#! /bin/bash # # Dreamplug 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 # Do one of the following three # setenv arcNumber 2097 # for standard sheevaplugs # setenv arcNumber 2678 # for e-sata sheevaplugs # setenv arcNumber 2659 # for guruplugs and dreamplugs ####### 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 ProgName="$0" KVer='' ERROR=0 WGET=$(which wget) if [[ -z $WGET ]]; then echo "missing wget" ERROR=1 fi if (( ERROR )); then exit 1 fi function Md5Compare () { if [[ $(cat $2 | cut -d' ' -f1) \ != $(md5sum $1 | cut -d' ' -f1) ]]; then echo "Bad md5 detected on $1" exit 1 fi } function GetDownloadPath() { local v1=$(echo $KVer | cut -d'.' -f1) local v2=$(echo $KVer | cut -d'.' -f2) local v3=$(echo $KVer | cut -d'.' -f3) local v4=$(echo $KVer | cut -d'.' -f4) local path="kernel/$v1/$v1.$v2" if (( $v1 == 2 )); then if [[ -z $v3 ]]; then path="$path/$v1.$v2" else path="$path/$v1.$v2.$v3" if [[ -z $v4 ]]; then path="$path/$v1.$v2.$v3" else path="$path/$v1.$v2.$v3.$v4" fi fi else if [[ -z $v3 ]]; then path="$path/$v1.$v2" else path="$path/$v1.$v2.$v3" fi fi echo $path } function Download() { echo "Downloading files" local path=$(GetDownloadPath) local f='' p='' for f in Modules.tar.gz Modules.tar.gz.md5 uImage uImage.md5 System.map; do p='sheeva' [[ $f != uImage* ]] || p='dream' if [[ ! -f $p-$KVer-$f ]]; then local sites="http://www.plugapps.com/mirror/with-linux http://sheeva.with-linux.com/sheeva" local s='' for s in $sites; do if $WGET -c $s/$path/$p-$KVer-$f && [[ -f $p-$KVer-$f ]]; then break fi done if [[ ! -f $p-$KVer-$f ]]; then echo "Unable to retrieve $p-$KVer-$f" exit 1 fi fi done Md5Compare sheeva-$KVer-Modules.tar.gz sheeva-$KVer-Modules.tar.gz.md5 Md5Compare dream-$KVer-uImage dream-$KVer-uImage.md5 } function ExtractModules() { local v1=$(echo $KVer | cut -d'.' -f1) local v2=$(echo $KVer | cut -d'.' -f2) local v3=$(echo $KVer | cut -d'.' -f3) local depmodVer=$KVer [[ ! -z $v3 ]] || depmodVer="$v1.$v2.0" local extractDir='/' [[ ! -L '/lib' ]] || extractDir=$(dirname $(readlink '/lib')) [[ -d $extractDir ]] || extractDir="/$extractDir" echo "Extracting modules" tar x -C $extractDir --overwrite -zf sheeva-$KVer-Modules.tar.gz [[ -d /boot ]] || mkdir /boot cp sheeva-$KVer-System.map /boot/ depmod -eF /boot/sheeva-$KVer-System.map $depmodVer } function RootKernel() { echo "Writing kernel to /boot" [[ -d /boot ]] || mkdir /boot cp dream-$KVer-uImage /boot/ echo "****************************************************************" echo " update your bootcmd to load dream-$KVer-uImage" echo " or create a link from /boot/dream-$KVer-uImage to /boot/uImage" echo "****************************************************************" } function Usage() { echo "Use $ProgName VERSION to write kernel to /boot" echo echo " where VERSION is something like 3.0" } if (( $# < 1 )); then Usage exit 1 fi KVer="$1" Download ExtractModules RootKernel