From: Niklas Cassel via buildroot <buildroot@buildroot.org>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Niklas Cassel <cassel@kernel.org>,
Damien Le Moal <dlemoal@kernel.org>,
Kilian Zinnecker <kilian.zinnecker@mail.de>,
Niklas Cassel via buildroot <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH 2/2] configs/rock5b_defconfig: enable uboot-env on the SD card
Date: Tue, 17 Sep 2024 08:35:16 +0000 [thread overview]
Message-ID: <Zuk_RMVJAzqVO5s8@ryzen.lan> (raw)
In-Reply-To: <20240914222032.3fee5e2e@windsurf>
On Sat, Sep 14, 2024 at 10:20:32PM +0200, Thomas Petazzoni wrote:
> > diff --git a/board/radxa/rock5b/genimage.cfg b/board/radxa/rock5b/genimage.cfg
> > index 43bb65bdd9..cd6c4e2dd4 100644
> > --- a/board/radxa/rock5b/genimage.cfg
> > +++ b/board/radxa/rock5b/genimage.cfg
> > @@ -9,6 +9,14 @@ image sdcard.img {
> > in-partition-table = "false"
> > image = "u-boot-rockchip.bin"
> > offset = 32K
> > + size = 16352K # 16MB - 32KB
>
> I believe this size parameter is not really useful. Indeed, the next
> partition has offset = 16 MB, so if the image in the previous partition
> is too large, genimage will complain.
You are right, genimage appears to still be able to figure this out and
give an error. Will remove in v2.
>
> And in fact, I believe we don't care about the offset of the env
> partition, see below.
>
> > diff --git a/configs/rock5b_defconfig b/configs/rock5b_defconfig
> > index b88d8c5da3..50f58d379d 100644
> > --- a/configs/rock5b_defconfig
> > +++ b/configs/rock5b_defconfig
> > @@ -15,6 +15,8 @@ BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> > BR2_TARGET_UBOOT_CUSTOM_VERSION=y
> > BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.01"
> > BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rock5b-rk3588"
> > +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/u-boot.fragment"
> > +BR2_TARGET_UBOOT_INITIAL_ENV=y
> > BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
> > BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
> > BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y
> > @@ -46,6 +48,10 @@ BR2_PACKAGE_HOST_DOSFSTOOLS=y
> > BR2_PACKAGE_HOST_DTC=y
> > BR2_PACKAGE_HOST_GENIMAGE=y
> > BR2_PACKAGE_HOST_MTOOLS=y
> > +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
> > +BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE=y
> > +BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE="output/target/etc/u-boot-initial-env"
>
> This won't work because the output directory is not always output/. But
> I believe this is useless, because you're creating an image of what is
> the default environment. So basically, you should instead not create an
> environment image at all: just tell U-Boot that the environment is at
> offset XYZ (or even better, in partition X). The environment partition
> will contain nothing or garbage, so at the first boot, U-Boot will use
> its built-in environment itself, and at the first "saveenv", it will
> save the environment to the designated partition.
Well, what happens if you simply point to an offset or partition that is
empty, is that uboot will see an empty environment, so it will see bootcmd
as empty, so it will just enter the uboot command prompt without booting
anything at all.
Sure, if you have serial console connected, you can just type:
env default -f -a; saveenv; run bootcmd
but not everyone has a serial console connected, so not booting
anything by default seems like a major regression.
I do however have a uboot script that will check if the env is empty,
and if so, write the default env and run bootcmd.
(So it will simply write the environment on first boot, otherwise
it will just run bootcmd.)
I thought that solution was a bit more hacky, but at least it will not
require us using a source file in "output/" (which apparently can also
have a different name than "output/").
I will submit v2 using this solution so that you can have a look.
Kind regards,
Niklas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-09-17 8:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 18:21 [Buildroot] [PATCH 0/2] rock5b quality of life improvements Niklas Cassel via buildroot
2024-09-09 18:21 ` [Buildroot] [PATCH 1/2] configs/rock5b: enable mdev to enable automatic module loading Niklas Cassel via buildroot
2024-09-14 20:15 ` Thomas Petazzoni via buildroot
2024-09-09 18:21 ` [Buildroot] [PATCH 2/2] configs/rock5b_defconfig: enable uboot-env on the SD card Niklas Cassel via buildroot
2024-09-14 20:20 ` Thomas Petazzoni via buildroot
2024-09-17 8:35 ` Niklas Cassel via buildroot [this message]
2024-09-17 8:46 ` Niklas Cassel via buildroot
2024-09-25 20:26 ` Thomas Petazzoni via buildroot
2024-10-03 13:45 ` Niklas Cassel via buildroot
2024-10-03 20:29 ` Niklas Cassel via buildroot
2024-10-03 13:49 ` Niklas Cassel via buildroot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zuk_RMVJAzqVO5s8@ryzen.lan \
--to=buildroot@buildroot.org \
--cc=Niklas.Cassel@wdc.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=kilian.zinnecker@mail.de \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox