[PATCH 3/4] kexec/uImage: Recognize uImage RAM Disks
Suzuki K. Poulose
suzuki at in.ibm.com
Wed Mar 6 03:40:33 EST 2013
From: Suzuki K. Poulose <suzuki at in.ibm.com>
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 at in.ibm.com>
---
include/kexec-uImage.h | 1 +
kexec/kexec-uImage.c | 19 ++++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/include/kexec-uImage.h b/include/kexec-uImage.h
index 266ca73..4725157 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 9e275b2..1ad02f4 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:
More information about the kexec
mailing list