Reorganize option rom (+linux kernel) loading.
PATCH 1/1 Reorganize option rom (+linux kernel) loading.
This patch adds infrastructure to maintain memory regions which must be restored on reset. That includes roms (vga bios and option roms on pc), but is also used when loading linux kernels directly. Features:
- loading files is supported.
- passing blobs is supported.
- target address range is supported (for optionrom area).
- fixed target memory address is supported (linux kernel).
The final memory layout is created once all memory regions are registered. The option roms get addresses assigned and the registered regions are checked against overlaps. Finally all data is copyed to the guest memory.
Advantages:
(1) Filling memory on initial boot and on reset takes the same code path, making reset more robust.
(2) The need to keep track of the option rom load address is gone.
(3) Due to (2) option roms can be loaded outside pc_init(). This allows to move the pxe rom loading into the nic drivers for example.
Additional bonus: There is a 'info roms' monitor command now.
The patch also switches over pc.c and removes the option_rom_setup_reset() and load_option_rom() functions.
--- hw/elf_ops.h | 6 +- hw/loader.c | 166 +++++++++++++++++++++++++++++++++++- hw/loader.h | 24 +++++ hw/pc.c | 269 ++++++++++++++++++---------------------------------------- monitor.c | 3 + vl.c | 3 + 6 files changed, 282 insertions(+), 189 deletions(-)
hw/elf_ops.h +4 -2
@@ -179,7 +179,7 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab,return -1 ; } -static int glue (load_elf ,SZ )(int fd,int64_t address_offset, +static int glue (load_elf ,SZ )(const char *name,int fd,int64_t address_offset,int must_swab,uint64_t *pentry,uint64_t *lowaddr,uint64_t *highaddr,int elf_machine,int clear_lsb)
@@ -190,6 +190,7 @@ static int glue(load_elf, SZ)(int fd, int64_t address_offset,elf_word mem_size;uint64_t addr, low = (uint64_t )-1 , high =0 ;uint8_t *data =NULL ; +char label[128 ];if (read (fd, &ehdr,sizeof (ehdr)) !=sizeof (ehdr)) goto fail;
@@ -249,7 +250,8 @@ static int glue(load_elf, SZ)(int fd, int64_t address_offset,linked at the wrong physical address. */ addr = ph->p_paddr + address_offset; -cpu_physical_memory_write_rom (addr, data, mem_size); +snprintf (label,sizeof (label),"phdr #%d: %s" , i, name); +rom_add_blob_fixed (label, data, mem_size, addr); total_size += mem_size;if (addr < low)
hw/loader.c +164 -2
183 lines not on this page · raw message
hw/loader.h +24 -0
@@ -18,4 +18,28 @@ int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);int read_targphys (int fd,target_phys_addr_t dst_addr,size_t nbytes);void pstrcpy_targphys (target_phys_addr_t dest,int buf_size,const char *source); + +int rom_add_file (const char *file, +target_phys_addr_t min,target_phys_addr_t max,int align); +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 ); +void do_info_roms (Monitor *mon); + +#define rom_add_file_fixed (_f, _a) \ + rom_add_file(_f, _a, 0, 0) +#define rom_add_blob_fixed (_f, _b, _l, _a) \ + rom_add_blob(_f, _b, _l, _a, 0, 0) + +#define PC_ROM_MIN_VGA 0xc0000 +#define PC_ROM_MIN_OPTION 0xc8000 +#define PC_ROM_MAX 0xe0000 +#define PC_ROM_ALIGN 0x800 +#define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA) + +#define rom_add_vga (_f) \ + rom_add_file(_f, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN) +#define rom_add_option (_f) \ + rom_add_file(_f, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN) +#endif
hw/pc.c +84 -185
449 lines not on this page · raw message
monitor.c +3 -0
@@ -29,6 +29,7 @@#include "hw/pc.h" #include "hw/pci.h" #include "hw/watchdog.h" +#include "hw/loader.h" #include "gdbstub.h" #include "net.h" #include "qemu-char.h"
@@ -1884,6 +1885,8 @@ static const mon_cmd_t info_cmds[] = { "", "show device tree" }, {"qdm" ,"" , do_info_qdm, "", "show qdev device model list" }, + { "roms", "", do_info_roms, + "", "show roms" }, { NULL, NULL, }, };
vl.c +3 -0
@@ -140,6 +140,7 @@ int main(int argc, char **argv)#include "hw/smbios.h" #include "hw/xen.h" #include "hw/qdev.h" +#include "hw/loader.h" #include "bt-host.h" #include "net.h" #include "monitor.h"
@@ -5875,6 +5876,8 @@ int main(int argc, char **argv, char **envp)exit (1 ); } +rom_load_all (); +if (loadvm) {if (load_vmstate (cur_mon, loadvm) <0 ) { autostart =0 ;
Signature · 1 line
1.6.2.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Juan Quintela
Review
Quoted 2 lines · Gerd Hoffmann
(quoted diff) +2
-0+ +static void rom_insert(const char *type, Rom *rom)You are not using the type parameter,
Indeed. There was a debug message which used the type parameter. Guess it can be zapped now.
Quoted 2 lines
I guess that a field inside struct
Rom could make sense.
I don't think so. What for?
cheers,
Gerd
Quoted 23 lines · Gerd Hoffmann
This patch adds infrastructure to maintain memory regions which must be restored on reset. That includes roms (vga bios and option roms on pc), but is also used when loading linux kernels directly. Features:
- loading files is supported.
- passing blobs is supported.
- target address range is supported (for optionrom area).
- fixed target memory address is supported (linux kernel).The final memory layout is created once all memory regions are registered. The option roms get addresses assigned and the registered regions are checked against overlaps. Finally all data is copyed to the guest memory.
Advantages:
(1) Filling memory on initial boot and on reset takes the same code path, making reset more robust.
(2) The need to keep track of the option rom load address is gone.
(3) Due to (2) option roms can be loaded outsidepc_init(). This allows to move the pxe rom loading into the nic drivers for example.
Quoted 4 lines
Additional bonus: There is a 'info roms' monitor command now.
The patch also switches over
pc.cand removes theoption_rom_setup_reset()andload_option_rom()functions.
Nice idea. The implementation seems to be buggy, I only ever see one rom and for example sparc-test crashes when issuing 'info roms'.
Perhaps 'info roms' could also check whether the rom has been changed? On most platforms roms are really read only memories.
Quoted 2 lines
+ fd =
open(rom->path, O_RDONLY);
+ if (-1 == fd) {
Not again!
Quoted 5 lines
+ rom->align = align;
+ rom->min = min;
+ rom->max = max;
+ rom->romsize =lseek(fd, 0, SEEK_END);
+ rom->data =qemu_mallocz(rom->romsize);
There are plenty of extra spaces.
Hi,
Quoted 2 lines
Nice idea. The implementation seems to be buggy, I only ever see one rom
On !pc platforms only elf roms will show up.
Quoted 1 line
and for example sparc-test crashes when issuing 'info roms'.
Huh? Works for me. Details please. sparc is one of the archs I've actually tested:
(qemu) info roms
addr=0000000070000000 size=0x0e4000 name="phdr #0: /home/kraxel/projects/qemu/pc-bios/openbios-sparc32"
ppc has two entries from the two elf phdr sections:
(qemu) info roms
addr=00000000fff00000 size=0x052c88 name="phdr #0: /home/kraxel/projects/qemu/pc-bios/openbios-ppc" addr=00000000fffffffc size=0x000004 name="phdr #1: /home/kraxel/projects/qemu/pc-bios/openbios-ppc"
pc has multiple entries when loading option roms (for network booting), looks like this then:
(qemu) info roms
addr=00000000000c0000 size=0x008c00 name="vgabios-cirrus.bin" addr=00000000000c9000 size=0x008000 name="pxe-e1000.bin"
Booting linux kernels (pc too) directly will produce even more entries:
(qemu) info roms
addr=0000000000010000 size=0x003800 name="linux-setup" addr=0000000000020000 size=0x000001 name="linux-cmdline" addr=00000000000c0000 size=0x008c00 name="vgabios-cirrus.bin" addr=00000000000c9000 size=0x000200 name="linux-bootsect" addr=0000000000100000 size=0x342910 name="/boot/vmlinuz-2.6.30.5-43.fc11.x86_64"
Quoted 1 line
Perhaps 'info roms' could also check whether the rom has been changed?
Point being?
Quoted 1 line
On most platforms roms are really read only memories.
Yep, I've noticed on a quick glimpse. So in that case writing roms on reset isn't very useful because the guest shouldn't be able to modify them in the first place. It doesn't harm though, except that we keep a copy of the roms around for no reason. Maybe make restore-on-reset opt-in?
Quoted 4 lines
hw/loader.c out: · line 601
Quoted 2 lines
hw/loader.c +2
-0+ fd =open (rom->path,O_RDONLY ); +if (-1 == fd) {Not again!
Oops. Fixed.
Quoted 7 lines
hw/loader.c out: · line 611
Quoted 5 lines
hw/loader.c +5
-0+ rom->align = align; + rom->min = min; + rom->max = max; + rom->romsize =lseek (fd,0 ,SEEK_END ); + rom->data =qemu_mallocz (rom->romsize);There are plenty of extra spaces.
The vertical alignment makes the code more readable IMHO.
cheers,
Gerd
Quoted 11 lines · Gerd Hoffmann
Hi,
Quoted 2 lines
Nice idea. The implementation seems to be buggy, I only ever see one rom
On !pc platforms only elf roms will show up.
Quoted 1 line
and for example sparc-test crashes when issuing 'info roms'.
Huh? Works for me. Details please. sparc is one of the archs I've actually tested:
OK, V2 seems to work, except that the command line is not passed:
NET: Registered protocol family 1
NET: Registered protocol family 17
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) <0>Press L1-A to return to the boot prom
Quoted 3 lines
Quoted 1 line
Perhaps 'info roms' could also check whether the rom has been changed?
Point being?
Could be useful information. Maybe not.
Quoted 6 lines
Quoted 1 line
On most platforms roms are really read only memories.
Yep, I've noticed on a quick glimpse. So in that case writing roms on reset isn't very useful because the guest shouldn't be able to modify them in the first place. It doesn't harm though, except that we keep a copy of the roms around for no reason. Maybe make restore-on-reset opt-in?
Or make writability opt-in feature?
Quoted 5 lines
OK, V2 seems to work, except that the command line is not passed:
NET: Registered protocol family 1
NET: Registered protocol family 17Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) <0>Press L1-A to return to the boot prom
So you are booting sparc via -kernel I guess?
Quoted 3 lines
Quoted 1 line
around for no reason. Maybe make restore-on-reset opt-in?
Or make writability opt-in feature?
v2 does it automagically by checking the memory type. 'info roms' got a new mem=[ram|rom] entry.
cheers,
Gerd
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines
OK, V2 seems to work, except that the command line is not passed:
NET: Registered protocol family 1
NET: Registered protocol family 17Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(1,0)
<0>Press L1-A to return to the boot promSo you are booting sparc via -kernel I guess?
One more question: Fails it on first boot or only after reset? In case it fails after reset only: Does that work without the patch?
thanks,
Gerd
Quoted 9 lines · Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann
Quoted 7 lines
OK, V2 seems to work, except that the command line is not passed:
NET: Registered protocol family 1
NET: Registered protocol family 17Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(1,0)
<0>Press L1-A to return to the boot prom
Quoted 4 lines
Quoted 1 line
So you are booting sparc via -kernel I guess?
One more question: Fails it on first boot or only after reset? In case it fails after reset only: Does that work without the patch?
First boot, identical result after reset. Without patch:
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 4096KiB [1 disk] into ram disk... done.
VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 156k freed
sh: can't access tty; job control turned off
#
Quoted 17 lines · Blue Swirl
Quoted 9 lines · Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann
Quoted 7 lines
OK, V2 seems to work, except that the command line is not passed:
NET: Registered protocol family 1
NET: Registered protocol family 17Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(1,0)
<0>Press L1-A to return to the boot promQuoted 4 lines
Quoted 1 line
So you are booting sparc via -kernel I guess?
One more question: Fails it on first boot or only after reset? In case it fails after reset only: Does that work without the patch?
First boot, identical result after reset. Without patch:
Quoted 8 lines
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 4096KiB [1 disk] into ram disk... done.
VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 156k freed
sh: can't access tty; job control turned off
#
Incremental fix attached.
Booting works now.system_reset in monitor works fine too.
Will respin the patch tomorrow.
cheers,
Gerd
From 73928f9846fc8493d56f5a42c25b68707f6679e7 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Tue, 6 Oct 2009 23:09:50 +0200
Subject: [PATCH] fix sparc.
--- hw/axis_dev88.c | 2 +- hw/etraxfs.c | 2 +- hw/loader.c | 38 ++++++++++++++++++++++++++++++++------ hw/loader.h | 4 +++- hw/mips_malta.c | 2 +- hw/mips_r4k.c | 2 +- hw/pc.c | 2 +- hw/petalogix_s3adsp1800_mmu.c | 2 +- hw/ppc.c | 2 +- hw/ppc_newworld.c | 2 +- hw/ppc_oldworld.c | 2 +- hw/r2d.c | 2 +- hw/sun4m.c | 14 ++++++++------ hw/sun4u.c | 2 +- 14 files changed, 54 insertions(+), 24 deletions(-)
hw/axis_dev88.c +1 -1
@@ -365,7 +365,7 @@ void axisdev88_init (ram_addr_t ram_size,/* Let the kernel know we are modifying the cmdline. */ env->regs[10 ] =0x87109563 ; env->regs[11 ] =0x40000000 ; -pstrcpy_targphys (env->regs[11 ],256 , kernel_cmdline); +pstrcpy_targphys ("cmdline" , env->regs[11 ],256 , kernel_cmdline); } } env->pc = bootstrap_pc;
hw/etraxfs.c +1 -1
@@ -157,7 +157,7 @@ void bareetraxfs_init (ram_addr_t ram_size,/* Let the kernel know we are modifying the cmdline. */ env->regs[10 ] =0x87109563 ; env->regs[11 ] =0x40000000 ; -pstrcpy_targphys (env->regs[11 ],256 , kernel_cmdline); +pstrcpy_targphys ("cmdline" , env->regs[11 ],256 , kernel_cmdline); } } env->pc = bootstrap_pc;
hw/loader.c +32 -6
@@ -108,20 +108,20 @@ int load_image_targphys(const char *filename,return size; } -void pstrcpy_targphys (target_phys_addr_t dest,int buf_size, +void pstrcpy_targphys (const char *name,target_phys_addr_t dest,int buf_size,const char *source) { -static const uint8_t nul_byte =0 ;const char *nulp; +char *ptr;if (buf_size <=0 )return ; nulp =memchr (source,0 , buf_size);if (nulp) { -cpu_physical_memory_write_rom (dest, (uint8_t *)source, - (nulp - source) +1 ); +rom_add_blob_fixed (name, source, (nulp - source) +1 , dest); }else { -cpu_physical_memory_write_rom (dest, (uint8_t *)source, buf_size -1 ); -cpu_physical_memory_write_rom (dest, &nul_byte,1 ); +rom_add_blob_fixed (name, source, buf_size, dest); + ptr =rom_ptr (dest + buf_size -1 ); + *ptr =0 ; } }
@@ -672,6 +672,32 @@ int rom_load_all(void)return 0 ; } +static Rom *find_rom (target_phys_addr_t addr) +{ +Rom *rom; + + QTAILQ_FOREACH(rom, &roms, next) { +if (rom->max) +continue ; +if (rom->min > addr) +continue ; +if (rom->min + rom->romsize < addr) +continue ; +return rom; + } +return NULL ; +} + +void *rom_ptr (target_phys_addr_t addr) +{ +Rom *rom; + + rom =find_rom (addr); +if (!rom || !rom->data) +return NULL ; +return rom->data + (addr - rom->min); +} +void do_info_roms (Monitor *mon) {Rom *rom;
hw/loader.h +3 -1
@@ -15,7 +15,8 @@ int load_uimage(const char *filename, target_phys_addr_t *ep,int read_targphys (const char *name,int fd,target_phys_addr_t dst_addr,size_t nbytes); -void pstrcpy_targphys (target_phys_addr_t dest,int buf_size, +void pstrcpy_targphys (const char *name, +target_phys_addr_t dest,int buf_size,const char *source); int rom_add_file(const char *file,
@@ -23,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 ); +void *rom_ptr (target_phys_addr_t addr);void do_info_roms (Monitor *mon);#define rom_add_file_fixed (_f, _a) \
hw/mips_malta.c +1 -1
@@ -679,7 +679,7 @@ static void prom_set(int index, const char *string, ...)va_start (ap, string);vsnprintf (buf,ENVP_ENTRY_SIZE , string, ap);va_end (ap); -pstrcpy_targphys (table_addr +VIRT_TO_PHYS_ADDEND ,ENVP_ENTRY_SIZE , buf); +pstrcpy_targphys ("prom" , table_addr +VIRT_TO_PHYS_ADDEND ,ENVP_ENTRY_SIZE , buf); }/* Kernel */
hw/mips_r4k.c +1 -1
@@ -130,7 +130,7 @@ static void load_kernel (CPUState *env) }else { ret =0 ; } -pstrcpy_targphys ((16 <<20 ) -256 + ret,256 , +pstrcpy_targphys ("cmdline" , (16 <<20 ) -256 + ret,256 , loaderparams.kernel_cmdline);stl_phys ((16 <<20 ) -260 ,0x12345678 );
hw/pc.c +1 -1
@@ -865,7 +865,7 @@ static void load_linux(void *fw_cfg, initrd_max = max_ram_size-ACPI_DATA_SIZE -1 ;/* kernel command line */ -rom_add_blob_fixed ("linux-cmdline" , kernel_cmdline, +rom_add_blob_fixed ("cmdline" , kernel_cmdline,strlen (kernel_cmdline)+1 , cmdline_addr);if (protocol >=0x202 ) {
hw/petalogix_s3adsp1800_mmu.c +1 -1
@@ -176,7 +176,7 @@ petalogix_s3adsp1800_init(ram_addr_t ram_size, env->regs[5 ] = ddr_base + kernel_size;if (kernel_cmdline && (kcmdline_len =strlen (kernel_cmdline))) { -pstrcpy_targphys (env->regs[5 ],256 , kernel_cmdline); +pstrcpy_targphys ("cmdline" , env->regs[5 ],256 , kernel_cmdline); } env->regs[6 ] =0 ;/* Provide a device-tree. */
hw/ppc.c +1 -1
@@ -1256,7 +1256,7 @@ int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,NVRAM_set_lword (nvram,0x3C , kernel_size);if (cmdline) {/* XXX: put the cmdline in NVRAM too ? */ -pstrcpy_targphys (CMDLINE_ADDR , RAM_size -CMDLINE_ADDR , cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR , RAM_size -CMDLINE_ADDR , cmdline);NVRAM_set_lword (nvram,0x40 ,CMDLINE_ADDR );NVRAM_set_lword (nvram,0x44 ,strlen (cmdline)); }else {
hw/ppc_newworld.c +1 -1
@@ -364,7 +364,7 @@ static void ppc_core99_init (ram_addr_t ram_size,fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size);if (kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys (CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 ); }
hw/ppc_oldworld.c +1 -1
@@ -384,7 +384,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size);if (kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys (CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 ); }
hw/r2d.c +1 -1
@@ -250,7 +250,7 @@ static void r2d_init(ram_addr_t ram_size,SDRAM_BASE +LINUX_LOAD_OFFSET , SDRAM_SIZE - LINUX_LOAD_OFFSET); env->pc = (SDRAM_BASE +LINUX_LOAD_OFFSET ) |0xa0000000 ; -pstrcpy_targphys (SDRAM_BASE +0x10100 ,256 , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,SDRAM_BASE +0x10100 ,256 , kernel_cmdline); }else { kernel_size =load_image_targphys (kernel_filename,SDRAM_BASE ,SDRAM_SIZE ); env->pc =SDRAM_BASE |0xa0000000 ;/* Start from P2 area */
hw/sun4m.c +8 -6
@@ -299,6 +299,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,int linux_boot;unsigned int i;long initrd_size, kernel_size; +uint8_t *ptr; linux_boot = (kernel_filename !=NULL );
@@ -341,9 +342,10 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename, }if (initrd_size >0 ) {for (i =0 ; i <64 *TARGET_PAGE_SIZE ; i +=TARGET_PAGE_SIZE ) { -if (ldl_phys (KERNEL_LOAD_ADDR + i) ==0x48647253 ) {// HdrS -stl_phys (KERNEL_LOAD_ADDR + i +16 ,INITRD_LOAD_ADDR ); -stl_phys (KERNEL_LOAD_ADDR + i +20 , initrd_size); + ptr =rom_ptr (KERNEL_LOAD_ADDR + i); +if (ldl_p (ptr) ==0x48647253 ) {// HdrS +stl_p (ptr +16 ,INITRD_LOAD_ADDR ); +stl_p (ptr +20 , initrd_size);break ; } }
@@ -875,7 +877,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size);if (kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys (CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 ); }
@@ -1457,7 +1459,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size);if (kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys (CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 ); }
@@ -1645,7 +1647,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size);if (kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys (CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 ); }
hw/sun4u.c +1 -1
@@ -651,7 +651,7 @@ static void sun4uv_init(ram_addr_t RAM_size,fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size);if (kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys (CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 ); }
Signature · 1 line
1.6.2.5
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines
OK, V2 seems to work, except that the command line is not passed:
NET: Registered protocol family 1
NET: Registered protocol family 17Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(1,0)
<0>Press L1-A to return to the boot promSo you are booting sparc via -kernel I guess?
Yes, the sparc-test setup from QEMU download page.