Skip to contentSkip to conversation

buildman: Extract environment as part of each build

PATCH Superseded Alex Kiernan 2 participants 5 messages May 29, 2018 – May 31, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 buildman: Extract environment as part of each build

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

---

Changes in v2:
- capture stderr/stdout so when the build fails we don't produce spurious output as part of the build

 tools/buildman/builderthread.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
tools/buildman/builderthread.py +10 -0
index 0efe80d945..c84ba6acf1 100644
@@ -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=True,
+                            capture_stderr=True, 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
Signature · 1 line
2.17.0
#1 lore raw

PATCH v2 1/2 buildman: Extract environment as part of each build

Quoted 6 lines · Alex Kiernan

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

---

Review

Quoted 8 lines

Changes in v2:
- capture stderr/stdout so when the build fails we don't produce spurious output as part of the build

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

b/tools/buildman/builderthread.py

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 351

Quoted 5 lines

index 0efe80d945..c84ba6acf1 100644

tools/buildman/builderthread.py +0 -0
@@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
                      lines.append(size_result.stdout.splitlines()[1] + '

' +

tools/buildman/builderthread.py class BuilderThread(threading.Thread):

Quoted 13 lines
tools/buildman/builderthread.py +10 -0
                                   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=True,
+                            capture_stderr=True, 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

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 365

Quoted 1 line
tools/buildman/builderthread.py +0 -0
              # of binutil's 'size' utility, but it omits the header line

and

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 366

Quoted 1 line
tools/buildman/builderthread.py +0 -0
              # adds an additional hex value at the end of each line for

the

This is failing in Travis:

https://travis-ci.org/akiernan/u-boot/jobs/385534243#L899

Signature · 1 line
Alex Kiernan
#2 lore raw

PATCH v2 1/2 buildman: Extract environment as part of each build

Quoted 8 lines · Alex Kiernan
Quoted 5 lines · Alex Kiernan

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

---

Quoted 6 lines
Quoted 6 lines

Changes in v2:
- capture stderr/stdout so when the build fails we don't produce spurious output as part of the build

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

Review

Quoted 2 lines
(quoted diff) +0 -0

b/tools/buildman/builderthread.py

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 351

Quoted 5 lines

index 0efe80d945..c84ba6acf1 100644

tools/buildman/builderthread.py +0 -0
@@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
                      lines.append(size_result.stdout.splitlines()[1] + '

' +

tools/buildman/builderthread.py class BuilderThread(threading.Thread):

Quoted 13 lines
tools/buildman/builderthread.py +10 -0
                                   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=True,
+                            capture_stderr=True, 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

Quoted 8 lines

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 365

Quoted 1 line
tools/buildman/builderthread.py +0 -0
              # of binutil's 'size' utility, but it omits the header line

and

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 366

Quoted 1 line
tools/buildman/builderthread.py +0 -0
              # adds an additional hex value at the end of each line for

the

This is failing in Travis:

https://travis-ci.org/akiernan/u-boot/jobs/385534243#L899

For the patman failure, you could try this patch:

http://patchwork.ozlabs.org/patch/914202/

Regards,
Simon

#3 lore raw

PATCH v2 1/2 buildman: Extract environment as part of each build

Quoted 47 lines · Simon Glass
Quoted 8 lines · Alex Kiernan
Quoted 5 lines · Alex Kiernan

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

---

Quoted 6 lines
Quoted 6 lines

Changes in v2:
- capture stderr/stdout so when the build fails we don't produce spurious output as part of the build

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

Review

Quoted 2 lines
(quoted diff) +0 -0

b/tools/buildman/builderthread.py

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 351

Quoted 5 lines

index 0efe80d945..c84ba6acf1 100644

tools/buildman/builderthread.py +0 -0
@@ -351,6 +351,16 @@ class BuilderThread(threading.Thread):
                      lines.append(size_result.stdout.splitlines()[1] + '

' +

tools/buildman/builderthread.py class BuilderThread(threading.Thread):

Quoted 13 lines
tools/buildman/builderthread.py +10 -0
                                   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=True,
+                            capture_stderr=True, 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

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 365

Quoted 1 line
tools/buildman/builderthread.py +0 -0
              # of binutil's 'size' utility, but it omits the header line

and

tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 366

Quoted 1 line
tools/buildman/builderthread.py +0 -0
              # adds an additional hex value at the end of each line for

the

Quoted 9 lines
Quoted 3 lines

This is failing in Travis:

https://travis-ci.org/akiernan/u-boot/jobs/385534243#L899

For the patman failure, you could try this patch:

http://patchwork.ozlabs.org/patch/914202/

Thanks, that fixed half of it, the other was I needed to capture objcopy during functional tests; I really need to work out why make tests gives me out of the box failures so I can use it all the time.

Signature · 1 line
Alex Kiernan
#4 lore raw

PATCH v2 2/2 buildman: Add support for environment delta in summary

In reply to Alex Kiernan

When summarising the builds, add the -U option to emit delta lines for the default environment built into U-Boot at each commit.

---

Changes in v2:
- update buildman README to cover -U option

 tools/buildman/README     |  28 +++++++++
 tools/buildman/builder.py | 128 +++++++++++++++++++++++++++++++++-----
 tools/buildman/cmdline.py |   2 +
 tools/buildman/control.py |   3 +-
 4 files changed, 145 insertions(+), 16 deletions(-)
tools/buildman/README +28 -0
index 6c43c546f8..76601902cb 100644
@@ -1008,6 +1008,34 @@ variables. This avoids lots of useless output when converting a CONFIG
 option to Kconfig. To disable this behaviour, use --squash-config-y.
 
 
+Checking the environment
+========================
+
+When converting CONFIG options which manipulate the default environment,
+a common requirement is to check that the default environment has not
+changed due to the conversion. Buildman supports this with the -U option,
+used after a build. This shows differences in the default environment
+between one commit and the next.
+
+For example:
+
+$ buildman -b squash brppt1 -sU
+boards.cfg is up to date. Nothing to do.
+Summary of 2 commits for 3 boards (3 threads, 3 jobs per thread)
+01: Migrate bootlimit to Kconfig
+02: Squashed commit of the following:
+   c brppt1_mmc: altbootcmd=mmc dev 1; run mmcboot0; -> mmc dev 1; run mmcboot0
+   c brppt1_spi: altbootcmd=mmc dev 1; run mmcboot0; -> mmc dev 1; run mmcboot0
+   + brppt1_nand: altbootcmd=run usbscript
+   - brppt1_nand:  altbootcmd=run usbscript
+(no errors to report)
+
+This shows that commit 2 modified the value of 'altbootcmd' for 'brppt1_mmc'
+and 'brppt1_spi', removing a trailing semicolon. 'brppt1_nand' gained an a
+value for 'altbootcmd', but lost one for ' altbootcmd'.
+
+The -U option uses the u-boot.env files which are produced by a build.
+
 Other options
 =============
 
tools/buildman/builder.py +113 -15

273 lines not on this page · raw message

tools/buildman/cmdline.py +2 -0
index b8ddd4795c..e493b1ac4a 100644
@@ -92,6 +92,8 @@ def ParseArgs():
           default=None, help='Number of builder threads to use')
     parser.add_option('-u', '--show_unknown', action='store_true',
           default=False, help='Show boards with unknown build result')
+    parser.add_option('-U', '--show-environment', action='store_true',
+          default=False, help='Show environment changes in summary')
     parser.add_option('-v', '--verbose', action='store_true',
           default=False, help='Show build results while the build progresses')
     parser.add_option('-V', '--verbose-build', action='store_true',
tools/buildman/control.py +2 -1
index 4ac4386db6..bc0819784f 100644
@@ -319,7 +319,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
         builder.SetDisplayOptions(options.show_errors, options.show_sizes,
                                   options.show_detail, options.show_bloat,
                                   options.list_error_boards,
-                                  options.show_config)
+                                  options.show_config,
+                                  options.show_environment)
         if options.summary:
             builder.ShowSummary(commits, board_selected)
         else:
Signature · 1 line
2.17.0