Jump to content

Recommended Posts

Posted

Hi,

 

I've a rock-3a board with an NVMe device and a BTRFS filesystem using the whole disk ( no partitions )

 

I've seen some devices having BTRFS support in u-boot, so first thing I built the u-boot images using the extension:

 

cat extensions/uboot-btrfs.sh
# Enable BTRFS support in u-boot

function post_config_uboot_target__enable_uboot_btrfs_support() {
display_alert "u-boot for ${BOARD}/${BRANCH}" "u-boot: enable BTRFS filesystem support" "info"
run_host_command_logged scripts/config --enable CONFIG_CMD_BTRFS
}

 

And patched the configuration of the board:

 

git diff .
diff --git a/config/boards/rock-3a.conf b/config/boards/rock-3a.conf
index 401894fa5..90f8a8a72 100644
--- a/config/boards/rock-3a.conf
+++ b/config/boards/rock-3a.conf
@@ -15,12 +15,15 @@ BOOT_SPI_RKSPI_LOADER="yes"
IMAGE_PARTITION_TABLE="gpt"
BOOTFS_TYPE="fat"

+# Enable btrfs support in u-boot
+enable_extension "uboot-btrfs"
+
function post_family_config__rock-3a_use_mainline_uboot_except_vendor_and_add_sata_target() {
display_alert "$BOARD" "Configuring ($BOARD) standard and sata uboot target map" "info"
UBOOT_TARGET_MAP="

 

 

./compile.sh artifact BOARD=rock-3a BRANCH=current RELEASE=trixie BUILD_MINIMAL=yes BUILD_DESKTOP=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,img ROOTFS_TYPE=btrfs FIXED_IMAGE_SIZE=4096 DISABLE_IPV6=false WHAT=uboot

  

With this I flashed the SPI image:

 

root@rock-3a:~# flashcp u-boot-rockchip-spi.bin  /dev/mtd0

root@rock-3a:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01000000 00001000 "spi4.0"

 

So, then I booted it without the SD card I use for the /boot partition, used the serial port ( as it didn't autoboot )  and I saw:

 

=> nvme info
Device 0: Vendor: 0x2646 Rev: SBM02103 Prod: 50026B778514A843 e: Hard Disk
Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)


=> btrsubvol nvme 0:1
** No partition table - nvme 0 **
Couldn't find partition nvme 0:1
=> btrsubvol nvme 0:0
ID 257 gen 153600 path /@rootfs/
ID 257 gen 153600 path /@rootfs/
ID 259 gen 153599 path /@home/

=> ls nvme 0:0 /boot/
<DIR>         16  Sat Dec 06 08:32:08 2025  dtb
<   >          0  Sat Dec 06 08:44:38 2025  .next
<   >   37679616  Sat Nov 15 03:03:00 2025  Image
<   >    5560276  Tue Nov 11 22:48:14 202urrent-rockchip64
<   >    5560445  Sat Nov 15 03:03:00 2025  System.map-6.12.58-current-rockchip64
<   >        236  Sat Dec 06 08:54:54 2025  armbianEnv.txt<   >        200  Sat Sep 09 08:armbianEnv.txt.old
<   >          0  Tue Jun 18 18:05:14 2024  armbianEnv.txt.out
<   >       1536  Thu Aug 31 17:25:06 2023  armbian_first_run.txt.template
<   >      38518  Thu Aug 31 17:25:04 2023  boot.bmp
<   >       3180  Thu Aug 31 17:20:00 2023  boot.cmd
<   >       3252  Thu Aug 31 17:26:44 20  boot.scr
<   >     258746  Tue Nov 11 22:48:14 2025  config-6.12.57-current-rockchip64
<   >     258803  Sat Nov 15 03:03:00 2025  config-6.12.58-current-ro<   >   29107600  Tue Nov 25 21:2 2025  initrd.img-6.12.57-current-rockchip64
<   >   29108356  Sat Dec 06 08:44:34 2025  initrd.img-6.12.58-current-rockchip64<   >   29108420  Sat Dec 06 08:
  

 

So it can read BTRFS, but no booting, I tried manually based on some commands I get but no luck:

 

=> load nvme 0:0 $loadaddr /boot/boot.scr
3252 bytes read in 27 ms (117.2 KiB/s)

=> source
## Executing script at 00c00800
Boot script loaded from
** Bad device specification 0x9000000 armbianEnv **
** Bad device specification 0x9000000 armbianEnv.txt **
Couldn't find partit
Can't set block device
** Bad device specification 0x12180000 uInitrd **
** Bad device specification 0x12180000 uInitrd **
Couldn't find partition 0x1218000ck device
** Bad device specification 0x02000000 Image **
** Bad device specification 0x020000on 0x02000000 Image
Can't set block device
** Bad device specification 0x12000000 dtb/rockchipspecification 0x12000000 dtb/rockchip/rk3568-rock-3a.dtb **
Couldn't find partition 0x12000000 t set block device
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
No FDT memory address configure via "fdt addr <address>" command.
Aborting!
** Bad device specification 0x9000000 dtb/rockchiay/-fixup **
** Bad device specification 0x9000000 dtb/rockchip/overlay/-fixup.scr **
Couldn'tp/overlay/-fixup.scr
Can't set block device
** Bad device specification 0x9000000 fixup **
**0 fixup.scr **
Couldn't find partition 0x9000000 fixup.scr
Can't set block device
Applying us
## Executing script at 09000000
Wrong image format for "source" command
Unknown command 'kaslRM64 Image magic!

 

I'd like to get this worked, I can test anything you can provide me, I'm a n00b trying to learn a bit more about U-Boot.

 

Thanks in advance. 

 

 

Posted (edited)

Your serial console cable seems to drop several characters or so, but that should not matter for booting.

 

What matters I think is that you have no partition and I see in boot.cmd

test -n "${distro_bootpart}" || distro_bootpart=1

echo "Boot script loaded from ${devtype} ${devnum}:${distro_bootpart}"

 

This 1 year old, yours might be different.  So if your boot.scr is still compiled from such boot.cmd content (see end of file how), I think it won't work. I have used parttitionless Btrfs, but not for OS rootfs, I also think GRUB will need a hack then. So if possible make it with just as default as possible, a 1st partition btrfs formatted with rootfs and likely also the rootfs subvol set as default. Also that is a tricky thing with GRUB (Debian) I know. I wiped a bootFAT partition actually, so about 16M+256M space before rootfs partition and also sorted the GPT table to default, so 1st entry Btrfs rootfs.

 

I find the boot cmd rather complex, I used a minimum direct one as well for tests. see 

 

My (ROCK3A 24/7 up now) has bootFAT again, I did wipe/hide boot.* and armbianEnv.txt and use extlinux, so I can select a specific kernel option via serial console.

 

/extlinux/extlinux.conf

menu title Select the kernel variant
DEFAULT vendor
TIMEOUT 80
LABEL vendor
       KERNEL 6.1.115-vendor-rk35xx/Image
       INITRD 6.1.115-vendor-rk35xx/uInitrd
       FDT    6.1.115-vendor-rk35xx/rk3568-rock-3a.dtb
       FDTOVERLAYS 6.1.115-vendor-rk35xx/rock-3a-sata.dtbo
       APPEND root=LABEL=armbidroot rootwait rw earlyprintk console=ttyS2,1500000 cma=256M
LABEL edge
       KERNEL 6.17.0-edge-rockchip64/Image
       INITRD 6.17.0-edge-rockchip64/uInitrd
       FDT    6.17.0-edge-rockchip64/rk3568-rock-3a.dtb
       APPEND root=LABEL=armbidroot rootwait rw earlyprintk console=ttyS2,1500000 cma=256M

As this is on extra FAT, I need extra copies for all the files referenced, but when only 1 Btrfs, it should be possible to refer to files in /boot and elsewhere.

Edited by eselarm
Posted

Hi @eselarm, thanks for the detailed response.

 

I've checked my boot.cmd and boot.scr is ancient ( from Aug 2023 ).

 

I'm going to try to set the variables beforehand, as I see in the output they are blank ( devtype, devnum, prefix ). 

 

When I succeed I guess the next step will be to set these variables in U-Boot, but nowadays there's no gpt partition table in SPI with the uboot_env, so I guess will need to figure it out later ( via env or find the boot.scr in the NVMe ), first I want to try to boot from NVMe manually.

 

Thanks again

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines