From 4e97c77bed320d8d37e8754e7f5a3e92aa4b3b93 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Wed, 20 Jul 2016 01:26:22 -0500 Subject: [PATCH] scipts 2.0 - massive update to correspond with website lauch Signed-off-by: Matt DeVillier --- firmware.sh | 414 +++++++++++++++++++++++++++------------------- functions.sh | 201 +++++++++++++++++++++- kodi.sh | 18 +- setup-firmware.sh | 3 +- setup-kodi.sh | 7 +- sources.sh | 40 +++-- 6 files changed, 467 insertions(+), 216 deletions(-) diff --git a/firmware.sh b/firmware.sh index 6b4814f..4260448 100644 --- a/firmware.sh +++ b/firmware.sh @@ -49,16 +49,16 @@ if [ -z "$1" ]; then fi #download SeaBIOS update -echo_yellow "\nDownloading Legacy BIOS update" -curl -s -L -O ${dropbox_url}${seabios_file}.md5 -curl -s -L -O ${dropbox_url}${seabios_file} +echo_yellow "\nDownloading RW_LEGACY firmware update" +curl -s -L -O ${rwlegacy_source}${seabios_file}.md5 +curl -s -L -O ${rwlegacy_source}${seabios_file} #verify checksum on downloaded file md5sum -c ${seabios_file}.md5 --quiet 2> /dev/null -[[ $? -ne 0 ]] && { exit_red "Legacy BIOS download checksum fail; download corrupted, cannot flash"; return 1; } +[[ $? -ne 0 ]] && { exit_red "RW_LEGACY download checksum fail; download corrupted, cannot flash"; return 1; } #preferUSB? if [ "$preferUSB" = true ]; then - curl -s -L -o bootorder "${dropbox_url}bootorder.usb" + curl -s -L -o bootorder "${cbfs_source}bootorder.usb" if [ $? -ne 0 ]; then echo_red "Unable to download bootorder file; boot order cannot be changed." else @@ -68,7 +68,7 @@ if [ "$preferUSB" = true ]; then fi #useHeadless? if [ "$useHeadless" = true ]; then - curl -s -L -O "${dropbox_url}${hswbdw_headless_vbios}" + curl -s -L -O "${cbfs_source}${hswbdw_headless_vbios}" if [ $? -ne 0 ]; then echo_red "Unable to download headless VGA BIOS; headless firmware cannot be installed." else @@ -83,10 +83,23 @@ if [ "$useHeadless" = true ]; then fi fi fi +#add emmc/sdcard controller addresses for Baytrail if known +if [[ "$isBaytrail" = true && "$emmcAddr" != "" ]]; then + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard0 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard1 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard2 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard3 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard4 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard5 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} remove -n etc/sdcard6 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} add-int -i ${emmcAddr} -n etc/sdcard0 > /dev/null 2>&1 + ${cbfstoolcmd} ${seabios_file} add-int -i ${sdcardAddr} -n etc/sdcard1 > /dev/null 2>&1 +fi + #flash updated legacy BIOS -echo_yellow "Installing Legacy BIOS / RW_LEGACY (${seabios_file})" +echo_yellow "Installing RW_LEGACY firmware (${seabios_file})" ${flashromcmd} -w -i RW_LEGACY:${seabios_file} > /dev/null 2>&1 -echo_green "Legacy BIOS successfully updated." +echo_green "Legacy BIOS / RW_LEGACY firmware successfully installed/updated." } @@ -107,11 +120,11 @@ function flash_coreboot() { #temp if [[ "$isHswBook" = true || "$isBdwBook" = true ]]; then - exit_red "\nFirmware files for Haswell/Broadwell Chromebooks are temporarily unavailable." + exit_red "\nFull ROM firmware files for Haswell/Broadwell Chromebooks are temporarily unavailable." return 1 fi -echo_green "\nInstall/Update Custom coreboot Firmware" +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 technical knowledge to recover. You have been warned." @@ -128,8 +141,8 @@ if [[ "$isChromeOS" = true && ( "$(crossystem wpsw_cur)" == "1" || "$(crossystem fi #determine correct file / URL -firmware_source=${firmware_source_main} -[[ "$isHswBook" = true || "$isBdwBook" = true ]] && firmware_source=${firmware_source_coolstar} +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 @@ -150,15 +163,7 @@ if [ "$device" = "peppy" ]; then fi fi -#read existing firmware and try to extract MAC address info -echo_yellow "Reading current firmware" -${flashromcmd} -r /tmp/bios.bin > /dev/null 2>&1 -if [ $? -ne 0 ]; then - echo_red "Failure reading current firmware; cannot proceed." - read -p "Press [Enter] to return to the main menu." - return; -fi - +#extract MAC address if needed if [[ "$isHswBox" = true || "$isBdwBox" = true || "$device" = "ninja" ]]; then #check if contains MAC address, extract extract_vpd /tmp/bios.bin @@ -230,7 +235,7 @@ if [ -f /tmp/vpd.bin ]; then fi #preferUSB? if [ "$preferUSB" = true ]; then - curl -s -L -o bootorder "${dropbox_url}bootorder.usb" + curl -s -L -o bootorder "${cbfs_source}bootorder.usb" if [ $? -ne 0 ]; then echo_red "Unable to download bootorder file; boot order cannot be changed." else @@ -240,7 +245,7 @@ if [ "$preferUSB" = true ]; then fi #useHeadless? if [ "$useHeadless" = true ]; then - curl -s -L -O "${dropbox_url}${hswbdw_headless_vbios}" + curl -s -L -O "${cbfs_source}${hswbdw_headless_vbios}" if [ $? -ne 0 ]; then echo_red "Unable to download headless VGA BIOS; headless firmware cannot be installed." else @@ -250,7 +255,7 @@ if [ "$useHeadless" = true ]; then fi #addPXE? if [ "$addPXE" = true ]; then - curl -s -L -O "${dropbox_url}${pxe_optionrom}" + curl -s -L -O "${cbfs_source}${pxe_optionrom}" if [ $? -ne 0 ]; then echo_red "Unable to download PXE option ROM; PXE capability cannot be added." else @@ -275,7 +280,7 @@ fi echo_yellow "Installing custom coreboot firmware (${coreboot_file})" ${flashromcmd} -w "${coreboot_file}" > /dev/null 2>&1 if [ $? -eq 0 ]; then - echo_green "Custom coreboot firmware successfully installed/updated." + echo_green "Custom coreboot firmware (Full ROM) successfully installed/updated." else echo_red "An error occurred flashing the coreboot firmware. DO NOT REBOOT!" fi @@ -344,62 +349,78 @@ Connect the USB/SD device which contains the backed-up stock firmware and press echo -e "" else - if [[ "$isHswBox" = false && "$isBdwBox" = false && "$device" != "ninja" ]]; then - exit_red "\nUnfortunately I don't have a stock firmware available to download for \"$device\" at this time."; return 1 + if [[ "$hasShellball" = false ]]; then + exit_red "\nUnfortunately I don't have a stock firmware available to download for \"$device\" at this time." + return 1 fi #download firmware extracted from recovery image - echo_yellow "\nThat's ok, I'll download one for you. Which ChromeBox do you have?" - if [ "$device" != "panther" ]; then - echo_yellow "I'm pretty sure it's \"$device\"" + echo_yellow "\nThat's ok, I'll download a shellball firmware for you." + + if [ "${device^^}" = "PANTHER" ]; then + echo -e "Which ChromeBox do you have?\n" + echo "1) Asus CN60 [PANTHER]" + echo "2) HP CB1 [ZAKO]" + echo "3) Dell 3010 [TRICKY]" + echo "4) Acer CXI [MCCLOUD]" + echo "" + read -p "? " fw_num + if [[ $fw_num -lt 1 || $fw_num -gt 8 ]]; then + exit_red "Invalid input - cancelling" + return 1 + fi + #confirm menu selection + echo -e "" + read -p "Confirm selection number ${fw_num} [y/N] " + [[ "$REPLY" = "y" || "$REPLY" = "Y" ]] || exit_red "User cancelled restoring stock firmware"; return + + #download firmware file + echo -e "" + echo_yellow "Downloading recovery image firmware file" + case "$fw_num" in + 1) _device="panther"; + ;; + 2) _device="zako"; + ;; + 3) _device="tricky"; + ;; + 4) _device="mccloud"; + ;; + esac + + + else + #confirm device detection + echo_yellow "Confirm system details:" + echo -e "Device: ${deviceDesc}" + echo -e "Board Name: ${device^^}" + echo -e "" + read -p "? [y/N] " + if [[ "$REPLY" != "y" && "$REPLY" != "Y" ]]; then + exit_red "Device detection failed; unable to restoring stock firmware" + return 1 + fi + echo -e "" + _device=${device} fi - echo "1) Asus CN60 (Haswell) [Panther]" - echo "2) HP CB1 (Haswell) [Zako]" - echo "3) Dell 3010 (Haswell) [Tricky]" - echo "4) Acer CXI (Haswell) [McCloud]" - echo "5) Asus CN62 (Broadwell) [Guado]" - echo "6) Acer CXI2 (Broadwell) [Rikku]" - echo "7) Lenovo ThinkCentre (Broadwell) [Tidus]" - echo "8) AOpen Chromebox Commercial (Baytrail) [Ninja]" - echo "" - read -p "? " fw_num - if [[ $fw_num -lt 1 || $fw_num -gt 8 ]]; then - exit_red "Invalid input - cancelling"; return - fi - - #download firmware file - echo_yellow "\nDownloading recovery image firmware file" - case "$fw_num" in - 1) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/sLQL9i1p; - ;; - 2) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/8NmzlrZ6; - ;; - 3) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/IXLtQ097; - ;; - 4) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/Nh5EeEti; - ;; - 5) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/r0sKwJYe; - ;; - 6) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/qd59yozS; - ;; - 7) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/uidxAG1E; - ;; - 8) curl -s -L -o /tmp/stock-firmware.rom https://db.tt/3xsP2Qtj - ;; - esac + #download shellball ROM + curl -s -L -o /tmp/stock-firmware.rom ${shellball_source}shellball.${_device}.bin; [[ $? -ne 0 ]] && { exit_red "Error downloading; unable to restore stock firmware."; return 1; } - #read current firmware to extract VPD - echo_yellow "Reading current firmware" - ${flashromcmd} -r /tmp/bios.bin > /dev/null 2>&1 - [[ $? -ne 0 ]] && { exit_red "Failure reading current firmware; cannot proceed."; return 1; } - #extract VPD - extract_vpd /tmp/bios.bin - #merge with recovery image firmware - if [ -f /tmp/vpd.bin ]; then - echo_yellow "Merging VPD into recovery image firmware" - dd if=/tmp/vpd.bin bs=1 seek=$((0x00600000)) count=$((0x00004000)) of=/tmp/stock-firmware.rom conv=notrunc > /dev/null 2>&1 + #extract VPD if present + if [[ "$isHswBox" = true || "$isBdwBox" = true || "$device" = "ninja" ]]; then + #read current firmware to extract VPD + echo_yellow "Reading current firmware" + ${flashromcmd} -r /tmp/bios.bin > /dev/null 2>&1 + [[ $? -ne 0 ]] && { exit_red "Failure reading current firmware; cannot proceed."; return 1; } + #extract VPD + extract_vpd /tmp/bios.bin + #merge with recovery image firmware + if [ -f /tmp/vpd.bin ]; then + echo_yellow "Merging VPD into recovery image firmware" + dd if=/tmp/vpd.bin bs=1 seek=$((0x00600000)) count=$((0x00004000)) of=/tmp/stock-firmware.rom conv=notrunc > /dev/null 2>&1 + fi fi firmware_file=/tmp/stock-firmware.rom fi @@ -410,7 +431,8 @@ ${flashromcmd} -w ${firmware_file} > /dev/null 2>&1 [[ $? -ne 0 ]] && { exit_red "An error occurred restoring the stock firmware. DO NOT REBOOT!"; return 1; } #all good echo_green "Stock firmware successfully restored." -echo_green "After rebooting, you will need to restore ChromeOS using the ChromeOS recovery media." +echo_green "After rebooting, you will need to restore ChromeOS using the ChromeOS recovery media, +then re-run this script to reset the Firmware Boot Flags (GBB Flags) to factory default." read -p "Press [Enter] to return to the main menu." } @@ -517,10 +539,10 @@ fi [[ -z "$1" ]] && legacy_text="Legacy Boot" || legacy_text="$1" -echo_green "\nSet Boot Options (GBB Flags)" +echo_green "\nSet Firmware Boot Options (GBB Flags)" echo_yellow "Select your preferred boot delay and default boot option. -You can always override the default using [CTRL-D] or -[CTRL-L] on the developer mode boot splash screen" +You can always override the default using [CTRL+D] or +[CTRL+L] on the Developer Mode boot screen" echo -e "1) Short boot delay (1s) + ${legacy_text} default 2) Long boot delay (30s) + ${legacy_text} default @@ -556,7 +578,7 @@ ${gbbutilitycmd} --set --flags="${_flags}" /tmp/gbb.temp > /dev/null [[ $? -ne 0 ]] && { exit_red "\nError setting boot options."; return 1; } ${flashromcmd} -w -i GBB:/tmp/gbb.temp > /dev/null 2>&1 [[ $? -ne 0 ]] && { exit_red "\nError writing back firmware; unable to set boot options."; return 1; } -echo_green "\nBoot options successfully set." +echo_green "\nFirmware Boot options successfully set." read -p "Press [Enter] to return to the main menu." } @@ -566,22 +588,22 @@ read -p "Press [Enter] to return to the main menu." ################### function set_hwid() { -# set hwid using gbb_utility +# set HWID using gbb_utility # ensure hardware write protect disabled if [[ "$isChromeOS" = true && "$(crossystem wpsw_cur)" != *"0"* ]]; then exit_red "\nWrite-protect enabled, non-stock firmware installed, or not running ChromeOS; cannot set HWID."; return 1 fi -echo_green "Set Hardware ID (hwid) using gbb_utility" +echo_green "Set Hardware ID (HWID) using gbb_utility" -#get current hwid +#get current HWID _hwid="$(crossystem hwid)" >/dev/null 2>&1 if [ $? -eq 0 ]; then - echo_yellow "Current hwid is $_hwid" + echo_yellow "Current HWID is $_hwid" fi -read -p "Enter a new hwid (use all caps): " hwid +read -p "Enter a new HWID (use all caps): " hwid echo -e "" -read -p "Confirm changing hwid to $hwid [y/N] " confirm +read -p "Confirm changing HWID to $hwid [y/N] " confirm if [[ "$confirm" = "Y" || "$confirm" = "y" ]]; then echo_yellow "\nSetting hardware ID..." #disable software write-protect @@ -592,9 +614,9 @@ if [[ "$confirm" = "Y" || "$confirm" = "y" ]]; then ${flashromcmd} -r -i GBB:/tmp/gbb.temp > /dev/null 2>&1 [[ $? -ne 0 ]] && { exit_red "\nError reading firmware (non-stock?); unable to set HWID."; return 1; } ${gbbutilitycmd} --set --hwid="${hwid}" /tmp/gbb.temp > /dev/null - [[ $? -ne 0 ]] && { exit_red "\nError setting hwid."; return 1; } + [[ $? -ne 0 ]] && { exit_red "\nError setting HWID."; return 1; } ${flashromcmd} -w -i GBB:/tmp/gbb.temp > /dev/null 2>&1 - [[ $? -ne 0 ]] && { exit_red "\nError writing back firmware; unable to set hwid."; return 1; } + [[ $? -ne 0 ]] && { exit_red "\nError writing back firmware; unable to set HWID."; return 1; } echo_green "Hardware ID successfully set." fi read -p "Press [Enter] to return to the main menu." @@ -634,8 +656,8 @@ fi cd /tmp #download SeaBIOS payload -curl -s -L -O ${dropbox_url}/${bootstub_payload_baytrail} -curl -s -L -O ${dropbox_url}/${bootstub_payload_baytrail}.md5 +curl -s -L -O ${bootstub_source}/${bootstub_payload_baytrail} +curl -s -L -O ${bootstub_source}/${bootstub_payload_baytrail}.md5 #verify checksum on downloaded file md5sum -c ${bootstub_payload_baytrail}.md5 --quiet > /dev/null 2>&1 @@ -666,9 +688,9 @@ fi #USB boot priority read -p "Default to booting from USB? If N, always boot from internal storage unless selected from boot menu. [y/N] " if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]]; then - curl -s -L -o bootorder ${dropbox_url}/bootorder.usb + curl -s -L -o bootorder ${cbfs_source}/bootorder.usb else - curl -s -L -o bootorder ${dropbox_url}/bootorder.hdd + curl -s -L -o bootorder ${cbfs_source}/bootorder.emmc fi @@ -684,21 +706,28 @@ ${cbfstoolcmd} boot_stub.bin remove -n etc/sdcard2 > /dev/null 2>&1 ${cbfstoolcmd} boot_stub.bin remove -n etc/sdcard3 > /dev/null 2>&1 ${cbfstoolcmd} boot_stub.bin remove -n etc/sdcard4 > /dev/null 2>&1 ${cbfstoolcmd} boot_stub.bin remove -n etc/sdcard5 > /dev/null 2>&1 +${cbfstoolcmd} boot_stub.bin remove -n etc/sdcard6 > /dev/null 2>&1 ${cbfstoolcmd} boot_stub.bin add-payload -n fallback/payload -f ${bootstub_payload_baytrail} -c lzma > /dev/null 2>&1 if [ $? -ne 0 ]; then exit_red "There was an error modifying the BOOT_STUB payload, nothing has been flashed."; return 1 else ${cbfstoolcmd} boot_stub.bin add -n bootorder -f bootorder -t raw > /dev/null 2>&1 ${cbfstoolcmd} boot_stub.bin add-int -i 3000 -n etc/boot-menu-wait > /dev/null 2>&1 - ${cbfstoolcmd} boot_stub.bin add-int -i 0xd071c000 -n etc/sdcard0 > /dev/null 2>&1 - ${cbfstoolcmd} boot_stub.bin add-int -i 0xd071d000 -n etc/sdcard1 > /dev/null 2>&1 - ${cbfstoolcmd} boot_stub.bin add-int -i 0xd071f000 -n etc/sdcard2 > /dev/null 2>&1 - ${cbfstoolcmd} boot_stub.bin add-int -i 0xd081f000 -n etc/sdcard3 > /dev/null 2>&1 - ${cbfstoolcmd} boot_stub.bin add-int -i 0xd091c000 -n etc/sdcard4 > /dev/null 2>&1 - ${cbfstoolcmd} boot_stub.bin add-int -i 0xd091f000 -n etc/sdcard5 > /dev/null 2>&1 + if [ "$emmcAddr" != "" ]; then + ${cbfstoolcmd} boot_stub.bin add-int -i ${emmcAddr} -n etc/sdcard0 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i ${sdcardAddr} -n etc/sdcard1 > /dev/null 2>&1 + else + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd071f000 -n etc/sdcard0 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd071d000 -n etc/sdcard1 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd071c000 -n etc/sdcard2 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd081f000 -n etc/sdcard3 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd081c000 -n etc/sdcard4 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd091f000 -n etc/sdcard5 > /dev/null 2>&1 + ${cbfstoolcmd} boot_stub.bin add-int -i 0xd091c000 -n etc/sdcard6 > /dev/null 2>&1 + fi #flash modified BOOT_STUB back - echo_yellow "Flashing modified BOOT_STUB" + echo_yellow "Flashing modified BOOT_STUB firmware" ${flashromcmd} -w -i BOOT_STUB:boot_stub.bin > /dev/null 2>&1 if [ $? -ne 0 ]; then @@ -707,7 +736,7 @@ else ${flashromcmd} -w -i BOOT_STUB:boot_stub.bin > /dev/null 2>&1 echo_red "There was an error flashing the modified BOOT_STUB, but the stock one has been restored." else - echo_green "Legacy boot capable BOOT_STUB successfully flashed" + echo_green "Legacy boot capable BOOT_STUB firmware successfully flashed" fi fi read -p "Press [Enter] to return to the main menu." @@ -725,17 +754,14 @@ function restore_boot_stub() # set GBB flags to ensure dev mode, legacy boot # offer RW_LEGACY update -#check baytrail -[[ "$isBaytrail" = false ]] && { exit_red "\nThis functionality is only available for Baytrail ChromeOS devices currently"; return 1; } #check OS [[ "$isChromeOS" = true ]] && { exit_red "\nThis functionality is not available under ChromeOS."; return 1; } echo_green "\nRestore stock BOOT_STUB from backup" -echo_yellow "Warning: this function is only intended for users who installed -a legacy boot capable BOOT_STUB via this script. If you installed -a different one (eg, John Lewis') then this will not work, and -could potentially brick your device." +echo_yellow "Standard disclaimer: flashing the firmware has the potential to +brick your device, requiring relatively inexpensive hardware and some +technical knowledge to recover. You have been warned." read -p "Do you wish to continue? [y/N] " [[ "$REPLY" = "Y" || "$REPLY" = "y" ]] || return @@ -761,14 +787,32 @@ dd if=rw_legacy.bin of=boot_stub.stock bs=1M count=1 > /dev/null 2>&1 #verify valid BOOT_STUB ${cbfstoolcmd} boot_stub.stock extract -n config -f config.${device} > /dev/null 2>&1 -[[ $? -ne 0 ]] && { exit_red "No valid BOOT_STUB backup found; unable to restore stock BOOT_STUB"; return 1; } +if [[ $? -ne 0 ]]; then + echo_yellow "No valid BOOT_STUB backup found; attempting to download/extract from a shellball ROM" + #download and extract from shellball ROM + curl -s -L -o /tmp/shellball.rom ${shellball_source}shellball.${device}.bin + if [[ $? -ne 0 ]]; then + exit_red "No valid BOOT_STUB backup found; error downloading shellball ROM; unable to restore stock BOOT_STUB." + return 1 + fi + ${cbfstoolcmd} shellball.rom read -r BOOT_STUB -f boot_stub.stock >/dev/null 2>&1 + if [ $? -ne 0 ]; then + exit_red "No valid BOOT_STUB backup found; error reading shellball ROM; unable to restore stock BOOT_STUB." + return 1 + fi + ${cbfstoolcmd} boot_stub.stock extract -n config -f config.${device} > /dev/null 2>&1 + if [[ $? -ne 0 ]]; then + exit_red "No BOOT_STUB backup available; unable to restore stock BOOT_STUB" + return 1 + fi +fi #verify valid for this device cat config.${device} | grep ${device} > /dev/null 2>&1 [[ $? -ne 0 ]] && { exit_red "No valid BOOT_STUB backup found; unable to restore stock BOOT_STUB"; return 1; } #restore stock BOOT_STUB -echo_yellow "\Restoring stock BOOT_STUB" +echo_yellow "Restoring stock BOOT_STUB" ${flashromcmd} -w -i BOOT_STUB:boot_stub.stock > /dev/null 2>&1 if [ $? -ne 0 ]; then #flash back non-stock BOOT_STUB @@ -800,39 +844,56 @@ read -p "Press [Enter] to return to the main menu." ######################## function menu_fwupdate() { clear - echo -e "${NORMAL}\n ChromeOS device Firmware Utility ${script_date} ${NORMAL}" + echo -e "${NORMAL}\n ChromeOS Firmware Utility 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}" echo -e "${MENU}*********************************************${NORMAL}" + echo -e "${MENU}**${NUMBER} System Info ${NORMAL}" + echo -e "${MENU}**${NORMAL} Device: ${deviceDesc}" + echo -e "${MENU}**${NORMAL} Board Name: ${device^^}" + echo -e "${MENU}**${NORMAL} CPU Type: $deviceCpuType" + echo -e "${MENU}**${NORMAL} Fw Type: $firmwareType" + echo -e "${MENU}*********************************************${NORMAL}" echo -e "${MENU}**${NORMAL}" - echo -e "${MENU}**${NUMBER} 1)${MENU} Install/Update Legacy BIOS in RW_LEGACY slot${NORMAL}" - if [ "$isBaytrail" = true ]; then - echo -e "${MENU}**${NUMBER} 2)${MENU} Install/Update Legacy BIOS in BOOT_STUB slot ${NORMAL}" + if [[ "$unlockMenu" = true || ( "$isFullRom" = false && "$isBootStub" = false ) ]]; then + echo -e "${MENU}**${NUMBER} 1)${MENU} Install/Update RW_LEGACY Firmware ${NORMAL}" else - echo -e "${GRAY_TEXT}**${GRAY_TEXT} 2)${GRAY_TEXT} Install/Update Legacy BIOS in BOOT_STUB slot ${NORMAL}" + echo -e "${GRAY_TEXT}**${GRAY_TEXT} 1)${GRAY_TEXT} Install/Update RW_LEGACY Firmware ${NORMAL}" fi - if [[ "$isBaytrail" = false || "$bayTrailHasFullROM" = "true" ]]; then + if [[ "$unlockMenu" = true || ( "$isFullRom" = false && "$isBaytrail" = true && "$bayTrailHasFullROM" = false ) ]]; then + echo -e "${MENU}**${NUMBER} 2)${MENU} Install/Update BOOT_STUB Firmware ${NORMAL}" + else + echo -e "${GRAY_TEXT}**${GRAY_TEXT} 2)${GRAY_TEXT} Install/Update BOOT_STUB Firmware ${NORMAL}" + fi + if [[ "$unlockMenu" = true || ( "$isBaytrail" = false || "$bayTrailHasFullROM" = "true" ) ]]; then echo -e "${MENU}**${NUMBER} 3)${MENU} Install/Update Custom coreboot Firmware (Full ROM) ${NORMAL}" else echo -e "${GRAY_TEXT}**${GRAY_TEXT} 3)${GRAY_TEXT} Install/Update Custom coreboot Firmware (Full ROM) ${NORMAL}" fi - echo -e "${MENU}**${NUMBER} 4)${MENU} Set Boot Options (GBB flags)${NORMAL}" - echo -e "${MENU}**${NUMBER} 5)${MENU} Set Hardware ID (hwid) ${NORMAL}" - if [[ "$isBaytrail" = true && "$isChromeOS" = false ]]; then - echo -e "${MENU}**${NUMBER} 6)${MENU} Restore Stock BOOT_STUB slot ${NORMAL}" + if [[ "$unlockMenu" = true || ( "$isFullRom" = false && "$isBootStub" = false ) ]]; then + echo -e "${MENU}**${NUMBER} 4)${MENU} Set Boot Options (GBB flags) ${NORMAL}" + echo -e "${MENU}**${NUMBER} 5)${MENU} Set Hardware ID (HWID) ${NORMAL}" else - echo -e "${GRAY_TEXT}**${GRAY_TEXT} 6)${GRAY_TEXT} Restore Stock BOOT_STUB slot ${NORMAL}" + echo -e "${GRAY_TEXT}**${GRAY_TEXT} 4)${GRAY_TEXT} Set Boot Options (GBB flags)${NORMAL}" + echo -e "${GRAY_TEXT}**${GRAY_TEXT} 5)${GRAY_TEXT} Set Hardware ID (HWID) ${NORMAL}" fi - if [[ "$isChromeOS" = false && ( "$isBaytrail" = false || "$bayTrailHasFullROM" = "true" ) ]]; then - echo -e "${MENU}**${NUMBER} 7)${MENU} Restore Stock Firmware ${NORMAL}" + if [[ "$unlockMenu" = true || ( "$isBaytrail" = true && "$isBootStub" = true && "$isChromeOS" = false ) ]]; then + echo -e "${MENU}**${NUMBER} 6)${MENU} Restore Stock BOOT_STUB ${NORMAL}" else - echo -e "${GRAY_TEXT}**${GRAY_TEXT} 7)${GRAY_TEXT} Restore Stock Firmware ${NORMAL}" + echo -e "${GRAY_TEXT}**${GRAY_TEXT} 6)${GRAY_TEXT} Restore Stock BOOT_STUB ${NORMAL}" + fi + if [[ "$unlockMenu" = true || ( "$isChromeOS" = false && "$isFullRom" = true ) ]]; then + echo -e "${MENU}**${NUMBER} 7)${MENU} Restore Stock Firmware (full) ${NORMAL}" + else + echo -e "${GRAY_TEXT}**${GRAY_TEXT} 7)${GRAY_TEXT} Restore Stock Firmware (full) ${NORMAL}" fi echo -e "${MENU}**${NORMAL}" echo -e "${MENU}**${NUMBER} 8)${NORMAL} Reboot ${NORMAL}" echo -e "${MENU}**${NUMBER} 9)${NORMAL} Power Off ${NORMAL}" + echo -e "${MENU}**${NORMAL}" + echo -e "${MENU}**${NUMBER} U)${NORMAL} Unlock Disabled Functions ${NORMAL}" echo -e "${MENU}*********************************************${NORMAL}" - echo -e "${ENTER_LINE}Select a menu option or ${RED_TEXT}q to quit${NORMAL}" + echo -e "${ENTER_LINE}Select a menu option or ${RED_TEXT}q to quit ${NORMAL}" read opt @@ -841,78 +902,85 @@ function menu_fwupdate() { if [[ $opt = "q" ]]; then exit; else - if [ "$isBaytrail" = true ]; then - case $opt in - 2) modify_boot_stub; - menu_fwupdate; - ;; - esac - if [ "$isChromeOS" = false ]; then - case $opt in - 6) restore_boot_stub; - menu_fwupdate; - ;; - esac - fi - if [[ "$bayTrailHasFullROM" = "true" ]]; then - case $opt in - 3) flash_coreboot; - menu_fwupdate; - ;; - esac - if [ "$isChromeOS" = false ]; then - case $opt in - 7) restore_stock_firmware; - menu_fwupdate; - ;; - esac - fi - fi - else - case $opt in - 3) flash_coreboot; - menu_fwupdate; - ;; - esac - if [ "$isChromeOS" = false ]; then - case $opt in - 7) restore_stock_firmware; - menu_fwupdate; - ;; - esac - fi - fi - #options always available case $opt in + + 1) if [[ "$unlockMenu" = true || "$isChromeOS" = true || "$isFullRom" = false \ + && "$isBootStub" = false ]]; then + update_rwlegacy + fi + menu_fwupdate + ;; + + 2) if [[ "$unlockMenu" = true || "$isBaytrail" = true && "$bayTrailHasFullROM" = false ]]; then + modify_boot_stub + fi + menu_fwupdate + ;; + + 3) if [[ "$unlockMenu" = true || ( "$isUnsupported" = false && "$isBaytrail" = false ) \ + || ( "$isBaytrail" = true && "$bayTrailHasFullROM" = true ) ]]; then + flash_coreboot + fi + menu_fwupdate + ;; + + 4) if [[ "$unlockMenu" = true || "$isChromeOS" = true || "$isUnsupported" = false \ + && "$isFullRom" = false && "$isBootStub" = false ]]; then + set_boot_options + fi + menu_fwupdate + ;; + + 5) if [[ "$unlockMenu" = true || "$isChromeOS" = true || "$isUnsupported" = false \ + && "$isFullRom" = false && "$isBootStub" = false ]]; then + set_hwid + fi + menu_fwupdate + ;; - 1) update_rwlegacy; - menu_fwupdate; + 6) if [[ "$unlockMenu" = true || "$isBootStub" = true ]]; then + restore_boot_stub + fi + menu_fwupdate + ;; + + 7) if [[ "$unlockMenu" = true || "$isChromeOS" = false && "$isUnsupported" = false \ + && "$isFullRom" = true ]]; then + restore_stock_firmware + fi + menu_fwupdate ;; - 4) set_boot_options; - menu_fwupdate; - ;; - 5) set_hwid; - menu_fwupdate; - ;; + 8) echo -e "\nRebooting...\n"; cleanup; reboot; exit; ;; + 9) echo -e "\nPowering off...\n"; cleanup; poweroff; exit; ;; + q) cleanup; exit; ;; + + u) if [ "$unlockMenu" = false ]; then + echo_yellow "\nAre you sure you wish to unlock all menu functions?" + read -p "Only do this if you really know what you are doing... [y/N]? " + [[ "$REPLY" = "y" || "$REPLY" = "Y" ]] && unlockMenu=true + fi + menu_fwupdate + ;; \n) cleanup; exit; ;; + *) clear; menu_fwupdate; - ;; + ;; esac fi done diff --git a/functions.sh b/functions.sh index 1f156c2..ca40adc 100644 --- a/functions.sh +++ b/functions.sh @@ -20,15 +20,28 @@ isBdwBox=false isHswBook=false isBdwBook=false isBaytrail=false +isBraswell=false +isSkylake=false +isUnsupported=false bayTrailHasFullROM=false +firmwareType="" +isStock=true +isFullRom=false +isBootStub=false +hasRwLegacy=false +unlockMenu=false +hasShellball=false -hsw_boxes=('' '' '' ''); -hsw_books=('' '' '' '' ''); +hsw_boxes=('' '' '' '' ''); +hsw_books=('' '' '' ''); bdw_boxes=('' '' ''); bdw_books=('' '' '' '' ''); -baytrail=('' '' '' '' '' '' '' '' '' '' '' '' '' '' ''); -baytrail_full_rom=(''); - +baytrail=('' '' '' '' '' '' '' '' '' '' '' '' '' '' ''); +baytrail_full_rom=('' '' '' '' '' ''); +braswell=('' '' '' '' '' ''); +skylake=(''); + +shellballs=($(printf "%s %s %s %s %s " "${hsw_boxes[@]}" "${hsw_books[@]}" "${bdw_boxes[@]}" "${bdw_books[@]}" "${baytrail[@]}")); #menu text output NORMAL=$(echo "\033[m") @@ -137,7 +150,7 @@ if [ ! -f ${cbfstoolcmd} ]; then fi #echo_yellow "Downloading cbfstool utility" - curl -s -L -O "${dropbox_url}"/cbfstool.tar.gz + curl -s -L -O "${util_source}"/cbfstool.tar.gz if [ $? -ne 0 ]; then echo_red "Error downloading cbfstool; cannot proceed." #restore working dir @@ -169,7 +182,7 @@ if [ ! -f ${flashromcmd} ]; then working_dir=`pwd` cd /tmp - curl -s -L -O "${dropbox_url}"/flashrom.tar.gz + curl -s -L -O "${util_source}"/flashrom.tar.gz if [ $? -ne 0 ]; then echo_red "Error downloading flashrom; cannot proceed." #restore working dir @@ -201,7 +214,7 @@ if [ ! -f ${gbbutilitycmd} ]; then working_dir=`pwd` cd /tmp - curl -s -L -O "${dropbox_url}"/gbb_utility.tar.gz + curl -s -L -O "${util_source}"/gbb_utility.tar.gz if [ $? -ne 0 ]; then echo_red "Error downloading gbb_utility; cannot proceed." #restore working dir @@ -263,7 +276,12 @@ fi [[ "${hsw_books[@]}" =~ "$device" ]] && isHswBook=true [[ "${bdw_books[@]}" =~ "$device" ]] && isBdwBook=true [[ "${baytrail[@]}" =~ "$device" ]] && isBaytrail=true +[[ "${braswell[@]}" =~ "$device" ]] && isBraswell=true +[[ "${skylake[@]}" =~ "$device" ]] && isSkylake=true [[ "${baytrail_full_rom[@]}" =~ "$device" ]] && bayTrailHasFullROM=true +[[ "${shellballs[@]}" =~ "$device" ]] && hasShellball=true +[[ "$isHswBox" = true || "$isBdwBox" = true || "$isHswBook" = true || "$isBdwBook" = true || "$isBaytrail" = true \ + || "$isBraswell" = true || "$isSkylake" = true || "$device" = "stumpy" ]] || isUnsupported=true #check if running under ChromeOS / ChromiumOS if [ -f /etc/lsb-release ]; then @@ -314,6 +332,173 @@ if [ $? -ne 0 ]; then return 1 fi +#get device firmware info +echo -e "\nGetting device/system info..." +#read entire firmware +${flashromcmd} -r /tmp/bios.bin > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo_red "Failure reading current firmware; cannot proceed." + return 1; +fi +#break out BOOT_STUB and RW_LEGACY pieces, check for validity +${cbfstoolcmd} bios.bin read -r BOOT_STUB -f bs.tmp >/dev/null 2>&1 +if [ $? -ne 0 ]; then + #non-stock firmware + isStock=false + isFullRom=true +else + #see if BOOT_STUB is stock + ${cbfstoolcmd} bs.tmp extract -n fallback/vboot -f vb.tmp -m x86 >/dev/null 2>&1 + [[ $? -ne 0 ]] && isBootStub=true + #check RW_LEGACY + ${cbfstoolcmd} bios.bin read -r RW_LEGACY -f rwl.tmp >/dev/null 2>&1 + [[ $? -eq 0 ]] && hasRwLegacy=true +fi +#set firmware type +if [[ "$isChromeOS" = true && "$isStock" = true && "$isBootStub" = false ]]; then + firmwareType="Stock ChromeOS" +elif [[ "$isBootStub" = true ]]; then + firmwareType="Stock w/modified BOOT_STUB" +elif [[ "$isFullRom" = true ]]; then + #get more info + fwVer=$(dmidecode -s bios-version) + fwDate=$(dmidecode -s bios-release-date) + firmwareType="Full ROM ($fwVer $fwDate)" +elif [[ "$isChromeOS" = false && "$hasRwLegacy" = true ]]; then + firmwareType="Stock w/modified RW_LEGACY" +elif [[ "$isChromeOS" = true && "$isBaytrail" = true && "$hasRwLegacy" = true ]]; then + firmwareType="Stock w/modified RW_LEGACY" +fi + +#get full device info +[ "$isChromeOS" = true ] && _hwid=$(crossystem hwid) || _hwid=${device^^} +case "${_hwid}" in + #TBD*) _x='...|Dell 11P' ;; + ACER_ZGB*) _x='PNV|Acer AC700 Chromebook||' ;; + ARKHAM*) _x='ARM|ASUS OnHub SRT-AC1900 Router||' ;; + AURON_PAINE*) _x='BDW|Acer Chromebook 11 (C740)||' ;; + AURON_YUNA*) _x='BDW|Acer Chromebook 15 (CB5-571, C910)||' ;; + BANJO*) _x='BYT|Acer Chromebook 15 (CB3-531)||' ;; + BIG*) _x='ARM|Acer Chromebook 13 (CB5-311)||' ;; + BLAZE*) _x='ARM|HP Chromebook 14 G3||' ;; + BUDDY*) _x='BDW|Acer Chromebase 24||' ;; + BUTTERFLY*) _x='SDB|HP Pavilion Chromebook 14||' ;; + CANDY*) _x='BYT|Dell Chromebook 11||' ;; + CELES*) _x='BSW|Samsung Chromebook 3||' ;; + CHELL*) _x='SKL|HP Chromebook 13 G1||' ;; + CLAPPER*) _x='BYT|Lenovo N20/N20P Chromebook||' ;; + CYAN*) _x='BSW|OriginsT / Acer Chromebook R11 (C738T)||' ;; + EDGAR*) _x='BSW|Acer Chromebook 14 (CB3-431)||' ;; + ENGUARDE_???-???-??A*) _x='BYT|CTL N6 Education Chromebook||' ;; + ENGUARDE_???-???-??B*) _x='BYT|M&A Chromebook||' ;; + ENGUARDE_???-???-??C*) _x='BYT|Senkatel C1101 Chromebook||' ;; + ENGUARDE_???-???-??D*) _x='BYT|Edxis Education Chromebook||' ;; + ENGUARDE_???-???-??E*) _x='BYT|Lenovo N21 Chromebook||' ;; + ENGUARDE_???-???-??F*) _x='BYT|RGS Education Chromebook||' ;; + ENGUARDE_???-???-??G*) _x='BYT|Crambo Chromebook||' ;; + ENGUARDE_???-???-??H*) _x='BYT|True IDC Chromebook||' ;; + ENGUARDE_???-???-??I*) _x='BYT|Videonet Chromebook||' ;; + ENGUARDE_???-???-??J*) _x='BYT|eduGear Chromebook R||' ;; + ENGUARDE_???-???-??K*) _x='BYT|ASI Chromebook||' ;; + ENGUARDE*) _x='BYT|201x|(unknown ENGUARDE)||' ;; + EXPRESSO_???-???-??A*) _x='ARM|HEXA Chromebook Pi||' ;; + EXPRESSO_???-???-??B*) _x='ARM|Bobicus Chromebook 11||' ;; + EXPRESSO_???-???-??C*) _x='ARM|Edxis Chromebook||' ;; + EXPRESSO*) _x='ARM|201x|(unknown EXPRESSO)||' ;; + FALCO*) _x='HSW|HP Chromebook 14||' ;; + GANDOF*) _x='BDW|Toshiba Chromebook 2 CB30/CB35||' ;; + GLIMMER*) _x='BYT|Lenovo ThinkPad 11e/Yoga Chromebook||' ;; + GNAWTY_???-???-??B*) _x='BYT|Acer Chromebook 11/Olay (C735)|0xd091f000|0xd091c000' ;; + GNAWTY_???-???-??A*) _x='BYT|Acer Chromebook 11 (CB3-111,C730,C730E)|0xd091f000|0xd091c000' ;; + GNAWTY_???-???-???) _x='BYT|Acer Chromebook 11 (CB3-111,C730,C730E)|0xd091f000|0xd091c000' ;; + GNAWTY*) _x='BYT|Acer Chromebook 11 (CB3-111/131,C730/C730E/C735)|0xd091f000|0xd091c000' ;; + GUADO*) _x='BDW|ASUS Chromebox CN62||' ;; + HELI*) _x='BYT|Haier Chromebook G2||' ;; + IEC_MARIO) _x='PNV|Google Cr-48||' ;; + JAQ_???-???-???-A*) _x='ARM|Haier Chromebook 11||' ;; + JAQ_???-???-???-B*) _x='ARM|True IDC Chromebook 11||' ;; + JAQ_???-???-???-C*) _x='ARM|Xolo Chromebook||' ;; + JAQ_???-???-???-D*) _x='ARM|Medion Akoya S2013 Chromebook||' ;; + JAQ*) _x='ARM|(unknown JAQ)||' ;; + JERRY_???-???-???-A*) _x='ARM|HiSense Chromebook 11||' ;; + JERRY_???-???-???-B*) _x='ARM|CTL J2/J4 Chromebook for Education||' ;; + JERRY_???-???-???-C*) _x='ARM|Poin2 Chromebook 11||' ;; + JERRY_???-???-???-D*) _x='ARM|eduGear Chromebook K Series||' ;; + JERRY_???-???-???-E*) _x='ARM|NComputing Chromebook CX100||' ;; + JERRY*) _x='ARM|201x|(unknown JERRY)||' ;; + KIP*) _x='BYT|HP Chromebook 11 G3/G4||' ;; + KITTY*) _x='ARM|Acer Chromebase' ;; + LEON*) _x='HSW|Toshiba CB30/CB35 Chromebook||' ;; + LINK*) _x='IVB|Google Chromebook Pixel||' ;; + LULU*) _x='BDW|Dell Chromebook 13 7310||' ;; + LUMPY*) _x='SDB|Samsung Chromebook Series 5 550||' ;; + MCCLOUD*) _x='HSW|Acer Chromebox CXI||' ;; + MICKEY*) _x='ARM|ASUS Chromebit CS10||' ;; + MIGHTY_???-???-???-A*) _x='ARM|Haier Chromebook 11e||' ;; + MIGHTY_???-???-???-B*) _x='ARM|Nexian Chromebook||' ;; + MIGHTY_???-???-???-D*) _x='ARM|eduGear Chromebook M Series||' ;; + MIGHTY_???-???-???-E*) _x='ARM|Sector 5 E1 Rugged Chromebook||' ;; + MIGHTY_???-???-???-F*) _x='ARM|Viglen Chromebook 11||' ;; + MIGHTY_???-???-???-G*) _x='ARM|PCmerge Chromebook PCM-116E||' ;; + MIGHTY_???-???-???-H*) _x='ARM|Lumos Education Chromebook||' ;; + MIGHTY_???-???-???-I*) _x='ARM|MEDION Chromebook S2015||' ;; + MIGHTY*) _x='ARM|(unknown MIGHTY)||' ;; + MINNIE*) _x='ARM|ASUS Chromebook Flip C100PA||' ;; + MONROE*) _x='HSW|LG Chromebase||' ;; + NINJA*) _x='BYT|AOpen Chromebox Commercial|0xd081f000|0xd081c000' ;; + ORCO*) _x='BYT|Lenovo Ideapad 100S Chromebook||' ;; + PAINE*) _x='BDW|Acer Chromebook 11 (C740)||' ;; + PANTHER*) _x='HSW|ASUS Chromebox CN60||' ;; + PARROT*) _x='SDB|Acer C7 / C710 Chromebook||' ;; + PEPPY*) _x='HSW|Acer C720, C720P Chromebook||' ;; + PIT*) _x='ARM|Samsung Chromebook 2 (XE503C12)||' ;; + PI*) _x='ARM|Samsung Chromebook 2 (XE503C32)||' ;; + QUAWKS*) _x='BYT|ASUS Chromebook C300||' ;; + REKS*) _x='BSW|Lenovo N22 Chromebook||' ;; + RIKKU*) _x='BDW|Acer Chromebox CXI2||' ;; + SAMS_ALEX*) _x='PNV|Samsung Chromebook Series 5||' ;; + SAMUS*) _x='BDW|Google Chromebook Pixel||' ;; + SKATE*) _x='ARM|HP Chromebook 11 G2||' ;; + SNOW*) _x='ARM|Samsung Chromebook||' ;; + SPEEDY*) _x='ARM|ASUS Chromebook C201||' ;; + SPRING*) _x='ARM|HP Chromebook 11 G1||' ;; + SQUAWKS*) _x='BYT|ASUS Chromebook C200||' ;; + STOUT*) _x='IVB|Lenovo Thinkpad X131e Chromebook||' ;; + STUMPY*) _x='SDB|Samsung Chromebox Series 3||' ;; + SUMO*) _x='BYT|AOpen Chromebase Commercial||' ;; + SWANKY*) _x='BYT|Toshiba Chromebook 2 CB30/CB35|0xd071f000|0xd071c000' ;; + TERRA13*) _x='BSW|ASUS Chromebook C300SA||' ;; + TERRA*) _x='BSW|ASUS Chromebook C202SA||' ;; + TIDUS*) _x='BDW|Lenovo ThinkCentre Chromebox||' ;; + TRICKY*) _x='HSW|Dell Chromebox||' ;; + ULTIMA*) _x='BSW|Lenovo ThinkPad 11e/Yoga Chromebook (G3)||' ;; + WHIRLWIND*) _x='ARM|TP-Link OnHub TGR1900 Router||' ;; + WINKY*) _x='BYT|Samsung Chromebook 2 (XE500C12)||' ;; + WOLF*) _x='HSW|Dell Chromebook 11||' ;; + YUNA*) _x='BDW|Acer Chromebook 15 (CB5-571, C910)||' ;; + ZAKO*) _x='HSW|HP Chromebox CB1/G1/for Meetings||' ;; + #*) _='|||' ;; +esac + +deviceCpuType=`echo $_x | cut -d\| -f1` +deviceDesc=`echo $_x | cut -d\| -f2` +emmcAddr=`echo $_x | cut -d\| -f3` +sdcardAddr=`echo $_x | cut -d\| -f4-` + +## CPU family, Processor core, other distinguishing characteristic +case "$deviceCpuType" in +ARM) deviceCpuType="ARM" ;; +PNV) deviceCpuType="Intel Pineview" ;; +SDB) deviceCpuType="Intel SandyBridge" ;; +IVB) deviceCpuType="Intel IvyBridge" ;; +HSW) deviceCpuType="Intel Haswell" ;; +BYT) deviceCpuType="Intel BayTrail" ;; +BDW) deviceCpuType="Intel Broadwell" ;; +BSW) deviceCpuType="Intel Braswell" ;; +SKL) deviceCpuType="Intel Skylake" ;; +#*) deviceCpuType="(unrecognized)" ;; +esac + return 0 } diff --git a/kodi.sh b/kodi.sh index 3ec116b..6939d35 100644 --- a/kodi.sh +++ b/kodi.sh @@ -214,7 +214,7 @@ echo_yellow "\nPartitions formatted and mounted" echo_yellow "Updating bootloader" #get/extract syslinux -tar_file="${dropbox_url}syslinux-5.10-md.tar.bz2" +tar_file="${util_source}syslinux-5.10-md.tar.bz2" curl -s -L -o /tmp/Storage/syslinux.tar.bz2 $tar_file if [ $? -ne 0 ]; then LE_install_error "Failed to download syslinux; check your Internet connection and try again" @@ -280,12 +280,7 @@ tar_url="${LE_url}${tar_file}" cd /tmp/Storage curl -L -o $tar_file $tar_url if [ $? -ne 0 ]; then - echo_yellow "Failed to download LibreELEC; trying dropbox mirror" - tar_url="${dropbox_url}${tar_file}" - wget -O $tar_file $tar_url - if [ $? -ne 0 ]; then - LE_install_error "Failed to download LibreELEC; check your Internet connection and try again" - fi + LE_install_error "Failed to download LibreELEC; check your Internet connection and try again" fi echo_yellow "\nLibreELEC download complete; installing..." tar -xpf $tar_file @@ -513,7 +508,7 @@ fi echo_yellow "Partitions formatted and mounted; installing bootloader" #get/extract syslinux -tar_file="${dropbox_url}syslinux-5.10-md.tar.bz2" +tar_file="${util_source}syslinux-5.10-md.tar.bz2" curl -s -L -o /tmp/Storage/syslinux.tar.bz2 $tar_file > /dev/null 2>&1 if [ $? -ne 0 ]; then LE_install_error "Failed to download syslinux; check your Internet connection and try again" @@ -546,12 +541,7 @@ tar_url="${LE_url}${tar_file}" cd /tmp/Storage curl -L -o $tar_file $tar_url if [ $? -ne 0 ]; then - echo_yellow "Failed to download LibreELEC; trying dropbox mirror" - tar_url="${dropbox_url}${tar_file}" - curl -L -o $tar_file $tar_url - if [ $? -ne 0 ]; then - LE_install_error "Failed to download LibreELEC; check your Internet connection and try again" - fi + LE_install_error "Failed to download LibreELEC; check your Internet connection and try again" fi echo_yellow "\nLibreELEC download complete; installing..." tar -xpf $tar_file diff --git a/setup-firmware.sh b/setup-firmware.sh index 1afe991..3dd69f6 100644 --- a/setup-firmware.sh +++ b/setup-firmware.sh @@ -5,7 +5,7 @@ # a custom coreboot firmware for supported # ChromeOS devices # -# Created by Matt Devo +# Created by Mr.Chromebox # # May be freely distributed and modified as needed, # as long as proper attribution is given. @@ -13,7 +13,6 @@ #where the stuff is script_url="https://raw.githubusercontent.com/MattDevo/scripts/master/" -dropbox_url="https://dl.dropboxusercontent.com/u/98309225/" #set working dir cd /tmp diff --git a/setup-kodi.sh b/setup-kodi.sh index 3397601..616afc1 100644 --- a/setup-kodi.sh +++ b/setup-kodi.sh @@ -1,10 +1,10 @@ #!/bin/bash # -# This script will prep Haswell/Broadwell-based +# This script will prep supported # ChromeOS devices for Kodi installation via -# OpenELEC or Ubuntu/Kodibuntu +# LibreELEC or GalliumOS/Ubuntu # -# Created by Matt Devo +# Created by Mr.Chromebox # # May be freely distributed and modified as needed, # as long as proper attribution is given. @@ -12,7 +12,6 @@ #where the stuff is script_url="https://raw.githubusercontent.com/MattDevo/scripts/master/" -dropbox_url="https://dl.dropboxusercontent.com/u/98309225/" #set working dir cd /tmp diff --git a/sources.sh b/sources.sh index 4694b54..40f7889 100644 --- a/sources.sh +++ b/sources.sh @@ -3,11 +3,16 @@ #define these here for easy updating -script_date="[2016-07-14]" +script_date="[2016-07-19]" #where the stuff is -firmware_source_main="https://dl.dropboxusercontent.com/u/98309225/" -firmware_source_coolstar="https://dl.dropboxusercontent.com/u/59964215/chromebook/ROM/" +util_source="https://www.mrchromebox.tech/files/util/" +rwlegacy_source="https://www.mrchromebox.tech/files/firmware/rw_legacy/" +bootstub_source="https://www.mrchromebox.tech/files/firmware/boot_stub/" +fullrom_source="https://www.mrchromebox.tech/files/firmware/full_rom/" +fullrom_source_coolstar="https://dl.dropboxusercontent.com/u/59964215/chromebook/ROM/" +shellball_source="https://www.mrchromebox.tech/files/firmware/shellball/" +cbfs_source="https://www.mrchromebox.tech/files/firmware/cbfs/" #LE sources LE_url_official="http://releases.libreelec.tv/" @@ -21,21 +26,20 @@ LE_version_stable="7.0.2" LE_version_latest="7.90.003" #SBIB full ROMs -coreboot_stumpy="coreboot-seabios-stumpy-mattdevo-20160623.rom" +coreboot_stumpy="coreboot-seabios-stumpy-mrchromebox-20160719.rom" #Haswell full ROMs -coreboot_hsw_box="coreboot-seabios-hsw_chromebox-mattdevo-20160623.rom" +coreboot_hsw_box="coreboot-seabios-panther-mrchromebox-20160719.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" -coreboot_monroe="coreboot-seabios-monroe-20160108-coolstar.rom" #Broadwell full ROMs -coreboot_guado="coreboot-seabios-guado-mattdevo-20160623.rom" -coreboot_rikku="coreboot-seabios-rikku-mattdevo-20160623.rom" -coreboot_tidus="coreboot-seabios-tidus-mattdevo-20160623.rom" +coreboot_guado="coreboot-seabios-guado-mrchromebox-20160719.rom" +coreboot_rikku="coreboot-seabios-rikku-mrchromebox-20160719.rom" +coreboot_tidus="coreboot-seabios-tidus-mrchromebox-20160719.rom" coreboot_auron_paine="coreboot-seabios-auron-20160109-coolstar.rom" coreboot_auron_yuna=${coreboot_auron_paine} coreboot_gandof="coreboot-seabios-gandof-20160309-coolstar.rom" @@ -43,16 +47,22 @@ coreboot_lulu="coreboot-seabios-lulu-20160311-coolstar.rom" coreboot_samus="coreboot-seabios-samus-20160324-coolstar.rom" #BayTrail full ROMs -coreboot_ninja="coreboot-seabios-ninja-mattdevo-20160710.rom" +coreboot_enguarde="coreboot-seabios-enguarde-mrchromebox-20160719.rom" +coreboot_glimmer="coreboot-seabios-glimmer-mrchromebox-20160719.rom" +coreboot_gnawty="coreboot-seabios-gnawty-mrchromebox-20160719.rom" +coreboot_ninja="coreboot-seabios-ninja-mrchromebox-20160719.rom" +coreboot_quawks="coreboot-seabios-quawks-mrchromebox-20160719.rom" +coreboot_swanky="coreboot-seabios-swanky-mrchromebox-20160719.rom" + #RW_LEGACY payloads -seabios_hswbdw_box="seabios-hswbdw-box-mattdevo-20160704.bin" -seabios_hsw_book="seabios-hsw-book-mattdevo-20160704.bin" -seabios_bdw_book="seabios-bdw-book-mattdevo-20160704.bin" -seabios_baytrail="seabios-byt-mattdevo-20160704.bin" +seabios_hswbdw_box="seabios-hswbdw-box-mrchromebox-20160719.bin" +seabios_hsw_book="seabios-hsw-book-mrchromebox-20160719.bin" +seabios_bdw_book="seabios-bdw-book-mrchromebox-20160719.bin" +seabios_baytrail="seabios-byt-mrchromebox-20160719.bin" #BOOT_STUB payload -bootstub_payload_baytrail="seabios-byt-bootstub-mattdevo-20160704.bin" +bootstub_payload_baytrail="seabios-byt-bootstub-mrchromebox-20160719.bin" #hsw/bdw headless VBIOS hswbdw_headless_vbios="hswbdw_vgabios_1040_cbox_headless.dat"