diff options
| author | Christopher Kenna <cjk@cs.unc.edu> | 2012-09-27 16:16:55 -0400 |
|---|---|---|
| committer | Christopher Kenna <cjk@cs.unc.edu> | 2012-09-27 16:16:55 -0400 |
| commit | c4d20aa234b2adcbf04a65d77aee35e95ab82d14 (patch) | |
| tree | 4e03e5f75b33026dffc048afb81b12fcf4eccdcd | |
| parent | 897c93a793d2f42bd4b30eaf2ee152c3959ce677 (diff) | |
Bug fixes for ARM installer scripts.
| -rw-r--r-- | arm-installer-common.sh | 42 | ||||
| -rwxr-xr-x | odroid-install-kernel.sh | 10 | ||||
| -rwxr-xr-x | panda-install-kernel.sh | 16 |
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. |
| 7 | HOST="pound.cs.unc.edu" | 7 | HOST="pound.cs.unc.edu" |
| 8 | # User doing the builds. | ||
| 9 | USER="cjk" | ||
| 8 | 10 | ||
| 9 | # Not installed on the U-Boot partition. | 11 | # Not installed on the U-Boot partition. |
| 10 | ZIMAGE_FILE="zImage" | 12 | ZIMAGE_FILE="zImage" |
| @@ -27,6 +29,9 @@ TMP_DIR=$(mktemp -d) | |||
| 27 | # initramfs state directory (Debian/Ubuntu) | 29 | # initramfs state directory (Debian/Ubuntu) |
| 28 | INITRAMFS_STATEDIR="/var/lib/initramfs-tools" | 30 | INITRAMFS_STATEDIR="/var/lib/initramfs-tools" |
| 29 | 31 | ||
| 32 | # Where the modules live (not in /lib/modules). This is relative to my homedir. | ||
| 33 | MODULES_PATH="modules" | ||
| 34 | |||
| 30 | error() { | 35 | error() { |
| 31 | echo "$@" >&2 | 36 | echo "$@" >&2 |
| 32 | exit 1 | 37 | exit 1 |
| @@ -37,24 +42,21 @@ if [ $# -ne 2 ] ; then | |||
| 37 | fi | 42 | fi |
| 38 | 43 | ||
| 39 | KERN_DIR=$1 | 44 | KERN_DIR=$1 |
| 40 | SCRIPT_NAME=$2 | 45 | BOOT_TXT=$2 |
| 41 | 46 | ||
| 42 | if [ ! -f "$SCRIPT_NAME" ] ; then | 47 | if [ ! -f "$BOOT_TXT" ] ; then |
| 43 | error "Boot script not a file: $SCRIPT_NAME" | 48 | error "Boot script TXT not a file: $BOOT_TXT" |
| 44 | fi | 49 | fi |
| 45 | 50 | ||
| 46 | getversion() { | 51 | getversion() { |
| 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 | ||
| 60 | fetchfiles() { | 62 | fetchfiles() { |
| @@ -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 | ||
| 67 | mkuboot() { | 89 | mkuboot() { |
| @@ -74,7 +96,7 @@ mkuboot() { | |||
| 74 | 96 | ||
| 75 | mkscript() { | 97 | mkscript() { |
| 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. | ||
| 3 | LOAD_ADDR=0x4000800 | 6 | LOAD_ADDR=0x4000800 |
| 4 | ENTRY_POINT=0x4000800 | 7 | ENTRY_POINT=0x4000800 |
| 5 | 8 | ||
| @@ -12,7 +15,8 @@ if [ 0 -ne $? ] ; then | |||
| 12 | fi | 15 | fi |
| 13 | set -e | 16 | set -e |
| 14 | 17 | ||
| 15 | getversion | 18 | KVERSION=$(getversion) |
| 19 | CONFIG_FILE="config-$KVERSION" | ||
| 16 | 20 | ||
| 17 | fetchfiles | 21 | fetchfiles |
| 18 | 22 | ||
| @@ -24,12 +28,12 @@ moveconfig | |||
| 24 | 28 | ||
| 25 | doinitramfs | 29 | doinitramfs |
| 26 | 30 | ||
| 27 | mkunitrd | 31 | mkuinitrd |
| 28 | 32 | ||
| 29 | copy_to_uboot | 33 | copy_to_uboot |
| 30 | 34 | ||
| 31 | echo "Making LITMUS the default ..." >&2 | 35 | echo "Making LITMUS the default ..." >&2 |
| 32 | mv $TMP_MOUNT/$SCRIPT_NAME $TMP_MOUNT/boot.scr | 36 | mv $UBOOT_PATH/$SCRIPT_FILE $UBOOT_PATH/boot.scr |
| 33 | echo "done." >&2 | 37 | echo "done." >&2 |
| 34 | 38 | ||
| 35 | rm_tmp_files | 39 | rm_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 | ||
| 3 | set -e | 3 | . $(dirname $0)/arm-installer-common.sh |
| 4 | 4 | ||
| 5 | error() { | 5 | # This is machine specific, AFAIK. |
| 6 | echo "$@" >&2 | 6 | LOAD_ADDR=0x80008000 |
| 7 | exit 1 | 7 | ENTRY_POINT=0x80008000 |
| 8 | } | ||
| 9 | 8 | ||
| 10 | TMP_MOUNT=$(mktemp -d) | 9 | TMP_MOUNT=$(mktemp -d) |
| 11 | 10 | ||
| 12 | # The FAT u-boot bootloader partition. | 11 | # The FAT u-boot bootloader partition. |
| 13 | UBOOT_PART=/dev/mmcblk0p1 | 12 | UBOOT_PART=/dev/mmcblk0p1 |
| 14 | 13 | ||
| 15 | # This is machine specific, AFAIK. | 14 | KVERSION=$(getversion) |
| 16 | LOAD_ADDR=0x80008000 | 15 | CONFIG_FILE="config-$KVERSION" |
| 17 | ENTRY_POINT=0x80008000 | ||
| 18 | |||
| 19 | getversion | ||
| 20 | 16 | ||
| 21 | fetchfiles | 17 | fetchfiles |
| 22 | 18 | ||
