[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.
This commit is contained in:
parent
4c85017968
commit
ac28d054c8
|
@ -76,6 +76,8 @@ struct bzimage_exec_context {
|
||||||
size_t rm_heap;
|
size_t rm_heap;
|
||||||
/** Command line (offset from rm_kernel) */
|
/** Command line (offset from rm_kernel) */
|
||||||
size_t rm_cmdline;
|
size_t rm_cmdline;
|
||||||
|
/** Command line maximum length */
|
||||||
|
size_t cmdline_size;
|
||||||
/** Video mode */
|
/** Video mode */
|
||||||
unsigned int vid_mode;
|
unsigned int vid_mode;
|
||||||
/** Memory limit */
|
/** Memory limit */
|
||||||
|
@ -162,8 +164,8 @@ static int bzimage_set_cmdline ( struct image *image,
|
||||||
|
|
||||||
/* Copy command line down to real-mode portion */
|
/* Copy command line down to real-mode portion */
|
||||||
cmdline_len = ( strlen ( cmdline ) + 1 );
|
cmdline_len = ( strlen ( cmdline ) + 1 );
|
||||||
if ( cmdline_len > BZI_CMDLINE_SIZE )
|
if ( cmdline_len > exec_ctx->cmdline_size )
|
||||||
cmdline_len = BZI_CMDLINE_SIZE;
|
cmdline_len = exec_ctx->cmdline_size;
|
||||||
copy_to_user ( exec_ctx->rm_kernel, exec_ctx->rm_cmdline,
|
copy_to_user ( exec_ctx->rm_kernel, exec_ctx->rm_cmdline,
|
||||||
cmdline, cmdline_len );
|
cmdline, cmdline_len );
|
||||||
DBGC ( image, "bzImage %p command line \"%s\"\n", image, cmdline );
|
DBGC ( image, "bzImage %p command line \"%s\"\n", image, cmdline );
|
||||||
|
@ -320,6 +322,12 @@ static int bzimage_exec ( struct image *image ) {
|
||||||
} else {
|
} else {
|
||||||
exec_ctx.mem_limit = BZI_INITRD_MAX;
|
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 */
|
/* Parse command line for bootloader parameters */
|
||||||
if ( ( rc = bzimage_parse_cmdline ( image, &exec_ctx, cmdline ) ) != 0)
|
if ( ( rc = bzimage_parse_cmdline ( image, &exec_ctx, cmdline ) ) != 0)
|
||||||
|
|
|
@ -62,6 +62,14 @@ struct bzimage_header {
|
||||||
uint32_t cmd_line_ptr;
|
uint32_t cmd_line_ptr;
|
||||||
/** Highest legal initrd address */
|
/** Highest legal initrd address */
|
||||||
uint32_t initrd_addr_max;
|
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 ));
|
} __attribute__ (( packed ));
|
||||||
|
|
||||||
/** Offset of bzImage header within kernel image */
|
/** Offset of bzImage header within kernel image */
|
||||||
|
|
Reference in New Issue