1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/bin/sh
# This code is covered by the GNU General Public License (GPLv2 or higher)
NVRAM=$(which nvram)
FW_PRINTENV=$(which fw_printenv)
path=$(mount | grep ext2 | sed -n '/sda1/ {s/\/dev\/sda1 on \(.*\) type.*/\1/; p}')
if [ -z "$path" ]; then
echo "You have to create an ext2 filesystem on /dev/sda1"
exit 1
fi
if [ ! -e $path/uImage.buffalo ]; then
echo "You have to download the uImage.buffalo file from the debian-installer for Kurobox Pro, and put it in $path"
exit 1
fi
if [ ! -e $path/initrd.buffalo ]; then
echo "You have to download the initrd.buffalo file from the debian-installer for Kurobox Pro, and put it in $path"
exit 1
fi
if [ -n "$NVRAM" ]; then
PRINTENV="$NVRAM -c printenv"
SETENV="$NVRAM -c set"
elif [ -n "$FW_PRINTENV" ]; then
if [ -z "$(which fw_setenv)" ]; then
echo "Program fw_setenv not found, cannot modify U-Boot environment..."
exit 1
elif [ ! -f /etc/fw_env.config ]; then
echo "Configuration file for fw_printenv not found."
exit 1
else
PRINTENV=$FW_PRINTENV
SETENV=$(which fw_setenv)
fi
else
echo "No tool found for modifying U-Boot environment..."
exit 1
fi
printf "Saving U-Boot environment to ubootenv.bak... "
$PRINTENV > ubootenv.bak
echo "done."
echo "Changing U-Boot environment... "
$SETENV bootcmd 'ide reset; ext2load ide 0:1 $(default_kernel_addr) /$(kernel); ext2load ide 0:1 $(default_initrd_addr) /$(initrd); setenv bootargs $(bootargs_base); bootm $(default_kernel_addr) $(default_initrd_addr)'
echo "done."
echo "Please reboot your Kurobox Pro."
|