Skip to contentSkip to conversation

the rootcause of the grub2 that can support USB keyboard

DISCUSSION Sherry Zhang(BJ-RD) 2 participants 2 messages Aug 21, 2018 – Aug 22, 2018

lore
Share & tools
lore
#0 lore raw

Hi all,

Rencently, I have learned the GRUB2. And I have a question about it.

The first experiment:

Platform: i386-pc
Sata : MBR format

I have read the grub-2.02 source code and I find the core.img including the modules : ext2 part_msdos biosdisk I delete the grub.cfg in the "/boot/grub/grub/cfg",so the system will enter the command-line of the grub. So the grub only has modules as followings:
Name Ref count Dependencies

Minicmd          1
Normal           1                       buf io,gettext,terminal,crypto,extcmd,boot
Gzio             0

Bufio 1
Gettext 1
Terminal 2
Crypto 2
Extcmd 2
Boot 2
Biosdisk 1
Part_msdos 1
Ext2 1 fshelp
Fshelp 2

But I have found the USB keyboard module-usb_keyboard.mod that I don't load , So why the usb keyboard can be used when I don't load usb modules?

Best regards,
Sherry Zhang

?????
?????????????????????????????????????????????????????
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.

#1 lore raw

Hi,

Quoted 3 lines · Sherry Zhang(BJ-RD)

But I have found the USB keyboard module-usb_keyboard.mod that I don't load ,
So why the usb keyboard can be used when I don't load usb modules?

A better question is, why does "module-usb_keyboard.mod" exist in the first place? In theory, GRUB should be able to use whatever the firmware provides to access key presses and shouldn't need a module at all.

However, there were a few incredibly dodgy computers (mostly "late 1990s" time frame?) where the firmware expects a PS/2 keyboard and firmware's keyboard support doesn't work with a USB keyboard. GRUB probably provides a "module-usb_keyboard.mod" so that USB keyboards will work properly on these incredibly dodgy computers.

Note: I'm not a GRUB developer or anything, I just know how much computers can suck. ;-)

- Brendan