QEMU: improvement of the initrd support for mips(el)
PATCH 1/1 QEMU: improvement of the initrd support for mips(el)
Hi,
The attached patch improves the initrd support of the mips(el) platform by passing the initrd size and location via the kernel command line. This removes the need to pass them manually.
Thanks,
Aurelien
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
mips_r4k.c renamed from mips_r4k.c.orig +16 -5
@@ -121,7 +121,7 @@unsigned long bios_offset;int ret;CPUState *env; -long kernel_size; +long kernel_size, initrd_size;int i; env =cpu_init ();
@@ -163,10 +163,11 @@ }/* load initrd */ + initrd_size =0 ;if (initrd_filename) { -if (load_image (initrd_filename, - phys_ram_base +INITRD_LOAD_ADDR +VIRT_TO_PHYS_ADDEND ) - == (target_ulong) -1 ) { + initrd_size =load_image (initrd_filename, + phys_ram_base +INITRD_LOAD_ADDR +VIRT_TO_PHYS_ADDEND ); +if (initrd_size == (target_ulong) -1 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename);exit (1 );
@@ -174,7 +175,17 @@ }/* Store command line. */ -strcpy (phys_ram_base + (16 <<20 ) -256 , kernel_cmdline); +if (initrd_size >0 ) { + ret =sprintf (phys_ram_base + (16 <<20 ) -256 , +"rd_start=0x%08x rd_size=%li " , +INITRD_LOAD_ADDR , + initrd_size); +strcpy (phys_ram_base + (16 <<20 ) -256 + ret, kernel_cmdline); + } +else { +strcpy (phys_ram_base + (16 <<20 ) -256 , kernel_cmdline); + } +/* FIXME: little endian support */ *(int *)(phys_ram_base + (16 <<20 ) -260 ) =tswap32 (0x12345678 ); *(int *)(phys_ram_base + (16 <<20 ) -264 ) =tswap32 (ram_size);