summaryrefslogtreecommitdiffstats
path: root/utils/hooks/20-update-dtb-sample
blob: 44186a9e5745fe13554a535fd1fc356b140c9b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
OpenPOWER on IntegriCloud