3 if [ ! -f /boot/zImage ] ; then
4 echo "Cannot find kernel to flash in /boot/zImage"
8 /bin/rm -f /boot/zImage-partition
10 if [ -f /boot/zImage-partition ] ; then
11 echo "Unable to remove kernel partition file"
15 echo "Creating kernel partition header"
16 /usr/sbin/kern_header /boot/zImage /boot/zImage-partition
18 if [ ! -f /boot/zImage-partition ] ; then
19 echo "Unable to create kernel partition header"
23 echo "Creating kernel partition file"
24 /bin/cat /boot/zImage >> /boot/zImage-partition
26 /bin/rm -f /boot/zImage-partition.old
28 if [ -f /boot/zImage-partition.old ] ; then
29 echo "Unable to remove old kernel partition file"
33 echo "Saving old kernel partition"
34 cat /dev/mtdblock2 > /boot/zImage-partition.old
36 if [ ! -f /boot/zImage-partition.old ] ; then
37 echo "Unable to create old kernel partition file"
41 /bin/ls -l /boot/zImage /boot/zImage-partition /boot/zImage-partition.old
43 echo "Flashing new kernel partition"
44 cat /boot/zImage-partition > /dev/mtdblock2
46 /bin/rm -f /boot/zImage-partition.verify
48 if [ -f /boot/zImage-partition.verify ] ; then
49 echo "Unable to remove kernel partition verify file"
53 echo "Verifing new kernel partition"
54 /bin/dd if=/dev/mtd2 of=/boot/zImage-partition.verify bs=1 \
55 count=`/bin/dd if=/dev/mtd2 bs=4 count=1 2>/dev/null | \
56 /usr/bin/hexdump -n 6 -e '"%02d"'` 2>/dev/null
58 if [ ! -f /boot/zImage-partition.verify ] ; then
59 echo "Unable to create kernel partition verify file"
63 if cmp /boot/zImage-partition /boot/zImage-partition.verify ; then
64 echo "Verification successful"
65 /bin/rm -f /boot/zImage-partition.verify
66 /bin/rm -f /boot/zImage-partition
67 /bin/rm -f /boot/zImage-partition.old
71 echo "VERIFICATION FAILED - DANGER DANGER DANGER"
73 echo "You must now manually reflash the new kernel,"
74 echo "or reflash the old kernel back again."
75 echo "The kernel partition is /dev/mtdblock2"
76 echo "The old kernel partition is in /boot/zImage-partition.old"
77 echo "The present partition contents are in /boot/zImage-partition.verify"
78 echo "The new kernel partition is in /boot/zImage-partition"