From bac5c3a05a6944c81eb982d8eee254a9312975c2 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 6 Sep 2016 12:33:01 -0500 Subject: [PATCH] add Legacy/UEFI Full ROM support for all HSW/BDW devices use colored text to improve readability when requiring user input restrict Kodi EZ Setup to Legacy ROMs only Signed-off-by: Matt DeVillier --- firmware.sh | 100 ++++++++++++++++++++++++++++++++++++--------------- functions.sh | 5 ++- kodi.sh | 1 + sources.sh | 89 +++++++++++++++++++++++++++------------------ 4 files changed, 130 insertions(+), 65 deletions(-) diff --git a/firmware.sh b/firmware.sh index e8f4011..c793f3c 100644 --- a/firmware.sh +++ b/firmware.sh @@ -41,12 +41,14 @@ useHeadless=false if [ -z "$1" ]; then echo -e "" #USB boot priority - read -p "Default to booting from USB? If N, always boot from internal storage unless selected from boot menu. [y/N] " + echo_yellow "Default to booting from USB?" + read -p "If N, always boot from internal storage unless selected from boot menu. [y/N] " [[ "$REPLY" = "y" || "$REPLY" = "Y" ]] && preferUSB=true echo -e "" #headless? if [ "$seabios_file" = "$seabios_hswbdw_box" ]; then - read -p "Install \"headless\" firmware? This is only needed for servers running without a connected display. [y/N] " + echo_yellow "Install \"headless\" firmware?" + read -p "This is only needed for servers running without a connected display. [y/N] " [[ "$REPLY" = "y" || "$REPLY" = "Y" ]] && useHeadless=true echo -e "" fi @@ -110,12 +112,6 @@ read -p "Press [Enter] to return to the main menu." ############################# function flash_coreboot() { -#temp -if [[ "$isHswBook" = true || "$isBdwBook" = true ]]; then - exit_red "\nFull ROM firmware files for Haswell/Broadwell Chromebooks are temporarily unavailable." - return 1 -fi - echo_green "\nInstall/Update Custom coreboot Firmware (Full ROM)" echo_yellow "Standard disclaimer: flashing the firmware has the potential to brick your device, requiring relatively inexpensive hardware and some @@ -132,13 +128,43 @@ if [[ "$isChromeOS" = true && ( "$(crossystem wpsw_cur)" == "1" || "$(crossystem exit_red "\nHardware write-protect enabled, cannot flash coreboot firmware."; return 1 fi +#UEFI or legacy firmware +useUEFI=false +if [[ "$hasUEFIoption" = true ]]; then + echo -e "" + echo_yellow "Install UEFI-compatible firmware?" + echo -e "UEFI firmware is preferred for Windows and OSX; +Linux requires the use of a boot manager like rEFInd. +Some Linux distros (like GalliumOS) are not UEFI-compatible +and work better with Legacy Boot (SeaBIOS) firmware. If you +have an existing Linux install using RW_LEGACY or BOOT_STUB +firmware, then choose the Legacy option. +" + REPLY="" + while [[ "$REPLY" != "U" && "$REPLY" != "u" && "$REPLY" != "L" && "$REPLY" != "l" ]] + do + read -p "Enter 'U' for UEFI, 'L' for Legacy: " + if [[ "$REPLY" = "U" || "$REPLY" = "u" ]]; then + useUEFI=true + fi + done +fi + #determine correct file / URL firmware_source=${fullrom_source} -[[ "$isHswBook" = true || "$isBdwBook" = true ]] && firmware_source=${fullrom_source_coolstar} if [ "$isHswBox" = true ]; then - coreboot_file=$coreboot_hsw_box -elif [[ "$isBdwBox" = true || "$isHswBook" = true || "$isBdwBook" = true || "$device" = "stumpy" || "$bayTrailHasFullROM" = "true" ]]; then - eval coreboot_file=$`echo "coreboot_${device}"` + if [ "$useUEFI" = true ]; then + coreboot_file=$coreboot_uefi_hsw_box + else + coreboot_file=$coreboot_hsw_box + fi +elif [[ "$isBdwBox" = true || "$isHswBook" = true || "$isBdwBook" = true \ + || "$device" = "stumpy" || "$bayTrailHasFullROM" = "true" ]]; then + if [ "$useUEFI" = true ]; then + eval coreboot_file=$`echo "coreboot_uefi_${device}"` + else + eval coreboot_file=$`echo "coreboot_${device}"` + fi else exit_red "Unknown or unsupported device (${device^^}); cannot continue."; return 1 fi @@ -148,10 +174,21 @@ if [ "$device" = "peppy" ]; then hasElan=$(cat /proc/bus/input/devices | grep "Elan") hasCypress=$(cat /proc/bus/input/devices | grep "Cypress") if [[ $hasElan = "" && $hasCypress = "" ]]; then - read -p "Unable to automatically determine trackpad type. Does your Peppy have an Elan pad? [y/N]" - [[ "$REPLY" = "y" || "$REPLY" = "Y" ]] && coreboot_file=${coreboot_peppy_elan} + echo -e "" + read -p "Unable to automatically determine trackpad type. Does your Peppy have an Elan pad? [y/N] " + if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]]; then + if [ "$useUEFI" = true ]; then + coreboot_file=${coreboot_uefi_peppy_elan} + else + coreboot_file=${coreboot_peppy_elan} + fi + fi elif [[ $hasElan != "" ]]; then - coreboot_file=${coreboot_peppy_elan} + if [ "$useUEFI" = true ]; then + coreboot_file=${coreboot_uefi_peppy_elan} + else + coreboot_file=${coreboot_peppy_elan} + fi fi fi @@ -168,11 +205,10 @@ fi #check if existing firmware is stock grep -obUa "vboot" /tmp/bios.bin >/dev/null if [ $? -eq 0 ]; then - read -p "Create a backup copy of your stock firmware? [Y/n] - -This is highly recommended in case you wish to return your device to stock + echo_yellow "Create a backup copy of your stock firmware?" + read -p "This is highly recommended in case you wish to return your device to stock configuration/run ChromeOS, or in the (unlikely) event that things go south -and you need to recover using an external EEPROM programmer. " +and you need to recover using an external EEPROM programmer. [Y/n] " [ "$REPLY" = "n" ] || backup_firmware fi #check that backup succeeded @@ -180,9 +216,10 @@ fi #headless? useHeadless=false -if [[ "$isHswBox" = true || "$isBdwBox" = true ]]; then +if [[ $useUEFI = false && ( "$isHswBox" = true || "$isBdwBox" = true ) ]]; then echo -e "" - read -p "Install \"headless\" firmware? This is only needed for servers running without a connected display. [y/N] " + echo_yellow "Install \"headless\" firmware?" + read -p "This is only needed for servers running without a connected display. [y/N] " if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then useHeadless=true fi @@ -190,21 +227,26 @@ fi #USB boot priority preferUSB=false -echo -e "" -read -p "Default to booting from USB? If N, always boot from the internal SSD unless selected from boot menu. [y/N] " -if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then - preferUSB=true -fi +if [[ $useUEFI = false ]]; then + echo -e "" + echo_yellow "Default to booting from USB?" + read -p "If N, always boot from the internal SSD unless selected from boot menu. [y/N] " + if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then + preferUSB=true + fi + fi #add PXE? addPXE=false -if [[ "$isHswBox" = true || "$isBdwBox" = true || "$device" = "ninja" ]]; then +if [[ $useUEFI = false && ( "$isHswBox" = true || "$isBdwBox" = true || "$device" = "ninja" ) ]]; then echo -e "" - read -p "Add PXE network booting capability? (This is not needed for by most users) [y/N] " + echo_yellow "Add PXE network booting capability?" + read -p "(This is not needed for by most users) [y/N] " if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then addPXE=true echo -e "" - read -p "Boot PXE by default? (will fall back to SSD/USB) [y/N] " + echo_yellow "Boot PXE by default?" + read -p "(will fall back to SSD/USB) [y/N] " if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then pxeDefault=true fi diff --git a/functions.sh b/functions.sh index f36d3e0..61bbca7 100644 --- a/functions.sh +++ b/functions.sh @@ -31,6 +31,7 @@ isFullRom=false isBootStub=false hasRwLegacy=false unlockMenu=false +hasUEFIoption=false hasShellball=false hsw_boxes=('' '' '' '' ''); @@ -41,7 +42,8 @@ baytrail=('' '' '' '' '' '' '< baytrail_full_rom=('' '' '' '' '' '' ''); braswell=('' '' '' '' '' '' ''); skylake=('' '' ''); - + +UEFI_ROMS=($(printf "%s %s %s %s " "${hsw_boxes[@]}" "${hsw_books[@]}" "${bdw_boxes[@]}" "${bdw_books[@]}")); shellballs=($(printf "%s %s %s %s %s " "${hsw_boxes[@]}" "${hsw_books[@]}" "${bdw_boxes[@]}" "${bdw_books[@]}" "${baytrail[@]}")); #menu text output @@ -280,6 +282,7 @@ fi [[ "${skylake[@]}" =~ "$device" ]] && isSkylake=true [[ "${baytrail_full_rom[@]}" =~ "$device" ]] && bayTrailHasFullROM=true [[ "${shellballs[@]}" =~ "$device" ]] && hasShellball=true +[[ "${UEFI_ROMS[@]}" =~ "$device" ]] && hasUEFIoption=true [[ "$isHswBox" = true || "$isBdwBox" = true || "$isHswBook" = true || "$isBdwBook" = true || "$isBaytrail" = true \ || "$isBraswell" = true || "$isSkylake" = true || "$device" = "stumpy" ]] || isUnsupported=true diff --git a/kodi.sh b/kodi.sh index d27de9c..2ac42ac 100644 --- a/kodi.sh +++ b/kodi.sh @@ -584,6 +584,7 @@ die "Error: $@" ############# function menu_kodi() { clear + hasUEFIoption=false echo -e "${NORMAL}\n ChromeBox Kodi E-Z Setup Script ${script_date} ${NORMAL}" echo -e "${NORMAL} (c) Mr. Chromebox \n ${NORMAL}" echo -e "${NORMAL} Paypal towards beer/programmer fuel welcomed at above address :)\n ${NORMAL}" diff --git a/sources.sh b/sources.sh index c9f830e..86c9a3f 100644 --- a/sources.sh +++ b/sources.sh @@ -3,7 +3,7 @@ #define these here for easy updating -script_date="[2016-08-09]" +script_date="[2016-09-06]" #where the stuff is util_source="https://www.mrchromebox.tech/files/util/" @@ -22,52 +22,71 @@ chrx_url="https://chrx.org/go" #LE version LE_version_base="LibreELEC-Generic.x86_64" LE_version_stable="7.0.2" -LE_version_latest="7.90.004" +LE_version_latest="7.90.005" #syslinux version syslinux_version="syslinux-6.04-pre1" #SBIB full ROMs -coreboot_stumpy="coreboot-seabios-stumpy-mrchromebox-20160805.rom" +coreboot_stumpy="coreboot_seabios-stumpy-mrchromebox_20160906.rom" -#Haswell full ROMs -coreboot_hsw_box="coreboot-seabios-panther-mrchromebox-20160805.rom" -coreboot_peppy="coreboot-seabios-peppy-20160108-coolstar.rom" -coreboot_peppy_elan="coreboot-seabios-peppy-20160108-coolstar-elan.rom" -coreboot_falco="coreboot-seabios-falco-20160108-coolstar.rom" -coreboot_wolf="coreboot-seabios-wolf-20160108-coolstar.rom" -coreboot_leon="coreboot-seabios-leon-20160108-coolstar.rom" +#Haswell full ROMs - Legacy +coreboot_falco="coreboot_seabios-falco-mrchromebox_20160906.rom" +coreboot_leon="coreboot_seabios-leon-mrchromebox_20160906.rom" +coreboot_hsw_box="coreboot_seabios-panther-mrchromebox_20160906.rom" +coreboot_peppy="coreboot_seabios-peppy-mrchromebox_20160906.rom" +coreboot_peppy_elan="coreboot_seabios-peppy_elan-mrchromebox_20160906.rom" +coreboot_wolf="coreboot_seabios-wolf-mrchromebox_20160906.rom" +#Haswell full ROMs - UEFI +coreboot_uefi_falco="coreboot_seabios_duet-falco-mrchromebox_20160906.rom" +coreboot_uefi_leon="coreboot_seabios_duet-leon-mrchromebox_20160906.rom" +coreboot_uefi_hsw_box="coreboot_seabios_duet-panther-mrchromebox_20160906.rom" +coreboot_uefi_peppy="coreboot_seabios_duet-peppy-mrchromebox_20160906.rom" +coreboot_uefi_peppy_elan="coreboot_seabios_duet-peppy_elan-mrchromebox_20160906.rom" +coreboot_uefi_wolf="coreboot_seabios_duet-wolf-mrchromebox_20160906.rom" -#Broadwell full ROMs -coreboot_guado="coreboot-seabios-guado-mrchromebox-20160805.rom" -coreboot_rikku="coreboot-seabios-rikku-mrchromebox-20160805.rom" -coreboot_tidus="coreboot-seabios-tidus-mrchromebox-20160805.rom" -coreboot_auron_paine="coreboot-seabios-auron-20160109-coolstar.rom" -coreboot_auron_yuna=${coreboot_auron_paine} -coreboot_gandof="coreboot-seabios-gandof-20160309-coolstar.rom" -coreboot_lulu="coreboot-seabios-lulu-20160311-coolstar.rom" -coreboot_samus="coreboot-seabios-samus-20160324-coolstar.rom" +#Broadwell full ROMs - Legacy +coreboot_auron_paine="coreboot_seabios-auron_paine-mrchromebox_20160906.rom" +coreboot_auron_yuna="coreboot_seabios-auron_yuna-mrchromebox_20160906.rom" +coreboot_auron=${coreboot_auron_paine} +coreboot_gandof="coreboot_seabios-gandof-mrchromebox_20160906.rom" +coreboot_guado="coreboot_seabios-guado-mrchromebox_20160906.rom" +coreboot_lulu="coreboot_seabios-lulu-mrchromebox_20160906.rom" +coreboot_rikku="coreboot_seabios-rikku-mrchromebox_20160906.rom" +coreboot_samus="coreboot_seabios-samus-mrchromebox_20160906.rom" +coreboot_tidus="coreboot_seabios-tidus-mrchromebox_20160906.rom" +#Broadwell full ROMs - UEFI +coreboot_uefi_auron_paine="coreboot_seabios_duet-auron_paine-mrchromebox_20160906.rom" +coreboot_uefi_auron_yuna="coreboot_seabios_duet-auron_yuna-mrchromebox_20160906.rom" +coreboot_uefi_auron=${coreboot_uefi_auron_paine} +coreboot_uefi_gandof="coreboot_seabios_duet-gandof-mrchromebox_20160906.rom" +coreboot_uefi_guado="coreboot_seabios_duet-guado-mrchromebox_20160906.rom" +coreboot_uefi_lulu="coreboot_seabios_duet-lulu-mrchromebox_20160906.rom" +coreboot_uefi_rikku="coreboot_seabios_duet-rikku-mrchromebox_20160906.rom" +coreboot_uefi_samus="coreboot_seabios_duet-samus-mrchromebox_20160906.rom" +coreboot_uefi_tidus="coreboot_seabios_duet-tidus-mrchromebox_20160906.rom" -#BayTrail full ROMs -coreboot_candy="coreboot-seabios-candy-mrchromebox-20160805.rom" -coreboot_enguarde="coreboot-seabios-enguarde-mrchromebox-20160805.rom" -coreboot_glimmer="coreboot-seabios-glimmer-mrchromebox-20160805.rom" -coreboot_gnawty="coreboot-seabios-gnawty-mrchromebox-20160805.rom" -coreboot_ninja="coreboot-seabios-ninja-mrchromebox-20160805.rom" -coreboot_quawks="coreboot-seabios-quawks-mrchromebox-20160805.rom" -coreboot_swanky="coreboot-seabios-swanky-mrchromebox-20160805.rom" + +#BayTrail full ROMs - Legacy +coreboot_candy="coreboot_seabios-candy-mrchromebox_20160906.rom" +coreboot_enguarde="coreboot_seabios-enguarde-mrchromebox_20160906.rom" +coreboot_glimmer="coreboot_seabios-glimmer-mrchromebox_20160906.rom" +coreboot_gnawty="coreboot_seabios-gnawty-mrchromebox_20160906.rom" +coreboot_ninja="coreboot_seabios-ninja-mrchromebox_20160906.rom" +coreboot_quawks="coreboot_seabios-quawks-mrchromebox_20160906.rom" +coreboot_swanky="coreboot_seabios-swanky-mrchromebox_20160906.rom" #RW_LEGACY payloads -seabios_hswbdw_box="seabios-hswbdw-box-mrchromebox-20160805.bin" -seabios_hsw_book="seabios-hsw-book-mrchromebox-20160805.bin" -seabios_bdw_book="seabios-bdw-book-mrchromebox-20160805.bin" -seabios_baytrail="seabios-byt-mrchromebox-20160805.bin" -seabios_braswell="seabios-bsw-mrchromebox-20160805.bin" -seabios_skylake="seabios-skl-mrchromebox-20160805.bin" +seabios_hswbdw_box="seabios-hswbdw_box-mrchromebox_20160906.bin" +seabios_hsw_book="seabios-hsw_book-mrchromebox_20160906.bin" +seabios_bdw_book="seabios-bdw_book-mrchromebox_20160906.bin" +seabios_baytrail="seabios-byt-mrchromebox_20160906.bin" +seabios_braswell="seabios-bsw-mrchromebox_20160906.bin" +seabios_skylake="seabios-skl-mrchromebox_20160906.bin" -#BOOT_STUB payload -bootstub_payload_baytrail="seabios-byt-bootstub-mrchromebox-20160805.bin" +#BOOT_STUB payloads +bootstub_payload_baytrail="seabios-byt_bootstub-mrchromebox_20160906.bin" #hsw/bdw headless VBIOS hswbdw_headless_vbios="hswbdw_vgabios_1040_cbox_headless.dat"