-
Notifications
You must be signed in to change notification settings - Fork 0
/
debian.sh
executable file
·98 lines (85 loc) · 2.41 KB
/
debian.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
#
# Copyrigh: Voipac s.r.o.
# Author: Marek Belisko <[email protected]>
#
set -x
PARAM_CMD="all"
SCRIPT_NAME=${0##*/}
function usage()
{
echo "Make Debian image and create a bootabled SD card"
echo
echo "Usage:"
echo " MACHINE=imx8mq-voipac|imx93-voipac ./${SCRIPT_NAME} options"
echo
echo "Options:"
echo " -h|--help -- print this help"
echo " -c|--cmd <command>"
echo " Supported commands:"
echo " all -- build or rebuild kernel/bootloader/rootfs"
echo " bootloader -- build or rebuild U-Boot"
echo " kernel -- build or rebuild the Linux kernel"
echo " rootfs -- build or rebuild the Debian root filesystem and create rootfs.tar.gz"
echo " (including: make & install Debian packages, firmware and kernel modules & headers)"
echo
}
## parse input arguments ##
readonly SHORTOPTS="c:o:d:h"
readonly LONGOPTS="cmd:,output:,dev:,help,debug"
ARGS=$(getopt -s bash --options ${SHORTOPTS} \
--longoptions ${LONGOPTS} --name "${SCRIPT_NAME}" -- "$@" )
eval set -- "$ARGS"
while true; do
case $1 in
-c|--cmd ) # script command
shift
PARAM_CMD="$1";
;;
-h|--help ) # get help
usage
exit 0;
;;
-- )
shift
break
;;
* )
shift
break
;;
esac
shift
done
if [ -z "${MACHINE}" ]; then
echo "Undefined machine."
usage
exit 1
fi
# prepare sources if do not exists yet
source helpers/commands_prepare.sh
source helpers/make_debian_image.sh
cmd_make_prepare
case $PARAM_CMD in
rootfs )
cmd_make_rootfs
;;
bootloader )
cmd_make_uboot
;;
kernel )
cmd_make_kernel
;;
all )
cmd_make_uboot &&
cmd_make_kernel &&
cmd_make_rootfs
cmd_make_sdimg
;;
clean )
cmd_make_clean
;;
* )
echo "Invalid input command: \"${PARAM_CMD}\"";
;;
esac