Re: [PATCH] x86_64, i386: Add command line length to boot protocol

From: Vivek Goyal
Date: Wed Mar 07 2007 - 05:06:19 EST


On Tue, Mar 06, 2007 at 07:14:30PM +0100, Bernhard Walle wrote:
> Because the command line is increased to 2048 characters after 2.6.21,
> it's not possible for boot loaders and userspace tools to determine the length
> of the command line the kernel can understand. The benefit of knowing the
> length is that users can be warned if the command line size is too long which
> prevents surprise if things don't work after bootup.

This makes sense to me. It can be used in kexec bootloader to warn user
if command line size exceeds than supported by kernel.

>
> This patch updates the boot protocol to contain a field called
> "cmdline_size" that contain the length of the command line (excluding
> the terminating zero).
>
> The patch also adds missing fields (of protocol version 2.05) to the x86_64
> setup code.

Today I have posted the x86_64 relocatable kernel patches which also fill
in missing 2.05 fields for x86_64.

[..]
> #define SIG1 0xAA55
> @@ -81,7 +82,7 @@ start:
> # This is the setup header, and it must start at %cs:2 (old 0x9020:2)
>
> .ascii "HdrS" # header signature
> - .word 0x0205 # header version number (>= 0x0105)
> + .word 0x0206 # header version number (>= 0x0105)
> # or else old loadlin-1.5 will fail)
> realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
> start_sys_seg: .word SYSSEG
> @@ -171,6 +172,10 @@ relocatable_kernel: .byte 0
> pad2: .byte 0
> pad3: .word 0
>
> +cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
> + #added with boot protocol
> + #version 2.06
> +

I think you will not require more than two bytes to represent supported
command line size so you can use replace pad3 and use these two bytes. These
were anyway padding bytes to be used for other requirements.

[..]
> # or else old loadlin-1.5 will fail)
> realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
> start_sys_seg: .word SYSSEG
> @@ -155,6 +156,18 @@ cmd_line_ptr: .long 0 # (Header versio
> # low memory 0x10000 or higher.
>
> ramdisk_max: .long 0xffffffff
> +
> +kernel_alignment: .long CONFIG_PHYSICAL_START #physical addr alignment
> + #(not relocatable =>
> + #fixed start == alignment)
> +

This is wrong. CONFIG_PHYSICAL_START is not alignment. On x86_64 alignment
required is 2MB. (0x200000).

Thanks
Vivek
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/