1

From documentation I know that:

Chain-loading is only supported on PC BIOS and EFI platforms.

Is it possible to use native drivers (provided by nativedisk command) with chainloader command? If not, why? Did this feature not implemented yet or is it not theoretically possible to implement it?

1

As far as I know, those two features are independent of each other.

nativedisk is just one of the ways GRUB can access the disks. But if the firmware does not support accessing the disk where the chainloaded bootloader is located, then the chainloaded second bootloader would need to also include its own drivers... or else it might be incapable of continuing the boot process alone because it cannot access the disk it was loaded from without outside help. (If the second bootloader relies on GRUB's drivers, then that's not true chainloading, but more like being an add-on module for GRUB.)

Supporting chain-loading requires that GRUB can load the chained bootloader exactly the same way the firmware would have done it. In case of PC BIOS, it's a simple matter of copying the loaded code to a known memory address and jumping to it. In case of EFI, the EFI Boot Services will provide the necessary functionality: basically GRUB2 just tells the EFI firmware "please run this file instead of me" and the firmware does exactly that.

In other architectures, the firmware might do something in the process of loading GRUB that cannot be trivially undone. Or perhaps there has been no need to add chainloading support for some of the other architectures so far.

When implementing chain-loading for new architectures, you will need to know and replicate what the firmware would otherwise do. Typically, the firmware will give the bootloader some information about the hardware it's booting from. If you use GRUB's nativedisk drivers to extend functionality beyond what the firmware can do, you may have a problem: if the firmware could not provide the necessary boot information, will your chainloading routine be able to provide meaningful replacements for whatever the chainloaded bootloader will need? All this will be very much platform-specific: it might be doable on one platform and impossible on another.

3
  • Thank you for your response! I'll try to explain my case. I provide the following experiment: I take two Flash drives, install GRUB2 to one and any Linux image to second (with dd or unetbooin). Then I execute nativedisk, chainloader (usb1)+1, boot. Then I have kernel panic. My architecture is x86 PC BIOS. May be I do something wrong? – synteru Jul 31 '20 at 11:09
  • A Linux kernel panic would indicate that GRUB did its job of loading the kernel and initramfs, and has already started the Linux kernel. At that point GRUB and its drivers will no longer have any effect on what happens next. Most commonly a kernel panic indicates a failure to mount the real root filesystem, so check your root= kernel boot parameter and make sure your initramfs has all the necessary Linux drivers and utilities (e.g. LVM tools or cryptsetup, if you use LVM or disk encryption respectively) you'll need to access and mount the root filesystem. – telcoM Jul 31 '20 at 12:10
  • "Kernel panic" isn't right term. GRUB2 doesn't do anything after boot command. Only Ctrl-Alt-Del works properly after that. But I think you've answered to my question and problem lies in another dimension. Thank you, @telcoM! I'll create a new question for this problem. – synteru Jul 31 '20 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.