public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
@ 2007-11-26 16:46 Markus Klotzbücher
  2007-11-26 17:04 ` Ben Warren
  2007-11-26 22:19 ` Wolfgang Denk
  0 siblings, 2 replies; 13+ messages in thread
From: Markus Klotzbücher @ 2007-11-26 16:46 UTC (permalink / raw)
  To: u-boot


This patch updates the fw_printenv/fw_setenv userspace tool to include
the correct mtd header in order to compile again. Along with this a
number of warnings are fixed.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index f723b5b..2b055bb 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -31,16 +31,14 @@
 #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;
-
 #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 */
@@ -60,22 +58,22 @@ static int curdev;
 
 typedef struct environment_s {
 	ulong crc;			/* CRC32 over data bytes    */
-	uchar flags;			/* active or obsolete */
-	uchar *data;
+	unsigned char flags;		/* active or obsolete */
+	char *data;
 } env_t;
 
 static env_t environment;
 
 static int HaveRedundEnv = 0;
 
-static uchar active_flag = 1;
-static uchar obsolete_flag = 0;
+static unsigned char active_flag = 1;
+static unsigned char obsolete_flag = 0;
 
 
 #define XMK_STR(x)	#x
 #define MK_STR(x)	XMK_STR(x)
 
-static uchar default_environment[] = {
+static char default_environment[] = {
 #if defined(CONFIG_BOOTARGS)
 	"bootargs=" CONFIG_BOOTARGS "\0"
 #endif
@@ -155,7 +153,7 @@ static uchar default_environment[] = {
 };
 
 static int flash_io (int mode);
-static uchar *envmatch (uchar * s1, uchar * s2);
+static char *envmatch (char * s1, char * s2);
 static int env_init (void);
 static int parse_config (void);
 
@@ -175,15 +173,15 @@ static inline ulong getenvsize (void)
  * Search the environment for a variable.
  * Return the value, if found, or NULL, if not found.
  */
-unsigned char *fw_getenv (unsigned char *name)
+char *fw_getenv (char *name)
 {
-	uchar *env, *nxt;
+	char *env, *nxt;
 
 	if (env_init ())
 		return (NULL);
 
 	for (env = environment.data; *env; env = nxt + 1) {
-		uchar *val;
+		char *val;
 
 		for (nxt = env; *nxt; ++nxt) {
 			if (nxt >= &environment.data[ENV_SIZE]) {
@@ -206,7 +204,7 @@ unsigned char *fw_getenv (unsigned char *name)
  */
 void fw_printenv (int argc, char *argv[])
 {
-	uchar *env, *nxt;
+	char *env, *nxt;
 	int i, n_flag;
 
 	if (env_init ())
@@ -241,8 +239,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) {
 
@@ -279,9 +277,9 @@ void fw_printenv (int argc, char *argv[])
 int fw_setenv (int argc, char *argv[])
 {
 	int i, len;
-	uchar *env, *nxt;
-	uchar *oldval = NULL;
-	uchar *name;
+	char *env, *nxt;
+	char *oldval = NULL;
+	char *name;
 
 	if (argc < 2) {
 		return (EINVAL);
@@ -361,7 +359,7 @@ int fw_setenv (int argc, char *argv[])
 	while ((*env = *name++) != '\0')
 		env++;
 	for (i = 2; i < argc; ++i) {
-		uchar *val = argv[i];
+		char *val = argv[i];
 
 		*env = (i == 2) ? '=' : ' ';
 		while ((*++env = *val++) != '\0');
@@ -373,7 +371,7 @@ int fw_setenv (int argc, char *argv[])
   WRITE_FLASH:
 
 	/* Update CRC */
-	environment.crc = crc32 (0, environment.data, ENV_SIZE);
+	environment.crc = crc32 (0, (uint8_t*) environment.data, ENV_SIZE);
 
 	/* write environment back to flash */
 	if (flash_io (O_RDWR)) {
@@ -569,7 +567,7 @@ static int flash_io (int mode)
  * If the names match, return the value of s2, else NULL.
  */
 
-static uchar *envmatch (uchar * s1, uchar * s2)
+static char *envmatch (char * s1, char * s2)
 {
 
 	while (*s1 == *s2++)
@@ -586,10 +584,10 @@ static uchar *envmatch (uchar * s1, uchar * s2)
 static int env_init (void)
 {
 	int crc1, crc1_ok;
-	uchar *addr1;
+	char *addr1;
 
 	int crc2, crc2_ok;
-	uchar flag1, flag2, *addr2;
+	char flag1, flag2, *addr2;
 
 	if (parse_config ())		/* should fill envdevices */
 		return 1;
@@ -608,7 +606,7 @@ static int env_init (void)
 		return (errno);
 	}
 
-	crc1_ok = ((crc1 = crc32 (0, environment.data, ENV_SIZE))
+	crc1_ok = ((crc1 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE))
 			   == environment.crc);
 	if (!HaveRedundEnv) {
 		if (!crc1_ok) {
@@ -632,7 +630,7 @@ static int env_init (void)
 			return (errno);
 		}
 
-		crc2_ok = ((crc2 = crc32 (0, environment.data, ENV_SIZE))
+		crc2_ok = ((crc2 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE))
 				   == environment.crc);
 		flag2 = environment.flags;
 
diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index 13c45a2..58607de 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -47,8 +47,8 @@
 	"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " 	\
 	"bootm"
 
-extern		void  fw_printenv(int argc, char *argv[]);
-extern unsigned char *fw_getenv  (unsigned char *name);
-extern		int   fw_setenv  (int argc, char *argv[]);
+extern void  fw_printenv(int argc, char *argv[]);
+extern char *fw_getenv  (char *name);
+extern int fw_setenv  (int argc, char *argv[]);
 
 extern unsigned	long  crc32	 (unsigned long, const unsigned char *, unsigned);



Best regards

Markus Klotzb?cher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-26 16:46 [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again Markus Klotzbücher
@ 2007-11-26 17:04 ` Ben Warren
  2007-11-26 22:19 ` Wolfgang Denk
  1 sibling, 0 replies; 13+ messages in thread
From: Ben Warren @ 2007-11-26 17:04 UTC (permalink / raw)
  To: u-boot

Markus,

Markus Klotzb?cher wrote:
> This patch updates the fw_printenv/fw_setenv userspace tool to include
> the correct mtd header in order to compile again. Along with this a
> number of warnings are fixed.
>   
Looks a lot like this one:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/26484

IIRC, Wolfgang rejected it because it was Linux 2.6-specific...

regards,
Ben

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-26 16:46 [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again Markus Klotzbücher
  2007-11-26 17:04 ` Ben Warren
@ 2007-11-26 22:19 ` Wolfgang Denk
  2007-11-27  9:23   ` Markus Klotzbücher
  1 sibling, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2007-11-26 22:19 UTC (permalink / raw)
  To: u-boot

In message <87r6idhs49.fsf@denx.de> you wrote:
> 
> This patch updates the fw_printenv/fw_setenv userspace tool to include
> the correct mtd header in order to compile again. Along with this a
> number of warnings are fixed.
> 
> Signed-off-by: Markus Klotzbuecher <mk@denx.de>

Hm... this is only the "correct mtd header" if you are building for
somewhat recent versions of the Linux kernel - if you want to support
his on older versions (using older versions of MTD code) this will
break.

I suggest we optionally provide a build option to allow  to  use  the
old  include files for systems that still need it (as a separate make
target, for example).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Intuition, however illogical, is recognized as a command prerogative.
	-- Kirk, "Obsession", stardate 3620.7

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-26 22:19 ` Wolfgang Denk
@ 2007-11-27  9:23   ` Markus Klotzbücher
  2007-11-27 15:34     ` Ben Warren
  2008-01-09  7:51     ` Wolfgang Denk
  0 siblings, 2 replies; 13+ messages in thread
From: Markus Klotzbücher @ 2007-11-27  9:23 UTC (permalink / raw)
  To: u-boot

Dear Ben, Wolfang,

Wolfgang Denk <wd@denx.de> writes:

> In message <87r6idhs49.fsf@denx.de> you wrote:
>
> Hm... this is only the "correct mtd header" if you are building for
> somewhat recent versions of the Linux kernel - if you want to support
> his on older versions (using older versions of MTD code) this will
> break.

I see.

> I suggest we optionally provide a build option to allow  to  use  the
> old  include files for systems that still need it (as a separate make
> target, for example).

How about the following:

This patch updates the fw_printenv/fw_setenv userspace tool to include
the correct MTD header in order to compile against current kernel
headers. Backward compatibility is preserved by introducing an option
MTD_VERSION which can be set to "old" for compilation using the old MTD
headers. Along with this a number of warnings are fixed.

Signed-off-by: Markus Klotzbuecher <mk@denx.de>


diff --git a/Makefile b/Makefile
index ac4b430..f34b05d 100644
--- a/Makefile
+++ b/Makefile
@@ -318,7 +318,7 @@ updater:
 		$(MAKE) -C tools/updater all || exit 1
 
 env:
-		$(MAKE) -C tools/env all || exit 1
+		$(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1
 
 depend dep:	version
 		for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
diff --git a/tools/env/Makefile b/tools/env/Makefile
index 1f16768..ea2d5b5 100644
--- a/tools/env/Makefile
+++ b/tools/env/Makefile
@@ -28,6 +28,10 @@ HEADERS	:= fw_env.h
 
 CPPFLAGS := -Wall -DUSE_HOSTCC
 
+ifeq ($(MTD_VERSION),old)
+CPPFLAGS += -DMTD_OLD
+endif
+
 all:	$(obj)fw_printenv
 
 $(obj)fw_printenv:	$(SRCS) $(HEADERS)
diff --git a/tools/env/README b/tools/env/README
index d8386f7..f8a644e 100644
--- a/tools/env/README
+++ b/tools/env/README
@@ -6,6 +6,10 @@ For the run-time utiltity configuration uncomment the line
 #define CONFIG_FILE  "/etc/fw_env.config"
 in fw_env.h.
 
+For building against older versions of the MTD headers (meaning before
+v2.6.8-rc1) it is required to pass the argument "MTD_VERSION=old" to
+make.
+
 See comments in the fw_env.config file for definitions for the
 particular board.
 
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index f723b5b..bf9d506 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -31,16 +31,20 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <linux/mtd/mtd.h>
-#include "fw_env.h"
 
-typedef unsigned char uchar;
+#ifdef MTD_OLD
+# include <linux/mtd/mtd.h>
+#else
+# include <mtd/mtd-user.h>
+#endif
+
+#include "fw_env.h"
 
 #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 */
@@ -60,22 +64,22 @@ static int curdev;
 
 typedef struct environment_s {
 	ulong crc;			/* CRC32 over data bytes    */
-	uchar flags;			/* active or obsolete */
-	uchar *data;
+	unsigned char flags;		/* active or obsolete */
+	char *data;
 } env_t;
 
 static env_t environment;
 
 static int HaveRedundEnv = 0;
 
-static uchar active_flag = 1;
-static uchar obsolete_flag = 0;
+static unsigned char active_flag = 1;
+static unsigned char obsolete_flag = 0;
 
 
 #define XMK_STR(x)	#x
 #define MK_STR(x)	XMK_STR(x)
 
-static uchar default_environment[] = {
+static char default_environment[] = {
 #if defined(CONFIG_BOOTARGS)
 	"bootargs=" CONFIG_BOOTARGS "\0"
 #endif
@@ -155,7 +159,7 @@ static uchar default_environment[] = {
 };
 
 static int flash_io (int mode);
-static uchar *envmatch (uchar * s1, uchar * s2);
+static char *envmatch (char * s1, char * s2);
 static int env_init (void);
 static int parse_config (void);
 
@@ -175,15 +179,15 @@ static inline ulong getenvsize (void)
  * Search the environment for a variable.
  * Return the value, if found, or NULL, if not found.
  */
-unsigned char *fw_getenv (unsigned char *name)
+char *fw_getenv (char *name)
 {
-	uchar *env, *nxt;
+	char *env, *nxt;
 
 	if (env_init ())
 		return (NULL);
 
 	for (env = environment.data; *env; env = nxt + 1) {
-		uchar *val;
+		char *val;
 
 		for (nxt = env; *nxt; ++nxt) {
 			if (nxt >= &environment.data[ENV_SIZE]) {
@@ -206,7 +210,7 @@ unsigned char *fw_getenv (unsigned char *name)
  */
 void fw_printenv (int argc, char *argv[])
 {
-	uchar *env, *nxt;
+	char *env, *nxt;
 	int i, n_flag;
 
 	if (env_init ())
@@ -241,8 +245,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) {
 
@@ -279,9 +283,9 @@ void fw_printenv (int argc, char *argv[])
 int fw_setenv (int argc, char *argv[])
 {
 	int i, len;
-	uchar *env, *nxt;
-	uchar *oldval = NULL;
-	uchar *name;
+	char *env, *nxt;
+	char *oldval = NULL;
+	char *name;
 
 	if (argc < 2) {
 		return (EINVAL);
@@ -361,7 +365,7 @@ int fw_setenv (int argc, char *argv[])
 	while ((*env = *name++) != '\0')
 		env++;
 	for (i = 2; i < argc; ++i) {
-		uchar *val = argv[i];
+		char *val = argv[i];
 
 		*env = (i == 2) ? '=' : ' ';
 		while ((*++env = *val++) != '\0');
@@ -373,7 +377,7 @@ int fw_setenv (int argc, char *argv[])
   WRITE_FLASH:
 
 	/* Update CRC */
-	environment.crc = crc32 (0, environment.data, ENV_SIZE);
+	environment.crc = crc32 (0, (uint8_t*) environment.data, ENV_SIZE);
 
 	/* write environment back to flash */
 	if (flash_io (O_RDWR)) {
@@ -569,7 +573,7 @@ static int flash_io (int mode)
  * If the names match, return the value of s2, else NULL.
  */
 
-static uchar *envmatch (uchar * s1, uchar * s2)
+static char *envmatch (char * s1, char * s2)
 {
 
 	while (*s1 == *s2++)
@@ -586,10 +590,10 @@ static uchar *envmatch (uchar * s1, uchar * s2)
 static int env_init (void)
 {
 	int crc1, crc1_ok;
-	uchar *addr1;
+	char *addr1;
 
 	int crc2, crc2_ok;
-	uchar flag1, flag2, *addr2;
+	char flag1, flag2, *addr2;
 
 	if (parse_config ())		/* should fill envdevices */
 		return 1;
@@ -608,7 +612,7 @@ static int env_init (void)
 		return (errno);
 	}
 
-	crc1_ok = ((crc1 = crc32 (0, environment.data, ENV_SIZE))
+	crc1_ok = ((crc1 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE))
 			   == environment.crc);
 	if (!HaveRedundEnv) {
 		if (!crc1_ok) {
@@ -632,7 +636,7 @@ static int env_init (void)
 			return (errno);
 		}
 
-		crc2_ok = ((crc2 = crc32 (0, environment.data, ENV_SIZE))
+		crc2_ok = ((crc2 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE))
 				   == environment.crc);
 		flag2 = environment.flags;
 
diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index 13c45a2..58607de 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -47,8 +47,8 @@
 	"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " 	\
 	"bootm"
 
-extern		void  fw_printenv(int argc, char *argv[]);
-extern unsigned char *fw_getenv  (unsigned char *name);
-extern		int   fw_setenv  (int argc, char *argv[]);
+extern void  fw_printenv(int argc, char *argv[]);
+extern char *fw_getenv  (char *name);
+extern int fw_setenv  (int argc, char *argv[]);
 
 extern unsigned	long  crc32	 (unsigned long, const unsigned char *, unsigned);



Viele Gr??e / Best regards

Markus Klotzb?cher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27  9:23   ` Markus Klotzbücher
@ 2007-11-27 15:34     ` Ben Warren
  2007-11-27 20:33       ` Markus Klotzbücher
  2007-11-27 22:06       ` Wolfgang Denk
  2008-01-09  7:51     ` Wolfgang Denk
  1 sibling, 2 replies; 13+ messages in thread
From: Ben Warren @ 2007-11-27 15:34 UTC (permalink / raw)
  To: u-boot

Markus Klotzb?cher wrote:
> Dear Ben, Wolfang,
>
> Wolfgang Denk <wd@denx.de> writes:
>
>   
>> In message <87r6idhs49.fsf@denx.de> you wrote:
>>
>> Hm... this is only the "correct mtd header" if you are building for
>> somewhat recent versions of the Linux kernel - if you want to support
>> his on older versions (using older versions of MTD code) this will
>> break.
>>     
>
> I see.
>
>   
>> I suggest we optionally provide a build option to allow  to  use  the
>> old  include files for systems that still need it (as a separate make
>> target, for example).
>>     
>
> How about the following:
>
> This patch updates the fw_printenv/fw_setenv userspace tool to include
> the correct MTD header in order to compile against current kernel
> headers. Backward compatibility is preserved by introducing an option
> MTD_VERSION which can be set to "old" for compilation using the old MTD
> headers. Along with this a number of warnings are fixed.
>   
Sounds good to me.  It'd be cooler if make could detect the 
presence/absence of <linux/mtd-user.h>, but I'm not enough of a build 
system whiz to know how to do that.

A couple of additional requests:

1.  Can you also please add the other part of my patch that 
creates/destroys the 'fw_setenv' symbolic link?  It's a bit annoying 
that the documentation mentions the 'fw_setenv' utility, but it doesn't 
really exist without a bit of help.

2.  Please include changes to the relevant documentation (README + wiki) 
so that people know to when and how to set MTD_VERSION.  This may 
prevent a few 'RTFM' e-mails.

regards,
Ben

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27 15:34     ` Ben Warren
@ 2007-11-27 20:33       ` Markus Klotzbücher
  2007-11-27 20:46         ` Ben Warren
  2007-11-27 20:56         ` Jerry Van Baren
  2007-11-27 22:06       ` Wolfgang Denk
  1 sibling, 2 replies; 13+ messages in thread
From: Markus Klotzbücher @ 2007-11-27 20:33 UTC (permalink / raw)
  To: u-boot

Hi Ben,

Ben Warren <bwarren@qstreams.com> writes:

> Markus Klotzb?cher wrote:
>> How about the following:
>>
>> This patch updates the fw_printenv/fw_setenv userspace tool to include
>> the correct MTD header in order to compile against current kernel
>> headers. Backward compatibility is preserved by introducing an option
>> MTD_VERSION which can be set to "old" for compilation using the old MTD
>> headers. Along with this a number of warnings are fixed.
>>
> Sounds good to me.  It'd be cooler if make could detect the
> presence/absence of <linux/mtd-user.h>, but I'm not enough of a build
> system whiz to know how to do that.

I'm afraid nor am I. Suggestions welcome.

> A couple of additional requests:
>
> 1.  Can you also please add the other part of my patch that
> creates/destroys the 'fw_setenv' symbolic link?  It's a bit annoying
> that the documentation mentions the 'fw_setenv' utility, but it
> doesn't really exist without a bit of help.

Agreed that this confusing, but does a symbolic link really help?
Wouldn't it be better to simply describe the rationale in the
documentation instead?

> 2.  Please include changes to the relevant documentation (README +
> wiki) so that people know to when and how to set MTD_VERSION.  This
> may prevent a few 'RTFM' e-mails.

The patch I posted updates the README in tools/env/ and I'll update the
wiki as soon as the patch is accepted. I wonder though, if the
env/tools/README shouldn't be move into the main README. It's rather
hidden where it is right now.

Viele Gr??e / Best regards

Markus Klotzb?cher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27 20:33       ` Markus Klotzbücher
@ 2007-11-27 20:46         ` Ben Warren
  2007-11-27 20:56         ` Jerry Van Baren
  1 sibling, 0 replies; 13+ messages in thread
From: Ben Warren @ 2007-11-27 20:46 UTC (permalink / raw)
  To: u-boot

Markus Klotzb?cher wrote:
> Hi Ben,
>
> Ben Warren <bwarren@qstreams.com> writes:
>
>   
>> Markus Klotzb?cher wrote:
>>     
>>> How about the following:
>>>
>>> This patch updates the fw_printenv/fw_setenv userspace tool to include
>>> the correct MTD header in order to compile against current kernel
>>> headers. Backward compatibility is preserved by introducing an option
>>> MTD_VERSION which can be set to "old" for compilation using the old MTD
>>> headers. Along with this a number of warnings are fixed.
>>>
>>>       
>> Sounds good to me.  It'd be cooler if make could detect the
>> presence/absence of <linux/mtd-user.h>, but I'm not enough of a build
>> system whiz to know how to do that.
>>     
>
> I'm afraid nor am I. Suggestions welcome.
>
>   
>> A couple of additional requests:
>>
>> 1.  Can you also please add the other part of my patch that
>> creates/destroys the 'fw_setenv' symbolic link?  It's a bit annoying
>> that the documentation mentions the 'fw_setenv' utility, but it
>> doesn't really exist without a bit of help.
>>     
>
> Agreed that this confusing, but does a symbolic link really help?
> Wouldn't it be better to simply describe the rationale in the
> documentation instead?
>
>   
I like the symbolic link, because when done you end up with an 
executable called 'fw_setenv' and move it to the file system with 'cp 
-a'.  I don't care too much though, as long as it's documented somewhere 
where people will see it.  Personally, I went through a "where the eff 
is the fw_setenv utility that's mentioned in the documentation" and 
eventually looked in the source code and noticed that it uses 
argv[0]...  Sparing others this grief would be nice.
>> 2.  Please include changes to the relevant documentation (README +
>> wiki) so that people know to when and how to set MTD_VERSION.  This
>> may prevent a few 'RTFM' e-mails.
>>     
>
> The patch I posted updates the README in tools/env/ and I'll update the
> wiki as soon as the patch is accepted. I wonder though, if the
> env/tools/README shouldn't be move into the main README. It's rather
> hidden where it is right now.
>
>   
Yeah, either there or in /doc.  It's badly hidden now.
> Viele Gr??e / Best regards
>
> Markus Klotzb?cher
>
>   
cheers,
B-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27 20:33       ` Markus Klotzbücher
  2007-11-27 20:46         ` Ben Warren
@ 2007-11-27 20:56         ` Jerry Van Baren
  2007-11-27 22:12           ` Wolfgang Denk
  1 sibling, 1 reply; 13+ messages in thread
From: Jerry Van Baren @ 2007-11-27 20:56 UTC (permalink / raw)
  To: u-boot

Markus Klotzb?cher wrote:
> Hi Ben,
> 
> Ben Warren <bwarren@qstreams.com> writes:
> 
>> Markus Klotzb?cher wrote:
>>> How about the following:
>>>
>>> This patch updates the fw_printenv/fw_setenv userspace tool to include
>>> the correct MTD header in order to compile against current kernel
>>> headers. Backward compatibility is preserved by introducing an option
>>> MTD_VERSION which can be set to "old" for compilation using the old MTD
>>> headers. Along with this a number of warnings are fixed.
>>>
>> Sounds good to me.  It'd be cooler if make could detect the
>> presence/absence of <linux/mtd-user.h>, but I'm not enough of a build
>> system whiz to know how to do that.
> 
> I'm afraid nor am I. Suggestions welcome.

I'm not sure it is a reasonable suggestion, but something like...

ifeq ($(strip $(wildcard /usr/include/mtd/mtd-user.h)),)
	MTD_VERSION=old
else
	MTD_VERSION=new
endif

This is using a hardcoded path for <linux/mtd-user.h> (odd, my system 
has it in a different place than Markus referenced - probably my 
ignorance or configuration).  This may be acceptable, or there may be a 
better way to do this.  (Use VPATH?  Things get complicated doing that.)

[snip]

> Viele Gr??e / Best regards
> 
> Markus Klotzb?cher

Best regards,
gvb

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27 15:34     ` Ben Warren
  2007-11-27 20:33       ` Markus Klotzbücher
@ 2007-11-27 22:06       ` Wolfgang Denk
  2007-11-27 22:30         ` Ben Warren
  1 sibling, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2007-11-27 22:06 UTC (permalink / raw)
  To: u-boot

In message <474C390C.8060007@qstreams.com> you wrote:
>
> Sounds good to me.  It'd be cooler if make could detect the 
> presence/absence of <linux/mtd-user.h>, but I'm not enough of a build 
> system whiz to know how to do that.

Where should he detect this? On the build host? Who says the target
uses the same kernel / MTD version? Who says you always want to build
for the same kernel / MTD version? 

I think auto-detection is basicly impossible (at least without making
the build depending on  the  knowledge  of  a  "corresponding"  Linux
kernel   tree,   and   I   think   Markus'   new   approach  is  more
straightforward.

> 1.  Can you also please add the other part of my patch that 
> creates/destroys the 'fw_setenv' symbolic link?  It's a bit annoying 
> that the documentation mentions the 'fw_setenv' utility, but it doesn't 
> really exist without a bit of help.
> 
> 2.  Please include changes to the relevant documentation (README + wiki) 
> so that people know to when and how to set MTD_VERSION.  This may 
> prevent a few 'RTFM' e-mails.

Agreed for README. The wiki cannot be "patched" like this. We can
Markus only make promise that he will update the information there,
too.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Doubt isn't the opposite of faith; it is an element of faith.
- Paul Tillich, German theologian and historian

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27 20:56         ` Jerry Van Baren
@ 2007-11-27 22:12           ` Wolfgang Denk
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfgang Denk @ 2007-11-27 22:12 UTC (permalink / raw)
  To: u-boot

In message <474C8472.4080706@ge.com> you wrote:
>
> I'm not sure it is a reasonable suggestion, but something like...
> 
> ifeq ($(strip $(wildcard /usr/include/mtd/mtd-user.h)),)
> 	MTD_VERSION=old
> else
> 	MTD_VERSION=new
> endif

Doesn't work. Who says my target uses the same MTD version as my build
host?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... The things love can drive a man to -- the  ecstasies,  the  mise-
ries,  the broken rules, the desperate chances, the glorious failures
and the glorious victories.
	-- McCoy, "Requiem for Methuselah", stardate 5843.7

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27 22:06       ` Wolfgang Denk
@ 2007-11-27 22:30         ` Ben Warren
  0 siblings, 0 replies; 13+ messages in thread
From: Ben Warren @ 2007-11-27 22:30 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <474C390C.8060007@qstreams.com> you wrote:
>   
>> Sounds good to me.  It'd be cooler if make could detect the 
>> presence/absence of <linux/mtd-user.h>, but I'm not enough of a build 
>> system whiz to know how to do that.
>>     
>
> Where should he detect this? On the build host? Who says the target
> uses the same kernel / MTD version? Who says you always want to build
> for the same kernel / MTD version? 
>
> I think auto-detection is basicly impossible (at least without making
> the build depending on  the  knowledge  of  a  "corresponding"  Linux
> kernel   tree,   and   I   think   Markus'   new   approach  is  more
> straightforward.
>
>   
Right.  I said it would be cool, not necessarily possible.  This brings 
up a problem with this utility - the version of headers that it's built 
against is at the mercy of however the cross compiler's set up, not 
necessarily against the one the user really wants.   Maybe we should 
force the user to define a path, and #error if it isn't defined.  This 
path could be added to C_INCLUDE_PATH and then we could do all sorts of 
Makefile trickery.  Just a thought...
>> 1.  Can you also please add the other part of my patch that 
>> creates/destroys the 'fw_setenv' symbolic link?  It's a bit annoying 
>> that the documentation mentions the 'fw_setenv' utility, but it doesn't 
>> really exist without a bit of help.
>>
>> 2.  Please include changes to the relevant documentation (README + wiki) 
>> so that people know to when and how to set MTD_VERSION.  This may 
>> prevent a few 'RTFM' e-mails.
>>     
>
> Agreed for README. The wiki cannot be "patched" like this. We can
> Markus only make promise that he will update the information there,
> too.
>
>
>   
Sounds good.  Promises are fun.

regards,
Ben

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2007-11-27  9:23   ` Markus Klotzbücher
  2007-11-27 15:34     ` Ben Warren
@ 2008-01-09  7:51     ` Wolfgang Denk
  2008-01-09 15:19       ` Markus Klotzbücher
  1 sibling, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2008-01-09  7:51 UTC (permalink / raw)
  To: u-boot

Dear Markus,

in message <871wacjb3r.fsf@denx.de> you wrote:
> 
> > I suggest we optionally provide a build option to allow  to  use  the
> > old  include files for systems that still need it (as a separate make
> > target, for example).
> 
> How about the following:
> 
> This patch updates the fw_printenv/fw_setenv userspace tool to include
> the correct MTD header in order to compile against current kernel
> headers. Backward compatibility is preserved by introducing an option
> MTD_VERSION which can be set to "old" for compilation using the old MTD
> headers. Along with this a number of warnings are fixed.
> 
> Signed-off-by: Markus Klotzbuecher <mk@denx.de>

Applied. Thanks again.

Would you please also update the wiki docs? TIA...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Who is the oldest inhabitant of this village?"
"We haven't got one; we had one, but he died three weeks ago."

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again
  2008-01-09  7:51     ` Wolfgang Denk
@ 2008-01-09 15:19       ` Markus Klotzbücher
  0 siblings, 0 replies; 13+ messages in thread
From: Markus Klotzbücher @ 2008-01-09 15:19 UTC (permalink / raw)
  To: u-boot


Wolfgang Denk <wd@denx.de> writes:

> in message <871wacjb3r.fsf@denx.de> you wrote:

>> This patch updates the fw_printenv/fw_setenv userspace tool to include
>> the correct MTD header in order to compile against current kernel
>> headers. Backward compatibility is preserved by introducing an option
>> MTD_VERSION which can be set to "old" for compilation using the old MTD
>> headers. Along with this a number of warnings are fixed.
>> 
>> Signed-off-by: Markus Klotzbuecher <mk@denx.de>
>
> Applied. Thanks again.
>
> Would you please also update the wiki docs? TIA...

Sure, I updated the following site in the wiki:

http://www.denx.de/wiki/DULG/HowCanIAccessUBootEnvironmentVariablesInLinux

Is this the only page or did I miss something?

Best regards

Markus Klotzb?cher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-01-09 15:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-26 16:46 [U-Boot-Users] [PATCH]: tools: fix fw_printenv tool to compile again Markus Klotzbücher
2007-11-26 17:04 ` Ben Warren
2007-11-26 22:19 ` Wolfgang Denk
2007-11-27  9:23   ` Markus Klotzbücher
2007-11-27 15:34     ` Ben Warren
2007-11-27 20:33       ` Markus Klotzbücher
2007-11-27 20:46         ` Ben Warren
2007-11-27 20:56         ` Jerry Van Baren
2007-11-27 22:12           ` Wolfgang Denk
2007-11-27 22:06       ` Wolfgang Denk
2007-11-27 22:30         ` Ben Warren
2008-01-09  7:51     ` Wolfgang Denk
2008-01-09 15:19       ` Markus Klotzbücher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox