summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile2
-rw-r--r--tools/env/fw_env.c2
-rw-r--r--tools/mkenvimage.c11
3 files changed, 10 insertions, 5 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 3b95964fd1..c422b76054 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -157,7 +157,7 @@ HOSTCFLAGS_sha256.o := -pedantic
#HOSTCFLAGS_mpc86x_clk.o := -pedantic
quiet_cmd_wrap = WRAP $@
-cmd_wrap = echo "\#include <$(srctree)/$(patsubst $(obj)/%,%,$@)>" >$@
+cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
$(obj)/lib/%.c $(obj)/common/%.c:
$(call cmd,wrap)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 30d5b037f0..1173eea782 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -125,7 +125,7 @@ static int get_config (char *);
#endif
static inline ulong getenvsize (void)
{
- ulong rc = CUR_ENVSIZE - sizeof(long);
+ ulong rc = CUR_ENVSIZE - sizeof(uint32_t);
if (HaveRedundEnv)
rc -= sizeof (char);
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index bbd3041e36..6971b91314 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -37,6 +37,8 @@ static void usage(const char *exec_name)
"\t\tkey1=value1\n"
"\t\tkey2=value2\n"
"\t\t...\n"
+ "\tEmpty lines are skipped, and lines with a # in the first\n"
+ "\tcolumn are treated as comments (also skipped).\n"
"\t-r : the environment has multiple copies in flash\n"
"\t-b : the target is big endian (default is little endian)\n"
"\t-p <byte> : fill the image with <byte> bytes instead of 0xff bytes\n"
@@ -221,10 +223,9 @@ int main(int argc, char **argv)
/* Replace newlines separating variables with \0 */
for (fp = 0, ep = 0 ; fp < filesize ; fp++) {
if (filebuf[fp] == '\n') {
- if (ep == 0) {
+ if (fp == 0 || filebuf[fp-1] == '\n') {
/*
- * Newlines at the beginning of the file ?
- * Ignore them.
+ * Skip empty lines.
*/
continue;
} else if (filebuf[fp-1] == '\\') {
@@ -240,6 +241,10 @@ int main(int argc, char **argv)
/* End of a variable */
envptr[ep++] = '\0';
}
+ } else if ((fp == 0 || filebuf[fp-1] == '\n') && filebuf[fp] == '#') {
+ /* Comment, skip the line. */
+ while (++fp < filesize && filebuf[fp] != '\n')
+ continue;
} else {
envptr[ep++] = filebuf[fp];
}
OpenPOWER on IntegriCloud