-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel_install.sh
executable file
·80 lines (66 loc) · 1.51 KB
/
kernel_install.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
until [ "${comfirm}" = "y" ]
do
check=""
until [ "${check}" = "y" ]
do
dev1=""
until [ -n "${dev1}" ]
do
read -p " [] Do you want install from
(1) tar.xz
(2) kernel folder
-> " tar
if [ ${tar} = "1" ]; then
sudo rm -rf arch
sudo rm -rf dist
tar Jxvf boot.tar.xz
tar Jxvf modules.tar.xz
fi
read -p " [] Where is your card reader?[eg] sdx
-> " reader
dev1=$(lsblk | grep "${reader}"1)
dev2=$(lsblk | grep "${reader}"2)
done
echo
echo ${dev1}
echo ${dev2}
echo
read -p " [] Is that correct?[y/n]
-> " check
done
path1=$(echo "$dev1" | grep -o "/media/.*")
path2=$(echo "$dev2" | grep -o "/media/.*")
echo
echo ${path1}
echo ${path2}
echo
read -p " [] Is the path correct?[y/n]
-> " comfirm
done
echo
read -p " [] What's your kernel name?
-> " name
echo " ** Installing kernel"
cp arch/arm/boot/zImage "${path1}"/"${name}"
sed -i '/kernel=/d' "${path1}"/config.txt
echo "kernel=${name}" | sudo tee --append "${path1}"/config.txt
echo
echo " ** Installing modules"
sudo cp -rp dist/lib/modules/* "${path2}"/lib/modules/
echo
echo " ** Installing dtb overlays"
rm -f "${path1}"/overlays/*
cp arch/arm/boot/dts/*.dtb* "${path1}"/
sed -i '/device_tree=/d' "${path1}"/config.txt
echo "device_tree=bcm2710-rpi-3-b.dtb" | sudo tee --append "${path1}"/config.txt
cp arch/arm/boot/dts/overlays/*.dtb* "${path1}"/overlays
echo
echo " ** Waiting for file system sync"
sync
read -p " [] Do you want to unmount SD card?[y/n]
-> " umount
if [ "${umount}" = "y" ]; then
sudo umount "${path1}"
sudo umount "${path2}"
fi