linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Moving ARM dts files
@ 2018-12-04 18:36 Rob Herring
  2018-12-04 18:47 ` Alexandre Belloni
                   ` (9 more replies)
  0 siblings, 10 replies; 38+ messages in thread
From: Rob Herring @ 2018-12-04 18:36 UTC (permalink / raw)
  To: arm
  Cc: Andrew Lunn, Alexandre Belloni, Tony Lindgren, Linus Walleij,
	Liviu Dudau, Masahiro Yamada, Thierry Reding, Florian Fainelli,
	Kevin Hilman, Gregory Clement, Michal Simek, Krzysztof Kozlowski,
	Joel Stanley, Andy Gross, devicetree, Jason Cooper, Simon Horman,
	linux-arm-kernel, Maxime Coquelin, Shawn Guo,
	Andreas Färber, Daniel Mack

Olof, Arnd,

I've put together a script to move the dts files and update the 
makefiles. It doesn't handle files not following a common prefix which 
isn't many and some includes within the dts files will need some fixups 
by hand.

MAINTAINERS will also need updating.

A few questions:

Do we want to move absolutely everything to subdirs? There's quite a 
few platforms with only 1-2 platforms. I haven't added these to the 
list yet, but can.

Do any vendors need another level of directories? davinci, omap, nspire, 
etc. for TI for example.

What to do with armv7m.dtsi? I guess it should remain and we just fixup 
the include. There may be a few other cross vendor things.


Sub-arch maintainers, 
'vendor_map' below is the mapping of file prefix to new subdirectory 
(the SoC vendor prefix). Please comment if there are any issues.

Rob

8<-----------------------------------------------------------
#!/usr/bin/env python3

import os
import re
from git import Git
import glob

vendor_map = {
    'imx': 'fsl',
    'ls': 'fsl',
    'vf': 'fsl',
    'qcom': 'qcom',
    'am3' : 'ti',
    'am4' : 'ti',
    'am5' : 'ti',
    'da' : 'ti',
    'dm' : 'ti',
    'dra' : 'ti',
    'keystone' : 'ti',
    'omap' : 'ti',
    'nspire' : 'ti',
    'armada' : 'marvell',
    'berlin' : 'marvell',
    'dove' : 'marvell',
    'kirkwood' : 'marvell',
    'orion' : 'marvell',
    'pxa' : 'marvell',
    'mvebu' : 'marvell',
    'mmp2' : 'marvell',
    'arm-' : 'arm',
    'integ' : 'arm',
    've' : 'arm',
    'aspeed' : 'aspeed',
    'at91' : 'atmel',
    'sama' : 'atmel',
    'bcm' : 'brcm',
    'exynos' : 'samsung',
    's3c' : 'samsung',
    's5p' : 'samsung',
    'gemini' : 'cortina',
    'hi3' : 'hisilicon',
    'hip' : 'hisilicon',
    'hisi' : 'hisilicon',
    'mt' : 'mediatek',
    'meson' : 'amlogic',
    'owl' : 'actions',
    'r7' : 'renesas',
    'r8' : 'renesas',
    'r9' : 'renesas',
    'rk' : 'rockchip',
    'socfpga' : 'altera',
    'st' : 'st',
    'spear' : 'st',
    'sun' : 'allwinner',
    'tegra' : 'nvidia',
    'zynq' : 'xilinx',
    'wm' : 'wm',
    'uniph' : 'socionext',
    'zx' : 'zte',
}

if __name__ == "__main__":
    g = Git('.')

    g.checkout("HEAD", "arch/arm/boot/dts/Makefile")
    dts_make = open("arch/arm/boot/dts/Makefile", "r").read()

    # make entries 1 line
    make2 = re.sub(r'\\\n', '', dts_make)

    for k,v in vendor_map.items():
        for f in glob.iglob("arch/arm/boot/dts/" + k + "*.*"):
            new_dir = "arch/arm/boot/dts/" + v + "/"
            base = os.path.splitext(os.path.basename(f))[0]

            os.makedirs(new_dir, exist_ok=True)
            g.mv(f, new_dir)

            # Remove the file from the makefile
            dts_make = re.sub('.*' + base + r'\.dtb.*\\\n', '', dts_make)
            dts_make = re.sub('.*' + base + r'\.dtb', '', dts_make)

            # extract the matching makefile entry
            reg = re.search(r'.*' + base + r'.*', make2)
            if not reg:
                continue

            entry = reg.group(0)
            make2 = re.sub(r'.*' + base + r'.*', '', make2)
            if entry:
                makefile = open(new_dir + 'Makefile', 'a+')
                print(entry, file=makefile)
                makefile.close()


    for d in sorted(glob.iglob("arch/arm/boot/dts/*/")):
        dts_make += 'subdir-y += ' + d.split(os.path.sep)[-2] + '\n'

        # Add license and sort entries of sub-dir makefile
        vendor_make = '# SPDX-License-Identifier: GPL-2.0\n'
        make_lines = open(d + 'Makefile', 'r').readlines()
        for l in sorted(make_lines):
            vendor_make += l

        vendor_make = re.sub(r'\t', r'\\\n\t', vendor_make)

        f = open(d + 'Makefile', 'w')
        f.write(vendor_make)
        f.close()
        g.add(d + 'Makefile')

    # Remove entries with no dtbs left
    dts_make = re.sub(r'.*\+= \\\n\n', '', dts_make)

    open("arch/arm/boot/dts/Makefile", "w").write(dts_make)
    g.add("arch/arm/boot/dts/Makefile")

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2018-12-11 16:13 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 18:36 Moving ARM dts files Rob Herring
2018-12-04 18:47 ` Alexandre Belloni
2018-12-04 19:09   ` Rob Herring
2018-12-04 22:21 ` Simon Horman
2018-12-05  1:22 ` Andreas Färber
2018-12-05  4:17   ` Rob Herring
2018-12-05 17:33     ` Tom Rini
2018-12-06 13:32     ` Andreas Färber
2018-12-06 19:06       ` Rob Herring
2018-12-06 20:06         ` Mark Brown
2018-12-06 20:49           ` Olof Johansson
2018-12-07 14:57           ` Rob Herring
2018-12-07 15:16             ` Mark Brown
2018-12-07 15:29               ` Rob Herring
2018-12-06 20:14         ` Tom Rini
2018-12-05  4:18 ` Masahiro Yamada
2018-12-05  9:48   ` Michal Simek
2018-12-05  6:02 ` Jisheng Zhang
2018-12-05  8:19   ` Linus Walleij
2018-12-05  8:34     ` Jisheng Zhang
2018-12-05  9:04       ` Linus Walleij
2018-12-05 15:01     ` Rob Herring
2018-12-05 21:03       ` Linus Walleij
2018-12-06 13:39       ` Uwe Kleine-König
2018-12-06 13:58         ` Rob Herring
2018-12-06 14:05           ` Alexandre Belloni
2018-12-06 14:30             ` Linus Walleij
2018-12-06 16:57               ` Rob Herring
2018-12-06 22:12                 ` Linus Walleij
2018-12-07 23:35                   ` Tony Lindgren
2018-12-05  8:13 ` Nicolas.Ferre
2018-12-05 15:14 ` Neil Armstrong
2018-12-05 17:36 ` Li Yang
2018-12-07 22:33 ` Rob Herring
2018-12-08  9:25   ` Krzysztof Kozlowski
2018-12-08 22:40   ` Linus Walleij
2018-12-11 15:58   ` Olof Johansson
2018-12-08 10:07 ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).