[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pause GRUB booting
Re: Pause GRUB booting
Tue, 11 Apr 2017 20:58:54 +0300
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
11.04.2017 18:59, Robert Middleton пишет:
> I'm trying to modify GRUB to pause booting if a user presses a button
> that is connected to a USB<->Serial converter. This is a bit of an
> odd situation, so here's a quick overview:
> On occasion, we need to allow end-users to pause booting to allow for
> HDD recovery. This can only happen before GRUB attempts to write to
> the HDD,
GRUB does not write anything; the only possible write is save_env
command that must be called explicitly in grub.cfg.
> otherwise the system stays broken. The system has no
> keyboard, but it does have hard buttons that send a serial message
> over an FTDI usb to serial converter.
Note that right now GRUB ftdi driver only supports QEMU emulated USB
serial, so you will likely need to extend it.
> I have tried editing grub.cfg
> to insert the FTDI module, but I don't see exactly how to read data
> from an arbitrary serial port and continue on if there is no data on
> the serial line.
This is similar to what was requested before. I think we need to add
support for timeout as well as raw character to read. Actually there was
patch at least for timeout as far as I remember. Currently I'm afraid
there is no way to poll for character with timeout on CLI level.
> There are also about 6 FTDIs on the system, so
> knowing which one to read from is important.
Actually GRUB supports multiple input (and output) devices so you could
add all of them as input device and read would poll all of them. Vut see
I would not know how to distinguish between 6 identical USB devices in
> My backup plan is to
> pause the boot for 30 seconds each time, but I'm trying to avoid
> that(plus the wait still has to happen before any data gets written to
> the disk).
> Is this possible to achieve, or would it require hacking of GRUB code
You will need to hack code. The most obvious is to extend read to
timeout or return after fixed amount of characters (e.g. 1) are seen.
As for multiple FTDI inputs, I am not sure currently whether
programmatic solution exists. You will likely need to extend
terminal_input (and terminal_output) command to either accept wildcards,
or put output into variable for further post-processing.
- Pause GRUB booting, Robert Middleton, 2017/04/11
- Re: Pause GRUB booting,
Andrei Borzenkov <=