diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-01-15 15:59:27 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-15 15:59:27 +0800 |
commit | af805399e80ae70a9fc7af9b47d76577be44a683 (patch) | |
tree | bdf4b70c6c4b0da19440162c1b1cb384ef2c0383 | |
parent | 49f515d354d8d40e2053fe5806fea12b06bcb115 (diff) | |
download | talos-petitboot-af805399e80ae70a9fc7af9b47d76577be44a683.tar.gz talos-petitboot-af805399e80ae70a9fc7af9b47d76577be44a683.zip |
utils: Add boot hook to set stdout property on DT machines
On machines that use device-tree boot, they'll often set an early
console, defined by the linux,stdout property in the /chosen/ device
tree node.
This hook adds a facility for petitboot to set this, based on an NVRAM
setting.
-rwxr-xr-x | utils/hooks/20-set-stdout | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/hooks/20-set-stdout b/utils/hooks/20-set-stdout new file mode 100755 index 0000000..92ff030 --- /dev/null +++ b/utils/hooks/20-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 |