Fallback mechanism/fallback.sh

From coreboot
Jump to navigation Jump to search

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

#!/bin/sh
# In the cases where this work is copyrightable, it falls under the GPLv2
# or later license that is available here:
# https://www.gnu.org/licenses/gpl-2.0.txt

if [ $# -ne 0 ] ; then
	echo "Usage $0"
	exit 1
fi

die()
{
  echo "$1 Failed"
  exit 1
}

check_config()
{
  grep "^CONFIG_CBFS_PREFIX=\"fallback\"$" .config > /dev/null || die "Not using normal cbfs prefix"
  grep "^CONFIG_UPDATE_IMAGE=y$" .config > /dev/null && die "You should not be using CONFIG_UPDATE_IMAGE"
  grep "^CONFIG_SKIP_MAX_REBOOT_CNT_CLEAR=y" .config > /dev/null || die "Not using CONFIG_SKIP_MAX_REBOOT_CNT_CLEAR"
}

check_config
rm -rf build
make oldconfig || die "make oldconfig"
make || die "make"

# Uncomment if you use GRUB and you need to add a grub.cfg
# ./util/cbfstool/cbfstool ./build/coreboot.rom add -f grub.cfg -n etc/grub.cfg -t raw
./util/cbfstool/cbfstool ./build/coreboot.rom print