summaryrefslogtreecommitdiff
path: root/kexec
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2015-11-23 15:04:23 +0800
committerSimon Horman <horms@verge.net.au>2015-11-24 16:04:10 +0900
commit4bad06c3cd2a989459458eadd78c703ac5a3b8b6 (patch)
tree751d05ca599529d1c4eb1174777e5d5725812b3d /kexec
parent4580c372000b469c4292e548c806dfe5922e97d1 (diff)
arm: use /sys/firmware/fdt in case without --atags and --dtb
Latest linux kernel will create /sys/firmware/fdt file. It will be convenient to use it in case one does not specify --atags and --dtb options. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r--kexec/arch/arm/kexec-arm.c7
-rw-r--r--kexec/arch/arm/kexec-arm.h2
-rw-r--r--kexec/arch/arm/kexec-zImage-arm.c8
3 files changed, 17 insertions, 0 deletions
diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c
index 10035f2..4e90e69 100644
--- a/kexec/arch/arm/kexec-arm.c
+++ b/kexec/arch/arm/kexec-arm.c
@@ -12,6 +12,7 @@
#include <stdint.h>
#include <string.h>
#include <getopt.h>
+#include <unistd.h>
#include "../../kexec.h"
#include "../../kexec-syscall.h"
#include "kexec-arm.h"
@@ -137,3 +138,9 @@ int arch_compat_trampoline(struct kexec_info *UNUSED(info))
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}
+
+/* return 1 if /sys/firmware/fdt exists, otherwise return 0 */
+int have_sysfs_fdt(void)
+{
+ return !access(SYSFS_FDT, F_OK);
+}
diff --git a/kexec/arch/arm/kexec-arm.h b/kexec/arch/arm/kexec-arm.h
index 79663e3..a74cce2 100644
--- a/kexec/arch/arm/kexec-arm.h
+++ b/kexec/arch/arm/kexec-arm.h
@@ -3,6 +3,7 @@
#include <sys/types.h>
+#define SYSFS_FDT "/sys/firmware/fdt"
#define BOOT_BLOCK_VERSION 17
#define BOOT_BLOCK_LAST_COMP_VERSION 16
@@ -16,5 +17,6 @@ void zImage_arm_usage(void);
int uImage_arm_probe(const char *buf, off_t len);
int uImage_arm_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info);
+extern int have_sysfs_fdt(void);
#endif /* KEXEC_ARM_H */
diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
index d5b8ab4..d85ab9b 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -396,6 +396,14 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
return -1;
}
+ if (!use_atags && !dtb_file) {
+ int f;
+
+ f = have_sysfs_fdt();
+ if (f)
+ dtb_file = SYSFS_FDT;
+ }
+
if (command_line) {
command_line_len = strlen(command_line) + 1;
if (command_line_len > COMMAND_LINE_SIZE)