[syslinux:master] pxe: Fix recognition of keeppxe option

syslinux-bot for Adam Goldman adamg at pobox.com
Sat Mar 18 14:27:05 PDT 2017


Commit-ID:  346d2278e23f1b9f02903506753263ad7226de58
Gitweb:     http://www.syslinux.org/commit/346d2278e23f1b9f02903506753263ad7226de58
Author:     Adam Goldman <adamg at pobox.com>
AuthorDate: Sun, 5 Mar 2017 17:24:22 -0500
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sun, 5 Mar 2017 17:24:42 -0500

pxe: Fix recognition of keeppxe option

The preprocessor directive IS_PXELINUX is no longer valid.

Submitted-by: Adam Goldman <adamg at pobox.com>

Move "keeppxe" processing from
com32/elflink/ldlinux/kernel.c:new_linux_kernel() to
com32/lib/syslinux/load_linux.c:bios_boot_linux() using strstr() (not
find_argument in original patch).

Should also be processed by firmware->boot_linux() if not yet done.

Signed-off-by: Gene Cumm <gene.cumm at gmail.com>

---
 com32/elflink/ldlinux/kernel.c  |  8 --------
 com32/lib/syslinux/load_linux.c | 12 +++++++++++-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c
index f3ba37f..942f97c 100644
--- a/com32/elflink/ldlinux/kernel.c
+++ b/com32/elflink/ldlinux/kernel.c
@@ -48,14 +48,6 @@ int new_linux_kernel(char *okernel, char *ocmdline)
 
 	sprintf(cmdline, "BOOT_IMAGE=%s %s", kernel_name, args);
 
-	/* "keeppxe" handling */
-#if IS_PXELINUX
-	extern char KeepPXE;
-
-	if (strstr(cmdline, "keeppxe"))
-		KeepPXE |= 1;
-#endif
-
 	if (strstr(cmdline, "quiet"))
 		opt_quiet = true;
 
diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c
index 26c39c1..0edb771 100644
--- a/com32/lib/syslinux/load_linux.c
+++ b/com32/lib/syslinux/load_linux.c
@@ -48,6 +48,7 @@
 #include <syslinux/movebits.h>
 #include <syslinux/firmware.h>
 #include <syslinux/video.h>
+#include <syslinux/config.h>
 
 #define BOOT_MAGIC 0xAA55
 #define LINUX_MAGIC ('H' + ('d' << 8) + ('r' << 16) + ('S' << 24))
@@ -166,6 +167,7 @@ int bios_boot_linux(void *kernel_buf, size_t kernel_size,
     struct syslinux_memmap *amap = NULL;
     uint32_t memlimit = 0;
     uint16_t video_mode = 0;
+    uint16_t bootflags = 0;
     const char *arg;
 
     cmdline_size = strlen(cmdline) + 1;
@@ -200,6 +202,14 @@ int bios_boot_linux(void *kernel_buf, size_t kernel_size,
 	}
     }
 
+    if (syslinux_filesystem() == SYSLINUX_FS_PXELINUX &&
+	strstr(cmdline, "keeppxe")) {
+	extern __weak char KeepPXE;
+
+	KeepPXE |= 1;		/* for pxelinux_scan_memory */
+	bootflags = 3;		/* for unload_pxe */
+    }
+
     /* Copy the header into private storage */
     /* Use whdr to modify the actual kernel header */
     memcpy(&hdr, kernel_buf, sizeof hdr);
@@ -495,7 +505,7 @@ int bios_boot_linux(void *kernel_buf, size_t kernel_size,
 	dprintf("*** vga=current, not calling syslinux_force_text_mode()...\n");
     }
 
-    syslinux_shuffle_boot_rm(fraglist, mmap, 0, &regs);
+    syslinux_shuffle_boot_rm(fraglist, mmap, bootflags, &regs);
     dprintf("shuffle_boot_rm failed\n");
 
 bail:


More information about the Syslinux-commits mailing list