netinstall: final custom script, make sure to backup and install custom bootloaders at end of install, also make sure that the script knows about new u-boot.img files

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
pull/8/head
Robert Nelson 13 years ago
parent 94e8dd2e81
commit 10180bbdef

@ -1118,9 +1118,11 @@ function populate_boot {
if mount -t vfat ${MMC}${PARTITION_PREFIX}1 ${TEMPDIR}/disk; then
mkdir -p ${TEMPDIR}/disk/cus
if [ "${SPL_BOOT}" ] ; then
if [ -f ${TEMPDIR}/dl/${MLO} ]; then
cp -v ${TEMPDIR}/dl/${MLO} ${TEMPDIR}/disk/MLO
cp -v ${TEMPDIR}/dl/${MLO} ${TEMPDIR}/disk/cus/MLO
fi
fi
@ -1128,8 +1130,10 @@ function populate_boot {
if [ -f ${TEMPDIR}/dl/${UBOOT} ]; then
if echo ${UBOOT} | grep img > /dev/null 2>&1;then
cp -v ${TEMPDIR}/dl/${UBOOT} ${TEMPDIR}/disk/u-boot.img
cp -v ${TEMPDIR}/dl/${UBOOT} ${TEMPDIR}/disk/cus/u-boot.img
else
cp -v ${TEMPDIR}/dl/${UBOOT} ${TEMPDIR}/disk/u-boot.bin
cp -v ${TEMPDIR}/dl/${UBOOT} ${TEMPDIR}/disk/cus/u-boot.bin
fi
fi
fi
@ -1162,11 +1166,11 @@ if [ "${USE_UENV}" ] ; then
cat ${TEMPDIR}/bootscripts/netinstall.cmd
echo "-----------------------------"
echo "Normal Boot Script:"
cp -v ${TEMPDIR}/bootscripts/normal.cmd ${TEMPDIR}/disk/normal.txt
cp -v ${TEMPDIR}/bootscripts/normal.cmd ${TEMPDIR}/disk/cus/normal.txt
echo "-----------------------------"
cat ${TEMPDIR}/bootscripts/normal.cmd
echo "-----------------------------"
touch ${TEMPDIR}/disk/use_uenv
touch ${TEMPDIR}/disk/cus/use_uenv
else
echo "Copying boot.scr based boot scripts to Boot Partition"
echo "-----------------------------"
@ -1178,7 +1182,7 @@ else
cat ${TEMPDIR}/bootscripts/netinstall.cmd
echo "-----------------------------"
echo "Normal Boot Script:"
cp -v ${TEMPDIR}/bootscripts/normal.cmd ${TEMPDIR}/disk/boot.cmd
cp -v ${TEMPDIR}/bootscripts/normal.cmd ${TEMPDIR}/disk/cus/boot.cmd
cat ${TEMPDIR}/bootscripts/normal.cmd
echo "-----------------------------"
fi

@ -8,25 +8,22 @@ FINAL_FSTYPE=$(mount | grep /dev/ | grep -v devpts | awk '{print $5}')
rm -f /boot/uboot/uInitrd.net || true
rm -f /boot/uboot/uImage.net || true
#Next: are we using uEnv.txt or boot.scr boot files?
if [ -f "/boot/uboot/use_uenv" ]; then
#Cleanup: Initial Bootloader
rm -f /boot/uboot/uEnv.txt || true
rm -f /boot/uboot/boot.scr || true
if [ -f "/boot/uboot/normal.txt" ]; then
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/normal.txt
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/normal.txt
rm -f /boot/uboot/uEnv.txt || true
mv /boot/uboot/normal.txt /boot/uboot/uEnv.txt
#Next: are we using uEnv.txt or boot.scr boot files?
if [ -f "/boot/uboot/cus/use_uenv" ]; then
if [ -f "/boot/uboot/cus/normal.txt" ]; then
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/cus/normal.txt
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/cus/normal.txt
mv /boot/uboot/cus/normal.txt /boot/uboot/uEnv.txt
fi
else
if [ -f "/boot/uboot/boot.scr" ]; then
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/boot.cmd
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/boot.cmd
rm -f /boot/uboot/boot.scr || true
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot" -d /boot/uboot/boot.cmd /boot/uboot/boot.scr
fi
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/cus/boot.cmd
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/cus/boot.cmd
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot" -d /boot/uboot/cus/boot.cmd /boot/uboot/boot.scr
cp /boot/uboot/cus/boot.cmd /boot/uboot/boot.cmd
fi
#Install Correct Kernel Image:
@ -35,3 +32,4 @@ update-initramfs -c -k `uname -r`
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uboot/uInitrd
mkimage -A arm -O linux -T kernel -C none -a ZRELADD -e ZRELADD -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uboot/uImage
rm -f /boot/uboot/linux-image-*_1.0*_arm*.deb || true

@ -14,43 +14,46 @@ rm -f /boot/uboot/uInitrd.bak || true
rm -f /boot/uboot/uImage || true
rm -f /boot/uboot/uImage.bak || true
#Did: Ubuntu touch and backup scr boot file?
if [ -f "/boot/uboot/boot.scr.bak" ]; then
#Cleanup: Initial Bootloader
rm -f /boot/uboot/boot.scr || true
mv /boot/uboot/boot.scr.bak /boot/uboot/boot.scr
fi
rm -f /boot/uboot/boot.scr.bak || true
rm -f /boot/uboot/uEnv.txt || true
rm -f /boot/uboot/uEnv.txt.bak || true
#Did: Ubuntu touch and backup MLO Bootloader?
if [ -f "/boot/uboot/MLO.bak" ]; then
#Restore backup MLO (SPL) Bootloader?
rm -f /boot/uboot/MLO || true
mv /boot/uboot/MLO.bak /boot/uboot/MLO
fi
rm -f /boot/uboot/MLO.bak || true
#Did: Ubuntu touch and backup u-boot.bin Bootloader?
if [ -f "/boot/uboot/u-boot.bin.bak" ]; then
rm -f /boot/uboot/u-boot.bin || true
mv /boot/uboot/u-boot.bin.bak /boot/uboot/u-boot.bin
if [ -f /boot/uboot/cus/MLO ] ; then
mv /boot/uboot/cus/MLO /boot/uboot/MLO
fi
#Next: are we using uEnv.txt or boot.scr boot files?
if [ -f "/boot/uboot/use_uenv" ]; then
rm -f /boot/uboot/boot.scr || true
#Restore, backup u-boot Bootloader?
rm -f /boot/uboot/u-boot.bin || true
rm -f /boot/uboot/u-boot.bin.bak || true
rm -f /boot/uboot/u-boot.img || true
rm -f /boot/uboot/u-boot.img.bak || true
if [ -f "/boot/uboot/normal.txt" ]; then
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/normal.txt
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/normal.txt
if [ -f /boot/uboot/cus/u-boot.img ] ; then
mv /boot/uboot/cus/u-boot.img /boot/uboot/u-boot.img
fi
rm -f /boot/uboot/uEnv.txt || true
mv /boot/uboot/normal.txt /boot/uboot/uEnv.txt
if [ -f /boot/uboot/cus/u-boot.bin ] ; then
mv /boot/uboot/cus/u-boot.bin /boot/uboot/u-boot.bin
fi
else
if [ -f "/boot/uboot/boot.scr" ]; then
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/boot.cmd
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/boot.cmd
rm -f /boot/uboot/boot.scr || true
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot" -d /boot/uboot/boot.cmd /boot/uboot/boot.scr
#Next: are we using uEnv.txt or boot.scr boot files?
if [ -f "/boot/uboot/cus/use_uenv" ]; then
if [ -f "/boot/uboot/cus/normal.txt" ]; then
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/cus/normal.txt
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/cus/normal.txt
mv /boot/uboot/cus/normal.txt /boot/uboot/uEnv.txt
fi
else
sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/cus/boot.cmd
sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/cus/boot.cmd
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Boot" -d /boot/uboot/cus/boot.cmd /boot/uboot/boot.scr
cp /boot/uboot/cus/boot.cmd /boot/uboot/boot.cmd
fi
#Cleanup: some of Ubuntu's packages:
@ -66,3 +69,4 @@ update-initramfs -c -k `uname -r`
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uboot/uInitrd
mkimage -A arm -O linux -T kernel -C none -a ZRELADD -e ZRELADD -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uboot/uImage
rm -f /boot/uboot/linux-image-*_1.0*_arm*.deb || true

Loading…
Cancel
Save