Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: use /sys/firmware/fdt in case without --atags and --dtb
@ 2015-11-23  7:04 Dave Young
  2015-11-24  7:04 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Young @ 2015-11-23  7:04 UTC (permalink / raw)
  To: kexec

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>
---
 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)

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm: use /sys/firmware/fdt in case without --atags and --dtb
  2015-11-23  7:04 [PATCH] arm: use /sys/firmware/fdt in case without --atags and --dtb Dave Young
@ 2015-11-24  7:04 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2015-11-24  7:04 UTC (permalink / raw)
  To: Dave Young; +Cc: kexec

On Mon, Nov 23, 2015 at 03:04:23PM +0800, Dave Young wrote:
> 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>

Thanks, applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-24  7:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-23  7:04 [PATCH] arm: use /sys/firmware/fdt in case without --atags and --dtb Dave Young
2015-11-24  7:04 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox