From 93487f1566974d17630a432e2cc3db38b29c888d Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Wed, 23 Oct 2024 20:25:09 +0200 Subject: [PATCH] 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 Signed-off-by: Thomas Petazzoni --- board/radxa/rock5b/genimage.cfg | 7 +++++++ board/radxa/rock5b/u-boot.fragment | 5 +++++ configs/rock5b_defconfig | 1 + 3 files changed, 13 insertions(+) create mode 100644 board/radxa/rock5b/u-boot.fragment diff --git a/board/radxa/rock5b/genimage.cfg b/board/radxa/rock5b/genimage.cfg index 43bb65bdd9..070cc03dc2 100644 --- a/board/radxa/rock5b/genimage.cfg +++ b/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 } } diff --git a/board/radxa/rock5b/u-boot.fragment b/board/radxa/rock5b/u-boot.fragment new file mode 100644 index 0000000000..ceba8d609a --- /dev/null +++ b/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 diff --git a/configs/rock5b_defconfig b/configs/rock5b_defconfig index d75ad585fb..af748a5d25 100644 --- a/configs/rock5b_defconfig +++ b/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