X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=utils%2Fhooks%2F80-set-stdout;fp=utils%2Fhooks%2F80-set-stdout;h=92ff030c2716c61181f601cc606775dc950ecc43;hp=0000000000000000000000000000000000000000;hb=8f0e069fc43ed6f6a230329839f970415147d1aa;hpb=0611a74491328d9ce346957c2320310a21caa8a9 diff --git a/utils/hooks/80-set-stdout b/utils/hooks/80-set-stdout new file mode 100755 index 0000000..92ff030 --- /dev/null +++ b/utils/hooks/80-set-stdout @@ -0,0 +1,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