[SOLVED] Looking for detailed Grub2 instructions...
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
Looking for detailed Grub2 instructions...
Nevermind. I figured it out. Grub2 is a poorly documented pain in the buns. It would help if they explained about the grub-core. Not to mention having a configure switch to build the core for multiple BIOS types on x86.
i.e. --include-platforms=i386-pc,i386-efi,x86_64-efi
...and those resultant builds would appear in /usr/lib/grub
Any idea what you would want to try?
I'd be interested to hear if you find anything that works (or that perhaps does not work, and what's wrong with it).
It gets most of the grub.cfg right. In arch the initrd only has the intel microcode and not the initrd image to boot by default, so manually edit to include both. In debian if you rsync an install to a new partition you'll likely need to edit the UUID in the grub.cfg manually as well. Rinse and repeat every time the kernel updates or something changes that runs update-grub. Various chainloading grub (configfile) to grub, and "c" command mode or "e" to edit a menu item to jump hurdles.
There was an effort to rewrite grub called burg (grub backwards). Although a terrible name that's impossible to google. Various plop / btmgr loaders as well as lilo if grub blows too much. And refind if your 32 bit UEFI boots a 64 bit distro. Just some existing options. Although most make grub look modern in comparison. Baring other board types that only allow uboot.
I use lilo, which is easy if you have Crux on the same machine. If you don't you will need to get source code and Pkgfile scripts for lilo and bin86 from the Crux core repository.
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Original Poster
Rep:
Quote:
Originally Posted by Shadow_7
$ sudo grub-install /dev/...
$ sudo update-grub
It gets most of the grub.cfg right. In arch the initrd...
Grub config isn't the problem and grub-update wouldn't effect a livecd/usb anyway. The problem is the bootloader itself. To create a multi-start grub rescue you need the grub-core built for multiple environments. If you use the LFS build instructions it will only build for the platform you're on. That's fine if you built on an int 13H machine (read: BIOS booting MBR) and were planning on using the disk only for other BIOS booting machines. But, what if you're running on an UEFI 64 machine and you need to make a rescue disk for a BIOS machine, or a EFI386 machine? You're SOL because a BIOS booting machine needs an eltorito noemu bootloader installed on the CD/DVD/USB.
Live distro's get around this by creating multi-start CD/DVDs, etc. The image contains eltorito noemu, and EFI platform bootloaders. The Grub instructions don't explain how to do this. I finally figured it out, but it was a pain. I can explain it here if anyone is interested, but I'm not going to unless someone speaks and asks for it. Because, that whole process is lengthy.
Edit: There's a reason so many distros recommend efibootmgr for efi systems. Build grub2 wrong, or be missing a specific kernel module when executing grub-install on an efi system and it will fail. :/
One of a million that has absolutely nothing to do with the subject at hand: grub as a live distro bootloader for multiple BIOS types. I know how to write a grub.cfg.
depending on if issuing grub-install from bios or efi: "grub-install --target=x86-64.efi" if issuing from bios or "grub-install --target=i386-pci" if issuing from efi. to install to the other format. For efi will have to copy the grubx64.efi to /boot/efi/EFI/BOOT/bootx64.efi
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Original Poster
Rep:
Quote:
Originally Posted by colorpurple21859
depending on if issuing grub-install from bios or efi: "grub-install --target=x86-64.efi" if issuing from bios or "grub-install --target=i386-pci" if issuing from efi. to install to the other format. For efi will have to copy the grubx64.efi to /boot/efi/EFI/BOOT/bootx64.efi
grub-install --target=x86_64-efi will not work if you didn't not either build on that platform or didn't compile and additional grub-core for it. You'll know if it's there or not by looking at /usr/lib/grub. A directory will be listed there for each platform grub has a built bootloader for. Check your slackware distro. They did it correctly and there should be multiple platform directories in there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.