So petitboot (petitboot-nc) calls the executable pb-discover which calls the executable uboot-parser which is able to understand to a certain degree U-Boot scripts and Grub scripts. Looks complex, especially the script parsing. But it works.
When working with Grub, I personally do not like these grub updating scripts (like update-grub2). It is supposed to handle stuff automatically, but I am afraid if something does not work as expected, or if I want to have some special setup, then I have to learn both the basic and the higher level stuff. I find that working with the basic Grub commands is preferable.
Actually Grub seems not to be needed at all. It is sufficient to manually place text lines describing what to load in file /boot/grub/grub.cfg, and petitboot will find it.
For example without a/boot/boot.scr and with my /boot/grub/grub.cfg on the sda2:
Code: Select all
set UUID=224c6385-3275-428a-8016-6bca778dc627
menuentry "Armbian 20220728a-rpardini Jammy (1st entry in /boot/grub/grub.cfg)" {
linux /boot/Image root=UUID=$UUID console=tty0 console=ttyS02,1500000 loglevel=7 rootflags=data=writeback rw no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 bootsplash.bootfile=bootsplash.armbian
initrd /boot/uInitrd
devicetree /boot/dtb/rockchip/rk3568-odroid-m1.dtb
}
menuentry "Armbian 20220728a-rpardini Jammy Recovery (2nd entry in /boot/grub/grub.cfg)" {
linux /boot/Image root=UUID=$UUID console=tty0 console=ttyS02,1500000 loglevel=7 rootflags=data=writeback ro no_console_suspend consoleblank=0 S
initrd /boot/uInitrd
devicetree /boot/dtb/rockchip/rk3568-odroid-m1.dtb
}
... and with both an old existing /boot/boot.scr and with my/boot/grub/grub.cfg on my sda3:
Code: Select all
set UUID=7592f5a1-0f63-4196-a3c2-ba03b91d7fd0
menuentry "Debian GNU/Linux 11 (bullseye) (entry in /boot/grub/grub.cfg)" {
linux /boot/vmlinuz root=UUID=$UUID console=tty1 console=ttyS2,1500000 pci=nomsi fsck.mode=force fsck.repair=yes console=ttyS0,115200n8
initrd /boot/initrd.img
devicetree /boot/dtb
}
... the petitboot screen looks about like this:
Code: Select all
Petitboot (dev.20220424) Hardkernel ODROID-M1
--------------------------------------------------------------------------------
[Disk: sda2 / 224c6385-3275-428a-8016-6bca778dc627]
Armbian 20220728a-rpardini Jammy Recovery (2nd entry in /boot/grub/grub.cfg)
Armbian 20220728a-rpardini Jammy (1st entry in /boot/grub/grub.cfg)
[Disk: sda3 / 7592f5a1-0f63-4196-a3c2-ba03b91d7fd0]
Debian GNU/Linux 11 (bullseye)
Debian GNU/Linux 11 (bullseye) (entry in /boot/grub/grub.cfg)
[Disk: mmcblk1p1 / e9d5f39f-9f69-449c-b6e6-ca83c1de2c58]
Ubuntu 20.04.4 LTS
System information
System configuration
System status log
Language
Rescan devices
Retrieve config from URL
Plugins (0)
*Exit to shell
--------------------------------------------------------------------------------
Enter=accept, e=edit, n=new, x=exit, l=language, g=log, h=help
Some interesting points:
- A boot entry described by /boot/boot.scr is listed before boot entries described in /boot/grub/grub.cfg
- Boot entries from /boot/grub/grub.cfg are listed in reverse order on the petitboot screen
Addendum 2022-08-07: The "root=..." kernel command line parameter is ignored when the debian/ubuntu package
bootscript-odroidm1 is installed.
See
viewtopic.php?p=353410#p353410 for an explanation and how to resolve that.