From 3779bcebaea33341f8861b9ffc817b8565f30c21 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 6 Apr 2020 06:50:16 -0700 Subject: [PATCH] Update the utility scripts and README.md file for the new X230 Tablet release --- x230t/README.md | 22 +-- x230t/build.sh | 6 +- x230t/compile.sh | 2 +- x230t/external_install_bottom.sh | 4 +- x230t/external_install_top.sh | 4 +- x230t/release.sh | 8 +- x230t/x230_heads.sh | 162 ---------------------- x230t/x230_heads_extract_blobs.sh | 127 ----------------- x230t/{x230_skulls.sh => x230t_skulls.sh} | 26 ++-- 9 files changed, 36 insertions(+), 325 deletions(-) delete mode 100755 x230t/x230_heads.sh delete mode 100755 x230t/x230_heads_extract_blobs.sh rename x230t/{x230_skulls.sh => x230t_skulls.sh} (89%) diff --git a/x230t/README.md b/x230t/README.md index 8ddbc52..18d4914 100644 --- a/x230t/README.md +++ b/x230t/README.md @@ -1,4 +1,4 @@ -# Skulls - [Thinkpad X230](https://pcsupport.lenovo.com/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x230) and X230T +# Skulls - [Thinkpad X230 Tablet](https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-tablet-laptops/thinkpad-x230-tablet) ![seabios_bootmenu](front.jpg) @@ -12,10 +12,10 @@ Get it from our [release page](https://github.com/merge/coreboot-x230/releases) We release multiple different, but _very similar_ images you can choose from. They all should work on all versions of the X230/X230T. These are the differences; (xxxxxxxxxx stands for random characters in the filename): -* `x230_coreboot_seabios_xxxxxxxxxx_top.rom` includes the _proprietary_ +* `x230t_coreboot_seabios_xxxxxxxxxx_top.rom` includes the _proprietary_ [VGA BIOS](https://en.wikipedia.org/wiki/Video_BIOS) from [Intel](https://www.intel.com/content/www/us/en/intelligent-systems/intel-embedded-graphics-drivers/faq-bios-firmware.html) which is non-free software. It is executed in "secure" mode. -* `x230_coreboot_seabios_free_xxxxxxxxxx_top.rom` includes the +* `x230t_coreboot_seabios_free_xxxxxxxxxx_top.rom` includes the [VGA BIOS](https://en.wikipedia.org/wiki/Video_BIOS) [SeaVGABIOS](https://www.seabios.org/SeaVGABIOS) which is free software. While technically more interesting, visually this is currently not as @@ -33,13 +33,13 @@ beautiful: * [How to rebuild](#how-to-reproduce-the-release-images) ## TL;DR -1. run `sudo ./x230_skulls.sh` on your current X230 Linux system +1. run `sudo ./x230t_skulls.sh` on your current X230 Linux system 2. Power down, remove the battery. Remove the keyboard and palmrest. Connect a hardware flasher to an external PC (or a Raspberry Pi with a SPI 8-pin chip clip can directly be used), and run `sudo ./external_install_bottom.sh` on the lower chip and `sudo ./external_install_top.sh` on the top chip of the two. -3. For updating later, run `./x230_skulls.sh`. No need to disassemble. +3. For updating later, run `./x230t_skulls.sh`. No need to disassemble. And always use the latest [released](https://github.com/merge/coreboot-x230/releases) package. This will be tested. The git master @@ -47,15 +47,15 @@ branch is _not_ meant to be stable. Use it for testing only. ## First-time installation #### before you begin -Run Linux on your X230, install `dmidecode` and run -`sudo ./x230_skulls.sh`. It simply prints system information and +Run Linux on your X230 Tablet, install `dmidecode` and run +`sudo ./x230t_skulls.sh`. It simply prints system information and helps you to be up to date. -Make sure you have the latest skulls-x230 package release by running -`./x230_skulls.sh -U`. +Make sure you have the latest skulls-x230t package release by running +`./x230t_skulls.sh -U`. #### original BIOS update / EC firmware (optional) -If the script, `sudo ./x230_skulls.sh` says "The installed original BIOS is very +If the script, `sudo ./x230t_skulls.sh` says "The installed original BIOS is very old.", it means that you have a BIOS version that may include an EC version older than 1.14. @@ -71,7 +71,7 @@ further firmware patching. You have 2 options: -* use [the latest original CD](https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x230/downloads/ds029187) and burn it, or +* use [the latest original CD](https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-tablet-laptops/thinkpad-x230-tablet/downloads/DS029683) and burn it, or * use the same, only with a patched EC firmware that allows using any aftermarket-battery: (this is only possible up to EC Firmware 1.14) By default, only original Lenovo batteries are allowed. diff --git a/x230t/build.sh b/x230t/build.sh index adfb329..cdedeae 100755 --- a/x230t/build.sh +++ b/x230t/build.sh @@ -7,7 +7,7 @@ have_config=0 usage() { - echo "Skulls for the X230" + echo "Skulls for the X230 Tablet" echo " Run this script to rebuild a released image" echo "" echo "Usage: $0 [-c ]" @@ -77,5 +77,5 @@ CONFIGFILE_READY=$(echo $CONFIGFILE | cut -d'-' -f2-) cp $CONFIGFILE $CONFIGFILE_READY cd .. -./build.sh --clean-slate --commit $(ls -1 x230/defconfig-* | cut -d'-' -f2-) x230 -rm -f x230/defconfig-* +./build.sh --clean-slate --commit $(ls -1 x230t/defconfig-* | cut -d'-' -f2-) x230t +rm -f x230t/defconfig-* diff --git a/x230t/compile.sh b/x230t/compile.sh index 78092b6..51c0486 100755 --- a/x230t/compile.sh +++ b/x230t/compile.sh @@ -11,7 +11,7 @@ source /home/coreboot/common_scripts/config_and_make.sh ## MODEL VARIABLES ################################################################################ MAINBOARD="lenovo" -MODEL="x230" +MODEL="x230t" ################################################################################ diff --git a/x230t/external_install_bottom.sh b/x230t/external_install_bottom.sh index ae9df45..f32620f 100755 --- a/x230t/external_install_bottom.sh +++ b/x230t/external_install_bottom.sh @@ -20,9 +20,9 @@ rpi_frequency=0 usage() { - echo "Skulls for the X230" + echo "Skulls for the X230 Tablet" echo " Run this script on an external computer with a flasher" - echo " connected to the X230's bottom chip (farther away from" + echo " connected to the X230T's bottom chip (farther away from" echo " the display, closer to you)." echo "" echo "Usage: $0 [-m] [-k ] [-l] [-f ] [-b ] [-c ]" diff --git a/x230t/external_install_top.sh b/x230t/external_install_top.sh index b26216c..47adaec 100755 --- a/x230t/external_install_top.sh +++ b/x230t/external_install_top.sh @@ -15,7 +15,7 @@ rpi_frequency=0 usage() { - echo "Skulls for the X230" + echo "Skulls for the X230 Tablet" echo " Run this script on an external computer with a flasher" echo " connected to the X230's top chip (closer to the display" echo " and farther from you)" @@ -83,7 +83,7 @@ command -v flashrom >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install flash command -v mktemp >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install mktemp (coreutils)${NC}."; exit 1; } if [ ! "$have_input_image" -gt 0 ] ; then - image_available=$(ls -1 | grep x230_coreboot_seabios || true) + image_available=$(ls -1 | grep x230t_coreboot_seabios || true) if [ -z "${image_available}" ] ; then echo "No image file found. Please add -i " echo "" diff --git a/x230t/release.sh b/x230t/release.sh index e9e530c..5c7f08a 100755 --- a/x230t/release.sh +++ b/x230t/release.sh @@ -115,7 +115,7 @@ if [ ! "$filesize" -eq "$reference_filesize" ] ; then exit 1 fi -RELEASE_DIR="skulls-x230-${version}" +RELEASE_DIR="skulls-x230t-${version}" rm -rf "$RELEASE_DIR" mkdir -p "$RELEASE_DIR" @@ -132,9 +132,9 @@ sha256sum ${RELEASE_DIR}/${RELEASE_IMAGE_FILE_2} > "${RELEASE_DIR}/${RELEASE_IMA cp ../SOURCE.md "$RELEASE_DIR" cp -a ../util "$RELEASE_DIR" -# copy in x230 stuff +# copy in x230t stuff cp -a README.md NEWS LICENSE* \ - x230_skulls.sh x230_heads.sh \ + x230t_skulls.sh \ external_install_bottom.sh external_install_top.sh \ "$RELEASE_DIR" @@ -143,7 +143,7 @@ tar -cJf "$RELEASE_DIR".tar.xz "$RELEASE_DIR" rm -rf "$RELEASE_DIR" git commit -a -m "update to ${version}" -git tag -s "${version}" -m "skulls-x230 ${version}" +git tag -s "${version}" -m "skulls-x230t ${version}" sha256sum "$RELEASE_DIR".tar.xz > "$RELEASE_DIR".tar.xz.sha256 sha512sum "$RELEASE_DIR".tar.xz > "$RELEASE_DIR".tar.xz.sha512 diff --git a/x230t/x230_heads.sh b/x230t/x230_heads.sh deleted file mode 100755 index aa99bd3..0000000 --- a/x230t/x230_heads.sh +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-3.0+ -# Copyright (C) 2018, Martin Kepplinger - -set -e - -cd "$(dirname "$0")" - -source "util/functions.sh" - -have_input_image=0 -extended_mode=0 - -usage() -{ - echo "Skulls for the X230" - echo " Run this script on the X230 directly." - echo "" - echo " This flashes Heads to your BIOS, see http://osresearch.net" - echo " Heads is a different project. No image is included." - echo " Read https://github.com/osresearch/heads for how to build it" - echo " Make sure you booted Linux with iomem=relaxed" - echo "" - echo "Usage: $0 -i .rom" - echo "" - echo " (EXPERIMENTAL) Extended Bios:" - echo " -x use extended mode" - echo "" - echo "Usage example:" - echo "Flash an extended Heads image: $0 -x -i .rom" -} - -args=$(getopt -o xi:h -- "$@") -if [ $? -ne 0 ] ; then - usage - exit 1 -fi - -eval set -- "$args" -while [ $# -gt 0 ] -do - case "$1" in - -i) - INPUT_IMAGE_PATH=$2 - have_input_image=1 - shift - ;; - -x) - extended_mode=1 - ;; - -h) - usage - exit 1 - ;; - --) - shift - break - ;; - *) - echo "Invalid option: $1" - exit 1 - ;; - esac - shift -done - -force_x230_and_root - -if [ ! "$have_input_image" -gt 0 ] ; then - image_available=$(ls -1 | grep rom || true) - if [ -z "${image_available}" ] ; then - echo "No image file found. Please add -i " - echo "" - usage - exit 1 - fi - - prompt="file not specified. Please select a file to flash:" - options=( $(find -maxdepth 1 -name "*rom" -print0 | xargs -0) ) - - PS3="$prompt " - select INPUT_IMAGE_PATH in "${options[@]}" "Quit" ; do - if (( REPLY == 1 + ${#options[@]} )) ; then - exit - - elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then - break - - else - echo "Invalid option. Try another one." - fi - done -fi - -OUTPUT_PATH=output -INPUT_IMAGE_NAME=$(basename "${INPUT_IMAGE_PATH}") -OUTPUT_IMAGE_NAME=${INPUT_IMAGE_NAME%%.*}_prepared.rom - -echo -e "input: ${INPUT_IMAGE_NAME}" -echo -e "output: ${OUTPUT_PATH}/${OUTPUT_IMAGE_NAME}" - -input_filesize=$(wc -c <"$INPUT_IMAGE_PATH") -reference_filesize=12582912 -if [ ! "$input_filesize" -eq "$reference_filesize" ] ; then - echo "Error: input file must be 12MB of size" - exit 1 -fi - -rm -rf ${OUTPUT_PATH} -mkdir ${OUTPUT_PATH} - -cp "${INPUT_IMAGE_PATH}" "${OUTPUT_PATH}/${OUTPUT_IMAGE_NAME}" -LAYOUT_FILENAME="x230-layout-heads.txt" - -if [ ! "$extended_mode" -gt 0 ] ; then - echo "0x00000000:0x00000fff ifd" > ${OUTPUT_PATH}/${LAYOUT_FILENAME} - echo "0x00001000:0x00002fff gbe" >> ${OUTPUT_PATH}/${LAYOUT_FILENAME} - echo "0x00003000:0x004fffff me" >> ${OUTPUT_PATH}/${LAYOUT_FILENAME} - echo "0x00500000:0x00bfffff bios" >> ${OUTPUT_PATH}/${LAYOUT_FILENAME} -else - echo -e "${YELLOW}EXPERIMENTAL: extended flash image${NC}" - echo "0x00000000:0x00000fff ifd" > ${OUTPUT_PATH}/${LAYOUT_FILENAME} - echo "0x00001000:0x00002fff gbe" >> ${OUTPUT_PATH}/${LAYOUT_FILENAME} - echo "0x00003000:0x0001afff me" >> ${OUTPUT_PATH}/${LAYOUT_FILENAME} - echo "0x0001b000:0x00bfffff bios" >> ${OUTPUT_PATH}/${LAYOUT_FILENAME} -fi - -echo -e "${YELLOW}WARNING${NC}: Make sure not to power off your computer or interrupt this process in any way!" -echo -e " Interrupting this process may result in irreparable damage to your computer!" -check_battery -while true; do - read -r -p "Flash the BIOS now? y/N: " yn - case $yn in - [Yy]* ) - if [ ! "$extended_mode" -gt 0 ] ; then - cd ${OUTPUT_PATH} && ${FLASHROM} --force --noverify-all -p internal --layout ${LAYOUT_FILENAME} --image bios -w "${OUTPUT_IMAGE_NAME}" - else - cd ${OUTPUT_PATH} && ${FLASHROM} -p internal --layout ${LAYOUT_FILENAME} --image ifd -w "${OUTPUT_IMAGE_NAME}" - ${FLASHROM} -p internal --layout ${LAYOUT_FILENAME} --image me -w "${OUTPUT_IMAGE_NAME}" - ${FLASHROM} -p internal --layout ${LAYOUT_FILENAME} --image bios -w "${OUTPUT_IMAGE_NAME}" - fi - break - ;; - [Nn]* ) - exit - ;; - * ) - exit - ;; - esac -done - -rm -rf ${OUTPUT_PATH} - -while true; do - read -r -p "Power off now? (please do!) Y/n: " yn - case $yn in - [Yy]* ) poweroff ;; - [Nn]* ) exit;; - * ) poweroff ;; - esac -done diff --git a/x230t/x230_heads_extract_blobs.sh b/x230t/x230_heads_extract_blobs.sh deleted file mode 100755 index 65d2704..0000000 --- a/x230t/x230_heads_extract_blobs.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-3.0+ -# Copyright (C) 2019, Martin Kepplinger - -set -e - -cd "$(dirname "$0")" - -IFDTOOL=./util/ifdtool/ifdtool -ME_CLEANER=./util/me_cleaner/me_cleaner.py -have_input_image=0 - -usage() -{ - echo "EXPERIMENTAL" - echo "" - echo "This generates files for building Heads from your original 12M backup:" - echo " (cat bottom.bin top.bin > full_backup_image.rom)" - echo " ifd/me will be shrinked by me_cleaner and unlocked" - echo "" - echo " http://osresearch.net" - echo "" - echo "Usage: $0 -f .rom -i (optional) -m " - echo "" - usage - exit 1 -fi - -if [ ! -e ${IFDTOOL} ] ; then - if [ ! -d util/ifdtool ] ; then - echo "Please specify -i " - exit 1 - fi - make -C util/ifdtool - if [ ! -e ${IFDTOOL} ] ; then - echo "Failed to build ifdtool" - exit 1 - fi -fi -if [ ! -e ${ME_CLEANER} ] ; then - mkdir -p util/me_cleaner - curl -L https://raw.githubusercontent.com/corna/me_cleaner/v1.2/me_cleaner.py -o util/me_cleaner/me_cleaner.py - if [ ! -e ${ME_CLEANER} ] ; then - echo "Failed to download me_cleaner" - exit 1 - fi -fi - -OUTPUT_PATH=output -INPUT_IMAGE_NAME=$(basename "${INPUT_IMAGE_PATH}") -WORK_IMAGE_NAME=${INPUT_IMAGE_NAME%%.*}_prepared.rom - -input_filesize=$(wc -c <"$INPUT_IMAGE_PATH") -reference_filesize=12582912 -if [ ! "$input_filesize" -eq "$reference_filesize" ] ; then - echo "Error: input file must be 12MB of size" - exit 1 -fi - -rm -rf ${OUTPUT_PATH} -mkdir ${OUTPUT_PATH} -cp "${INPUT_IMAGE_PATH}" "${OUTPUT_PATH}/${WORK_IMAGE_NAME}" - -${IFDTOOL} -x "${OUTPUT_PATH}/${WORK_IMAGE_NAME}" -mv flashregion*bin "${OUTPUT_PATH}/" -cp "${OUTPUT_PATH}/flashregion_3_gbe.bin" "${OUTPUT_PATH}/gbe.bin" -rm ${OUTPUT_PATH}/flashregion*bin - -python ${ME_CLEANER} -r -t -d -S -O "${OUTPUT_PATH}/unneeded_cleaned_image.bin" -D "${OUTPUT_PATH}/ifd_shrinked.bin" -M "${OUTPUT_PATH}/me.bin" "${OUTPUT_PATH}/${WORK_IMAGE_NAME}" -rm "${OUTPUT_PATH}/unneeded_cleaned_image.bin" - -${IFDTOOL} -u "${OUTPUT_PATH}/ifd_shrinked.bin" -mv "${OUTPUT_PATH}/ifd_shrinked.bin.new" "${OUTPUT_PATH}/descriptor.bin" -rm "${OUTPUT_PATH}/ifd_shrinked.bin" - -rm "${OUTPUT_PATH}/${WORK_IMAGE_NAME}" - -echo "done. this is what a layout file should look like:" -echo "0x00000000:0x00000fff ifd" -echo "0x00001000:0x00002fff gbe" -echo "0x00003000:0x0001afff me" -echo "0x0001b000:0x00bfffff bios" - -mv ${OUTPUT_PATH}/* . && rm -rf ${OUTPUT_PATH} diff --git a/x230t/x230_skulls.sh b/x230t/x230t_skulls.sh similarity index 89% rename from x230t/x230_skulls.sh rename to x230t/x230t_skulls.sh index 40ee1df..2a1e1c1 100755 --- a/x230t/x230_skulls.sh +++ b/x230t/x230t_skulls.sh @@ -14,8 +14,8 @@ verbose=0 usage() { - echo "Skulls for the X230" - echo " Run this script on the X230 directly." + echo "Skulls for the X230 Tablet" + echo " Run this script on the X230 Tablet directly." echo "" echo " This flashes the BIOS with the given image." echo " Make sure you booted Linux with iomem=relaxed" @@ -76,9 +76,9 @@ if [ "$request_update" -gt 0 ] ; then UPSTREAM_VERSION=$(curl -s https://api.github.com/repos/merge/skulls/releases/latest | grep browser_download_url | cut -d'"' -f4 | cut -d'/' -f9 | head -n 1 | egrep -o "([0-9]{1,}\.)+[0-9]{1,}") - UPSTREAM_X230=$(echo ${UPSTREAM_FILE} | grep x230) - if [[ -z "$UPSTREAM_X230" ]] ; then - echo "The latest release didn't include the X230" + UPSTREAM_X230T=$(echo ${UPSTREAM_FILE} | grep x230t) + if [[ -z "$UPSTREAM_X230T" ]] ; then + echo "The latest release didn't include the X230 Tablet" exit 0 fi @@ -87,10 +87,10 @@ if [ "$request_update" -gt 0 ] ; then fi if [[ "$CURRENT_VERSION" = "$UPSTREAM_VERSION" ]] ; then - echo -e "${GREEN}You are using the latest version of Skulls for the X230${NC}" + echo -e "${GREEN}You are using the latest version of Skulls for the X230 Tablet${NC}" exit 0 elif [[ "$CURRENT_VERSION" < "$UPSTREAM_VERSION" ]] ; then - echo -e "${RED}You have ${CURRENT_VERSION} but there is version ${UPSTREAM_VERSION} available for the X230. Please update.${NC}" + echo -e "${RED}You have ${CURRENT_VERSION} but there is version ${UPSTREAM_VERSION} available for the X230 Tablet. Please update.${NC}" read -r -p "Download it to the parent directory now? [y/N] " response case "$response" in [yY][eE][sS]|[yY]) @@ -100,9 +100,9 @@ if [ "$request_update" -gt 0 ] ; then curl -LO ${UPSTREAM_URL} curl -LO ${UPSTREAM_URL_SHA256} sha256sum -c ${UPSTREAM_FILE}.sha256 - mkdir skulls-x230-${UPSTREAM_VERSION} - tar -xf ${UPSTREAM_FILE} -C skulls-x230-${UPSTREAM_VERSION}/ - echo "Version ${UPSTREAM_VERSION} extracted to ../skulls-x230-${UPSTREAM_VERSION}/" + mkdir skulls-x230t-${UPSTREAM_VERSION} + tar -xf ${UPSTREAM_FILE} -C skulls-x230t-${UPSTREAM_VERSION}/ + echo "Version ${UPSTREAM_VERSION} extracted to ../skulls-x230t-${UPSTREAM_VERSION}/" echo "Please continue in the new directory." ;; *) @@ -110,7 +110,7 @@ if [ "$request_update" -gt 0 ] ; then ;; esac else - echo "You seem to use a development version. Please use release package skulls-x230 ${UPSTREAM_VERSION} for flashing." + echo "You seem to use a development version. Please use release package skulls-x230t ${UPSTREAM_VERSION} for flashing." fi exit 0 @@ -145,7 +145,7 @@ if [[ "$verbose" -gt 0 ]] ; then fi if [ ! "$have_input_image" -gt 0 ] ; then - image_available=$(ls -1 | grep x230_coreboot_seabios || true) + image_available=$(ls -1 | grep x230t_coreboot_seabios || true) if [ -z "${image_available}" ] ; then echo "No image file found. Please add -i " echo "" @@ -154,7 +154,7 @@ if [ ! "$have_input_image" -gt 0 ] ; then fi prompt="file not specified. Please select a file to flash. Please read the README for details about the differences:" - options=( $(find -maxdepth 1 -name "x230_coreboot_seabios*rom" -print0 | xargs -0) ) + options=( $(find -maxdepth 1 -name "x230t_coreboot_seabios*rom" -print0 | xargs -0) ) PS3="$prompt " select INPUT_IMAGE_PATH in "${options[@]}" "Quit" ; do