Commit a735aa31 authored by bellard's avatar bellard
Browse files

added precompiled linux boot sector


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@652 c046a42c-6fe2-441c-8c8c-71466251a162
parent 6b2b6112
......@@ -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 \
......
......@@ -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
......
#
# 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 *~
......@@ -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:
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment