]> git.ozlabs.org Git - petitboot/blob - utils/hooks/20-update-dtb-sample
discover: add reinit path
[petitboot] / utils / hooks / 20-update-dtb-sample
1 #!/bin/sh
2 #
3 # This is a sample boot hook to add a single property to the new kernel's
4 # device tree.
5
6 [ -z "$boot_dtb" ] && exit
7
8 dtb_in=$boot_dtb
9 dtb_out=$(mktemp)
10
11 # Convert the dtb to dts, append our extra property, and convert back to dtb
12 (
13         dtc -I dtb -O dts $dtb_in
14         echo '/ { petitboot,test = "test"; };'
15 ) | dtc -I dts -O dtb -o $dtb_out
16
17 # If we have a good dtb (ie, the compile succeeded), replace the existing
18 # dtb file.
19 if [ $? = 0 ]
20 then
21         mv $dtb_out $dtb_in
22 fi