#! /bin/bash # # Sheeva kernel install # This README can be used to flash the new kernel # Watch out for erase/flash errors # If errors are encountered you should redo the flash # # This is a mainline Linux Kernel and you must set # the mainlineLinux and arcNumber env variables in U-Boot # and change the bootargs for a successful boot. # # setenv mainlineLinux yes # setenv arcNumber 2097 ####### change bootargs, replace nand_mtd with orion_nand and add rootfstype=jffs2 # setenv bootargs rootfstype=jffs2 console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=192.168.1.9:192.168.1.4:192.168.1.4:255.255.255.0:DB88FXX81:eth0:none # saveenv ####### change vm security settings # Due to changes in vm security a change must be made in /etc/sysctl.d/10-process-security.conf. # vm.mmap_min_addr should be set to 32768 (This change is safe for any kernel version). # If this is not done it is likely that you will not be able to login remotely. # Although you should still be able to login as root on the main console. set -e set -u KVer='2.6.30.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://sheeva6.with-linux.com/sheeva/$KVer/sheeva-$KVer-$f || \ wget -c http://sheeva.with-linux.com/sheeva/$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 RootKernel() { echo "Writing kernel to root" 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 FlashKernel() { echo "Flashing kernel" # 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 } Download ExtractModules if [[ $# > 0 ]] && [[ "$1" == "--rootkernel" ]]; then RootKernel else FlashKernel fi