Recently I've been playing around with the Radxa ROCK 5B+. Turns out installing Gentoo on it is a rather involved process, especially if you want a bcachefs rootfs. For those of you wondering why on earth someone would want to do that: this post is not about the why, but about the how. I have my reasons.

The ROCK 5B+ supports loading U-Boot from its SPI NOR flash chip. However, that chip is empty when the board leaves the factory. It can also load U-Boot from a microSD card. So you could write Radxa OS to a microSD card, and continue from there, but I prefer using what I know. As I'm an OpenWrt developer, and I know that OpenWrt supports various Rockchip based boards, that's where I started. Checking the rockchip target in OpenWrt, I quickly learned it supports the ROCK 5B. Not the same board, but it's very similar. So let's build an OpenWrt image for the ROCK 5B, flash it to a microSD card, and see if it boots.

It does, but unfortunately I hit a bunch of problems along the way.

Problem 1: the Gentoo ARM64 install ISO requires a UEFI capable bootloader

And the Gentoo ARM64 install ISO doesn't come with one. This is not unusual, as most boards require a bootloader built specifically for that board. So we'll have to build our own. Shouldn't be too difficult. But unless you already have a working ARM64 system, you'll need to set up a cross compiler. Still shouldn't be too difficult, but might be time consuming. But hey, I build OpenWrt all the time, and it does all the hard work for you. So I used OpenWrt to build an image for the ROCK 5B, and flashed it (openwrt-rockchip-armv8-radxa_rock-5b-squashfs-sysupgrade.img.gz) to a microSD card. Threw it in the microSD slot of the ROCK 5B+, connected a USB to TTL adapter, and powered on the board. Result: the board boots!

Now we can flash U-Boot to the SPI NOR. Transfer the build_dir/target-aarch64_generic_musl/u-boot-rock5b-rk3588/u-boot-2025.01/u-boot-rockchip-spi.bin file built by OpenWrt and write it to the SPI NOR:

dd if=/tmp/u-boot-rock5b-rk3588/u-boot-2025.01/u-boot-rockchip-spi.bin of=/dev/mtdblock0 bs=4k

Great, now we have a UEFI capable U-Boot on the board, and we can boot the Gentoo ARM64 install ISO from a microSD card.

Problem 2: no console output due to confusing documentation and unusual baud rate

The ROCK 5B+ uses baud rate 1500000 by default, which is not very common. Most hardware I've played around with uses 115200. In addition, checking the documentation for the board initially led me to use the wrong pins on the 40 pin header. You need to use the pins as documented here. Not sure how, but initially I ended up on this page and tried totally wrong pins, which resulted in no output whatsoever on the serial console.

Problem 3: Gentoo ARM64 install ISO does not support serial console baud rate > 115200

After using the correct pins, I can see output on the serial console. Yay! Boot the Gentoo ARM64 install ISO from a microSD, edit the boot entry to append console=ttyS2,1500000 to the kernel command line, and try to boot it. Almost! Everything appears to be going well, until it has to spawn getty on the serial console. It correctly detects the serial console is on ttyS2 from the kernel command line option, but unfortunately no output is shown after starting the getty.

Turns out the scripts to handle serial console in the Gentoo livecd-tools do not support baud rates above 115200. Apparently this is 20 year old code that hardcodes the baud rates it considers valid, with 115200 being the highest supported. No problem. Reset the board, abort the U-Boot boot sequence, run setenv baudrate 115200. Kill your serial console client, restart it with a baud rate of 115200, and run boot. Now append edit the boot entry to append console=ttyS2,115200 to the kernel command line, and try booting it again. Low and behold, we get the bash prompt from the Gentoo ARM64 install ISO!

I've reported the issue in the Gentoo Bugzilla.

Problem 4: bcachefs-tools not included in Gentoo ARM64 install ISO

Great, we were finally able to boot the Gentoo ARM64 install ISO, which turns out to be using a 6.12 kernel, with support for bcachefs enabled. Getting closer. But then it appeared bcachefs-tools is not included in the ISO, so we're not able to create any bcachefs filesystems. ARGH! Now what? Let's try the Arch Linux ARM64 install ISO. Download, write to microSD, slide in the ROCK 5B+, and try to boot. Don't forget to switch your serial console client back to baud rate 1500000 first. Edit the 'Archboot - Arch Linux AA64' entry, append console=ttyS2,1500000 to the kernel command line, and try to boot.

Problem 5: panthor module crashes kernel

Great. Now the kernel on the Arch Linux install medium crashes. Apparently a known issue for months, but it hasn't been fixed. Reboot and add modprobe.blacklist=panthor to the kernel command line. Now we finally arrive in a usable live system. From here, we can follow the Gentoo Handbook. Or at least, that's what I hoped. Instead, we're hitting the next problem.

Problem 6: no network in Arch Linux livecd

This worked fine in the Gentoo install ISO, which had an older kernel. Means we won't be able to download the stage 3 tarball, etc. We could put it on on a USB flash drive, but then portage in the chroot will also not be able to download anything. Partition your drive, and format the root filesystem as bcachefs from the Arch Linux livecd. Finally, shut down the system, insert the microSD card with the Gentoo ARM64 install ISO again, and repeat part of the steps from problem 3.

Final words

We can now mount the bcachefs rootfs we created in the Arch Linux install medium. From here on, we can follow the usual steps in the Gentoo Handbook. Using GRUB would probably be the easiest, but I decided to give systemd-boot a try. As if I didn't make this installation hard enough on myself already. I'll do a follow-up post on this in the near future.