#! /bin/bash # # This testing kernel is same configuration as the standard 2.6.31.6 # with the exception that it has taskstats enabled. set -e set -u KVer='2.6.31.6' function Md5Compare () { if [[ $(cat $2 | cut -d' ' -f1) \ != $(md5sum $1 | cut -d' ' -f1) ]]; then echo "Bad md5 detected on $1" exit 1 fi } function Download() { echo "Downloading files" local f='' for f in Modules.tar.gz Modules.tar.gz.md5 uImage uImage.md5; do if [[ ! -f sheeva-$KVer-$f ]]; then if [[ -z "$(which wget)" ]]; then echo "Use apt-get to install wget, then rerun this script" exit 1 fi wget -c http://sheeva.with-linux.com/sheeva/testing/$KVer/sheeva-$KVer-$f || \ wget -c http://sheeva6.with-linux.com/sheeva/testing/$KVer/sheeva-$KVer-$f if [[ ! -f sheeva-$KVer-$f ]]; then echo "Unable to retrieve sheeva-$KVer-$f" exit 1 fi fi done Md5Compare sheeva-$KVer-Modules.tar.gz sheeva-$KVer-Modules.tar.gz.md5 Md5Compare sheeva-$KVer-uImage sheeva-$KVer-uImage.md5 } function ExtractModules() { echo "Extracting modules" tar x -C / --overwrite -zf sheeva-$KVer-Modules.tar.gz } function NandKernel() { echo "Flashing kernel to NAND" # MTDDEVICE should be either /dev/mtd0 or /dev/mtd1 # depending on which partition contains the kernel uImage local Mtd=$(grep uImage /proc/mtd | cut -d' ' -f1 | sed 's#:##') flash_eraseall -j /dev/$Mtd nandwrite -pm /dev/$Mtd sheeva-$KVer-uImage } function RootKernel() { echo "Writing kernel to /boot" [[ -d /boot ]] || mkdir /boot cp sheeva-$KVer-uImage /boot/ echo "****************************************************************" echo " update your bootcmd to load sheeva-$KVer-uImage" echo " or use a symlink from /boot/sheeva-$KVer-uImage to /boot/uImage" echo "****************************************************************" } function Usage() { echo "Use --nandkernel to write kernel to NAND" echo "Or --rootkernel to write kernel to /boot" } if [[ $# < 1 ]]; then Usage exit 1 fi if [[ "$1" == "--nandkernel" ]]; then Download ExtractModules NandKernel elif [[ "$1" == "--rootkernel" ]]; then Download ExtractModules RootKernel else Usage exit 1 fi