virtex_ml507: Add support for loading initrd images
PATCH 1/1 virtex_ml507: Add support for loading initrd images
From: "Edgar E. Iglesias" <[email protected]>
--- hw/ppc/virtex_ml507.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
hw/ppc/virtex_ml507.c +33 -1
@@ -166,6 +166,19 @@ static int xilinx_load_device_tree(hwaddr addr,if (!fdt) {return 0 ; } + + r =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + initrd_base); +if (r <0 ) { +error_report ("couldn't set /chosen/linux,initrd-start'" ); + } + + r =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + (initrd_base + initrd_size)); +if (r <0 ) { +error_report ("couldn't set /chosen/linux,initrd-end'" ); + } + r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 )fprintf (stderr,"couldn't set /chosen/bootargs\n" );
@@ -179,6 +192,8 @@ static void virtex_init(QEMUMachineInitArgs *args)const char *cpu_model = args->cpu_model;const char *kernel_filename = args->kernel_filename;const char *kernel_cmdline = args->kernel_cmdline; +hwaddr initrd_base =0 ; +int initrd_size =0 ;MemoryRegion *address_space_mem =get_system_memory ();DeviceState *dev;PowerPCCPU *cpu;
@@ -242,10 +257,27 @@ static void virtex_init(QEMUMachineInitArgs *args) boot_info.ima_size = kernel_size; +/* Load initrd. */ +if (args->initrd_filename) { + initrd_base = high =ROUND_UP (high,4 ); + initrd_size =load_image_targphys (args->initrd_filename, + high, ram_size - high); + +if (initrd_size <0 ) { +error_report ("couldn't load ram disk '%s'\n" , + args->initrd_filename); +exit (1 ); + } + high =ROUND_UP (high + initrd_size,4 ); + } +/* Provide a device-tree. */ boot_info.fdt = high + (8192 *2 ); boot_info.fdt &= ~8191 ; -xilinx_load_device_tree (boot_info.fdt, ram_size,0 ,0 , kernel_cmdline); + +xilinx_load_device_tree (boot_info.fdt, ram_size, + initrd_base, initrd_size, + kernel_cmdline); } env->load_info = &boot_info; }
Signature · 1 line
1.8.3.2
Alexander Graf
AppliedQuoted 3 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>
Thanks, applied to ppc-next.
Alex
Am 03.02.2014 16:20, schrieb Edgar E. Iglesias:
Quoted 12 lines
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>--- hw/ppc/virtex_ml507.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)hw/ppc/virtex_ml507.c +0
-0
hw/ppc/virtex_ml507.c static int xilinx_load_device_tree(hwaddr addr, · line 173
Quoted 8 lines
hw/ppc/virtex_ml507.c +5
-0@@ -166,6 +166,19 @@ static int xilinx_load_device_tree(hwaddr addr,if (!fdt) {return 0 ; } + + r =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + initrd_base); +if (r <0 ) { +error_report ("couldn't set /chosen/linux,initrd-start'" );
Both this ...
hw/ppc/virtex_ml507.c static int xilinx_load_device_tree(hwaddr addr, · line 179
Quoted 6 lines
hw/ppc/virtex_ml507.c +6
-0+ } + + r =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + (initrd_base + initrd_size)); +if (r <0 ) { +error_report ("couldn't set /chosen/linux,initrd-end'" );
... and the other error_report() have either a stray trailing single-quote or one missing before the path.
Quoted 16 lines
hw/ppc/virtex_ml507.c +4
-0+ } + r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 )fprintf (stderr,"couldn't set /chosen/bootargs\n" );@@ -179,6 +192,8 @@ static void virtex_init(QEMUMachineInitArgs *args)const char *cpu_model = args->cpu_model;const char *kernel_filename = args->kernel_filename;const char *kernel_cmdline = args->kernel_cmdline; +hwaddr initrd_base =0 ; +int initrd_size =0 ;MemoryRegion *address_space_mem =get_system_memory ();DeviceState *dev;PowerPCCPU *cpu;@@ -242,10 +257,27 @@ static void virtex_init(QEMUMachineInitArgs *args)
hw/ppc/virtex_ml507.c static void virtex_init(QEMUMachineInitArgs *args) · line 267
Quoted 10 lines
hw/ppc/virtex_ml507.c +8
-0boot_info.ima_size = kernel_size; +/* Load initrd. */ +if (args->initrd_filename) { + initrd_base = high =ROUND_UP (high,4 ); + initrd_size =load_image_targphys (args->initrd_filename, + high, ram_size - high); + +if (initrd_size <0 ) { + error_report("couldn't load ram disk '%s'\n",
And here's a stray \n.
Andreas
Quoted 17 lines
hw/ppc/virtex_ml507.c +10
-1+ args->initrd_filename); +exit (1 ); + } + high =ROUND_UP (high + initrd_size,4 ); + } +/* Provide a device-tree. */ boot_info.fdt = high + (8192 *2 ); boot_info.fdt &= ~8191 ; -xilinx_load_device_tree (boot_info.fdt, ram_size,0 ,0 , kernel_cmdline); + +xilinx_load_device_tree (boot_info.fdt, ram_size, + initrd_base, initrd_size, + kernel_cmdline); } env->load_info = &boot_info; }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 52 lines · Andreas Färber
Am 03.02.2014 16:20, schrieb Edgar E. Iglesias:
Quoted 12 lines
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>---
hw/ppc/virtex_ml507.c| 34 +++++++++++++++++++++++++++++++++-1 file changed, 33 insertions(+), 1 deletion(-)hw/ppc/virtex_ml507.c +0
-0hw/ppc/virtex_ml507.c static int xilinx_load_device_tree(hwaddr addr, · line 173
Quoted 8 lines
hw/ppc/virtex_ml507.c +5
-0@@ -166,6 +166,19 @@ static int xilinx_load_device_tree(hwaddr addr,if (!fdt) {return 0 ; } + + r =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-start" , + initrd_base); +if (r <0 ) { +error_report ("couldn't set /chosen/linux,initrd-start'" );Both this ...
hw/ppc/virtex_ml507.c static int xilinx_load_device_tree(hwaddr addr, · line 179
Quoted 6 lines
hw/ppc/virtex_ml507.c +6
-0+ } + + r =qemu_fdt_setprop_cell (fdt,"/chosen" ,"linux,initrd-end" , + (initrd_base + initrd_size)); +if (r <0 ) { +error_report ("couldn't set /chosen/linux,initrd-end'" );... and the other
error_report()have either a stray trailing single-quote or one missing before the path.Quoted 18 lines
hw/ppc/virtex_ml507.c +4
-0+ } + r =qemu_fdt_setprop_string (fdt,"/chosen" ,"bootargs" , kernel_cmdline);if (r <0 )fprintf (stderr,"couldn't set /chosen/bootargs\n" );@@ -179,6 +192,8 @@ static void virtex_init(QEMUMachineInitArgs *args)const char *cpu_model = args->cpu_model;const char *kernel_filename = args->kernel_filename;const char *kernel_cmdline = args->kernel_cmdline; +hwaddr initrd_base =0 ; +int initrd_size =0 ;MemoryRegion *address_space_mem =get_system_memory ();DeviceState *dev;PowerPCCPU *cpu;@@ -242,10 +257,27 @@ static void virtex_init(QEMUMachineInitArgs *args) boot_info.ima_size = kernel_size;
Quoted 10 lines
hw/ppc/virtex_ml507.c static void virtex_init(QEMUMachineInitArgs *args) · line 267
Quoted 8 lines
hw/ppc/virtex_ml507.c +8
-0+/* Load initrd. */ +if (args->initrd_filename) { + initrd_base = high =ROUND_UP (high,4 ); + initrd_size =load_image_targphys (args->initrd_filename, + high, ram_size - high); + +if (initrd_size <0 ) { + error_report("couldn't load ram disk '%s'\n",And here's a stray \n.
Do you think we could add this to checkpatch.pl? A \n at the end of error_report() is certainly something I've seen a lot already :).
I'll fix these 3 bits up in my branch.
Alex