filesystem: prepared for u-boot upgrade.

This commit is contained in:
Ricardo Martins 2014-08-11 17:08:48 +01:00
parent a650535d90
commit 00bb88ce54

View File

@ -6,8 +6,6 @@
#############################################################################
# Author: Ricardo Martins #
#############################################################################
# $Id:: upgrade 1244 2012-10-08 07:21:07Z rasm $:#
#############################################################################
base='/opt/lsts/glued'
hostname="$(hostname)"
@ -111,6 +109,68 @@ kernel_upgrade()
fi
}
uboot_part_upgrade()
{
label="$1"
dev="$2"
echo -en "* $label: probing bootloader partition... "
if ! [ -b "$dev" ]; then
echo 'not present'
return 0
fi
echo 'present'
echo -en "* $label: mounting bootloader partition... "
mount -t vfat "$dev" /mnt > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "failed"
return 0
fi
echo 'done'
for f in MLO u-boot.img; do
echo -en "* $label: Replacing $f... "
cp "$base/.glued-new/boot/$f" /mnt
echo 'done'
done
echo -en "* $label: unmounting bootloader partition... "
umount /mnt > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo 'failed'
return 1
fi
sync && sync && sync && sync
echo 'done'
return 0
}
uboot_part_upgrade_check()
{
# Check if board is a BeagleBone black.
dmesg | grep -i 'machine model' | grep -i beaglebone > /dev/null 2>&1
if [ $? -eq 0 ]; then
uboot_part_upgrade 'BeagleBone Black' '/dev/mmcblk1p1'
return 0
fi
# Check if board is a IGEPv2.
dmesg | grep -i 'machine model' | grep -i igepv2 > /dev/null 2>&1
if [ $? -eq 0 ]; then
uboot_part_upgrade 'IGEPv2' '/dev/mmcblk0p1'
return 0
fi
grep "IGEP v2" /proc/cpuinfo > /dev/null 2>&1
if [ $? -eq 0 ]; then
uboot_part_upgrade 'IGEPv2' '/dev/mmcblk0p1'
return 0
fi
return 0
}
old_move()
{
echo "* Mounting rootfs read-write..."
@ -158,6 +218,7 @@ start()
version || return 1
kernel_dst || return 1
new_unpack || return 1
uboot_part_upgrade_check || return 1
kernel_upgrade || return 1
old_move || return 1
}