Skip to contentSkip to conversation

default filename of tftp and nfs

PATCH In review Hiroshi Ito 2 participants 3 messages Dec 5, 2004 – Aug 3, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 default filename of tftp and nfs

Hello,

default filename of tftp and nfs has different value between little endian machine and big one.

This patch fixes endian problem.

Patch is for current cvs.

--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256 -------------- next part --------------
Index: common/command.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/common/command.c,v retrieving revision 1.17

command.c +2 -2
diff -u -b -B -w -p -r1.17 command.c
@@ -136,9 +136,9 @@ do_test (cmd_tbl_t *cmdtp, int flag, int
 
 		if (adv == 2) {
 			if (strcmp(ap[0], "-z") == 0)
-				expr = strlen(ap[1]) == 0 ? 0 : 1;
-			else if (strcmp(ap[0], "-n") == 0)
 				expr = strlen(ap[1]) == 0 ? 1 : 0;
+			else if (strcmp(ap[0], "-n") == 0)
+				expr = strlen(ap[1]) == 0 ? 0 : 1;
 			else {
 				expr = 1;
 				break;
#1 lore raw

Sorry, I attached wrong file.

Here is a correct patch.

From: Hiroshi Ito <[email protected]>
Subject: [Patch] default filename of tftp and nfs
Date: Mon, 06 Dec 2004 03:35:22 +0900
Message-Id: <[email protected]>

Quoted 7 lines

Hello,

default filename of tftp and nfs has different value between little endian machine and big one.

This patch fixes endian problem.

Quoted 7 lines

Patch is for current cvs.

--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256

-------------- next part --------------
Index: net/nfs.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/net/nfs.c,v
retrieving revision 1.8

nfs.c +4 -6
diff -u -b -B -w -p -r1.8 nfs.c
@@ -703,13 +703,11 @@ NfsStart (void)
 	}
 
 	if (BootFile[0] == '\0') {
-		IPaddr_t OurIP = ntohl (NetOurIP);
-
 		sprintf (default_filename, "/nfsroot/%02lX%02lX%02lX%02lX.img",
-			OurIP & 0xFF,
-			(OurIP >>  8) & 0xFF,
-			(OurIP >> 16) & 0xFF,
-			(OurIP >> 24) & 0xFF	);
+			NetOurIP & 0xFF,
+			(NetOurIP >>  8) & 0xFF,
+			(NetOurIP >> 16) & 0xFF,
+			(NetOurIP >> 24) & 0xFF	);
 		strcpy (nfs_path, default_filename);
 
 		printf ("*** Warning: no boot file name; using '%s'\n",

Index: net/tftp.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/net/tftp.c,v
retrieving revision 1.9

tftp.c +4 -6
diff -u -b -B -w -p -r1.9 tftp.c
@@ -302,13 +302,11 @@ void
 TftpStart (void)
 {
 	if (BootFile[0] == '\0') {
-		IPaddr_t OurIP = ntohl(NetOurIP);
-
 		sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
-			OurIP & 0xFF,
-			(OurIP >>  8) & 0xFF,
-			(OurIP >> 16) & 0xFF,
-			(OurIP >> 24) & 0xFF	);
+			NetOurIP & 0xFF,
+			(NetOurIP >>  8) & 0xFF,
+			(NetOurIP >> 16) & 0xFF,
+			(NetOurIP >> 24) & 0xFF	);
 		tftp_filename = default_filename;
 
 		printf ("*** Warning: no boot file name; using '%s'\n",
#2 lore raw
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 5 lines

default filename of tftp and nfs has different value between little endian machine and big one.

This patch fixes endian problem.

Added, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Confound these ancestors.... They've stolen our best ideas!"
- Ben Jonson