BIOS design using PETITBOOT to support SPI booting

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Fri Nov 30, 2018 11:55 am

Hi phaseshifter,
Actually, I don't think all components (including kernel build, copy uInitrd.igz to vfat file system) should be implemented automatically at this stage,
because end users don't need to follow this build routines once all features based on final user scenario are completed.
Pre-built kernel image only for bios and uIinitrd.igz will be built in spi flash.
It's possible it can be updated later, but very rarely.

I think the uInitrd packaging sequence should be ready as auto config to maintain the sequence and and share/discuss this idea with you.
But not all operations, I think. :)
Did I understand what you're asking?...

And about wiki page, sorry for many typo errors. :(
Still I'm keeping modifying scenario and fixing/improving the whole sequence.... many updates.
I will update the wiki page middle of next week and examine it very carefully.

phaseshifter
Posts: 3434
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: 34 times
Been thanked: 39 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by phaseshifter » Fri Nov 30, 2018 12:07 pm

ok um...i am basically wondering where the autoconfig scrypt finishes i guess

..because as i re-edited my post not shure if you have re read it...did it not make correct sense to you...

Hmm..because i thought that after the auto script..next to do...is the kernel build process...and the uInitrd.igz had been copied..

because it was not for me on many installs i have done..

it may be an issue in his script i am not shure..but uIntrd.igz was definitely not in my /media/boot directory..at all..
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Fri Nov 30, 2018 12:35 pm

phaseshifter wrote:ok um...i am basically wondering where the autoconfig scrypt finishes i guess

..because as i re-edited my post not shure if you have re read it...did it not make correct sense to you...

Hmm..because i thought that after the auto script..next to do...is the kernel build process...and the uInitrd.igz had been copied..

because it was not for me on many installs i have done..

it may be an issue in his script i am not shure..but uIntrd.igz was definitely not in my /media/boot directory..at all..
I see. I understand now. :)
I will update wiki page and auto script as your opinion next week.

phaseshifter
Posts: 3434
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: 34 times
Been thanked: 39 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by phaseshifter » Sat Dec 01, 2018 7:36 am

also i would like to add..
The modding of the boot.ini file need`s to be done after
the auto build script has been done
or
directly
after the kernel build has been done..
not exactly shure which order is correct for the boot.ini modding..i think after either is acceptable
if you do a reboot after any of the above steps
but before the modding of the boot.ini file.... it will not boot to a p-boot screen...

you cannot expect it to boot up into the p-boot menu before this has been done

also i would like to add if you have the uart kit connected to monitor the p-boot at the serial line
it will just boot to a blank screen for some reason and the putty window will either stop at a blank screen or ..freeing kernel memory
this needs to be disconnected to allow it to boot to the p-boot screen don't know why this is happening.

i have to do another build after discovering what i found in my prior 2 posts...
i know joy has to add a lot of changes..so i may wait till next week.. after he revamps the wiki page....

and your modding of the "kexec.conf" needs to be looked at being done
before a reboot of the above steps as well
because you lose your putty window to enable any further modding that you need to do...still the putty window issue is a problem...

So therefore the ordering need`s to be addressed here...

EDIT: ... sorry my bad the wiki guide of the h-k official was what i was referring to when i talked about the "ordering"...joy`s thread topic shows the correct ordering..as far as modding the boot file..etc...
the auto-build page needs to include the boot modding..etc.
.the manual build shows some modding but not enough.
.i guess he is still at work with his notes.etc.etc..
.i expect he is aware of the issues although i thought i`d share some opinion on the subject..
.lot`s of stress in my world cannot do any thing much atm...everything is packed trying to move place and my health has gone to crap..yet i forge ahead...life goes on...
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Fri Dec 21, 2018 2:04 am

I'll try to give it another try tomorrow. Has anything changed since last time?
Would I get away without building systemd & friends and just using the prebuild initrd?

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Fri Dec 21, 2018 12:20 pm

Hi mad_ady,
You don't need to build uInitrd by yourself.
Please find the attachment, uInitrd.igz.zip.

It contains some updates including adjusted petitboot logic for fast reboot and kexec version.
https://github.com/JeonghwaCho/petitboo ... e04f85f43d
Attachments
uInitrd.igz.zip
(3.38 MiB) Downloaded 19 times

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Sat Dec 22, 2018 12:18 am

Ok, I tried your initrd and petitboot started fine.
It couldn't see (nor boot) from the emmc, but it complained about missing vfat code pages in my kernel (I admit I skipped those - will need to redo it).
Otherwise it looks great - but it would be nice (if possible) to spawn a shell on serial (for debugging purposes).

If I have time I'll try dual-booting some systems as well.

phaseshifter
Posts: 3434
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: 34 times
Been thanked: 39 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by phaseshifter » Sat Jan 05, 2019 11:04 am

i`m in a transitional period and cannot do anything much ..hopefully soon i will be able.....
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Tue Jan 08, 2019 12:15 am

I'm playing with petitboot and I'm currently at stage 4. I created and populated /etc/kboot.conf and I can successfully boot from the EMMC. I did add an entry for USB (sda1), but it isn't listed when I am in petitboot. If I want to add a new entry in the menu from within petitboot I am shown only sda2 and not sda1 (mmcblk1 is shown as well). The only problem I can think of is that both mmcblk1p1 and sda1 have the same serial number/uuid. I'll try changing one of them, though that requires a reformat.

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Tue Jan 08, 2019 9:04 pm

Ok, I changed my boot partition's serial number (by formatting it again), and now petitboot can see both usb and emmc and boot from either. I was able to boot the debian image from usb, with ubuntu on the emmc.

Great feature! I'd like to see it in other odroid boards as well. Would make multiboot a breeze.

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Wed Jan 09, 2019 11:47 am

mad_ady wrote:
Tue Jan 08, 2019 12:15 am
The only problem I can think of is that both mmcblk1p1 and sda1 have the same serial number/uuid. I'll try changing one of them, though that requires a reformat.
mad_ady wrote: Ok, I changed my boot partition's serial number (by formatting it again), and now petitboot can see both usb and emmc and boot from either. I was able to boot the debian image from usb, with ubuntu on the emmc.
Thank you for sharing your test result and the menu issue with sn/uuid, mad_ady. :)

umiddelb
Posts: 451
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2
Has thanked: 0
Been thanked: 0
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by umiddelb » Thu Jan 10, 2019 6:49 am

You don't need to reformat the filesystem, see tune2fs (8).

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Thu Jan 10, 2019 8:13 am

tune2fs works only on ext systems. I was having a duplicate uuid/serial number on my vfat boot partition. It was a quick format, no worries :)

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Thu Jan 10, 2019 8:21 am

@mad_ady,
To make sure, can I ask one?
Do you have only one list on petitboot main menu if you use same UUID for both of usb and emmc?
As I checked, there are two lists with the node "/dev/sda1" and "/dev/mmcblk0p1" (that contain kboot.conf) even though they use same uuid.

petitboot scan all of storages and can detect each kboot.conf, then display the items on main menu automatically.

For example...
I have two kboot.conf in the root path of each storages.
(1) 1 usb stick with 1 vfat and 1 ext4 filesystem
- In vfat filesystem, there is a kboot.conf.

Code: Select all

USB_boot='sda1:/Image initrd=sda1:/uInitrd dtb=sda1:/rk3399-odroidn1-linux.dtb swiotlb=1 console=ttyFIQ0,115200n8 root=/dev/sda2 rootwait rw'
(2) 1 emmc card with 1 vfat and 1 ext4 filesystem
Also it has another kboot.conf in the vfat of emmc.

Code: Select all

EMMC_boot='mmcblk1p1:/Image initrd=mmcblk1p1:/uInitrd dtb=mmcblk1p1:/rk3399-odroidn1-linux.dtb swiotlb=1 console=ttyFIQ0,115200n8 root=/dev/mmcblk1p1 rootwait rw'
Once N1 boots and enters petitboot main menu, it shows two items with name, "USB_boot" and "EMMC_boot".

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Thu Jan 10, 2019 11:58 am

@mad_ady,
Just now, I understand why you should change uuid for 2nd booting.
If root of bootargs is configured using uuid as following, it must make a confusion to load 2nd rootfs
even though petitboot main menu shows them separate items.

Code: Select all

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

Code: Select all

root=/dev/sda2 rootwait.....
It should be changed if we use uuid for root definition.

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Thu Jan 10, 2019 3:45 pm

I didn't know kboot.conf could live on the vfat partition. In my case I only had one /etc/kboot.conf with entries for emmc and sda.
The problem was when sda1 and mmcblk1p1 had the same serial number/uuid, when starting petitboot it would not list the usb entry in the menu. If I went in and tried to add a new entry inside petitboot it would list mmcblk1p1, mmcblk1p2 and sda2 as available partitions and would make no mention about sda1 (and couldn't load kernel/initrd from it). The bootargs specified the disk by name, not uuid.

Anyway, uuids should always be unique by design.

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Thu Jan 10, 2019 4:49 pm

mad_ady wrote:
Thu Jan 10, 2019 3:45 pm
I didn't know kboot.conf could live on the vfat partition. In my case I only had one /etc/kboot.conf with entries for emmc and sda. The problem was when sda1 and mmcblk1p1 had the same serial number/uuid, when starting petitboot it would not list the usb entry in the menu.
Both are possible.

[case 1] under /etc/kboot.conf that has all storages' label definitions in a kboot.conf file
As I tested [case 1], I sometime lost some or all lists. still now I couldn't figure it out. (I need more knowledge about the device scanning logic of petitboot pb-discover.)
And it's located in read-only type ramdisk (/etc/kboot.conf) so, it's not flexible to update storage list.

[case 2] each storage has its kboot.conf that has its label.
So I tried another way, [case 2].
Fortunately, the latest petitboot pb-discover supports this.
With [case 2], I can have all lists and also when I connect another storage (or detach a storage) in runtime on petitboot main menu, available lists are updated automatically.
Also it's easy to add/remove device list flexibly. This approach is more extensible.

So please try the [case 2] way.
mad_ady wrote:
Thu Jan 10, 2019 3:45 pm
Anyway, uuids should always be unique by design.
You're right. It should be.

elatllat
Posts: 1355
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2
Has thanked: 5 times
Been thanked: 19 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by elatllat » Wed Jan 16, 2019 2:30 am

Code: Select all

make clean > /dev/null && make tinyconfig && make -j $(nproc) > ../make.out 2> ../make.err && du -h  arch/arm64/boot/Image
1.3M	arch/arm64/boot/Image
Adding ext4,ipv4,lvm,cryptsetup bring it up to 3.2M (or more as I did not test I had all the required options enabled, and that's excluding user space)

Going below the current built in options; https://lwn.net/Articles/746780/

joy
Posts: 847
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 8 times
Been thanked: 35 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by joy » Sat Feb 09, 2019 1:10 pm

elatllat wrote:
Wed Jan 16, 2019 2:30 am
Adding ext4,ipv4,lvm,cryptsetup bring it up to 3.2M (or more as I did not test I had all the required options enabled, and that's excluding user space)

Going below the current built in options; https://lwn.net/Articles/746780/
As you mentioned, network features of bios with petitboot is a big and important part for this topic. Also crypto features, too.
Considering 8MB-sized spi flash, ramdisk size should be under 3.5MB, also kernel image including network and related file system features, too.
As soon as I'm available, I will try it soon.
Let's move forward to next step. ;)

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Sat Feb 09, 2019 3:28 pm

That's a very interesting read, thanks

phaseshifter
Posts: 3434
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: 34 times
Been thanked: 39 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by phaseshifter » Wed Mar 06, 2019 2:52 pm

is the chip i have been using with maddy at the latter going to be considered..i am getting an N-2 very soon so it has the chip built into the board from what i can see..i still have my spi addon chip board if were going to proceed further on this path...thank`s phase...
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

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

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by mad_ady » Wed Mar 06, 2019 3:25 pm

I think we can use the builtin one, no need for the external chip.

User avatar
tobetter
Posts: 3702
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: 28 times
Been thanked: 117 times
Contact:

Re: BIOS design using PETITBOOT to support SPI booting

Unread post by tobetter » Wed Mar 06, 2019 3:30 pm

Another SPI flash memory could not be attached to ODROID-N2 or SPI driver may need to be touched in order to work with SPI flash memory. Also, another SPI flash memory does not make ODROID-N2 bootup.

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 0 guests