Patchwork [U-Boot,05/10] pxe: use bootz instead of bootm when enabled

login
register
mail settings
Submitter Rob Herring
Date Dec. 3, 2012, 3 a.m.
Message ID <1354503629-25621-6-git-send-email-robherring2@gmail.com>
Download mbox | patch
Permalink /patch/203273/
State Accepted
Delegated to: Joe Hershberger
Headers show

Comments

Rob Herring - Dec. 3, 2012, 3 a.m.
From: Rob Herring <rob.herring@calxeda.com>

Standard pxelinux servers would use zImage rather than u-boot image
format, so use bootz instead of bootm if enabled.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 common/cmd_pxe.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Wolfgang Denk - Dec. 3, 2012, 12:22 p.m.
Dear Rob Herring,

In message <1354503629-25621-6-git-send-email-robherring2@gmail.com> you wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> Standard pxelinux servers would use zImage rather than u-boot image
> format, so use bootz instead of bootm if enabled.

Why would this be the case?  We should encourage the use of a
checksum-protected image format, i. e. the default setting should be
for FIT images, followed by legacy U-Boot images, and fall back on
archaic formats like zImage only when there is really no other way.


Best regards,

Wolfgang Denk
Rob Herring - Dec. 3, 2012, 2:16 p.m.
On 12/03/2012 06:22 AM, Wolfgang Denk wrote:
> Dear Rob Herring,
> 
> In message <1354503629-25621-6-git-send-email-robherring2@gmail.com> you wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Standard pxelinux servers would use zImage rather than u-boot image
>> format, so use bootz instead of bootm if enabled.
> 
> Why would this be the case?  We should encourage the use of a
> checksum-protected image format, i. e. the default setting should be
> for FIT images, followed by legacy U-Boot images, and fall back on
> archaic formats like zImage only when there is really no other way.
> 

There is no way for the client to tell the server what kind of client it
is and therefore what kind of image to serve. There is the dhcp client
id string, but that can't be used in situations were you don't control
the dhcp server setup. That problem is also the reason for patch 9 where
you can't distinguish between x86 and ARM for "default".

When we have systems that boot from UEFI, they will certainly not use
u-boot image formats and we don't want to have different setup based on
the client/bootloader type.

I can actually just make this run-time rather than compile time. When
do_bootm returns when it fails to find a valid u-boot image, I can just
call do_bootz.

Rob

Patch

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 02ed645..cad5d36 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -579,6 +579,7 @@  static int label_localboot(struct pxe_label *label)
 static int label_boot(struct pxe_label *label)
 {
 	char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
+	char initrd_str[22];
 	int bootm_argc = 3;
 
 	label_print(label);
@@ -604,7 +605,10 @@  static int label_boot(struct pxe_label *label)
 			return 1;
 		}
 
-		bootm_argv[2] = getenv("ramdisk_addr_r");
+		bootm_argv[2] = initrd_str;
+		strcpy(bootm_argv[2], getenv("ramdisk_addr_r"));
+		strcat(bootm_argv[2], ":");
+		strcat(bootm_argv[2], getenv("filesize"));
 	} else {
 		bootm_argv[2] = "-";
 	}
@@ -648,7 +652,11 @@  static int label_boot(struct pxe_label *label)
 	if (bootm_argv[3])
 		bootm_argc = 4;
 
+#ifdef CONFIG_CMD_BOOTZ
+	do_bootz(NULL, 0, bootm_argc, bootm_argv);
+#else
 	do_bootm(NULL, 0, bootm_argc, bootm_argv);
+#endif
 	return 1;
 }