-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.sh
75 lines (62 loc) · 1.12 KB
/
lib.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
#!/bin/bash
get_remote()
{
path=pub/scm/linux/kernel/git/tegra/linux.git
var=$1
git remote -v | while read name url spec; do
case "$url" in
*.kernel.org:/$path | *.kernel.org:$path)
echo "$name"
break
;;
*)
;;
esac
done
}
function cross_compile_prepare()
{
local arch key value path
case $1 in
aarch64)
arch=arm64
;;
*)
arch=$1
;;
esac
if test -f "$HOME/.cross-compile"; then
while read key value; do
key="${key%:}"
if test "$key" = "path"; then
eval "value=$value"
if test -n "$path"; then
path="$path:$value"
else
path="$value"
fi
elif test "$key" = "$arch"; then
if test -n "$CROSS_COMPILE"; then
saved_CROSS_COMPILE="$CROSS_COMPILE"
fi
ARCH=$arch; CROSS_COMPILE="$value"
export ARCH CROSS_COMPILE
fi
done < "$HOME/.cross-compile"
fi
if test -n "$path"; then
saved_PATH="$PATH"
PATH="$path:$PATH"
fi
}
function cross_compile_cleanup()
{
if test -n "$saved_CROSS_COMPILE"; then
CROSS_COMPILE="$saved_CROSS_COMPILE"
else
unset CROSS_COMPILE
fi
if test -n "$saved_PATH"; then
PATH="$saved_PATH"
fi
}