Patchwork [U-Boot,RFC,3/4] x86: Allow cmdline setup in setup_zimage() to be optional

login
register
mail settings
Submitter Simon Glass
Date Jan. 12, 2013, 5:48 p.m.
Message ID <1358012928-2112-4-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/211528/
State RFC
Headers show

Comments

Simon Glass - Jan. 12, 2013, 5:48 p.m.
If we are passing this using the device tree then we may not want to
set this up here. TBD.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/x86/lib/zimage.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
Graeme Russ - Jan. 14, 2013, 11:19 p.m.
Hi Simon,

On Sun, Jan 13, 2013 at 4:48 AM, Simon Glass <sjg@chromium.org> wrote:
> If we are passing this using the device tree then we may not want to
> set this up here. TBD.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/x86/lib/zimage.c |   21 ++++++++++++---------
>  1 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> index 8819afd..9fc450a 100644
> --- a/arch/x86/lib/zimage.c
> +++ b/arch/x86/lib/zimage.c
> @@ -269,18 +269,21 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>                 hdr->loadflags |= HEAP_FLAG;
>         }
>
> -       if (bootproto >= 0x0202) {
> -               hdr->cmd_line_ptr = (uintptr_t)cmd_line;
> -       } else if (bootproto >= 0x0200) {
> -               setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
> -               setup_base->screen_info.cl_offset =
> -                       (uintptr_t)cmd_line - (uintptr_t)setup_base;
> +       if (cmd_line) {
> +               if (bootproto >= 0x0202) {
> +                       hdr->cmd_line_ptr = (uintptr_t)cmd_line;
> +               } else if (bootproto >= 0x0200) {

To be honest, I think it would be simpler if older kernels are just
completely unsupported and get rid of all this logic

Regards,

Graeme

Patch

diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 8819afd..9fc450a 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -269,18 +269,21 @@  int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 		hdr->loadflags |= HEAP_FLAG;
 	}
 
-	if (bootproto >= 0x0202) {
-		hdr->cmd_line_ptr = (uintptr_t)cmd_line;
-	} else if (bootproto >= 0x0200) {
-		setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
-		setup_base->screen_info.cl_offset =
-			(uintptr_t)cmd_line - (uintptr_t)setup_base;
+	if (cmd_line) {
+		if (bootproto >= 0x0202) {
+			hdr->cmd_line_ptr = (uintptr_t)cmd_line;
+		} else if (bootproto >= 0x0200) {
+			setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
+			setup_base->screen_info.cl_offset =
+				(uintptr_t)cmd_line - (uintptr_t)setup_base;
+
+			hdr->setup_move_size = 0x9100;
+		}
 
-		hdr->setup_move_size = 0x9100;
+		/* build command line at COMMAND_LINE_OFFSET */
+		build_command_line(cmd_line, auto_boot);
 	}
 
-	/* build command line at COMMAND_LINE_OFFSET */
-	build_command_line(cmd_line, auto_boot);
 	return 0;
 }