Re: [PATCH v2 5/7] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc

2010-07-29 Thread Matthew McClintock

On Jul 29, 2010, at 3:33 AM, Simon Horman wrote:

> On Tue, Jul 20, 2010 at 03:14:58PM -0500, Matthew McClintock wrote:
>> This fixes --reuseinitrd and --ramdisk option for ppc32 on
>> uImage-ppc and Elf. It works for normal kexec as well as for
>> kdump.
>> 
>> When using --reuseinitrd you need to specifify retain_initrd
>> on the command line. Also, if you are doing kdump you need to make
>> sure your initrd lives in the crashdump region otherwise the
>> kdump kernel will not be able to access it. The --ramdisk option
>> should always work.
> 
> Thanks, I have applied this change.
> I had to do a minor merge on the Makefile,
> could you verify that the result is correct?
> 

Tested and looks good.

-M

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v2 5/7] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc

2010-07-29 Thread Simon Horman
On Tue, Jul 20, 2010 at 03:14:58PM -0500, Matthew McClintock wrote:
> This fixes --reuseinitrd and --ramdisk option for ppc32 on
> uImage-ppc and Elf. It works for normal kexec as well as for
> kdump.
> 
> When using --reuseinitrd you need to specifify retain_initrd
> on the command line. Also, if you are doing kdump you need to make
> sure your initrd lives in the crashdump region otherwise the
> kdump kernel will not be able to access it. The --ramdisk option
> should always work.

Thanks, I have applied this change.
I had to do a minor merge on the Makefile,
could you verify that the result is correct?
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 5/7] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc

2010-07-20 Thread Matthew McClintock
This fixes --reuseinitrd and --ramdisk option for ppc32 on
uImage-ppc and Elf. It works for normal kexec as well as for
kdump.

When using --reuseinitrd you need to specifify retain_initrd
on the command line. Also, if you are doing kdump you need to make
sure your initrd lives in the crashdump region otherwise the
kdump kernel will not be able to access it. The --ramdisk option
should always work.

Signed-off-by: Matthew McClintock 
---
 kexec/arch/ppc/Makefile   |1 +
 kexec/arch/ppc/include/arch/options.h |3 +
 kexec/arch/ppc/kexec-elf-ppc.c|   44 -
 kexec/arch/ppc/kexec-ppc.c|6 +++
 kexec/arch/ppc/kexec-ppc.h|2 +
 kexec/arch/ppc/kexec-uImage-ppc.c |   68 +++-
 6 files changed, 118 insertions(+), 6 deletions(-)

diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile
index 5988213..c963175 100644
--- a/kexec/arch/ppc/Makefile
+++ b/kexec/arch/ppc/Makefile
@@ -21,6 +21,7 @@ libfdt_SRCS += $(LIBFDT_SRCS:%=kexec/arch/ppc/libfdt/%)
 CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/libfdt
 
 ppc_KEXEC_SRCS += $(libfdt_SRCS)
+ppc_ARCH_REUSE_INITRD =
 
 dist += kexec/arch/ppc/Makefile $(ppc_KEXEC_SRCS)  \
kexec/arch/ppc/kexec-ppc.h kexec/arch/ppc/ppc_asm.h \
diff --git a/kexec/arch/ppc/include/arch/options.h 
b/kexec/arch/ppc/include/arch/options.h
index f646ccc..0c00ea7 100644
--- a/kexec/arch/ppc/include/arch/options.h
+++ b/kexec/arch/ppc/include/arch/options.h
@@ -8,6 +8,7 @@
 #define OPT_GAMECUBE(OPT_ARCH_MAX+1)
 #define OPT_DTB (OPT_ARCH_MAX+2)
 #define OPT_NODES   (OPT_ARCH_MAX+3)
+#define OPT_RAMDISK(OPT_ARCH_MAX+4)
 
 /* Options relevant to the architecture (excluding loader-specific ones),
  * in this case none:
@@ -35,6 +36,8 @@
KEXEC_ARCH_OPTIONS \
{"command-line", 1, 0, OPT_APPEND},\
{"append",   1, 0, OPT_APPEND},\
+   {"ramdisk",  1, 0, OPT_APPEND},\
+   {"initrd",   1, 0, OPT_APPEND},\
{"gamecube", 1, 0, OPT_GAMECUBE},\
{"dtb", 1, 0, OPT_DTB},\
{"reuse-node", 1, 0, OPT_NODES},\
diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
index 87e6507..58bba54 100644
--- a/kexec/arch/ppc/kexec-elf-ppc.c
+++ b/kexec/arch/ppc/kexec-elf-ppc.c
@@ -127,6 +127,8 @@ static const struct option options[] = {
KEXEC_ARCH_OPTIONS
{"command-line", 1, 0, OPT_APPEND},
{"append",   1, 0, OPT_APPEND},
+   {"ramdisk",  1, 0, OPT_RAMDISK},
+   {"initrd",   1, 0, OPT_RAMDISK},
{"gamecube", 1, 0, OPT_GAMECUBE},
{"dtb", 1, 0, OPT_DTB},
{"reuse-node", 1, 0, OPT_NODES},
@@ -139,10 +141,12 @@ void elf_ppc_usage(void)
printf(
 "--command-line=STRING Set the kernel command line to 
STRING.\n"
 "--append=STRING   Set the kernel command line to 
STRING.\n"
+"--ramdisk=  Initial RAM disk.\n"
+"--initrd=   same as --ramdisk\n"
 "--gamecube=1|0Enable/disable support for ELFs with 
changed\n"
 "  addresses suitable for the GameCube.\n"
-" --dtb= Specify device tree blob file.\n"
-" --reuse-node=nodeSpecify nodes which should be taken 
from /proc/device-tree.\n"
+"--dtb= Specify device tree blob file.\n"
+"--reuse-node=nodeSpecify nodes which should be taken 
from /proc/device-tree.\n"
 "  Can be set multiple times.\n"
 );
 }
@@ -177,7 +181,7 @@ int elf_ppc_load(int argc, char **argv, const char 
*buf, off_t len,
unsigned long my_kernel, my_dt_offset;
unsigned long my_stack, my_backup_start;
unsigned int slave_code[256 / sizeof(unsigned int)], master_entry;
-   unsigned char *seg_buf = NULL;
+   char *seg_buf = NULL;
off_t seg_size = 0;
int target_is_gamecube = 0;
unsigned int addr;
@@ -193,6 +197,8 @@ int elf_ppc_load(int argc, char **argv, const char 
*buf, off_t len,
dtb = NULL;
max_addr = LONG_MAX;
hole_addr = 0;
+   kernel_addr = 0;
+   ramdisk = 0;
 
while ((opt = getopt_long(argc, argv, short_options, options, 0)) != 
-1) {
switch (opt) {
@@ -207,6 +213,9 @@ int elf_ppc_load(int argc, char **argv, const char 
*buf, off_t len,
case OPT_APPEND:
command_line = optarg;
break;
+   case OPT_RAMDISK:
+   ramdisk = optarg;
+   break;
case OPT_GAMECUBE:
target_is_gamecube = atoi(optarg);
break;
@@ -234,6 +243,9 @@ int elf_ppc_load(int argc, char **argv, const char 
*buf, off_t len,
command_line_len = strle