utils/hooks: Add dtb-sort hook
authorJeremy Kerr <jk@ozlabs.org>
Mon, 20 Jan 2014 07:12:46 +0000 (15:12 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 21 Jan 2014 05:36:01 +0000 (13:36 +0800)
The boot hooks may have altered the DTB in various ways, so add a final
(90-) boot hook to re-sort the dtb with `dtc -s`.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
utils/hooks/90-sort-dtb [new file with mode: 0644]

diff --git a/utils/hooks/90-sort-dtb b/utils/hooks/90-sort-dtb
new file mode 100644 (file)
index 0000000..a9c490f
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Last pass for the DTB: sort properties.
+
+[ -n "$boot_dtb" ] || exit
+
+dtb_in=$boot_dtb
+dtb_out=$(mktemp)
+
+dtc -s -I dtb -O dtb -o $dtb_out $dtb_in 
+
+[ $? = 0 ] && mv $dtb_out $dtb_in