Can radxa zero can boot from 2nd partition from SD card?

Can radxa zero can boot from 2nd partition from SD card? if it can how to make it? Thanks

Yes, you can do this with U-Boot. https://u-boot.readthedocs.io/en/latest/usage/partitions.html

it only work when I put boot script in the 1st partition. if I put uboot boot script at 2nd partition. it can’t bootup. Do you have any way to let the boot script work when I put in 2nd partition?

You have to tell U-Boot to look for the boot script there. Maybe this is helpful depending on your distro? https://forum.armbian.com/topic/12205-u-boot-question-boot-2nd-partition/

You may have to recompile U-Boot with the desired bootcmd string: https://wiki.radxa.com/Zero/dev/u-boot

weird, when I put boot.scr at 1st fat partition it can success bootup, but when I put boot.scr at 2nd fat partition it failed.

Success:
U-Boot 2021.07-gdb6738fe-dirty (Sep 18 2022 - 12:18:39 -0700) radxa-zero

Model: Radxa Zero
SoC: Amlogic Meson G12A (S905Y2) Revision 28:b (30:2)
DRAM: 1 GiB
MMC: sd@ffe03000: 0, sd@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from nowhere… OK
In: serial
Out: serial
Err: serial
Net: Net Initialization Skipped
No ethernet found.
starting USB…
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices… 1 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
Hit any key to stop autoboot: 0
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1…
Found U-Boot script /boot.scr
968 bytes read in 5 ms (188.5 KiB/s)

Executing script at 08000000

fatload mmc 1:2 0x08008000 /meson-g12a-radxa-zero.dtb
74404 bytes read in 9 ms (7.9 MiB/s)
ext4load mmc 1:3 0x13000000 vmlinuz
10297704 bytes read in 911 ms (10.8 MiB/s)
unzip 0x13000000 0x08080000
Uncompressed size: 24904192 = 0x17C0200
ext4load mmc 1:3 0x13000000 initrd
24517204 bytes read in 2161 ms (10.8 MiB/s)
booti 0x08080000 0x13000000:1761a54 0x08008000
Moving Image from 0x8080000 to 0x8200000, end=9a60000

Flattened Device Tree blob at 08008000

Booting using the fdt blob at 0x8008000
Loading Ramdisk to 3a7db000, end 3bf3ca54 … OK
Loading Device Tree to 000000003a7c5000, end 000000003a7da2a3 … OK

Starting kernel …

Failed:
U-Boot 2021.07-gdb6738fe-dirty (Sep 18 2022 - 12:18:39 -0700) radxa-zero

Model: Radxa Zero
SoC: Amlogic Meson G12A (S905Y2) Revision 28:b (30:2)
DRAM: 1 GiB
MMC: sd@ffe03000: 0, sd@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from nowhere… OK
In: serial
Out: serial
Err: serial
Net: Net Initialization Skipped
No ethernet found.
starting USB…
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices… 1 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
Hit any key to stop autoboot: 0
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1…
Card did not respond to voltage select! : -110
Scanning disk sd@ffe03000.blk…
Disk sd@ffe03000.blk not ready
Scanning disk sd@ffe05000.blk…
Card did not respond to voltage select! : -110
Scanning disk mmc@ffe07000.blk…
Disk mmc@ffe07000.blk not ready
Found 4 disks
** Unable to read file ubootefi.var **
Failed to load EFI variables
BootOrder not defined
EFI boot manager: Cannot load any image
Scanning mmc 1:2…
Found U-Boot script /boot.scr
968 bytes read in 3 ms (314.5 KiB/s)

Executing script at 08000000

fatload mmc 1:2 0x08008000 /meson-g12a-radxa-zero.dtb
74404 bytes read in 10 ms (7.1 MiB/s)
ext4load mmc 1:3 0x13000000 vmlinuz
10297704 bytes read in 912 ms (10.8 MiB/s)
unzip 0x13000000 0x08080000
Uncompressed size: 24904192 = 0x17C0200
ext4load mmc 1:3 0x13000000 initrd
24517204 bytes read in 2160 ms (10.8 MiB/s)
booti 0x08080000 0x13000000:1761a54 0x08008000
Moving Image from 0x8080000 to 0x8200000, end=9a60000

Flattened Device Tree blob at 08008000

Booting using the fdt blob at 0x8008000
Loading Ramdisk to 3a7db000, end 3bf3ca54 … OK
Loading Device Tree to 000000003a7c5000, end 000000003a7da2a3 … OK
“Synchronous Abort” handler, esr 0x96000004
elr: 000000000105f628 lr : 000000000104f658 (reloc)
elr: 000000003dfb3628 lr : 000000003dfa3658
x0 : 252cf00104280c01 x1 : 000000003dfb9f40
x2 : 0000000000000010 x3 : 0000000000000000
x4 : 0000000000000000 x5 : 252cf00104280c01
x6 : 000000003bf74a40 x7 : 0000000000000007
x8 : 0000000000000000 x9 : 0000000000000008
x10: 000000000000bc60 x11: 000000003bf3e2ac
x12: 000000000000ba38 x13: 000000003bf3e268
x14: 000000003a7c5000 x15: 0000000000000020
x16: 000000003df80108 x17: 000000003bf78400
x18: 000000003bf51dd0 x19: 000000003af3f040
x20: 000000003df54fc8 x21: 000000003dfb9f40
x22: 0000000000000300 x23: 000000003bf61af0
x24: 000000003dfd9300 x25: 0000000005300000
x26: 0000000000300000 x27: 0000000000000000
x28: 0000000000000300 x29: 000000003bf3e270

Code: eb02009f 54000061 52800000 14000006 (386468a3)
Resetting CPU …

resetting …

the boot script like follow:
setenv bootargs ‘xxxxxxxxxxxxx’

load fdt

fatload mmc 1:2 ${fdt_addr_r} ${fdtfile}

load kernel

ext4load mmc 1:3 ${ramdisk_addr_r} vmlinuz
unzip ${ramdisk_addr_r} ${kernel_addr_r}

load initrd

ext4load mmc 1:3 ${ramdisk_addr_r} initrd

boot

booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}

hi @theophile

I compare the u-boot build follow wifi page and the one download form https://dl.radxa.com/zero/images/loader/u-boot.bin

wiki: U-Boot 2021.07-gdb6738fe (Dec 24 2022 - 08:47:38 -0800) radxa-zero,
download: U-Boot 2022.04-00001-g4bbaa9c0 (Jun 29 2022 - 15:17:30 +0800) radxa-zero

and seem the downloaded u-boot fixed the issue: can’t boot when u-boot script are location at 2nd partition.

So can you help me how to get the latest u-boot source or the build of 2022.04-00001-g4bbaa9c0 , Thanks a lot and Merry Christmas!

when I download u-boot from https://dl.radxa.com/zero/images/loader/ it works. so can you let me know what is the branch of uboot in https://dl.radxa.com/zero/images/loader/ ?

Hi Theophile, can you tell me how the u-boot build out as the one in https://dl.radxa.com/zero/images/loader/u-boot.bin. I following the wiki page https://wiki.radxa.com/Zero/dev/u-boot but seem the binary are different size

Thans @theophile, I fix it by define CONFIG_BOOTCOMMAND and reboot u-boot.