fw_printenv - changed MTD include and fixe [...]
PATCH 1/1 fw_printenv - changed MTD include and fixe [...]
Hello list,
inside the automatic U-Boot patch tracking system a new ticket [DNX#2007021942000012] was created:
<snip>
Quoted 98 lines
This user-space program was including a kernel header, which prevented compilation. Compiler warnings were 'fixed' by some casts. If anyone stores binary data in environment variables this may not work.
The DULG mentions a '
fw_setenv' command, which doesn't technically exist. TheMakefilewas modified to create a link that becomes this command.Signed-off-by Ben Warren <[email protected]>--- tools/env/Makefile | 3 ++- tools/env/README | 3 ++- tools/env/fw_env.c | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-)tools/env/Makefile +2
-1@@ -32,9 +32,10 @@ all: $(obj)fw_printenv $(obj)fw_printenv: $(SRCS) $(HEADERS) $(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $(obj)fw_printenv + ln -s $(obj)fw_printenv $(obj)fw_setenv clean: - rm -f $(obj)fw_printenv $(obj)crc32.c + rm -f $(obj)fw_printenv $(obj)crc32.c $(obj)fw_setenv $(obj)crc32.c: ln -s $(src)../../lib_generic/crc32.c $(obj)crc32.ctools/env/README +1
-1@@ -34,7 +34,8 @@ The DEVICEx_NAME constants define which be used to access the environment. The DEVICEx_OFFSET constants define the environment offset within the -MTD character device. +MTD character device. Note that if your Linux kernel is compiled withMTD
tools/env/README +1
-0+PARTITION support, this value will probably be 0. ENVx_SIZE defines the size in bytes taken by the environment, which may be less then flash sector size, if the environment takes lesstools/env/fw_env.c +6
-6@@ -31,7 +31,7 @@ #include <sys/types.h>#include <sys/ioctl.h> #include <sys/stat.h> #include <unistd.h> -#include <linux/mtd/mtd.h> +#include <mtd/mtd-user.h> #include "fw_env.h" typedef unsigned char uchar ;@@ -40,7 +40,7 @@ #define CMD_GETENV "fw_printenv"#define CMD_SETENV "fw_setenv" typedef struct envdev_s { - uchar devname[16]; /* Device name */ + char devname[16]; /* Device name */ ulong devoff; /* Device offset */ ulong env_size; /* environment size */ ulong erase_size; /* device erase size */@@ -241,8 +241,8 @@ void fw_printenv (int argc, char *argv[] }for (i =1 ; i < argc; ++i) {/* print single env variables */ -uchar *name = argv[i]; -uchar *val =NULL ; +char *name = argv[i]; +char *val =NULL ;for (env = environment.data; *env; env = nxt +1 ) {@@ -253,7 +253,7 @@ void fw_printenv (int argc, char *argv[]return ; } } - val =envmatch (name, env); + val = (char *)envmatch ((uchar *)name, env);if (val) {if (!n_flag) {fputs (name, stdout);@@ -281,7 +281,7 @@ int fw_setenv (int argc, char *argv[])int i, len;uchar *env, *nxt;uchar *oldval =NULL ; -uchar *name; +char *name;if (argc <2 ) {return (EINVAL );
tools/env/fw_env.c int fw_setenv (int argc, char *argv[]) · line 304
Quoted 2 lines
tools/env/fw_env.c +0
-0@@ -303,7 +303,7 @@ int fw_setenv (int argc, char *argv[])return (EINVAL ); }
</snip>
Your U-Boot support team