-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathkernel_arm64_push.sh
executable file
·65 lines (53 loc) · 1.6 KB
/
kernel_arm64_push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Author: Jesper Dangaard Brouer <[email protected]>
# License: GPL
#
# This script "kernel_arm64_push.sh" rsync the kernel binaries + dtb file
# to a remote ARM64 board
export ARCH=arm64
t=/usr/bin/time
# exit script on any errors
set -e
if [ -n "$1" ]; then
export HOST=$1
else
if [ -z $HOST ]; then
echo "ERROR - Please specify HOSTNAME to push to!"
exit 1
fi
fi
# Target board for choosing correct DTS/DTB file (arch/arm64/boot/dts/)
if [ -n "$2" ]; then
TARGET=$2
echo "Using arch/arm64 DTS target: $TARGET"
fi
if [ -z "$VER" ]; then
export VER=`cat include/config/kernel.release`
fi
export KERNEL=$VER
if [ -z "$KERNEL" ]; then
echo "ERROR - Cannot detect the Kernel version you want to push"
exit 2
fi
IMAGE_FILE=arch/arm64/boot/Image
if [[ ! -e $IMAGE_FILE ]]; then
echo "ERROR - Cannot find ARM64 kernel image file"
exit 3
fi
if [ "$TARGET" == "mcbin" ]; then
DTS_FILE=arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtb
elif [ "$TARGET" == "espressobin" ]; then
DTS_FILE=arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtb
else
echo "Not updating board DTS/DTB"
fi
# If target specified push the DTS/DTB file
if [ -n "$DTS_FILE" ]; then
echo "Update DST/DTB file for target ARM64 board: $TARGET"
$t rsync -e ssh -av $DTS_FILE root@${HOST}:/boot/
fi
echo "-=-=-=- Pushing kernel:[$VER] to host:[$HOST] -=-=-=-"
$t rsync -e ssh -av $IMAGE_FILE root@${HOST}:/boot/
echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
echo "-=-=-=- DONE Pushed kernel:[$VER] to host:[$HOST] -=-=-=-"
echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"