[U-Boot] [PATCH 1/8] fdtgrep: Improve error handling with invalid device tree

This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com ---
tools/fdtgrep.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c index 67aa41a..8d3fef4 100644 --- a/tools/fdtgrep.c +++ b/tools/fdtgrep.c @@ -660,6 +660,8 @@ static int fdtgrep_find_regions(const void *fdt, if (!ret) count++; } + if (ret && ret != -FDT_ERR_NOTFOUND) + return ret;
/* Find all the aliases and add those regions back in */ if (disp->add_aliases && count < max_regions) { @@ -667,7 +669,11 @@ static int fdtgrep_find_regions(const void *fdt,
new_count = fdt_add_alias_regions(fdt, region, count, max_regions, &state); - if (new_count <= max_regions) { + if (new_count == -FDT_ERR_NOTFOUND) { + /* No alias node found */ + } else if (new_count < 0) { + return new_count; + } else if (new_count <= max_regions) { /* * The alias regions will now be at the end of the list. * Sort the regions by offset to get things into the @@ -679,9 +685,6 @@ static int fdtgrep_find_regions(const void *fdt, } }
- if (ret != -FDT_ERR_NOTFOUND) - return ret; - return count; }
@@ -807,6 +810,9 @@ static int do_fdtgrep(struct display_info *disp, const char *filename) disp->flags); if (count < 0) { report_error("fdt_find_regions", count); + if (count == -FDT_ERR_BADLAYOUT) + fprintf(stderr, + "/aliases node must come before all other nodes\n"); return -1; } if (count <= max_regions)

Fix this nit to keep the code consistent.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/patman/patchstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 6d3c41f..27d031e 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -376,7 +376,7 @@ def GetMetaDataForList(commit_range, git_dir=None, count=None, if not series: series = Series() series.allow_overwrite = allow_overwrite - params = gitutil.LogCmd(commit_range,reverse=True, count=count, + params = gitutil.LogCmd(commit_range, reverse=True, count=count, git_dir=git_dir) stdout = command.RunPipe([params], capture=True).stdout ps = PatchStream(series, is_log=True)

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
Fix this nit to keep the code consistent.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

On 7 March 2016 at 09:43, Joe Hershberger joe.hershberger@gmail.com wrote:
On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
Fix this nit to keep the code consistent.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot-dm/next

It is convenient to install symlinks to buildman and patman in the search patch, such as /usr/local/bin. But when this is done, the -H option fails to work because it looks in the directory containing the symlink instead of its target. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/buildman/control.py | 3 ++- tools/patman/patman.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 8b3cd30..c2c54bf 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -101,7 +101,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, pager = os.getenv('PAGER') if not pager: pager = 'more' - fname = os.path.join(os.path.dirname(sys.argv[0]), 'README') + fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), + 'README') command.Run(pager, fname) return 0
diff --git a/tools/patman/patman.py b/tools/patman/patman.py index d05c5ff..fe50eb4 100755 --- a/tools/patman/patman.py +++ b/tools/patman/patman.py @@ -117,7 +117,8 @@ elif options.full_help: pager = os.getenv('PAGER') if not pager: pager = 'more' - fname = os.path.join(os.path.dirname(sys.argv[0]), 'README') + fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), + 'README') command.Run(pager, fname)
# Process commits, produce patches files, check them, email them

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
It is convenient to install symlinks to buildman and patman in the search patch, such as /usr/local/bin. But when this is done, the -H option fails to work because it looks in the directory containing the symlink instead of its target. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

On 7 March 2016 at 09:44, Joe Hershberger joe.hershberger@gmail.com wrote:
On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
It is convenient to install symlinks to buildman and patman in the search patch, such as /usr/local/bin. But when this is done, the -H option fails to work because it looks in the directory containing the symlink instead of its target. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot-dm/next

Normally we use a single quote for strings unless there is a reason not to (such as an embedded single quote). Fix a few counter-examples in this file. Also add a missing function-argument comment.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/buildman/toolchain.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index e33e105..5e77fed 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -57,6 +57,7 @@ class Toolchain: Args: fname: Filename of the gcc component test: True to run the toolchain to test it + verbose: True to print out the information """ self.gcc = fname self.path = os.path.dirname(fname) @@ -155,8 +156,8 @@ class Toolchains: """ toolchains = bsettings.GetItems('toolchain') if not toolchains: - print ("Warning: No tool chains - please add a [toolchain] section" - " to your buildman config file %s. See README for details" % + print ('Warning: No tool chains - please add a [toolchain] section' + ' to your buildman config file %s. See README for details' % bsettings.config_fname)
paths = [] @@ -367,14 +368,14 @@ class Toolchains: Full path to the downloaded archive file in that directory, or None if there was an error while downloading """ - print "Downloading: %s" % url + print 'Downloading: %s' % url leaf = url.split('/')[-1] tmpdir = tempfile.mkdtemp('.buildman') response = urllib2.urlopen(url) fname = os.path.join(tmpdir, leaf) fd = open(fname, 'wb') meta = response.info() - size = int(meta.getheaders("Content-Length")[0]) + size = int(meta.getheaders('Content-Length')[0]) done = 0 block_size = 1 << 16 status = '' @@ -388,7 +389,7 @@ class Toolchains:
done += len(buffer) fd.write(buffer) - status = r"%10d MiB [%3d%%]" % (done / 1024 / 1024, + status = r'%10d MiB [%3d%%]' % (done / 1024 / 1024, done * 100 / size) status = status + chr(8) * (len(status) + 1) print status,

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
Normally we use a single quote for strings unless there is a reason not to (such as an embedded single quote). Fix a few counter-examples in this file. Also add a missing function-argument comment.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

On 7 March 2016 at 09:45, Joe Hershberger joe.hershberger@gmail.com wrote:
On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
Normally we use a single quote for strings unless there is a reason not to (such as an embedded single quote). Fix a few counter-examples in this file. Also add a missing function-argument comment.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot-dm/next

At present if you try to use buildman with the branch 'test' it will complain that it is unsure whether you mean the branch or the directory. This is a feature of the 'git log' command that buildman uses. Fix it by resolving the ambiguity.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/patman/gitutil.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 5f1b4f6..e088bae 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -44,6 +44,11 @@ def LogCmd(commit_range, git_dir=None, oneline=False, reverse=False, cmd.append('-n%d' % count) if commit_range: cmd.append(commit_range) + + # Add this in case we have a branch with the same name as a directory. + # This avoids messages like this, for example: + # fatal: ambiguous argument 'test': both revision and filename + cmd.append('--') return cmd
def CountCommitsToBranch():

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
At present if you try to use buildman with the branch 'test' it will complain that it is unsure whether you mean the branch or the directory. This is a feature of the 'git log' command that buildman uses. Fix it by resolving the ambiguity.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

At present the priority of a toolchain is calculated from its filename based on hard-coded rules. Allow it to be specified by the caller. We will use this in a later patch. Also display the priority and provide a message when it is overriden by another toolchain of higher priority.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/buildman/toolchain.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 5e77fed..1874d73 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -14,6 +14,8 @@ import urllib2 import bsettings import command
+PRIORITY_CALC = 0 + # Simple class to collect links from a page class MyHTMLParser(HTMLParser): def __init__(self, arch): @@ -50,14 +52,17 @@ class Toolchain: cross: Cross compile string, e.g. 'arm-linux-' arch: Architecture of toolchain as determined from the first component of the filename. E.g. arm-linux-gcc becomes arm + priority: Toolchain priority (0=highest, 20=lowest) """ - def __init__(self, fname, test, verbose=False): + def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC): """Create a new toolchain object.
Args: fname: Filename of the gcc component test: True to run the toolchain to test it verbose: True to print out the information + priority: Priority to use for this toolchain, or PRIORITY_CALC to + calculate it """ self.gcc = fname self.path = os.path.dirname(fname) @@ -76,6 +81,10 @@ class Toolchain:
# As a basic sanity check, run the C compiler with --version cmd = [fname, '--version'] + if priority == PRIORITY_CALC: + self.priority = self.GetPriority(fname) + else: + self.priority = priority if test: result = command.RunPipe([cmd], capture=True, env=env, raise_on_error=False) @@ -83,7 +92,7 @@ class Toolchain: if verbose: print 'Tool chain test: ', if self.ok: - print 'OK' + print 'OK, priority %d' % self.priority else: print 'BAD' print 'Command: ', cmd @@ -91,7 +100,6 @@ class Toolchain: print result.stderr else: self.ok = True - self.priority = self.GetPriority(fname)
def GetPriority(self, fname): """Return the priority of the toolchain. @@ -102,15 +110,15 @@ class Toolchain: Args: fname: Filename of toolchain Returns: - Priority of toolchain, 0=highest, 20=lowest. + Priority of toolchain, PRIORITY_CALC=highest, 20=lowest. """ priority_list = ['-elf', '-unknown-linux-gnu', '-linux', '-none-linux-gnueabi', '-uclinux', '-none-eabi', '-gentoo-linux-gnu', '-linux-gnueabi', '-le-linux', '-uclinux'] for prio in range(len(priority_list)): if priority_list[prio] in fname: - return prio - return prio + return PRIORITY_CALC + prio + return PRIORITY_CALC + prio
def MakeEnvironment(self, full_path): """Returns an environment for using the toolchain. @@ -171,7 +179,7 @@ class Toolchains: def GetSettings(self): self.paths += self.GetPathList()
- def Add(self, fname, test=True, verbose=False): + def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC): """Add a toolchain to our list
We select the given toolchain as our preferred one for its @@ -180,14 +188,20 @@ class Toolchains: Args: fname: Filename of toolchain's gcc driver test: True to run the toolchain to test it + priority: Priority to use for this toolchain """ - toolchain = Toolchain(fname, test, verbose) + toolchain = Toolchain(fname, test, verbose, priority) add_it = toolchain.ok if toolchain.arch in self.toolchains: add_it = (toolchain.priority < self.toolchains[toolchain.arch].priority) if add_it: self.toolchains[toolchain.arch] = toolchain + elif verbose: + print ("Toolchain '%s' at priority %d will be ignored because " + "another toolchain for arch '%s' has priority %d" % + (toolchain.gcc, toolchain.priority, toolchain.arch, + self.toolchains[toolchain.arch].priority))
def ScanPath(self, path, verbose): """Scan a path for a valid toolchain

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
At present the priority of a toolchain is calculated from its filename based on hard-coded rules. Allow it to be specified by the caller. We will use this in a later patch. Also display the priority and provide a message when it is overriden by another toolchain of higher priority.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

On 7 March 2016 at 09:50, Joe Hershberger joe.hershberger@gmail.com wrote:
On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
At present the priority of a toolchain is calculated from its filename based on hard-coded rules. Allow it to be specified by the caller. We will use this in a later patch. Also display the priority and provide a message when it is overriden by another toolchain of higher priority.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger joe.hershberger@ni.com
Applied to u-boot-dm/next

At present the architecture is deduced from the toolchain filename. Allow it to be specified by the caller.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/buildman/toolchain.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 1874d73..7bcc0af 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -54,7 +54,8 @@ class Toolchain: component of the filename. E.g. arm-linux-gcc becomes arm priority: Toolchain priority (0=highest, 20=lowest) """ - def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC): + def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC, + arch=None): """Create a new toolchain object.
Args: @@ -75,7 +76,10 @@ class Toolchain:
# The architecture is the first part of the name pos = self.cross.find('-') - self.arch = self.cross[:pos] if pos != -1 else 'sandbox' + if arch: + self.arch = arch + else: + self.arch = self.cross[:pos] if pos != -1 else 'sandbox'
env = self.MakeEnvironment(False)
@@ -92,7 +96,8 @@ class Toolchain: if verbose: print 'Tool chain test: ', if self.ok: - print 'OK, priority %d' % self.priority + print "OK, arch='%s', priority %d" % (self.arch, + self.priority) else: print 'BAD' print 'Command: ', cmd @@ -179,7 +184,8 @@ class Toolchains: def GetSettings(self): self.paths += self.GetPathList()
- def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC): + def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, + arch=None): """Add a toolchain to our list
We select the given toolchain as our preferred one for its @@ -189,8 +195,9 @@ class Toolchains: fname: Filename of toolchain's gcc driver test: True to run the toolchain to test it priority: Priority to use for this toolchain + arch: Toolchain architecture, or None if not known """ - toolchain = Toolchain(fname, test, verbose, priority) + toolchain = Toolchain(fname, test, verbose, priority, arch) add_it = toolchain.ok if toolchain.arch in self.toolchains: add_it = (toolchain.priority <

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
At present the architecture is deduced from the toolchain filename. Allow it to be specified by the caller.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com

On 7 March 2016 at 09:58, Joe Hershberger joe.hershberger@gmail.com wrote:
On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
At present the architecture is deduced from the toolchain filename. Allow it to be specified by the caller.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com
Applied to u-boot-dm/next

At present buildman allows you to specify the directory containing the toolchain, but not the actual toolchain prefix. If there are multiple toolchains in a single directory, this can be inconvenient.
Add a new 'toolchain-prefix' setting to the settings file, which allows the full prefix (or path to the C compiler) to be specified.
Update the documentation to match.
Suggested-by: Stephen Warren swarren@wwwdotorg.org Reported-by: Joe Hershberger joe.hershberger@ni.com Signed-off-by: Simon Glass sjg@chromium.org ---
tools/buildman/README | 287 +++++++++++++++++++++++++++----------------- tools/buildman/toolchain.py | 17 ++- 2 files changed, 194 insertions(+), 110 deletions(-)
diff --git a/tools/buildman/README b/tools/buildman/README index 6f41008..19ec3f5 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -169,6 +169,19 @@ Make sure the tags (here root: rest: and eldk:) are unique. The toolchain-alias section indicates that the i386 toolchain should be used to build x86 commits.
+Note that you can also specific exactly toolchain prefixes if you like: + +[toolchain-prefix] +arm: /opt/arm-eabi-4.6/bin/arm-eabi- + +or even: + +[toolchain-prefix] +arm: /opt/arm-eabi-4.6/bin/arm-eabi-gcc + +This tells buildman that you want to use this exact toolchain for the arm +architecture. This will override any toolchains found by searching using the +[toolchain] settings.
3. Make sure you have the require Python pre-requisites
@@ -185,124 +198,180 @@ Run this check to make sure that you have a toolchain for every architecture.
$ ./tools/buildman/buildman --list-tool-chains Scanning for tool chains + - scanning prefix '/opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-' +Tool chain test: OK, arch='x86', priority 1 + - scanning prefix '/opt/arm-eabi-4.6/bin/arm-eabi-' +Tool chain test: OK, arch='arm', priority 1 + - scanning path '/toolchains/gcc-4.9.0-nolibc/i386-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/i386-linux/bin/i386-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/i386-linux/usr/bin' +Tool chain test: OK, arch='i386', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/aarch64-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/aarch64-linux/usr/bin' +Tool chain test: OK, arch='aarch64', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/microblaze-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin/microblaze-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/microblaze-linux/usr/bin' +Tool chain test: OK, arch='microblaze', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/mips64-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/mips64-linux/bin/mips64-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/mips64-linux/usr/bin' +Tool chain test: OK, arch='mips64', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/sparc64-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/sparc64-linux/usr/bin' +Tool chain test: OK, arch='sparc64', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi' + - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin' + - found '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/usr/bin' +Tool chain test: OK, arch='arm', priority 3 +Toolchain '/toolchains/gcc-4.9.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc' at priority 3 will be ignored because another toolchain for arch 'arm' has priority 1 + - scanning path '/toolchains/gcc-4.9.0-nolibc/sparc-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/sparc-linux/bin/sparc-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/sparc-linux/usr/bin' +Tool chain test: OK, arch='sparc', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/mips-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/mips-linux/bin/mips-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/mips-linux/usr/bin' +Tool chain test: OK, arch='mips', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/x86_64-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc' + - found '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-x86_64-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/usr/bin' +Tool chain test: OK, arch='x86_64', priority 4 +Tool chain test: OK, arch='x86_64', priority 4 +Toolchain '/toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-x86_64-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'x86_64' has priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/m68k-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/m68k-linux/bin/m68k-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/m68k-linux/usr/bin' +Tool chain test: OK, arch='m68k', priority 4 + - scanning path '/toolchains/gcc-4.9.0-nolibc/powerpc-linux' + - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/.' + - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin' + - found '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc' + - looking in '/toolchains/gcc-4.9.0-nolibc/powerpc-linux/usr/bin' +Tool chain test: OK, arch='powerpc', priority 4 + - scanning path '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux' + - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/.' + - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin' + - found '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin/bfin-uclinux-gcc' + - looking in '/toolchains/gcc-4.6.3-nolibc/bfin-uclinux/usr/bin' +Tool chain test: OK, arch='bfin', priority 6 + - scanning path '/toolchains/gcc-4.6.3-nolibc/sparc-linux' + - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/.' + - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin' + - found '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin/sparc-linux-gcc' + - looking in '/toolchains/gcc-4.6.3-nolibc/sparc-linux/usr/bin' +Tool chain test: OK, arch='sparc', priority 4 +Toolchain '/toolchains/gcc-4.6.3-nolibc/sparc-linux/bin/sparc-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'sparc' has priority 4 + - scanning path '/toolchains/gcc-4.6.3-nolibc/mips-linux' + - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/.' + - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin' + - found '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc' + - looking in '/toolchains/gcc-4.6.3-nolibc/mips-linux/usr/bin' +Tool chain test: OK, arch='mips', priority 4 +Toolchain '/toolchains/gcc-4.6.3-nolibc/mips-linux/bin/mips-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'mips' has priority 4 + - scanning path '/toolchains/gcc-4.6.3-nolibc/m68k-linux' + - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/.' + - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin' + - found '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc' + - looking in '/toolchains/gcc-4.6.3-nolibc/m68k-linux/usr/bin' +Tool chain test: OK, arch='m68k', priority 4 +Toolchain '/toolchains/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc' at priority 4 will be ignored because another toolchain for arch 'm68k' has priority 4 + - scanning path '/toolchains/gcc-4.6.3-nolibc/powerpc-linux' + - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/.' + - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/bin' + - found '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc' + - looking in '/toolchains/gcc-4.6.3-nolibc/powerpc-linux/usr/bin' +Tool chain test: OK, arch='powerpc', priority 4 +Tool chain test: OK, arch='or32', priority 4 + - scanning path '/toolchains/gcc-4.2.4-nolibc/avr32-linux' + - looking in '/toolchains/gcc-4.2.4-nolibc/avr32-linux/.' + - looking in '/toolchains/gcc-4.2.4-nolibc/avr32-linux/bin' + - found '/toolchains/gcc-4.2.4-nolibc/avr32-linux/bin/avr32-linux-gcc' + - looking in '/toolchains/gcc-4.2.4-nolibc/avr32-linux/usr/bin' +Tool chain test: OK, arch='avr32', priority 4 - scanning path '/' - looking in '/.' - looking in '/bin' - looking in '/usr/bin' - - found '/usr/bin/gcc' -Tool chain test: OK + - found '/usr/bin/i586-mingw32msvc-gcc' - found '/usr/bin/c89-gcc' -Tool chain test: OK - - found '/usr/bin/c99-gcc' -Tool chain test: OK - found '/usr/bin/x86_64-linux-gnu-gcc' -Tool chain test: OK - - scanning path '/toolchains/powerpc-linux' - - looking in '/toolchains/powerpc-linux/.' - - looking in '/toolchains/powerpc-linux/bin' - - found '/toolchains/powerpc-linux/bin/powerpc-linux-gcc' -Tool chain test: OK - - looking in '/toolchains/powerpc-linux/usr/bin' - - scanning path '/toolchains/nds32le-linux-glibc-v1f' - - looking in '/toolchains/nds32le-linux-glibc-v1f/.' - - looking in '/toolchains/nds32le-linux-glibc-v1f/bin' - - found '/toolchains/nds32le-linux-glibc-v1f/bin/nds32le-linux-gcc' -Tool chain test: OK - - looking in '/toolchains/nds32le-linux-glibc-v1f/usr/bin' - - scanning path '/toolchains/nios2' - - looking in '/toolchains/nios2/.' - - looking in '/toolchains/nios2/bin' - - found '/toolchains/nios2/bin/nios2-linux-gcc' -Tool chain test: OK - - found '/toolchains/nios2/bin/nios2-linux-uclibc-gcc' -Tool chain test: OK - - looking in '/toolchains/nios2/usr/bin' - - found '/toolchains/nios2/usr/bin/nios2-linux-gcc' -Tool chain test: OK - - found '/toolchains/nios2/usr/bin/nios2-linux-uclibc-gcc' -Tool chain test: OK - - scanning path '/toolchains/microblaze-unknown-linux-gnu' - - looking in '/toolchains/microblaze-unknown-linux-gnu/.' - - looking in '/toolchains/microblaze-unknown-linux-gnu/bin' - - found '/toolchains/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-gcc' -Tool chain test: OK - - found '/toolchains/microblaze-unknown-linux-gnu/bin/mb-linux-gcc' -Tool chain test: OK - - looking in '/toolchains/microblaze-unknown-linux-gnu/usr/bin' - - scanning path '/toolchains/mips-linux' - - looking in '/toolchains/mips-linux/.' - - looking in '/toolchains/mips-linux/bin' - - found '/toolchains/mips-linux/bin/mips-linux-gcc' -Tool chain test: OK - - looking in '/toolchains/mips-linux/usr/bin' - - scanning path '/toolchains/old' - - looking in '/toolchains/old/.' - - looking in '/toolchains/old/bin' - - looking in '/toolchains/old/usr/bin' - - scanning path '/toolchains/i386-linux' - - looking in '/toolchains/i386-linux/.' - - looking in '/toolchains/i386-linux/bin' - - found '/toolchains/i386-linux/bin/i386-linux-gcc' -Tool chain test: OK - - looking in '/toolchains/i386-linux/usr/bin' - - scanning path '/toolchains/bfin-uclinux' - - looking in '/toolchains/bfin-uclinux/.' - - looking in '/toolchains/bfin-uclinux/bin' - - found '/toolchains/bfin-uclinux/bin/bfin-uclinux-gcc' -Tool chain test: OK - - looking in '/toolchains/bfin-uclinux/usr/bin' - - scanning path '/toolchains/sparc-elf' - - looking in '/toolchains/sparc-elf/.' - - looking in '/toolchains/sparc-elf/bin' - - found '/toolchains/sparc-elf/bin/sparc-elf-gcc' -Tool chain test: OK - - looking in '/toolchains/sparc-elf/usr/bin' - - scanning path '/toolchains/arm-2010q1' - - looking in '/toolchains/arm-2010q1/.' - - looking in '/toolchains/arm-2010q1/bin' - - found '/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc' -Tool chain test: OK - - looking in '/toolchains/arm-2010q1/usr/bin' - - scanning path '/toolchains/from' - - looking in '/toolchains/from/.' - - looking in '/toolchains/from/bin' - - looking in '/toolchains/from/usr/bin' - - scanning path '/toolchains/sh4-gentoo-linux-gnu' - - looking in '/toolchains/sh4-gentoo-linux-gnu/.' - - looking in '/toolchains/sh4-gentoo-linux-gnu/bin' - - found '/toolchains/sh4-gentoo-linux-gnu/bin/sh4-gentoo-linux-gnu-gcc' -Tool chain test: OK - - looking in '/toolchains/sh4-gentoo-linux-gnu/usr/bin' - - scanning path '/toolchains/avr32-linux' - - looking in '/toolchains/avr32-linux/.' - - looking in '/toolchains/avr32-linux/bin' - - found '/toolchains/avr32-linux/bin/avr32-gcc' -Tool chain test: OK - - looking in '/toolchains/avr32-linux/usr/bin' - - scanning path '/toolchains/m68k-linux' - - looking in '/toolchains/m68k-linux/.' - - looking in '/toolchains/m68k-linux/bin' - - found '/toolchains/m68k-linux/bin/m68k-linux-gcc' -Tool chain test: OK - - looking in '/toolchains/m68k-linux/usr/bin' -List of available toolchains (17): -arm : /toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -avr32 : /toolchains/avr32-linux/bin/avr32-gcc -bfin : /toolchains/bfin-uclinux/bin/bfin-uclinux-gcc + - found '/usr/bin/gcc' + - found '/usr/bin/c99-gcc' + - found '/usr/bin/arm-linux-gnueabi-gcc' + - found '/usr/bin/aarch64-linux-gnu-gcc' + - found '/usr/bin/winegcc' + - found '/usr/bin/arm-linux-gnueabihf-gcc' +Tool chain test: OK, arch='i586', priority 11 +Tool chain test: OK, arch='c89', priority 11 +Tool chain test: OK, arch='x86_64', priority 4 +Toolchain '/usr/bin/x86_64-linux-gnu-gcc' at priority 4 will be ignored because another toolchain for arch 'x86_64' has priority 4 +Tool chain test: OK, arch='sandbox', priority 11 +Tool chain test: OK, arch='c99', priority 11 +Tool chain test: OK, arch='arm', priority 4 +Toolchain '/usr/bin/arm-linux-gnueabi-gcc' at priority 4 will be ignored because another toolchain for arch 'arm' has priority 1 +Tool chain test: OK, arch='aarch64', priority 4 +Toolchain '/usr/bin/aarch64-linux-gnu-gcc' at priority 4 will be ignored because another toolchain for arch 'aarch64' has priority 4 +Tool chain test: OK, arch='sandbox', priority 11 +Toolchain '/usr/bin/winegcc' at priority 11 will be ignored because another toolchain for arch 'sandbox' has priority 11 +Tool chain test: OK, arch='arm', priority 4 +Toolchain '/usr/bin/arm-linux-gnueabihf-gcc' at priority 4 will be ignored because another toolchain for arch 'arm' has priority 1 +List of available toolchains (34): +aarch64 : /toolchains/gcc-4.9.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc +alpha : /toolchains/gcc-4.9.0-nolibc/alpha-linux/bin/alpha-linux-gcc +am33_2.0 : /toolchains/gcc-4.9.0-nolibc/am33_2.0-linux/bin/am33_2.0-linux-gcc +arm : /opt/arm-eabi-4.6/bin/arm-eabi-gcc +avr32 : /toolchains/gcc-4.2.4-nolibc/avr32-linux/bin/avr32-linux-gcc +bfin : /toolchains/gcc-4.6.3-nolibc/bfin-uclinux/bin/bfin-uclinux-gcc c89 : /usr/bin/c89-gcc c99 : /usr/bin/c99-gcc -i386 : /toolchains/i386-linux/bin/i386-linux-gcc -m68k : /toolchains/m68k-linux/bin/m68k-linux-gcc -mb : /toolchains/microblaze-unknown-linux-gnu/bin/mb-linux-gcc -microblaze: /toolchains/microblaze-unknown-linux-gnu/bin/microblaze-unknown-linux-gnu-gcc -mips : /toolchains/mips-linux/bin/mips-linux-gcc -nds32le : /toolchains/nds32le-linux-glibc-v1f/bin/nds32le-linux-gcc -nios2 : /toolchains/nios2/bin/nios2-linux-gcc -powerpc : /toolchains/powerpc-linux/bin/powerpc-linux-gcc +frv : /toolchains/gcc-4.9.0-nolibc/frv-linux/bin/frv-linux-gcc +h8300 : /toolchains/gcc-4.9.0-nolibc/h8300-elf/bin/h8300-elf-gcc +hppa : /toolchains/gcc-4.9.0-nolibc/hppa-linux/bin/hppa-linux-gcc +hppa64 : /toolchains/gcc-4.9.0-nolibc/hppa64-linux/bin/hppa64-linux-gcc +i386 : /toolchains/gcc-4.9.0-nolibc/i386-linux/bin/i386-linux-gcc +i586 : /usr/bin/i586-mingw32msvc-gcc +ia64 : /toolchains/gcc-4.9.0-nolibc/ia64-linux/bin/ia64-linux-gcc +m32r : /toolchains/gcc-4.9.0-nolibc/m32r-linux/bin/m32r-linux-gcc +m68k : /toolchains/gcc-4.9.0-nolibc/m68k-linux/bin/m68k-linux-gcc +microblaze: /toolchains/gcc-4.9.0-nolibc/microblaze-linux/bin/microblaze-linux-gcc +mips : /toolchains/gcc-4.9.0-nolibc/mips-linux/bin/mips-linux-gcc +mips64 : /toolchains/gcc-4.9.0-nolibc/mips64-linux/bin/mips64-linux-gcc +or32 : /toolchains/gcc-4.5.1-nolibc/or32-linux/bin/or32-linux-gcc +powerpc : /toolchains/gcc-4.9.0-nolibc/powerpc-linux/bin/powerpc-linux-gcc +powerpc64 : /toolchains/gcc-4.9.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc +ppc64le : /toolchains/gcc-4.9.0-nolibc/ppc64le-linux/bin/ppc64le-linux-gcc +s390x : /toolchains/gcc-4.9.0-nolibc/s390x-linux/bin/s390x-linux-gcc sandbox : /usr/bin/gcc -sh4 : /toolchains/sh4-gentoo-linux-gnu/bin/sh4-gentoo-linux-gnu-gcc -sparc : /toolchains/sparc-elf/bin/sparc-elf-gcc -x86_64 : /usr/bin/x86_64-linux-gnu-gcc +sh4 : /toolchains/gcc-4.6.3-nolibc/sh4-linux/bin/sh4-linux-gcc +sparc : /toolchains/gcc-4.9.0-nolibc/sparc-linux/bin/sparc-linux-gcc +sparc64 : /toolchains/gcc-4.9.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc +tilegx : /toolchains/gcc-4.6.2-nolibc/tilegx-linux/bin/tilegx-linux-gcc +x86 : /opt/gcc-4.6.3-nolibc/x86_64-linux/bin/x86_64-linux-gcc +x86_64 : /toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc
You can see that everything is covered, even some strange ones that won't diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 7bcc0af..d81ff14 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -14,7 +14,7 @@ import urllib2 import bsettings import command
-PRIORITY_CALC = 0 +PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_CALC = range(3)
# Simple class to collect links from a page class MyHTMLParser(HTMLParser): @@ -152,11 +152,17 @@ class Toolchains:
Public members: toolchains: Dict of Toolchain objects, keyed by architecture name + prefixes: Dict of prefixes to check, keyed by architecture. This can + be a full path and toolchain prefix, for example + {'x86', 'opt/i386-linux/bin/i386-linux-'}, or the name of + something on the search path, for example + {'arm', 'arm-linux-gnueabihf-'}. Wildcards are not supported. paths: List of paths to check for toolchains (may contain wildcards) """
def __init__(self): self.toolchains = {} + self.prefixes = {} self.paths = [] self._make_flags = dict(bsettings.GetItems('make-flags'))
@@ -182,6 +188,7 @@ class Toolchains: return paths
def GetSettings(self): + self.prefixes = bsettings.GetItems('toolchain-prefix') self.paths += self.GetPathList()
def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, @@ -240,6 +247,14 @@ class Toolchains: verbose: True to print out progress information """ if verbose: print 'Scanning for tool chains' + for name, value in self.prefixes: + if verbose: print " - scanning prefix '%s'" % value + if os.path.exists(value): + self.Add(value, True, verbose, PRIORITY_FULL_PREFIX, name) + else: + fname = value + 'gcc' + if os.path.exists(fname): + self.Add(fname, True, verbose, PRIORITY_PREFIX_GCC, name) for path in self.paths: if verbose: print " - scanning path '%s'" % path fnames = self.ScanPath(path, verbose)

On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
At present buildman allows you to specify the directory containing the toolchain, but not the actual toolchain prefix. If there are multiple toolchains in a single directory, this can be inconvenient.
Add a new 'toolchain-prefix' setting to the settings file, which allows the full prefix (or path to the C compiler) to be specified.
Update the documentation to match.
Suggested-by: Stephen Warren swarren@wwwdotorg.org Reported-by: Joe Hershberger joe.hershberger@ni.com Signed-off-by: Simon Glass sjg@chromium.org
Thanks!
Reviewed-by: Joe Hershberger joe.hershberger@ni.com

On 03/06/2016 07:45 PM, Simon Glass wrote:
At present buildman allows you to specify the directory containing the toolchain, but not the actual toolchain prefix. If there are multiple toolchains in a single directory, this can be inconvenient.
Add a new 'toolchain-prefix' setting to the settings file, which allows the full prefix (or path to the C compiler) to be specified.
Update the documentation to match.
Since these are explicit requests, it would be nice if there was an obvious failure if the requested toolchain was not found, rather than just falling back to the existing search behaviour. For example, I expected the following to work:
[toolchain-prefix] arm: arm-none-eabi-
... but that was silently ignored. Instead I needed to write:
[toolchain-prefix] arm: /usr/bin/arm-none-eabi-
Aside from that this patch works for me. I was rather hoping for a cmdline or environment override, but I guess that feeling is influenced by needing to change CROSS_COMPILE when switching between architectures; with ~/.buildman I don't need that, so setting it up once in a file should be OK.
When I tested this I wanted to make sure the request had been honored. I tried telling buildman not to hide the build output, but the following still prints almost nothing:
./tools/buildman/buildman -c 1 -T 1 -v -V p2371-2180
According to "buildman --help", that should print the full make output.
I also looked in the buildman work tree to see if the request had been honored, at file ../.bm-work/00/build/arch/arm/mach-tegra/.cmd_enterrcm.o.cmd. That looked fine, although ~/.buildman specified /usr/bin/aarch64-linux-gnu- as the prefix whereas the command in that .o.cmd file was just "aarch64-linux-gnu-gcc" without the path. It looks like buildman or Kbuild is stripping off the leading path elements because /usr/bin is in the $PATH. Is that expected?

Hi Stephen,
On 7 March 2016 at 14:08, Stephen Warren swarren@wwwdotorg.org wrote:
On 03/06/2016 07:45 PM, Simon Glass wrote:
At present buildman allows you to specify the directory containing the toolchain, but not the actual toolchain prefix. If there are multiple toolchains in a single directory, this can be inconvenient.
Add a new 'toolchain-prefix' setting to the settings file, which allows the full prefix (or path to the C compiler) to be specified.
Update the documentation to match.
Since these are explicit requests, it would be nice if there was an obvious failure if the requested toolchain was not found, rather than just falling back to the existing search behaviour. For example, I expected the following to work:
[toolchain-prefix] arm: arm-none-eabi-
... but that was silently ignored. Instead I needed to write:
I' ll add an error for that.
[toolchain-prefix] arm: /usr/bin/arm-none-eabi-
OK, I'll add PATH scanning.
Aside from that this patch works for me. I was rather hoping for a cmdline or environment override, but I guess that feeling is influenced by needing to change CROSS_COMPILE when switching between architectures; with ~/.buildman I don't need that, so setting it up once in a file should be OK.
When I tested this I wanted to make sure the request had been honored. I tried telling buildman not to hide the build output, but the following still prints almost nothing:
./tools/buildman/buildman -c 1 -T 1 -v -V p2371-2180
According to "buildman --help", that should print the full make output.
Actually it just logs it - see the 'log' file. I'll update the help and README to make that clear.
I also looked in the buildman work tree to see if the request had been honored, at file ../.bm-work/00/build/arch/arm/mach-tegra/.cmd_enterrcm.o.cmd. That looked fine, although ~/.buildman specified /usr/bin/aarch64-linux-gnu- as the prefix whereas the command in that .o.cmd file was just "aarch64-linux-gnu-gcc" without the path. It looks like buildman or Kbuild is stripping off the leading path elements because /usr/bin is in the $PATH. Is that expected?
It isn't buildman doing that - see the 'toolchain' file for the toolchain it uses for the build. I suppose it is a feature of Kbuild. Masahiro might know more about that.
Regards, Simon

Hi Simon,
2016-03-07 11:45 GMT+09:00 Simon Glass sjg@chromium.org:
This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com
I think this patch would diplay a clearer hint, but would not solve the root cause.
fdtgrep still crashes with the following DTS:
/ { model = "UniPhier PH1-LD20 Reference Board"; compatible = "socionext,ph1-ld20-ref", "socionext,ph1-ld20";
memory { device_type = "memory"; reg = <0 0x80000000 0 0xc0000000>; };
chosen { stdout-path = "serial0:115200n8"; };
aliases { serial0 = &serial0; serial1 = &serial1; serial2 = &serial2; serial3 = &serial3; i2c0 = &i2c0; i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; i2c4 = &i2c4; i2c5 = &i2c5; i2c6 = &i2c6; }; };
Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT /aliases node must come before all other nodes Error: FDT_ERR_BADMAGIC
But, fdtgrep can accept the following:
/ { model = "UniPhier PH1-LD20 Reference Board"; compatible = "socionext,ph1-ld20-ref", "socionext,ph1-ld20";
aliases { serial0 = &serial0; serial1 = &serial1; serial2 = &serial2; serial3 = &serial3; i2c0 = &i2c0; i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; i2c4 = &i2c4; i2c5 = &i2c5; i2c6 = &i2c6; };
memory { device_type = "memory"; reg = <0 0x80000000 0 0xc0000000>; };
chosen { stdout-path = "serial0:115200n8"; }; };
Should I really move the "aliases" node? I do not think this restriction is reasonable.

Hi Masahiro,
On 6 March 2016 at 20:07, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Hi Simon,
2016-03-07 11:45 GMT+09:00 Simon Glass sjg@chromium.org:
This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com
I think this patch would diplay a clearer hint, but would not solve the root cause.
fdtgrep still crashes with the following DTS:
Crashes?
/ { model = "UniPhier PH1-LD20 Reference Board"; compatible = "socionext,ph1-ld20-ref", "socionext,ph1-ld20";
memory { device_type = "memory"; reg = <0 0x80000000 0 0xc0000000>; }; chosen { stdout-path = "serial0:115200n8"; }; aliases { serial0 = &serial0; serial1 = &serial1; serial2 = &serial2; serial3 = &serial3; i2c0 = &i2c0; i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; i2c4 = &i2c4; i2c5 = &i2c5; i2c6 = &i2c6; };
};
Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT /aliases node must come before all other nodes Error: FDT_ERR_BADMAGIC
You mean it gives an error?
But, fdtgrep can accept the following:
/ { model = "UniPhier PH1-LD20 Reference Board"; compatible = "socionext,ph1-ld20-ref", "socionext,ph1-ld20";
aliases { serial0 = &serial0; serial1 = &serial1; serial2 = &serial2; serial3 = &serial3; i2c0 = &i2c0; i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; i2c4 = &i2c4; i2c5 = &i2c5; i2c6 = &i2c6; }; memory { device_type = "memory"; reg = <0 0x80000000 0 0xc0000000>; }; chosen { stdout-path = "serial0:115200n8"; };
};
Should I really move the "aliases" node? I do not think this restriction is reasonable.
Agreed. Given that it now sorts the regions I'm not sure why that restriction is still there, actually.
Looking a bit closer, it is really checking that the aliases node isn't last. It could probably work around it by using fdt_size_dt_structs() when node_end is -ve.
Regards, Simon

2016-03-07 12:31 GMT+09:00 Simon Glass sjg@chromium.org:
Hi Masahiro,
On 6 March 2016 at 20:07, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Hi Simon,
2016-03-07 11:45 GMT+09:00 Simon Glass sjg@chromium.org:
This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com
I think this patch would diplay a clearer hint, but would not solve the root cause.
fdtgrep still crashes with the following DTS:
Crashes?
Yes.
I applied your patch, but fdtgrep still would not work.
Please try this.
$ git clone git://git.denx.de/u-boot-uniphier.git $ cd u-boot-uniphier $ git checkout -b for-simon origin/for-simon $ make uniphier_ld20_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ make CROSS_COMPILE=aarch64-linux-gnu- scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config.h UPD include/config.h GEN include/autoconf.mk GEN include/autoconf.mk.dep GEN spl/include/autoconf.mk CHK include/config/uboot.release UPD include/config/uboot.release CHK include/generated/version_autogenerated.h UPD include/generated/version_autogenerated.h CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h CC lib/asm-offsets.s CHK include/generated/generic-asm-offsets.h UPD include/generated/generic-asm-offsets.h CC arch/arm/lib/asm-offsets.s CHK include/generated/asm-offsets.h UPD include/generated/asm-offsets.h HOSTCC tools/gen_eth_addr HOSTCC tools/img2srec HOSTCC tools/mkenvimage.o HOSTCC tools/os_support.o WRAP tools/lib/crc32.c HOSTCC tools/lib/crc32.o HOSTLD tools/mkenvimage HOSTCC tools/aisimage.o HOSTCC tools/atmelimage.o WRAP tools/common/bootm.c HOSTCC tools/common/bootm.o HOSTCC tools/default_image.o WRAP tools/lib/fdtdec_common.c HOSTCC tools/lib/fdtdec_common.o WRAP tools/lib/fdtdec.c HOSTCC tools/lib/fdtdec.o HOSTCC tools/fit_common.o HOSTCC tools/fit_image.o HOSTCC tools/gpimage.o HOSTCC tools/gpimage-common.o WRAP tools/common/image-fit.c HOSTCC tools/common/image-fit.o HOSTCC tools/image-host.o WRAP tools/common/image.c HOSTCC tools/common/image.o HOSTCC tools/imagetool.o HOSTCC tools/imximage.o HOSTCC tools/kwbimage.o WRAP tools/lib/md5.c HOSTCC tools/lib/md5.o HOSTCC tools/lpc32xximage.o HOSTCC tools/mxsimage.o HOSTCC tools/omapimage.o HOSTCC tools/pblimage.o HOSTCC tools/pbl_crc32.o WRAP tools/lib/rc4.c HOSTCC tools/lib/rc4.o HOSTCC tools/rkcommon.o HOSTCC tools/rkimage.o HOSTCC tools/rksd.o HOSTCC tools/rkspi.o HOSTCC tools/socfpgaimage.o WRAP tools/lib/sha1.c HOSTCC tools/lib/sha1.o WRAP tools/lib/sha256.c HOSTCC tools/lib/sha256.o WRAP tools/common/hash.c HOSTCC tools/common/hash.o HOSTCC tools/ublimage.o HOSTCC tools/zynqimage.o WRAP tools/lib/libfdt/fdt.c HOSTCC tools/lib/libfdt/fdt.o WRAP tools/lib/libfdt/fdt_ro.c HOSTCC tools/lib/libfdt/fdt_ro.o WRAP tools/lib/libfdt/fdt_rw.c HOSTCC tools/lib/libfdt/fdt_rw.o WRAP tools/lib/libfdt/fdt_strerror.c HOSTCC tools/lib/libfdt/fdt_strerror.o WRAP tools/lib/libfdt/fdt_wip.c HOSTCC tools/lib/libfdt/fdt_wip.o WRAP tools/lib/libfdt/fdt_region.c HOSTCC tools/lib/libfdt/fdt_region.o HOSTCC tools/dumpimage.o HOSTLD tools/dumpimage HOSTCC tools/mkimage.o HOSTLD tools/mkimage HOSTCC tools/proftool HOSTCC tools/relocate-rela HOSTCC tools/fdtgrep.o HOSTLD tools/fdtgrep LD arch/arm/cpu/built-in.o CC arch/arm/cpu/armv8/cpu.o CC arch/arm/cpu/armv8/generic_timer.o CC arch/arm/cpu/armv8/cache_v8.o AS arch/arm/cpu/armv8/exceptions.o AS arch/arm/cpu/armv8/cache.o AS arch/arm/cpu/armv8/tlb.o AS arch/arm/cpu/armv8/transition.o CC arch/arm/cpu/armv8/fwcall.o LD arch/arm/cpu/armv8/built-in.o AS arch/arm/cpu/armv8/start.o AS arch/arm/lib/crt0_64.o AS arch/arm/lib/relocate_64.o CC arch/arm/lib/bootm-fdt.o CC arch/arm/lib/bootm.o CC arch/arm/lib/sections.o CC arch/arm/lib/stack.o AS arch/arm/lib/ccn504.o AS arch/arm/lib/gic_64.o CC arch/arm/lib/interrupts_64.o CC arch/arm/lib/reset.o CC arch/arm/lib/cache.o LD arch/arm/lib/built-in.o AR arch/arm/lib/lib.a CC arch/arm/mach-uniphier/board_early_init_f.o CC arch/arm/mach-uniphier/cpu_info.o CC arch/arm/mach-uniphier/print_misc_info.o CC arch/arm/mach-uniphier/dram_init.o CC arch/arm/mach-uniphier/board_common.o CC arch/arm/mach-uniphier/board_early_init_r.o CC arch/arm/mach-uniphier/board_late_init.o CC arch/arm/mach-uniphier/reset.o LD arch/arm/mach-uniphier/arm64/built-in.o CC arch/arm/mach-uniphier/boot-mode/boot-mode.o CC arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.o CC arch/arm/mach-uniphier/boot-mode/cmd_pinmon.o LD arch/arm/mach-uniphier/boot-mode/built-in.o LD arch/arm/mach-uniphier/clk/built-in.o LD arch/arm/mach-uniphier/dram/built-in.o LD arch/arm/mach-uniphier/pinctrl/built-in.o CC arch/arm/mach-uniphier/boards.o CC arch/arm/mach-uniphier/soc_info.o CC arch/arm/mach-uniphier/micro-support-card.o LD arch/arm/mach-uniphier/built-in.o CC cmd/boot.o CC cmd/bootm.o CC cmd/help.o CC cmd/version.o CC cmd/source.o CC cmd/bdinfo.o CC cmd/console.o CC cmd/echo.o CC cmd/elf.o CC cmd/exit.o CC cmd/fat.o CC cmd/fdt.o CC cmd/flash.o CC cmd/gpio.o CC cmd/i2c.o CC cmd/itest.o CC cmd/load.o CC cmd/mem.o CC cmd/mmc.o CC cmd/nand.o CC cmd/net.o CC cmd/pcmcia.o CC cmd/setexpr.o CC cmd/time.o CC cmd/test.o CC cmd/usb.o CC cmd/nvedit.o CC cmd/disk.o LD cmd/built-in.o CC common/init/board_init.o LD common/init/built-in.o CC common/main.o CC common/exports.o CC common/hash.o CC common/cli_hush.o CC common/autoboot.o CC common/board_f.o CC common/board_r.o CC common/board_info.o CC common/bootm.o CC common/bootm_os.o CC common/env_attr.o CC common/env_callback.o CC common/env_flags.o CC common/env_mmc.o CC common/fdt_support.o CC common/usb.o CC common/usb_hub.o CC common/usb_storage.o CC common/flash.o CC common/splash.o CC common/env_common.o CC common/console.o CC common/dlmalloc.o CC common/malloc_simple.o CC common/image.o CC common/image-fdt.o CC common/memsize.o CC common/stdio.o CC common/cli_simple.o CC common/cli.o CC common/cli_readline.o CC common/command.o CC common/s_record.o CC common/xyzModem.o LD common/built-in.o CC disk/part.o CC disk/part_dos.o LD disk/built-in.o LD drivers/adc/built-in.o CC drivers/block/disk-uclass.o LD drivers/block/built-in.o CC drivers/clk/clk-uclass.o CC drivers/clk/clk_fixed_rate.o CC drivers/clk/uniphier/clk-uniphier-core.o CC drivers/clk/uniphier/clk-uniphier-mio.o LD drivers/clk/uniphier/built-in.o LD drivers/clk/built-in.o CC drivers/core/device.o CC drivers/core/lists.o CC drivers/core/root.o CC drivers/core/uclass.o CC drivers/core/util.o CC drivers/core/device-remove.o CC drivers/core/simple-bus.o CC drivers/core/dump.o LD drivers/core/built-in.o CC drivers/crypto/fsl/sec.o LD drivers/crypto/fsl/built-in.o LD drivers/crypto/rsa_mod_exp/built-in.o LD drivers/crypto/built-in.o LD drivers/dfu/built-in.o LD drivers/hwmon/built-in.o CC drivers/input/input.o CC drivers/input/key_matrix.o LD drivers/input/built-in.o LD drivers/memory/built-in.o CC drivers/misc/i2c_eeprom.o LD drivers/misc/built-in.o CC drivers/pcmcia/tqm8xx_pcmcia.o LD drivers/pcmcia/built-in.o CC drivers/pinctrl/pinctrl-uclass.o CC drivers/pinctrl/pinctrl-generic.o LD drivers/pinctrl/nxp/built-in.o LD drivers/pinctrl/uniphier/built-in.o LD drivers/pinctrl/built-in.o LD drivers/pwm/built-in.o CC drivers/rtc/date.o LD drivers/rtc/built-in.o LD drivers/soc/built-in.o LD drivers/sound/built-in.o LD drivers/thermal/built-in.o LD drivers/timer/built-in.o LD drivers/tpm/built-in.o LD drivers/twserial/built-in.o LD drivers/video/bridge/built-in.o LD drivers/video/built-in.o LD drivers/watchdog/built-in.o LD drivers/built-in.o LD drivers/dma/built-in.o CC drivers/gpio/gpio-uclass.o CC drivers/gpio/gpio-uniphier.o LD drivers/gpio/built-in.o CC drivers/i2c/i2c-uclass.o CC drivers/i2c/i2c-uniphier.o CC drivers/i2c/i2c-uniphier-f.o LD drivers/i2c/built-in.o CC drivers/mmc/mmc-uclass.o CC drivers/mmc/mmc.o CC drivers/mmc/uniphier-sd.o CC drivers/mmc/mmc_write.o LD drivers/mmc/built-in.o CC drivers/mtd/mtdcore.o CC drivers/mtd/mtd_uboot.o CC drivers/mtd/cfi_flash.o LD drivers/mtd/built-in.o CC drivers/mtd/nand/nand.o CC drivers/mtd/nand/nand_bbt.o CC drivers/mtd/nand/nand_ids.o CC drivers/mtd/nand/nand_util.o CC drivers/mtd/nand/nand_ecc.o CC drivers/mtd/nand/nand_base.o CC drivers/mtd/nand/nand_timings.o CC drivers/mtd/nand/denali.o LD drivers/mtd/nand/built-in.o LD drivers/mtd/onenand/built-in.o LD drivers/mtd/spi/built-in.o CC drivers/net/smc911x.o LD drivers/net/built-in.o LD drivers/net/phy/built-in.o LD drivers/pci/built-in.o LD drivers/power/built-in.o LD drivers/power/battery/built-in.o LD drivers/power/fuel_gauge/built-in.o LD drivers/power/mfd/built-in.o LD drivers/power/pmic/built-in.o LD drivers/power/regulator/built-in.o CC drivers/serial/serial-uclass.o CC drivers/serial/serial_uniphier.o LD drivers/serial/built-in.o CC drivers/spi/spi.o LD drivers/spi/built-in.o LD drivers/usb/dwc3/built-in.o LD drivers/usb/emul/built-in.o LD drivers/usb/eth/built-in.o LD drivers/usb/gadget/built-in.o LD drivers/usb/gadget/udc/built-in.o CC drivers/usb/host/xhci.o CC drivers/usb/host/xhci-mem.o CC drivers/usb/host/xhci-ring.o CC drivers/usb/host/xhci-uniphier.o LD drivers/usb/host/built-in.o LD drivers/usb/musb-new/built-in.o LD drivers/usb/musb/built-in.o LD drivers/usb/phy/built-in.o LD drivers/usb/ulpi/built-in.o CC fs/fs.o CC fs/fat/fat_write.o CC fs/fat/file.o LD fs/fat/built-in.o LD fs/built-in.o CC lib/libfdt/fdt.o CC lib/libfdt/fdt_ro.o CC lib/libfdt/fdt_rw.o CC lib/libfdt/fdt_strerror.o CC lib/libfdt/fdt_sw.o CC lib/libfdt/fdt_wip.o CC lib/libfdt/fdt_empty_tree.o CC lib/libfdt/fdt_addresses.o CC lib/libfdt/fdt_region.o LD lib/libfdt/built-in.o CC lib/zlib/zlib.o LD lib/zlib/built-in.o CC lib/crc7.o CC lib/crc8.o CC lib/crc16.o CC lib/fdtdec_common.o CC lib/fdtdec.o CC lib/gunzip.o CC lib/initcall.o CC lib/lmb.o CC lib/ldiv.o CC lib/net_utils.o CC lib/qsort.o CC lib/rc4.o CC lib/strmhz.o CC lib/list_sort.o CC lib/hashtable.o CC lib/errno.o CC lib/display_options.o CC lib/crc32.o CC lib/ctype.o CC lib/div64.o CC lib/hang.o CC lib/linux_compat.o CC lib/linux_string.o CC lib/membuff.o CC lib/slre.o CC lib/string.o CC lib/time.o CC lib/rand.o CC lib/vsprintf.o CC lib/panic.o CC lib/strto.o LD lib/built-in.o CC net/checksum.o CC net/arp.o CC net/bootp.o CC net/eth_legacy.o CC net/eth_common.o CC net/net.o CC net/nfs.o CC net/ping.o CC net/tftp.o LD net/built-in.o LD test/built-in.o CC test/dm/cmd_dm.o LD test/dm/built-in.o CC examples/standalone/stubs.o LD examples/standalone/libstubs.o CC examples/standalone/hello_world.o LD examples/standalone/hello_world CC examples/standalone/smc911x_eeprom.o LD examples/standalone/smc911x_eeprom OBJCOPY examples/standalone/hello_world.srec OBJCOPY examples/standalone/smc911x_eeprom.srec OBJCOPY examples/standalone/hello_world.bin OBJCOPY examples/standalone/smc911x_eeprom.bin LDS u-boot.lds LD u-boot OBJCOPY u-boot.srec OBJCOPY u-boot-nodtb.bin start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x84000000 $start $end DTC arch/arm/dts/uniphier-ph1-ld20-ref.dtb DTC arch/arm/dts/uniphier-ph1-ld4-ref.dtb DTC arch/arm/dts/uniphier-ph1-ld6b-ref.dtb DTC arch/arm/dts/uniphier-ph1-pro4-ace.dtb DTC arch/arm/dts/uniphier-ph1-pro4-ref.dtb DTC arch/arm/dts/uniphier-ph1-pro4-sanji.dtb DTC arch/arm/dts/uniphier-ph1-pro5-4kbox.dtb DTC arch/arm/dts/uniphier-ph1-sld3-ref.dtb DTC arch/arm/dts/uniphier-ph1-sld8-ref.dtb DTC arch/arm/dts/uniphier-proxstream2-gentil.dtb DTC arch/arm/dts/uniphier-proxstream2-vodka.dtb SHIPPED dts/dt.dtb CAT u-boot-dtb.bin COPY u-boot.bin SYM u-boot.sym CFG u-boot.cfg LD spl/arch/arm/mach-uniphier/arm64/built-in.o LD spl/arch/arm/mach-uniphier/bcu/built-in.o CC spl/arch/arm/mach-uniphier/boot-mode/boot-mode.o CC spl/arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.o CC spl/arch/arm/mach-uniphier/boot-mode/cmd_pinmon.o LD spl/arch/arm/mach-uniphier/boot-mode/built-in.o CC spl/arch/arm/mach-uniphier/dram/umc-ld20.o LD spl/arch/arm/mach-uniphier/dram/built-in.o LD spl/arch/arm/mach-uniphier/early-clk/built-in.o LD spl/arch/arm/mach-uniphier/early-pinctrl/built-in.o CC spl/arch/arm/mach-uniphier/init/init.o CC spl/arch/arm/mach-uniphier/init/init-ld20.o LD spl/arch/arm/mach-uniphier/init/built-in.o CC spl/arch/arm/mach-uniphier/memconf/memconf.o CC spl/arch/arm/mach-uniphier/memconf/memconf-pxs2.o LD spl/arch/arm/mach-uniphier/memconf/built-in.o LD spl/arch/arm/mach-uniphier/pll/built-in.o CC spl/arch/arm/mach-uniphier/sbc/sbc-savepin.o LD spl/arch/arm/mach-uniphier/sbc/built-in.o CC spl/arch/arm/mach-uniphier/boards.o CC spl/arch/arm/mach-uniphier/soc_info.o CC spl/arch/arm/mach-uniphier/micro-support-card.o LD spl/arch/arm/mach-uniphier/built-in.o CC spl/arch/arm/cpu/armv8/cpu.o CC spl/arch/arm/cpu/armv8/generic_timer.o CC spl/arch/arm/cpu/armv8/cache_v8.o AS spl/arch/arm/cpu/armv8/exceptions.o AS spl/arch/arm/cpu/armv8/cache.o AS spl/arch/arm/cpu/armv8/tlb.o AS spl/arch/arm/cpu/armv8/transition.o CC spl/arch/arm/cpu/armv8/fwcall.o LD spl/arch/arm/cpu/armv8/built-in.o AS spl/arch/arm/cpu/armv8/start.o LD spl/arch/arm/cpu/built-in.o AS spl/arch/arm/lib/crt0_64.o CC spl/arch/arm/lib/spl.o CC spl/arch/arm/lib/sections.o CC spl/arch/arm/lib/stack.o AS spl/arch/arm/lib/ccn504.o AS spl/arch/arm/lib/gic_64.o CC spl/arch/arm/lib/interrupts_64.o CC spl/arch/arm/lib/reset.o CC spl/arch/arm/lib/cache.o LD spl/arch/arm/lib/built-in.o AR spl/arch/arm/lib/lib.a CC spl/common/spl/spl.o CC spl/common/spl/spl_nor.o CC spl/common/spl/spl_nand.o CC spl/common/spl/spl_mmc.o LD spl/common/spl/built-in.o CC spl/common/init/board_init.o LD spl/common/init/built-in.o CC spl/common/env_common.o CC spl/common/console.o CC spl/common/dlmalloc.o CC spl/common/malloc_simple.o CC spl/common/image.o CC spl/common/image-fdt.o CC spl/common/memsize.o CC spl/common/stdio.o CC spl/common/cli_simple.o CC spl/common/cli.o CC spl/common/cli_readline.o CC spl/common/command.o CC spl/common/s_record.o CC spl/common/xyzModem.o LD spl/common/built-in.o CC spl/cmd/nvedit.o CC spl/cmd/disk.o LD spl/cmd/built-in.o CC spl/drivers/clk/clk-uclass.o CC spl/drivers/clk/clk_fixed_rate.o CC spl/drivers/clk/uniphier/clk-uniphier-core.o CC spl/drivers/clk/uniphier/clk-uniphier-mio.o LD spl/drivers/clk/uniphier/built-in.o LD spl/drivers/clk/built-in.o CC spl/drivers/core/device.o CC spl/drivers/core/lists.o CC spl/drivers/core/root.o CC spl/drivers/core/uclass.o CC spl/drivers/core/util.o CC spl/drivers/core/simple-bus.o CC spl/drivers/core/dump.o LD spl/drivers/core/built-in.o CC spl/drivers/mmc/mmc-uclass.o CC spl/drivers/mmc/mmc.o CC spl/drivers/mmc/uniphier-sd.o LD spl/drivers/mmc/built-in.o CC spl/drivers/mtd/nand/denali_spl.o LD spl/drivers/mtd/nand/built-in.o CC spl/drivers/pinctrl/pinctrl-uclass.o CC spl/drivers/pinctrl/pinctrl-generic.o LD spl/drivers/pinctrl/nxp/built-in.o LD spl/drivers/pinctrl/uniphier/built-in.o LD spl/drivers/pinctrl/built-in.o CC spl/drivers/serial/serial-uclass.o CC spl/drivers/serial/serial_uniphier.o LD spl/drivers/serial/built-in.o LD spl/drivers/built-in.o LD spl/dts/built-in.o LD spl/fs/built-in.o CC spl/lib/libfdt/fdt.o CC spl/lib/libfdt/fdt_ro.o CC spl/lib/libfdt/fdt_rw.o CC spl/lib/libfdt/fdt_strerror.o CC spl/lib/libfdt/fdt_sw.o CC spl/lib/libfdt/fdt_wip.o CC spl/lib/libfdt/fdt_empty_tree.o CC spl/lib/libfdt/fdt_addresses.o CC spl/lib/libfdt/fdt_region.o LD spl/lib/libfdt/built-in.o CC spl/lib/fdtdec_common.o CC spl/lib/fdtdec.o CC spl/lib/hashtable.o CC spl/lib/errno.o CC spl/lib/display_options.o CC spl/lib/crc32.o CC spl/lib/ctype.o CC spl/lib/div64.o CC spl/lib/hang.o CC spl/lib/linux_compat.o CC spl/lib/linux_string.o CC spl/lib/membuff.o CC spl/lib/slre.o CC spl/lib/string.o CC spl/lib/time.o CC spl/lib/rand.o CC spl/lib/vsprintf.o CC spl/lib/panic.o CC spl/lib/strto.o LD spl/lib/built-in.o LDS spl/u-boot-spl.lds LD spl/u-boot-spl OBJCOPY spl/u-boot-spl-nodtb.bin FDTGREP spl/u-boot-spl.dtb Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT /aliases node must come before all other nodes Error: FDT_ERR_BADMAGIC make[1]: *** [spl/u-boot-spl.dtb] Error 1 make: *** [spl/u-boot-spl] Error 2

On Mon, Mar 7, 2016 at 10:37 AM, Masahiro Yamada yamada.masahiro@socionext.com wrote:
2016-03-07 12:31 GMT+09:00 Simon Glass sjg@chromium.org:
Hi Masahiro,
On 6 March 2016 at 20:07, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Hi Simon,
2016-03-07 11:45 GMT+09:00 Simon Glass sjg@chromium.org:
This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com
I think this patch would diplay a clearer hint, but would not solve the root cause.
fdtgrep still crashes with the following DTS:
Crashes?
Yes.
Perhaps a language barrier?
I applied your patch, but fdtgrep still would not work.
True, but does not work and crashes are two different things.
Please try this.
<snip>
OBJCOPY spl/u-boot-spl-nodtb.bin FDTGREP spl/u-boot-spl.dtb Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT /aliases node must come before all other nodes Error: FDT_ERR_BADMAGIC make[1]: *** [spl/u-boot-spl.dtb] Error 1 make: *** [spl/u-boot-spl] Error 2
This is just an error. It's not an ideal limitation, but it's far better than it was. I also bet Simon is going to send a v2 that fixes it completely.
-Joe

Hi Joe,
On 7 March 2016 at 09:42, Joe Hershberger joe.hershberger@gmail.com wrote:
On Mon, Mar 7, 2016 at 10:37 AM, Masahiro Yamada yamada.masahiro@socionext.com wrote:
2016-03-07 12:31 GMT+09:00 Simon Glass sjg@chromium.org:
Hi Masahiro,
On 6 March 2016 at 20:07, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Hi Simon,
2016-03-07 11:45 GMT+09:00 Simon Glass sjg@chromium.org:
This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com
I think this patch would diplay a clearer hint, but would not solve the root cause.
fdtgrep still crashes with the following DTS:
Crashes?
Yes.
Perhaps a language barrier?
I applied your patch, but fdtgrep still would not work.
True, but does not work and crashes are two different things.
Please try this.
<snip>
OBJCOPY spl/u-boot-spl-nodtb.bin FDTGREP spl/u-boot-spl.dtb Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT /aliases node must come before all other nodes Error: FDT_ERR_BADMAGIC make[1]: *** [spl/u-boot-spl.dtb] Error 1 make: *** [spl/u-boot-spl] Error 2
This is just an error. It's not an ideal limitation, but it's far better than it was. I also bet Simon is going to send a v2 that fixes it completely.
Yes I hope to look at this some more. But I also feel that aliases should go at the top of the file...it seems odd to have the 'directory' at the bottom.
Regards, Simon

On 7 March 2016 at 11:26, Simon Glass sjg@chromium.org wrote:
Hi Joe,
On 7 March 2016 at 09:42, Joe Hershberger joe.hershberger@gmail.com wrote:
On Mon, Mar 7, 2016 at 10:37 AM, Masahiro Yamada yamada.masahiro@socionext.com wrote:
2016-03-07 12:31 GMT+09:00 Simon Glass sjg@chromium.org:
Hi Masahiro,
On 6 March 2016 at 20:07, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Hi Simon,
2016-03-07 11:45 GMT+09:00 Simon Glass sjg@chromium.org:
This tool requires that the aliases node be the first node in the tree. But when it is not, it does not handle things gracefully. In fact it crashes.
Fix this, and add a more helpful error message.
Signed-off-by: Simon Glass sjg@chromium.org Reported-by: Masahiro Yamada yamada.masahiro@socionext.com
I think this patch would diplay a clearer hint, but would not solve the root cause.
fdtgrep still crashes with the following DTS:
Crashes?
Yes.
Perhaps a language barrier?
I applied your patch, but fdtgrep still would not work.
True, but does not work and crashes are two different things.
Please try this.
<snip>
OBJCOPY spl/u-boot-spl-nodtb.bin FDTGREP spl/u-boot-spl.dtb Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT /aliases node must come before all other nodes Error: FDT_ERR_BADMAGIC make[1]: *** [spl/u-boot-spl.dtb] Error 1 make: *** [spl/u-boot-spl] Error 2
This is just an error. It's not an ideal limitation, but it's far better than it was. I also bet Simon is going to send a v2 that fixes it completely.
Yes I hope to look at this some more. But I also feel that aliases should go at the top of the file...it seems odd to have the 'directory' at the bottom.
Regards, Simon
I'm applying this since it fixes a crash.
Applied to u-boot-dm/next
participants (4)
-
Joe Hershberger
-
Masahiro Yamada
-
Simon Glass
-
Stephen Warren