[Buildroot] [PATCH 8/9] boards/zynq: rename the DTB to be loaded by U-Boot

Peter Korsgaard peter at korsgaard.com
Mon Dec 11 21:37:48 UTC 2017


>>>>> "Luca" == Luca Ceresoli <luca at lucaceresoli.net> writes:

 > We are about to introduce genimage support for the Zynq boards. For
 > all of them U-Boot loads the DTB from a file named "devicetree.dtb" so
 > we need to rename it on the SD card image.

 > We could use genimage itself to rename files while creating the
 > image. But this would require a different genimage.cfg for each board,
 > leading to duplicate code.

 > Instead let's create a "devicetree.dtb" symlink pointing to the dtb
 > listed in the configuration. Currently all the Zynq-based boards have
 > only one DTS configured, but if one had two or more of them, the
 > symlink would point to the first one.

 > Signed-off-by: Luca Ceresoli <luca at lucaceresoli.net>
 > ---
 >  board/zynq/post-image.sh        | 11 +++++++++++
 >  configs/zynq_microzed_defconfig |  1 +
 >  configs/zynq_zc706_defconfig    |  1 +
 >  configs/zynq_zed_defconfig      |  1 +
 >  4 files changed, 14 insertions(+)
 >  create mode 100755 board/zynq/post-image.sh

 > diff --git a/board/zynq/post-image.sh b/board/zynq/post-image.sh
 > new file mode 100755
 > index 000000000000..449f4a23725a
 > --- /dev/null
 > +++ b/board/zynq/post-image.sh
 > @@ -0,0 +1,11 @@
 > +#!/bin/sh
 > +
 > +# By default U-Boot loads DTB from a file named "devicetree.dtb", so
 > +# let's use a symlink with that name that points to the *first*
 > +# devicetree listed in the config.
 > +
 > +FIRST_DT=$(sed -n \
 > +           's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9\-]*\).*"$/\1/p' \
 > +           ${BR2_CONFIG})
 > +
 > +ln -fs ${FIRST_DT}.dtb ${BINARIES_DIR}/devicetree.dtb

I've added a check for the empty string (E.G. in case you are not
building a kernel / using this option) and committed, thanks.

-- 
Bye, Peter Korsgaard



More information about the buildroot mailing list