mirror of
https://github.com/Dasharo/scripts.git
synced 2026-03-06 14:51:26 -08:00
Initial migration from dropbox/google drive
This commit is contained in:
23
README.md
23
README.md
@@ -1,2 +1,25 @@
|
||||
# scripts
|
||||
Scripts for setup/install/firmware update for ChromeOS devices
|
||||
|
||||
setup-kodi.sh facilitates the installation of Kodi on supported ChromeOS devices.
|
||||
|
||||
It allows the user to install a dual-boot setup with either OpenELEC or Ubuntu
|
||||
(with or without Kodi), to set the default OS, and to set the boot timeout on the
|
||||
developer mode splash screen. It also provides for the installation of an updated
|
||||
Legacy BIOS for devices that need it.
|
||||
|
||||
The script also allows the user to flash custom firmware, turning a ChromeBox into a regular PC,
|
||||
and provides for the creation of installation media for OpenELEC and a custom build of
|
||||
KodiBuntu (optimized for Haswell-based ChromeOS devices), though any off-the-shelf OS can be
|
||||
installed (including Windows 8/8.1/10).
|
||||
|
||||
setup-kodi.sh will run on any system with a full bash shell, though the dual-boot related functions
|
||||
are restricted to ChromeOS.
|
||||
|
||||
|
||||
setup-firmware.sh is a slimmed-down version of the above, without the kodi-related parts, and has
|
||||
the same requirements/restrictions as well.
|
||||
|
||||
|
||||
cbox-firmware-update.sh exists solely to update the custom firmware on Haswell ChromeBoxes running
|
||||
OpenELEC, which cannot run the above scripts due to lack of a full Bash shell.
|
||||
175
cbox-firmware-update.sh
Normal file
175
cbox-firmware-update.sh
Normal file
@@ -0,0 +1,175 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script will install/update the custom coreboot
|
||||
# firmware on a Haswell-based Asus/HP/Acer/Dell ChromeBox
|
||||
#
|
||||
# Created by Matt DeVillier <matt.devillier@gmail.com>
|
||||
#
|
||||
# May be freely distributed and modified as needed,
|
||||
# as long as proper attribution is given.
|
||||
#
|
||||
|
||||
#globals
|
||||
dropbox_url="https://dl.dropboxusercontent.com/u/98309225/"
|
||||
flashromcmd="/tmp/flashrom"
|
||||
cbfstoolcmd="/tmp/cbfstool"
|
||||
preferUSB=false
|
||||
|
||||
# Must run as root
|
||||
if [ $(whoami) != "root" ]; then
|
||||
echo -e "You need to run this script as root; use 'sudo bash <script name>'"
|
||||
exit
|
||||
fi
|
||||
|
||||
#header
|
||||
echo -e "\nChromeBox Firmware Updater v1.2"
|
||||
echo -e "(c) Matt DeVillier <matt.devillier@gmail.com>"
|
||||
echo -e "$***************************************************"
|
||||
|
||||
#show warning
|
||||
echo -e "\n!! WARNING !!
|
||||
This firmware is only valid for a Haswell-based Asus/HP/Acer/Dell
|
||||
ChromeBox with Celeron 2955U/2957U, Core i3-4010U, Core i7-4600U CPUs
|
||||
which is already running my custom coreboot firmware.
|
||||
Use on any other device will almost certainly brick it.\n"
|
||||
|
||||
read -p "Do you wish to continue? [y/N] "
|
||||
[ "$REPLY" == "y" ] || exit
|
||||
|
||||
working_dir=`pwd`
|
||||
cd /tmp
|
||||
|
||||
#check if update needed
|
||||
echo -e "\nChecking if update available...\n"
|
||||
curl -s -L -O ${dropbox_url}/latest.version
|
||||
if [[ $? -ne 0 || ! -f latest.version ]]; then
|
||||
echo -e "Error downloading firmware version information; cannot proceed."
|
||||
#restore working dir
|
||||
cd ${working_dir}
|
||||
exit
|
||||
fi
|
||||
curr_fw=$(echo `dmesg | grep -m1 "DMI: Google Panther" | awk '{print $NF}'` | awk -F'/' '{print $3$1$2}')
|
||||
if [ "$curr_fw" == "" ]; then
|
||||
curr_fw=$(echo `dmesg | grep -m1 "Panther, BIOS" | awk '{print $NF}'` | awk -F'/' '{print $3$1$2}')
|
||||
if [ "$curr_fw" == "" ]; then
|
||||
echo -e "Error: unable to determine current firmware version; aborting."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
latest_fw=`cat latest.version | awk '{print $1}'`
|
||||
coreboot_file=`cat latest.version | awk '{print $2}'`
|
||||
|
||||
if [ "$curr_fw" -ge "$latest_fw" ]; then
|
||||
echo -e "You already have the latest firmware ($latest_fw)"
|
||||
read -p "Would you like to install anyway? [y/N] "
|
||||
if [[ "$REPLY" != "y" && "$REPLY" != "Y" ]]; then
|
||||
exit
|
||||
fi
|
||||
else
|
||||
echo -e "Firmware update available ($latest_fw)"
|
||||
fi
|
||||
|
||||
#headless?
|
||||
echo -e "\nInstall \"headless\" firmware? This is only needed for servers"
|
||||
read -p "running without a connected display. [y/N] "
|
||||
if [[ "$REPLY" == "y" || "$REPLY" == "Y" ]]; then
|
||||
coreboot_file=`cat latest.version | awk '{print $3}'`
|
||||
fi
|
||||
|
||||
#USB boot priority
|
||||
echo -e ""
|
||||
read -p "Default to booting from any connected USB device? If N, always boot from the internal SSD unless selected from boot menu. [y/N] "
|
||||
if [[ "$REPLY" == "y" || "$REPLY" == "Y" ]]; then
|
||||
preferUSB=true
|
||||
fi
|
||||
|
||||
#check for/get flashrom
|
||||
if [ ! -f ${flashromcmd} ]; then
|
||||
echo -e "\nDownloading flashrom utility"
|
||||
curl -s -L -O ${dropbox_url}/flashrom.tar.gz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Error downloading flashrom; cannot proceed."
|
||||
#restore working dir
|
||||
cd ${working_dir}
|
||||
exit
|
||||
fi
|
||||
tar -zxf flashrom.tar.gz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Error extracting flashrom; cannot proceed."
|
||||
#restore working dir
|
||||
cd ${working_dir}
|
||||
exit
|
||||
fi
|
||||
#set +x
|
||||
chmod +x ./flashrom
|
||||
fi
|
||||
|
||||
#check for/get cbfstool
|
||||
if [ ! -f ${cbfstoolcmd} ]; then
|
||||
echo -e "\nDownloading cbfstool utility"
|
||||
curl -s -L -O ${dropbox_url}/cbfstool.tar.gz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Error downloading cbfstool; cannot proceed."
|
||||
#restore working dir
|
||||
cd ${working_dir}
|
||||
exit
|
||||
fi
|
||||
tar -zxf cbfstool.tar.gz
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Error extracting cbfstool; cannot proceed."
|
||||
#restore working dir
|
||||
cd ${working_dir}
|
||||
exit
|
||||
fi
|
||||
#set +x
|
||||
chmod +x ./cbfstool
|
||||
fi
|
||||
|
||||
#read existing firmware and try to extract MAC address info
|
||||
echo -e "\nReading current firmware"
|
||||
${flashromcmd} -r bios.bin > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Failure reading current firmware; cannot proceed."
|
||||
cd ${working_dir}
|
||||
exit
|
||||
fi
|
||||
|
||||
#check if contains MAC address, extract
|
||||
${cbfstoolcmd} bios.bin extract -n vpd.bin -f vpd.bin >& /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "Failure extracting MAC address from current firmware; default will be used"
|
||||
fi
|
||||
|
||||
#download firmware file
|
||||
echo -e "\nDownloading coreboot firmware"
|
||||
curl -s -L -O "${dropbox_url}${coreboot_file}"
|
||||
curl -s -L -O "${dropbox_url}${coreboot_file}.md5"
|
||||
curl -s -L -O "${dropbox_url}bootorder"
|
||||
#verify checksum on downloaded file
|
||||
md5sum -c ${coreboot_file}.md5 > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
#check if we have a VPD to restore
|
||||
if [ -f /tmp/vpd.bin ]; then
|
||||
${cbfstoolcmd} ${coreboot_file} add -n vpd.bin -f /tmp/vpd.bin -t raw
|
||||
fi
|
||||
#preferUSB?
|
||||
if [ "$preferUSB" = true ]; then
|
||||
${cbfstoolcmd} ${coreboot_file} add -n bootorder -f /tmp/bootorder -t raw
|
||||
fi
|
||||
#flash coreboot firmware
|
||||
echo -e "\nInstalling firmware: ${coreboot_file}"
|
||||
${flashromcmd} -w "${coreboot_file}" > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "\ncoreboot firmware successfully updated."
|
||||
echo -e "Please power cycle your ChromeBox to complete the update.\n"
|
||||
else
|
||||
echo -e "\nAn error occurred flashing the coreboot firmware. DO NOT REBOOT!"
|
||||
fi
|
||||
else
|
||||
#download checksum fail
|
||||
echo -e "\ncoreboot firmware download checksum fail; download corrupted, cannot flash."
|
||||
fi
|
||||
#clean up
|
||||
cd ${working_dir}
|
||||
|
||||
1671
functions.sh
Normal file
1671
functions.sh
Normal file
File diff suppressed because it is too large
Load Diff
33
setup-firmware.sh
Normal file
33
setup-firmware.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script offers provides the ability to update the
|
||||
# Legacy Boot payload, set boot options, and install
|
||||
# a custom coreboot firmware for supported
|
||||
# ChromeOS devices
|
||||
#
|
||||
# Created by Matt DeVillier <matt.devillier@gmail.com>
|
||||
#
|
||||
# May be freely distributed and modified as needed,
|
||||
# as long as proper attribution is given.
|
||||
#
|
||||
|
||||
#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
|
||||
|
||||
#get functions script
|
||||
rm -rf functions.sh >/dev/null &2>1
|
||||
curl -s -L -O ${script_url}/functions.sh
|
||||
. ./functions.sh
|
||||
|
||||
#do setup stuff
|
||||
prelim_setup
|
||||
if [ $? -ne 0 ]; then
|
||||
return -1
|
||||
fi
|
||||
|
||||
#show menu
|
||||
menu_fwupdate
|
||||
32
setup-kodi.sh
Normal file
32
setup-kodi.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script will prep Haswell/Broadwell-based
|
||||
# ChromeOS devices for Kodi installation via
|
||||
# OpenELEC or Ubuntu/Kodibuntu
|
||||
#
|
||||
# Created by Matt DeVillier <matt.devillier@gmail.com>
|
||||
#
|
||||
# May be freely distributed and modified as needed,
|
||||
# as long as proper attribution is given.
|
||||
#
|
||||
|
||||
#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
|
||||
|
||||
#get functions script
|
||||
rm -rf functions.sh >/dev/null &2>1
|
||||
curl -s -L -O ${script_url}/functions.sh
|
||||
. ./functions.sh
|
||||
|
||||
#do setup stuff
|
||||
prelim_setup
|
||||
if [ $? -ne 0 ]; then
|
||||
return -1
|
||||
fi
|
||||
|
||||
#show menu
|
||||
menu_kodi
|
||||
Reference in New Issue
Block a user