From ecf2897acff392fe2eabf867c82716ab1c2806cc Mon Sep 17 00:00:00 2001 From: Liam McLoughlin Date: Tue, 1 May 2012 16:10:46 +0100 Subject: [PATCH] Updated to store repo on root partition --- rpi-update | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/rpi-update b/rpi-update index 196ca85..a9af385 100755 --- a/rpi-update +++ b/rpi-update @@ -6,7 +6,9 @@ set -o errexit UPDATE=${2:-1} UPDATE_URI="https://raw.github.com/Hexxeh/rpi-update/master/rpi-update" FW_REPO="git://github.com/Hexxeh/rpi-firmware.git" +FW_REPOLOCAL="~/.rpi-firmware" FW_PATH="/boot" +FW_REPONAME=`basename ${FW_REPOLOCAL}` FW_RAM=${1:-224} FW_GPU=$((256-FW_RAM)) @@ -46,8 +48,8 @@ EOF } function update_modules { - cp -R ${FW_PATH}/modules/* /lib/modules/ - for D in `find ${FW_PATH}/modules -mindepth 1 -maxdepth 1 -type d`; do + cp -R ${FW_REPOLOCAL}/modules/* /lib/modules/ + for D in `find ${FW_REPOLOCAL}/modules -mindepth 1 -maxdepth 1 -type d`; do depmod -a `basename $D` done } @@ -56,20 +58,21 @@ function update_sdk { ELFOUTPUT=`readelf -a /bin/bash` if [ "$ELFOUTPUT" != "${ELFOUTPUT/VFP_args/}" ]; then echo "Using HardFP libraries" - cp -R ${FW_PATH}/vc/hardfp/* / + cp -R ${FW_REPOLOCAL}/vc/hardfp/* / else echo "Using SoftFP libraries" - cp -R ${FW_PATH}/vc/softfp/* / + cp -R ${FW_REPOLOCAL}/vc/softfp/* / fi - cp -R ${FW_PATH}/vc/sdk/* / -} - -function restore_configs { - cp ${FW_PATH}.bak/*.txt ${FW_PATH}/ &> /dev/null + cp -R ${FW_REPOLOCAL}/vc/sdk/* / } function set_split { - cp ${FW_PATH}/arm${FW_RAM}_start.elf ${FW_PATH}/start.elf + cp ${FW_REPOLOCAL}/arm${FW_RAM}_start.elf ${FW_PATH}/start.elf +} + +function update_firmware { + cp ${FW_REPOLOCAL}/*.bin ${FW_PATH}/ + cp ${FW_REPOLOCAL}/*.img ${FW_PATH}/ } if [[ $EUID -ne 0 ]]; then @@ -82,9 +85,6 @@ if [[ $UPDATE -ne 0 ]]; then update_self fi -echo "Come back later, rpi-update needs patching up" -exit 0 - command -v git >/dev/null 2>&1 || { echo "This tool requires you have Git installed, please install it first" echo "In Debian, try: sudo apt-get install git-core" @@ -101,13 +101,14 @@ command -v readelf >/dev/null 2>&1 || { echo "Using memory split of ${FW_RAM}MB/${FW_GPU}MB" -GITCMD="git --git-dir=${FW_PATH}/.git --work-tree=${FW_PATH}" +GITCMD="git --git-dir=${FW_REPOLOCAL}/.git --work-tree=${FW_REPOLOCAL}" +mkdir -p ${FW_REPOLOCAL} if $($GITCMD rev-parse &> /dev/null); then echo "Updating firmware (this will take a few minutes)" - rm -f ${FW_PATH}/start.elf $GITCMD fetch --quiet $GITCMD merge origin/master -m "automerge" --quiet + update_firmware update_modules update_sdk set_split @@ -117,16 +118,14 @@ else echo "We're running for the first time" echo "Setting up firmware (this will take a few minutes)" cp -R ${FW_PATH} ${FW_PATH}.bak - rm -rf /boot &> /dev/null - git clone ${FW_REPO} ${FW_PATH} --depth=1 --quiet + git clone ${FW_REPO} ${FW_REPOLOCAL} --depth=1 --quiet RETVAL=$? if [[ $RETVAL != 0 ]]; then - echo "We failed! Attmepting to restore your original firmware" - cp -R ${FW_PATH}.bak/* ${FW_PATH}/ + echo "Failed to download new firmware files" else + update_firmware update_modules update_sdk - restore_configs set_split sync echo "If no errors appeared, your firmware was successfully setup"