aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-02-25 23:54:25 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-02-25 23:54:25 +0000
commita735aa3139c5b9785eac09dcf6384d89c8d8c445 (patch)
tree8a1737f2ec97203bf19d5efc4b1a0cc6289e3eaf
parent6b2b6112f872f656ba4c9ef22ff1576e87042bcc (diff)
added precompiled linux boot sector
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@652 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--Makefile3
-rw-r--r--Makefile.target3
-rw-r--r--pc-bios/Makefile24
-rw-r--r--pc-bios/linux_boot.S (renamed from linux_boot.S)9
-rw-r--r--pc-bios/linux_boot.binbin0 -> 512 bytes
-rw-r--r--vl.c15
6 files changed, 40 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 4c49bd4929..11f7915503 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,8 @@ install: all
mkdir -p $(prefix)/bin
install -m 755 -s $(TOOLS) $(prefix)/bin
mkdir -p $(sharedir)
- install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin $(sharedir)
+ install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
+ pc-bios/linux_boot.bin $(sharedir)
mkdir -p $(mandir)/man1
install qemu.1 $(mandir)/man1
for d in $(TARGET_DIRS); do \
diff --git a/Makefile.target b/Makefile.target
index 3f5a1ba855..08d8dfc185 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -206,9 +206,6 @@ endif
# must use static linking to avoid leaving stuff in virtual address space
VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o fdc.o osdep.o
-ifeq ($(TARGET_ARCH), i386)
-VL_OBJS+=linux_boot.o
-endif
ifeq ($(TARGET_ARCH), ppc)
VL_OBJS+= hw.o
endif
diff --git a/pc-bios/Makefile b/pc-bios/Makefile
new file mode 100644
index 0000000000..7ae0ff02a0
--- /dev/null
+++ b/pc-bios/Makefile
@@ -0,0 +1,24 @@
+#
+# NOTE: only compilable with x86 cross compile tools
+#
+include ../config-host.mak
+
+DEFINES=
+
+TARGETS=
+ifeq ($(ARCH),i386)
+TARGETS+=linux_boot.bin
+endif
+
+all: $(TARGETS)
+
+linux_boot.bin: linux_boot.o
+ ld --oformat binary -Ttext 0 -o $@ $<
+ chmod a-x $@
+
+%.o: %.S
+ $(CC) $(DEFINES) -c -o $@ $<
+
+clean:
+ rm -f $(TARGETS) *.o *~
+
diff --git a/linux_boot.S b/pc-bios/linux_boot.S
index 353052c976..22fcd4be80 100644
--- a/linux_boot.S
+++ b/pc-bios/linux_boot.S
@@ -7,10 +7,9 @@
.code16
.text
- .globl linux_boot_start
- .globl linux_boot_end
+ .globl _start
-linux_boot_start:
+_start:
cli
cld
mov $LOAD_SEG, %ax
@@ -23,10 +22,8 @@ linux_boot_start:
ljmp $LOAD_SEG + 0x20, $0
1:
- .fill 510 - (1b - linux_boot_start), 1, 0
+ .fill 510 - (1b - _start), 1, 0
/* boot sector signature */
.byte 0x55
.byte 0xaa
-
-linux_boot_end:
diff --git a/pc-bios/linux_boot.bin b/pc-bios/linux_boot.bin
new file mode 100644
index 0000000000..80f7b5fee1
--- /dev/null
+++ b/pc-bios/linux_boot.bin
Binary files differ
diff --git a/vl.c b/vl.c
index 7e729ee541..e2e1393032 100644
--- a/vl.c
+++ b/vl.c
@@ -53,6 +53,7 @@
#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
#define BIOS_FILENAME "bios.bin"
#define VGABIOS_FILENAME "vgabios.bin"
+#define LINUX_BOOT_FILENAME "linux_boot.bin"
//#define DEBUG_UNUSED_IOPORT
@@ -3463,15 +3464,21 @@ int main(int argc, char **argv)
bochs_bios_init();
if (linux_boot) {
- extern uint8_t linux_boot_start;
- extern uint8_t linux_boot_end;
+ uint8_t bootsect[512];
if (bs_table[0] == NULL) {
fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n");
exit(1);
}
- bdrv_set_boot_sector(bs_table[0], &linux_boot_start,
- &linux_boot_end - &linux_boot_start);
+ snprintf(buf, sizeof(buf), "%s/%s", bios_dir, LINUX_BOOT_FILENAME);
+ ret = load_image(buf, bootsect);
+ if (ret != sizeof(bootsect)) {
+ fprintf(stderr, "qemu: could not load linux boot sector '%s'\n",
+ buf);
+ exit(1);
+ }
+
+ bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect));
/* now we can load the kernel */
ret = load_kernel(kernel_filename,