[U-Boot] [PATCH 5/5] lib: libfdt: wrap scripts/dtc/libfdt/* where possible

Masahiro Yamada yamada.masahiro at socionext.com
Sun Oct 22 15:43:28 UTC 2017


2017-10-22 23:35 GMT+09:00 Simon Glass <sjg at chromium.org>:
> Hi Masahiro,
>
> On 17 October 2017 at 15:30, Masahiro Yamada
> <yamada.masahiro at socionext.com> wrote:
>> lib/libfdt/ and scripts/dtc/libfdt have the same copies for the
>> followings 6 files:
>>   fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c
>>   fdt_sw.c
>>
>> Make them a wrapper of scripts/dtc/libfdt/*.  This is exactly what
>> Linux does to sync libfdt.  In order to make is possible, import
>> <linux/libfdt.h> and <linux/libfdt_env.h> from Linux 4.14-rc5.
>>
>> Unfortunately, U-Boot locally modified the following 3 files:
>>   fdt_ro.c fdt_wip.c fdt_rw.c
>>
>> The fdt_region.c is U-Boot own file.
>>
>> I did not touch them in order to avoid unpredictable impact.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>> ---
>>
>>  include/libfdt_env.h        |   6 -
>>  include/linux/libfdt.h      |  17 +
>>  include/linux/libfdt_env.h  |  22 ++
>>  lib/libfdt/Makefile         |  17 +-
>>  lib/libfdt/fdt.c            | 212 +----------
>>  lib/libfdt/fdt_addresses.c  |  57 +--
>>  lib/libfdt/fdt_empty_tree.c |  39 +-
>>  lib/libfdt/fdt_overlay.c    | 863 +-------------------------------------------
>>  lib/libfdt/fdt_strerror.c   |  63 +---
>>  lib/libfdt/fdt_sw.c         | 256 +------------
>>  10 files changed, 63 insertions(+), 1489 deletions(-)
>>  create mode 100644 include/linux/libfdt.h
>>  create mode 100644 include/linux/libfdt_env.h
>>
>
> I am not hugely keen on this. At present I can compare upstream with
> U-Boot directly. Why do I need to worry about scripts/? Why are the
> files even duplicated in there?


There are two copies.  Is it ok to keep both?


As I explained in the following patch
http://patchwork.ozlabs.org/patch/826742/
scripts/dtc reflects the directory structure of the upstream DTC.

So, I believe syncing scripts/lib/libfdt is consistent
and requires least effort to import outcomes from upstream DTC/kernel.

I am opposed to edit file locally.
This is make the sync work difficult.
We can split U-Boot specific functions out to lib/libfdt/fdt-local.c
(the file name is not important, it could be anything)


-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list