-
Notifications
You must be signed in to change notification settings - Fork 4
/
kernel-modules
executable file
·131 lines (120 loc) · 2.93 KB
/
kernel-modules
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
#
# Copyright (C) 2020 Pig <[email protected]>
#
# Simple script to import/update kernel modules
# Version 0.3
#
source ~/bin/helper
# Aliases
cai='git commit --amend --no-edit'
ci='git commit --no-edit'
ds='drivers/staging'
f='git fetch caf'
fn='FETCH_HEAD --no-edit'
mo='git merge --allow-unrelated-histories -s ours --no-commit FETCH_HEAD'
ms='git merge -X subtree'
os='opensource'
qc='qcom'
r='git read-tree --prefix'
rm='https://source.codeaurora.org/quic/la/platform/vendor'
rma='git remote add caf'
sa='git subtree add --prefix'
tp='techpack'
uf='-u FETCH_HEAD'
wl=$qc-$os/wlan
# Read git cmd
function readcmd() {
if [ $cmd = 's' ]; then
$f/$mod $br && $sa=$dir caf/$mod $br && $cai
elif [ $cmd = 'm' ]; then
if [ $option = 'u' ]; then
$f/$mod $br && $ms=$dir $fn
else $f/$mod $br && $mo && $r=$dir $uf && $ci
fi
else die "Invalid target cmd, aborting!"
fi
}
# Indicate module directories
function indicatemodir() {
if [ $num = '1' ]; then
mod=qcacld-3.0
elif [ $num = '2' ]; then
mod=qca-wifi-host-cmn
elif [ $num = '3' ]; then
mod=fw-api
elif [ $num = '4' ]; then
mod=audio-kernel
dir=$tp/audio
elif [ $num = '5' ]; then
mod=data-kernel
dir=$tp/data
elif [ $num = '6' ]; then
mod=camera-kernel
dir=$tp/camera
else die "Invalid target input, aborting!"
fi
if [ $num -eq '1' ] || [ $num -eq '2' ] || [ $num -eq '3' ]; then
dir=$ds/$mod
fi
}
# Add remote
function addremote() {
if [ $num -eq '1' ] || [ $num -eq '2' ] || [ $num -eq '3' ]; then
$rma/$mod $rm/$wl/$mod
elif [ $num -eq '5' ]; then
$rma/$mod $rm/$qc-$os/$mod
elif [ $num -eq '4' ] || [ $num -eq '6' ] ; then
$rma/$mod $rm/$os/$mod
fi
}
# Initialize
function init() {
header "Available modules"
info "1.qcacld-3.0\n2.qca-wifi-host-cmn\n3.fw-api\n4.audio-kernel\n5.data-kernel\n6.camera-kernel"
read -p "Target kernel module: " num
case $num in
1 | 2 | 3 | 4 | 5 | 6)
read -p "Target tag / branch: " br
read -p "Import (i) / Update (u): " option
if [ $option != u ]; then
read -p "Target cmd: merge (m) subtree (s) " cmd
else cmd=m
fi
esac
}
# Import modules
function import() {
addremote
success "Add remote for target module ${mod} done."
case $mod in
qcacld-3.0 | qca-wifi-host-cmn | fw-api | audio-kernel | data-kernel | camera-kernel)
readcmd
success "Import from target ${br} for target ${mod} done."
esac
}
# Update modules
function update() {
case $mod in
qcacld-3.0 | qca-wifi-host-cmn | fw-api | audio-kernel | data-kernel | camera-kernel)
readcmd
success "Update to target ${br} for target module ${mod} done."
esac
}
# Process import or update
function process() {
case $option in
i)
import
;;
u)
update
;;
*)
die "Invalid target option, aborting!"
;;
esac
}
init
indicatemodir
process