Petitboot, yet another bootloader based on KEXEC

Post Reply
User avatar
tobetter
Posts: 8400
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 490 times
Been thanked: 1325 times
Contact:

Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

20201101

New Petitboot update image 20201101 is uploaded. In order to update with the new image, please attach HDMI cable and USB keyboard, go for Exit to shell from the Petitboot menu and do run the command pb-update. This will start to update new firmware and will reboot when finished.

Code: Select all

# pb-update
What's improved:
  • OLED will shows the IP address and MAC address
  • Booting issue of ArchLinux (leaded by @jgmdev) is resolved, but need more attetion to fix
In case the Petitboot does not start after updating?
For some reason, the update could fail. In such case, you will need to use the recovery image other than update image. For recovery, download the image from link and flash it to uSD card using dd or Etcher.
http://ppa.linuxfactory.or.kr/images/pe ... 201101.img

In order to start the recovery mode
1) Remove the storages attached and power cable attached to ODROID-HC4.
2) Keep attached HDMI cable to see if the recovery mode is started.
3) Flip the ODROID-HC4 case and pressing the boot select switch on bottom before power up.
4) Keep pressing the switch just until the blue LED lits, no more than it blinks.
5) If the boot select switch is pressed properly, recover mode will start and SPI flash will be updated.

Have fun with your ODROID!!
Attachments
IMG_20201101_1608502.jpg
IMG_20201101_1608502.jpg (112.87 KiB) Viewed 2345 times
These users thanked the author tobetter for the post (total 2):
superpowter77 (Sun Nov 01, 2020 5:27 pm) • istanbulls (Sun Nov 01, 2020 8:38 pm)

User avatar
mad_ady
Posts: 9703
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 609 times
Been thanked: 721 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by mad_ady »

Ha! Are you using the display in petitboot? cool!
These users thanked the author mad_ady for the post:
istanbulls (Sun Nov 01, 2020 8:39 pm)

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

mad_ady wrote:
Sun Nov 01, 2020 4:16 pm
Ha! Are you using the display in petitboot? cool!
Yep, that's from the Petitboot with the very vare minimal information for the network.
These users thanked the author tobetter for the post:
istanbulls (Sun Nov 01, 2020 8:39 pm)

User avatar
istanbulls
Posts: 585
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID; N2, C4, XU4, N2+, CH4
Location: Istanbul-Turkey
Has thanked: 362 times
Been thanked: 97 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by istanbulls »

We want an update like this in N2 and C4 !!! :D

i ordered new 1.54 ", 2.42", 1.3 "4 pin i2c displays, i have to try.
1.3 "sh1106 screen broke. :( "uncontrollable power is not power"

User avatar
mad_ady
Posts: 9703
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 609 times
Been thanked: 721 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by mad_ady »

With the risk of being chased around with a baseball bat, do you know what would be cool?
If you could mirror whatever text is selected in the petitboot screen on the oled. Presumably you could do it by writing the selection text to a text file in /tmp (from within petitboot) and have the oled screen read from it periodically.
That would allow you to operate petitboot with just the oled (not sure what possible advantage that would bring, but it would be cool!)

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

20201218

Update version from 20201218 is uploaded. The firmware can be updated in the Petitboot itself by running the command 'pb-update', or you can download firmware file from spiboot-20201218.img and copy it to your SD card as spiboot.img.

What's improved:
  • Support Amlogic compressed multi device tree format.

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

20201222

Update version from 20201222 is uploaded. The firmware can be updated in the Petitboot itself by running the command 'pb-update', or you can download firmware file from spiboot-20201222.img and copy it to your SD card as spiboot.img.

What's improved:
  • Multiple kernel boot entry from 'grub.cfg'
How to apply GRUB multiboot configuration.
Please do not use this feature if you are not familiar with this and use this at your own risk. This could cause the boot failure and not easy to recover if you don't know what to do.

Code: Select all

$ sudo apt update
$ sudo apt install odroid-grub
$ sudo update-grub2 
[sudo] password for tobetter: 
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.10.0-odroid-panfrost-arm64
Found initrd image: /boot/initrd.img-5.10.0-odroid-panfrost-arm64
Found linux image: /boot/vmlinuz-5.10.0-odroid-arm64
Found initrd image: /boot/initrd.img-5.10.0-odroid-arm64
Found linux image: /boot/vmlinuz-5.9.0-odroid-arm64
Found initrd image: /boot/initrd.img-5.9.0-odroid-arm64
Found linux image: /boot/vmlinuz-5.8.0-odroid-arm64
Found initrd image: /boot/initrd.img-5.8.0-odroid-arm64
Found Ubuntu 20.10 (20.10) on /dev/sda2
done
IMG_20201223_2346021.jpg
IMG_20201223_2346021.jpg (166.58 KiB) Viewed 2054 times
These users thanked the author tobetter for the post:
odroid (Thu Dec 24, 2020 10:28 am)

User avatar
istanbulls
Posts: 585
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID; N2, C4, XU4, N2+, CH4
Location: Istanbul-Turkey
Has thanked: 362 times
Been thanked: 97 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by istanbulls »

I wanted to enlarge the fonts, I broke Petitboot. The blue led is on steady, I wanted to re-install with the uSD, but the blue led is always on.

I tried pressing the pin under the HC4 but it didn't boot from the uSD.

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

istanbulls wrote:
Sat Jan 09, 2021 7:08 pm
I wanted to enlarge the fonts, I broke Petitboot. The blue led is on steady, I wanted to re-install with the uSD, but the blue led is always on.

I tried pressing the pin under the HC4 but it didn't boot from the uSD.
Did you press the button until the blue LED on?

User avatar
istanbulls
Posts: 585
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID; N2, C4, XU4, N2+, CH4
Location: Istanbul-Turkey
Has thanked: 362 times
Been thanked: 97 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by istanbulls »

tobetter wrote:
Sat Jan 09, 2021 7:30 pm
istanbulls wrote:
Sat Jan 09, 2021 7:08 pm
I wanted to enlarge the fonts, I broke Petitboot. The blue led is on steady, I wanted to re-install with the uSD, but the blue led is always on.

I tried pressing the pin under the HC4 but it didn't boot from the uSD.
Did you press the button until the blue LED on?
yes, the blue led is not lit.
Where can I find the recovery image. I just found the ones for N2.

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

istanbulls wrote:
Sat Jan 09, 2021 7:33 pm
tobetter wrote:
Sat Jan 09, 2021 7:30 pm
istanbulls wrote:
Sat Jan 09, 2021 7:08 pm
I wanted to enlarge the fonts, I broke Petitboot. The blue led is on steady, I wanted to re-install with the uSD, but the blue led is always on.

I tried pressing the pin under the HC4 but it didn't boot from the uSD.
Did you press the button until the blue LED on?
yes, the blue led is not lit.
Where can I find the recovery image. I just found the ones for N2.
Ah...tried N2 image? :) Download the recovery image for HC4.
http://ppa.linuxfactory.or.kr/images/pe ... 222.img.xz

User avatar
istanbulls
Posts: 585
Joined: Tue May 14, 2019 10:18 pm
languages_spoken: Turkish
ODROIDs: ODROID; N2, C4, XU4, N2+, CH4
Location: Istanbul-Turkey
Has thanked: 362 times
Been thanked: 97 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by istanbulls »

tobetter wrote:
Sat Jan 09, 2021 7:35 pm
istanbulls wrote:
Sat Jan 09, 2021 7:33 pm
tobetter wrote:
Sat Jan 09, 2021 7:30 pm
istanbulls wrote:
Sat Jan 09, 2021 7:08 pm
I wanted to enlarge the fonts, I broke Petitboot. The blue led is on steady, I wanted to re-install with the uSD, but the blue led is always on.

I tried pressing the pin under the HC4 but it didn't boot from the uSD.
Did you press the button until the blue LED on?
yes, the blue led is not lit.
Where can I find the recovery image. I just found the ones for N2.
Ah...tried N2 image? :) Download the recovery image for HC4.
http://ppa.linuxfactory.or.kr/images/pe ... 222.img.xz
Recovery image for N2 is usually 50mb. :)
The image in the link you gave is 8mb. I thought of it as Update image and tried it with Recovery image for N2. :D
I wrote the image in the link you provided to the uSD card, now the update has started :)

jnohlgard
Posts: 4
Joined: Thu Jan 21, 2021 11:59 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by jnohlgard »

Hi,
Where can I find the sources for the current version of petitboot for HC4 (20201222)?
This repo has not been updated in the last two years https://github.com/tobetter/petitboot

jnohlgard
Posts: 4
Joined: Thu Jan 21, 2021 11:59 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by jnohlgard »

I have two issues that can be manually worked around, but it is a pain to do it manually on every reboot so I would like to fix it in petitboot.

First issue:

If the size of the uncompressed kernel + compressed initrd image + dtb exceeds 0x5000000 bytes (80 MiB), then the boot will hang after kexec -e because the initrd gets written into the memory region reserved for BL31 (secmon in dtb). I don't have any knowledge about BL31 or what it is for, but simply avoiding that region makes the boot succeed.

Workaround:

Run kexec manually and add

Code: Select all

--mem-min 0x5300000
to the kexec -l command line.

Second issue:

The root= parameter on the kernel command line gets translated from root=UUID=abcdef1234567 into root=/dev/mmcblk1pX, which messes up the boot because for some reason, the SD card slot shows up as /dev/mmcblk1 in the petitboot system, while when I launch my real kernel it will be detected at /dev/mmcblk0, so using UUID to find the partition is just plain better here.

Workaround:

Run kexec manually with the right root= parameter

These two issues makes petitboot pretty useless on my system, except that I don't have to mess with Uboot scripts. I am experienced enough that I can manually launch the kernel via kexec from the command line so at least I have a working system. However, I might have to revert to using uboot on SD card instead to avoid the need for manual typing (or manual copy pasting over serial console) to boot.

Why is the kernel + initrd bigger than 80 MiB?

I am experimenting with running an upstream Fedora kernel (with some small patches for hardware support, but staying close to the upstream config) which has a systemd based initrd with the ignition provisioning system and lots of kernel modules included.

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

jnohlgard wrote:
Fri Jan 29, 2021 1:57 am
I have two issues that can be manually worked around, but it is a pain to do it manually on every reboot so I would like to fix it in petitboot.

First issue:

If the size of the uncompressed kernel + compressed initrd image + dtb exceeds 0x5000000 bytes (80 MiB), then the boot will hang after kexec -e because the initrd gets written into the memory region reserved for BL31 (secmon in dtb). I don't have any knowledge about BL31 or what it is for, but simply avoiding that region makes the boot succeed.

Workaround:

Run kexec manually and add

Code: Select all

--mem-min 0x5300000
to the kexec -l command line.
Good to know if you solve the issue with the parameter, can you let me know how the address 0x5300000 is determined?
Second issue:

The root= parameter on the kernel command line gets translated from root=UUID=abcdef1234567 into root=/dev/mmcblk1pX, which messes up the boot because for some reason, the SD card slot shows up as /dev/mmcblk1 in the petitboot system, while when I launch my real kernel it will be detected at /dev/mmcblk0, so using UUID to find the partition is just plain better here.

Workaround:

Run kexec manually with the right root= parameter
There is two issue to use the device node instead of root=UUID=xxxx.
1. Most open source OS team build the image does not change the UUID on the first boot. In case if there is two memory cards flash with same OS image but having different OS setup cannot make boot properly.
2. I do not remember correctly which was, it's been about a year ago. Its initram fs was not able to read UUID of the root file system after the Petitboot. So the Petitboot change the 'root=UUID=xxx' to 'root=/dev/xxx'.
These two issues makes petitboot pretty useless on my system, except that I don't have to mess with Uboot scripts. I am experienced enough that I can manually launch the kernel via kexec from the command line so at least I have a working system. However, I might have to revert to using uboot on SD card instead to avoid the need for manual typing (or manual copy pasting over serial console) to boot.

Why is the kernel + initrd bigger than 80 MiB?

I am experimenting with running an upstream Fedora kernel (with some small patches for hardware support, but staying close to the upstream config) which has a systemd based initrd with the ignition provisioning system and lots of kernel modules included.
I've built new Petitboot for your two issues.
http://ppa.linuxfactory.or.kr/images/pe ... 210129.img

1. KEXEC will run with "--mem-min=0x5300000" as you discovered but I'd like to be sure how 0x5300000 is determined. :)
2. Still need to keep using 'root=/dev/xxx' instead of 'root=UUID=xxx" as I explained. But for your 2nd problem, I've made a change to bypass the 'root=UUID=xxx' as-is if you set the flag to the Petitboot. The flag can be set with this command in the Petitboot and this change will work on next rebooting.

Code: Select all

fw_setenv rootuuid true

jnohlgard
Posts: 4
Joined: Thu Jan 21, 2021 11:59 pm
languages_spoken: english
ODROIDs: HC4
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by jnohlgard »

The 0x5300000 comes from the comment in the Linux dts files that show that the secmon reserved section starts at 0x5000000 and is 0x300000 (3 MiB) long. https://github.com/torvalds/linux/blob/ ... i#L98-L102

Thanks for the binary, but what about the source code? Can I get a copy of the sources somewhere?

amibumping
Posts: 2
Joined: Wed Feb 10, 2021 9:13 pm
languages_spoken: spanish
ODROIDs: HC4
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by amibumping »

Hi, yesterday I received my HC4, and I tried to update petitboot, but running the command pb-update does nothing, it says that I should go to an URL: http://ppa.linuxfactory.or.kr/images/pe ... hc4/latest, I finally updated manually to version 20201222.img but I don't know if is the latest stable, or if the command should run.

Thank you.

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

Re: Petitboot, yet another bootloader based on KEXEC

Post by tobetter »

amibumping wrote:
Wed Feb 10, 2021 9:16 pm
Hi, yesterday I received my HC4, and I tried to update petitboot, but running the command pb-update does nothing, it says that I should go to an URL: http://ppa.linuxfactory.or.kr/images/pe ... hc4/latest, I finally updated manually to version 20201222.img but I don't know if is the latest stable, or if the command should run.

Thank you.
No worries, you already have the latest one (20201222).

amibumping
Posts: 2
Joined: Wed Feb 10, 2021 9:13 pm
languages_spoken: spanish
ODROIDs: HC4
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by amibumping »

tobetter wrote:
amibumping wrote:
Wed Feb 10, 2021 9:16 pm
Hi, yesterday I received my HC4, and I tried to update petitboot, but running the command pb-update does nothing, it says that I should go to an URL: http://ppa.linuxfactory.or.kr/images/pe ... hc4/latest, I finally updated manually to version 20201222.img but I don't know if is the latest stable, or if the command should run.

Thank you.
No worries, you already have the latest one (20201222).
Thank you for the fastest response!

Enviado desde mi Mi 9T mediante Tapatalk


eriwei123
Posts: 2
Joined: Sun Feb 28, 2021 9:40 am
languages_spoken: english
ODROIDs: HC4
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by eriwei123 »

Hi all,

I deleted my petitboot bootloader to fix my missing hdmi output wenn booting armbian from sd card which did not realy work. Now i want to recover petitboot but i´m not succsessful regardless which hc4 recovery image i try. When I write the image to the micro SD card with etcher and then try to start the odroid with the button on the bottom pressed, only the red led lights up, even if wait for a long time keeping the button pressed. I tried two different sandisk cards. Anny suggestions? should i try another card?

P.S. When I try to boot the armbian image, while pressing the button, the blue led starts blinking but I there is no display output. the odroid seems to have a problem with my display now even though it worked fine, when still had petitboot.

User avatar
mad_ady
Posts: 9703
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 609 times
Been thanked: 721 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by mad_ady »

If you've erased petitboot you don't need to press the button anymore. Try booting the recovery sd normally and leave it on (even if display doesn't work) for at least 10 minutes.

eriwei123
Posts: 2
Joined: Sun Feb 28, 2021 9:40 am
languages_spoken: english
ODROIDs: HC4
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Post by eriwei123 »

@mad_ady: Thanks for the advise but this seems not to work. I now have found an old monitor which works with the hc4 but the recovery doesn´t seem to work. Could it be, that the recovery only works with certain sd cards?
??

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 0 guests