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 at redhat.com> --- kexec/arch/arm/kexec-arm.c | 7 +++++++ kexec/arch/arm/kexec-arm.h | 2 ++ kexec/arch/arm/kexec-zImage-arm.c | 8 ++++++++ 3 files changed, 17 insertions(+) --- kexec-tools.orig/kexec/arch/arm/kexec-arm.c +++ kexec-tools/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_ 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); +} --- kexec-tools.orig/kexec/arch/arm/kexec-arm.h +++ kexec-tools/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 */ --- kexec-tools.orig/kexec/arch/arm/kexec-zImage-arm.c +++ kexec-tools/kexec/arch/arm/kexec-zImage-arm.c @@ -358,6 +358,14 @@ int zImage_arm_load(int argc, char **arg 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)