diff mbox series

[U-Boot,v1,1/2] buildman: Extract environment as part of each build

Message ID 20180525045704.21658-1-alex.kiernan@gmail.com
State Superseded
Delegated to: Simon Glass
Headers show
Series [U-Boot,v1,1/2] buildman: Extract environment as part of each build | expand

Commit Message

Alex Kiernan May 25, 2018, 4:57 a.m. UTC
As we're building the boards, extract the default U-Boot environment to
uboot.env so we can interrogate it later.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 tools/buildman/builderthread.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Lukasz Majewski May 25, 2018, 8:03 a.m. UTC | #1
Hi Alex,

> As we're building the boards, extract the default U-Boot environment
> to uboot.env so we can interrogate it later.

If applicable, you may also consider using:
scripts/get_default_envs.sh

script to extract default envs (to txt file).

> 
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
> 
>  tools/buildman/builderthread.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/tools/buildman/builderthread.py
> b/tools/buildman/builderthread.py index 0efe80d945..688322ced2 100644
> --- a/tools/buildman/builderthread.py
> +++ b/tools/buildman/builderthread.py
> @@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
>                      lines.append(size_result.stdout.splitlines()[1]
> + ' ' + rodata_size)
>  
> +            # Extract the environment from U-Boot and dump it out
> +            cmd = ['%sobjcopy' % self.toolchain.cross, '-O',
> 'binary',
> +                   '-j', '.rodata.default_environment',
> +                   'env/built-in.o', 'uboot.env']
> +            command.RunPipe([cmd], capture=False,
> +                            capture_stderr=False, cwd=result.out_dir,
> +                            raise_on_error=False, env=env)
> +            ubootenv = os.path.join(result.out_dir, 'uboot.env')
> +            self.CopyFiles(result.out_dir, build_dir, '',
> ['uboot.env']) +
>              # Write out the image sizes file. This is similar to the
> output # of binutil's 'size' utility, but it omits the header line and
>              # adds an additional hex value at the end of each line
> for the




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
Alex Kiernan May 25, 2018, 8:56 a.m. UTC | #2
On Fri, May 25, 2018 at 9:05 AM Lukasz Majewski <lukma@denx.de> wrote:

> Hi Alex,

> > As we're building the boards, extract the default U-Boot environment
> > to uboot.env so we can interrogate it later.

> If applicable, you may also consider using:
> scripts/get_default_envs.sh

> script to extract default envs (to txt file).


I started with that, but then tripped over boards which have embedded
newlines in their environment variables, which then made parsing the
resulting text file much harder, which is why I swapped back to just using
the NUL terminated blob. Of course I can't now find the one I tripped over
to point at :(

> >
> > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > ---
> >
> >  tools/buildman/builderthread.py | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/tools/buildman/builderthread.py
> > b/tools/buildman/builderthread.py index 0efe80d945..688322ced2 100644
> > --- a/tools/buildman/builderthread.py
> > +++ b/tools/buildman/builderthread.py
> > @@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
> >                      lines.append(size_result.stdout.splitlines()[1]
> > + ' ' + rodata_size)
> >
> > +            # Extract the environment from U-Boot and dump it out
> > +            cmd = ['%sobjcopy' % self.toolchain.cross, '-O',
> > 'binary',
> > +                   '-j', '.rodata.default_environment',
> > +                   'env/built-in.o', 'uboot.env']
> > +            command.RunPipe([cmd], capture=False,
> > +                            capture_stderr=False, cwd=result.out_dir,
> > +                            raise_on_error=False, env=env)
> > +            ubootenv = os.path.join(result.out_dir, 'uboot.env')
> > +            self.CopyFiles(result.out_dir, build_dir, '',
> > ['uboot.env']) +
> >              # Write out the image sizes file. This is similar to the
> > output # of binutil's 'size' utility, but it omits the header line and
> >              # adds an additional hex value at the end of each line
> > for the




> 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
Alex Kiernan May 25, 2018, 10:03 a.m. UTC | #3
On Fri, May 25, 2018 at 9:56 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:


> On Fri, May 25, 2018 at 9:05 AM Lukasz Majewski <lukma@denx.de> wrote:

> > Hi Alex,

> > > As we're building the boards, extract the default U-Boot environment
> > > to uboot.env so we can interrogate it later.

> > If applicable, you may also consider using:
> > scripts/get_default_envs.sh

> > script to extract default envs (to txt file).


> I started with that, but then tripped over boards which have embedded
> newlines in their environment variables, which then made parsing the
> resulting text file much harder, which is why I swapped back to just using
> the NUL terminated blob. Of course I can't now find the one I tripped over
> to point at :(


ge_bx50v3 and mx53ppd (the failbootcmd variable)

> > >
> > > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > > ---
> > >
> > >  tools/buildman/builderthread.py | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > >
> > > diff --git a/tools/buildman/builderthread.py
> > > b/tools/buildman/builderthread.py index 0efe80d945..688322ced2 100644
> > > --- a/tools/buildman/builderthread.py
> > > +++ b/tools/buildman/builderthread.py
> > > @@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
> > >                      lines.append(size_result.stdout.splitlines()[1]
> > > + ' ' + rodata_size)
> > >
> > > +            # Extract the environment from U-Boot and dump it out
> > > +            cmd = ['%sobjcopy' % self.toolchain.cross, '-O',
> > > 'binary',
> > > +                   '-j', '.rodata.default_environment',
> > > +                   'env/built-in.o', 'uboot.env']
> > > +            command.RunPipe([cmd], capture=False,
> > > +                            capture_stderr=False, cwd=result.out_dir,
> > > +                            raise_on_error=False, env=env)
> > > +            ubootenv = os.path.join(result.out_dir, 'uboot.env')
> > > +            self.CopyFiles(result.out_dir, build_dir, '',
> > > ['uboot.env']) +
> > >              # Write out the image sizes file. This is similar to the
> > > output # of binutil's 'size' utility, but it omits the header line and
> > >              # adds an additional hex value at the end of each line
> > > for the




> > 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



> --
> Alex Kiernan



--
Alex Kiernan
Simon Glass May 26, 2018, 2:07 a.m. UTC | #4
Hi Alex,

On 24 May 2018 at 22:57, Alex Kiernan <alex.kiernan@gmail.com> wrote:
> As we're building the boards, extract the default U-Boot environment to
> uboot.env so we can interrogate it later.
>
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
>
>  tools/buildman/builderthread.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)

I wonder if this should be an option? Is the file large?

Also please update the README to mention this.

Regards,
Simon
Alex Kiernan May 26, 2018, 5:19 a.m. UTC | #5
On Sat, May 26, 2018 at 3:07 AM Simon Glass <sjg@chromium.org> wrote:

> Hi Alex,

> On 24 May 2018 at 22:57, Alex Kiernan <alex.kiernan@gmail.com> wrote:
> > As we're building the boards, extract the default U-Boot environment to
> > uboot.env so we can interrogate it later.
> >
> > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > ---
> >
> >  tools/buildman/builderthread.py | 10 ++++++++++
> >  1 file changed, 10 insertions(+)

> I wonder if this should be an option? Is the file large?


Only as big as the things that are defined - it's not the full size of
CONFIG_ENV_SIZE. The biggest one I've got sitting around is just under 6k,
which for that particular board is about 2.5% of the disk use for the whole
result directory - doesn't feel like a huge increase.

> Also please update the README to mention this.


Will do.
Simon Glass May 26, 2018, 10:18 p.m. UTC | #6
Hi Alex,

On 25 May 2018 at 23:19, Alex Kiernan <alex.kiernan@gmail.com> wrote:
> On Sat, May 26, 2018 at 3:07 AM Simon Glass <sjg@chromium.org> wrote:
>
>> Hi Alex,
>
>> On 24 May 2018 at 22:57, Alex Kiernan <alex.kiernan@gmail.com> wrote:
>> > As we're building the boards, extract the default U-Boot environment to
>> > uboot.env so we can interrogate it later.
>> >
>> > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
>> > ---
>> >
>> >  tools/buildman/builderthread.py | 10 ++++++++++
>> >  1 file changed, 10 insertions(+)
>
>> I wonder if this should be an option? Is the file large?
>
>
> Only as big as the things that are defined - it's not the full size of
> CONFIG_ENV_SIZE. The biggest one I've got sitting around is just under 6k,
> which for that particular board is about 2.5% of the disk use for the whole
> result directory - doesn't feel like a huge increase.

OK that sounds fine to me.

>
>> Also please update the README to mention this.
>
>
> Will do.
>
> --
> Alex Kiernan

Regards,
Simon
diff mbox series

Patch

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 0efe80d945..688322ced2 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -351,6 +351,16 @@  class BuilderThread(threading.Thread):
                     lines.append(size_result.stdout.splitlines()[1] + ' ' +
                                  rodata_size)
 
+            # Extract the environment from U-Boot and dump it out
+            cmd = ['%sobjcopy' % self.toolchain.cross, '-O', 'binary',
+                   '-j', '.rodata.default_environment',
+                   'env/built-in.o', 'uboot.env']
+            command.RunPipe([cmd], capture=False,
+                            capture_stderr=False, cwd=result.out_dir,
+                            raise_on_error=False, env=env)
+            ubootenv = os.path.join(result.out_dir, 'uboot.env')
+            self.CopyFiles(result.out_dir, build_dir, '', ['uboot.env'])
+
             # Write out the image sizes file. This is similar to the output
             # of binutil's 'size' utility, but it omits the header line and
             # adds an additional hex value at the end of each line for the