diff options
Diffstat (limited to 'kexec/kexec-uImage.c')
-rw-r--r-- | kexec/kexec-uImage.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c index 3bc85c5..3799a3b 100644 --- a/kexec/kexec-uImage.c +++ b/kexec/kexec-uImage.c @@ -16,6 +16,10 @@ * Basic uImage loader. Not rocket science. */ +/* + * Returns the image type if everything goes well. This would + * allow the user to decide if the image is of their interest. + */ int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch) { struct image_header header; @@ -84,7 +88,15 @@ int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch) return -1; } #endif - return 0; + return (int)header.ih_type; +} + +int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch) +{ + int type = uImage_probe(buf, len, arch); + + return (type == IH_TYPE_KERNEL || type == IH_TYPE_KERNEL_NOLOAD) ? + 0 : -1; } #ifdef HAVE_LIBZ |