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 \
# 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
--- /dev/null
+#
+# 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 *~
+
.code16
.text
- .globl linux_boot_start
- .globl linux_boot_end
+ .globl _start
-linux_boot_start:
+_start:
cli
cld
mov $LOAD_SEG, %ax
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:
#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
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,