diff mbox series

[v2,1/1] of: overlay: rename overlay source files from .dts to .dtso

Message ID 20220503211954.1428919-1-frowand.list@gmail.com (mailing list archive)
State Handled Elsewhere
Headers show
Series [v2,1/1] of: overlay: rename overlay source files from .dts to .dtso | expand

Commit Message

Frank Rowand May 3, 2022, 9:19 p.m. UTC
From: Frank Rowand <frank.rowand@sony.com>

In drivers/of/unittest-data/:
   - Rename .dts overlay source files to use .dtso suffix.
   - Add Makefile rule to build .dtbo.o assembly file from overlay
     .dtso source file.
   - Update Makefile to build .dtbo.o objects instead of .dtb.o from
     unittest overlay source files.

Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
.dtb.o

Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
of %.dts

Rename .dts overlay source files to use .dtso suffix in:
   arch/arm64/boot/dts/freescale/
   arch/arm64/boot/dts/xilinx/

Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---

Testing by arm64 people would be much appreciated.

Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

version 1 patch:
   https://lore.kernel.org/r/20210324223713.1334666-1-frowand.list@gmail.com

changes from version 1:
   - rebase to 5.18-rc1 plus many patches already accepted by Rob
     Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
   - Add new overlay source files in:
      arch/arm64/boot/dts/freescale/
      arch/arm64/boot/dts/xilinx/
   - Do not delete overlay documentation file

 ...qds-13bb.dts => fsl-ls1028a-qds-13bb.dtso} |  0
 ...qds-65bb.dts => fsl-ls1028a-qds-65bb.dtso} |  0
 ...qds-7777.dts => fsl-ls1028a-qds-7777.dtso} |  0
 ...qds-85bb.dts => fsl-ls1028a-qds-85bb.dtso} |  0
 ...qds-899b.dts => fsl-ls1028a-qds-899b.dtso} |  0
 ...qds-9999.dts => fsl-ls1028a-qds-9999.dtso} |  0
 ...ts => imx8mm-venice-gw72xx-0x-imx219.dtso} |  0
 ...=> imx8mm-venice-gw72xx-0x-rs232-rts.dtso} |  0
 ...dts => imx8mm-venice-gw72xx-0x-rs422.dtso} |  0
 ...dts => imx8mm-venice-gw72xx-0x-rs485.dtso} |  0
 ...ts => imx8mm-venice-gw73xx-0x-imx219.dtso} |  0
 ...=> imx8mm-venice-gw73xx-0x-rs232-rts.dtso} |  0
 ...dts => imx8mm-venice-gw73xx-0x-rs422.dtso} |  0
 ...dts => imx8mm-venice-gw73xx-0x-rs485.dtso} |  0
 ...v-g-revA.dts => zynqmp-sck-kv-g-revA.dtso} |  0
 ...v-g-revB.dts => zynqmp-sck-kv-g-revB.dtso} |  0
 drivers/of/unittest-data/Makefile             | 86 ++++++++++++-------
 .../{overlay.dts => overlay.dtso}             |  0
 .../{overlay_0.dts => overlay_0.dtso}         |  0
 .../{overlay_1.dts => overlay_1.dtso}         |  0
 .../{overlay_10.dts => overlay_10.dtso}       |  0
 .../{overlay_11.dts => overlay_11.dtso}       |  0
 .../{overlay_12.dts => overlay_12.dtso}       |  0
 .../{overlay_13.dts => overlay_13.dtso}       |  0
 .../{overlay_15.dts => overlay_15.dtso}       |  0
 .../{overlay_16.dts => overlay_16.dtso}       |  0
 .../{overlay_17.dts => overlay_17.dtso}       |  0
 .../{overlay_18.dts => overlay_18.dtso}       |  0
 .../{overlay_19.dts => overlay_19.dtso}       |  0
 .../{overlay_2.dts => overlay_2.dtso}         |  0
 .../{overlay_20.dts => overlay_20.dtso}       |  0
 .../{overlay_3.dts => overlay_3.dtso}         |  0
 .../{overlay_4.dts => overlay_4.dtso}         |  0
 .../{overlay_5.dts => overlay_5.dtso}         |  0
 .../{overlay_6.dts => overlay_6.dtso}         |  0
 .../{overlay_7.dts => overlay_7.dtso}         |  0
 .../{overlay_8.dts => overlay_8.dtso}         |  0
 .../{overlay_9.dts => overlay_9.dtso}         |  0
 ...node.dts => overlay_bad_add_dup_node.dtso} |  0
 ...prop.dts => overlay_bad_add_dup_prop.dtso} |  0
 ...d_phandle.dts => overlay_bad_phandle.dtso} |  0
 ...bad_symbol.dts => overlay_bad_symbol.dtso} |  0
 .../{overlay_base.dts => overlay_base.dtso}   |  0
 ...erlay_gpio_01.dts => overlay_gpio_01.dtso} |  0
 ...lay_gpio_02a.dts => overlay_gpio_02a.dtso} |  0
 ...lay_gpio_02b.dts => overlay_gpio_02b.dtso} |  0
 ...erlay_gpio_03.dts => overlay_gpio_03.dtso} |  0
 ...lay_gpio_04a.dts => overlay_gpio_04a.dtso} |  0
 ...lay_gpio_04b.dts => overlay_gpio_04b.dtso} |  0
 .../{static_base_1.dts => static_base_1.dtso} |  0
 .../{static_base_2.dts => static_base_2.dtso} |  0
 .../{testcases.dts => testcases.dtso}         |  0
 drivers/of/unittest.c                         | 48 +++++------
 scripts/Makefile.lib                          |  2 +-
 54 files changed, 78 insertions(+), 58 deletions(-)
 rename arch/arm64/boot/dts/freescale/{fsl-ls1028a-qds-13bb.dts => fsl-ls1028a-qds-13bb.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{fsl-ls1028a-qds-65bb.dts => fsl-ls1028a-qds-65bb.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{fsl-ls1028a-qds-7777.dts => fsl-ls1028a-qds-7777.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{fsl-ls1028a-qds-85bb.dts => fsl-ls1028a-qds-85bb.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{fsl-ls1028a-qds-899b.dts => fsl-ls1028a-qds-899b.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{fsl-ls1028a-qds-9999.dts => fsl-ls1028a-qds-9999.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw72xx-0x-imx219.dts => imx8mm-venice-gw72xx-0x-imx219.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw72xx-0x-rs232-rts.dts => imx8mm-venice-gw72xx-0x-rs232-rts.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw72xx-0x-rs422.dts => imx8mm-venice-gw72xx-0x-rs422.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw72xx-0x-rs485.dts => imx8mm-venice-gw72xx-0x-rs485.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw73xx-0x-imx219.dts => imx8mm-venice-gw73xx-0x-imx219.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw73xx-0x-rs232-rts.dts => imx8mm-venice-gw73xx-0x-rs232-rts.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw73xx-0x-rs422.dts => imx8mm-venice-gw73xx-0x-rs422.dtso} (100%)
 rename arch/arm64/boot/dts/freescale/{imx8mm-venice-gw73xx-0x-rs485.dts => imx8mm-venice-gw73xx-0x-rs485.dtso} (100%)
 rename arch/arm64/boot/dts/xilinx/{zynqmp-sck-kv-g-revA.dts => zynqmp-sck-kv-g-revA.dtso} (100%)
 rename arch/arm64/boot/dts/xilinx/{zynqmp-sck-kv-g-revB.dts => zynqmp-sck-kv-g-revB.dtso} (100%)
 rename drivers/of/unittest-data/{overlay.dts => overlay.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_0.dts => overlay_0.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_1.dts => overlay_1.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_10.dts => overlay_10.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_11.dts => overlay_11.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_12.dts => overlay_12.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_13.dts => overlay_13.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_15.dts => overlay_15.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_16.dts => overlay_16.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_17.dts => overlay_17.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_18.dts => overlay_18.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_19.dts => overlay_19.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_2.dts => overlay_2.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_20.dts => overlay_20.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_3.dts => overlay_3.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_4.dts => overlay_4.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_5.dts => overlay_5.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_6.dts => overlay_6.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_7.dts => overlay_7.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_8.dts => overlay_8.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_9.dts => overlay_9.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_bad_add_dup_node.dts => overlay_bad_add_dup_node.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_bad_add_dup_prop.dts => overlay_bad_add_dup_prop.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_bad_phandle.dts => overlay_bad_phandle.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_bad_symbol.dts => overlay_bad_symbol.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_base.dts => overlay_base.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_gpio_01.dts => overlay_gpio_01.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_gpio_02a.dts => overlay_gpio_02a.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_gpio_02b.dts => overlay_gpio_02b.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_gpio_03.dts => overlay_gpio_03.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_gpio_04a.dts => overlay_gpio_04a.dtso} (100%)
 rename drivers/of/unittest-data/{overlay_gpio_04b.dts => overlay_gpio_04b.dtso} (100%)
 rename drivers/of/unittest-data/{static_base_1.dts => static_base_1.dtso} (100%)
 rename drivers/of/unittest-data/{static_base_2.dts => static_base_2.dtso} (100%)
 rename drivers/of/unittest-data/{testcases.dts => testcases.dtso} (100%)

Comments

kernel test robot May 4, 2022, 2:53 a.m. UTC | #1
Hi,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on next-20220503]
[cannot apply to masahiroy-kbuild/for-next v5.18-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/frowand-list-gmail-com/of-overlay-rename-overlay-source-files-from-dts-to-dtso/20220504-052106
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arc-randconfig-m031-20220501 (https://download.01.org/0day-ci/archive/20220504/202205041054.U5pUx0xQ-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/53969d905002b16289e1524e691435a64652db0d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review frowand-list-gmail-com/of-overlay-rename-overlay-source-files-from-dts-to-dtso/20220504-052106
        git checkout 53969d905002b16289e1524e691435a64652db0d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> make[4]: *** No rule to make target 'drivers/of/unittest-data/static_base_1.dtb', needed by 'drivers/of/unittest-data/static_test_1.dtb'.
>> make[4]: *** No rule to make target 'drivers/of/unittest-data/static_base_2.dtb', needed by 'drivers/of/unittest-data/static_test_2.dtb'.
   make[4]: Target '__build' not remade because of errors.
Frank Rowand May 4, 2022, 8:42 p.m. UTC | #2
On 5/3/22 16:42, Rob Herring wrote:
> On Tue, May 3, 2022 at 4:20 PM <frowand.list@gmail.com> wrote:
>>
>> From: Frank Rowand <frank.rowand@sony.com>
>>
>> In drivers/of/unittest-data/:
>>    - Rename .dts overlay source files to use .dtso suffix.
>>    - Add Makefile rule to build .dtbo.o assembly file from overlay
>>      .dtso source file.
>>    - Update Makefile to build .dtbo.o objects instead of .dtb.o from
>>      unittest overlay source files.
>>
>> Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
>> .dtb.o
>>
>> Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
>> of %.dts
>>
>> Rename .dts overlay source files to use .dtso suffix in:
>>    arch/arm64/boot/dts/freescale/
>>    arch/arm64/boot/dts/xilinx/
>>
>> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
>> ---
>>
>> Testing by arm64 people would be much appreciated.
>>
>> Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
>> git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
>>
>> version 1 patch:
>>    https://lore.kernel.org/r/20210324223713.1334666-1-frowand.list@gmail.com
>>
>> changes from version 1:
>>    - rebase to 5.18-rc1 plus many patches already accepted by Rob
>>      Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
>>    - Add new overlay source files in:
>>       arch/arm64/boot/dts/freescale/
>>       arch/arm64/boot/dts/xilinx/
> 
> I can't apply these. They need to be applied separately. And probably
> at end of the merge window or right after rc1 (IOW, coordinated with
> SoC maintainers in advance). Or we support both forms for a cycle.

If applied separately then git bisect is broken.  I don't see this change
as being big enough to be considered a "flag day" change, but if I can't
get the SoC maintainers to ack you pulling these renames then I can easily
re-spin in a way to support both forms for a release cycle.

> 
> [...]
> 
>> diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
>> index d072f3ba3971..df2ca1820273 100644
>> --- a/drivers/of/unittest-data/Makefile
>> +++ b/drivers/of/unittest-data/Makefile
>> @@ -1,38 +1,58 @@
>>  # SPDX-License-Identifier: GPL-2.0
>> -obj-y += testcases.dtb.o
>>
>> -obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
>> -                           overlay_0.dtb.o \
>> -                           overlay_1.dtb.o \
>> -                           overlay_2.dtb.o \
>> -                           overlay_3.dtb.o \
>> -                           overlay_4.dtb.o \
>> -                           overlay_5.dtb.o \
>> -                           overlay_6.dtb.o \
>> -                           overlay_7.dtb.o \
>> -                           overlay_8.dtb.o \
>> -                           overlay_9.dtb.o \
>> -                           overlay_10.dtb.o \
>> -                           overlay_11.dtb.o \
>> -                           overlay_12.dtb.o \
>> -                           overlay_13.dtb.o \
>> -                           overlay_15.dtb.o \
>> -                           overlay_16.dtb.o \
>> -                           overlay_17.dtb.o \
>> -                           overlay_18.dtb.o \
>> -                           overlay_19.dtb.o \
>> -                           overlay_20.dtb.o \
>> -                           overlay_bad_add_dup_node.dtb.o \
>> -                           overlay_bad_add_dup_prop.dtb.o \
>> -                           overlay_bad_phandle.dtb.o \
>> -                           overlay_bad_symbol.dtb.o \
>> -                           overlay_base.dtb.o \
>> -                           overlay_gpio_01.dtb.o \
>> -                           overlay_gpio_02a.dtb.o \
>> -                           overlay_gpio_02b.dtb.o \
>> -                           overlay_gpio_03.dtb.o \
>> -                           overlay_gpio_04a.dtb.o \
>> -                           overlay_gpio_04b.dtb.o
>> +# Generate an assembly file to wrap the output of the device tree compiler
>> +quiet_cmd_dt_S_dtbo= DTB     $@
>> +cmd_dt_S_dtbo=\
>> +{                                                      \
>> +       echo '\#include <asm-generic/vmlinux.lds.h>';   \
>> +       echo '.section .dtb.init.rodata,"a"';           \
>> +       echo '.balign STRUCT_ALIGNMENT';                \
>> +       echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \
>> +       echo '__dtbo_$(subst -,_,$(*F))_begin:';        \
>> +       echo '.incbin "$<" ';                           \
>> +       echo '__dtbo_$(subst -,_,$(*F))_end:';          \
>> +       echo '.global __dtbo_$(subst -,_,$(*F))_end';   \
>> +       echo '.balign STRUCT_ALIGNMENT';                \
>> +} > $@
>> +
>> +
>> +$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
>> +       $(call if_changed,dt_S_dtbo)
> 
> Humm, this belongs in scripts/Makefile.lib.

I would rather keep it isolated to just the use in unittest.
We just now got rid of the final driver use of of_overlay_fdt_apply()
by the grandfathered legacy user in:

   841281fe52a7 drm: rcar-du: Drop LVDS device tree backward compatibility

That driver was the only use of %.dtb.S for an overlay.

I can't eliminate the rule for %.dtb.S because that is used in several
cases for building the system FDT into the kernel.  But having this
rule in drivers/of/unittest-data/Makefile provides consistent naming
of overlays withing unittest.  Helping to make it clear that they are
not a system FDT.

> 
> I don't think we need a different section name with __dtbo_* instead
> of __dtb_* if that simplifies the Makefile.

A different section name is not needed if the rule is moved to
scripts/Makefile.lib but even if moved there, I prefer to keep the
overlay data clearly delineated from the system FDT data.

There is also a kernel test robot email warning about randconfig
arc build errors:

>> make[4]: *** No rule to make target 'drivers/of/unittest-data/static_base_1.dtb', needed by 'drivers/of/unittest-data/static_test_1.dtb'.
>> make[4]: *** No rule to make target 'drivers/of/unittest-data/static_base_2.dtb', needed by 'drivers/of/unittest-data/static_test_2.dtb'.

They look like a pre-existing problem, not new.  I'll get their
build environment and see what's going on.

-Frank

> 
>> +
>> +obj-y += testcases.dtbo.o
>> +
>> +obj-$(CONFIG_OF_OVERLAY) += overlay.dtbo.o \
>> +                           overlay_0.dtbo.o \
>> +                           overlay_1.dtbo.o \
>> +                           overlay_2.dtbo.o \
>> +                           overlay_3.dtbo.o \
>> +                           overlay_4.dtbo.o \
>> +                           overlay_5.dtbo.o \
>> +                           overlay_6.dtbo.o \
>> +                           overlay_7.dtbo.o \
>> +                           overlay_8.dtbo.o \
>> +                           overlay_9.dtbo.o \
>> +                           overlay_10.dtbo.o \
>> +                           overlay_11.dtbo.o \
>> +                           overlay_12.dtbo.o \
>> +                           overlay_13.dtbo.o \
>> +                           overlay_15.dtbo.o \
>> +                           overlay_16.dtbo.o \
>> +                           overlay_17.dtbo.o \
>> +                           overlay_18.dtbo.o \
>> +                           overlay_19.dtbo.o \
>> +                           overlay_20.dtbo.o \
>> +                           overlay_bad_add_dup_node.dtbo.o \
>> +                           overlay_bad_add_dup_prop.dtbo.o \
>> +                           overlay_bad_phandle.dtbo.o \
>> +                           overlay_bad_symbol.dtbo.o \
>> +                           overlay_base.dtbo.o \
>> +                           overlay_gpio_01.dtbo.o \
>> +                           overlay_gpio_02a.dtbo.o \
>> +                           overlay_gpio_02b.dtbo.o \
>> +                           overlay_gpio_03.dtbo.o \
>> +                           overlay_gpio_04a.dtbo.o \
>> +                           overlay_gpio_04b.dtbo.o
>>
>>  # enable creation of __symbols__ node
>>  DTC_FLAGS_overlay += -@
> 
> 
>> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
>> index dff55ae09d97..1d3c170d95db 100644
>> --- a/drivers/of/unittest.c
>> +++ b/drivers/of/unittest.c
>> @@ -1423,12 +1423,12 @@ static int __init unittest_data_add(void)
>>         void *unittest_data_align;
>>         struct device_node *unittest_data_node = NULL, *np;
>>         /*
>> -        * __dtb_testcases_begin[] and __dtb_testcases_end[] are magically
>> -        * created by cmd_dt_S_dtb in scripts/Makefile.lib
>> +        * __dtbo_testcases_begin[] and __dtbo_testcases_end[] are
>> +        * created by cmd_dt_S_dtbo in Makefile
>>          */
>> -       extern uint8_t __dtb_testcases_begin[];
>> -       extern uint8_t __dtb_testcases_end[];
>> -       const int size = __dtb_testcases_end - __dtb_testcases_begin;
>> +       extern uint8_t __dtbo_testcases_begin[];
>> +       extern uint8_t __dtbo_testcases_end[];
>> +       const int size = __dtbo_testcases_end - __dtbo_testcases_begin;
>>         int rc;
>>         void *ret;
>>
>> @@ -1443,7 +1443,7 @@ static int __init unittest_data_add(void)
>>                 return -ENOMEM;
>>
>>         unittest_data_align = PTR_ALIGN(unittest_data, FDT_ALIGN_SIZE);
>> -       memcpy(unittest_data_align, __dtb_testcases_begin, size);
>> +       memcpy(unittest_data_align, __dtbo_testcases_begin, size);
>>
>>         ret = of_fdt_unflatten_tree(unittest_data_align, NULL, &unittest_data_node);
>>         if (!ret) {
>> @@ -3009,24 +3009,24 @@ static inline void __init of_unittest_overlay(void) { }
>>  #ifdef CONFIG_OF_OVERLAY
>>
>>  /*
>> - * __dtb_ot_begin[] and __dtb_ot_end[] are created by cmd_dt_S_dtb
>> - * in scripts/Makefile.lib
>> + * __dtbo_##overlay_name##_begin[] and __dtbo_##overlay_name##_end[] are
>> + * created by cmd_dt_S_dtbo in Makefile
>>   */
>>
>> -#define OVERLAY_INFO_EXTERN(name) \
>> -       extern uint8_t __dtb_##name##_begin[]; \
>> -       extern uint8_t __dtb_##name##_end[]
>> +#define OVERLAY_INFO_EXTERN(overlay_name) \
>> +       extern uint8_t __dtbo_##overlay_name##_begin[]; \
>> +       extern uint8_t __dtbo_##overlay_name##_end[]
>>
>> -#define OVERLAY_INFO(overlay_name, expected)             \
>> -{      .dtb_begin       = __dtb_##overlay_name##_begin, \
>> -       .dtb_end         = __dtb_##overlay_name##_end,   \
>> -       .expected_result = expected,                     \
>> -       .name            = #overlay_name,                \
>> +#define OVERLAY_INFO(overlay_name, expected)               \
>> +{      .dtbo_begin       = __dtbo_##overlay_name##_begin, \
>> +       .dtbo_end         = __dtbo_##overlay_name##_end,   \
>> +       .expected_result = expected,                       \
>> +       .name            = #overlay_name,                  \
>>  }
>>
>>  struct overlay_info {
>> -       uint8_t         *dtb_begin;
>> -       uint8_t         *dtb_end;
>> +       uint8_t         *dtbo_begin;
>> +       uint8_t         *dtbo_end;
> 
> Is this rename really needed?
> 
>>         int             expected_result;
>>         int             ovcs_id;
>>         char            *name;
>> @@ -3100,7 +3100,7 @@ static struct overlay_info overlays[] = {
>>         OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
>>         OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
>>         /* end marker */
>> -       {.dtb_begin = NULL, .dtb_end = NULL, .expected_result = 0, .name = NULL}
>> +       {.dtbo_begin = NULL, .dtbo_end = NULL, .expected_result = 0, .name = NULL}
>>  };
>>
>>  static struct device_node *overlay_base_root;
>> @@ -3157,13 +3157,13 @@ void __init unittest_unflatten_overlay_base(void)
>>                 return;
>>         }
>>
>> -       data_size = info->dtb_end - info->dtb_begin;
>> +       data_size = info->dtbo_end - info->dtbo_begin;
>>         if (!data_size) {
>>                 pr_err("No dtb 'overlay_base' to attach\n");
>>                 return;
>>         }
>>
>> -       size = fdt_totalsize(info->dtb_begin);
>> +       size = fdt_totalsize(info->dtbo_begin);
>>         if (size != data_size) {
>>                 pr_err("dtb 'overlay_base' header totalsize != actual size");
>>                 return;
>> @@ -3175,7 +3175,7 @@ void __init unittest_unflatten_overlay_base(void)
>>                 return;
>>         }
>>
>> -       memcpy(new_fdt, info->dtb_begin, size);
>> +       memcpy(new_fdt, info->dtbo_begin, size);
>>
>>         __unflatten_device_tree(new_fdt, NULL, &overlay_base_root,
>>                                 dt_alloc_memory, true);
>> @@ -3210,11 +3210,11 @@ static int __init overlay_data_apply(const char *overlay_name, int *ovcs_id)
>>                 return 0;
>>         }
>>
>> -       size = info->dtb_end - info->dtb_begin;
>> +       size = info->dtbo_end - info->dtbo_begin;
>>         if (!size)
>>                 pr_err("no overlay data for %s\n", overlay_name);
>>
>> -       ret = of_overlay_fdt_apply(info->dtb_begin, size, &info->ovcs_id);
>> +       ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id);
>>         if (ovcs_id)
>>                 *ovcs_id = info->ovcs_id;
>>         if (ret < 0)
>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
>> index 9f69ecdd7977..b409bec5fa45 100644
>> --- a/scripts/Makefile.lib
>> +++ b/scripts/Makefile.lib
>> @@ -363,7 +363,7 @@ endef
>>  $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
>>         $(call if_changed_rule,dtc)
>>
>> -$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
>> +$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
>>         $(call if_changed_dep,dtc)
>>
>>  dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
>> --
>> Frank Rowand <frank.rowand@sony.com>
>>
Frank Rowand May 4, 2022, 9:40 p.m. UTC | #3
On 5/4/22 16:08, Rob Herring wrote:
> On Wed, May 4, 2022 at 3:42 PM Frank Rowand <frowand.list@gmail.com> wrote:
>>
>> On 5/3/22 16:42, Rob Herring wrote:
>>> On Tue, May 3, 2022 at 4:20 PM <frowand.list@gmail.com> wrote:
>>>>
>>>> From: Frank Rowand <frank.rowand@sony.com>
>>>>
>>>> In drivers/of/unittest-data/:
>>>>    - Rename .dts overlay source files to use .dtso suffix.
>>>>    - Add Makefile rule to build .dtbo.o assembly file from overlay
>>>>      .dtso source file.
>>>>    - Update Makefile to build .dtbo.o objects instead of .dtb.o from
>>>>      unittest overlay source files.
>>>>
>>>> Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
>>>> .dtb.o
>>>>
>>>> Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
>>>> of %.dts
>>>>
>>>> Rename .dts overlay source files to use .dtso suffix in:
>>>>    arch/arm64/boot/dts/freescale/
>>>>    arch/arm64/boot/dts/xilinx/
>>>>
>>>> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
>>>> ---
>>>>
>>>> Testing by arm64 people would be much appreciated.
>>>>
>>>> Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
>>>>
>>>> version 1 patch:
>>>>    https://lore.kernel.org/r/20210324223713.1334666-1-frowand.list@gmail.com
>>>>
>>>> changes from version 1:
>>>>    - rebase to 5.18-rc1 plus many patches already accepted by Rob
>>>>      Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
>>>>    - Add new overlay source files in:
>>>>       arch/arm64/boot/dts/freescale/
>>>>       arch/arm64/boot/dts/xilinx/
>>>
>>> I can't apply these. They need to be applied separately. And probably
>>> at end of the merge window or right after rc1 (IOW, coordinated with
>>> SoC maintainers in advance). Or we support both forms for a cycle.
>>
>> If applied separately then git bisect is broken.  I don't see this change
>> as being big enough to be considered a "flag day" change, but if I can't
>> get the SoC maintainers to ack you pulling these renames then I can easily
>> re-spin in a way to support both forms for a release cycle.
>>
>>>
>>> [...]
>>>
>>>> diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
>>>> index d072f3ba3971..df2ca1820273 100644
>>>> --- a/drivers/of/unittest-data/Makefile
>>>> +++ b/drivers/of/unittest-data/Makefile
>>>> @@ -1,38 +1,58 @@
>>>>  # SPDX-License-Identifier: GPL-2.0
>>>> -obj-y += testcases.dtb.o
>>>>
>>>> -obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
>>>> -                           overlay_0.dtb.o \
>>>> -                           overlay_1.dtb.o \
>>>> -                           overlay_2.dtb.o \
>>>> -                           overlay_3.dtb.o \
>>>> -                           overlay_4.dtb.o \
>>>> -                           overlay_5.dtb.o \
>>>> -                           overlay_6.dtb.o \
>>>> -                           overlay_7.dtb.o \
>>>> -                           overlay_8.dtb.o \
>>>> -                           overlay_9.dtb.o \
>>>> -                           overlay_10.dtb.o \
>>>> -                           overlay_11.dtb.o \
>>>> -                           overlay_12.dtb.o \
>>>> -                           overlay_13.dtb.o \
>>>> -                           overlay_15.dtb.o \
>>>> -                           overlay_16.dtb.o \
>>>> -                           overlay_17.dtb.o \
>>>> -                           overlay_18.dtb.o \
>>>> -                           overlay_19.dtb.o \
>>>> -                           overlay_20.dtb.o \
>>>> -                           overlay_bad_add_dup_node.dtb.o \
>>>> -                           overlay_bad_add_dup_prop.dtb.o \
>>>> -                           overlay_bad_phandle.dtb.o \
>>>> -                           overlay_bad_symbol.dtb.o \
>>>> -                           overlay_base.dtb.o \
>>>> -                           overlay_gpio_01.dtb.o \
>>>> -                           overlay_gpio_02a.dtb.o \
>>>> -                           overlay_gpio_02b.dtb.o \
>>>> -                           overlay_gpio_03.dtb.o \
>>>> -                           overlay_gpio_04a.dtb.o \
>>>> -                           overlay_gpio_04b.dtb.o
>>>> +# Generate an assembly file to wrap the output of the device tree compiler
>>>> +quiet_cmd_dt_S_dtbo= DTB     $@
>>>> +cmd_dt_S_dtbo=\
>>>> +{                                                      \
>>>> +       echo '\#include <asm-generic/vmlinux.lds.h>';   \
>>>> +       echo '.section .dtb.init.rodata,"a"';           \
>>>> +       echo '.balign STRUCT_ALIGNMENT';                \
>>>> +       echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \
>>>> +       echo '__dtbo_$(subst -,_,$(*F))_begin:';        \
>>>> +       echo '.incbin "$<" ';                           \
>>>> +       echo '__dtbo_$(subst -,_,$(*F))_end:';          \
>>>> +       echo '.global __dtbo_$(subst -,_,$(*F))_end';   \
>>>> +       echo '.balign STRUCT_ALIGNMENT';                \
>>>> +} > $@
>>>> +
>>>> +
>>>> +$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
>>>> +       $(call if_changed,dt_S_dtbo)
>>>
>>> Humm, this belongs in scripts/Makefile.lib.
>>
>> I would rather keep it isolated to just the use in unittest.
>> We just now got rid of the final driver use of of_overlay_fdt_apply()
>> by the grandfathered legacy user in:
>>
>>    841281fe52a7 drm: rcar-du: Drop LVDS device tree backward compatibility
>>
>> That driver was the only use of %.dtb.S for an overlay.
> 
> I'd actually prefer more drivers handling compatibility this way than
> handling old and new DTs in code. That's easier to find and when
> compatibility with old DTs is no longer needed we can just remove the
> fixup overlay. Though I guess that one was a lot of code too, but that
> would probably be mitigated if we had multiple users. Anyways, that's
> a side issue.

If I remember correctly, that is a total reversal of previous discussions
and policy decisions.

My previous position has been to not have drivers applying overlays.
I'll have to step back and revisit the concept, trying to set aside
my previous assumptions and conclusions.

But before I go away and revisit, there is one thing to mention.  Now
that you have machine parseable bindings (and many of them implemented)
and also a method to statically validate overlays applied on top of
specific base .dtbs (that is the purpose of the arch/arm64/dts/* files
that I renamed in this patch, right?), allowing drivers to dynamically
apply overlays, potentially after modifying the base devicetree (that's
the other patch series I need to be reviewing at the moment...) reduces
the validation coverage.

> 
> .dtb.S is an intermediate format that no one looks at. The arguments
> for knowing what the file is don't really apply to it. We should do
> here whatever makes the makefiles the simplest.
> 
>> I can't eliminate the rule for %.dtb.S because that is used in several
>> cases for building the system FDT into the kernel.  But having this
>> rule in drivers/of/unittest-data/Makefile provides consistent naming
>> of overlays withing unittest.  Helping to make it clear that they are
>> not a system FDT.
> 
> But if they are in one spot you can make that whole unreadable mess of
> a command a macro with '.dtb.S' becoming a variable. Then we have 1
> unreadable blob and when someone goes to fix something in it, they
> don't have to find our hidden copy.> 
>>> I don't think we need a different section name with __dtbo_* instead
>>> of __dtb_* if that simplifies the Makefile.
>>
>> A different section name is not needed if the rule is moved to
>> scripts/Makefile.lib but even if moved there, I prefer to keep the
>> overlay data clearly delineated from the system FDT data.
> 
> At least make that a separate patch then.

OK, will do.

> 
> Rob
Rob Herring (Arm) May 9, 2022, 10:11 p.m. UTC | #4
On Wed, May 04, 2022 at 04:40:30PM -0500, Frank Rowand wrote:
> On 5/4/22 16:08, Rob Herring wrote:
> > On Wed, May 4, 2022 at 3:42 PM Frank Rowand <frowand.list@gmail.com> wrote:
> >>
> >> On 5/3/22 16:42, Rob Herring wrote:
> >>> On Tue, May 3, 2022 at 4:20 PM <frowand.list@gmail.com> wrote:
> >>>>
> >>>> From: Frank Rowand <frank.rowand@sony.com>
> >>>>
> >>>> In drivers/of/unittest-data/:
> >>>>    - Rename .dts overlay source files to use .dtso suffix.
> >>>>    - Add Makefile rule to build .dtbo.o assembly file from overlay
> >>>>      .dtso source file.
> >>>>    - Update Makefile to build .dtbo.o objects instead of .dtb.o from
> >>>>      unittest overlay source files.
> >>>>
> >>>> Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
> >>>> .dtb.o
> >>>>
> >>>> Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
> >>>> of %.dts
> >>>>
> >>>> Rename .dts overlay source files to use .dtso suffix in:
> >>>>    arch/arm64/boot/dts/freescale/
> >>>>    arch/arm64/boot/dts/xilinx/
> >>>>
> >>>> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> >>>> ---
> >>>>
> >>>> Testing by arm64 people would be much appreciated.
> >>>>
> >>>> Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
> >>>> git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
> >>>>
> >>>> version 1 patch:
> >>>>    https://lore.kernel.org/r/20210324223713.1334666-1-frowand.list@gmail.com
> >>>>
> >>>> changes from version 1:
> >>>>    - rebase to 5.18-rc1 plus many patches already accepted by Rob
> >>>>      Applies on branch dt/next, commit 4fb74186cee8 of Rob's kernel.org tree.
> >>>>    - Add new overlay source files in:
> >>>>       arch/arm64/boot/dts/freescale/
> >>>>       arch/arm64/boot/dts/xilinx/
> >>>
> >>> I can't apply these. They need to be applied separately. And probably
> >>> at end of the merge window or right after rc1 (IOW, coordinated with
> >>> SoC maintainers in advance). Or we support both forms for a cycle.
> >>
> >> If applied separately then git bisect is broken.  I don't see this change
> >> as being big enough to be considered a "flag day" change, but if I can't
> >> get the SoC maintainers to ack you pulling these renames then I can easily
> >> re-spin in a way to support both forms for a release cycle.
> >>
> >>>
> >>> [...]
> >>>
> >>>> diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
> >>>> index d072f3ba3971..df2ca1820273 100644
> >>>> --- a/drivers/of/unittest-data/Makefile
> >>>> +++ b/drivers/of/unittest-data/Makefile
> >>>> @@ -1,38 +1,58 @@
> >>>>  # SPDX-License-Identifier: GPL-2.0
> >>>> -obj-y += testcases.dtb.o
> >>>>
> >>>> -obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
> >>>> -                           overlay_0.dtb.o \
> >>>> -                           overlay_1.dtb.o \
> >>>> -                           overlay_2.dtb.o \
> >>>> -                           overlay_3.dtb.o \
> >>>> -                           overlay_4.dtb.o \
> >>>> -                           overlay_5.dtb.o \
> >>>> -                           overlay_6.dtb.o \
> >>>> -                           overlay_7.dtb.o \
> >>>> -                           overlay_8.dtb.o \
> >>>> -                           overlay_9.dtb.o \
> >>>> -                           overlay_10.dtb.o \
> >>>> -                           overlay_11.dtb.o \
> >>>> -                           overlay_12.dtb.o \
> >>>> -                           overlay_13.dtb.o \
> >>>> -                           overlay_15.dtb.o \
> >>>> -                           overlay_16.dtb.o \
> >>>> -                           overlay_17.dtb.o \
> >>>> -                           overlay_18.dtb.o \
> >>>> -                           overlay_19.dtb.o \
> >>>> -                           overlay_20.dtb.o \
> >>>> -                           overlay_bad_add_dup_node.dtb.o \
> >>>> -                           overlay_bad_add_dup_prop.dtb.o \
> >>>> -                           overlay_bad_phandle.dtb.o \
> >>>> -                           overlay_bad_symbol.dtb.o \
> >>>> -                           overlay_base.dtb.o \
> >>>> -                           overlay_gpio_01.dtb.o \
> >>>> -                           overlay_gpio_02a.dtb.o \
> >>>> -                           overlay_gpio_02b.dtb.o \
> >>>> -                           overlay_gpio_03.dtb.o \
> >>>> -                           overlay_gpio_04a.dtb.o \
> >>>> -                           overlay_gpio_04b.dtb.o
> >>>> +# Generate an assembly file to wrap the output of the device tree compiler
> >>>> +quiet_cmd_dt_S_dtbo= DTB     $@
> >>>> +cmd_dt_S_dtbo=\
> >>>> +{                                                      \
> >>>> +       echo '\#include <asm-generic/vmlinux.lds.h>';   \
> >>>> +       echo '.section .dtb.init.rodata,"a"';           \
> >>>> +       echo '.balign STRUCT_ALIGNMENT';                \
> >>>> +       echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \
> >>>> +       echo '__dtbo_$(subst -,_,$(*F))_begin:';        \
> >>>> +       echo '.incbin "$<" ';                           \
> >>>> +       echo '__dtbo_$(subst -,_,$(*F))_end:';          \
> >>>> +       echo '.global __dtbo_$(subst -,_,$(*F))_end';   \
> >>>> +       echo '.balign STRUCT_ALIGNMENT';                \
> >>>> +} > $@
> >>>> +
> >>>> +
> >>>> +$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
> >>>> +       $(call if_changed,dt_S_dtbo)
> >>>
> >>> Humm, this belongs in scripts/Makefile.lib.
> >>
> >> I would rather keep it isolated to just the use in unittest.
> >> We just now got rid of the final driver use of of_overlay_fdt_apply()
> >> by the grandfathered legacy user in:
> >>
> >>    841281fe52a7 drm: rcar-du: Drop LVDS device tree backward compatibility
> >>
> >> That driver was the only use of %.dtb.S for an overlay.
> > 
> > I'd actually prefer more drivers handling compatibility this way than
> > handling old and new DTs in code. That's easier to find and when
> > compatibility with old DTs is no longer needed we can just remove the
> > fixup overlay. Though I guess that one was a lot of code too, but that
> > would probably be mitigated if we had multiple users. Anyways, that's
> > a side issue.
> 
> If I remember correctly, that is a total reversal of previous discussions
> and policy decisions.

I don't think so.

> My previous position has been to not have drivers applying overlays.
> I'll have to step back and revisit the concept, trying to set aside
> my previous assumptions and conclusions.

If not drivers, who can? As I said in the other thread, I don't think a 
general mechanism will ever happen. Though a general mechanism with 
constraints (such as drivers registering target nodes which subtrees 
can be applied to) would be an implementation detail. Having constraints 
on what's allowed has been my position forever. In my mind, allowing 
overlays for specific drivers/subsystems is constrained, so maybe that's 
the confusion here.


> But before I go away and revisit, there is one thing to mention.  Now
> that you have machine parseable bindings (and many of them implemented)
> and also a method to statically validate overlays applied on top of
> specific base .dtbs (that is the purpose of the arch/arm64/dts/* files
> that I renamed in this patch, right?), allowing drivers to dynamically
> apply overlays, potentially after modifying the base devicetree (that's
> the other patch series I need to be reviewing at the moment...) reduces
> the validation coverage.

The bootloader can also do whatever modifications it wants too and 
that's not validated. However, we can run validation at build time and 
now on a running system, so at least the beginning and end states can be 
validated.

Rob
Geert Uytterhoeven July 7, 2022, 7:21 a.m. UTC | #5
Hi Frank,

On Tue, May 3, 2022 at 11:20 PM <frowand.list@gmail.com> wrote:
> From: Frank Rowand <frank.rowand@sony.com>
>
> In drivers/of/unittest-data/:
>    - Rename .dts overlay source files to use .dtso suffix.
>    - Add Makefile rule to build .dtbo.o assembly file from overlay
>      .dtso source file.
>    - Update Makefile to build .dtbo.o objects instead of .dtb.o from
>      unittest overlay source files.
>
> Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
> .dtb.o
>
> Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
> of %.dts
>
> Rename .dts overlay source files to use .dtso suffix in:
>    arch/arm64/boot/dts/freescale/
>    arch/arm64/boot/dts/xilinx/
>
> Signed-off-by: Frank Rowand <frank.rowand@sony.com>

What is the status of this work?
Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Frank Rowand July 18, 2022, 11:44 p.m. UTC | #6
On 7/7/22 02:21, Geert Uytterhoeven wrote:
> Hi Frank,
> 
> On Tue, May 3, 2022 at 11:20 PM <frowand.list@gmail.com> wrote:
>> From: Frank Rowand <frank.rowand@sony.com>
>>
>> In drivers/of/unittest-data/:
>>    - Rename .dts overlay source files to use .dtso suffix.
>>    - Add Makefile rule to build .dtbo.o assembly file from overlay
>>      .dtso source file.
>>    - Update Makefile to build .dtbo.o objects instead of .dtb.o from
>>      unittest overlay source files.
>>
>> Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
>> .dtb.o
>>
>> Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
>> of %.dts
>>
>> Rename .dts overlay source files to use .dtso suffix in:
>>    arch/arm64/boot/dts/freescale/
>>    arch/arm64/boot/dts/xilinx/
>>
>> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> 
> What is the status of this work?
> Thanks!

I'll work on this tomorrow after I test your overlay improvement patches.

-Frank

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
Geert Uytterhoeven Sept. 20, 2022, 8:58 a.m. UTC | #7
Hi Frank,

Pity you couldn't make it to Dublin. We've been missing you!

On Tue, Jul 19, 2022 at 1:44 AM Frank Rowand <frowand.list@gmail.com> wrote:
> On 7/7/22 02:21, Geert Uytterhoeven wrote:
> > On Tue, May 3, 2022 at 11:20 PM <frowand.list@gmail.com> wrote:
> >> From: Frank Rowand <frank.rowand@sony.com>
> >>
> >> In drivers/of/unittest-data/:
> >>    - Rename .dts overlay source files to use .dtso suffix.
> >>    - Add Makefile rule to build .dtbo.o assembly file from overlay
> >>      .dtso source file.
> >>    - Update Makefile to build .dtbo.o objects instead of .dtb.o from
> >>      unittest overlay source files.
> >>
> >> Modify driver/of/unitest.c to use .dtbo.o based symbols instead of
> >> .dtb.o
> >>
> >> Modify scripts/Makefile.lib %.dtbo rule to depend upon %.dtso instead
> >> of %.dts
> >>
> >> Rename .dts overlay source files to use .dtso suffix in:
> >>    arch/arm64/boot/dts/freescale/
> >>    arch/arm64/boot/dts/xilinx/
> >>
> >> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> >
> > What is the status of this work?
> > Thanks!
>
> I'll work on this tomorrow after I test your overlay improvement patches.

Any updates? We're again at rc6.
Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-13bb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-13bb.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-13bb.dts
rename to arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-13bb.dtso
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dts
rename to arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-65bb.dtso
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-7777.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-7777.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-7777.dts
rename to arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-7777.dtso
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-85bb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-85bb.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-85bb.dts
rename to arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-85bb.dtso
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-899b.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-899b.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-899b.dts
rename to arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-899b.dtso
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-9999.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-9999.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-9999.dts
rename to arch/arm64/boot/dts/freescale/fsl-ls1028a-qds-9999.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs232-rts.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs422.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rs485.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-imx219.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs232-rts.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs422.dtso
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dtso
similarity index 100%
rename from arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dts
rename to arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx-0x-rs485.dtso
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dts b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso
similarity index 100%
rename from arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dts
rename to arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dts b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso
similarity index 100%
rename from arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dts
rename to arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso
diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
index d072f3ba3971..df2ca1820273 100644
--- a/drivers/of/unittest-data/Makefile
+++ b/drivers/of/unittest-data/Makefile
@@ -1,38 +1,58 @@ 
 # SPDX-License-Identifier: GPL-2.0
-obj-y += testcases.dtb.o
 
-obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
-			    overlay_0.dtb.o \
-			    overlay_1.dtb.o \
-			    overlay_2.dtb.o \
-			    overlay_3.dtb.o \
-			    overlay_4.dtb.o \
-			    overlay_5.dtb.o \
-			    overlay_6.dtb.o \
-			    overlay_7.dtb.o \
-			    overlay_8.dtb.o \
-			    overlay_9.dtb.o \
-			    overlay_10.dtb.o \
-			    overlay_11.dtb.o \
-			    overlay_12.dtb.o \
-			    overlay_13.dtb.o \
-			    overlay_15.dtb.o \
-			    overlay_16.dtb.o \
-			    overlay_17.dtb.o \
-			    overlay_18.dtb.o \
-			    overlay_19.dtb.o \
-			    overlay_20.dtb.o \
-			    overlay_bad_add_dup_node.dtb.o \
-			    overlay_bad_add_dup_prop.dtb.o \
-			    overlay_bad_phandle.dtb.o \
-			    overlay_bad_symbol.dtb.o \
-			    overlay_base.dtb.o \
-			    overlay_gpio_01.dtb.o \
-			    overlay_gpio_02a.dtb.o \
-			    overlay_gpio_02b.dtb.o \
-			    overlay_gpio_03.dtb.o \
-			    overlay_gpio_04a.dtb.o \
-			    overlay_gpio_04b.dtb.o
+# Generate an assembly file to wrap the output of the device tree compiler
+quiet_cmd_dt_S_dtbo= DTB     $@
+cmd_dt_S_dtbo=\
+{							\
+	echo '\#include <asm-generic/vmlinux.lds.h>';	\
+	echo '.section .dtb.init.rodata,"a"';		\
+	echo '.balign STRUCT_ALIGNMENT';		\
+	echo '.global __dtbo_$(subst -,_,$(*F))_begin';	\
+	echo '__dtbo_$(subst -,_,$(*F))_begin:';	\
+	echo '.incbin "$<" ';				\
+	echo '__dtbo_$(subst -,_,$(*F))_end:';		\
+	echo '.global __dtbo_$(subst -,_,$(*F))_end';	\
+	echo '.balign STRUCT_ALIGNMENT';		\
+} > $@
+
+
+$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
+	$(call if_changed,dt_S_dtbo)
+
+obj-y += testcases.dtbo.o
+
+obj-$(CONFIG_OF_OVERLAY) += overlay.dtbo.o \
+			    overlay_0.dtbo.o \
+			    overlay_1.dtbo.o \
+			    overlay_2.dtbo.o \
+			    overlay_3.dtbo.o \
+			    overlay_4.dtbo.o \
+			    overlay_5.dtbo.o \
+			    overlay_6.dtbo.o \
+			    overlay_7.dtbo.o \
+			    overlay_8.dtbo.o \
+			    overlay_9.dtbo.o \
+			    overlay_10.dtbo.o \
+			    overlay_11.dtbo.o \
+			    overlay_12.dtbo.o \
+			    overlay_13.dtbo.o \
+			    overlay_15.dtbo.o \
+			    overlay_16.dtbo.o \
+			    overlay_17.dtbo.o \
+			    overlay_18.dtbo.o \
+			    overlay_19.dtbo.o \
+			    overlay_20.dtbo.o \
+			    overlay_bad_add_dup_node.dtbo.o \
+			    overlay_bad_add_dup_prop.dtbo.o \
+			    overlay_bad_phandle.dtbo.o \
+			    overlay_bad_symbol.dtbo.o \
+			    overlay_base.dtbo.o \
+			    overlay_gpio_01.dtbo.o \
+			    overlay_gpio_02a.dtbo.o \
+			    overlay_gpio_02b.dtbo.o \
+			    overlay_gpio_03.dtbo.o \
+			    overlay_gpio_04a.dtbo.o \
+			    overlay_gpio_04b.dtbo.o
 
 # enable creation of __symbols__ node
 DTC_FLAGS_overlay += -@
diff --git a/drivers/of/unittest-data/overlay.dts b/drivers/of/unittest-data/overlay.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay.dts
rename to drivers/of/unittest-data/overlay.dtso
diff --git a/drivers/of/unittest-data/overlay_0.dts b/drivers/of/unittest-data/overlay_0.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_0.dts
rename to drivers/of/unittest-data/overlay_0.dtso
diff --git a/drivers/of/unittest-data/overlay_1.dts b/drivers/of/unittest-data/overlay_1.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_1.dts
rename to drivers/of/unittest-data/overlay_1.dtso
diff --git a/drivers/of/unittest-data/overlay_10.dts b/drivers/of/unittest-data/overlay_10.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_10.dts
rename to drivers/of/unittest-data/overlay_10.dtso
diff --git a/drivers/of/unittest-data/overlay_11.dts b/drivers/of/unittest-data/overlay_11.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_11.dts
rename to drivers/of/unittest-data/overlay_11.dtso
diff --git a/drivers/of/unittest-data/overlay_12.dts b/drivers/of/unittest-data/overlay_12.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_12.dts
rename to drivers/of/unittest-data/overlay_12.dtso
diff --git a/drivers/of/unittest-data/overlay_13.dts b/drivers/of/unittest-data/overlay_13.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_13.dts
rename to drivers/of/unittest-data/overlay_13.dtso
diff --git a/drivers/of/unittest-data/overlay_15.dts b/drivers/of/unittest-data/overlay_15.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_15.dts
rename to drivers/of/unittest-data/overlay_15.dtso
diff --git a/drivers/of/unittest-data/overlay_16.dts b/drivers/of/unittest-data/overlay_16.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_16.dts
rename to drivers/of/unittest-data/overlay_16.dtso
diff --git a/drivers/of/unittest-data/overlay_17.dts b/drivers/of/unittest-data/overlay_17.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_17.dts
rename to drivers/of/unittest-data/overlay_17.dtso
diff --git a/drivers/of/unittest-data/overlay_18.dts b/drivers/of/unittest-data/overlay_18.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_18.dts
rename to drivers/of/unittest-data/overlay_18.dtso
diff --git a/drivers/of/unittest-data/overlay_19.dts b/drivers/of/unittest-data/overlay_19.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_19.dts
rename to drivers/of/unittest-data/overlay_19.dtso
diff --git a/drivers/of/unittest-data/overlay_2.dts b/drivers/of/unittest-data/overlay_2.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_2.dts
rename to drivers/of/unittest-data/overlay_2.dtso
diff --git a/drivers/of/unittest-data/overlay_20.dts b/drivers/of/unittest-data/overlay_20.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_20.dts
rename to drivers/of/unittest-data/overlay_20.dtso
diff --git a/drivers/of/unittest-data/overlay_3.dts b/drivers/of/unittest-data/overlay_3.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_3.dts
rename to drivers/of/unittest-data/overlay_3.dtso
diff --git a/drivers/of/unittest-data/overlay_4.dts b/drivers/of/unittest-data/overlay_4.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_4.dts
rename to drivers/of/unittest-data/overlay_4.dtso
diff --git a/drivers/of/unittest-data/overlay_5.dts b/drivers/of/unittest-data/overlay_5.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_5.dts
rename to drivers/of/unittest-data/overlay_5.dtso
diff --git a/drivers/of/unittest-data/overlay_6.dts b/drivers/of/unittest-data/overlay_6.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_6.dts
rename to drivers/of/unittest-data/overlay_6.dtso
diff --git a/drivers/of/unittest-data/overlay_7.dts b/drivers/of/unittest-data/overlay_7.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_7.dts
rename to drivers/of/unittest-data/overlay_7.dtso
diff --git a/drivers/of/unittest-data/overlay_8.dts b/drivers/of/unittest-data/overlay_8.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_8.dts
rename to drivers/of/unittest-data/overlay_8.dtso
diff --git a/drivers/of/unittest-data/overlay_9.dts b/drivers/of/unittest-data/overlay_9.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_9.dts
rename to drivers/of/unittest-data/overlay_9.dtso
diff --git a/drivers/of/unittest-data/overlay_bad_add_dup_node.dts b/drivers/of/unittest-data/overlay_bad_add_dup_node.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_bad_add_dup_node.dts
rename to drivers/of/unittest-data/overlay_bad_add_dup_node.dtso
diff --git a/drivers/of/unittest-data/overlay_bad_add_dup_prop.dts b/drivers/of/unittest-data/overlay_bad_add_dup_prop.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_bad_add_dup_prop.dts
rename to drivers/of/unittest-data/overlay_bad_add_dup_prop.dtso
diff --git a/drivers/of/unittest-data/overlay_bad_phandle.dts b/drivers/of/unittest-data/overlay_bad_phandle.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_bad_phandle.dts
rename to drivers/of/unittest-data/overlay_bad_phandle.dtso
diff --git a/drivers/of/unittest-data/overlay_bad_symbol.dts b/drivers/of/unittest-data/overlay_bad_symbol.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_bad_symbol.dts
rename to drivers/of/unittest-data/overlay_bad_symbol.dtso
diff --git a/drivers/of/unittest-data/overlay_base.dts b/drivers/of/unittest-data/overlay_base.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_base.dts
rename to drivers/of/unittest-data/overlay_base.dtso
diff --git a/drivers/of/unittest-data/overlay_gpio_01.dts b/drivers/of/unittest-data/overlay_gpio_01.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_gpio_01.dts
rename to drivers/of/unittest-data/overlay_gpio_01.dtso
diff --git a/drivers/of/unittest-data/overlay_gpio_02a.dts b/drivers/of/unittest-data/overlay_gpio_02a.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_gpio_02a.dts
rename to drivers/of/unittest-data/overlay_gpio_02a.dtso
diff --git a/drivers/of/unittest-data/overlay_gpio_02b.dts b/drivers/of/unittest-data/overlay_gpio_02b.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_gpio_02b.dts
rename to drivers/of/unittest-data/overlay_gpio_02b.dtso
diff --git a/drivers/of/unittest-data/overlay_gpio_03.dts b/drivers/of/unittest-data/overlay_gpio_03.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_gpio_03.dts
rename to drivers/of/unittest-data/overlay_gpio_03.dtso
diff --git a/drivers/of/unittest-data/overlay_gpio_04a.dts b/drivers/of/unittest-data/overlay_gpio_04a.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_gpio_04a.dts
rename to drivers/of/unittest-data/overlay_gpio_04a.dtso
diff --git a/drivers/of/unittest-data/overlay_gpio_04b.dts b/drivers/of/unittest-data/overlay_gpio_04b.dtso
similarity index 100%
rename from drivers/of/unittest-data/overlay_gpio_04b.dts
rename to drivers/of/unittest-data/overlay_gpio_04b.dtso
diff --git a/drivers/of/unittest-data/static_base_1.dts b/drivers/of/unittest-data/static_base_1.dtso
similarity index 100%
rename from drivers/of/unittest-data/static_base_1.dts
rename to drivers/of/unittest-data/static_base_1.dtso
diff --git a/drivers/of/unittest-data/static_base_2.dts b/drivers/of/unittest-data/static_base_2.dtso
similarity index 100%
rename from drivers/of/unittest-data/static_base_2.dts
rename to drivers/of/unittest-data/static_base_2.dtso
diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dtso
similarity index 100%
rename from drivers/of/unittest-data/testcases.dts
rename to drivers/of/unittest-data/testcases.dtso
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index dff55ae09d97..1d3c170d95db 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1423,12 +1423,12 @@  static int __init unittest_data_add(void)
 	void *unittest_data_align;
 	struct device_node *unittest_data_node = NULL, *np;
 	/*
-	 * __dtb_testcases_begin[] and __dtb_testcases_end[] are magically
-	 * created by cmd_dt_S_dtb in scripts/Makefile.lib
+	 * __dtbo_testcases_begin[] and __dtbo_testcases_end[] are
+	 * created by cmd_dt_S_dtbo in Makefile
 	 */
-	extern uint8_t __dtb_testcases_begin[];
-	extern uint8_t __dtb_testcases_end[];
-	const int size = __dtb_testcases_end - __dtb_testcases_begin;
+	extern uint8_t __dtbo_testcases_begin[];
+	extern uint8_t __dtbo_testcases_end[];
+	const int size = __dtbo_testcases_end - __dtbo_testcases_begin;
 	int rc;
 	void *ret;
 
@@ -1443,7 +1443,7 @@  static int __init unittest_data_add(void)
 		return -ENOMEM;
 
 	unittest_data_align = PTR_ALIGN(unittest_data, FDT_ALIGN_SIZE);
-	memcpy(unittest_data_align, __dtb_testcases_begin, size);
+	memcpy(unittest_data_align, __dtbo_testcases_begin, size);
 
 	ret = of_fdt_unflatten_tree(unittest_data_align, NULL, &unittest_data_node);
 	if (!ret) {
@@ -3009,24 +3009,24 @@  static inline void __init of_unittest_overlay(void) { }
 #ifdef CONFIG_OF_OVERLAY
 
 /*
- * __dtb_ot_begin[] and __dtb_ot_end[] are created by cmd_dt_S_dtb
- * in scripts/Makefile.lib
+ * __dtbo_##overlay_name##_begin[] and __dtbo_##overlay_name##_end[] are
+ * created by cmd_dt_S_dtbo in Makefile
  */
 
-#define OVERLAY_INFO_EXTERN(name) \
-	extern uint8_t __dtb_##name##_begin[]; \
-	extern uint8_t __dtb_##name##_end[]
+#define OVERLAY_INFO_EXTERN(overlay_name) \
+	extern uint8_t __dtbo_##overlay_name##_begin[]; \
+	extern uint8_t __dtbo_##overlay_name##_end[]
 
-#define OVERLAY_INFO(overlay_name, expected)             \
-{	.dtb_begin       = __dtb_##overlay_name##_begin, \
-	.dtb_end         = __dtb_##overlay_name##_end,   \
-	.expected_result = expected,                     \
-	.name            = #overlay_name,                \
+#define OVERLAY_INFO(overlay_name, expected)               \
+{	.dtbo_begin       = __dtbo_##overlay_name##_begin, \
+	.dtbo_end         = __dtbo_##overlay_name##_end,   \
+	.expected_result = expected,                       \
+	.name            = #overlay_name,                  \
 }
 
 struct overlay_info {
-	uint8_t		*dtb_begin;
-	uint8_t		*dtb_end;
+	uint8_t		*dtbo_begin;
+	uint8_t		*dtbo_end;
 	int		expected_result;
 	int		ovcs_id;
 	char		*name;
@@ -3100,7 +3100,7 @@  static struct overlay_info overlays[] = {
 	OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
 	OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
 	/* end marker */
-	{.dtb_begin = NULL, .dtb_end = NULL, .expected_result = 0, .name = NULL}
+	{.dtbo_begin = NULL, .dtbo_end = NULL, .expected_result = 0, .name = NULL}
 };
 
 static struct device_node *overlay_base_root;
@@ -3157,13 +3157,13 @@  void __init unittest_unflatten_overlay_base(void)
 		return;
 	}
 
-	data_size = info->dtb_end - info->dtb_begin;
+	data_size = info->dtbo_end - info->dtbo_begin;
 	if (!data_size) {
 		pr_err("No dtb 'overlay_base' to attach\n");
 		return;
 	}
 
-	size = fdt_totalsize(info->dtb_begin);
+	size = fdt_totalsize(info->dtbo_begin);
 	if (size != data_size) {
 		pr_err("dtb 'overlay_base' header totalsize != actual size");
 		return;
@@ -3175,7 +3175,7 @@  void __init unittest_unflatten_overlay_base(void)
 		return;
 	}
 
-	memcpy(new_fdt, info->dtb_begin, size);
+	memcpy(new_fdt, info->dtbo_begin, size);
 
 	__unflatten_device_tree(new_fdt, NULL, &overlay_base_root,
 				dt_alloc_memory, true);
@@ -3210,11 +3210,11 @@  static int __init overlay_data_apply(const char *overlay_name, int *ovcs_id)
 		return 0;
 	}
 
-	size = info->dtb_end - info->dtb_begin;
+	size = info->dtbo_end - info->dtbo_begin;
 	if (!size)
 		pr_err("no overlay data for %s\n", overlay_name);
 
-	ret = of_overlay_fdt_apply(info->dtb_begin, size, &info->ovcs_id);
+	ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id);
 	if (ovcs_id)
 		*ovcs_id = info->ovcs_id;
 	if (ret < 0)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 9f69ecdd7977..b409bec5fa45 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -363,7 +363,7 @@  endef
 $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
 	$(call if_changed_rule,dtc)
 
-$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
+$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
 	$(call if_changed_dep,dtc)
 
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)