When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.
In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.
This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.
Signed-off-by: Tom Rini <trini@konsulko.com>
The size of 'filebuf' was not increased as more and more bytes are read
from stdin, but 'filebuf' was always reallocated to the same fix size.
This works as long as only less bytes than the initial buffer size come
in, for more input this will segfault. (It actually does, I tested
that.) So for each loop cycle the buffer size has to be increased by the
number of bytes we want to read.
Signed-off-by: Alexander Dahl <ada@thorsis.com>
On success read() returns the number of bytes read or zero for EOF. On
error -1 is returned and errno is set, so the right way to test if read
had failed is to test the return value instead of errno.
Signed-off-by: Alexander Dahl <ada@thorsis.com>
The current head revision of mkenvimage
(e72be8947e) will prevent you from creating
an env image from a text file that is larger than the env length specified
by the '-s' option. That doesn't make sense given that the tool now allows
comments and blank lines. This patch removes that limitation and allows
longer text files to be used.
I don't have time / desire at the moment to figure out "patman" and could
really care less if this is adopted up stream. Just figured I would share
in case anybody else finds it useful enough to take time to do a proper
patch.
>From 39ff30190c2bf687861f4b4b33230f1944fb64f9 Mon Sep 17 00:00:00 2001
From: Brian McFarland <bmcfarland@rldrake.com>
Date: Thu, 12 Mar 2015 11:37:19 -0400
Subject: [PATCH] In mkenvimage, removed the check that prevented using a
source text file larger than the output environment image. Instead, the main
parsing loop checks to see if the environment buffer is full, and quits if it
is. After the main parse loop, a second loop swallows comments and
whitespace until either the EOF is reached or more env vars are found, in
which case an error will be thrown.
This patch adds support for comments in the input to mkenvimage, i.e. in
the environment source: All lines starting with a # in the firs column
will be ignored.
Additionally empty lines will also be ignored.
Signed-off-by: Dominik Muth <dominik.muth@bkvibro.com>
Commit 669dfc2e adds libfdt_env.h to HOSTCPPFLAGS. It causes stdio.h
to be included before _GNU_SOURCE is defined in C files. On some old hosts
some prototypes are protected by #ifdef __USE_GNU, which is set when
_GNU_SOURCE is defined.
Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>
We have a header file specifically for mingw cruft, so keep it there
to avoid crap spreading into the main tools. This lets our devs just
worry about *nix systems.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
mkenvimage does not build due to missed os_support.o and unsupported
file modes S_IRGRP S_IWGRP.
Tested with mingw 4.2.1 on ubuntu 12.04.
Signed-off-by: Vladimir Yakovlev <nagos@inbox.ru>
Use the POSIX variant of basename due to BSD systems (e.g. OS X) do not provide
GNU version of basename(3). It is save to use the POSIX variant here cause we do
never use argv[0] later on which may be modified by the basename(3) POSIX
variant.
On systems providing GNU variant the GNU variant should be used since string.h
is included before libgen.h. Therefore let the _GNU_SOURCE as is.
This patch fixes following warning (on OS X):
---8<---
mkenvimage.c: In function ‘main’:
mkenvimage.c:105: warning: implicit declaration of function ‘basename’
mkenvimage.c:105: warning: assignment makes pointer from integer without a cast
--->8---
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
cc: Keith Mok <ek9852@gmail.com>
Fix the compiler warning
mkenvimage.c: In function ‘main’:
mkenvimage.c:218: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘unsigned int’
mkenvimage.c:226: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘unsigned int’
introduced with the commit
mkenvimage: Use mmap() when reading from a regular file
6ee39f8055
Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
CC: David Wagner <david.wagner@free-electrons.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Mike Frysinger <vapier@gentoo.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: David Wagner <deubeuliou@gmail.com>
Remove this feature since it seems impossible to reliably detect them.
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Verbosly fail if the target environment size or the padding byte are badly
formated.
Verbosly fail if something bad happens when reading from standard input.
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
compiler.h needs to be included from U-Boot's headers.
Also, group U-Boot-specific includes together
stdlib.h was missing.
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Also, don't split error messages over several lines as per a coding style
exception making them easier to grep.
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Don't use argv[0] for usage() because it may or may not be clobbered
by the previous call to basename(). Use "prg" instead as it is done
in the rest of the code.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Since the original implementation indicates explicit error handling
we turn off getopt()'s internal error messaging to avoid duplicate
error messages. Additionally we add ':' (missing option argument)
error handling.
Signed-off-by: Horst Kronstorfer <hkronsto@frequentis.com>
This tool takes a key=value configuration file (same as would a `printenv' show)
and generates the corresponding environment image, ready to be flashed.
use case: flash the environment with an external tool
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
Acked-by; Mike Frysinger <vapier@gentoo.org>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>