]> git.ozlabs.org Git - petitboot/blob - utils/hooks/20-set-stdout
ui/ncurses: Re-add autoboot selection to config screen
[petitboot] / utils / hooks / 20-set-stdout
1 #!/bin/sh
2
3 # Hook to set the linux,stdout-path property from an nvram property
4 # (named $nvram_prop).
5
6 nvram_prop=petitboot,console
7
8 # we need to be using a dtb
9 [ -n "$boot_dtb" ] || exit
10
11 console=$(nvram --print-config="$nvram_prop")
12
13 [ $? = 0 -a -n "$console" ] || exit
14
15 dtb_in=$boot_dtb
16 dtb_out=$(mktemp)
17
18 (
19         dtc -I dtb -O dts $dtb_in
20         echo '/ { chosen { linux,stdout-path = "'$console'"; }; }; '
21 ) | dtc -I dts -O dtb -o $dtb_out
22
23 [ $? = 0 ] && mv $dtb_out $dtb_in