Closed xogium closed 1 year ago
Okay, extlinux/syslinux is too simplistic for this user case, it looks like. If you want a rootfs that can be booted either with micro sd or eMMC you need a boot script which set the kernel command line/bootargs based on which device you booted from, and extlinux.conf is too basic to permit this, as far as I understand.
In other words, we can't use the same boot file on both eMMC and micro sd, because the rootfs partition for the eMMC is p2, and the rootfs on micro sd is p5. So we need to tell u-boot exactly this, and this seems to require scripting.
I'm going to apply the extlinux.conf environment and test it. I'll give you feedback on the results. Thank you.
Hiya! I managed to get something going using a boot script, also. I will push it shortly, if you are interested in testing.
I asked around on irc and it seems like extlinux is too limited to make generic boot a possible option in this exact case, as I suspected. You can't tell it to set different device for eMMC or micro sd boot. I've got a system fully able to boot over micro sd over here, using the basic u-boot defconfig with no change. Straight to buildroot prompt.
On Mon Oct 16, 2023 at 8:00 AM CEST, NAMIC KIM wrote:
I'm going to apply the extlinux.conf environment and test it. I'll give you feedback on the results. Thank you.
Alright, just pushed a set of commits that should, hopefully make both eMMC and micro sd boot automated.
Please try them out whenever you get some time. and tell me if you still encounter any issues, I'll be glad to improve this project.
Thank you. I will test it and let you know the result.
SD card boot is Work!!
Follow is my boot log..
NOTICE: CPU: STM32MP135D Rev.Y
NOTICE: Model: Seeed STM32MP135D Odyssey Board
NOTICE: BL2: v2.8-stm32mp1-r1.0(release):()
NOTICE: BL2: Built : 16:33:36, Oct 16 2023
NOTICE: BL2: Booting BL32
I/TC: Early console on UART#4
I/TC:
I/TC: Embedded DTB found
I/TC: OP-TEE version: Unknown_3.19 (gcc version 12.3.0 (Buildroot 2023.08.1)) #1 Mon Oct 16 07:27:58 UTC 2023 arm
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: WARNING: All debug access are allowed
I/TC: No RNG configuration specified, defaulting to NIST B
I/TC: Platform stm32mp1: flavor 135D_ODYSSEY - DT stm32mp135d-odyssey.dts
I/TC: DTB enables console (non-secure)
I/TC: Primary CPU switching to normal world boot
optee optee: OP-TEE: revision 3.19
U-Boot 2022.10-stm32mp-r1 (Oct 16 2023 - 16:32:47 +0900)
CPU: STM32MP135D Rev.Y
Model: Seeed STM32MP135D Odyssey Board
Board: stm32mp1 in trusted mode (st,stm32mp135d-odyssey)
DRAM: 512 MiB
optee optee: OP-TEE: revision 3.19
Clocks:
- MPU : 1000 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
Core: 252 devices, 32 uclasses, devicetree: board
WDT: Started watchdog with servicing (32s timeout)
NAND: 0 MiB
MMC: STM32 SD/MMC: 0, STM32 SD/MMC: 1
Loading Environment from MMC... OK
In: serial
Out: serial
Err: serial
invalid MAC address 0 in OTP 00:00:00:00:00:00
Net:
Error: eth1@5800a000 address not set.
eth1: eth2@5800e000
Hit any key to stop autoboot: 0
Boot over mmc0!
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:5...
Found U-Boot script /boot/boot.scr
714 bytes read in 7 ms (99.6 KiB/s)
## Executing script at c4100000
Micro sd card boot
43867 bytes read in 10 ms (4.2 MiB/s)
10441216 bytes read in 444 ms (22.4 MiB/s)
Kernel image @ 0xc2000000 [ 0x000000 - 0x9f5200 ]
## Flattened Device Tree blob at c4000000
Booting using the fdt blob at 0xc4000000
Loading Device Tree to cfff2000, end cffffb5a ... OK
Starting kernel ...
[ 0.007007] /cpus/cpu@0 missing clock-frequency property
[ 1.150582] Driver 'scmi-optee' was unable to register with bus_type 'tee' because the bus was not initialized.
[ 1.430278] stm32-cpufreq stm32-cpufreq: OPP-v2 not supported
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting watchdog...
Seeding 256 bits and crediting
Saving 256 bits of creditable seed for next boot
Starting network: OK
Welcome to Buildroot
buildroot login:
That's awesome! So this is fixed, correct?
Btw, curiosity on my part, how did you find the tree? Was it the seeed wiki document issue opened about writing doc?
In any case I'm glad this now works for you. If you have any other issue just open a new one and we shall go from there.
I found by search in github.com. Thank you for your efforts, and now I have to try something different. Thank you very much.
You're very welcome!
@namix71 Do you think having something like syslinux.conf is necessary for this? Or should we stick to some u-boot script? I might just redo this part... For the tree as a whole actually, because right now this is problematic. I figured u-boot would grab the device and boot on its own from it, but it isn't doing so. It must not be knowing what to do and missing a file to tell it exactly what to do.
I am very sorry for the mess. I am not used to u-boot at all.
I am just not sure how to not interfeer with nfs boot if for example you boot with a bootloader burned on the eMMC or micro sd, which has its own rootfs, but you want to do nfs for whatever reason. Do you have any ideas how to handle this?
Because, from what I gather, the bootloader would figure out the device it booted from, that is mmc0 or mmc1 then choose to execute syslinux.conf from there... I guess there's still the possibility of interrupting it to do what you want instead.