mirror of
https://github.com/raspberrypi/rpi-update.git
synced 2026-01-20 21:13:38 +08:00
Added VC libs update support and tidied the script up a little
This commit is contained in:
50
rpi-update
50
rpi-update
@@ -45,12 +45,33 @@ EOF
|
|||||||
exec /bin/bash updateScript.sh "$@"
|
exec /bin/bash updateScript.sh "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_depmod {
|
function update_modules {
|
||||||
|
cp -R ${FW_PATH}/modules/* /lib/modules/
|
||||||
for D in `find ${FW_PATH}/modules -mindepth 1 -maxdepth 1 -type d`; do
|
for D in `find ${FW_PATH}/modules -mindepth 1 -maxdepth 1 -type d`; do
|
||||||
depmod -a `basename $D`
|
depmod -a `basename $D`
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_sdk {
|
||||||
|
ELFOUTPUT=`readelf -A /bin/bash`
|
||||||
|
if [ "$ELFOUTPUT" != "${ELFOUTPUT/HardFP/}" ]; then
|
||||||
|
echo "Using HardFP libraries"
|
||||||
|
cp -R ${FW_PATH}/vc/hardfp/* /
|
||||||
|
else
|
||||||
|
echo "Using SoftFP libraries"
|
||||||
|
cp -R ${FW_PATH}/vc/softfp/* /
|
||||||
|
fi
|
||||||
|
cp -R ${FW_PATH}/vc/sdk/* /
|
||||||
|
}
|
||||||
|
|
||||||
|
function restore_configs {
|
||||||
|
cp ${FW_PATH}.bak/*.txt ${FW_PATH}/ &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_split {
|
||||||
|
cp ${FW_PATH}/arm${FW_RAM}_start.elf ${FW_PATH}/start.elf
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
echo "This tool must be run as root"
|
echo "This tool must be run as root"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -68,6 +89,13 @@ command -v git >/dev/null 2>&1 || {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command -v readelf >/dev/null 2>&1 || {
|
||||||
|
echo "This tool requires you have readelf installed, please install it first"
|
||||||
|
echo "In Debian, try: sudo apt-get install readelf"
|
||||||
|
echo "In Arch, try: pacman -Sy readelf"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo "Using memory split of ${FW_RAM}MB/${FW_GPU}MB"
|
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_PATH}/.git --work-tree=${FW_PATH}"
|
||||||
@@ -76,27 +104,27 @@ if $($GITCMD rev-parse &> /dev/null); then
|
|||||||
echo "Updating firmware (this will take a few minutes)"
|
echo "Updating firmware (this will take a few minutes)"
|
||||||
rm -f ${FW_PATH}/start.elf
|
rm -f ${FW_PATH}/start.elf
|
||||||
$GITCMD fetch --quiet
|
$GITCMD fetch --quiet
|
||||||
$GITCMD merge origin/master --no-edit --quiet
|
$GITCMD merge origin/master -m "automerge" --quiet
|
||||||
cp ${FW_PATH}/arm${FW_RAM}_start.elf ${FW_PATH}/start.elf
|
update_modules
|
||||||
cp -R ${FW_PATH}/modules/* /lib/modules/
|
update_sdk
|
||||||
do_depmod
|
set_split
|
||||||
sync
|
sync
|
||||||
echo "If no errors appeared, your firmware was successfully updated"
|
echo "If no errors appeared, your firmware was successfully updated"
|
||||||
else
|
else
|
||||||
echo "We're running for the first time"
|
echo "We're running for the first time"
|
||||||
echo "Setting up firmware (this will take a few minutes)"
|
echo "Setting up firmware (this will take a few minutes)"
|
||||||
cp -R ${FW_PATH} ${FW_PATH}.bak
|
cp -R ${FW_PATH} ${FW_PATH}.bak
|
||||||
rm -rf /boot/*
|
rm -rf /boot &> /dev/null
|
||||||
git clone ${FW_REPO} ${FW_PATH} --depth=1 --quiet
|
git clone ${FW_REPO} ${FW_PATH} --depth=1 --quiet
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [[ $RETVAL != 0 ]]; then
|
if [[ $RETVAL != 0 ]]; then
|
||||||
echo "We failed! Attmepting to restore your original firmware"
|
echo "We failed! Attmepting to restore your original firmware"
|
||||||
cp -R ${FW_PATH}.bak ${FW_PATH}
|
cp -R ${FW_PATH}.bak/* ${FW_PATH}/
|
||||||
else
|
else
|
||||||
cp -R ${FW_PATH}/modules/* /lib/modules/
|
update_modules
|
||||||
do_depmod
|
update_sdk
|
||||||
cp ${FW_PATH}.bak/*.txt ${FW_PATH}/ &> /dev/null
|
restore_configs
|
||||||
cp ${FW_PATH}/arm${FW_RAM}_start.elf ${FW_PATH}/start.elf
|
set_split
|
||||||
sync
|
sync
|
||||||
echo "If no errors appeared, your firmware was successfully setup"
|
echo "If no errors appeared, your firmware was successfully setup"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user