-
Notifications
You must be signed in to change notification settings - Fork 23
/
03-install-kernel.sh
executable file
·62 lines (51 loc) · 1.43 KB
/
03-install-kernel.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
#!/bin/bash
set -e
source .env
echo "===================="
echo "03-install-kernel.sh"
echo "===================="
# Functions
infecho () {
echo "[Info] $1"
}
# Notify User
infecho "The env vars that will be used in this script..."
infecho "PP_SD_DEVICE = $PP_IMAGE"
infecho "PP_PARTA = $PP_PARTA"
infecho "PP_PARTB = $PP_PARTB"
echo
# Automatic Preflight Checks
if [[ $EUID -ne 0 ]]; then
errecho "This script must be run as root!"
exit 1
fi
# Warning
echo "=== WARNING WARNING WARNING ==="
infecho "This script USES THE DD COMMAND AS ROOT. If the env vars are wrong, this could do something bad."
infecho "Make sure this script is run from the main dir of the repo, since it assumes that's true."
infecho "Also, I didn't test this so it might also cause WWIII or something."
infecho "I'm not responsible for anything that happens, you should read the script first."
echo "=== WARNING WARNING WARNING ==="
echo
if [ ! -z "$PS1" ]; then
read -p "Continue? [y/N] " -n 1 -r
else
REPLY=y
fi
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd uboot
infecho "Writing bootloader..."
dd if=u-boot-sunxi-with-spl.bin of=$PP_IMAGE bs=1024 seek=8
infecho "Changing directory back..."
cd ../
infecho "Mounting SD card partitions..."
mkdir -p bootfs
mount $PP_PARTA bootfs
infecho "Copying boot.scr..."
cp files/boot.scr bootfs/
infecho "Unmounting SD card partitions..."
umount $PP_PARTA
rmdir bootfs
fi