diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-06-21 10:43:49 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-06-24 13:07:58 +0800 |
commit | ed6021ebefa8b56604cdbb23a1c38008ed88b8c7 (patch) | |
tree | b1f135f9a5e2d6ceaf9849e96b873f40deb67468 /utils/hooks | |
parent | aaa1de0046295cfd1f7a5428f399a5d1f9e1e563 (diff) | |
download | petitboot-ed6021ebefa8b56604cdbb23a1c38008ed88b8c7.zip petitboot-ed6021ebefa8b56604cdbb23a1c38008ed88b8c7.tar.gz |
utils/hooks: Add sample update-dtb hook.
Provide an example for writing a pre-boot hook to update the dtb.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'utils/hooks')
-rw-r--r-- | utils/hooks/20-update-dtb-sample | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/hooks/20-update-dtb-sample b/utils/hooks/20-update-dtb-sample new file mode 100644 index 0000000..44186a9 --- /dev/null +++ b/utils/hooks/20-update-dtb-sample @@ -0,0 +1,22 @@ +#!/bin/sh +# +# This is a sample boot hook to add a single property to the new kernel's +# device tree. + +[ -z "$boot_dtb" ] && exit + +dtb_in=$boot_dtb +dtb_out=$(mktemp) + +# Convert the dtb to dts, append our extra property, and convert back to dtb +( + dtc -I dtb -O dts $dtb_in + echo '/ { petitboot,test = "test"; };' +) | dtc -I dts -O dtb -o $dtb_out + +# If we have a good dtb (ie, the compile succeeded), replace the existing +# dtb file. +if [ $? = 0 ] +then + mv $dtb_out $dtb_in +fi |