diff --git a/scripts/flash.sh b/scripts/flash.sh index 36f98a4..dd64958 100755 --- a/scripts/flash.sh +++ b/scripts/flash.sh @@ -9,12 +9,19 @@ then fi MODEL="$1" -if [ ! -d "models/$1" ] +if [ ! -d "models/${MODEL}" ] then - echo "model '$1' not found" >&2 + echo "model '${MODEL}' not found" >&2 exit 1 fi MODEL_DIR="$(realpath "models/${MODEL}")" +DMI_MODEL="$(cat /sys/class/dmi/id/product_version)" +if [ "${DMI_MODEL}" != "${MODEL}" ] +then + echo "Refusing to flash model '${MODEL}' to model '${DMI_MODEL}'" >&2 + exit 1 +fi + cargo build --release --manifest-path libs/intel-spi/Cargo.toml sudo libs/intel-spi/target/release/intel-spi "build/${MODEL}/coreboot.rom"