Petitboot, yet another bootloader based on KEXEC

Sholander
Posts: 46
Joined: Wed Jun 05, 2019 1:02 am
languages_spoken: english
ODROIDs: ODROID N2
Has thanked: 0
Been thanked: 4 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Sholander » Mon Aug 12, 2019 5:09 am

From where can I download "RC3 version of Petitboot" ? The last version I have is "201907-RC1"

User avatar
mad_ady
Posts: 6862
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 237 times
Been thanked: 177 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by mad_ady » Mon Aug 12, 2019 6:01 am

Look for it a few pages back in a post from @tobetter.
@tobetter: maybe you should make it official and put it on the wiki

woodyl
Posts: 18
Joined: Mon Aug 05, 2019 2:04 am
languages_spoken: english
ODROIDs: Odroid N2
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by woodyl » Mon Aug 12, 2019 11:48 pm

Is it possible to set up Petitboot to automatically set the HDMI display resolution? I'm using an HDMI-to-VGA adapter that only supports up to 720p. When I boot into an OS (Arch in this case), the bootloader automatically detects the resolution so that the display works, but it doesn't work with Petitboot. Here's another idea: I know that Petitboot scans through the attached devices to find a boot.ini file. What if it first looked through all the devices to find a 'petitboot.ini' file? Then, you could set parameters to stop booting and revert to Petitboot with various options set. You could set screen resolution, e.g. That would let you start up in Petitboot without having to disconnect the device your OS is mounted on. Maybe you could reboot from Petitboot and bypass the petitboot.ini file on the reboot.

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Tue Aug 13, 2019 11:30 am

woodyl wrote:
Mon Aug 12, 2019 11:48 pm
Is it possible to set up Petitboot to automatically set the HDMI display resolution? I'm using an HDMI-to-VGA adapter that only supports up to 720p. When I boot into an OS (Arch in this case), the bootloader automatically detects the resolution so that the display works, but it doesn't work with Petitboot. Here's another idea: I know that Petitboot scans through the attached devices to find a boot.ini file. What if it first looked through all the devices to find a 'petitboot.ini' file? Then, you could set parameters to stop booting and revert to Petitboot with various options set. You could set screen resolution, e.g. That would let you start up in Petitboot without having to disconnect the device your OS is mounted on. Maybe you could reboot from Petitboot and bypass the petitboot.ini file on the reboot.
Somehow display autodetection code in the Linux kernel does not work properly in the Petitboot, this issue is not fixed yet, unfortunately. I do not clearly understand the suggestion. Are you meaning to let Petitboot can set the boot configuration?

User avatar
mad_ady
Posts: 6862
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 237 times
Been thanked: 177 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by mad_ady » Tue Aug 13, 2019 1:38 pm

I think we're looking for a way to bypass resolution autodetection and force a specific resolution instead. This could be done either by hardcoding it and building a custom petitboot or by parsing a separate "petitboot.ini" config file.
I remember that c2 had a c2_init.sh file that ran in the initrd and set the manual resolution by grabbing it from the kernel command line. It was setting it via sysfs if I remember correctly. Is there something similar for n2's startup?

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Tue Aug 13, 2019 1:55 pm

mad_ady wrote:
Tue Aug 13, 2019 1:38 pm
I think we're looking for a way to bypass resolution autodetection and force a specific resolution instead. This could be done either by hardcoding it and building a custom petitboot or by parsing a separate "petitboot.ini" config file.
I remember that c2 had a c2_init.sh file that ran in the initrd and set the manual resolution by grabbing it from the kernel command line. It was setting it via sysfs if I remember correctly. Is there something similar for n2's startup?
I was thinking of the way to add a new section u-boot like this in case display auto detection cannot be resolved.

Code: Select all

  1 [u-boot]
  2 hdmimode=1080p60hz
  3 
  4 [petitboot]
  5 petitboot,interface=eth0
  6 petitboot,timeout=5
  7 petitboot,console=ttyS0,115200n8
  8 petitboot,bootdevs=network,any,
  9 petitboot,autoboot=true
 10 petitboot,http_proxy=
 11 petitboot,https_proxy=
 12 petitboot,write?=true
These users thanked the author tobetter for the post:
binhex (Tue Aug 13, 2019 6:05 pm)

User avatar
mad_ady
Posts: 6862
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 237 times
Been thanked: 177 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by mad_ady » Tue Aug 13, 2019 2:26 pm

Sure, but that would be more work for you

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Tue Aug 13, 2019 2:36 pm

mad_ady wrote:
Tue Aug 13, 2019 2:26 pm
Sure, but that would be more work for you
always...

woodyl
Posts: 18
Joined: Mon Aug 05, 2019 2:04 am
languages_spoken: english
ODROIDs: Odroid N2
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by woodyl » Wed Aug 14, 2019 2:04 am

The idea I suggested of having the petitboot.ini file would provide more options than just setting the HDMI resolution. If we could do something like that, it would avoid the necessity of hardcoding various options into Petitboot. So, my idea is that PB is now scanning the first partition of of each drive looking for boot.ini. What I'm proposing is that it would first scan the partition for petitbooot.ini, then if it didn't find one, it would go on to scan for boot.ini as usual. If it finds petitboot.ini, it could load options from there. For instance, it could set HDMI resolution, then revert back to booting Petitboot instead of booting into the boot.ini. That way, you could interact with Petiboot, check the version, etc. On reboot, you could have the option to skip petitboot.ini on the next reboot. That's just one idea. I think that people who know more about it than I do can think of some other possibilities with such a setup. The main thing is that it would provide flexibility and reduce the need to hardcode everything somebody wants to do into PB itself.

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Wed Aug 14, 2019 5:02 am

Hello.
I booted my N2 from SSD using petitboot without issue. Since few days, my N2 doesn't boot anymore.
The SSD is well detected by petitboot and both partitions are well mounted and accessible.
As usual petitboot start to boot the SSD after 10s but even after waiting few minutes, I haven't the login prompt on the console.

For sure there is something wrong during the boot process. How can I see all steps of the boot process on the console ? I always had black screen until the login prompt.

Thank you.

elatllat
Posts: 1584
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2
Has thanked: 24 times
Been thanked: 71 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by elatllat » Wed Aug 14, 2019 11:28 am

Viald wrote:
Wed Aug 14, 2019 5:02 am
... How can I see all steps of the boot process on the console ?...
buy a uart cable or edit console out of boot.ini

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Wed Aug 14, 2019 12:26 pm

Viald wrote:
Wed Aug 14, 2019 5:02 am
Hello.
I booted my N2 from SSD using petitboot without issue. Since few days, my N2 doesn't boot anymore.
The SSD is well detected by petitboot and both partitions are well mounted and accessible.
As usual petitboot start to boot the SSD after 10s but even after waiting few minutes, I haven't the login prompt on the console.

For sure there is something wrong during the boot process. How can I see all steps of the boot process on the console ? I always had black screen until the login prompt.

Thank you.
Which OS is in your SSD?
Can you add console=tty1 to the boot.ini on your SSD?
These users thanked the author tobetter for the post:
Viald (Thu Aug 15, 2019 2:29 am)

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Wed Aug 14, 2019 2:59 pm

Ubuntu, I'll try. Thanks

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Thu Aug 15, 2019 2:30 am

Thank you Tobetter, I can now see the boot steps and I was able to correct the issue.

karog
Posts: 22
Joined: Fri Oct 09, 2015 3:28 am
languages_spoken: english
ODROIDs: XU4,N2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by karog » Thu Aug 15, 2019 2:34 am

@Vlald, so what was the issue? It is always helpful to others what issues may arise. So a post saying you fixed the problem is less helpful than one that states what the problem and solution was for fellow travelers, even if you may think it is unique to you. Thx

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Thu Aug 15, 2019 3:27 am

You are right. In fact, the issue comes from /etc/fstab I had added USB disk which was not plugged anymore. The system started in maintenance mode. Until I was not able to see the boot steps, I was not able to guess my mistake too ;)

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Mon Aug 19, 2019 1:31 am

No sure that this issue could comes from Petitboot. I just ask ;)

I have added 3 more USB disks for data storage only (no boot)
I have a Kernel panic at boot time when I boot with the 3 more USB disks plugged.
According the boot log, the boot disk is sda and the root partition sda2.
IMG_20190818_173901.jpg
IMG_20190818_173901.jpg (597.71 KiB) Viewed 3090 times

It seems that the kernel try to recognize a partition which doesn't exist sdd2

Code: Select all

root@Capsule:/etc/modprobe.d# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 1B415BE1-03C3-4DB4-8250-0FD7DE09B560

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048 9767541133 9767539086  4.6T Linux filesystem

Command (m for help): q

root@Capsule:/etc/modprobe.d# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdc: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 0B1B8626-FEFD-4215-A9B3-EDE09718E81C

Device     Start        End    Sectors  Size Type
/dev/sdc1   2048 9767541133 9767539086  4.6T Linux filesystem

Command (m for help): q

root@Capsule:/etc/modprobe.d# fdisk /dev/sdd

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdd: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 291DECBA-E73F-4299-A527-5F545E1D6766

Device     Start        End    Sectors  Size Type
/dev/sdd1   2048 9767541133 9767539086  4.6T Linux filesystem
If I boot without, and plug the 3 USB disks after the system has started, everything is OK.

Code: Select all

root@Capsule:/etc/modprobe.d# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
|-sda1   8:1    0   128M  0 part /media/boot
|-sda2   8:2    0   220G  0 part /
`-sda3   8:3    0   6.4G  0 part [SWAP]
sdb      8:16   0   4.6T  0 disk 
`-sdb1   8:17   0   4.6T  0 part /media/usb0
sdc      8:32   0   4.6T  0 disk 
`-sdc1   8:33   0   4.6T  0 part /media/usb1
sdd      8:48   0   4.6T  0 disk 
`-sdd1   8:49   0   4.6T  0 part /media/usb2

karog
Posts: 22
Joined: Fri Oct 09, 2015 3:28 am
languages_spoken: english
ODROIDs: XU4,N2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by karog » Mon Aug 19, 2019 1:47 am

When you have a bunch of disks, it is a crap shoot which drive letter they will get. What is root= in your boot.ini? Are you using UUID or PARTUUID or something less reliable?

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Mon Aug 19, 2019 2:23 am

I use UUID

Code: Select all

root=UUID=e139ce78-9841-40fe-8823-96a304a09859

Code: Select all

/dev/sda1: SEC_TYPE="msdos" LABEL="BOOT" UUID="F702-39CB" TYPE="vfat" PARTUUID="03823826-01"
/dev/sda2: LABEL="rootfs" UUID="e139ce78-9841-40fe-8823-96a304a09859" TYPE="ext4" PARTUUID="03823826-02"
/dev/sda3: UUID="a607fa8c-7f6d-4388-b982-96e3e7b6edd5" TYPE="swap" PARTUUID="03823826-03"
/dev/sdb1: UUID="5d3f8c1f-0bad-4b66-8d92-8ed2567f8b21" TYPE="ext4" PARTUUID="84985b8f-347f-4ad2-8e9a-08ff683bd061"
/dev/sdc1: UUID="4e21d475-01a8-4f85-807b-b9c7f0cc4f63" TYPE="ext4" PARTUUID="ee264c45-9d2c-4564-ab93-5713782c0eee"
/dev/sdd1: UUID="0bb85373-7890-45cf-9a5c-efd8b435baf4" TYPE="ext4" PARTUUID="a9a8d95f-f741-4d83-b08a-4bdee91717de"

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Wed Aug 21, 2019 6:22 pm

In fact it's a bug from petitboot. See here for details and workaround. viewtopic.php?f=177&p=266352#p266352

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Wed Aug 21, 2019 6:24 pm

Viald wrote:
Wed Aug 21, 2019 6:22 pm
In fact it's a bug from petitboot. See here for details and workaround. viewtopic.php?f=177&p=266352#p266352
Sorry...For some reason, I've missed your post here. But glad to know the trick using root=PARTUUID=... instead of root=UUID=... works.

Viald
Posts: 60
Joined: Thu Aug 01, 2019 6:47 am
languages_spoken: english
Has thanked: 7 times
Been thanked: 3 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Viald » Wed Aug 21, 2019 6:30 pm

No problem ;)

woodyl
Posts: 18
Joined: Mon Aug 05, 2019 2:04 am
languages_spoken: english
ODROIDs: Odroid N2
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by woodyl » Thu Aug 29, 2019 11:34 pm

Does Petitboot read environment variables from a uEnv.txt file?

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Aug 30, 2019 12:26 am

woodyl wrote:
Thu Aug 29, 2019 11:34 pm
Does Petitboot read environment variables from a uEnv.txt file?
Nope, what is uEnv.txt?

woodyl
Posts: 18
Joined: Mon Aug 05, 2019 2:04 am
languages_spoken: english
ODROIDs: Odroid N2
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by woodyl » Fri Aug 30, 2019 12:37 am

Some u-boots read environment variables from a uEnv.txt from attached media during boot up:
https://www.linuxjournal.com/content/handy-u-boot-trick

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Aug 30, 2019 12:48 am

woodyl wrote:
Fri Aug 30, 2019 12:37 am
Some u-boots read environment variables from a uEnv.txt from attached media during boot up:
https://www.linuxjournal.com/content/handy-u-boot-trick
U-boot env for Petitboot is sitting in SPI flash memory along with Petitboot but not able to change it as of now. There was a short discussion to set boot U-boot env in order to set display resolution which I was planning to use 'petitboot.cfg', but not finished the implementation yet. Can you share what's your use case using uEnv.txt?

woodyl
Posts: 18
Joined: Mon Aug 05, 2019 2:04 am
languages_spoken: english
ODROIDs: Odroid N2
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by woodyl » Fri Aug 30, 2019 2:09 am

I'm not sure how petitboot.cfg works or where it occurs in the boot process. I think uEnv.txt is fairly standard. I'm running Arch Linux ARM on some Pogoplug SBCs. The u-boot for these devices has environmental variables that normally reside in nand, along with the u-boot. The uEnv.txt file contains environmental variables that can temporarily overwrite the variables that are stored in nand. This is useful, for instance, to set variables to mount a drive at a particular /dev location, specify boot images, etc. One way that works is that you can set up somewhat generic values in the firmware, then override them when you want to mount a different OS, etc. I think that uEnv.txt and petitboot.cfg probably serve the same purpose. The goal is to provide a more flexible boot process.

You can see a description about uEnv.txt here: http://processors.wiki.ti.com/index.php ... g_uEnv.txt

Here's info about how the Arch Linux Arm U-boot uses uEnv.txt (see section C): https://forum.doozan.com/read.php?3,12381

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Aug 30, 2019 2:33 am

I believe that myself understand how U-boot works with its env variables, but ths standard way of U-boot storing to flash memory is not common with ODROID board. Multiple OS for ODROID SBC, Ubuntu/Android/Debain, has "boot.ini" in their boot partition and it works like a boot script for U-boot, the bootloader has the responsiblity to load and execute it.

For Petitboot, it's an Linux app. So when you have Petitboot, you are already far away from U-boot and Petitboot parses the boot.ini in the different storages and shows the boot entries. Therefore, if you are looking into the way to customize the boot features or process for Arch Linux, you should check if it has boot.ini in its OS release and change it.

"Tapatalk wishes you to have fun with ODROID"


Sav
Posts: 52
Joined: Mon Sep 02, 2019 2:33 am
languages_spoken: english
ODROIDs: odroid-n2
Has thanked: 18 times
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Sav » Mon Sep 02, 2019 10:09 pm

Hi, I tried to test the elatllat's kernel 5.3-rc build, following his tutorial ( viewtopic.php?f=176&t=33993&p=261833#p261833 ).
I installed the kernel build on an ubuntu minimal image on sd card (the tutorial explains how to copy the boot.ini by using
perl -pi -e 's/blk0/blk1/g' /media/boot/boot.ini
)
When I restarted the N2 petitboot didn't recognize the system on the sd card.
I attached the sd card on my laptop and I can see on the boot partition the boot.ini file. It is like this:
ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv dtb_loadaddr "0x1000000"
fatload mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
fatload mmc ${devno}:1 0x01080000 uImage
bootm 0x1080000 - ${dtb_loadaddr}
Did I missed something in petitboot?

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Mon Sep 02, 2019 10:29 pm

Sav wrote:
Mon Sep 02, 2019 10:09 pm
Hi, I tried to test the elatllat's kernel 5.3-rc build, following his tutorial ( viewtopic.php?f=176&t=33993&p=261833#p261833 ).
I installed the kernel build on an ubuntu minimal image on sd card (the tutorial explains how to copy the boot.ini by using
perl -pi -e 's/blk0/blk1/g' /media/boot/boot.ini
)
When I restarted the N2 petitboot didn't recognize the system on the sd card.
I attached the sd card on my laptop and I can see on the boot partition the boot.ini file. It is like this:
ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv dtb_loadaddr "0x1000000"
fatload mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
fatload mmc ${devno}:1 0x01080000 uImage
bootm 0x1080000 - ${dtb_loadaddr}
Did I missed something in petitboot?
Please do fix the address kernel from 0x1080000 to 0x01080000 or do use below.

Code: Select all

ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv loadaddr "0x01080000"
setenv dtb_loadaddr "0x1000000"

load mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
load mmc ${devno}:1 ${loadaddr} uImage
bootm ${loadaddr} - ${dtb_loadaddr}

Sav
Posts: 52
Joined: Mon Sep 02, 2019 2:33 am
languages_spoken: english
ODROIDs: odroid-n2
Has thanked: 18 times
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Sav » Tue Sep 03, 2019 4:35 am

tobetter wrote:
Mon Sep 02, 2019 10:29 pm
Sav wrote:
Mon Sep 02, 2019 10:09 pm
Hi, I tried to test the elatllat's kernel 5.3-rc build, following his tutorial ( viewtopic.php?f=176&t=33993&p=261833#p261833 ).
I installed the kernel build on an ubuntu minimal image on sd card (the tutorial explains how to copy the boot.ini by using
perl -pi -e 's/blk0/blk1/g' /media/boot/boot.ini
)
When I restarted the N2 petitboot didn't recognize the system on the sd card.
I attached the sd card on my laptop and I can see on the boot partition the boot.ini file. It is like this:
ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv dtb_loadaddr "0x1000000"
fatload mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
fatload mmc ${devno}:1 0x01080000 uImage
bootm 0x1080000 - ${dtb_loadaddr}
Did I missed something in petitboot?
Please do fix the address kernel from 0x1080000 to 0x01080000 or do use below.

Code: Select all

ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv loadaddr "0x01080000"
setenv dtb_loadaddr "0x1000000"

load mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
load mmc ${devno}:1 ${loadaddr} uImage
bootm ${loadaddr} - ${dtb_loadaddr}
I used your boot.ini but the result is the same: petitboot didn't see the sd card boot.

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Wed Sep 04, 2019 2:10 am

Sav wrote:
Tue Sep 03, 2019 4:35 am
Please do fix the address kernel from 0x1080000 to 0x01080000 or do use below.

Code: Select all

ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv loadaddr "0x01080000"
setenv dtb_loadaddr "0x1000000"

load mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
load mmc ${devno}:1 ${loadaddr} uImage
bootm ${loadaddr} - ${dtb_loadaddr}
I used your boot.ini but the result is the same: petitboot didn't see the sd card boot.
Actually, I can see the boot entry with the change but not able to boot since uImage cannot be recognized for booting which I have not discovered yet.

Sav
Posts: 52
Joined: Mon Sep 02, 2019 2:33 am
languages_spoken: english
ODROIDs: odroid-n2
Has thanked: 18 times
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Sav » Wed Sep 04, 2019 4:13 am

tobetter wrote:
Wed Sep 04, 2019 2:10 am
Sav wrote:
Tue Sep 03, 2019 4:35 am
Please do fix the address kernel from 0x1080000 to 0x01080000 or do use below.

Code: Select all

ODROIDN2-UBOOT-CONFIG

setenv bootargs "root=/dev/mmcblk1p2 rootwait rw clk_ignore_unused console=ttyAML0,115200"
setenv loadaddr "0x01080000"
setenv dtb_loadaddr "0x1000000"

load mmc ${devno}:1 ${dtb_loadaddr} n2.dtb
load mmc ${devno}:1 ${loadaddr} uImage
bootm ${loadaddr} - ${dtb_loadaddr}
I used your boot.ini but the result is the same: petitboot didn't see the sd card boot.
Actually, I can see the boot entry with the change but not able to boot since uImage cannot be recognized for booting which I have not discovered yet.
I guess that to try the custom kernel is still needed to have the system in the emmc memory.

doloops
Posts: 3
Joined: Fri Sep 06, 2019 4:11 am
languages_spoken: english french
ODROIDs: ODROID N2 4G
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by doloops » Fri Sep 06, 2019 4:33 am

Hi all,

First of all, thanks for all the ideas, knowledge and insights you've put here and there, seems like a very active community here !

I've been playing with my N2 box for a couple of days and wanted to make it boot from SPI on NFS (so no SD Card) and managed to hack it using petitboot's image (success !), so I wanted to share my findings, actual status, and limitations...

Starting from the spiboot image here, https://dn.odroid.com/S922X/ODROID-N2/S ... 417+95.img , and editing the initrd image's /init script such as:
- eth0 is started up (for some reason, petitboot does not start the interface, so no dhcp)
- udhcpc is started manually
- a script is fetched by wget from an http server
- the script is then run.

ifconfig eth0 up
sbin/udhcpc -q -i eth0
ping -c 1 192.168.1.114
wget -O bootstrap 192.168.1.114/on2/bootstrap
sh bootstrap


(This is done instead of calling /usr/sbin/petitboot-nc)

Having a remote script run from an external source means it's much easier to play with, fix issues, without having to flash the spi over and over...

Then the bootstrap script fetches the kernel's zImage, the dtb and the initrd, from the same http server, and runs kexec on top of it.

This works like a charm, both for Armbian's Debian Strech and Ubuntu Bionic.
I just don't figure out how to achieve quite the same thing with a more standard petitboot behavior, especially because the spiboot.img kernel does not have nfs compiled in.
Having an http script or remote configuration is quite handy (petitboot's URL-based remote config gave me the idea of a remote script), but I didn't figure out how to save it somewhere in the spi config (and I don't want to have a sdcard in this box just for configuring spiboot).

Does anyone have any insight on this ?

Thanks in advance !
These users thanked the author doloops for the post:
tobetter (Fri Sep 06, 2019 2:11 pm)

User avatar
mad_ady
Posts: 6862
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 237 times
Been thanked: 177 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by mad_ady » Fri Sep 06, 2019 2:01 pm

@doloops: it sounds like a great achievement, though traditional NFS boot involved just uboot (which can live in spi) which would get its kernel from tftp and point to the rootfs via nfs...
But your way with kexec works as well.

I know petitboot has the option to load external scripts/modules (from external storage), but I'm not sure if those can influence the boot menu and add a NFS BOOT entry...

I wonder what happens to petitboot menu if the board is booted with eth0 up and dhcp and there is no dhcp server around...

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Sep 06, 2019 2:11 pm

mad_ady wrote:
Fri Sep 06, 2019 2:01 pm
@doloops: it sounds like a great achievement, though traditional NFS boot involved just uboot (which can live in spi) which would get its kernel from tftp and point to the rootfs via nfs...
But your way with kexec works as well.

I know petitboot has the option to load external scripts/modules (from external storage), but I'm not sure if those can influence the boot menu and add a NFS BOOT entry...

I wonder what happens to petitboot menu if the board is booted with eth0 up and dhcp and there is no dhcp server around...
I have homework... :)

doloops
Posts: 3
Joined: Fri Sep 06, 2019 4:11 am
languages_spoken: english french
ODROIDs: ODROID N2 4G
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by doloops » Fri Sep 06, 2019 3:42 pm

@mad_ady: Yes, I was well aware this is a non-standard, non-traditional boot process... First time playing with kexec, was fun !

@tobetter: How can I help with your homework ?
There is a dhcp server around (cause udhcpc finds it in 3 seconds), but the interface is not up.

One thing I forgot to mention: there is a segfault showing up in petitboot's init prior to my custom bootstrap, probably in pb-discover.
Could that be the reason why eth0 is not up ? Or eth0 down is absolutely expected ?

Second thing: I started trying to rebuild the whole SPI image from scratch instead of dirty hacking, using this:
https://wiki.odroid.com/odroid-n2/softw ... _buildroot
and
https://wiki.odroid.com/odroid-n2/softw ... _petitboot

Is that the correct source?
Can I build bios on a Aarch64 box ? I no longer have x86_64 boxes around, but it seems the gcc host is expected to be x86_64...

Thanks in advance,

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Sep 06, 2019 4:23 pm

doloops wrote:
Fri Sep 06, 2019 3:42 pm
@mad_ady: Yes, I was well aware this is a non-standard, non-traditional boot process... First time playing with kexec, was fun !

@tobetter: How can I help with your homework ?
There is a dhcp server around (cause udhcpc finds it in 3 seconds), but the interface is not up.

One thing I forgot to mention: there is a segfault showing up in petitboot's init prior to my custom bootstrap, probably in pb-discover.
Could that be the reason why eth0 is not up ? Or eth0 down is absolutely expected ?

Second thing: I started trying to rebuild the whole SPI image from scratch instead of dirty hacking, using this:
https://wiki.odroid.com/odroid-n2/softw ... _buildroot
and
https://wiki.odroid.com/odroid-n2/softw ... _petitboot

Is that the correct source?
Can I build bios on a Aarch64 box ? I no longer have x86_64 boxes around, but it seems the gcc host is expected to be x86_64...

Thanks in advance,
The NIC eth0 is not up by default since less chance to use eth0 by Petitboot ATM. It's expected.
What feature are you going to add now? Are you going to modify Petitboot to work NFS boot?

doloops
Posts: 3
Joined: Fri Sep 06, 2019 4:11 am
languages_spoken: english french
ODROIDs: ODROID N2 4G
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by doloops » Fri Sep 06, 2019 4:49 pm

tobetter wrote:
Fri Sep 06, 2019 4:23 pm
The NIC eth0 is not up by default since less chance to use eth0 by Petitboot ATM. It's expected.
What feature are you going to add now? Are you going to modify Petitboot to work NFS boot?
That's precisely why I may query your insight ;)
Would using petitboot for nfs boot make sence ?
Or should I stick to a bare uboot with a more PXE-friendly boot sequence implementation ?

If my setup could get close to some standard, upstream way of doing things, plus if someone else would be interested in netboot...

The one thing that I don't know is if I can save some config somewhere in the SPI flash...

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Sep 06, 2019 5:02 pm

doloops wrote:
Fri Sep 06, 2019 4:49 pm
tobetter wrote:
Fri Sep 06, 2019 4:23 pm
The NIC eth0 is not up by default since less chance to use eth0 by Petitboot ATM. It's expected.
What feature are you going to add now? Are you going to modify Petitboot to work NFS boot?
That's precisely why I may query your insight ;)
Would using petitboot for nfs boot make sence ?
Or should I stick to a bare uboot with a more PXE-friendly boot sequence implementation ?

If my setup could get close to some standard, upstream way of doing things, plus if someone else would be interested in netboot...

The one thing that I don't know is if I can save some config somewhere in the SPI flash...
I believe some user may want to run PXE or NFS boot like you, the feature is already in the Petitboot but not figured out yet. Due to the size issue of Linux kernel for Petitboot which has to be fit in 8MB memory, the Linux kernel for Petitboot does not have some features. So if you are interesting to debug Petitboot to support network, please do on Ubuntu or Debian running on ODROID-N2. It will save your time a lot and which I am doing so for Petitboot as well.

Saving the configuration into SPI flash memory is known issue, you must acknowledge it already. :(

elatllat
Posts: 1584
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2
Has thanked: 24 times
Been thanked: 71 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by elatllat » Sat Sep 07, 2019 12:19 am

Or just use full Petitboot from a sdcard :twisted:

phaseshifter
Posts: 3506
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: U-2,U3+,,XU-3,,XU3-LITE,,XU-4
C1+,,C-2,,,
N-1,,N-2,...other odroid acc`s as well
Has thanked: 41 times
Been thanked: 43 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by phaseshifter » Wed Sep 11, 2019 11:07 pm

why cannot we use a add0on board like some users have..wire it to the gpios..like we did before..instead of using the sd-card and the extra ram would be a boost..for whatever files needed to be flashed to it...???....my 20 cents worth...
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

felipejfc
Posts: 3
Joined: Tue Sep 17, 2019 11:04 pm
languages_spoken: english
ODROIDs: n2
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by felipejfc » Tue Sep 17, 2019 11:19 pm

I'm trying to dual boot with the following setup:

emmc - CoreElec
usd - Ubuntu (latest hardkernel image)
petitboot - 201907 RC1

I can boot coreelec fine but when I select usd (ubuntu) in petitboot I see only a black screen (blue light is flashing in the board)... any help?

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Tue Sep 17, 2019 11:21 pm

felipejfc wrote:
Tue Sep 17, 2019 11:19 pm
I'm trying to dual boot with the following setup:

emmc - CoreElec
usd - Ubuntu (latest hardkernel image)
petitboot - 201907 RC1

I can boot coreelec fine but when I select usd (ubuntu) in petitboot I see only a black screen (blue light is flashing in the board)... any help?
Have you success to boot with Ubuntu natively without Petitboot?

felipejfc
Posts: 3
Joined: Tue Sep 17, 2019 11:04 pm
languages_spoken: english
ODROIDs: n2
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by felipejfc » Tue Sep 17, 2019 11:30 pm

tobetter wrote:
Tue Sep 17, 2019 11:21 pm
felipejfc wrote:
Tue Sep 17, 2019 11:19 pm
I'm trying to dual boot with the following setup:

emmc - CoreElec
usd - Ubuntu (latest hardkernel image)
petitboot - 201907 RC1

I can boot coreelec fine but when I select usd (ubuntu) in petitboot I see only a black screen (blue light is flashing in the board)... any help?
Have you success to boot with Ubuntu natively without Petitboot?
I have!
For that I needed to take off the emmc from the board, for some reason if I boot with emmc(coreelec 9.2) and usd plugged then I get stuck in coreelec splash image...
But yes, when I removed the emmc I was able to boot with only usd (ubuntu) attached to the board...

One thing that might worth mentioning is that when I select ubuntu on petitboot I see my TV's HDR symbol like it sent some display information to the TV but then I get no image at all...

Philos
Posts: 11
Joined: Tue Feb 28, 2017 3:40 am
languages_spoken: german; english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by Philos » Fri Sep 20, 2019 4:55 pm

From a CoreElec-user's point of view, the 201907-RC-versions are the only releases which allow to use an external SSD as a boot medium for CoreElec. I think, these versions should be mentioned and made accessible in the list of releases (see https://wiki.odroid.com/odroid-n2/os_images/petitboot). Is anyone entitled to edit the Odroid wiki?

User avatar
tobetter
Posts: 4260
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 58 times
Been thanked: 234 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by tobetter » Fri Sep 20, 2019 6:08 pm

Philos wrote:
Fri Sep 20, 2019 4:55 pm
From a CoreElec-user's point of view, the 201907-RC-versions are the only releases which allow to use an external SSD as a boot medium for CoreElec. I think, these versions should be mentioned and made accessible in the list of releases (see https://wiki.odroid.com/odroid-n2/os_images/petitboot). Is anyone entitled to edit the Odroid wiki?
Thanks, it's been updated.

dapimp011
Posts: 9
Joined: Thu Aug 15, 2019 11:28 pm
languages_spoken: english
ODROIDs: N2
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by dapimp011 » Sun Sep 22, 2019 3:36 am

Hello guys,

total noob here, and thats why I am having problem I think :)
I have installed Armbian on emmc, also installed LOS on sd card.
I tried every single version of petitboot, but unfortunately none of them works for me. When I say dont work, I mean it doesnt recognize Armbian / Android at all, and when I try to move selection anywhere in petitboot, i got failed message. Using K400 wireless keyboard, and tried move usb wifi receiver to usb 2.0 otg like someone recommended, but no changes.
Armbian works when I move switch to emmc, and also Android works when I remove emmc.
I am trying all day to fix it, but I am out of ideas .. So I need help :P

User avatar
mad_ady
Posts: 6862
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 237 times
Been thanked: 177 times
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by mad_ady » Sun Sep 22, 2019 4:43 am

Do they get detected and show up in the menu?

dapimp011
Posts: 9
Joined: Thu Aug 15, 2019 11:28 pm
languages_spoken: english
ODROIDs: N2
Has thanked: 0
Been thanked: 0
Contact:

Re: Petitboot, yet another bootloader based on KEXEC

Unread post by dapimp011 » Sun Sep 22, 2019 4:56 am

mad_ady wrote:
Sun Sep 22, 2019 4:43 am
Do they get detected and show up in the menu?
No.
I tried one more thing.
When I remove emmc, and leave just sd card with android, petitboot boots normal, everything working with wifi keyboard and mouse, and android shows up in menu.
As soon as I put emmc with Armbian on, petitboot boots but without menu for systems, and cant use keyboard, it moves me to shell, with message failed...

https://imgur.com/KPRlnFp
https://imgur.com/hk7uNDm
https://imgur.com/kRUnlU7
https://imgur.com/t1b9U5f

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: odroidn2user and 2 guests