[U-Boot] Please pull u-boot-dm

Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info (2018-07-09 09:11:00 -0600)
---------------------------------------------------------------- Michael Pratt (1): fdt: Add device tree memory bindings
Simon Glass (38): dm: core: Add ofnode function to read a 64-bit int dm: core: Fix a few ofnode function comments dm: core: Add comments to ofnode_read_resource() functoins dm: core: Add a way to find an ofnode by compatible string log: Add a way to log a return value with a message dm: core: Add a way to bind a device by ofnode dm: spi: Update sandbox SPI emulation driver to use ofnode dm: core: Update of_read_fmap_entry() for livetree dm: core: Add a function to decode a memory region dm: core: Add logging of some common errors binman: Make the operation of Entry__testing explicit binman: Tidy up variables in _RunMicrocodeTest() binman: Correct operation of ObtainContents() binman: Tidy up execution of tests binman: Tidy up setting of entry contents libfdt: Bring in proposed pylibfdt changes libfdt: Fix the Python pack() function libfdt: Add get_property() and del_node() binman: Move coverage logic into a new test_util file dtoc: Add some tests for the fdt module dtoc: Update tests to write failures to /tmp dtoc: Make use of the new pylibfdt methods dtoc: Drop use of a local dtb buffer dtoc: Update fdt tests to increase code coverage dtoc: Keep track of property offsets dtoc: Fix Fdt.GetNode() to handle a missing node dtoc: Fix properties with a single zero-arg phandle dtoc: Fix some minor errors dtoc: Add a test for code coverage binman: Move capture_sys_output() to test_util dtoc: Increase code coverage to 100% test: Enable cover-coverage tests for dtoc and fdt dtoc: Avoid unwanted output during tests dtoc: Add functions to add integer properties binman: Complete documentation of stages binman: Add a ProcessFdt() method binman: Add a SetCalculatedProperties() method binman: Support updating the device tree with calc'd info
Tom Rini (1): binman: Switch to 'python-coverage'
doc/device-tree-bindings/memory/memory.txt | 67 +++++++ drivers/core/device.c | 8 + drivers/core/of_access.c | 20 +++ drivers/core/of_extra.c | 89 ++++++++- drivers/core/ofnode.c | 44 +++++ drivers/core/uclass.c | 14 +- drivers/misc/cros_ec.c | 4 +- drivers/mtd/spi/sandbox.c | 9 +- include/asm-generic/global_data.h | 1 + include/dm/device-internal.h | 4 + include/dm/of_access.h | 16 ++ include/dm/of_extra.h | 51 +++++- include/dm/ofnode.h | 48 ++++- include/fdt_support.h | 10 ++ include/fdtdec.h | 38 +++- include/log.h | 8 + include/spi_flash.h | 2 +- lib/fdtdec.c | 109 +++++++++++ scripts/dtc/libfdt/libfdt.h | 3 + scripts/dtc/pylibfdt/libfdt.i_shipped | 725 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ test/dm/spi.c | 8 +- test/run | 7 +- tools/binman/README | 45 +++-- tools/binman/binman.py | 40 +---- tools/binman/bsection.py | 27 +++ tools/binman/cmdline.py | 2 + tools/binman/control.py | 58 +++++- tools/binman/elf_test.py | 22 +-- tools/binman/entry.py | 42 +++++ tools/binman/etype/_testing.py | 37 +++- tools/binman/etype/blob.py | 3 +- tools/binman/etype/section.py | 13 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 46 ++--- tools/binman/etype/u_boot_spl_bss_pad.py | 4 +- tools/binman/etype/u_boot_ucode.py | 9 +- tools/binman/etype/u_boot_with_ucode_ptr.py | 11 +- tools/binman/ftest.py | 159 ++++++++++++++--- tools/binman/image.py | 17 ++ tools/binman/image_test.py | 2 +- tools/binman/test/41_unknown_pos_size.dts | 1 + tools/binman/test/57_unknown_contents.dts | 14 ++ tools/binman/test/58_x86_ucode_spl_needs_retry.dts | 36 ++++ tools/binman/test/59_change_size.dts | 14 ++ tools/binman/test/60_fdt_update.dts | 31 ++++ tools/binman/test/61_fdt_update_bad.dts | 32 ++++ tools/dtoc/dtb_platdata.py | 15 +- tools/dtoc/dtoc.py | 35 +++- tools/dtoc/dtoc_test_add_prop.dts | 24 +++ tools/dtoc/dtoc_test_addr32_64.dts | 2 +- tools/dtoc/dtoc_test_addr64_32.dts | 2 +- tools/dtoc/dtoc_test_bad_reg.dts | 17 ++ tools/dtoc/dtoc_test_bad_reg2.dts | 17 ++ tools/dtoc/dtoc_test_phandle.dts | 6 + tools/dtoc/dtoc_test_phandle_bad.dts | 16 ++ tools/dtoc/dtoc_test_phandle_bad2.dts | 22 +++ tools/dtoc/dtoc_test_phandle_reorder.dts | 23 +++ tools/dtoc/dtoc_test_phandle_single.dts | 23 +++ tools/dtoc/dtoc_test_simple.dts | 1 + tools/dtoc/fdt.py | 115 ++++++++---- tools/dtoc/fdt_util.py | 29 +-- tools/dtoc/test_dtoc.py | 221 +++++++++++++++++++++-- tools/dtoc/test_fdt | 1 + tools/dtoc/test_fdt.py | 450 ++++++++++++++++++++++++++++++++++++++++++++++ tools/patman/test_util.py | 85 +++++++++ 64 files changed, 2769 insertions(+), 285 deletions(-) create mode 100644 doc/device-tree-bindings/memory/memory.txt create mode 100644 tools/binman/test/57_unknown_contents.dts create mode 100644 tools/binman/test/58_x86_ucode_spl_needs_retry.dts create mode 100644 tools/binman/test/59_change_size.dts create mode 100644 tools/binman/test/60_fdt_update.dts create mode 100644 tools/binman/test/61_fdt_update_bad.dts create mode 100644 tools/dtoc/dtoc_test_add_prop.dts create mode 100644 tools/dtoc/dtoc_test_bad_reg.dts create mode 100644 tools/dtoc/dtoc_test_bad_reg2.dts create mode 100644 tools/dtoc/dtoc_test_phandle_bad.dts create mode 100644 tools/dtoc/dtoc_test_phandle_bad2.dts create mode 100644 tools/dtoc/dtoc_test_phandle_reorder.dts create mode 100644 tools/dtoc/dtoc_test_phandle_single.dts create mode 120000 tools/dtoc/test_fdt create mode 100755 tools/dtoc/test_fdt.py create mode 100644 tools/patman/test_util.py
Regards, Simon

On 9 July 2018 at 13:53, Simon Glass sjg@chromium.org wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.

On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info (2018-07-09 09:11:00 -0600)
Applied to u-boot/master, thanks!
That said, I see that this is a non-fatal error: Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/ <unittest.result.TestResult run=35 errors=0 failures=1> Traceback (most recent call last): File "/home/trini/work/u-boot/u-boot/tools/buildman/test.py", line 426, in testToolchainDownload self.toolchains.LocateArchUrl('arm')) AssertionError: 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc...' != 'https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc...'
Which I think we should fix and make a fatal error. If it's a test and it fails and it's not fatal, CI/etc won't catch it. Thanks!

On 07/10/2018 12:47 PM, Tom Rini wrote:
On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info (2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin COPY spl/u-boot-spl.bin BINMAN u-boot-tegra.bin BINMAN u-boot-nodtb-tegra.bin BINMAN u-boot-dtb-tegra.bin binman: pylibfdt error -9: FDT_ERR_BADMAGIC /var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot'
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.

Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 12:47 PM, Tom Rini wrote:
On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info (2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin COPY spl/u-boot-spl.bin BINMAN u-boot-tegra.bin BINMAN u-boot-nodtb-tegra.bin BINMAN u-boot-dtb-tegra.bin binman: pylibfdt error -9: FDT_ERR_BADMAGIC
/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot'
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
That said, I'm working on getting the real pylibffdt applied upstream, hopefully will not be too much longer.
Regards, Simon

On 07/10/2018 02:24 PM, Simon Glass wrote:
Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 12:47 PM, Tom Rini wrote:
On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info
(2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin COPY spl/u-boot-spl.bin BINMAN u-boot-tegra.bin BINMAN u-boot-nodtb-tegra.bin BINMAN u-boot-dtb-tegra.bin binman: pylibfdt error -9: FDT_ERR_BADMAGIC
/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot'
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
Is this the backtrace you're looking for?
[swarren@swarren-lx1 u-boot]$ CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s -j8" arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property binman: pylibfdt error -9: FDT_ERR_BADMAGIC
Traceback (most recent call last): File "../tools/binman/binman", line 120, in RunBinman ret_code = control.Binman(options, args) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py", line 128, in Binman dtb = fdt.FdtScan(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 459, in FdtScan dtb = Fdt(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 315, in __init__ self._fdt_obj = libfdt.Fdt(fd.read()) File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ check_err(fdt_check_header(self._fdt)); File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err raise FdtException(val) FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... Section '/binman/image1': Symbol '_binman_u_boot_any_prop_pos' in entry '/binman/image1/u-boot-spl': insert _binman_u_boot_any_prop_pos, offset 592c, value 80110000, length 4 Section '/binman/image1': Symbol '_binman_u_boot_any_prop_pos' in entry '/binman/image1/u-boot-spl': insert _binman_u_boot_any_prop_pos, offset 592c, value 80110000, length 4 Section '/binman/image2': Symbol '_binman_u_boot_any_prop_pos' in entry '/binman/image2/u-boot-spl': insert _binman_u_boot_any_prop_pos, offset 592c, value 80110000, length 4 Section '/binman/image2': Symbol '_binman_u_boot_any_prop_pos' in entry '/binman/image2/u-boot-spl': insert _binman_u_boot_any_prop_pos, offset 592c, value 80110000, length 4 Section '/binman/image3': Symbol '_binman_u_boot_any_prop_pos' in entry '/binman/image3/u-boot-spl': insert _binman_u_boot_any_prop_pos, offset 592c, value 80110000, length 4 Section '/binman/image3': Symbol '_binman_u_boot_any_prop_pos' in entry '/binman/image3/u-boot-spl': insert _binman_u_boot_any_prop_pos, offset 592c, value 80110000, length 4 Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2

Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 02:24 PM, Simon Glass wrote:
Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 12:47 PM, Tom Rini wrote:
On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info
(2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin COPY spl/u-boot-spl.bin BINMAN u-boot-tegra.bin BINMAN u-boot-nodtb-tegra.bin BINMAN u-boot-dtb-tegra.bin binman: pylibfdt error -9: FDT_ERR_BADMAGIC
/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory
'/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot'
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
Is this the backtrace you're looking for?
[swarren@swarren-lx1 u-boot]$ CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s -j8" arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property binman: pylibfdt error -9: FDT_ERR_BADMAGIC
Traceback (most recent call last): File "../tools/binman/binman", line 120, in RunBinman ret_code = control.Binman(options, args) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py", line 128, in Binman dtb = fdt.FdtScan(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 459, in FdtScan dtb = Fdt(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 315, in __init__ self._fdt_obj = libfdt.Fdt(fd.read()) File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ check_err(fdt_check_header(self._fdt)); File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err raise FdtException(val) FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
[..]
Regards, Simon

On 07/11/2018 06:12 PM, Simon Glass wrote:
Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 02:24 PM, Simon Glass wrote:
Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 12:47 PM, Tom Rini wrote:
On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
Hi Tom.
Here are some test-coverage and DM core enhancements. Also it adds a way to access the binman definition from U-Boot.
The following changes since commit 8c5d4fd0ec222701598a27b26ab7265d4cee45a3:
Prepare v2018.07 (2018-07-09 10:24:14 -0400)
are available in the Git repository at:
git://git.denx.de/u-boot-dm.git
for you to fetch changes up to 16b8d6b76992690c65c58dc8b0591496cc5e46ef:
binman: Support updating the device tree with calc'd info
(2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin COPY spl/u-boot-spl.bin BINMAN u-boot-tegra.bin BINMAN u-boot-nodtb-tegra.bin BINMAN u-boot-dtb-tegra.bin
binman: pylibfdt error -9: FDT_ERR_BADMAGIC
/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory
'/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot'
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
Is this the backtrace you're looking for?
[swarren@swarren-lx1 u-boot]$ CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s -j8" arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property binman: pylibfdt error -9: FDT_ERR_BADMAGIC
Traceback (most recent call last): File "../tools/binman/binman", line 120, in RunBinman ret_code = control.Binman(options, args) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py", line 128, in Binman dtb = fdt.FdtScan(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 459, in FdtScan dtb = Fdt(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 315, in __init__ self._fdt_obj = libfdt.Fdt(fd.read()) File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ check_err(fdt_check_header(self._fdt)); File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err raise FdtException(val) FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
I have the standard Ubuntu 16.04 packages installed, but no non-standard local builds:
device-tree-compiler 1.4.0+dfsg-2 libfdt1:amd64 1.4.0+dfsg-2

On 07/12/2018 09:52 AM, Stephen Warren wrote:
On 07/11/2018 06:12 PM, Simon Glass wrote:
Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 02:24 PM, Simon Glass wrote:
Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 12:47 PM, Tom Rini wrote:
On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote:
> Hi Tom. > > Here are some test-coverage and DM core enhancements. Also it adds a > way to access the binman definition from U-Boot. > > > The following changes since commit > 8c5d4fd0ec222701598a27b26ab7265d4cee45a3: > > Prepare v2018.07 (2018-07-09 10:24:14 -0400) > > are available in the Git repository at: > > git://git.denx.de/u-boot-dm.git > > for you to fetch changes up to > 16b8d6b76992690c65c58dc8b0591496cc5e46ef: > > binman: Support updating the device tree with calc'd info > (2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin COPY spl/u-boot-spl.bin BINMAN u-boot-tegra.bin BINMAN u-boot-nodtb-tegra.bin BINMAN u-boot-dtb-tegra.bin binman: pylibfdt error -9: FDT_ERR_BADMAGIC
/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244:
recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory
'/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver'
Makefile:148: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot'
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
Is this the backtrace you're looking for?
[swarren@swarren-lx1 u-boot]$ CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s -j8" arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property binman: pylibfdt error -9: FDT_ERR_BADMAGIC
Traceback (most recent call last): File "../tools/binman/binman", line 120, in RunBinman ret_code = control.Binman(options, args) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py",
line 128, in Binman dtb = fdt.FdtScan(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py",
line 459, in FdtScan dtb = Fdt(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py",
line 315, in __init__ self._fdt_obj = libfdt.Fdt(fd.read()) File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ check_err(fdt_check_header(self._fdt)); File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err raise FdtException(val) FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
I have the standard Ubuntu 16.04 packages installed, but no non-standard local builds:
device-tree-compiler 1.4.0+dfsg-2 libfdt1:amd64 1.4.0+dfsg-2
I suspect this is a missing dependency in the makefiles, or perhaps some process isn't waiting for its child to exit. The code that's finding the bad FDT magic appears to be reading from a file that hasn't yet been written yet:
[pid 26251] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] open("./u-boot-out.dtb", O_WRONLY|O_CREAT|O_TRUNC, 0666 <unfinished ...> [pid 26251] <... close resumed> ) = 0 [pid 26251] close(3) = 0 [pid 26251] open("./u-boot-out.dtb", O_RDONLY) = 3 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] read(3, "", 4096) = 0 [pid 26251] close(3) = 0 [pid 26251] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 [pid 26251] write(1, "binman: pylibfdt error -9: FDT_E"..., 44binman: pylibfdt error -9: FDT_ERR_BADMAGIC
[pid 26255] write(3, "\320\r\376\355\0\0We\0\0\0008\0\0Q\340\0\0\0(\0\0\0\21\0\0\0\20\0\0\0\0"..., 20480 <unfinished ...>

On 07/12/2018 12:17 PM, Stephen Warren wrote:
On 07/12/2018 09:52 AM, Stephen Warren wrote:
On 07/11/2018 06:12 PM, Simon Glass wrote:
Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 02:24 PM, Simon Glass wrote:
Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 12:47 PM, Tom Rini wrote: > > > On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote: > >> Hi Tom. >> >> Here are some test-coverage and DM core enhancements. Also it >> adds a >> way to access the binman definition from U-Boot. >> >> >> The following changes since commit >> 8c5d4fd0ec222701598a27b26ab7265d4cee45a3: >> >> Prepare v2018.07 (2018-07-09 10:24:14 -0400) >> >> are available in the Git repository at: >> >> git://git.denx.de/u-boot-dm.git >> >> for you to fetch changes up to >> 16b8d6b76992690c65c58dc8b0591496cc5e46ef: >> >> binman: Support updating the device tree with calc'd info >> (2018-07-09 09:11:00 -0600)
This pull has caused intermittent/random build errors on my Jenkins system. The log shows:
> LD spl/u-boot-spl > OBJCOPY spl/u-boot-spl-nodtb.bin > COPY spl/u-boot-spl.bin > BINMAN u-boot-tegra.bin > BINMAN u-boot-nodtb-tegra.bin > BINMAN u-boot-dtb-tegra.bin > binman: pylibfdt error -9: FDT_ERR_BADMAGIC > > > /var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: > > recipe for target 'u-boot-tegra.bin' failed > make[1]: *** [u-boot-tegra.bin] Error 1 > make[1]: *** Waiting for unfinished jobs.... > make[1]: Leaving directory > > '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' > > Makefile:148: recipe for target 'sub-make' failed > make: *** [sub-make] Error 2 > make: Leaving directory > '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot' >
This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox boards, yet a varying set of boards fail each time I trigger the build: Just beaver the first time, then just colibri_t20 and ventana, then just medcom-wide. Note that the system performs incremental builds, if that matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
Is this the backtrace you're looking for?
[swarren@swarren-lx1 u-boot]$ CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s -j8" arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property binman: pylibfdt error -9: FDT_ERR_BADMAGIC
Traceback (most recent call last): File "../tools/binman/binman", line 120, in RunBinman ret_code = control.Binman(options, args) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py",
line 128, in Binman dtb = fdt.FdtScan(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py",
line 459, in FdtScan dtb = Fdt(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py",
line 315, in __init__ self._fdt_obj = libfdt.Fdt(fd.read()) File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ check_err(fdt_check_header(self._fdt)); File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err raise FdtException(val) FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
I have the standard Ubuntu 16.04 packages installed, but no non-standard local builds:
device-tree-compiler 1.4.0+dfsg-2 libfdt1:amd64 1.4.0+dfsg-2
I suspect this is a missing dependency in the makefiles, or perhaps some process isn't waiting for its child to exit. The code that's finding the bad FDT magic appears to be reading from a file that hasn't yet been written yet:
[pid 26251] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] open("./u-boot-out.dtb", O_WRONLY|O_CREAT|O_TRUNC, 0666 <unfinished ...> [pid 26251] <... close resumed> ) = 0 [pid 26251] close(3) = 0 [pid 26251] open("./u-boot-out.dtb", O_RDONLY) = 3 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] read(3, "", 4096) = 0 [pid 26251] close(3) = 0 [pid 26251] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 [pid 26251] write(1, "binman: pylibfdt error -9: FDT_E"..., 44binman: pylibfdt error -9: FDT_ERR_BADMAGIC
[pid 26255] write(3, "\320\r\376\355\0\0We\0\0\0008\0\0Q\340\0\0\0(\0\0\0\21\0\0\0\20\0\0\0\0"..., 20480 <unfinished ...>
Specifically, this Makefile rule:
u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin: \ spl/u-boot-spl u-boot.bin FORCE $(call if_changed,binman)
runs that same binman invocation for all 3 target binaries separately and in parallel, and tools/binman/control.py:Binman() uses the same hard-coded filename for an output (or temporary?) file in each invocation. I'm not sure if we can simply replace:
fname = tools.GetOutputFilename('u-boot-out.dtb')
with a call to tempfile.mkstemp() or similar?

Hi Stephen,
On 12 July 2018 at 15:26, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/12/2018 12:17 PM, Stephen Warren wrote:
On 07/12/2018 09:52 AM, Stephen Warren wrote:
On 07/11/2018 06:12 PM, Simon Glass wrote:
Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 02:24 PM, Simon Glass wrote:
Hi Stephen,
On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote: > > > On 07/10/2018 12:47 PM, Tom Rini wrote: >> >> >> >> On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote: >> >>> Hi Tom. >>> >>> Here are some test-coverage and DM core enhancements. Also it adds a >>> way to access the binman definition from U-Boot. >>> >>> >>> The following changes since commit >>> 8c5d4fd0ec222701598a27b26ab7265d4cee45a3: >>> >>> Prepare v2018.07 (2018-07-09 10:24:14 -0400) >>> >>> are available in the Git repository at: >>> >>> git://git.denx.de/u-boot-dm.git >>> >>> for you to fetch changes up to >>> 16b8d6b76992690c65c58dc8b0591496cc5e46ef: >>> >>> binman: Support updating the device tree with calc'd info >>> (2018-07-09 09:11:00 -0600) > > > > > This pull has caused intermittent/random build errors on my Jenkins > system. > The log shows: > >> LD spl/u-boot-spl >> OBJCOPY spl/u-boot-spl-nodtb.bin >> COPY spl/u-boot-spl.bin >> BINMAN u-boot-tegra.bin >> BINMAN u-boot-nodtb-tegra.bin >> BINMAN u-boot-dtb-tegra.bin >> binman: pylibfdt error -9: FDT_ERR_BADMAGIC >> >> >> /var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: >> recipe for target 'u-boot-tegra.bin' failed >> make[1]: *** [u-boot-tegra.bin] Error 1 >> make[1]: *** Waiting for unfinished jobs.... >> make[1]: Leaving directory >> >> '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' >> Makefile:148: recipe for target 'sub-make' failed >> make: *** [sub-make] Error 2 >> make: Leaving directory >> '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot' > > > > > This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox > boards, yet a varying set of boards fail each time I trigger the build: > Just > beaver the first time, then just colibri_t20 and ventana, then just > medcom-wide. Note that the system performs incremental builds, if that > matters.
That might be the fdt_resize() problem which David Gibson has just sorted out upstream. If you can run binman -D (to get a stack trace) that might help. I should be able to do a patch if that is the problem.
Is this the backtrace you're looking for?
[swarren@swarren-lx1 u-boot]$ CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s -j8" arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property binman: pylibfdt error -9: FDT_ERR_BADMAGIC
Traceback (most recent call last): File "../tools/binman/binman", line 120, in RunBinman ret_code = control.Binman(options, args) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py", line 128, in Binman dtb = fdt.FdtScan(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 459, in FdtScan dtb = Fdt(fname) File "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", line 315, in __init__ self._fdt_obj = libfdt.Fdt(fd.read()) File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ check_err(fdt_check_header(self._fdt)); File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err raise FdtException(val) FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: recipe for target 'u-boot-tegra.bin' failed make[1]: *** [u-boot-tegra.bin] Error 1 make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
I have the standard Ubuntu 16.04 packages installed, but no non-standard local builds:
device-tree-compiler 1.4.0+dfsg-2 libfdt1:amd64 1.4.0+dfsg-2
I suspect this is a missing dependency in the makefiles, or perhaps some process isn't waiting for its child to exit. The code that's finding the bad FDT magic appears to be reading from a file that hasn't yet been written yet:
[pid 26251] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] open("./u-boot-out.dtb", O_WRONLY|O_CREAT|O_TRUNC, 0666 <unfinished ...> [pid 26251] <... close resumed> ) = 0 [pid 26251] close(3) = 0 [pid 26251] open("./u-boot-out.dtb", O_RDONLY) = 3 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] read(3, "", 4096) = 0 [pid 26251] close(3) = 0 [pid 26251] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 [pid 26251] write(1, "binman: pylibfdt error -9: FDT_E"..., 44binman: pylibfdt error -9: FDT_ERR_BADMAGIC
[pid 26255] write(3, "\320\r\376\355\0\0We\0\0\0008\0\0Q\340\0\0\0(\0\0\0\21\0\0\0\20\0\0\0\0"..., 20480 <unfinished ...>
Specifically, this Makefile rule:
u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin: \ spl/u-boot-spl u-boot.bin FORCE $(call if_changed,binman)
runs that same binman invocation for all 3 target binaries separately and in parallel, and tools/binman/control.py:Binman() uses the same hard-coded filename for an output (or temporary?) file in each invocation. I'm not sure if we can simply replace:
fname = tools.GetOutputFilename('u-boot-out.dtb')
with a call to tempfile.mkstemp() or similar?
Thanks very much for digging into this. I actually think that rule is wrong and needs to be fixed. I will take a look.
Regards, Simon

On 07/16/2018 10:40 PM, Simon Glass wrote:
Hi Stephen,
On 12 July 2018 at 15:26, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/12/2018 12:17 PM, Stephen Warren wrote:
On 07/12/2018 09:52 AM, Stephen Warren wrote:
On 07/11/2018 06:12 PM, Simon Glass wrote:
Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/10/2018 02:24 PM, Simon Glass wrote: > > > Hi Stephen, > > On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org wrote: >> >> >> On 07/10/2018 12:47 PM, Tom Rini wrote: >>> >>> >>> >>> On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote: >>> >>>> Hi Tom. >>>> >>>> Here are some test-coverage and DM core enhancements. Also it adds a >>>> way to access the binman definition from U-Boot. >>>> >>>> >>>> The following changes since commit >>>> 8c5d4fd0ec222701598a27b26ab7265d4cee45a3: >>>> >>>> Prepare v2018.07 (2018-07-09 10:24:14 -0400) >>>> >>>> are available in the Git repository at: >>>> >>>> git://git.denx.de/u-boot-dm.git >>>> >>>> for you to fetch changes up to >>>> 16b8d6b76992690c65c58dc8b0591496cc5e46ef: >>>> >>>> binman: Support updating the device tree with calc'd info >>>> (2018-07-09 09:11:00 -0600) >> >> >> >> >> This pull has caused intermittent/random build errors on my Jenkins >> system. >> The log shows: >> >>> LD spl/u-boot-spl >>> OBJCOPY spl/u-boot-spl-nodtb.bin >>> COPY spl/u-boot-spl.bin >>> BINMAN u-boot-tegra.bin >>> BINMAN u-boot-nodtb-tegra.bin >>> BINMAN u-boot-dtb-tegra.bin >>> binman: pylibfdt error -9: FDT_ERR_BADMAGIC >>> >>> >>> /var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: >>> recipe for target 'u-boot-tegra.bin' failed >>> make[1]: *** [u-boot-tegra.bin] Error 1 >>> make[1]: *** Waiting for unfinished jobs.... >>> make[1]: Leaving directory >>> >>> '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' >>> Makefile:148: recipe for target 'sub-make' failed >>> make: *** [sub-make] Error 2 >>> make: Leaving directory >>> '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot' >> >> >> >> >> This doesn't happen every time; my Jenkins system builds 25 Tegra/sandbox >> boards, yet a varying set of boards fail each time I trigger the build: >> Just >> beaver the first time, then just colibri_t20 and ventana, then just >> medcom-wide. Note that the system performs incremental builds, if that >> matters. > > > > That might be the fdt_resize() problem which David Gibson has just > sorted out upstream. If you can run binman -D (to get a stack trace) > that might help. I should be able to do a patch if that is the > problem.
Is this the backtrace you're looking for?
> [swarren@swarren-lx1 u-boot]$ > CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- > sh -c "make O=build-beaver -s beaver_defconfig && make O=build-beaver -s > -j8" > arch/arm/dts/tegra30-apalis.dtb: Warning (avoid_unnecessary_addr_size): > /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells > without "ranges" or child "reg" property > arch/arm/dts/tegra30-beaver.dtb: Warning (avoid_unnecessary_addr_size): > /i2c@7000d000/tps65911@2d/regulators: unnecessary #address-cells/#size-cells > without "ranges" or child "reg" property > binman: pylibfdt error -9: FDT_ERR_BADMAGIC > > Traceback (most recent call last): > File "../tools/binman/binman", line 120, in RunBinman > ret_code = control.Binman(options, args) > File > "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py", > line 128, in Binman > dtb = fdt.FdtScan(fname) > File > "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", > line 459, in FdtScan > dtb = Fdt(fname) > File > "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", > line 315, in __init__ > self._fdt_obj = libfdt.Fdt(fd.read()) > File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ > check_err(fdt_check_header(self._fdt)); > File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err > raise FdtException(val) > FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC > /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: > recipe for target 'u-boot-tegra.bin' failed > make[1]: *** [u-boot-tegra.bin] Error 1 > make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
I have the standard Ubuntu 16.04 packages installed, but no non-standard local builds:
device-tree-compiler 1.4.0+dfsg-2 libfdt1:amd64 1.4.0+dfsg-2
I suspect this is a missing dependency in the makefiles, or perhaps some process isn't waiting for its child to exit. The code that's finding the bad FDT magic appears to be reading from a file that hasn't yet been written yet:
[pid 26251] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] open("./u-boot-out.dtb", O_WRONLY|O_CREAT|O_TRUNC, 0666 <unfinished ...> [pid 26251] <... close resumed> ) = 0 [pid 26251] close(3) = 0 [pid 26251] open("./u-boot-out.dtb", O_RDONLY) = 3 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] read(3, "", 4096) = 0 [pid 26251] close(3) = 0 [pid 26251] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 [pid 26251] write(1, "binman: pylibfdt error -9: FDT_E"..., 44binman: pylibfdt error -9: FDT_ERR_BADMAGIC
[pid 26255] write(3, "\320\r\376\355\0\0We\0\0\0008\0\0Q\340\0\0\0(\0\0\0\21\0\0\0\20\0\0\0\0"..., 20480 <unfinished ...>
Specifically, this Makefile rule:
u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin: \ spl/u-boot-spl u-boot.bin FORCE $(call if_changed,binman)
runs that same binman invocation for all 3 target binaries separately and in parallel, and tools/binman/control.py:Binman() uses the same hard-coded filename for an output (or temporary?) file in each invocation. I'm not sure if we can simply replace:
fname = tools.GetOutputFilename('u-boot-out.dtb')
with a call to tempfile.mkstemp() or similar?
Thanks very much for digging into this. I actually think that rule is wrong and needs to be fixed. I will take a look.
Irrespective of whether the Makefile rule is wrong, and whether we change it at all, I still think we should apply the patch I sent for binman ("binman: ensure temp filenames don't collide") to solve this, since that's a legitimate fix irrespective of the Makefile rule.

Hi Stephen,
On 17 July 2018 at 09:33, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/16/2018 10:40 PM, Simon Glass wrote:
Hi Stephen,
On 12 July 2018 at 15:26, Stephen Warren swarren@wwwdotorg.org wrote:
On 07/12/2018 12:17 PM, Stephen Warren wrote:
On 07/12/2018 09:52 AM, Stephen Warren wrote:
On 07/11/2018 06:12 PM, Simon Glass wrote:
Hi Stephen,
On 11 July 2018 at 16:01, Stephen Warren swarren@wwwdotorg.org wrote: > > > On 07/10/2018 02:24 PM, Simon Glass wrote: >> >> >> >> Hi Stephen, >> >> On 10 July 2018 at 13:53, Stephen Warren swarren@wwwdotorg.org >> wrote: >>> >>> >>> >>> On 07/10/2018 12:47 PM, Tom Rini wrote: >>>> >>>> >>>> >>>> >>>> On Mon, Jul 09, 2018 at 01:53:43PM -0600, Simon Glass wrote: >>>> >>>>> Hi Tom. >>>>> >>>>> Here are some test-coverage and DM core enhancements. Also it >>>>> adds a >>>>> way to access the binman definition from U-Boot. >>>>> >>>>> >>>>> The following changes since commit >>>>> 8c5d4fd0ec222701598a27b26ab7265d4cee45a3: >>>>> >>>>> Prepare v2018.07 (2018-07-09 10:24:14 -0400) >>>>> >>>>> are available in the Git repository at: >>>>> >>>>> git://git.denx.de/u-boot-dm.git >>>>> >>>>> for you to fetch changes up to >>>>> 16b8d6b76992690c65c58dc8b0591496cc5e46ef: >>>>> >>>>> binman: Support updating the device tree with calc'd info >>>>> (2018-07-09 09:11:00 -0600) >>> >>> >>> >>> >>> >>> This pull has caused intermittent/random build errors on my Jenkins >>> system. >>> The log shows: >>> >>>> LD spl/u-boot-spl >>>> OBJCOPY spl/u-boot-spl-nodtb.bin >>>> COPY spl/u-boot-spl.bin >>>> BINMAN u-boot-tegra.bin >>>> BINMAN u-boot-nodtb-tegra.bin >>>> BINMAN u-boot-dtb-tegra.bin >>>> binman: pylibfdt error -9: FDT_ERR_BADMAGIC >>>> >>>> >>>> >>>> /var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot/Makefile:1244: >>>> recipe for target 'u-boot-tegra.bin' failed >>>> make[1]: *** [u-boot-tegra.bin] Error 1 >>>> make[1]: *** Waiting for unfinished jobs.... >>>> make[1]: Leaving directory >>>> >>>> >>>> '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/build/u-boot/beaver' >>>> Makefile:148: recipe for target 'sub-make' failed >>>> make: *** [sub-make] Error 2 >>>> make: Leaving directory >>>> >>>> '/var/lib/jenkins/workspace/u-boot-denx_uboot-master-build/src/u-boot' >>> >>> >>> >>> >>> >>> This doesn't happen every time; my Jenkins system builds 25 >>> Tegra/sandbox >>> boards, yet a varying set of boards fail each time I trigger the >>> build: >>> Just >>> beaver the first time, then just colibri_t20 and ventana, then just >>> medcom-wide. Note that the system performs incremental builds, if >>> that >>> matters. >> >> >> >> >> That might be the fdt_resize() problem which David Gibson has just >> sorted out upstream. If you can run binman -D (to get a stack trace) >> that might help. I should be able to do a patch if that is the >> problem. > > > > > Is this the backtrace you're looking for? > >> [swarren@swarren-lx1 u-boot]$ >> >> CROSS_COMPILE=/home/swarren/shared/gcc-linaro-7.2.1-2017.11-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- >> sh -c "make O=build-beaver -s beaver_defconfig && make >> O=build-beaver -s >> -j8" >> arch/arm/dts/tegra30-apalis.dtb: Warning >> (avoid_unnecessary_addr_size): >> /i2c@7000d000/tps65911@2d/regulators: unnecessary >> #address-cells/#size-cells >> without "ranges" or child "reg" property >> arch/arm/dts/tegra30-beaver.dtb: Warning >> (avoid_unnecessary_addr_size): >> /i2c@7000d000/tps65911@2d/regulators: unnecessary >> #address-cells/#size-cells >> without "ranges" or child "reg" property >> binman: pylibfdt error -9: FDT_ERR_BADMAGIC >> >> Traceback (most recent call last): >> File "../tools/binman/binman", line 120, in RunBinman >> ret_code = control.Binman(options, args) >> File >> >> "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/control.py", >> line 128, in Binman >> dtb = fdt.FdtScan(fname) >> File >> >> "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", >> line 459, in FdtScan >> dtb = Fdt(fname) >> File >> >> "/home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/tools/binman/../dtoc/fdt.py", >> line 315, in __init__ >> self._fdt_obj = libfdt.Fdt(fd.read()) >> File "scripts/dtc/pylibfdt/libfdt.py", line 207, in __init__ >> check_err(fdt_check_header(self._fdt)); >> File "scripts/dtc/pylibfdt/libfdt.py", line 160, in check_err >> raise FdtException(val) >> FdtException: pylibfdt error -9: FDT_ERR_BADMAGIC >> >> /home/swarren/shared/git_wa/tegra-uboot-flasher/u-boot/Makefile:1244: >> recipe for target 'u-boot-tegra.bin' failed >> make[1]: *** [u-boot-tegra.bin] Error 1 >> make[1]: *** Waiting for unfinished jobs....
Thanks for that. But actually that is not something I have seen or can explain. Here it is reading the DT at the start and somehow failing in the check. That DT is created by the U-Boot build system. Is it possible that your system has its own libfdt installed?
As it happened, the pylibfdt changes have been applied upstream today, so I'll prepare a patch to sync U-Boot up with that. Hopefully that will resolve any issues, but I am not sure.
I have the standard Ubuntu 16.04 packages installed, but no non-standard local builds:
device-tree-compiler 1.4.0+dfsg-2 libfdt1:amd64 1.4.0+dfsg-2
I suspect this is a missing dependency in the makefiles, or perhaps some process isn't waiting for its child to exit. The code that's finding the bad FDT magic appears to be reading from a file that hasn't yet been written yet:
[pid 26251] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] execve("../tools/binman/binman", ["../tools/binman/binman", "-d", "u-boot.dtb", "-O", ".", "-I", ".", "-I", "../board/nvidia/beaver", "spl/u-boot-spl"], [/* 158 vars */] <unfinished ...>
[pid 26255] open("./u-boot-out.dtb", O_WRONLY|O_CREAT|O_TRUNC, 0666 <unfinished ...> [pid 26251] <... close resumed> ) = 0 [pid 26251] close(3) = 0 [pid 26251] open("./u-boot-out.dtb", O_RDONLY) = 3 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] lseek(3, 0, SEEK_CUR) = 0 [pid 26251] fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 [pid 26251] read(3, "", 4096) = 0 [pid 26251] close(3) = 0 [pid 26251] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 [pid 26251] write(1, "binman: pylibfdt error -9: FDT_E"..., 44binman: pylibfdt error -9: FDT_ERR_BADMAGIC
[pid 26255] write(3, "\320\r\376\355\0\0We\0\0\0008\0\0Q\340\0\0\0(\0\0\0\21\0\0\0\20\0\0\0\0"..., 20480 <unfinished ...>
Specifically, this Makefile rule:
u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin: \ spl/u-boot-spl u-boot.bin FORCE $(call if_changed,binman)
runs that same binman invocation for all 3 target binaries separately and in parallel, and tools/binman/control.py:Binman() uses the same hard-coded filename for an output (or temporary?) file in each invocation. I'm not sure if we can simply replace:
fname = tools.GetOutputFilename('u-boot-out.dtb')
with a call to tempfile.mkstemp() or similar?
Thanks very much for digging into this. I actually think that rule is wrong and needs to be fixed. I will take a look.
Irrespective of whether the Makefile rule is wrong, and whether we change it at all, I still think we should apply the patch I sent for binman ("binman: ensure temp filenames don't collide") to solve this, since that's a legitimate fix irrespective of the Makefile rule.
Just to close this out, we ended up applying this patch:
2547e91dc1 tegra: Indicate that binman makes all three output files
Regards, Simon
participants (3)
-
Simon Glass
-
Stephen Warren
-
Tom Rini