What is the rock5b boot process? Where can i find prebuilt uboot? Where does it load configuration from?
I would like someone to help me with these
Whats the rock5b boot process?
Not sure about prebuild uboot - i built it from the source.
But some general bootflow is described here: https://opensource.rock-chips.com/wiki_Boot_option
i just cant get it to boot ive got the uboot built ive got a sample extlinux.conf but all i get from the serial console is this
What exactly are you trying to accomplish?
Run a Prebuilt Image (e.g. Radxa Debian, Armbian)
For Rock 5B images, if you’re running them off eMMC or SD card, you shouldn’t have to do anything - they’ll already have U-Boot. If you’re booting off NVMe, you’ll need to refer to the guide to flash U-Boot to SPI for the Rock 5B from @ Radxa Wiki.
Pre-built U-Boot images are available in Step 2 of that guide
Custom (e.g. Create Own Image)
The info on Boot options @ Rockchip OSS Wiki is a really good reference albeit dense
The key info is in the ASCII diagram, idbloader.img
should be at sector offset 0x40
, u-boot.itb
at sector offset 0x4000
, and your boot partition at sector 0x8000
. Boot partition will need to be something Radxa U-Boot can read (e.g. ext4) and needs to have /extlinux/extlinux.conf
.
You’ll see this reflected in the Radxa images: the first Linux partition is at sector 32,768 (x4000
). You won’t see the other parts: they live in between the GPT header and that first partition. You can* create partition entries the pre-loader & U-Boot @ sector 64 (0x40
) and sector 16384 (0x4000
) respectively, but that makes no difference from the boot perspective.
* Many would argue you should do this to ensure nothing sees the space between GPT header and 0x8000 as unused and performs a destructive action on it. But in practice, I haven’t seen a ton of images actually setting up their partition tables this way.
Im trying to make my own image not based on debian that boots of SDcard.
So currently i tried
sudo dd if=/dev/zero of=/dev/sdc bs=1M count=16M
to wipe the first 16MB of the sdcard destroying everything
then i ran
sudo parted /dev/sdc -s mklabel gpt \
mkpart primary ext4 16M 150M \
set 1 boot on \
mkpart primary ext4 150M 100%
to partition the sccard
and now i sudo dd if=./idbloader.img of=/dev/sdc seek=64
and i get tthe same serial output so its not loading the second part of the bootloader (yes i know u-boot.itb is missing but dding it doesnt make the thing even try to boot its still stuck in the same place)
Try using the Radxa U-Boot build: https://dl.radxa.com/rock5/sw/images/loader/rock-5b/debug/rock-5b-spi-image-g3caf61a44c2-debug.img
(Use bs=512 seek=64 skip=64
since it’s expecting to be written from 0x0
.)
Hi,
Im adding support for rock5b v1.41 im my distro.
With u-boot from https://dl.radxa.com/rock5/sw/images/loader/rock-5b/debug/
Im getting nicely booting 6.2-rc5 mainline kernel from sd-card.
But when I only replace above u-boot.itb to binary build compiled accordingly to: https://wiki.radxa.com/Rock5/guide/build-u-boot-on-5b
im getting hang like this (seems to be the same like top post in this thread):
..DDR Version V1.08 20220617
LPDDR4X, 2112MHz
channel[0] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[1] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[2] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[3] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
Manufacturer ID:0x6
CH0 RX Vref:32.7%, TX Vref:21.8%,21.8%
CH1 RX Vref:30.7%, TX Vref:20.8%,20.8%
CH2 RX Vref:31.7%, TX Vref:21.8%,21.8%
CH3 RX Vref:33.7%, TX Vref:21.8%,20.8%
change to F1: 528MHz
change to F2: 1068MHz
change to F3: 1560MHz
change to F0: 2112MHz
out
.INFO: Preloader serial: 2
NOTICE: BL31: v2.3():v2.3-405-gb52c2eadd:derrick.huang
NOTICE: BL31: Built : 11:23:47, Aug 15 2022
INFO: spec: 0x1
INFO: ext 32k is not valid
INFO: GICv3 without legacy support detected.
INFO: ARM GICv3 driver initialized in EL3
INFO: system boots from cpu-hwid-0
INFO: idle_st=0x21fff, pd_st=0x11fff9, repair_st=0xfff70001
INFO: dfs DDR fsp_params[0].freq_mhz= 2112MHz
INFO: dfs DDR fsp_params[1].freq_mhz= 528MHz
INFO: dfs DDR fsp_params[2].freq_mhz= 1068MHz
INFO: dfs DDR fsp_params[3].freq_mhz= 1560MHz
INFO: BL31: Initialising Exception Handling Framework
INFO: BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR: Error initializing runtime service opteed_fast
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x200000
INFO: SPSR = 0x3c9
For me issue is interesting as: test with flashing this locally build u-boot i.e. to working sdcard with radxa buntu gives nicely booting ubuntu.
(so this uboot seems work ok with radxa kernel + ubuntu, but fails with mainline).
As debug u-boot boots ok for me - i think issue is in latest radxa u-boot code. (hxxps://github.com/radxa/u-boot/commits/stable-5.10-rock5)
Showstopper for me is lack of any output from radxa u-boot - so I don’t know how to move forward…
Any thoughts what to do with this?
I had the same issue just use armbian uboot https://monka.systemonachip.net/deb/linux-u-boot-legacy-rock-5b_22.11.0-trunk_arm64.deb
fyi:
looking bit on radxa code…
applying https://github.com/warpme/minimyth2/blob/fb98f271097130ac3dfe6b34d670c9c56727202b/script/bootloaders/u-boot-rk3588-radxa/files/rock-5b-rk3588_defconfig-add-logging.patch gives me nicely booting 6.2 mainline
On which source do you apply this patch? The radxa u-boot I found, from the following URL doesn’t have the configs/rock-5b-rk3588_defconfig file.
I tried with mainline + linux-next patch (that contains rock-5b dts in boot/
I booted on the ARMbian Image (downgraded on 5.10.72 (the default 5.10.110 doesn’t have any display on HDMI on my v1.42 board), installed building tools.
Prepared the kernel the following way:
wget https://git.kernel.org/torvalds/t/linux-6.2-rc6.tar.gz
wget https://mirrors.edge.kernel.org/pub/linux/kernel/next/patch-v6.2-rc6-next-20230130.xz
tar xf linux-6.2-rc6.tar.gz
cd linux-6.2-rc6
xzcat ../patch-v6.2-rc6-next-20230130.xz | patch -p1
make menuconfig # autodetect the harware platform
make -j8
Then I mount the destination / in /mnt and the /boot in /mnt/boot (SDcard from eeprom)
sudo mount /dev/mmcblk0p2 /mnt
sudo mount /dev/mmcblk0p1 /mnt/boot/
and install kernel
export MNT=/mnt
sudo make INSTALL_MOD_PATH=/mnt modules_install
sudo make INSTALL_PATH=/mnt/boot install
sudo make INSTALL_PATH=/mnt/boot dtbs_install
sudo chroot /mnt update-initramfs -c -k all
And then I use the default deb script to put the as first choice.
sudo chroot /mnt test -d /etc/kernel/postinst.d && run-parts --arg=“6.2.0-rc6-next-20230130” --arg="/boot/vmlinuz-6.2.0-rc6-next-20230130" /etc/kernel/postinst.d
then I added some missing links.
cd /mnt/boot
mv dtb dtb_old # keep ref to the old one
ln -s dtbs/6.2.0-rc6-next-20230130 dtb
mv Image Image.old # keep ref to the old one
ln -s vmlinuz-6.2.0-rc6-next-20230130 Image
At the end I have the following links:
-rw-r--r-- 1 root root 210 févr. 1 13:05 armbianEnv.txt
-rw-r--r-- 1 root root 1536 déc. 9 12:03 armbian_first_run.txt.template
-rw-r--r-- 1 root root 38518 déc. 9 12:03 boot.bmp
-rw-r--r-- 1 root root 3180 déc. 9 11:50 boot.cmd
-rw-rw-r-- 1 root root 3252 déc. 9 12:05 boot.scr
-rw-r--r-- 1 root root 209980 nov. 30 12:09 config-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 215213 janv. 31 15:45 config-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 27 févr. 1 13:28 dtb -> dtb-5.10.72-rockchip-rk3588
drwxr-xr-x 3 root root 4096 janv. 20 21:34 dtb-5.10.72-rockchip-rk3588
lrwxrwxrwx 1 root root 28 févr. 1 13:17 dtb.new -> dtbs/6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 27 janv. 20 21:35 dtb_old -> dtb-5.10.72-rockchip-rk3588
drwxr-xr-x 3 root root 4096 janv. 31 15:45 dtbs
lrwxrwxrwx 1 root root 31 févr. 1 13:28 Image -> vmlinuz-5.10.72-rockchip-rk3588
lrwxrwxrwx 1 root root 31 févr. 1 13:18 Image.new -> vmlinuz-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 31 janv. 20 21:35 Image.old -> vmlinuz-5.10.72-rockchip-rk3588
lrwxrwxrwx 1 root root 34 févr. 1 13:16 initrd -> initrd.img-5.10.72-rockchip-rk3588
lrwxrwxrwx 1 root root 34 févr. 1 13:28 initrd.img -> initrd.img-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 15245781 janv. 31 15:47 initrd.img-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 15996756 févr. 1 09:03 initrd.img-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 34 févr. 1 09:03 initrd.img.new -> initrd.img-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 34 janv. 29 17:37 initrd.img.old -> initrd.img-5.10.72-rockchip-rk3588
drwx------ 2 root root 16384 déc. 9 12:05 lost+found
-rw-r--r-- 1 root root 0 janv. 20 21:35 .next
drwxr-xr-x 2 root root 4096 janv. 21 17:53 oldinitrd
lrwxrwxrwx 1 root root 34 févr. 1 13:28 System.map -> System.map-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 7615591 nov. 30 12:09 System.map-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 5880854 janv. 31 15:45 System.map-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 31 févr. 1 13:28 uInitrd -> uInitrd-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 15245845 janv. 31 15:47 uInitrd-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 15996820 févr. 1 09:03 uInitrd-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 31 févr. 1 09:03 uInitrd.new -> uInitrd-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 31 févr. 1 13:27 vmlinuz -> vmlinuz-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 32885248 nov. 30 12:09 vmlinuz-5.10.72-rockchip-rk3588
-rw-r--r-- 1 root root 31574528 janv. 31 15:45 vmlinuz-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 31 févr. 1 13:15 vmlinuz.new -> vmlinuz-6.2.0-rc6-next-20230130
lrwxrwxrwx 1 root root 31 févr. 1 09:03 vmlinuz.old -> vmlinuz-5.10.72-rockchip-rk3588
But the boot terminate on a segfault just after the INFO: SPSR…:
INFO: SPSR = 0x3c9
[ 1.152754] Internal error: Oops: 0000000096000007 [#1] SMP
[ 1.153247] Modules linked in:
[ 1.153518] CPU: 6 PID: 1 Comm: swapper/0 Tainted: G W 6.2.0-rc6-next-20230130 #3
[ 1.154293] Hardware name: Radxa ROCK 5 Model B (DT)
[ 1.154728] pstate: 00400009 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1.155336] pc : ftrace_free_mem+0x15c/0x350
[ 1.155718] lr : ftrace_free_mem+0x190/0x350
[ 1.156094] sp : ffffffc009f0bde0
[ 1.156384] x29: ffffffc009f0bde0 x28: 0000000000000000 x27: ffffffc00816c744
[ 1.157010] x26: ffffffc009da79e2 x25: ffffffc009f0be68 x24: ffffffc009b10000
[ 1.157636] x23: 0000000000000000 x22: ffffffc009c283f8 x21: ffffff83fc565000
[ 1.158261] x20: ffffffc009e6ba58 x19: ffffff83fc565080 x18: 0000000000000000
[ 1.158885] x17: 0000000000000000 x16: ffffffc0094fd694 x15: 0000000000000000
[ 1.159510] x14: ffffffc0094fd3c4 x13: 0000000000000000 x12: ffffffc0094fd714
[ 1.160136] x11: 0000000000000000 x10: ffffffc0094fd694 x9 : ffffffc008288aa8
[ 1.160760] x8 : ffffffc0094fd35c x7 : ffffffc009dab900 x6 : 0000000000000018
[ 1.161385] x5 : ffffff810006d3c0 x4 : ffffffc00816c744 x3 : 0000000000000010
[ 1.162010] x2 : ffffffc009b10000 x1 : ffffff83fc500000 x0 : fffffffffffffff0
[ 1.162636] Call trace:
[ 1.162852] ftrace_free_mem+0x15c/0x350
[ 1.163198] ftrace_free_init_mem+0x28/0x34
[ 1.163568] kernel_init+0x44/0x13c
[ 1.163878] ret_from_fork+0x10/0x20
[ 1.164197] Code: 54000808 b9401260 51000400 937c7c00 (f8606820)
[ 1.164731] ---[ end trace 0000000000000000 ]---
[ 1.165155] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 1.165824] SMP: stopping secondary CPUs
[ 1.166260] Kernel Offset: disabled
[ 1.166565] CPU features: 0x180000,001c0148,cc00720b
[ 1.167000] Memory Limit: none
[ 1.167272] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---