Allow the initrd to be specified on a separate line syslinux-3.71-pre4
authorH. Peter Anvin <hpa@zytor.com>
Fri, 4 Jul 2008 01:45:42 +0000 (18:45 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 4 Jul 2008 01:45:42 +0000 (18:45 -0700)
Allow the initrd to be specified on a separate line from command-line
options (append).  This apparently can help certain tools.

NEWS
com32/menu/readconfig.c
core/extlinux.asm
core/isolinux.asm
core/keywords
core/keywords.inc
core/ldlinux.asm
core/parseconfig.inc
core/pxelinux.asm
core/runkernel.inc

diff --git a/NEWS b/NEWS
index bf9865a..3e01ea2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ Changes in 3.71:
          point.
        * MEMDISK: be smarter about incompletely disabled floppies in
          the BIOS and about being the only BIOS.
+       * Optionally allow initrd to be specified on a separate line
+         rather than as part of the "append" line.  This is not
+         recommended, but apparently makes life easier for some tools.
 
 Changes in 3.70:
        * PXELINUX: Support enhanced capabilities when running on top
index 1020193..e26105a 100644 (file)
@@ -200,6 +200,7 @@ struct labeldata {
   const char *kernel;
   enum kernel_type type;
   const char *append;
+  const char *initrd;
   const char *menulabel;
   const char *passwd;
   char *helptext;
@@ -222,6 +223,7 @@ clear_label_data(struct labeldata *ld)
   refstr_put(ld->label);
   refstr_put(ld->kernel);
   refstr_put(ld->append);
+  refstr_put(ld->initrd);
   refstr_put(ld->menulabel);
   refstr_put(ld->passwd);
 
@@ -324,6 +326,9 @@ record(struct menu *m, struct labeldata *ld, const char *append)
       ipp = ipoptions;
       *ipp = '\0';
 
+      if (ld->initrd)
+       ipp += sprintf(ipp, " initrd=%s", ld->initrd);
+
       if (ld->ipappend) {
        ipappend = syslinux_ipappend_strings();
        for (i = 0; i < ipappend->count; i++) {
@@ -862,6 +867,14 @@ static void parse_config_file(FILE *f)
        refstr_put(append);
        append = a;
       }
+    } else if ( looking_at(p, "initrd") ) {
+      const char *a = refstrdup(skipspace(p+6));
+      if ( ld.label ) {
+       refstr_put(ld.initrd);
+       ld.initrd = a;
+      } else {
+       /* Ignore */
+      }
     } else if ( looking_at(p, "label") ) {
       p = skipspace(p+5);
       record(m, &ld, append);
@@ -870,6 +883,7 @@ static void parse_config_file(FILE *f)
       ld.type      = KT_KERNEL;
       ld.passwd    = NULL;
       ld.append    = NULL;
+      ld.initrd    = NULL;
       ld.menulabel = NULL;
       ld.helptext  = NULL;
       ld.ipappend  = ipappend;
index 02c2e22..bacb8a2 100644 (file)
@@ -1550,13 +1550,6 @@ err_bootfailed   db CR, LF, 'Boot failed: please change disks and press '
 config_name    db 'extlinux.conf',0            ; Unmangled form
 
 ;
-; Command line options we'd like to take a look at
-;
-; mem= and vga= are handled as normal 32-bit integer values
-initrd_cmd     db 'initrd='
-initrd_cmd_len equ 7
-
-;
 ; Config file keyword table
 ;
 %include "keywords.inc"
index 5452012..a3eb9ee 100644 (file)
@@ -1472,12 +1472,6 @@ dbg_isodir_msg   db 'isolinux directory at LBA = ', 0
 dbg_config_msg db 'About to load config file...', CR, LF, 0
 dbg_configok_msg       db 'Configuration file opened...', CR, LF, 0
 %endif
-;
-; Command line options we'd like to take a look at
-;
-; mem= and vga= are handled as normal 32-bit integer values
-initrd_cmd     db 'initrd='
-initrd_cmd_len equ 7
 
 ;
 ; Config file keyword table
index d7d8fa6..16fe772 100644 (file)
@@ -2,6 +2,7 @@ menu
 text
 include
 append
+initrd
 config
 default
 display
index b6a701b..65b657c 100644 (file)
@@ -49,6 +49,7 @@ keywd_table:
                keyword text,           pc_text
                keyword include,        pc_opencmd,     pc_include
                keyword append,         pc_append
+               keyword initrd,         pc_filename,    InitRD
                keyword default,        pc_default
                keyword display,        pc_opencmd,     get_msg_file
                keyword font,           pc_filecmd,     loadfont
@@ -74,19 +75,19 @@ keywd_table:
                keyword onerror,        pc_onerror
                keyword allowoptions,   pc_setint16,    AllowOptions
                keyword noescape,       pc_setint16,    NoEscape
-               keyword f1,             pc_fkey,        FKeyN(1)
-               keyword f2,             pc_fkey,        FKeyN(2)
-               keyword f3,             pc_fkey,        FKeyN(3)
-               keyword f4,             pc_fkey,        FKeyN(4)
-               keyword f5,             pc_fkey,        FKeyN(5)
-               keyword f6,             pc_fkey,        FKeyN(6)
-               keyword f7,             pc_fkey,        FKeyN(7)
-               keyword f8,             pc_fkey,        FKeyN(8)
-               keyword f9,             pc_fkey,        FKeyN(9)
-               keyword f10,            pc_fkey,        FKeyN(10)
-               keyword f0,             pc_fkey,        FKeyN(10)
-               keyword f11,            pc_fkey,        FKeyN(11)
-               keyword f12,            pc_fkey,        FKeyN(12)
+               keyword f1,             pc_filename,    FKeyN(1)
+               keyword f2,             pc_filename,    FKeyN(2)
+               keyword f3,             pc_filename,    FKeyN(3)
+               keyword f4,             pc_filename,    FKeyN(4)
+               keyword f5,             pc_filename,    FKeyN(5)
+               keyword f6,             pc_filename,    FKeyN(6)
+               keyword f7,             pc_filename,    FKeyN(7)
+               keyword f8,             pc_filename,    FKeyN(8)
+               keyword f9,             pc_filename,    FKeyN(9)
+               keyword f10,            pc_filename,    FKeyN(10)
+               keyword f0,             pc_filename,    FKeyN(10)
+               keyword f11,            pc_filename,    FKeyN(11)
+               keyword f12,            pc_filename,    FKeyN(12)
 %if IS_PXELINUX
                keyword ipappend,       pc_ipappend
 %endif
index 9cf1c03..2be865d 100644 (file)
@@ -1716,13 +1716,6 @@ syslinux_cfg3    db '/'                          ; /syslinux.cfg
 config_name    db 'syslinux.cfg', 0            ; syslinux.cfg
 
 ;
-; Command line options we'd like to take a look at
-;
-; mem= and vga= are handled as normal 32-bit integer values
-initrd_cmd     db 'initrd='
-initrd_cmd_len equ 7
-
-;
 ; Config file keyword table
 ;
 %include "keywords.inc"
index 2ef9c3a..e004cab 100644 (file)
@@ -289,9 +289,9 @@ pc_serial:  call getint
                ret
 
 ;
-; "F"-key command
+; Store mangled filename command
 ;
-pc_fkey:       push ax
+pc_filename:   push ax
                call pc_getline
                pop di
                call mangle_name                ; Mangle file name
@@ -301,6 +301,7 @@ pc_fkey:    push ax
 ; "label" command
 ;
 pc_label:      call commit_vk                  ; Commit any current vkernel
+               mov byte [InitRD+NULLOFFSET],NULLFILE   ; No "initrd" statement
                mov di,VKernelBuf               ; Erase the vkernelbuf for better compression
                mov cx,(vk_size >> 1)
                xor ax,ax
@@ -392,10 +393,30 @@ parse_config:
 ; commit_vk: Store the current VKernelBuf into buffer segment
 ;
 commit_vk:
-               ; For better compression, clean up the append field
-               mov ax,[VKernelBuf+vk_appendlen]
+               cmp byte [VKernel],0
+               jz .nolabel                     ; Nothing to commit...
+
                mov di,VKernelBuf+vk_append
-               add di,ax
+               add di,[VKernelBuf+vk_appendlen]
+
+               ; If we have an initrd statement, append it to the
+               ; append statement
+               cmp byte [InitRD+NULLOFFSET],NULLFILE
+               je .noinitrd
+               
+               mov si,initrd_cmd
+               mov cx,initrd_cmd_len
+               rep movsb
+               mov si,InitRD
+               call unmangle_name
+               mov al,' '
+               stosb
+
+               ; For better compression, clean up the append field
+.noinitrd:
+               mov ax,di
+               sub ax,VKernelBuf+vk_append
+               mov [VKernelBuf+vk_appendlen],ax
                mov cx,max_cmd_len+1
                sub cx,ax
                xor ax,ax
@@ -407,6 +428,7 @@ commit_vk:
                mov cx,vk_size
                call rllpack
                mov [VKernelEnd],edi
+.nolabel:
                ret
 .overflow:
                mov si,vk_overflow_msg
index 3efd3c6..812bbeb 100644 (file)
@@ -2731,13 +2731,6 @@ syslinux_banner  db CR, LF, 'PXELINUX ', version_str, ' ', date, ' ', 0
 cfgprefix      db 'pxelinux.cfg/'              ; No final null!
 cfgprefix_len  equ ($-cfgprefix)
 
-;
-; Command line options we'd like to take a look at
-;
-; mem= and vga= are handled as normal 32-bit integer values
-initrd_cmd     db 'initrd='
-initrd_cmd_len equ $-initrd_cmd
-
 ; This one we make ourselves
 bootif_str     db 'BOOTIF='
 bootif_str_len equ $-bootif_str
index bbd9c7a..4d62778 100644 (file)
@@ -617,6 +617,13 @@ err_noinitrd    db CR, LF, 'Could not find ramdisk image: ', 0
 boot_image      db 'BOOT_IMAGE='
 boot_image_len  equ $-boot_image
 
+;
+; Command line options we'd like to take a look at
+;
+; mem= and vga= are handled as normal 32-bit integer values
+initrd_cmd     db 'initrd='
+initrd_cmd_len equ $-initrd_cmd
+
                section .bss
                alignb 4
 MyHighMemSize  resd 1                  ; Possibly adjusted highmem size