4 ms·
Kexecboot: Linux-As-a-Bootloader implementation based on kexec
- zozbot234 7y agoInteresting. A kexecboot patch is widely available on Android, it gets used to provide a hackish multi-OS functionality. (The early boot environment brings up a multi-boot GUI, and the user can choose to continue booting or kexec a different kernel and system image.)
- joewee 7y agoStill requires installing twrp?
- spease 7y agoIs there a way to write a kernel directly to a boot sector and boot directly from it?
- kevinoid 7y agoFor EFI systems, the kernel includes a boot stub which allows it to be booted directly by the firmware without an additional bootloader. AFAIK it's not possible to boot directly via BIOS/MBR. https://www.kernel.org/doc/html/latest/admin-guide/efi-stub.html https://www.kernel.org/doc/html/latest/admin-guide/efi-stub....
- grapeli23 7y agoMinimal bootloader can fit in MBR. http://sebastian-plotz.blogspot.com/ http://sebastian-plotz.blogspot.com/
- charlesap 7y agoOr just turn on paging and page in your kernel from the MBR, ignoring the BIOS: https://github.com/charlesap/bootpager https://github.com/charlesap/bootpager EFI eliminates the need for such trickery though, and who doesn't have EFI these days?
- nineteen999 7y ago> who doesn't have EFI these days? VM's hosted on VMware ESX with the default settings comes to mind.
- tsuraan 7y agoSomewhat; if your system boots through EFI (as opposed to the ancient BIOS boot), then you can compile your kernel with the EFI_STUB option[0]. That kernel can be placed in EFI/Boot/bootx64.efi (or whatever you've configured your EFI to boot), and the EFI boot loader will run it without any other boot loader. IME, this goes very well with a built-in initramfs (INITRAMFS_SOURCE[1]), so you have a single-file kernel and ramfs that boots directly from EFI. [0] - https://www.kernel.org/doc/html/latest/admin-guide/efi-stub.html https://www.kernel.org/doc/html/latest/admin-guide/efi-stub.... [1] - https://github.com/torvalds/linux/blob/master/Documentation/driver-api/early-userspace/early_userspace_support.rst https://github.com/torvalds/linux/blob/master/Documentation/...
- Boulth 7y agoThat's right. I'm using this kind of setup on Arch (including Secure Boot signing of the EFI kernel).
- AnIdiotOnTheNet 7y agoI'm curious why there kernel needs to be specially compiled for this. Is it somehow impossible to build an EFI program that boots whatever is concatenated to the end of it? Is it similarly impossible to have the kernel boot an initramfs concatenated to the end of it? This would make it trivial to swap out the individual components without recompilation.
- newnewpdro 7y agoThe Linux kernel used to be a bootable MBR image, but I believe support for this was removed at some point. I used to build custom Linux kernels for rescue floppies that had no boot loader and a bundled rescue initramfs at an ISP back in the late 90s. They booted very quickly despite being 3.5" floppy disks, it was kind of epic for the time. http://tldp.org/HOWTO/Linux-i386-Boot-Code-HOWTO/bootsect.html http://tldp.org/HOWTO/Linux-i386-Boot-Code-HOWTO/bootsect.ht... Edit: It looks like 2.6.23 is when it vanished as part of the arch/i386/* -> arch/x86/* migration: Present @ 2.6.22: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/i386/boot/bootsect.S?h=v2.6.22 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... Gone in 2.6.23: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/i386/boot/?h=v2.6.23 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
- kevinoid 7y agoCould anyone familiar with this project comment on how it compares to kboot and petitboot? http://kboot.sourceforge.net/ http://kboot.sourceforge.net/ https://github.com/open-power/petitboot https://github.com/open-power/petitboot
- mmastrac 7y agoFrom a first glance, kboot seems to be unmaintained since 2007. Petitboot looks pretty good but doesn't do x86. Edit: https://www.plop.at/en/plopkexec/download.html https://www.plop.at/en/plopkexec/download.html might be a better alternative!
- kenz0r 7y agoPetitboot does do x86 - we're using it on an AMD x86-64 network appliance. https://opengear.com/products/om2200-operations-manager/ https://opengear.com/products/om2200-operations-manager/
- jabl 7y agoAlso linuxboot: https://www.linuxboot.org/ https://www.linuxboot.org/
- ewwhite 7y agoI've been using this kexec-reboot utility for years. https://github.com/error10/kexec-reboot https://github.com/error10/kexec-reboot
- jay7x 7y agoHi there! I'm one of kexecboot contributors. Just realized it's > 11 years old already! We're not active for last years but we're still alive. Feel free to adopt kexecboot to your device and make PR back! Thank you for raising attention too :) -- Jay7x