blob: ab36fb775d778d2b33c80be1c76b47ab578c2804 (
plain) (
blame)
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
|
SHORT_OPTS=":vbcfdh"
LONG_OPTS="version,build,clean,force,debug,help"
KERNEL="kernel-preboot-latest"
INITRAMFS="initramfs-default"
LOG_DIR="/tmp/pbmtk"
run_module_checks () {
if [ ! -z $1 ]; then
perror "Too many parameters. \n"
print_usage
exit 1
fi
if [ -z $(which make) ]; then
perror "buildutils are missing (if you are on a debian/ubuntu system: apt-get install ..)"
exit 1
fi
}
init_params () {
FORCE=0
DEBUG=0
TARGET_KERNEL=0
TARGET_INIT=0
CLEAN=0
BUILD=0
}
print_usage() {
unset_quiet
echo "Usage: $(basename $SELF) env [OPTIONS] TARGET"
echo -e " -b --build \t build"
echo -e " -c --clean \t remove all temporary stuff"
echo -e " -d --debug \t give more debug output"
echo -e " -f --force \t don't ask questions"
echo -e " -h --help \t print help"
echo -e " -v --version \t print version information"
echo -e "TARGET can be kernel, initramfs or all"
}
read_params() {
getopt_start $@
eval set -- "$GETOPT_TEMP"
while true ; do
case "$1" in
-v|--version)
echo "OpenSLX PreBoot .. ($VERSION - $VDATE)."
exit 0
;;
-h|--help)
print_usage
exit 0
;;
-f|--force) pinfo "Disable user-interaction."; FORCE=1; shift ;;
-b|--build)
BUILD=1
shift
;;
-c|--clean) pinfo "Clean setup."; CLEAN=1; shift ;;
-d|--debug) pinfo "Enabled debugmode."; DEBUG=1; unset_quiet; shift ;;
--) shift ; break ;;
*) perror "Internal error!" ; exit 1 ;;
esac
done
TARGET=$1
shift
case "$TARGET" in
kernel)
TARGET_KERNEL=1
msg="kernel"
;;
initramfs)
TARGET_INIT=1
msg="initramfs"
;;
all)
TARGET_INIT=1
TARGET_KERNEL=1
msg="kernel, initramfs"
;;
*)
perror "Missing valid TARGET for build.\n"
print_usage
exit 1
;;
esac
if [ -z $TARGET ]; then
perror "Missing valid TARGET for build.\n"
print_usage
exit 1
fi
}
run () {
#set_quiet
if [ "x$CLEAN" = "x1" ]; then
[ "x$TARGET_INIT" = "x1" ] && rm -rf $ROOT_DIR/contrib/syslinux/sys*
[ "x$TARGET_KERNEL" = "x1" ] && rm -rf $ROOT_DIR/build/linux-*
fi
[ "x$TARGET_KERNEL" = "x1" ] && $ROOT_DIR/bin/build.kernel.sh
[ "x$TARGET_INIT" = "x1" ] && $ROOT_DIR/bin/build.initramfs.sh
#unset_quiet
pinfo "FINISHED"
}
|