[PATCH 3/3] ppc/uImage: Add support for RAM Disks

Suzuki K. Poulose suzuki at in.ibm.com
Mon Jan 14 00:14:53 EST 2013


On 01/11/2013 12:41 PM, McClintock Matthew-B29882 wrote:
> On Fri, Jan 11, 2013 at 12:42 AM, Suzuki K. Poulose <suzuki at in.ibm.com> wrote:
>> From: Suzuki K. Poulose <suzuki at in.ibm.com>
>>
>> Handle the RAM Disks in uImage format
>
> As opposed to simple ext2.gz ramdisk?

Yep. Any supported ramdisk format can be wrapped up in a uImage file.

Thanks
Suzuki

>
> -M
>
>>
>> Signed-off-by: Suzuki K. Poulose <suzuki at in.ibm.com>
>> ---
>>   kexec/arch/ppc/kexec-uImage-ppc.c |   22 +++++++++++++++++++++-
>>   1 file changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c
>> index eaea3c1..58935c0 100644
>> --- a/kexec/arch/ppc/kexec-uImage-ppc.c
>> +++ b/kexec/arch/ppc/kexec-uImage-ppc.c
>> @@ -46,6 +46,26 @@ void uImage_ppc_usage(void)
>>          );
>>   }
>>
>> +char* slurp_ramdisk_ppc(const char *filename, off_t *r_size)
>> +{
>> +       struct Image_info img;
>> +       off_t size;
>> +       const unsigned char *buf =
>> +                       (const unsigned char *)slurp_file(filename, &size);
>> +
>> +       /* Check if this is a uImage RAMDisk */
>> +       if (buf != (void*)0 &&
>> +               uImage_probe(buf, size, IH_ARCH_PPC) == IH_TYPE_RAMDISK) {
>> +               if (uImage_load(buf, size, &img) != 0)
>> +                       die ("uImage: Reading %ld bytes from %s failed\n", size, filename);
>> +               buf = img.buf;
>> +               size = img.len;
>> +       }
>> +
>> +       *r_size = size;
>> +       return buf;
>> +}
>> +
>>   int uImage_ppc_probe(const char *buf, off_t len)
>>   {
>>          int type;
>> @@ -196,7 +216,7 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf,
>>          blob_buf = fixup_dtb_init(info, blob_buf, &blob_size, load_addr, &dtb_addr);
>>
>>          if (ramdisk) {
>> -               seg_buf = slurp_file(ramdisk, &seg_size);
>> +               seg_buf = slurp_ramdisk_ppc(ramdisk, &seg_size);
>>                  /* Load ramdisk at top of memory */
>>                  hole_addr = add_buffer(info, seg_buf, seg_size, seg_size,
>>                                  0, dtb_addr + blob_size, max_addr, -1);
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
>
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>




More information about the kexec mailing list