utils/hooks: Add create-dtb hook
authorJeremy Kerr <jk@ozlabs.org>
Thu, 20 Jun 2013 06:19:24 +0000 (14:19 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 24 Jun 2013 05:07:58 +0000 (13:07 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
utils/Makefile.am
utils/hooks/01-create-default-dtb [new file with mode: 0644]

index 2d7fe2df5e1800a69a2011a8238a6a78ef1e7155..c1ff586c404c78bc1de9451157140ac8129ccbac 100644 (file)
@@ -30,6 +30,7 @@ pb_event_SOURCES = pb-event.c
 dist_pkgdata_DATA = \
        kboot.conf.sample \
        bb-kexec-reboot \
-       logrotate.conf
+       logrotate.conf \
+       hooks/01-create-default-dtb
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/utils/hooks/01-create-default-dtb b/utils/hooks/01-create-default-dtb
new file mode 100644 (file)
index 0000000..82c25a2
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[ -n "$boot_dtb" ] && exit;
+[ ! -e /proc/device-tree ] && exit
+
+dtb=$(mktemp)
+
+dtc -I fs -O dtb -o $dtb /proc/device-tree
+
+echo "boot_dtb=$dtb"
+exit 2