summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2008-06-12 03:19:10 +0200
committerMichael Brown2008-06-12 03:19:10 +0200
commitac28d054c847e87ed6edb9549e04b86476d7ef72 (patch)
tree9c5e4f35e5fafd69f1537bcefcfb87defe7ebfa0 /src
parent[cmdline] Remove arbitrary limit on the length of image command lines (diff)
downloadipxe-ac28d054c847e87ed6edb9549e04b86476d7ef72.tar.gz
ipxe-ac28d054c847e87ed6edb9549e04b86476d7ef72.tar.xz
ipxe-ac28d054c847e87ed6edb9549e04b86476d7ef72.zip
[bzimage] Support kernel command lines of greater than 256 characters
2.6.22+ kernels have an extra field in the bzimage_header structure to indicate the maximum permitted command-line length. Use this if it is available.
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/image/bzimage.c12
-rw-r--r--src/arch/i386/include/bzimage.h8
2 files changed, 18 insertions, 2 deletions
diff --git a/src/arch/i386/image/bzimage.c b/src/arch/i386/image/bzimage.c
index ed9d286d2..38443f5be 100644
--- a/src/arch/i386/image/bzimage.c
+++ b/src/arch/i386/image/bzimage.c
@@ -76,6 +76,8 @@ struct bzimage_exec_context {
size_t rm_heap;
/** Command line (offset from rm_kernel) */
size_t rm_cmdline;
+ /** Command line maximum length */
+ size_t cmdline_size;
/** Video mode */
unsigned int vid_mode;
/** Memory limit */
@@ -162,8 +164,8 @@ static int bzimage_set_cmdline ( struct image *image,
/* Copy command line down to real-mode portion */
cmdline_len = ( strlen ( cmdline ) + 1 );
- if ( cmdline_len > BZI_CMDLINE_SIZE )
- cmdline_len = BZI_CMDLINE_SIZE;
+ if ( cmdline_len > exec_ctx->cmdline_size )
+ cmdline_len = exec_ctx->cmdline_size;
copy_to_user ( exec_ctx->rm_kernel, exec_ctx->rm_cmdline,
cmdline, cmdline_len );
DBGC ( image, "bzImage %p command line \"%s\"\n", image, cmdline );
@@ -320,6 +322,12 @@ static int bzimage_exec ( struct image *image ) {
} else {
exec_ctx.mem_limit = BZI_INITRD_MAX;
}
+ if ( bzhdr.version >= 0x0206 ) {
+ exec_ctx.cmdline_size = bzhdr.cmdline_size;
+ } else {
+ exec_ctx.cmdline_size = BZI_CMDLINE_SIZE;
+ }
+ DBG ( "cmdline_size = %zd\n", exec_ctx.cmdline_size );
/* Parse command line for bootloader parameters */
if ( ( rc = bzimage_parse_cmdline ( image, &exec_ctx, cmdline ) ) != 0)
diff --git a/src/arch/i386/include/bzimage.h b/src/arch/i386/include/bzimage.h
index 609e83625..aee058ae3 100644
--- a/src/arch/i386/include/bzimage.h
+++ b/src/arch/i386/include/bzimage.h
@@ -62,6 +62,14 @@ struct bzimage_header {
uint32_t cmd_line_ptr;
/** Highest legal initrd address */
uint32_t initrd_addr_max;
+ /** Physical addr alignment required for kernel */
+ uint32_t kernel_alignment;
+ /** Whether kernel is relocatable or not */
+ uint8_t relocatable_kernel;
+ /** Unused */
+ uint8_t pad2[3];
+ /** Maximum size of the kernel command line */
+ uint32_t cmdline_size;
} __attribute__ (( packed ));
/** Offset of bzImage header within kernel image */