-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path_shared_prologue
More file actions
56 lines (44 loc) · 1.36 KB
/
_shared_prologue
File metadata and controls
56 lines (44 loc) · 1.36 KB
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
#! /bin/bash
_rootdir=${_rootdir:-"$(dirname "$(readlink -f "$0")")"}
if [[ -z "$_rootdir" ]]; then
echo "Cannot derive root directory of the script $0" >&2
exit 1
fi
export LKHH_DIR=${LKHH_DIR:-$(dirname "$_rootdir")}
export LKHH_BIN=${LKHH_BIN:-$_rootdir}
export LKHH_ARENA=${LKHH_ARENA:-"$LKHH_DIR/arena"}
export LKHH_IMAGE=${LKHH_IMAGE:-"$LKHH_DIR/image"}
#
# Heuristics for identifying the kernel source rootdir to build.
#
function _lkhh_test_pwd_for_kernel_rootdir {
[[ -f Kbuild ]] && [[ -f Kconfig ]] && [[ -f Makefile ]]
}
if _lkhh_test_pwd_for_kernel_rootdir; then
export LKHH_LINUX=${LKHH_LINUX:-"$(readlink -f "$PWD")"}
else
export LKHH_LINUX=${LKHH_LINUX:-"$HOME/project/linux"}
fi
#
# Check validity of $LKHH_LINUX as a kernel source rootdir.
#
if ! pushd "$LKHH_LINUX" &>/dev/null; then
>/dev/stderr echo "Can not change into \"$LKHH_LINUX\"."
exit 1
elif ! _lkhh_test_pwd_for_kernel_rootdir; then
>/dev/stderr echo "$LKHH_LINUX is not a Linux kernel source rootdir."
popd &>/dev/null
exit 1
fi
popd &>/dev/null
unset -f _lkhh_test_pwd_for_kernel_rootdir
#
# https://bugzilla.redhat.com/show_bug.cgi?id=1528020
# Kernel building does not like a custom CPATH.
#
unset CPATH
_progname=${_progname:-"$(basename $0)"}
_ver=${_ver:-"0.0.1-dev"}
_author=${_author:-"Wei Peng <me@1pengw.com>"}
_verbose=0
source "$_rootdir/_shared_lib"