From: Lukasz Majewski <lukma@denx.de>
To: Martin Jansa <martin.jansa@gmail.com>
Cc: Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>,
Stefan Agner <stefan.agner@toradex.com>,
OpenEmbedded Core Mailing List
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] u-boot: Add {gen|deploy}_default_envs tasks to generate environment images
Date: Mon, 30 Apr 2018 16:22:29 +0200 [thread overview]
Message-ID: <20180430162229.62155473@jawa> (raw)
In-Reply-To: <CA+chaQdBDAXRA9i=eH67qTRK-cGZbtrNNEWN9XWkEyEF5b7xow@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5159 bytes --]
Hi Martin,
> And here is example how we're using it:
>
> https://github.com/webosose/meta-webosose/blob/master/meta-webos-raspberrypi/recipes-bsp/u-boot/u-boot-env.bb
>
> To make it compatible with raspberrypi3 and raspberrypi3-64, I've
> updated it a bit to select correct IMAGETYPE and BOOTCMD based on the
> environment:
>
> do_compile() {
> sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
> -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
> "${WORKDIR}/uboot-env.txt.in" > "${WORKDIR}/uboot-env.txt"
> uboot-mkenvimage -s 16384 -o uboot.env ${WORKDIR}/uboot-env.txt
> }
>
Thanks for sharing the code (and detailed explanation).
>
> On Mon, Apr 30, 2018 at 3:23 PM, Martin Jansa <martin.jansa@gmail.com>
> wrote:
>
> > u-boot-mkimage already builds mkenvimage, you just need to install
> > it in do_install:
> >
> > install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage
> > ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage
> >
> > This is what we have in
> > recipes-bsp/u-boot/u-boot-mkimage_%.bbappend and it works fine.
> >
> > On Mon, Apr 30, 2018 at 8:50 AM, Martin Hundebøll <mnhu@prevas.dk>
> > wrote:
> >> Hi Lukasz,
> >>
> >> On 2018-04-27 16:51, Lukasz Majewski wrote:
> >>
> >>> This commit provides the ability to generate u-boot
> >>> environment(s) as images, which afterwards can be used to produce
> >>> image (with wic) for flashing (eMMC or SPI-NOR).
> >>>
> >>> This change removes the need to run "env default" during
> >>> production phase,
> >>> as proper environment (including redundant one) is already stored
> >>> on persistent memory (the CRC is also correct).
> >>>
> >>
> >> I think we should create a separate recipe to install the native
> >> mkenvimage binary (e.g. u-boot-mkenvimage_%.bb) or update
> >> u-boot-mkimage_%.bb install it.
> >>
> >> Then a new recipe to create the environment images can depend on
> >> u-boot-mkenvimage-native.
> >>
> >> Also note the recently added upstream support for external
> >> environment definitions:
> >> http://git.denx.de/?p=u-boot.git;a=commit;h=f3d8f7dd73ac5dde
> >> 258eb786d4a01869395b56d7
> >>
> >> For our usecase we need the ability to generate environment images
> >> in yocto from such external definitions.
> >>
> >> // Martin
> >>
> >>
> >>> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> >>>
> >>> ---
> >>> This patch depends on "u-boot: Upgrade to 2018.03 release"
> >>> https://patchwork.openembedded.org/patch/149998/
> >>> ---
> >>> meta/recipes-bsp/u-boot/u-boot.inc | 35
> >>> ++++++++++++++++++++++++++++++ +++++
> >>> 1 file changed, 35 insertions(+)
> >>>
> >>> diff --git a/meta/recipes-bsp/u-boot/u-boot.inc
> >>> b/meta/recipes-bsp/u-boot/u-boot.inc
> >>> index c2bcf99840..2796e503cf 100644
> >>> --- a/meta/recipes-bsp/u-boot/u-boot.inc
> >>> +++ b/meta/recipes-bsp/u-boot/u-boot.inc
> >>> @@ -305,3 +305,38 @@ do_deploy () {
> >>> }
> >>> addtask deploy before do_build after do_compile
> >>> +
> >>> +# Create new rules to extract default envs
> >>> +UBOOT_ENVS_DEFAULT ?= "uboot-envs-default"
> >>> +DEFAULT_ENVS ?= "u-boot-env-default.txt"
> >>> +DEFAULT_ENVS_SIZE ?= "65536"
> >>> +
> >>> +# Generate default environment
> >>> +do_gen_default_envs[doc] = "Generate image with default U-Boot
> >>> environment(s)"
> >>> +do_gen_default_envs () {
> >>> + ${B}/source/scripts/get_default_envs.sh ${B} >
> >>> ${B}/${DEFAULT_ENVS}
> >>> +
> >>> + # Generate env image
> >>> + ${B}/tools/mkenvimage -s ${DEFAULT_ENVS_SIZE} -o
> >>> ${B}/${UBOOT_ENVS_DEFAULT} ${B}/${DEFAULT_ENVS}
> >>> +
> >>> + # Generate redundant env image
> >>> + ${B}/tools/mkenvimage -r -s ${DEFAULT_ENVS_SIZE} -o
> >>> ${B}/${UBOOT_ENVS_DEFAULT}_r ${B}/${DEFAULT_ENVS}
> >>> +
> >>> + rm ${B}/${DEFAULT_ENVS}
> >>> +}
> >>> +
> >>> +addtask gen_default_envs before do_deploy_default_envs after
> >>> do_compile +
> >>> +# Deploy default environment
> >>> +do_deploy_default_envs[doc] = "Copy images with default U-Boot
> >>> environment to deployment directory"
> >>> +do_deploy_default_envs () {
> >>> + install -d ${DEPLOYDIR}
> >>> +
> >>> + install ${B}/${UBOOT_ENVS_DEFAULT}
> >>> ${DEPLOYDIR}/${UBOOT_ENVS_DEFA ULT}
> >>> + install ${B}/${UBOOT_ENVS_DEFAULT}_r
> >>> ${DEPLOYDIR}/${UBOOT_ENVS_DEFAULT}_r
> >>> +
> >>> + rm ${B}/${UBOOT_ENVS_DEFAULT}
> >>> + rm ${B}/${UBOOT_ENVS_DEFAULT}_r
> >>> +}
> >>> +
> >>> +addtask deploy_default_envs before do_deploy after
> >>> do_gen_default_envs
> >>>
> >>> --
> >> _______________________________________________
> >> Openembedded-core mailing list
> >> Openembedded-core@lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >>
> >
> >
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]
next prev parent reply other threads:[~2018-04-30 14:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 14:51 [PATCH] u-boot: Add {gen|deploy}_default_envs tasks to generate environment images Lukasz Majewski
2018-04-27 15:07 ` Marek Vasut
2018-04-27 16:15 ` Lukasz Majewski
2018-04-27 17:37 ` Marek Vasut
2018-04-29 13:53 ` Lukasz Majewski
2018-04-29 14:07 ` Marek Vasut
2018-04-30 14:03 ` Otavio Salvador
2018-04-30 17:32 ` Marek Vasut
2018-05-03 16:28 ` Stefano Babic
2018-05-03 16:36 ` Marek Vasut
2018-05-03 16:50 ` Stefano Babic
2018-05-03 16:59 ` Marek Vasut
2018-05-03 18:15 ` Lukasz Majewski
2018-05-03 19:02 ` Marek Vasut
2018-05-09 11:45 ` Lukasz Majewski
2018-05-09 11:57 ` Marek Vasut
2018-05-03 20:58 ` Stefano Babic
2018-05-03 23:04 ` Marek Vasut
2018-04-30 6:50 ` Martin Hundebøll
2018-04-30 8:18 ` Lukasz Majewski
2018-04-30 13:23 ` Martin Jansa
2018-04-30 13:26 ` Martin Jansa
2018-04-30 14:22 ` Lukasz Majewski [this message]
2018-05-03 16:24 ` Stefano Babic
2018-05-03 18:17 ` Lukasz Majewski
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=20180430162229.62155473@jawa \
--to=lukma@denx.de \
--cc=marex@denx.de \
--cc=martin.jansa@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=stefan.agner@toradex.com \
--cc=trini@konsulko.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