Fix -kernel with SeaBIOS
cover Fix -kernel with SeaBIOS
SeaBIOS clears RAM between we write our -kernel image to RAM and the int19 handler gets triggered.
So in order to work around that, I sat down and implemented Avi's suggestion of "downloading" all blobs in runtime from the fw_cfg interface
Thanks to glommer who talked me into doing it ;-).
Alexander Graf (6):
Make fw_cfg interface 32-bit aware Introduce copy_rom
Convert multiboot to fw_cfg backed data storage Move common option rom code to header file Convert linux bootrom to external rom and fw_cfg Add linuxboot to BLOBS
Makefile | 2 +- hw/fw_cfg.c | 8 +- hw/fw_cfg.h | 13 +++- hw/loader.c | 38 +++++++++ hw/loader.h | 1 + hw/pc.c | 169 +++++++++++++---------------------------- pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 140 ++++++++++++++++++++++++++++++++++ pc-bios/optionrom/multiboot.S | 108 ++++++++++----------------- pc-bios/optionrom/optionrom.h | 107 ++++++++++++++++++++++++++ 10 files changed, 396 insertions(+), 192 deletions(-) create mode 100644 pc-bios/optionrom/linuxboot.S create mode 100644 pc-bios/optionrom/optionrom.h
PATCH 1/6 Make fw_cfg interface 32-bit aware
The fw_cfg interface can only handle up to 16 bits of data for its streams. While that isn't too much of a problem when handling integers, we would like to stream full kernel images over that interface!
So let's extend it to 32 bit length variables.
--- hw/fw_cfg.c | 8 ++++---- hw/fw_cfg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
hw/fw_cfg.c +4 -4
@@ -39,7 +39,7 @@#define FW_CFG_SIZE 2 typedef struct _FWCfgEntry { - uint16_t len; + uint32_t len; uint8_t *data; void *callback_opaque; FWCfgCallback callback;
@@ -48,7 +48,7 @@ typedef struct _FWCfgEntry {typedef struct _FWCfgState {FWCfgEntry entries[2 ][FW_CFG_MAX_ENTRY ];uint16_t cur_entry; -uint16_t cur_offset; +uint32_t cur_offset; }FWCfgState ;static void fw_cfg_write (FWCfgState *s,uint8_t value)
@@ -171,12 +171,12 @@ static const VMStateDescription vmstate_fw_cfg = { .minimum_version_id_old = 1, .fields = (VMStateField []) {VMSTATE_UINT16 (cur_entry, FWCfgState), -VMSTATE_UINT16 (cur_offset, FWCfgState), +VMSTATE_UINT32 (cur_offset, FWCfgState),VMSTATE_END_OF_LIST () } }; -int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint16_t len) +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len) {FWCfgState *s = opaque;int arch = !!(key &FW_CFG_ARCH_LOCAL );
hw/fw_cfg.h +1 -1
@@ -28,7 +28,7 @@#ifndef NO_QEMU_PROTOS typedef void (*FWCfgCallback )(void *opaque,uint8_t *data); -int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint16_t len); +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len);int fw_cfg_add_i16 (void *opaque,uint16_t key,uint16_t value);int fw_cfg_add_i32 (void *opaque,uint16_t key,uint32_t value);int fw_cfg_add_i64 (void *opaque,uint16_t key,uint64_t value);
Signature · 1 line
1.6.0.2
[Qemu-devel] Re: [PATCH 1/6] Make fw_cfg interface 32-bit aware
Quoted 40 lines · Alexander Graf
The
fw_cfginterface can only handle up to 16 bits of data for its streams. While that isn't too much of a problem when handling integers, we would like to stream full kernel images over that interface!So let's extend it to 32 bit length variables.
Signed-off-by Alexander Graf <[email protected]>--- hw/fw_cfg.c | 8 ++++---- hw/fw_cfg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)hw/fw_cfg.c +2
-3@@ -39,7 +39,7 @@#define FW_CFG_SIZE 2 typedef struct _FWCfgEntry { - uint16_t len; + uint32_t len; uint8_t *data; void *callback_opaque; FWCfgCallback callback;@@ -48,7 +48,7 @@ typedef struct _FWCfgEntry {typedef struct _FWCfgState {FWCfgEntry entries[2 ][FW_CFG_MAX_ENTRY ];uint16_t cur_entry; -uint16_t cur_offset; +uint32_t cur_offset; }FWCfgState ;static void fw_cfg_write (FWCfgState *s,uint8_t value)@@ -171,12 +171,12 @@ static const VMStateDescription vmstate_fw_cfg = { .minimum_version_id_old = 1, .fields = (VMStateField []) {VMSTATE_UINT16 (cur_entry, FWCfgState), -VMSTATE_UINT16 (cur_offset, FWCfgState),
hw/fw_cfg.c static const VMStateDescription vmstate_fw_cfg = { · line 182
Quoted 10 lines
hw/fw_cfg.c +2
-1+VMSTATE_UINT32 (cur_offset, FWCfgState), VMSTATE_END_OF_LIST() } }; -int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint16_t len) +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len) {FWCfgState *s = opaque;int arch = !!(key &FW_CFG_ARCH_LOCAL );
We need to bump a version here.
Quoted 14 lines
hw/fw_cfg.h +1
-1@@ -28,7 +28,7 @@#ifndef NO_QEMU_PROTOS typedef void (*FWCfgCallback )(void *opaque,uint8_t *data); -int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint16_t len); +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len);int fw_cfg_add_i16 (void *opaque,uint16_t key,uint16_t value);int fw_cfg_add_i32 (void *opaque,uint16_t key,uint32_t value);int fw_cfg_add_i64 (void *opaque,uint16_t key,uint64_t value);
[Qemu-devel] Re: [PATCH 1/6] Make fw_cfg interface 32-bit aware
Quoted 46 lines · Anthony Liguori
Quoted 45 lines · Alexander Graf
The
fw_cfginterface can only handle up to 16 bits of data for its streams.
While that isn't too much of a problem when handling integers, we would like to stream full kernel images over that interface!So let's extend it to 32 bit length variables.
Signed-off-by Alexander Graf <[email protected]>--- hw/fw_cfg.c | 8 ++++---- hw/fw_cfg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)hw/fw_cfg.c +3
-3@@ -39,7 +39,7 @@#define FW_CFG_SIZE 2 typedef struct _FWCfgEntry { - uint16_t len; + uint32_t len; uint8_t *data; void *callback_opaque; FWCfgCallback callback;@@ -48,7 +48,7 @@ typedef struct _FWCfgEntry {typedef struct _FWCfgState {FWCfgEntry entries[2 ][FW_CFG_MAX_ENTRY ];uint16_t cur_entry; -uint16_t cur_offset; +uint32_t cur_offset; }FWCfgState ;static void fw_cfg_write (FWCfgState *s,uint8_t value)@@ -171,12 +171,12 @@ static const VMStateDescription vmstate_fw_cfg = { .minimum_version_id_old = 1, .fields = (VMStateField []) {VMSTATE_UINT16 (cur_entry, FWCfgState), -VMSTATE_UINT16 (cur_offset, FWCfgState), +VMSTATE_UINT32 (cur_offset, FWCfgState),VMSTATE_END_OF_LIST () } };
Quoted 10 lines
Quoted 8 lines
hw/fw_cfg.c +1
-1-int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data, uint16_t len) +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len) {FWCfgState *s = opaque; int arch = !!(key & FW_CFG_ARCH_LOCAL);We need to bump a version here.
Sure - which one?
Alex
[Qemu-devel] Re: [PATCH 1/6] Make fw_cfg interface 32-bit aware
Quoted 61 lines · Alexander Graf
Quoted 47 lines · Anthony Liguori
Quoted 45 lines · Alexander Graf
The
fw_cfginterface can only handle up to 16 bits of data for its streams.
While that isn't too much of a problem when handling integers, we would like to stream full kernel images over that interface!So let's extend it to 32 bit length variables.
Signed-off-by Alexander Graf <[email protected]>--- hw/fw_cfg.c | 8 ++++---- hw/fw_cfg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)hw/fw_cfg.c +3
-3@@ -39,7 +39,7 @@#define FW_CFG_SIZE 2 typedef struct _FWCfgEntry { - uint16_t len; + uint32_t len; uint8_t *data; void *callback_opaque; FWCfgCallback callback;@@ -48,7 +48,7 @@ typedef struct _FWCfgEntry {typedef struct _FWCfgState {FWCfgEntry entries[2 ][FW_CFG_MAX_ENTRY ];uint16_t cur_entry; -uint16_t cur_offset; +uint32_t cur_offset; }FWCfgState ;static void fw_cfg_write (FWCfgState *s,uint8_t value)@@ -171,12 +171,12 @@ static const VMStateDescription vmstate_fw_cfg = { .minimum_version_id_old = 1, .fields = (VMStateField []) {VMSTATE_UINT16 (cur_entry, FWCfgState), -VMSTATE_UINT16 (cur_offset, FWCfgState), +VMSTATE_UINT32 (cur_offset, FWCfgState),VMSTATE_END_OF_LIST () } };Quoted 11 lines
Quoted 9 lines
hw/fw_cfg.c +1
-1-int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data, uint16_t len) +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len) {FWCfgState *s = opaque; int arch = !!(key & FW_CFG_ARCH_LOCAL);We need to bump a version here.
Quoted 2 lines
Sure - which one?
The version_id field in vmstate_fw_cfg. You also have to try to support older versions which means you may want to either split cur_offset into a high and low or ask Juan what the appropriate vodoo would be.
Regards,
Anthony Liguori
Quoted 2 lines
Alex
[Qemu-devel] Re: [PATCH 1/6] Make fw_cfg interface 32-bit aware
Quoted 59 lines · Anthony Liguori
Quoted 58 lines · Alexander Graf
Quoted 55 lines · Anthony Liguori
Quoted 48 lines · Alexander Graf
The
fw_cfginterface can only handle up to 16 bits of data for its streams.
While that isn't too much of a problem when handling integers, we would like to stream full kernel images over that interface!So let's extend it to 32 bit length variables.
Signed-off-by Alexander Graf <[email protected]>---
hw/fw_cfg.c | 8 ++++---- hw/fw_cfg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)hw/fw_cfg.c +4
-4@@ -39,7 +39,7 @@#define FW_CFG_SIZE 2 typedef struct _FWCfgEntry { - uint16_t len; + uint32_t len; uint8_t *data; void *callback_opaque; FWCfgCallback callback;@@ -48,7 +48,7 @@ typedef struct _FWCfgEntry {typedef struct _FWCfgState {FWCfgEntry entries[2 ][FW_CFG_MAX_ENTRY ];uint16_t cur_entry; -uint16_t cur_offset; +uint32_t cur_offset; }FWCfgState ;static void fw_cfg_write (FWCfgState *s,uint8_t value)@@ -171,12 +171,12 @@ static const VMStateDescription vmstate_fw_cfg = { .minimum_version_id_old = 1, .fields = (VMStateField []) {VMSTATE_UINT16 (cur_entry, FWCfgState), -VMSTATE_UINT16 (cur_offset, FWCfgState), +VMSTATE_UINT32 (cur_offset, FWCfgState),VMSTATE_END_OF_LIST () } }; -int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data, uint16_t len) +int fw_cfg_add_bytes (void *opaque,uint16_t key,uint8_t *data,uint32_t len) {Quoted 3 lines
FWCfgState *s = opaque; int arch = !!(key & FW_CFG_ARCH_LOCAL);We need to bump a version here.
Quoted 4 lines
Quoted 2 lines
Sure - which one?
The
version_idfield invmstate_fw_cfg. You also have to try to support older versions which means you may want to either splitcur_offsetinto a high and low or ask Juan what the appropriate vodoo would be.
Juan, I'd really love to learn some new voodoo :-).
This whole new qdev whatever based save format was supposed to make things like this easy, right? I would've known what to do with the old code ...
Alex
[Qemu-devel] Re: [PATCH 1/6] Make fw_cfg interface 32-bit aware
Quoted 2 lines · Alexander Graf
Juan, I'd really love to learn some new voodoo :-).
This whole new qdev whatever based save format was supposed to make things like this easy, right? I would've known what to do with the old code ...
I think Juan's mentioned something about writing a doc explaining how to use VMState correctly. I think it would certainly be helpful for situations like this.
But the most important part of VMState is that it converts something that was previously open coded and opaque to something that is data-driven and introspectable. I think it's done an extremely good job of achieving those goals. As we get everything converted, we can potentially figure out some ways to make this all a bit easier to understand. Right now, I think how we support backwards compatibility is admittedly awkward.
Regards,
Anthony Liguori
Quoted 1 line
Alex
PATCH 2/6 Introduce copy_rom
In reply to Alexander GrafWe have several rom helpers currently, but none of them can get us code that spans several roms into a pointer.
This patch introduces a function that copies over rom contents.
--- hw/loader.c | 38 ++++++++++++++++++++++++++++++++++++++ hw/loader.h | 1 + 2 files changed, 39 insertions(+), 0 deletions(-)
hw/loader.c +38 -0
@@ -701,6 +701,44 @@ static Rom *find_rom(target_phys_addr_t addr)return NULL ; } +int copy_rom (uint8_t *dest,target_phys_addr_t addr,size_t size) +{ +target_phys_addr_t end = addr + size; +uint8_t *s, *d = dest; +size_t l =0 ; +Rom *rom; + + QTAILQ_FOREACH(rom, &roms, next) { +if (rom->max) +continue ; +if (rom->min > addr) +continue ; +if (rom->min + rom->romsize < addr) +continue ; +if (rom->min > end) +break ; +if (!rom->data) +continue ; + + d = dest + (rom->min - addr); + s = rom->data; + l = rom->romsize; + +if (rom->min < addr) { + d = dest; + s += (addr - rom->min); + l -= (addr - rom->min); + } +if ((d + l) > (dest + size)) { + l = dest - d; + } + +memcpy (d, s, l); + } + +return (d + l) - dest; +} +void *rom_ptr (target_phys_addr_t addr) {Rom *rom;
hw/loader.h +1 -0
@@ -24,6 +24,7 @@ int rom_add_file(const char *file,int rom_add_blob (const char *name,const void *blob,size_t len,target_phys_addr_t min,target_phys_addr_t max,int align);int rom_load_all (void ); +int copy_rom (uint8_t *dest,target_phys_addr_t addr,size_t size);void *rom_ptr (target_phys_addr_t addr);void do_info_roms (Monitor *mon);
Signature · 1 line
1.6.0.2
[Qemu-devel] Re: [PATCH 2/6] Introduce copy_rom
Quoted 65 lines · Alexander Graf
We have several rom helpers currently, but none of them can get us code that spans several roms into a pointer.
This patch introduces a function that copies over rom contents.
Signed-off-by Alexander Graf <[email protected]>--- hw/loader.c | 38 ++++++++++++++++++++++++++++++++++++++ hw/loader.h | 1 + 2 files changed, 39 insertions(+), 0 deletions(-)hw/loader.c +38
-0@@ -701,6 +701,44 @@ static Rom *find_rom(target_phys_addr_t addr)return NULL ; } +int copy_rom (uint8_t *dest,target_phys_addr_t addr,size_t size) +{ +target_phys_addr_t end = addr + size; +uint8_t *s, *d = dest; +size_t l =0 ; +Rom *rom; + + QTAILQ_FOREACH(rom, &roms, next) { +if (rom->max) +continue ; +if (rom->min > addr) +continue ; +if (rom->min + rom->romsize < addr) +continue ; +if (rom->min > end) +break ; +if (!rom->data) +continue ; + + d = dest + (rom->min - addr); + s = rom->data; + l = rom->romsize; + +if (rom->min < addr) { + d = dest; + s += (addr - rom->min); + l -= (addr - rom->min); + } +if ((d + l) > (dest + size)) { + l = dest - d; + } + +memcpy (d, s, l); + } + +return (d + l) - dest; +} +void *rom_ptr (target_phys_addr_t addr) {Rom *rom;hw/loader.h +0
-0
hw/loader.h int rom_add_file(const char *file, · line 28
Quoted 5 lines
hw/loader.h +1
-0@@ -24,6 +24,7 @@ int rom_add_file(const char *file,int rom_add_blob (const char *name,const void *blob,size_t len,target_phys_addr_t min,target_phys_addr_t max,int align);int rom_load_all (void ); +int copy_rom (uint8_t *dest,target_phys_addr_t addr,size_t size);
rom_copy() would have fit better.
Regards,
Anthony Liguori
[Qemu-devel] Re: [PATCH 2/6] Introduce copy_rom
Quoted 65 lines · Anthony Liguori
Quoted 64 lines · Alexander Graf
We have several rom helpers currently, but none of them can get us code that spans several roms into a pointer.
This patch introduces a function that copies over rom contents.
Signed-off-by Alexander Graf <[email protected]>---
hw/loader.c| 38 ++++++++++++++++++++++++++++++++++++++hw/loader.h| 1 +2 files changed, 39 insertions(+), 0 deletions(-)hw/loader.c +38
-0@@ -701,6 +701,44 @@ static Rom *find_rom(target_phys_addr_t addr)return NULL ; } +int copy_rom (uint8_t *dest,target_phys_addr_t addr,size_t size) +{ +target_phys_addr_t end = addr + size; +uint8_t *s, *d = dest; +size_t l =0 ; +Rom *rom; + + QTAILQ_FOREACH(rom, &roms, next) { +if (rom->max) +continue ; +if (rom->min > addr) +continue ; +if (rom->min + rom->romsize < addr) +continue ; +if (rom->min > end) +break ; +if (!rom->data) +continue ; + + d = dest + (rom->min - addr); + s = rom->data; + l = rom->romsize; + +if (rom->min < addr) { + d = dest; + s += (addr - rom->min); + l -= (addr - rom->min); + } +if ((d + l) > (dest + size)) { + l = dest - d; + } + +memcpy (d, s, l); + } + +return (d + l) - dest; +} +void *rom_ptr (target_phys_addr_t addr) {Rom *rom;hw/loader.h +0
-0@@ -24,6 +24,7 @@ int rom_add_file(const char *file,
Quoted 8 lines
hw/loader.h int rom_add_file(const char *file, · line 30
Quoted 6 lines
hw/loader.h +1
-0int rom_add_blob (const char *name,const void *blob,size_t len,target_phys_addr_t min,target_phys_addr_t max,int align);int rom_load_all (void ); +int copy_rom (uint8_t *dest,target_phys_addr_t addr,size_t size);
rom_copy()would have fit better.
Ok, will rename in v2.
Alex
PATCH 3/6 Convert multiboot to fw_cfg backed data storage
In reply to Alexander GrafRight now we load the guest kernel to RAM, fire off the BIOS, hope it doesn't clobber memory and run an option rom that jumps into the kernel.
That breaks with SeaBIOS, as that clears memory. So let's read all kernel, module etc. data using the fw_cfg interface when in the int19 handler.
This patch implements said mechanism for multiboot.
--- hw/fw_cfg.h | 5 ++- hw/pc.c | 43 ++++++++++++++++------- pc-bios/optionrom/multiboot.S | 77 ++++++++++++++++++++++++++++++++--------- 3 files changed, 94 insertions(+), 31 deletions(-)
hw/fw_cfg.h +4 -1
@@ -17,7 +17,10 @@#define FW_CFG_NUMA 0x0d#define FW_CFG_BOOT_MENU 0x0e#define FW_CFG_MAX_CPUS 0x0f -#define FW_CFG_MAX_ENTRY 0x10 +#define FW_CFG_KERNEL_ENTRY 0x10 +#define FW_CFG_KERNEL_DATA 0x11 +#define FW_CFG_INITRD_DATA 0x12 +#define FW_CFG_MAX_ENTRY 0x13#define FW_CFG_WRITE_CHANNEL 0x4000#define FW_CFG_ARCH_LOCAL 0x8000
hw/pc.c +30 -13
83 lines not on this page · raw message
pc-bios/optionrom/multiboot.S +60 -17
140 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 4/6 Move common option rom code to header file
In reply to Alexander GrafWe will have a linux boot option rom soon, so let's take all functionality that might be useful for both to a header file that both roms can include.
That way we only have to write fw_cfg access code once.
--- pc-bios/optionrom/multiboot.S | 79 +----------------------------- pc-bios/optionrom/optionrom.h | 107 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 76 deletions(-) create mode 100644 pc-bios/optionrom/optionrom.h
pc-bios/optionrom/multiboot.S +3 -76
@@ -18,86 +18,15 @@ * Authors: Alexander Graf <[email protected]> */ -#define NO_QEMU_PROTOS -#include "../../hw/fw_cfg.h" - -#define BIOS_CFG_IOPORT_CFG 0x510 -#define BIOS_CFG_IOPORT_DATA 0x511 +#include "optionrom.h" #define MULTIBOOT_MAGIC 0x2badb002 #define GS_PROT_JUMP 0 #define GS_GDT_DESC 6 -/* Break the translation block flow so -d cpu shows us values */ -#define DEBUG_HERE \ - jmp 1f; \ - 1: - -/* 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 -/* - * Read a blob from the fw_cfg device. - * Requires _ADDR, _SIZE and _DATA values for the parameter. - * - * Clobbers: %eax, %edx, %es, %ecx, %edi - */ -#define read_fw_blob(var) \ - read_fw var ## _ADDR; \ - mov %eax, %edi; \ - read_fw var ## _SIZE; \ - mov %eax, %ecx; \ - mov $var ## _DATA, %ax; \ - mov $BIOS_CFG_IOPORT_CFG, %edx; \ - outw %ax, (%dx); \ - mov $BIOS_CFG_IOPORT_DATA, %dx; \ - cld; \ - DEBUG_HERE \ - rep insb (%dx), %es:(%edi); - -.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 - - /* 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 */ +BOOT_ROM_START run_multiboot:
@@ -249,6 +178,4 @@ gdt_desc: .short (5 * 8) - 1 .long gdt -.align 512, 0 -_end: - +BOOT_ROM_END
pc-bios/optionrom/optionrom.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 5/6 Convert linux bootrom to external rom and fw_cfg
In reply to Alexander GrafWe already have a working multiboot implementation that uses fw_cfg to get its kernel module etc. data in int19 runtime now.
So what's missing is a working linux boot option rom. While at it I figured it would be a good idea to take the opcode generator out of pc.c and instead use a proper option rom, like we do with multiboot.
So here it is - an fw_cfg using option rom for -kernel with linux!
--- hw/fw_cfg.h | 8 ++- hw/pc.c | 126 +++++++------------------------------ pc-bios/optionrom/Makefile | 2 +- pc-bios/optionrom/linuxboot.S | 140 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 172 insertions(+), 104 deletions(-) create mode 100644 pc-bios/optionrom/linuxboot.S
hw/fw_cfg.h +7 -1
@@ -20,7 +20,13 @@#define FW_CFG_KERNEL_ENTRY 0x10#define FW_CFG_KERNEL_DATA 0x11#define FW_CFG_INITRD_DATA 0x12 -#define FW_CFG_MAX_ENTRY 0x13 +#define FW_CFG_CMDLINE_ADDR 0x13 +#define FW_CFG_CMDLINE_SIZE 0x14 +#define FW_CFG_CMDLINE_DATA 0x15 +#define FW_CFG_SETUP_ADDR 0x16 +#define FW_CFG_SETUP_SIZE 0x17 +#define FW_CFG_SETUP_DATA 0x18 +#define FW_CFG_MAX_ENTRY 0x19#define FW_CFG_WRITE_CHANNEL 0x4000#define FW_CFG_ARCH_LOCAL 0x8000
hw/pc.c +24 -102
158 lines not on this page · raw message
pc-bios/optionrom/Makefile +1 -1
@@ -13,7 +13,7 @@ CFLAGS += -I$(SRC_PATH) CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector) QEMU_CFLAGS = $(CFLAGS) -build-all: multiboot.bin +build-all: multiboot.bin linuxboot.bin %.img: %.o $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
pc-bios/optionrom/linuxboot.S new file +140 -0
140 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 6/6 Add linuxboot to BLOBS
In reply to Alexander GrafWe should install linuxboot.bin too, so let's add it to the to-be-installed blobs.
--- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -256,7 +256,7 @@ video.x openbios-sparc32 openbios-sparc64 openbios-ppc \ pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \ pxe-virtio.bin pxe-eepro100.bin pxe-pcnet.bin \ bamboo.dtb petalogix-s3adsp1800.dtb \ -multiboot.bin +multiboot.bin linuxboot.bin else BLOBS= endif
Signature · 1 line
1.6.0.2
Thanks Alexander,
I hope this goes into qemu.git ASAP - without it it's totally unusable for my test setup, and it of course bit my silently when preparing a demo for a confernence where only reverting back to and older qemu helped..
Am 12.11.2009 um 15:53 schrieb Christoph Hellwig <[email protected]>:
Quoted 7 lines
Thanks Alexander,
I hope this goes into qemu.git ASAP - without it it's totally unusable for my test setup, and it of course bit my silently when preparing a demo for a confernence where only reverting back to and older qemu helped..
Yeah, I'm only waiting for a reply from Juan. If I don't see anything until tonight I'll send out my (untested) compat version that uses load_old.
Alex