summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-03 18:45:42 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-03 18:45:42 -0700
commit09dcba81bb7220e929093913bbfcb2c47e0ed4fb (patch)
tree509fa3f1f5b55f7e7ee5f6f7b50fa2ea8ae3720d
parent9de789906be3d913a89189c15ba4eff40f37022f (diff)
downloadsyslinux-09dcba81bb7220e929093913bbfcb2c47e0ed4fb.tar.gz
Allow the initrd to be specified on a separate linesyslinux-3.71-pre4
Allow the initrd to be specified on a separate line from command-line options (append). This apparently can help certain tools.
-rw-r--r--NEWS3
-rw-r--r--com32/menu/readconfig.c14
-rw-r--r--core/extlinux.asm7
-rw-r--r--core/isolinux.asm6
-rw-r--r--core/keywords1
-rw-r--r--core/keywords.inc27
-rw-r--r--core/ldlinux.asm7
-rw-r--r--core/parseconfig.inc32
-rw-r--r--core/pxelinux.asm7
-rw-r--r--core/runkernel.inc7
10 files changed, 66 insertions, 45 deletions
diff --git a/NEWS b/NEWS
index bf9865a6..3e01ea29 100644
--- 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
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index 10201938..e26105ad 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -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;
diff --git a/core/extlinux.asm b/core/extlinux.asm
index 02c2e229..bacb8a28 100644
--- a/core/extlinux.asm
+++ b/core/extlinux.asm
@@ -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"
diff --git a/core/isolinux.asm b/core/isolinux.asm
index 5452012c..a3eb9ee5 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -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
diff --git a/core/keywords b/core/keywords
index d7d8fa65..16fe7720 100644
--- a/core/keywords
+++ b/core/keywords
@@ -2,6 +2,7 @@ menu
text
include
append
+initrd
config
default
display
diff --git a/core/keywords.inc b/core/keywords.inc
index b6a701bb..65b657c1 100644
--- a/core/keywords.inc
+++ b/core/keywords.inc
@@ -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
diff --git a/core/ldlinux.asm b/core/ldlinux.asm
index 9cf1c03d..2be865da 100644
--- a/core/ldlinux.asm
+++ b/core/ldlinux.asm
@@ -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"
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index 2ef9c3a2..e004cab5 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -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
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index 3efd3c67..812bbeb2 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -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
diff --git a/core/runkernel.inc b/core/runkernel.inc
index bbd9c7af..4d627787 100644
--- a/core/runkernel.inc
+++ b/core/runkernel.inc
@@ -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