diff --git a/initrd/init b/initrd/init index 660e4dfea..ff981f97c 100755 --- a/initrd/init +++ b/initrd/init @@ -44,6 +44,13 @@ hwclock -l -s . /etc/functions . /etc/config +# set CONFIG_TPM dynamically before init +if [ -e /dev/tpm0 ]; then + export CONFIG_TPM='y' +else + export CONFIG_TPM='n' +fi + if [ "$CONFIG_COREBOOT" = "y" ]; then /bin/cbfs-init fi @@ -89,6 +96,13 @@ if [ "$boot_option" = "r" ]; then exit fi +# Override CONFIG_TPM and persist via user config +if [ -e /dev/tpm0 ]; then + echo "CONFIG_TPM=y" >> /etc/config.user +else + echo "CONFIG_TPM=n" >> /etc/config.user +fi + combine_configs . /tmp/config