* [Qemu-devel] [PATCH 4/5] Multiboot build system v4
2009-06-28 14:55 ` [Qemu-devel] [PATCH 3/5] Multiboot support v4 Alexander Graf
@ 2009-06-28 14:55 ` Alexander Graf
0 siblings, 0 replies; 7+ messages in thread
From: Alexander Graf @ 2009-06-28 14:55 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
In order to build the multiboot option rom, we need a Makefile and a tool
to sign the rom with.
Both are provided by this patch and mostly taken from the extboot source,
written by Anthony Liguori.
Once built, the resulting binary gets copied to pc-bios automatically.
Building also occurs automatically when on an x86 host.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v4 changes:
- make build more generic (optionrom directory)
- enable building with split object dir
---
Makefile | 12 +++++--
configure | 9 ++++-
pc-bios/optionrom/Makefile | 48 ++++++++++++++++++++++++++
pc-bios/optionrom/signrom.c | 79 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 144 insertions(+), 4 deletions(-)
create mode 100644 pc-bios/optionrom/Makefile
create mode 100644 pc-bios/optionrom/signrom.c
diff --git a/Makefile b/Makefile
index a06c9bf..b5020cc 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ ifdef CONFIG_WIN32
LIBS+=-lwinmm -lws2_32 -liphlpapi
endif
-build-all: $(TOOLS) $(DOCS) recurse-all
+build-all: $(TOOLS) $(DOCS) roms recurse-all
config-host.mak: configure
ifneq ($(wildcard config-host.mak),)
@@ -261,7 +261,7 @@ clean:
rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
rm -f qemu-img-cmds.h
$(MAKE) -C tests clean
- for d in $(TARGET_DIRS) libhw32 libhw64; do \
+ for d in $(TARGET_DIRS) $(ROMS) libhw32 libhw64; do \
$(MAKE) -C $$d $@ || exit 1 ; \
done
@@ -280,11 +280,17 @@ ifdef INSTALL_BLOBS
BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
-bamboo.dtb petalogix-s3adsp1800.dtb
+bamboo.dtb petalogix-s3adsp1800.dtb \
+multiboot.bin
else
BLOBS=
endif
+roms:
+ for d in $(ROMS); do \
+ $(MAKE) -C $$d || exit 1 ; \
+ done
+
install-doc: $(DOCS)
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
$(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
diff --git a/configure b/configure
index 33e3c41..1c925e0 100755
--- a/configure
+++ b/configure
@@ -1860,6 +1860,12 @@ if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
fi
echo "TOOLS=$tools" >> $config_mak
+roms=
+if test "$cpu" = "i386" -o "$cpu" = "x86_64" ; then
+ roms="pc-bios/optionrom"
+fi
+echo "ROMS=$roms" >> $config_mak
+
if test -f ${config_h}~ ; then
if cmp -s $config_h ${config_h}~ ; then
mv ${config_h}~ $config_h
@@ -2222,10 +2228,11 @@ done # for target in $targets
# build tree in object directory if source path is different from current one
if test "$source_path_used" = "yes" ; then
- DIRS="tests tests/cris slirp audio block"
+ DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
FILES="Makefile tests/Makefile"
FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
FILES="$FILES tests/test-mmap.c"
+ FILES="$FILES pc-bios/optionrom/Makefile"
for dir in $DIRS ; do
mkdir -p $dir
done
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
new file mode 100644
index 0000000..c4a6f42
--- /dev/null
+++ b/pc-bios/optionrom/Makefile
@@ -0,0 +1,48 @@
+all: build-all
+
+include ../../config-host.mak
+
+VPATH=$(SRC_PATH)/pc-bios/optionrom
+OBJCOPY=objcopy
+
+# from kernel sources - scripts/Kbuild.include
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Exit code chooses option. "$$TMP" is can be used as temporary file and
+# is automatically cleaned up.
+try-run = $(shell set -e; \
+ TMP="$(TMPOUT).$$$$.tmp"; \
+ if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi; \
+ rm -f "$$TMP")
+
+# cc-option-yn
+# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
+cc-option-yn = $(call try-run,\
+ $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
+
+CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
+CFLAGS += -I$(SRC_PATH)
+ifeq ($(call cc-option-yn,-fno-stack-protector),y)
+CFLAGS += -fno-stack-protector
+endif
+
+build-all: multiboot.bin
+
+%.o: %.S
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+%.img: %.o
+ $(LD) --oformat binary -Ttext 0 -o $@ $<
+
+%.bin: %.img signrom
+ ./signrom $< $@
+ cp $@ $(SRC_PATH)/pc-bios/
+
+signrom: signrom.c
+ $(CC) -o $@ -g -Wall $^
+
+clean:
+ $(RM) *.o *.img *.bin signrom *~
diff --git a/pc-bios/optionrom/signrom.c b/pc-bios/optionrom/signrom.c
new file mode 100644
index 0000000..fe8d677
--- /dev/null
+++ b/pc-bios/optionrom/signrom.c
@@ -0,0 +1,79 @@
+/*
+ * Extended Boot Option ROM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright IBM Corporation, 2007
+ * Authors: Anthony Liguori <aliguori@us.ibm.com>
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+ FILE *fin, *fout;
+ char buffer[512], oldbuffer[512];
+ int i, size, lag = 0;
+ uint8_t sum = 0;
+
+ if (argc != 3) {
+ printf("Usage: %s ROM OUTPUT\n", argv[0]);
+ return 1;
+ }
+
+ fin = fopen(argv[1], "rb");
+ fout = fopen(argv[2], "wb");
+
+ if (fin == NULL || fout == NULL) {
+ fprintf(stderr, "Could not open input/output files\n");
+ return 1;
+ }
+
+ do {
+ size = fread(buffer, 512, 1, fin);
+ if (size == 1) {
+ for (i = 0; i < 512; i++)
+ sum += buffer[i];
+
+ if (lag) {
+ if (fwrite(oldbuffer, 512, 1, fout) != 1) {
+ fprintf(stderr, "Write failed\n");
+ return 1;
+ }
+ }
+ lag = 1;
+ memcpy(oldbuffer, buffer, 512);
+ }
+ } while (size == 1);
+
+ if (size != 0) {
+ fprintf(stderr, "Failed to read from input file\n");
+ return 1;
+ }
+
+ oldbuffer[511] = -sum;
+
+ if (fwrite(oldbuffer, 512, 1, fout) != 1) {
+ fprintf(stderr, "Failed to write to output file\n");
+ return 1;
+ }
+
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 0/5] Add multiboot support (x86) v5
@ 2009-06-29 13:37 Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 1/5] Change bochs bios init order Alexander Graf
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2009-06-29 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
This patch implements support for Multiboot on x86 for -kernel.
Multiboot is a "new" approach to get rid of different bootloaders, providing
a unified interface for the kernel. It supports command line options and
kernel modules.
The two probably best known projects using multiboot are Xen and GNU Hurd.
This implementation should be mostly feature-complete. It is missing VBE
extensions, but as no system uses them currently it does not really hurt.
To use multiboot, specify the kernel as -kernel option. Modules should be given
as -initrd options, seperated by a comma (,). -append also works.
Please bear in mind that grub also does gzip decompression, which qemu does
not do yet. To run existing images, please ungzip them first.
The guest multiboot loader code is implemented as option rom using int 19.
Parts of the work are based on efforts by Rene Rebe, who originally ported
my code to int 19.
Also, Kevin Wolf helped a lot whenever I had a new version of this patch
around.
v2 addresses the fw_cfg comments from Blue Swirl
v3 makes things work on kvm and addresses avi's comments
v4 takes on anthony's complaints and adds documentation
v5 fixes reset with -kernel, but w/o -initrd
Alexander Graf (5):
Change bochs bios init order
Expose fw_cfg v2
Multiboot support v5
Multiboot build system v4
Add documentation for Multiboot
Makefile | 12 ++-
configure | 9 ++-
hw/pc.c | 264 ++++++++++++++++++++++++++++++++++++++---
pc-bios/optionrom/Makefile | 48 ++++++++
pc-bios/optionrom/multiboot.S | 209 ++++++++++++++++++++++++++++++++
pc-bios/optionrom/signrom.c | 79 ++++++++++++
qemu-options.hx | 17 ++-
7 files changed, 615 insertions(+), 23 deletions(-)
create mode 100644 pc-bios/optionrom/Makefile
create mode 100644 pc-bios/optionrom/multiboot.S
create mode 100644 pc-bios/optionrom/signrom.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/5] Change bochs bios init order
2009-06-29 13:37 [Qemu-devel] [PATCH 0/5] Add multiboot support (x86) v5 Alexander Graf
@ 2009-06-29 13:37 ` Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 2/5] Expose fw_cfg v2 Alexander Graf
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2009-06-29 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
For multiboot support, we need bochs_bios_init to happen before
load_linux, so we get the fw_cfg device.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
hw/pc.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 86e5cfe..f54de7e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -967,6 +967,12 @@ static void pc_init1(ram_addr_t ram_size,
if (oprom_area_size < 0x8000)
oprom_area_size = 0x8000;
+ /* map all the bios at the top of memory */
+ cpu_register_physical_memory((uint32_t)(-bios_size),
+ bios_size, bios_offset | IO_MEM_ROM);
+
+ bochs_bios_init();
+
if (linux_boot) {
load_linux(0xc0000 + oprom_area_size,
kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
@@ -993,12 +999,6 @@ static void pc_init1(ram_addr_t ram_size,
0xe0000);
}
- /* map all the bios at the top of memory */
- cpu_register_physical_memory((uint32_t)(-bios_size),
- bios_size, bios_offset | IO_MEM_ROM);
-
- bochs_bios_init();
-
cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1);
i8259 = i8259_init(cpu_irq[0]);
ferr_irq = i8259[13];
--
1.6.0.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 2/5] Expose fw_cfg v2
2009-06-29 13:37 ` [Qemu-devel] [PATCH 1/5] Change bochs bios init order Alexander Graf
@ 2009-06-29 13:37 ` Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 3/5] Multiboot support v5 Alexander Graf
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2009-06-29 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
Multiboot passes options to the option rom using the fw_cfg device.
Right now, that device is local to the bochs_bios_init function.
Let's change that and expose it, so everyone may put data in there.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v2 leaves env alone and just returns fw_cfg
---
hw/pc.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index f54de7e..6994326 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -448,7 +448,7 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)
extern uint64_t node_cpumask[MAX_NODES];
-static void bochs_bios_init(void)
+static void *bochs_bios_init(void)
{
void *fw_cfg;
uint8_t *smbios_table;
@@ -468,6 +468,7 @@ static void bochs_bios_init(void)
register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL);
fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
+
fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,
@@ -497,6 +498,8 @@ static void bochs_bios_init(void)
}
fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg,
(1 + smp_cpus + nb_numa_nodes) * 8);
+
+ return fw_cfg;
}
/* Generate an initial boot sector which sets state and jump to
@@ -851,6 +854,7 @@ static void pc_init1(ram_addr_t ram_size,
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BlockDriverState *fd[MAX_FD];
int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
+ void *fw_cfg;
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
@@ -971,7 +975,7 @@ static void pc_init1(ram_addr_t ram_size,
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
- bochs_bios_init();
+ fw_cfg = bochs_bios_init();
if (linux_boot) {
load_linux(0xc0000 + oprom_area_size,
--
1.6.0.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 3/5] Multiboot support v5
2009-06-29 13:37 ` [Qemu-devel] [PATCH 2/5] Expose fw_cfg v2 Alexander Graf
@ 2009-06-29 13:37 ` Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 4/5] Multiboot build system v4 Alexander Graf
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2009-06-29 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
This patch implements support for Multiboot on x86 for -kernel.
Multiboot is a "new" approach to get rid of different bootloaders, providing
a unified interface for the kernel. It supports command line options and
kernel modules.
The two probably best known projects using multiboot are Xen and GNU Hurd.
This implementation should be mostly feature-complete. It is missing VBE
extensions, but as no system uses them currently it does not really hurt.
To use multiboot, specify the kernel as -kernel option. Modules should be given
as -initrd options, seperated by a comma (,). -append also works.
Please bear in mind that grub also does gzip decompression, which qemu does
not do yet. To run existing images, please ungzip them first.
The guest multiboot loader code is implemented as option rom using int 19.
Parts of the work are based on efforts by Rene Rebe, who originally ported
my code to int 19.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v2 uses fw_cfg directly instead of env->fw_cfg
v3 changes:
- kvm compatibility (thanks gleb!)
- reformat if and for (avi)
v4 changes:
- implement reset
- fix cmdline
- set bootinfo start down to 0x9000
v5 changes:
- fix reset when -initrd is not given
---
hw/pc.c | 246 +++++++++++++++++++++++++++++++++++++++--
pc-bios/optionrom/multiboot.S | 209 ++++++++++++++++++++++++++++++++++
2 files changed, 447 insertions(+), 8 deletions(-)
create mode 100644 pc-bios/optionrom/multiboot.S
diff --git a/hw/pc.c b/hw/pc.c
index 6994326..d7ac6ce 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -40,6 +40,9 @@
/* output Bochs bios info messages */
//#define DEBUG_BIOS
+/* Show multiboot debug output */
+//#define DEBUG_MULTIBOOT
+
#define BIOS_FILENAME "bios.bin"
#define VGABIOS_FILENAME "vgabios.bin"
#define VGABIOS_CIRRUS_FILENAME "vgabios-cirrus.bin"
@@ -596,7 +599,218 @@ static long get_file_size(FILE *f)
return size;
}
-static void load_linux(target_phys_addr_t option_rom,
+#define MULTIBOOT_STRUCT_ADDR 0x9000
+
+#if MULTIBOOT_STRUCT_ADDR > 0xf0000
+#error multiboot struct needs to fit in 16 bit real mode
+#endif
+
+static int load_multiboot(void *fw_cfg,
+ FILE *f,
+ const char *kernel_filename,
+ const char *initrd_filename,
+ const char *kernel_cmdline,
+ uint8_t *header)
+{
+ int i, t, is_multiboot = 0;
+ uint32_t flags = 0;
+ uint32_t mh_entry_addr;
+ uint32_t mh_load_addr;
+ uint32_t mb_kernel_size;
+ uint32_t mmap_addr = MULTIBOOT_STRUCT_ADDR;
+ uint32_t mb_bootinfo = MULTIBOOT_STRUCT_ADDR + 0x500;
+ uint32_t mb_cmdline = mb_bootinfo + 0x200;
+ uint32_t mb_mod_end;
+
+ /* Ok, let's see if it is a multiboot image.
+ The header is 12x32bit long, so the latest entry may be 8192 - 48. */
+ for (i = 0; i < (8192 - 48); i += 4) {
+ if (ldl_p(header+i) == 0x1BADB002) {
+ uint32_t checksum = ldl_p(header+i+8);
+ flags = ldl_p(header+i+4);
+ checksum += flags;
+ checksum += (uint32_t)0x1BADB002;
+ if (!checksum) {
+ is_multiboot = 1;
+ break;
+ }
+ }
+ }
+
+ if (!is_multiboot)
+ return 0; /* no multiboot */
+
+#ifdef DEBUG_MULTIBOOT
+ fprintf(stderr, "qemu: I believe we found a multiboot image!\n");
+#endif
+
+ if (flags & 0x00000004) { /* MULTIBOOT_HEADER_HAS_VBE */
+ fprintf(stderr, "qemu: multiboot knows VBE. we don't.\n");
+ }
+ if (!(flags & 0x00010000)) { /* MULTIBOOT_HEADER_HAS_ADDR */
+ uint64_t elf_entry;
+ int kernel_size;
+ fclose(f);
+ kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL);
+ if (kernel_size < 0) {
+ fprintf(stderr, "Error while loading elf kernel\n");
+ exit(1);
+ }
+ mh_load_addr = mh_entry_addr = elf_entry;
+ mb_kernel_size = kernel_size;
+
+#ifdef DEBUG_MULTIBOOT
+ fprintf(stderr, "qemu: loading multiboot-elf kernel (%#x bytes) with entry %#zx\n",
+ mb_kernel_size, (size_t)mh_entry_addr);
+#endif
+ } else {
+ /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
+ uint32_t mh_header_addr = ldl_p(header+i+12);
+ mh_load_addr = ldl_p(header+i+16);
+#ifdef DEBUG_MULTIBOOT
+ uint32_t mh_load_end_addr = ldl_p(header+i+20);
+ uint32_t mh_bss_end_addr = ldl_p(header+i+24);
+#endif
+ uint32_t mb_kernel_text_offset = i - (mh_header_addr - mh_load_addr);
+
+ mh_entry_addr = ldl_p(header+i+28);
+ mb_kernel_size = get_file_size(f) - mb_kernel_text_offset;
+
+ /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE.
+ uint32_t mh_mode_type = ldl_p(header+i+32);
+ uint32_t mh_width = ldl_p(header+i+36);
+ uint32_t mh_height = ldl_p(header+i+40);
+ uint32_t mh_depth = ldl_p(header+i+44); */
+
+#ifdef DEBUG_MULTIBOOT
+ fprintf(stderr, "multiboot: mh_header_addr = %#x\n", mh_header_addr);
+ fprintf(stderr, "multiboot: mh_load_addr = %#x\n", mh_load_addr);
+ fprintf(stderr, "multiboot: mh_load_end_addr = %#x\n", mh_load_end_addr);
+ fprintf(stderr, "multiboot: mh_bss_end_addr = %#x\n", mh_bss_end_addr);
+#endif
+
+ fseek(f, mb_kernel_text_offset, SEEK_SET);
+
+#ifdef DEBUG_MULTIBOOT
+ fprintf(stderr, "qemu: loading multiboot kernel (%#x bytes) at %#x\n",
+ mb_kernel_size, mh_load_addr);
+#endif
+
+ if (!fread_targphys_ok(mh_load_addr, mb_kernel_size, f)) {
+ fprintf(stderr, "qemu: read error on multiboot kernel '%s' (%#x)\n",
+ kernel_filename, mb_kernel_size);
+ exit(1);
+ }
+ fclose(f);
+ }
+
+ /* blob size is only the kernel for now */
+ mb_mod_end = mh_load_addr + mb_kernel_size;
+
+ /* load modules */
+ stl_phys(mb_bootinfo + 20, 0x0); /* mods_count */
+ if (initrd_filename) {
+ uint32_t mb_mod_info = mb_bootinfo + 0x100;
+ uint32_t mb_mod_cmdline = mb_bootinfo + 0x300;
+ uint32_t mb_mod_start = mh_load_addr;
+ uint32_t mb_mod_length = mb_kernel_size;
+ char *next_initrd;
+ char *next_space;
+ int mb_mod_count = 0;
+
+ do {
+ next_initrd = strchr(initrd_filename, ',');
+ if (next_initrd)
+ *next_initrd = '\0';
+ /* if a space comes after the module filename, treat everything
+ after that as parameters */
+ cpu_physical_memory_write(mb_mod_cmdline, (uint8_t*)initrd_filename,
+ strlen(initrd_filename) + 1);
+ stl_phys(mb_mod_info + 8, mb_mod_cmdline); /* string */
+ mb_mod_cmdline += strlen(initrd_filename) + 1;
+ if ((next_space = strchr(initrd_filename, ' ')))
+ *next_space = '\0';
+#ifdef DEBUG_MULTIBOOT
+ printf("multiboot loading module: %s\n", initrd_filename);
+#endif
+ f = fopen(initrd_filename, "rb");
+ if (f) {
+ mb_mod_start = (mb_mod_start + mb_mod_length + (TARGET_PAGE_SIZE - 1))
+ & (TARGET_PAGE_MASK);
+ mb_mod_length = get_file_size(f);
+ mb_mod_end = mb_mod_start + mb_mod_length;
+
+ if (!fread_targphys_ok(mb_mod_start, mb_mod_length, f)) {
+ fprintf(stderr, "qemu: read error on multiboot module '%s' (%#x)\n",
+ initrd_filename, mb_mod_length);
+ exit(1);
+ }
+
+ mb_mod_count++;
+ stl_phys(mb_mod_info + 0, mb_mod_start);
+ stl_phys(mb_mod_info + 4, mb_mod_start + mb_mod_length);
+#ifdef DEBUG_MULTIBOOT
+ printf("mod_start: %#x\nmod_end: %#x\n", mb_mod_start,
+ mb_mod_start + mb_mod_length);
+#endif
+ stl_phys(mb_mod_info + 12, 0x0); /* reserved */
+ }
+ initrd_filename = next_initrd+1;
+ mb_mod_info += 16;
+ } while (next_initrd);
+ stl_phys(mb_bootinfo + 20, mb_mod_count); /* mods_count */
+ stl_phys(mb_bootinfo + 24, mb_bootinfo + 0x100); /* mods_addr */
+ }
+
+ /* Make sure we're getting kernel + modules back after reset */
+ option_rom_setup_reset(mh_load_addr, mb_mod_end - mh_load_addr);
+
+ /* Commandline support */
+ stl_phys(mb_bootinfo + 16, mb_cmdline);
+ t = strlen(kernel_filename);
+ cpu_physical_memory_write(mb_cmdline, (uint8_t*)kernel_filename, t);
+ mb_cmdline += t;
+ stb_phys(mb_cmdline++, ' ');
+ t = strlen(kernel_cmdline) + 1;
+ cpu_physical_memory_write(mb_cmdline, (uint8_t*)kernel_cmdline, t);
+
+ /* the kernel is where we want it to be now */
+
+#define MULTIBOOT_FLAGS_MEMORY (1 << 0)
+#define MULTIBOOT_FLAGS_BOOT_DEVICE (1 << 1)
+#define MULTIBOOT_FLAGS_CMDLINE (1 << 2)
+#define MULTIBOOT_FLAGS_MODULES (1 << 3)
+#define MULTIBOOT_FLAGS_MMAP (1 << 6)
+ stl_phys(mb_bootinfo, MULTIBOOT_FLAGS_MEMORY
+ | MULTIBOOT_FLAGS_BOOT_DEVICE
+ | MULTIBOOT_FLAGS_CMDLINE
+ | MULTIBOOT_FLAGS_MODULES
+ | MULTIBOOT_FLAGS_MMAP);
+ stl_phys(mb_bootinfo + 4, 640); /* mem_lower */
+ stl_phys(mb_bootinfo + 8, ram_size / 1024); /* mem_upper */
+ stl_phys(mb_bootinfo + 12, 0x8001ffff); /* XXX: use the -boot switch? */
+ stl_phys(mb_bootinfo + 48, mmap_addr); /* mmap_addr */
+
+#ifdef DEBUG_MULTIBOOT
+ fprintf(stderr, "multiboot: mh_entry_addr = %#x\n", mh_entry_addr);
+#endif
+
+ /* Pass variables to option rom */
+ fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, mh_entry_addr);
+ fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, mb_bootinfo);
+ fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, mmap_addr);
+
+ /* Make sure we're getting the config space back after reset */
+ option_rom_setup_reset(mb_bootinfo, 0x500);
+
+ option_rom[nb_option_roms] = "multiboot.bin";
+ nb_option_roms++;
+
+ return 1; /* yes, we are multiboot */
+}
+
+static void load_linux(void *fw_cfg,
+ target_phys_addr_t option_rom,
const char *kernel_filename,
const char *initrd_filename,
const char *kernel_cmdline,
@@ -608,7 +822,7 @@ static void load_linux(target_phys_addr_t option_rom,
uint16_t real_seg;
int setup_size, kernel_size, initrd_size = 0, cmdline_size;
uint32_t initrd_max;
- uint8_t header[1024];
+ uint8_t header[8192];
target_phys_addr_t real_addr, prot_addr, cmdline_addr, initrd_addr = 0;
FILE *f, *fi;
@@ -618,7 +832,8 @@ static void load_linux(target_phys_addr_t option_rom,
/* load the kernel header */
f = fopen(kernel_filename, "rb");
if (!f || !(kernel_size = get_file_size(f)) ||
- fread(header, 1, 1024, f) != 1024) {
+ fread(header, 1, MIN(ARRAY_SIZE(header), kernel_size), f) !=
+ MIN(ARRAY_SIZE(header), kernel_size)) {
fprintf(stderr, "qemu: could not load kernel '%s'\n",
kernel_filename);
exit(1);
@@ -630,8 +845,14 @@ static void load_linux(target_phys_addr_t option_rom,
#endif
if (ldl_p(header+0x202) == 0x53726448)
protocol = lduw_p(header+0x206);
- else
+ else {
+ /* This looks like a multiboot kernel. If it is, let's stop
+ treating it like a Linux kernel. */
+ if (load_multiboot(fw_cfg, f, kernel_filename,
+ initrd_filename, kernel_cmdline, header))
+ return;
protocol = 0;
+ }
if (protocol < 0x200 || !(header[0x211] & 0x01)) {
/* Low kernel */
@@ -721,16 +942,25 @@ static void load_linux(target_phys_addr_t option_rom,
}
/* store the finalized header and load the rest of the kernel */
- cpu_physical_memory_write(real_addr, header, 1024);
+ cpu_physical_memory_write(real_addr, header, ARRAY_SIZE(header));
setup_size = header[0x1f1];
if (setup_size == 0)
setup_size = 4;
setup_size = (setup_size+1)*512;
- kernel_size -= setup_size; /* Size of protected-mode code */
+ /* Size of protected-mode code */
+ kernel_size -= (setup_size > ARRAY_SIZE(header)) ? setup_size : ARRAY_SIZE(header);
+
+ /* In case we have read too much already, copy that over */
+ if (setup_size < ARRAY_SIZE(header)) {
+ cpu_physical_memory_write(prot_addr, header + setup_size, ARRAY_SIZE(header) - setup_size);
+ prot_addr += (ARRAY_SIZE(header) - setup_size);
+ setup_size = ARRAY_SIZE(header);
+ }
- if (!fread_targphys_ok(real_addr+1024, setup_size-1024, f) ||
+ if (!fread_targphys_ok(real_addr + ARRAY_SIZE(header),
+ setup_size - ARRAY_SIZE(header), f) ||
!fread_targphys_ok(prot_addr, kernel_size, f)) {
fprintf(stderr, "qemu: read error on kernel '%s'\n",
kernel_filename);
@@ -978,7 +1208,7 @@ static void pc_init1(ram_addr_t ram_size,
fw_cfg = bochs_bios_init();
if (linux_boot) {
- load_linux(0xc0000 + oprom_area_size,
+ load_linux(fw_cfg, 0xc0000 + oprom_area_size,
kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
oprom_area_size += 2048;
}
diff --git a/pc-bios/optionrom/multiboot.S b/pc-bios/optionrom/multiboot.S
new file mode 100644
index 0000000..d0eec26
--- /dev/null
+++ b/pc-bios/optionrom/multiboot.S
@@ -0,0 +1,209 @@
+/*
+ * Multiboot Option ROM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright Novell Inc, 2009
+ * Authors: Alexander Graf <agraf@suse.de>
+ */
+
+#define NO_QEMU_PROTOS
+#include "../../hw/fw_cfg.h"
+
+#define BIOS_CFG_IOPORT_CFG 0x510
+#define BIOS_CFG_IOPORT_DATA 0x511
+
+#define MULTIBOOT_MAGIC 0x2badb002
+
+/* Read a variable from the fw_cfg device.
+ Clobbers: %edx
+ Out: %eax */
+.macro read_fw VAR
+ mov $\VAR, %ax
+ mov $BIOS_CFG_IOPORT_CFG, %dx
+ outw %ax, (%dx)
+ mov $BIOS_CFG_IOPORT_DATA, %dx
+ inb (%dx), %al
+ shl $8, %eax
+ inb (%dx), %al
+ shl $8, %eax
+ inb (%dx), %al
+ shl $8, %eax
+ inb (%dx), %al
+ bswap %eax
+.endm
+
+.code16
+.text
+ .global _start
+_start:
+ .short 0xaa55
+ .byte (_end - _start) / 512
+ push %eax
+ push %ds
+
+ /* setup ds so we can access the IVT */
+ xor %ax, %ax
+ mov %ax, %ds
+
+ /* save old int 19 */
+ mov (0x19*4), %eax
+ mov %eax, %cs:old_int19
+
+ /* install our int 19 handler */
+ movw $int19_handler, (0x19*4)
+ mov %cs, (0x19*4+2)
+
+ pop %ds
+ pop %eax
+ lret
+
+int19_handler:
+ /* DS = CS */
+ movw %cs, %ax
+ movw %ax, %ds
+
+ /* fall through */
+
+run_multiboot:
+
+ cli
+ cld
+
+ mov %cs, %eax
+ shl $0x4, %eax
+
+ /* fix the gdt descriptor to be PC relative */
+ mov (gdt_desc+2), %ebx
+ add %eax, %ebx
+ mov %ebx, (gdt_desc+2)
+
+ /* fix the prot mode indirect jump to be PC relative */
+ mov (prot_jump), %ebx
+ add %eax, %ebx
+ mov %ebx, (prot_jump)
+
+ /* FS = bootinfo_struct */
+ read_fw FW_CFG_INITRD_ADDR
+ shr $4, %eax
+ mov %ax, %fs
+
+ /* ES = mmap_addr */
+ read_fw FW_CFG_INITRD_SIZE
+ shr $4, %eax
+ mov %ax, %es
+
+ /* Initialize multiboot mmap structs using int 0x15(e820) */
+ xor %ebx, %ebx
+ /* mmap start after first size */
+ movl $4, %edi
+
+mmap_loop:
+ /* entry size (mmap struct) & max buffer size (int15) */
+ movl $20, %ecx
+ /* store entry size */
+ movl %ecx, %es:-4(%edi)
+ /* e820 */
+ movl $0x0000e820, %eax
+ /* 'SMAP' magic */
+ movl $0x534d4150, %edx
+ int $0x15
+
+mmap_check_entry:
+ /* last entry? then we're done */
+ jb mmap_done
+ and %bx, %bx
+ jz mmap_done
+ /* valid entry, so let's loop on */
+
+mmap_store_entry:
+ /* %ax = entry_number * 24 */
+ mov $24, %ax
+ mul %bx
+ mov %ax, %di
+ movw %di, %fs:0x2c
+ /* %di = 4 + (entry_number * 24) */
+ add $4, %di
+ jmp mmap_loop
+
+mmap_done:
+real_to_prot:
+ /* Load the GDT before going into protected mode */
+lgdt:
+ data32 lgdt %cs:gdt_desc
+
+ /* get us to protected mode now */
+ movl $1, %eax
+ movl %eax, %cr0
+
+ /* the LJMP sets CS for us and gets us to 32-bit */
+ljmp:
+ data32 ljmp *%cs:prot_jump
+
+prot_mode:
+.code32
+
+ /* initialize all other segments */
+ movl $0x10, %eax
+ movl %eax, %ss
+ movl %eax, %ds
+ movl %eax, %es
+ movl %eax, %fs
+ movl %eax, %gs
+
+ /* Jump off to the kernel */
+ read_fw FW_CFG_KERNEL_ADDR
+ mov %eax, %ecx
+
+ /* EBX contains a pointer to the bootinfo struct */
+ read_fw FW_CFG_INITRD_ADDR
+ movl %eax, %ebx
+
+ /* EAX has to contain the magic */
+ movl $MULTIBOOT_MAGIC, %eax
+ljmp2:
+ jmp *%ecx
+
+/* Variables */
+.align 4, 0
+old_int19: .long 0
+
+prot_jump: .long prot_mode
+ .short 8
+
+.align 4, 0
+gdt:
+ /* 0x00 */
+.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+ /* 0x08: code segment (base=0, limit=0xfffff, type=32bit code exec/read, DPL=0, 4k) */
+.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x9a, 0xcf, 0x00
+
+ /* 0x10: data segment (base=0, limit=0xfffff, type=32bit data read/write, DPL=0, 4k) */
+.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0xcf, 0x00
+
+ /* 0x18: code segment (base=0, limit=0x0ffff, type=16bit code exec/read/conf, DPL=0, 1b) */
+.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00
+
+ /* 0x20: data segment (base=0, limit=0x0ffff, type=16bit data read/write, DPL=0, 1b) */
+.byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00
+
+gdt_desc:
+.short (5 * 8) - 1
+.long gdt
+
+.align 512, 0
+_end:
+
--
1.6.0.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 4/5] Multiboot build system v4
2009-06-29 13:37 ` [Qemu-devel] [PATCH 3/5] Multiboot support v5 Alexander Graf
@ 2009-06-29 13:37 ` Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 5/5] Add documentation for Multiboot Alexander Graf
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2009-06-29 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
In order to build the multiboot option rom, we need a Makefile and a tool
to sign the rom with.
Both are provided by this patch and mostly taken from the extboot source,
written by Anthony Liguori.
Once built, the resulting binary gets copied to pc-bios automatically.
Building also occurs automatically when on an x86 host.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v4 changes:
- make build more generic (optionrom directory)
- enable building with split object dir
---
Makefile | 12 +++++--
configure | 9 ++++-
pc-bios/optionrom/Makefile | 48 ++++++++++++++++++++++++++
pc-bios/optionrom/signrom.c | 79 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 144 insertions(+), 4 deletions(-)
create mode 100644 pc-bios/optionrom/Makefile
create mode 100644 pc-bios/optionrom/signrom.c
diff --git a/Makefile b/Makefile
index a06c9bf..b5020cc 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ ifdef CONFIG_WIN32
LIBS+=-lwinmm -lws2_32 -liphlpapi
endif
-build-all: $(TOOLS) $(DOCS) recurse-all
+build-all: $(TOOLS) $(DOCS) roms recurse-all
config-host.mak: configure
ifneq ($(wildcard config-host.mak),)
@@ -261,7 +261,7 @@ clean:
rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
rm -f qemu-img-cmds.h
$(MAKE) -C tests clean
- for d in $(TARGET_DIRS) libhw32 libhw64; do \
+ for d in $(TARGET_DIRS) $(ROMS) libhw32 libhw64; do \
$(MAKE) -C $$d $@ || exit 1 ; \
done
@@ -280,11 +280,17 @@ ifdef INSTALL_BLOBS
BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
video.x openbios-sparc32 openbios-sparc64 openbios-ppc \
pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
-bamboo.dtb petalogix-s3adsp1800.dtb
+bamboo.dtb petalogix-s3adsp1800.dtb \
+multiboot.bin
else
BLOBS=
endif
+roms:
+ for d in $(ROMS); do \
+ $(MAKE) -C $$d || exit 1 ; \
+ done
+
install-doc: $(DOCS)
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
$(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
diff --git a/configure b/configure
index 33e3c41..1c925e0 100755
--- a/configure
+++ b/configure
@@ -1860,6 +1860,12 @@ if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
fi
echo "TOOLS=$tools" >> $config_mak
+roms=
+if test "$cpu" = "i386" -o "$cpu" = "x86_64" ; then
+ roms="pc-bios/optionrom"
+fi
+echo "ROMS=$roms" >> $config_mak
+
if test -f ${config_h}~ ; then
if cmp -s $config_h ${config_h}~ ; then
mv ${config_h}~ $config_h
@@ -2222,10 +2228,11 @@ done # for target in $targets
# build tree in object directory if source path is different from current one
if test "$source_path_used" = "yes" ; then
- DIRS="tests tests/cris slirp audio block"
+ DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
FILES="Makefile tests/Makefile"
FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
FILES="$FILES tests/test-mmap.c"
+ FILES="$FILES pc-bios/optionrom/Makefile"
for dir in $DIRS ; do
mkdir -p $dir
done
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
new file mode 100644
index 0000000..c4a6f42
--- /dev/null
+++ b/pc-bios/optionrom/Makefile
@@ -0,0 +1,48 @@
+all: build-all
+
+include ../../config-host.mak
+
+VPATH=$(SRC_PATH)/pc-bios/optionrom
+OBJCOPY=objcopy
+
+# from kernel sources - scripts/Kbuild.include
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Exit code chooses option. "$$TMP" is can be used as temporary file and
+# is automatically cleaned up.
+try-run = $(shell set -e; \
+ TMP="$(TMPOUT).$$$$.tmp"; \
+ if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi; \
+ rm -f "$$TMP")
+
+# cc-option-yn
+# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
+cc-option-yn = $(call try-run,\
+ $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
+
+CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
+CFLAGS += -I$(SRC_PATH)
+ifeq ($(call cc-option-yn,-fno-stack-protector),y)
+CFLAGS += -fno-stack-protector
+endif
+
+build-all: multiboot.bin
+
+%.o: %.S
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+%.img: %.o
+ $(LD) --oformat binary -Ttext 0 -o $@ $<
+
+%.bin: %.img signrom
+ ./signrom $< $@
+ cp $@ $(SRC_PATH)/pc-bios/
+
+signrom: signrom.c
+ $(CC) -o $@ -g -Wall $^
+
+clean:
+ $(RM) *.o *.img *.bin signrom *~
diff --git a/pc-bios/optionrom/signrom.c b/pc-bios/optionrom/signrom.c
new file mode 100644
index 0000000..fe8d677
--- /dev/null
+++ b/pc-bios/optionrom/signrom.c
@@ -0,0 +1,79 @@
+/*
+ * Extended Boot Option ROM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright IBM Corporation, 2007
+ * Authors: Anthony Liguori <aliguori@us.ibm.com>
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+ FILE *fin, *fout;
+ char buffer[512], oldbuffer[512];
+ int i, size, lag = 0;
+ uint8_t sum = 0;
+
+ if (argc != 3) {
+ printf("Usage: %s ROM OUTPUT\n", argv[0]);
+ return 1;
+ }
+
+ fin = fopen(argv[1], "rb");
+ fout = fopen(argv[2], "wb");
+
+ if (fin == NULL || fout == NULL) {
+ fprintf(stderr, "Could not open input/output files\n");
+ return 1;
+ }
+
+ do {
+ size = fread(buffer, 512, 1, fin);
+ if (size == 1) {
+ for (i = 0; i < 512; i++)
+ sum += buffer[i];
+
+ if (lag) {
+ if (fwrite(oldbuffer, 512, 1, fout) != 1) {
+ fprintf(stderr, "Write failed\n");
+ return 1;
+ }
+ }
+ lag = 1;
+ memcpy(oldbuffer, buffer, 512);
+ }
+ } while (size == 1);
+
+ if (size != 0) {
+ fprintf(stderr, "Failed to read from input file\n");
+ return 1;
+ }
+
+ oldbuffer[511] = -sum;
+
+ if (fwrite(oldbuffer, 512, 1, fout) != 1) {
+ fprintf(stderr, "Failed to write to output file\n");
+ return 1;
+ }
+
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 5/5] Add documentation for Multiboot
2009-06-29 13:37 ` [Qemu-devel] [PATCH 4/5] Multiboot build system v4 Alexander Graf
@ 2009-06-29 13:37 ` Alexander Graf
0 siblings, 0 replies; 7+ messages in thread
From: Alexander Graf @ 2009-06-29 13:37 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, rene
The documentation shows how to use -kernel and friends for booting Linux,
but obviously knows nothing about multiboot yet.
Let's include some documentation for multiboot, so people know how to fully
exploit this cool new feature.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
qemu-options.hx | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 503da33..3b6f885 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1068,10 +1068,11 @@ ETEXI
DEFHEADING()
-DEFHEADING(Linux boot specific:)
+DEFHEADING(Linux/Multiboot boot specific:)
STEXI
-When using these options, you can use a given
-Linux kernel without installing it in the disk image. It can be useful
+
+When using these options, you can use a given Linux or Multiboot
+kernel without installing it in the disk image. It can be useful
for easier testing of various kernels.
@table @option
@@ -1081,7 +1082,8 @@ DEF("kernel", HAS_ARG, QEMU_OPTION_kernel, \
"-kernel bzImage use 'bzImage' as kernel image\n")
STEXI
@item -kernel @var{bzImage}
-Use @var{bzImage} as kernel image.
+Use @var{bzImage} as kernel image. The kernel can be either a Linux kernel
+or in multiboot format.
ETEXI
DEF("append", HAS_ARG, QEMU_OPTION_append, \
@@ -1096,6 +1098,13 @@ DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \
STEXI
@item -initrd @var{file}
Use @var{file} as initial ram disk.
+
+@item -initrd "@var{file1} arg=foo,@var{file2}"
+
+This syntax is only available with multiboot.
+
+Use @var{file1} and @var{file2} as modules and pass arg=foo as parameter to the
+first module.
ETEXI
STEXI
--
1.6.0.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-06-29 13:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-29 13:37 [Qemu-devel] [PATCH 0/5] Add multiboot support (x86) v5 Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 1/5] Change bochs bios init order Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 2/5] Expose fw_cfg v2 Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 3/5] Multiboot support v5 Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 4/5] Multiboot build system v4 Alexander Graf
2009-06-29 13:37 ` [Qemu-devel] [PATCH 5/5] Add documentation for Multiboot Alexander Graf
-- strict thread matches above, loose matches on Subject: below --
2009-06-28 14:55 [Qemu-devel] [PATCH 0/5] Add multiboot support (x86) v4 Alexander Graf
2009-06-28 14:55 ` [Qemu-devel] [PATCH 1/5] Change bochs bios init order Alexander Graf
2009-06-28 14:55 ` [Qemu-devel] [PATCH 2/5] Expose fw_cfg v2 Alexander Graf
2009-06-28 14:55 ` [Qemu-devel] [PATCH 3/5] Multiboot support v4 Alexander Graf
2009-06-28 14:55 ` [Qemu-devel] [PATCH 4/5] Multiboot build system v4 Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).