[syslinux:elflink] PXELINUX: implement our own version of local_boot16

syslinux-bot for Matt Fleming matt.fleming at intel.com
Wed Jun 26 13:00:07 PDT 2013


Commit-ID:  398cee85e1835b77e1b83a01fc20587bee8cc578
Gitweb:     http://www.syslinux.org/commit/398cee85e1835b77e1b83a01fc20587bee8cc578
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Wed, 26 Jun 2013 20:35:32 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 26 Jun 2013 20:56:44 +0100

PXELINUX: implement our own version of local_boot16

We need to do different things for PXE, such as reset the PXE
environment when booting from the local disk from PXELINUX.

This fixes a localboot regression.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 core/Makefile     | 11 ++++++-----
 core/pxeboot.c    | 40 ++++++++++++++++++++++++++++++++++++++++
 core/pxelinux.asm | 21 ++++++++++++++++++++-
 3 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/core/Makefile b/core/Makefile
index 59a61eb..f80c6d6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -68,7 +68,8 @@ LPXELINUX_OBJS = $(LPXELINUX_CSRC:%.c=%.o)
 PXELINUX_OBJS  = $(PXELINUX_CSRC:%.c=%.o)
 
 # Don't include console and network stack specific objects
-FILTER_OBJS = ./rawcon.o ./plaincon.o $(LPXELINUX_OBJS) $(PXELINUX_OBJS)
+FILTER_OBJS = ./rawcon.o ./plaincon.o ./localboot.o ./pxeboot.o \
+	$(LPXELINUX_OBJS) $(PXELINUX_OBJS)
 COBJS	 = $(filter-out $(FILTER_OBJS),$(COBJ))
 SOBJS	 = $(filter-out $(FILTER_OBJS),$(SOBJ))
 
@@ -125,7 +126,7 @@ AUXLIBS = libisolinux.a libisolinux-debug.a libldlinux.a \
 	$(OBJDUMP) -h $@ > $(@:.elf=.sec)
 	$(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
 
-libisolinux.a: rawcon.o
+libisolinux.a: rawcon.o localboot.o
 	rm -f $@
 	$(AR) cq $@ $^
 	$(RANLIB) $@
@@ -134,18 +135,18 @@ libisolinux-debug.a: libisolinux.a
 	cp $^ $@
 
 # Legacy network stack
-libpxelinux.a: rawcon.o $(PXELINUX_OBJS)
+libpxelinux.a: rawcon.o $(PXELINUX_OBJS) pxeboot.o
 	rm -f $@
 	$(AR) cq $@ $^
 	$(RANLIB) $@
 
 # LwIP network stack
-liblpxelinux.a: rawcon.o $(LPXELINUX_OBJS)
+liblpxelinux.a: rawcon.o $(LPXELINUX_OBJS) pxeboot.o
 	rm -f $@
 	$(AR) cq $@ $^
 	$(RANLIB) $@
 
-libldlinux.a: plaincon.o
+libldlinux.a: plaincon.o localboot.o
 	rm -f $@
 	$(AR) cq $@ $^
 	$(RANLIB) $@
diff --git a/core/pxeboot.c b/core/pxeboot.c
new file mode 100644
index 0000000..b6c9099
--- /dev/null
+++ b/core/pxeboot.c
@@ -0,0 +1,40 @@
+/*
+ *   Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ *  Boston MA 02111-1307, USA; either version 2 of the License, or
+ *  (at your option) any later version; incorporated herein by reference.
+ */
+
+#include <syslinux/video.h>
+#include "pxe.h"
+#include <com32.h>
+
+#define LOCALBOOT_MSG	"Booting from local disk..."
+
+extern void local_boot16(void);
+
+/*
+ * Boot to the local disk by returning the appropriate PXE magic.
+ * AX contains the appropriate return code.
+ */
+__export void local_boot(uint16_t ax)
+{
+    com32sys_t ireg;
+
+    syslinux_force_text_mode();
+
+    writestr(LOCALBOOT_MSG);
+    crlf();
+
+    /* Restore the environment we were called with */
+    reset_pxe();
+
+    cleanup_hardware();
+
+    ireg.eax.w[0] = ax;
+    call16(local_boot16, &ireg, NULL);
+}
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index d3215e7..5c93d98 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -290,7 +290,26 @@ KernelName	resb FILENAME_MAX	; Mangled name for kernel
 ; Hardware cleanup common code
 ;
 
-%include "localboot.inc"
+		section .text16
+		global local_boot16:function hidden
+local_boot16:
+		mov [LocalBootType],ax
+		lss sp,[InitStack]
+		pop gs
+		pop fs
+		pop es
+		pop ds
+		popad
+		mov ax,[cs:LocalBootType]
+		cmp ax,-1			; localboot -1 == INT 18h
+		je .int18
+		popfd
+		retf				; Return to PXE
+.int18:
+		popfd
+		int 18h
+		jmp 0F000h:0FFF0h
+		hlt
 
 ;
 ; kaboom: write a message and bail out.  Wait for quite a while,


More information about the Syslinux-commits mailing list