summaryrefslogtreecommitdiff
path: root/kexec/arch/arm/kexec-uImage-arm.c
diff options
context:
space:
mode:
authorMarc Andre Tanner <mat@brain-dump.org>2009-11-20 21:07:42 +0100
committerSimon Horman <horms@verge.net.au>2009-11-21 14:31:11 +1100
commitaee54c10512b494747b03121fb0b3b1e91f63645 (patch)
tree765749fb08ec8954e5be696afffa88b4ad5e303a /kexec/arch/arm/kexec-uImage-arm.c
parentd06ff6009ae59c21b5549896d55445cf47894ee9 (diff)
kexec-arm: add uImage support
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work. Signed-off-by: Marc Andre Tanner <mat@brain-dump.org> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/arm/kexec-uImage-arm.c')
-rw-r--r--kexec/arch/arm/kexec-uImage-arm.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/kexec/arch/arm/kexec-uImage-arm.c b/kexec/arch/arm/kexec-uImage-arm.c
new file mode 100644
index 0000000..44c8d5f
--- /dev/null
+++ b/kexec/arch/arm/kexec-uImage-arm.c
@@ -0,0 +1,33 @@
+/*
+ * uImage support added by Marc Andre Tanner <mat@brain-dump.org>
+ */
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include "../../kexec.h"
+#include "kexec-arm.h"
+#include "kexec-uImage-arm.h"
+
+int uImage_arm_probe(const char *buf, off_t len)
+{
+ struct image_header header;
+
+ if (len < sizeof(header))
+ return -1;
+
+ memcpy(&header, buf, sizeof(header));
+
+ if (cpu_to_be32(header.ih_magic) != IH_MAGIC)
+ return -1;
+
+ /* XXX: check CRC Checksum? */
+
+ return 0;
+}
+
+int uImage_arm_load(int argc, char **argv, const char *buf, off_t len,
+ struct kexec_info *info)
+{
+ return zImage_arm_load(argc, argv, buf + sizeof(struct image_header),
+ len - sizeof(struct image_header), info);
+}