[PATCH 7/7] Let SH adn ARM use common uImage probe code
Sebastian Andrzej Siewior
sebastian at breakpoint.cc
Wed Mar 31 04:24:18 EDT 2010
From: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
The now generic probe function is more complete than the currently used.
It seems that ARM's and SH's uImage are always uncompressed so it might
be good to check for this.
Cc: Paul Mundt <lethal at linux-sh.org>
Cc: Marc Andre Tanner <mat at brain-dump.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
---
kexec/arch/arm/Makefile | 1 +
kexec/arch/arm/kexec-uImage-arm.c | 15 ++-------------
kexec/arch/sh/Makefile | 1 +
kexec/arch/sh/kexec-uImage-sh.c | 15 ++-------------
4 files changed, 6 insertions(+), 26 deletions(-)
diff --git a/kexec/arch/arm/Makefile b/kexec/arch/arm/Makefile
index 9416339..2ecdb66 100644
--- a/kexec/arch/arm/Makefile
+++ b/kexec/arch/arm/Makefile
@@ -5,6 +5,7 @@ arm_KEXEC_SRCS= kexec/arch/arm/kexec-elf-rel-arm.c
arm_KEXEC_SRCS+= kexec/arch/arm/kexec-zImage-arm.c
arm_KEXEC_SRCS+= kexec/arch/arm/kexec-uImage-arm.c
arm_KEXEC_SRCS+= kexec/arch/arm/kexec-arm.c
+arm_KEXEC_SRCS+= kexec/kexec-uImage.c
dist += kexec/arch/arm/Makefile $(arm_KEXEC_SRCS) \
kexec/arch/arm/kexec-arm.h \
diff --git a/kexec/arch/arm/kexec-uImage-arm.c b/kexec/arch/arm/kexec-uImage-arm.c
index e881fd8..4875185 100644
--- a/kexec/arch/arm/kexec-uImage-arm.c
+++ b/kexec/arch/arm/kexec-uImage-arm.c
@@ -5,24 +5,13 @@
#include <string.h>
#include <sys/types.h>
#include <image.h>
+#include <kexec-uImage.h>
#include "../../kexec.h"
#include "kexec-arm.h"
int uImage_arm_probe(const char *buf, off_t len)
{
- struct image_header header;
-
- if ((uintmax_t)len < (uintmax_t)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;
+ return uImage_probe(buf, len, IH_ARCH_ARM);
}
int uImage_arm_load(int argc, char **argv, const char *buf, off_t len,
diff --git a/kexec/arch/sh/Makefile b/kexec/arch/sh/Makefile
index 9ccd008..a9f6081 100644
--- a/kexec/arch/sh/Makefile
+++ b/kexec/arch/sh/Makefile
@@ -9,6 +9,7 @@ sh_KEXEC_SRCS += kexec/arch/sh/kexec-elf-sh.c
sh_KEXEC_SRCS += kexec/arch/sh/kexec-elf-rel-sh.c
sh_KEXEC_SRCS += kexec/arch/sh/netbsd_booter.S
sh_KEXEC_SRCS += kexec/arch/sh/crashdump-sh.c
+sh_KEXEC_SRCS += kexec/kexec-uImage.c
sh_ADD_BUFFER =
sh_ADD_SEGMENT =
diff --git a/kexec/arch/sh/kexec-uImage-sh.c b/kexec/arch/sh/kexec-uImage-sh.c
index c2bce53..e983165 100644
--- a/kexec/arch/sh/kexec-uImage-sh.c
+++ b/kexec/arch/sh/kexec-uImage-sh.c
@@ -7,24 +7,13 @@
#include <string.h>
#include <sys/types.h>
#include <image.h>
+#include <kexec-uImage.h>
#include "../../kexec.h"
#include "kexec-sh.h"
int uImage_sh_probe(const char *buf, off_t len)
{
- struct image_header header;
-
- if ((uintmax_t)len < (uintmax_t)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;
+ return uImage_probe(buf, len, IH_ARCH_SH);
}
int uImage_sh_load(int argc, char **argv, const char *buf, off_t len,
--
1.6.5.2
More information about the kexec
mailing list