Revision a735aa31
b/Makefile | ||
---|---|---|
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 \ |
b/Makefile.target | ||
---|---|---|
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 |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* QEMU Boot sector to launch a preloaded Linux kernel |
|
3 |
* Copyright (c) 2004 Fabrice Bellard |
|
4 |
*/ |
|
5 |
|
|
6 |
#define LOAD_SEG 0x9000 |
|
7 |
|
|
8 |
.code16 |
|
9 |
.text |
|
10 |
.globl linux_boot_start |
|
11 |
.globl linux_boot_end |
|
12 |
|
|
13 |
linux_boot_start: |
|
14 |
cli |
|
15 |
cld |
|
16 |
mov $LOAD_SEG, %ax |
|
17 |
mov %ax, %ds |
|
18 |
mov %ax, %es |
|
19 |
mov %ax, %fs |
|
20 |
mov %ax, %gs |
|
21 |
mov %ax, %ss |
|
22 |
mov $0x8ffe, %sp |
|
23 |
ljmp $LOAD_SEG + 0x20, $0 |
|
24 |
|
|
25 |
1: |
|
26 |
.fill 510 - (1b - linux_boot_start), 1, 0 |
|
27 |
|
|
28 |
/* boot sector signature */ |
|
29 |
.byte 0x55 |
|
30 |
.byte 0xaa |
|
31 |
|
|
32 |
linux_boot_end: |
b/pc-bios/Makefile | ||
---|---|---|
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 |
|
b/pc-bios/linux_boot.S | ||
---|---|---|
1 |
/* |
|
2 |
* QEMU Boot sector to launch a preloaded Linux kernel |
|
3 |
* Copyright (c) 2004 Fabrice Bellard |
|
4 |
*/ |
|
5 |
|
|
6 |
#define LOAD_SEG 0x9000 |
|
7 |
|
|
8 |
.code16 |
|
9 |
.text |
|
10 |
.globl _start |
|
11 |
|
|
12 |
_start: |
|
13 |
cli |
|
14 |
cld |
|
15 |
mov $LOAD_SEG, %ax |
|
16 |
mov %ax, %ds |
|
17 |
mov %ax, %es |
|
18 |
mov %ax, %fs |
|
19 |
mov %ax, %gs |
|
20 |
mov %ax, %ss |
|
21 |
mov $0x8ffe, %sp |
|
22 |
ljmp $LOAD_SEG + 0x20, $0 |
|
23 |
|
|
24 |
1: |
|
25 |
.fill 510 - (1b - _start), 1, 0 |
|
26 |
|
|
27 |
/* boot sector signature */ |
|
28 |
.byte 0x55 |
|
29 |
.byte 0xaa |
b/vl.c | ||
---|---|---|
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 | 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, |
Also available in: Unified diff