From 1a2e3d16c3fdaf525847b65a03f50bf96646ec9c Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Thu, 17 May 2018 15:13:41 +0200 Subject: [PATCH] x230: add prepare_before_installation.sh script --- x230/README.md | 6 ++- x230/prepare_before_installation.sh | 69 +++++++++++++++++++++++++++++ x230/release.sh | 1 + 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100755 x230/prepare_before_installation.sh diff --git a/x230/README.md b/x230/README.md index e1351cd..9bd6243 100644 --- a/x230/README.md +++ b/x230/README.md @@ -35,10 +35,12 @@ package. This will be tested. The git master branch is _not_ meant to be stable. Use it for testing only. ## Flashing for the first time -* Especially for the first time, you must flash externally. See below for the details -for using a Rapberry Pi, for example. +* Before doing anything, run Linux, install `dmidecode` and run `prepare_before_installation.sh` +It simply prints valuable system information. * Make sure you have RAM that uses 1,5V, not 1,35V. Check the specification of your RAM module(s). +* Especially for the first time, you must flash externally. See below for the details +for using a Rapberry Pi, for example. ### before you begin: original update / EC firmware (optional) Before flashing coreboot, consider doing one original Lenovo upgrade process diff --git a/x230/prepare_before_installation.sh b/x230/prepare_before_installation.sh new file mode 100755 index 0000000..5b398e9 --- /dev/null +++ b/x230/prepare_before_installation.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2018, Martin Kepplinger +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' + +set -e + +usage() +{ + echo "Usage: $0" + echo "" + echo "please make sure dmidecode is installed" +} + +args=$(getopt -o h -- "$@") +if [ $? -ne 0 ] ; then + usage + exit 1 +fi + +eval set -- "$args" +while [ $# -gt 0 ] +do + case "$1" in + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + echo "Invalid option: $1" + exit 1 + ;; + esac + shift +done + +hash dmidecode + +LAPTOP=$(dmidecode | grep -i x230 | sort -u) +if [ -z $LAPTOP ] ; then + echo "This is no Thinkpad X230. This script is useless then." + exit 0 +fi + +BIOS_VENDOR=$(dmidecode -t bios | grep Vendor) +if [[ $BIOS_VENDOR = *"oreboot"* ]] ; then + echo "coreboot already intalled. This script is only useful when an original BIOS is installed." + exit 0 +fi + +dmidecode -s bios-version +BIOS_VERSION=$(dmidecode -s bios-version | grep -o '[0-9][0-9]') +if [ "${BIOS_VERSION}" = "72" ] ; then + echo "latest original BIOS version installed. Nothing to do." +elif [ "${BIOS_VERSION}" -gt "60" ] ; then + echo "original BIOS is not the latest version, but the EC version is." + echo "You may upgrade before installing coreboot if you want." +else + echo -e "The installed original BIOS is very old. ${RED}please upgrade${NC} before installing coreboot." +fi + +echo "Please search for your SODIMM RAM and verify that it uses 1,5 Volts (not 1,35V):" +dmidecode -t memory | grep Part | grep -v "Not Specified" | sort -u | cut -d':' -f2 | sed 's/ //' diff --git a/x230/release.sh b/x230/release.sh index 90c57e1..01a4a16 100755 --- a/x230/release.sh +++ b/x230/release.sh @@ -105,6 +105,7 @@ tar -cJf skulls-x230-${version}.tar.xz \ util \ LICENSE* \ prepare_internal_flashing.sh \ + prepare_before_intallation.sh \ flashrom_rpi_bottom_unlock.sh \ flashrom_rpi_top_write.sh \ sources \