From mboxrd@z Thu Jan 1 00:00:00 1970 From: klaus.goger at theobroma-systems.com Date: Fri, 1 Jun 2018 04:45:53 +0200 Subject: [U-Boot] [PATCH] sunxi: use CONFIG_DEFAULT_FDT_FILE everywhere In-Reply-To: <20180601005916.16277-1-mkelly@xevo.com> References: <20180601005916.16277-1-mkelly@xevo.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > On 01.06.2018, at 02:59, Martin Kelly wrote: > > Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes > the kernel fdtfile and the u-boot devicetree names are the same. > Although this is typically the case, sometimes you might want to > customize one of these differently, so it's useful to allow them to be > different. > > Fix this to use only CONFIG_DEFAULT_FDT_FILE as other boards do, and set > CONFIG_DEFAULT_FDT_FILE in board files to be the same as the current > fdtfile= setting. > > Signed-off-by: Martin Kelly > --- > This patch is against u-boot master and thus conflicts with u-boot sunxi patch > 31510b41f6b736fd03e2779a2585f85df39e667f ("sunxi: allow CONFIG_DEFAULT_FDT_FILE > override"). If you would like me to apply this against the sunxi tree instead, I > would be happy to do so and resend it. > > Obviously, I cannot test a change like this on every board. Here's the tests I > did: > > - Booted on the nanopi neo plus2 (the board I do have). > - Compile-tested every affected config. > - To avoid missing anything I generated the config changes with the following > Python script. This script mimics what the preprocessor was doing, but encodes > it explicitly in the config. Reviewing the script is probably easier than > reviewing each individual file: > > #!/usr/bin/python3 > > import os > > root = '/home/martin/u-boot/configs' > for name in os.listdir(root): > path = os.path.join(root, name) > with open(path, 'r') as f: > contents = f.read() > if 'CONFIG_ARCH_SUNXI=y' not in contents: > continue > if 'CONFIG_DEFAULT_FDT_FILE=' in contents: > # Make the script idempotent. > continue > > if 'CONFIG_MACH_SUN50I=y' in contents or 'CONFIG_MACH_SUN50I_H5=y' in contents: > arm64 = True > else: > arm64 = False > > lines = [] > for line in contents.split('\n'): > if line.startswith('CONFIG_DEFAULT_DEVICE_TREE='): > split = line.split('=') > assert(len(split) == 2) > dtb = split[1] > > if dtb[0] == '"' and dtb[-1] == '"': > # Dequotify. > dtb = dtb[1:-1] > > dtb = '%s.dtb' % dtb > if arm64: > dtb = 'allwinner/%s' % dtb > > lines.append('CONFIG_DEFAULT_FDT_FILE="%s"' % dtb) > lines.append(line) > > with open(path, 'w') as f: > f.write('\n'.join(lines)) > > [end script] Looks fine to me. My only note would be that your script adds CONFIG_DEFAULT_FDT_FILE at a different line as when generated by savedefconfig.