PetitBoot questions

Post Reply
arnysch
Posts: 4
Joined: Mon Aug 01, 2022 11:59 pm
languages_spoken: english
ODROIDs: M1
Has thanked: 1 time
Been thanked: 3 times
Contact:

PetitBoot questions

Post by arnysch »

Just bought the M1, my first desktop capable ARM system. Now experimenting with boot setup, trying to build a multiboot SSD (Armbian from rpardini, Debian 11, Ubuntu 20.04).

The PetitBoot concept which uses the kexec method is new to me, and I find it convincing. Much better than fiddling around with U-Boot.

Only I have two issues with PetitBoot:
  • PetitBoot seems remember e.g. a manually changed kernel command line, and I failed to find the place where this is saved.
  • Boot entries seem to be auto generated e.g. by these intricating /boot/boot.scr files. Isn't there a simpler way?
    For example rpardini's Armbian has a file /boot/extlinux/extlinux.conf which contains all necessary parameters as simple ASCII text. But PetitBoot seems ignore this file.
Now to answer above questions myself and maybe do modifications, I would like to see its source code including possible changes done for Odroid. AFAIK PetitBoot is GPL 2.0. Wondering: where can I find the sources for Odroid's PetitBoot?

User avatar
tobetter
Posts: 10320
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 667 times
Been thanked: 1764 times
Contact:

Re: PetitBoot questions

Post by tobetter »

arnysch wrote:
Tue Aug 02, 2022 2:35 am
  • PetitBoot seems remember e.g. a manually changed kernel command line, and I failed to find the place where this is saved.
Not really, it's not Petitboot thing at all. Petitboot only read the boot script from the storage where OS is installed and OS itself have to manage the boot script.
  • Boot entries seem to be auto generated e.g. by these intricating /boot/boot.scr files. Isn't there a simpler way?
    For example rpardini's Armbian has a file /boot/extlinux/extlinux.conf which contains all necessary parameters as simple ASCII text. But PetitBoot seems ignore this file.
The boot script boot.scr is in a binary format, it can be update with a command /usr/sbin/update-bootscript in Linux after booting by Petitboot. The kernel command line can be applied after changing the files in /usr/share/flash-kernel/ubootenv.d/vendor if you are with 4.19 kernel or /usr/share/flash-kernel/ubootenv.d/upstream with 5.x kernel. I hope this link helps you.
https://docs.linuxfactory.or.kr/guides/ ... t=boot.scr

In addition, Petitboot can read Grub configuration as a boot entry by Petitboot.

Code: Select all

sudo apt install odroid-grub2
sudo update-grub2
sudo reboot
These users thanked the author tobetter for the post:
arnysch (Wed Aug 03, 2022 11:31 pm)

arnysch
Posts: 4
Joined: Mon Aug 01, 2022 11:59 pm
languages_spoken: english
ODROIDs: M1
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: Success! Thank you! Example included here

Post by arnysch »

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.
These users thanked the author arnysch for the post:
tobetter (Wed Aug 03, 2022 11:35 pm)

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest