Commit a735aa3139c5b9785eac09dcf6384d89c8d8c445
1 parent
6b2b6112
added precompiled linux boot sector
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@652 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
6 changed files
with
40 additions
and
14 deletions
Makefile
... | ... | @@ -39,7 +39,8 @@ install: all |
39 | 39 | mkdir -p $(prefix)/bin |
40 | 40 | install -m 755 -s $(TOOLS) $(prefix)/bin |
41 | 41 | mkdir -p $(sharedir) |
42 | - install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin $(sharedir) | |
42 | + install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \ | |
43 | + pc-bios/linux_boot.bin $(sharedir) | |
43 | 44 | mkdir -p $(mandir)/man1 |
44 | 45 | install qemu.1 $(mandir)/man1 |
45 | 46 | for d in $(TARGET_DIRS); do \ | ... | ... |
Makefile.target
... | ... | @@ -206,9 +206,6 @@ endif |
206 | 206 | |
207 | 207 | # must use static linking to avoid leaving stuff in virtual address space |
208 | 208 | VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o fdc.o osdep.o |
209 | -ifeq ($(TARGET_ARCH), i386) | |
210 | -VL_OBJS+=linux_boot.o | |
211 | -endif | |
212 | 209 | ifeq ($(TARGET_ARCH), ppc) |
213 | 210 | VL_OBJS+= hw.o |
214 | 211 | endif | ... | ... |
pc-bios/Makefile
0 → 100644
1 | +# | |
2 | +# NOTE: only compilable with x86 cross compile tools | |
3 | +# | |
4 | +include ../config-host.mak | |
5 | + | |
6 | +DEFINES= | |
7 | + | |
8 | +TARGETS= | |
9 | +ifeq ($(ARCH),i386) | |
10 | +TARGETS+=linux_boot.bin | |
11 | +endif | |
12 | + | |
13 | +all: $(TARGETS) | |
14 | + | |
15 | +linux_boot.bin: linux_boot.o | |
16 | + ld --oformat binary -Ttext 0 -o $@ $< | |
17 | + chmod a-x $@ | |
18 | + | |
19 | +%.o: %.S | |
20 | + $(CC) $(DEFINES) -c -o $@ $< | |
21 | + | |
22 | +clean: | |
23 | + rm -f $(TARGETS) *.o *~ | |
24 | + | ... | ... |
linux_boot.S renamed to pc-bios/linux_boot.S
... | ... | @@ -7,10 +7,9 @@ |
7 | 7 | |
8 | 8 | .code16 |
9 | 9 | .text |
10 | - .globl linux_boot_start | |
11 | - .globl linux_boot_end | |
10 | + .globl _start | |
12 | 11 | |
13 | -linux_boot_start: | |
12 | +_start: | |
14 | 13 | cli |
15 | 14 | cld |
16 | 15 | mov $LOAD_SEG, %ax |
... | ... | @@ -23,10 +22,8 @@ linux_boot_start: |
23 | 22 | ljmp $LOAD_SEG + 0x20, $0 |
24 | 23 | |
25 | 24 | 1: |
26 | - .fill 510 - (1b - linux_boot_start), 1, 0 | |
25 | + .fill 510 - (1b - _start), 1, 0 | |
27 | 26 | |
28 | 27 | /* boot sector signature */ |
29 | 28 | .byte 0x55 |
30 | 29 | .byte 0xaa |
31 | - | |
32 | -linux_boot_end: | ... | ... |
pc-bios/linux_boot.bin
0 → 100644
No preview for this file type
vl.c
... | ... | @@ -53,6 +53,7 @@ |
53 | 53 | #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" |
54 | 54 | #define BIOS_FILENAME "bios.bin" |
55 | 55 | #define VGABIOS_FILENAME "vgabios.bin" |
56 | +#define LINUX_BOOT_FILENAME "linux_boot.bin" | |
56 | 57 | |
57 | 58 | //#define DEBUG_UNUSED_IOPORT |
58 | 59 | |
... | ... | @@ -3463,15 +3464,21 @@ int main(int argc, char **argv) |
3463 | 3464 | bochs_bios_init(); |
3464 | 3465 | |
3465 | 3466 | if (linux_boot) { |
3466 | - extern uint8_t linux_boot_start; | |
3467 | - extern uint8_t linux_boot_end; | |
3467 | + uint8_t bootsect[512]; | |
3468 | 3468 | |
3469 | 3469 | if (bs_table[0] == NULL) { |
3470 | 3470 | fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n"); |
3471 | 3471 | exit(1); |
3472 | 3472 | } |
3473 | - bdrv_set_boot_sector(bs_table[0], &linux_boot_start, | |
3474 | - &linux_boot_end - &linux_boot_start); | |
3473 | + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, LINUX_BOOT_FILENAME); | |
3474 | + ret = load_image(buf, bootsect); | |
3475 | + if (ret != sizeof(bootsect)) { | |
3476 | + fprintf(stderr, "qemu: could not load linux boot sector '%s'\n", | |
3477 | + buf); | |
3478 | + exit(1); | |
3479 | + } | |
3480 | + | |
3481 | + bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect)); | |
3475 | 3482 | |
3476 | 3483 | /* now we can load the kernel */ |
3477 | 3484 | ret = load_kernel(kernel_filename, | ... | ... |