summaryrefslogtreecommitdiffstats
path: root/utils/hooks/20-set-stdout
blob: 92ff030c2716c61181f601cc606775dc950ecc43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

# Hook to set the linux,stdout-path property from an nvram property
# (named $nvram_prop).

nvram_prop=petitboot,console

# we need to be using a dtb
[ -n "$boot_dtb" ] || exit

console=$(nvram --print-config="$nvram_prop")

[ $? = 0 -a -n "$console" ] || exit

dtb_in=$boot_dtb
dtb_out=$(mktemp)

(
	dtc -I dtb -O dts $dtb_in
	echo '/ { chosen { linux,stdout-path = "'$console'"; }; }; '
) | dtc -I dts -O dtb -o $dtb_out

[ $? = 0 ] && mv $dtb_out $dtb_in
OpenPOWER on IntegriCloud