summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-09-27 16:16:55 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-09-27 16:16:55 -0400
commitc4d20aa234b2adcbf04a65d77aee35e95ab82d14 (patch)
tree4e03e5f75b33026dffc048afb81b12fcf4eccdcd
parent897c93a793d2f42bd4b30eaf2ee152c3959ce677 (diff)
Bug fixes for ARM installer scripts.
-rw-r--r--arm-installer-common.sh42
-rwxr-xr-xodroid-install-kernel.sh10
-rwxr-xr-xpanda-install-kernel.sh16
3 files changed, 45 insertions, 23 deletions
diff --git a/arm-installer-common.sh b/arm-installer-common.sh
index 32fb69c..92bd63c 100644
--- a/arm-installer-common.sh
+++ b/arm-installer-common.sh
@@ -5,6 +5,8 @@ set -u
5 5
6# Build host for ARM. 6# Build host for ARM.
7HOST="pound.cs.unc.edu" 7HOST="pound.cs.unc.edu"
8# User doing the builds.
9USER="cjk"
8 10
9# Not installed on the U-Boot partition. 11# Not installed on the U-Boot partition.
10ZIMAGE_FILE="zImage" 12ZIMAGE_FILE="zImage"
@@ -27,6 +29,9 @@ TMP_DIR=$(mktemp -d)
27# initramfs state directory (Debian/Ubuntu) 29# initramfs state directory (Debian/Ubuntu)
28INITRAMFS_STATEDIR="/var/lib/initramfs-tools" 30INITRAMFS_STATEDIR="/var/lib/initramfs-tools"
29 31
32# Where the modules live (not in /lib/modules). This is relative to my homedir.
33MODULES_PATH="modules"
34
30error() { 35error() {
31 echo "$@" >&2 36 echo "$@" >&2
32 exit 1 37 exit 1
@@ -37,24 +42,21 @@ if [ $# -ne 2 ] ; then
37fi 42fi
38 43
39KERN_DIR=$1 44KERN_DIR=$1
40SCRIPT_NAME=$2 45BOOT_TXT=$2
41 46
42if [ ! -f "$SCRIPT_NAME" ] ; then 47if [ ! -f "$BOOT_TXT" ] ; then
43 error "Boot script not a file: $SCRIPT_NAME" 48 error "Boot script TXT not a file: $BOOT_TXT"
44fi 49fi
45 50
46getversion() { 51getversion() {
47 # This function also sets the CONFIG_FILE global.
48
49 local version 52 local version
50 set +e 53 set +e
51 version=$(ssh $HOST cat $KERN_DIR/include/config/kernel.release) 54 version=$(ssh $USER@$HOST cat $KERN_DIR/include/config/kernel.release)
52 set -e 55 set -e
53 if [ "x" = "x$version" ] ; then 56 if [ "x" = "x$version" ] ; then
54 error "Could not determine version" 57 error "Could not determine version"
55 fi 58 fi
56 CONFIG_FILE="config-$version" 59 echo "$version"
57 return $version
58} 60}
59 61
60fetchfiles() { 62fetchfiles() {
@@ -62,6 +64,26 @@ fetchfiles() {
62 rsync -P $USER@$HOST:$KERN_DIR/arch/arm/boot/zImage $TMP_DIR/$ZIMAGE_FILE 64 rsync -P $USER@$HOST:$KERN_DIR/arch/arm/boot/zImage $TMP_DIR/$ZIMAGE_FILE
63 rsync -P $USER@$HOST:$KERN_DIR/.config $TMP_DIR/$CONFIG_FILE 65 rsync -P $USER@$HOST:$KERN_DIR/.config $TMP_DIR/$CONFIG_FILE
64 echo "done." >&2 66 echo "done." >&2
67
68 local remotemodules
69 local havemodules
70 remotemodules="$MODULES_PATH/$KVERSION/lib/modules/$KVERSION"
71 set +e
72 ssh $USER@$HOST "test -e $remotemodules"
73 havemodules=$?
74 set -e
75 if [ $havemodules -ne 0 ] ; then
76 echo "No modules found." >&2
77 if [ -d "/lib/modules/$KVERSION" ] ; then
78 echo "Removing old modules ..." >&2
79 rm -rf "/lib/modules/$KVERSION"
80 echo "done." >&2
81 fi
82 else
83 echo "Copying modules ..." >&2
84 sudo rsync -aP --delete $USER@$HOST:$remotemodules /lib/modules/
85 echo "done." >&2
86 fi
65} 87}
66 88
67mkuboot() { 89mkuboot() {
@@ -74,7 +96,7 @@ mkuboot() {
74 96
75mkscript() { 97mkscript() {
76 echo "Generating u-boot configuration ... " >&2 98 echo "Generating u-boot configuration ... " >&2
77 mkimage -A arm -T script -C none -d "$SCRIPT_FILE" $TMP_DIR/$SCRIPT_FILE >&2 99 mkimage -A arm -T script -C none -d "$BOOT_TXT" $TMP_DIR/$SCRIPT_FILE >&2
78 echo "done." >&2 100 echo "done." >&2
79} 101}
80 102
@@ -105,7 +127,7 @@ mkuinitrd() {
105 127
106 echo "Making u-boot initrd image ... " >&2 128 echo "Making u-boot initrd image ... " >&2
107 mkimage -A arm -O linux -T ramdisk -C none \ 129 mkimage -A arm -O linux -T ramdisk -C none \
108 -d $initrdimage $TMP_DIR/$INITRD_NAME >&2 130 -d $initrdimage $TMP_DIR/$INITRD_FILE >&2
109 echo "done." >&2 131 echo "done." >&2
110} 132}
111 133
diff --git a/odroid-install-kernel.sh b/odroid-install-kernel.sh
index fc6da32..a65dcb8 100755
--- a/odroid-install-kernel.sh
+++ b/odroid-install-kernel.sh
@@ -1,5 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2 2
3. $(dirname $0)/arm-installer-common.sh
4
5# This is machine specific, AFAIK.
3LOAD_ADDR=0x4000800 6LOAD_ADDR=0x4000800
4ENTRY_POINT=0x4000800 7ENTRY_POINT=0x4000800
5 8
@@ -12,7 +15,8 @@ if [ 0 -ne $? ] ; then
12fi 15fi
13set -e 16set -e
14 17
15getversion 18KVERSION=$(getversion)
19CONFIG_FILE="config-$KVERSION"
16 20
17fetchfiles 21fetchfiles
18 22
@@ -24,12 +28,12 @@ moveconfig
24 28
25doinitramfs 29doinitramfs
26 30
27mkunitrd 31mkuinitrd
28 32
29copy_to_uboot 33copy_to_uboot
30 34
31echo "Making LITMUS the default ..." >&2 35echo "Making LITMUS the default ..." >&2
32mv $TMP_MOUNT/$SCRIPT_NAME $TMP_MOUNT/boot.scr 36mv $UBOOT_PATH/$SCRIPT_FILE $UBOOT_PATH/boot.scr
33echo "done." >&2 37echo "done." >&2
34 38
35rm_tmp_files 39rm_tmp_files
diff --git a/panda-install-kernel.sh b/panda-install-kernel.sh
index 9a22d8c..2a7f66a 100755
--- a/panda-install-kernel.sh
+++ b/panda-install-kernel.sh
@@ -1,22 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2 2
3set -e 3. $(dirname $0)/arm-installer-common.sh
4 4
5error() { 5# This is machine specific, AFAIK.
6 echo "$@" >&2 6LOAD_ADDR=0x80008000
7 exit 1 7ENTRY_POINT=0x80008000
8}
9 8
10TMP_MOUNT=$(mktemp -d) 9TMP_MOUNT=$(mktemp -d)
11 10
12# The FAT u-boot bootloader partition. 11# The FAT u-boot bootloader partition.
13UBOOT_PART=/dev/mmcblk0p1 12UBOOT_PART=/dev/mmcblk0p1
14 13
15# This is machine specific, AFAIK. 14KVERSION=$(getversion)
16LOAD_ADDR=0x80008000 15CONFIG_FILE="config-$KVERSION"
17ENTRY_POINT=0x80008000
18
19getversion
20 16
21fetchfiles 17fetchfiles
22 18