diff mbox series

[U-Boot,06/29] binman: Update the device-tree file on exit

Message ID 20180717192552.198496-7-sjg@chromium.org
State Rejected
Headers show
Series binman: Expand feature set and documentation | expand

Commit Message

Simon Glass July 17, 2018, 7:25 p.m. UTC
Binman can make additions to the device tree which are useful to U-Boot
when it runs (e.g. the position of each entry in the image). Write the
changes back so that they are easily accessible.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/control.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass July 17, 2018, 7:44 p.m. UTC | #1
Hi,

On 17 July 2018 at 13:25, Simon Glass <sjg@chromium.org> wrote:
> Binman can make additions to the device tree which are useful to U-Boot
> when it runs (e.g. the position of each entry in the image). Write the
> changes back so that they are easily accessible.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  tools/binman/control.py | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tools/binman/control.py b/tools/binman/control.py
> index 17c6d7a2d2..97652334e0 100644
> --- a/tools/binman/control.py
> +++ b/tools/binman/control.py
> @@ -168,8 +168,12 @@ def Binman(options, args):
>                  image.BuildImage()
>                  if options.map:
>                      image.WriteMap()
> +            # Write the updated FDT to our output file, and also back to the
> +            # input file, so it is visible after binman exits.
>              with open(fname, 'wb') as outfd:
>                  outfd.write(dtb.GetContents())
> +            with open(dtb_fname, 'wb') as outfd:
> +                outfd.write(dtb.GetContents())
>          finally:
>              tools.FinaliseOutputDir()
>      finally:
> --
> 2.18.0.203.gfac676dfb9-goog
>

Actually I think this patch is a bad idea since it can cause race
conditions. U-Boot's Makefile builds the .dtb, someone changes the
source, then binman updates the .dtb, causing the Makefile to think
that it does not need updating next time. I'll drop this patch.

Regards,
Simon
diff mbox series

Patch

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 17c6d7a2d2..97652334e0 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -168,8 +168,12 @@  def Binman(options, args):
                 image.BuildImage()
                 if options.map:
                     image.WriteMap()
+            # Write the updated FDT to our output file, and also back to the
+            # input file, so it is visible after binman exits.
             with open(fname, 'wb') as outfd:
                 outfd.write(dtb.GetContents())
+            with open(dtb_fname, 'wb') as outfd:
+                outfd.write(dtb.GetContents())
         finally:
             tools.FinaliseOutputDir()
     finally: