aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-06-26 20:35:32 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-06-26 20:56:44 +0100
commit398cee85e1835b77e1b83a01fc20587bee8cc578 (patch)
tree3663c56eb8436de712ea5aa69b8d4165efb4bfe5
parent9b8b5affd0d43fff833234f9c2b1425ec0447258 (diff)
downloadsyslinux-398cee85e1835b77e1b83a01fc20587bee8cc578.tar.gz
syslinux-398cee85e1835b77e1b83a01fc20587bee8cc578.tar.xz
syslinux-398cee85e1835b77e1b83a01fc20587bee8cc578.zip
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@intel.com>
-rw-r--r--core/Makefile11
-rw-r--r--core/pxeboot.c40
-rw-r--r--core/pxelinux.asm21
3 files changed, 66 insertions, 6 deletions
diff --git a/core/Makefile b/core/Makefile
index 59a61eb8..f80c6d63 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 00000000..b6c90998
--- /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 d3215e72..5c93d983 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,