summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuzuki K. Poulose <suzuki@in.ibm.com>2013-03-06 14:10:33 +0530
committerSimon Horman <horms@verge.net.au>2013-03-08 13:57:30 +0900
commit99a3a977990619cbd179b2b1435989785c9ee919 (patch)
treec73d87f8e4047acd89f5fab6321e8b8c5a157eb5
parent90f7609a739d24faffab41422185b9f1a65573da (diff)
downloadkexec-tools-99a3a977990619cbd179b2b1435989785c9ee919.tar.gz
kexec/uImage: Recognize uImage RAM Disks
Add IH_TYPE_RAMDISK as a recognized image type. uImage_load shouldn't decompress the RAMDISK type images, since uboot doesn't do it. Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--include/kexec-uImage.h1
-rw-r--r--kexec/kexec-uImage.c19
2 files changed, 19 insertions, 1 deletions
diff --git a/include/kexec-uImage.h b/include/kexec-uImage.h
index 266ca739..4725157b 100644
--- a/include/kexec-uImage.h
+++ b/include/kexec-uImage.h
@@ -10,5 +10,6 @@ struct Image_info {
int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch);
int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch);
+int uImage_probe_ramdisk(const unsigned char *buf, off_t len, unsigned int arch);
int uImage_load(const unsigned char *buf, off_t len, struct Image_info *info);
#endif
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c
index 9e275b27..1ad02f45 100644
--- a/kexec/kexec-uImage.c
+++ b/kexec/kexec-uImage.c
@@ -47,6 +47,8 @@ int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch)
case IH_TYPE_KERNEL:
case IH_TYPE_KERNEL_NOLOAD:
break;
+ case IH_TYPE_RAMDISK:
+ break;
default:
printf("uImage type %d unsupported\n", header.ih_type);
return -1;
@@ -99,6 +101,12 @@ int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch)
0 : -1;
}
+int uImage_probe_ramdisk(const unsigned char *buf, off_t len, unsigned int arch)
+{
+ int type = uImage_probe(buf, len, arch);
+ return (type == IH_TYPE_RAMDISK) ? 0 : -1;
+}
+
#ifdef HAVE_LIBZ
/* gzip flag byte */
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
@@ -231,7 +239,16 @@ int uImage_load(const unsigned char *buf, off_t len, struct Image_info *image)
break;
case IH_COMP_GZIP:
- return uImage_gz_load(img_buf, img_len, image);
+ /*
+ * uboot doesn't decompress the RAMDISK images.
+ * Comply to the uboot behaviour.
+ */
+ if (header->ih_type == IH_TYPE_RAMDISK) {
+ image->buf = img_buf;
+ image->len = img_len;
+ return 0;
+ } else
+ return uImage_gz_load(img_buf, img_len, image);
break;
default: