Browse Source

configs/rock5b: enable uboot-env on the SD card

Having the uboot environment defined on the SD card allows the user to
use the uboot setenv and saveenv commands to make persistent changes
(e.g. to change the boot order, or to set a server IP for PXE boot).

Set the uboot-env partition type GUID to "U-Boot environment", see:
https://github.com/u-boot/u-boot/blob/v2024.10/doc/README.gpt#L288
https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
and enable CONFIG_PARTITION_TYPE_GUID such that uboot will automatically
find the SD card partition to store/load the uboot environment to.

We need to mark the root partition as bootable, otherwise uboot will no
longer be able to boot the partition by default. (Most likely because
the root partition is now no longer the first partition on the device.)

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Niklas Cassel 9 months ago
parent
commit
93487f1566
3 changed files with 13 additions and 0 deletions
  1. 7 0
      board/radxa/rock5b/genimage.cfg
  2. 5 0
      board/radxa/rock5b/u-boot.fragment
  3. 1 0
      configs/rock5b_defconfig

+ 7 - 0
board/radxa/rock5b/genimage.cfg

@@ -11,8 +11,15 @@ image sdcard.img {
 		offset = 32K
 	}
 
+	partition uboot-env {
+		partition-type-uuid = 3de21764-95bd-54bd-a5c3-4abe786f38a8
+		offset = 16M
+		size = 64K
+	}
+
 	partition rootfs {
 		partition-type-uuid = L
 		image = "rootfs.ext2"
+		bootable = true
 	}
 }

+ 5 - 0
board/radxa/rock5b/u-boot.fragment

@@ -0,0 +1,5 @@
+CONFIG_ENV_SIZE=0x10000
+CONFIG_PARTITION_TYPE_GUID=y
+# CONFIG_ENV_IS_NOWHERE is not set
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_MMC_ENV_DEV=1

+ 1 - 0
configs/rock5b_defconfig

@@ -34,6 +34,7 @@ BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
 BR2_TARGET_UBOOT_CUSTOM_VERSION=y
 BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.10"
 BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rock5b-rk3588"
+BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/u-boot.fragment"
 BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
 BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y
 BR2_TARGET_UBOOT_NEEDS_OPENSSL=y