Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: akuster808 <akuster808@gmail.com>
Cc: Marek Vasut <marex@denx.de>, openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] u-boot: Provide tasks to generate default U-Boot environment(s) images
Date: Thu, 11 Jul 2019 10:26:27 +0200	[thread overview]
Message-ID: <20190711102627.5da79564@jawa> (raw)
In-Reply-To: <55b42a36-6210-fc70-231f-db5bf033b5be@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4606 bytes --]

Hi,

> On 7/9/19 7:20 AM, Lukasz Majewski wrote:
> > This change provides tasks to generate default U-Boot environment
> > images from built U-Boot (via. get_default_envs.sh script).
> >
> > Those images then can be used to generate wic images (with e.g.
> > eMMC layout). With such approach the end user doesn't see the "CRC
> > environment" error after the first boot.
> >
> > Moreover, those are built per MACHINE (as u-boot itself is) so then
> > could be used in SWUpdate scenarios with single tar'ed archive with
> > multiple MACHINE specific *.swu images.  
> I like this idea.
> 
> 
> >
> > It is also possible to adjust the *_ENVS_* variables in machine
> > specific conf file.  
> Can you give an example on how that is done or what it would look
> like?

This code simply needs to have defined:

UBOOT_ENVS_SIZE in machine conf if two machines use different medium
for storing the envs (e.g. NAND vs SPI-NOR).

> 
> 
> I have been using this class I created a while back to do just that
> 
> https://github.com/akuster/meta-odroid/blob/master/classes/uboot-boot-scr.bbclass

It seems like your class builds the envs from provided values. 

Just a hint it is now possible with u-boot to "create" at build time
envs with data provided from a simple text file.

The patch here just extracts default envs from build u-boot.

Part of the wic script:

part u-boot-env --source rawcopy --sourceparams="file=u-boot-env.img"
--ondisk mmcblk --no-table --align 1024 

part u-boot-env-r --source rawcopy
--sourceparams="file=u-boot-env.img_r" --ondisk mmcblk --no-table
--align
1032                                                                                                                                                                


> 
> - armin
> 
> > Test:
> > Newest master-next for poky repo - SHA1:
> > eb5b0a0b5e53a6e55a09e66489d3f24d0c6232ee MACHINE =
> > "beaglebone-yocto" in local.conf bitbake virtual/bootloader
> >
> >
> > As a result following links are available in deploy directory:
> > u-boot-env.img{_r}.
> >
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> >  meta/recipes-bsp/u-boot/u-boot.inc | 41
> > ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41
> > insertions(+)
> >
> > diff --git a/meta/recipes-bsp/u-boot/u-boot.inc
> > b/meta/recipes-bsp/u-boot/u-boot.inc index 9a754fd09b..e0ccf1ce1f
> > 100644 --- a/meta/recipes-bsp/u-boot/u-boot.inc
> > +++ b/meta/recipes-bsp/u-boot/u-boot.inc
> > @@ -331,3 +331,44 @@ do_deploy () {
> >  }
> >  
> >  addtask deploy before do_build after do_compile
> > +
> > +# Extract default envs from build U-Boot
> > +DEFAULT_UBOOT_ENVS_FILE ?= "u-boot-env"
> > +DEFAULT_ENVS ?= "${DEFAULT_UBOOT_ENVS_FILE}.txt"
> > +UBOOT_ENVS_DEFAULT ?=
> > "${DEFAULT_UBOOT_ENVS_FILE}-${MACHINE}-${PV}-${PR}.img"
> > +UBOOT_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 ${UBOOT_ENVS_SIZE} -o
> > ${B}/${UBOOT_ENVS_DEFAULT} ${B}/${DEFAULT_ENVS} +
> > +    # Generate redundant env image
> > +    ${B}/tools/mkenvimage -r -s ${UBOOT_ENVS_SIZE} -o
> > ${B}/${UBOOT_ENVS_DEFAULT}_r ${B}/${DEFAULT_ENVS} +
> > +    rm ${B}/${DEFAULT_ENVS}
> > +}
> > +
> > +addtask gen_default_envs before do_deploy 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_DEFAULT}
> > +     install ${B}/${UBOOT_ENVS_DEFAULT}_r
> > ${DEPLOYDIR}/${UBOOT_ENVS_DEFAULT}_r +
> > +     cd ${DEPLOYDIR}
> > +     ln -sf ${UBOOT_ENVS_DEFAULT} ${DEFAULT_UBOOT_ENVS_FILE}.img
> > +     ln -sf ${UBOOT_ENVS_DEFAULT}_r
> > ${DEFAULT_UBOOT_ENVS_FILE}.img_r +
> > +     rm ${B}/${UBOOT_ENVS_DEFAULT}
> > +     rm ${B}/${UBOOT_ENVS_DEFAULT}_r
> > +}
> > +
> > +addtask deploy_default_envs before do_deploy after
> > do_gen_default_envs  
> 
> 




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-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

      reply	other threads:[~2019-07-11  8:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 14:20 [PATCH] u-boot: Provide tasks to generate default U-Boot environment(s) images Lukasz Majewski
2019-07-10  8:54 ` Richard Purdie
2019-07-10  9:20   ` Lukasz Majewski
2019-07-10 13:32 ` akuster808
2019-07-11  8:26   ` Lukasz Majewski [this message]

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=20190711102627.5da79564@jawa \
    --to=lukma@denx.de \
    --cc=akuster808@gmail.com \
    --cc=marex@denx.de \
    --cc=openembedded-core@lists.openembedded.org \
    /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