* [Buildroot] [PATCH v4] configs/rock5b: enable uboot-env on the SD card
@ 2024-10-23 18:25 Niklas Cassel via buildroot
2024-10-23 19:53 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Niklas Cassel via buildroot @ 2024-10-23 18:25 UTC (permalink / raw)
To: buildroot
Cc: Kilian Zinnecker, Damien Le Moal, Thomas Petazzoni, Niklas Cassel
From: Niklas Cassel <cassel@kernel.org>
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>
---
Changes since v3:
-Use partition type GUID to specify the partition to use, rather than
hardcoding an offset using uboot Kconfig CONFIG_ENV_OFFSET.
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
--
2.47.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH v4] configs/rock5b: enable uboot-env on the SD card
2024-10-23 18:25 [Buildroot] [PATCH v4] configs/rock5b: enable uboot-env on the SD card Niklas Cassel via buildroot
@ 2024-10-23 19:53 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-10-23 19:53 UTC (permalink / raw)
To: Niklas Cassel via buildroot
Cc: Niklas Cassel, Kilian Zinnecker, Damien Le Moal, Niklas Cassel
On Wed, 23 Oct 2024 20:25:09 +0200
Niklas Cassel via buildroot <buildroot@buildroot.org> wrote:
> From: Niklas Cassel <cassel@kernel.org>
>
> 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>
> ---
> Changes since v3:
> -Use partition type GUID to specify the partition to use, rather than
> hardcoding an offset using uboot Kconfig CONFIG_ENV_OFFSET.
Nice solution: applied to master, thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-23 19:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 18:25 [Buildroot] [PATCH v4] configs/rock5b: enable uboot-env on the SD card Niklas Cassel via buildroot
2024-10-23 19:53 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox