@@ -1,499 +1,499 | |||||
1 | # |
|
1 | # | |
2 | # Build and Setup RPi2/3 Kernel |
|
2 | # Build and Setup RPi2/3 Kernel | |
3 | # |
|
3 | # | |
4 |
|
4 | |||
5 | # Load utility functions |
|
5 | # Load utility functions | |
6 | . ./functions.sh |
|
6 | . ./functions.sh | |
7 |
|
7 | |||
8 | # Need to use kali kernel src if nexmon is enabled |
|
8 | # Need to use kali kernel src if nexmon is enabled | |
9 | if [ "$ENABLE_NEXMON" = true ] ; then |
|
9 | if [ "$ENABLE_NEXMON" = true ] ; then | |
10 |
KERNEL_URL="${ |
|
10 | KERNEL_URL="${KALI_KERNEL_URL}" | |
11 | fi |
|
11 | fi | |
12 |
|
12 | |||
13 | # Fetch and build latest raspberry kernel |
|
13 | # Fetch and build latest raspberry kernel | |
14 | if [ "$BUILD_KERNEL" = true ] ; then |
|
14 | if [ "$BUILD_KERNEL" = true ] ; then | |
15 | echo "WARNING: if ENABLE_NEXMON is used remember to put the CORRECT KERNELSRC IN KERNELSRC_DIR!!!!!1!" |
|
15 | echo "WARNING: if ENABLE_NEXMON is used remember to put the CORRECT KERNELSRC IN KERNELSRC_DIR!!!!!1!" | |
16 | # Setup source directory |
|
16 | # Setup source directory | |
17 | mkdir -p "${KERNEL_DIR}" |
|
17 | mkdir -p "${KERNEL_DIR}" | |
18 |
|
18 | |||
19 | # Copy existing kernel sources into chroot directory |
|
19 | # Copy existing kernel sources into chroot directory | |
20 | if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then |
|
20 | if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then | |
21 | # Copy kernel sources and include hidden files |
|
21 | # Copy kernel sources and include hidden files | |
22 | cp -r "${KERNELSRC_DIR}/". "${KERNEL_DIR}" |
|
22 | cp -r "${KERNELSRC_DIR}/". "${KERNEL_DIR}" | |
23 |
|
23 | |||
24 | # Clean the kernel sources |
|
24 | # Clean the kernel sources | |
25 | if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then |
|
25 | if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then | |
26 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper |
|
26 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper | |
27 | fi |
|
27 | fi | |
28 | else # KERNELSRC_DIR="" |
|
28 | else # KERNELSRC_DIR="" | |
29 | # Create temporary directory for kernel sources |
|
29 | # Create temporary directory for kernel sources | |
30 | temp_dir=$(as_nobody mktemp -d) |
|
30 | temp_dir=$(as_nobody mktemp -d) | |
31 |
|
31 | |||
32 | # Fetch current RPi2/3 kernel sources |
|
32 | # Fetch current RPi2/3 kernel sources | |
33 | if [ -z "${KERNEL_BRANCH}" ] ; then |
|
33 | if [ -z "${KERNEL_BRANCH}" ] ; then | |
34 | as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux |
|
34 | as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux | |
35 | else |
|
35 | else | |
36 | as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux |
|
36 | as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux | |
37 | fi |
|
37 | fi | |
38 |
|
38 | |||
39 | # Copy downloaded kernel sources |
|
39 | # Copy downloaded kernel sources | |
40 | cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}" |
|
40 | cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}" | |
41 |
|
41 | |||
42 | # Remove temporary directory for kernel sources |
|
42 | # Remove temporary directory for kernel sources | |
43 | rm -fr "${temp_dir}" |
|
43 | rm -fr "${temp_dir}" | |
44 |
|
44 | |||
45 | # Set permissions of the kernel sources |
|
45 | # Set permissions of the kernel sources | |
46 | chown -R root:root "${R}/usr/src" |
|
46 | chown -R root:root "${R}/usr/src" | |
47 | fi |
|
47 | fi | |
48 |
|
48 | |||
49 | # Calculate optimal number of kernel building threads |
|
49 | # Calculate optimal number of kernel building threads | |
50 | if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then |
|
50 | if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then | |
51 | KERNEL_THREADS=$(grep -c processor /proc/cpuinfo) |
|
51 | KERNEL_THREADS=$(grep -c processor /proc/cpuinfo) | |
52 | fi |
|
52 | fi | |
53 |
|
53 | |||
54 | # Configure and build kernel |
|
54 | # Configure and build kernel | |
55 | if [ "$KERNELSRC_PREBUILT" = false ] ; then |
|
55 | if [ "$KERNELSRC_PREBUILT" = false ] ; then | |
56 | # Remove device, network and filesystem drivers from kernel configuration |
|
56 | # Remove device, network and filesystem drivers from kernel configuration | |
57 | if [ "$KERNEL_REDUCE" = true ] ; then |
|
57 | if [ "$KERNEL_REDUCE" = true ] ; then | |
58 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" |
|
58 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" | |
59 | sed -i\ |
|
59 | sed -i\ | |
60 | -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\ |
|
60 | -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\ | |
61 | -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\ |
|
61 | -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\ | |
62 | -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\ |
|
62 | -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\ | |
63 | -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\ |
|
63 | -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\ | |
64 | -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\ |
|
64 | -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\ | |
65 | -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\ |
|
65 | -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\ | |
66 | -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\ |
|
66 | -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\ | |
67 | -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\ |
|
67 | -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\ | |
68 | -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\ |
|
68 | -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\ | |
69 | -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\ |
|
69 | -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\ | |
70 | -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\ |
|
70 | -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\ | |
71 | -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\ |
|
71 | -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\ | |
72 | -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\ |
|
72 | -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\ | |
73 | -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\ |
|
73 | -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\ | |
74 | -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\ |
|
74 | -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\ | |
75 | -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\ |
|
75 | -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\ | |
76 | -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\ |
|
76 | -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\ | |
77 | -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\ |
|
77 | -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\ | |
78 | -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\ |
|
78 | -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\ | |
79 | -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\ |
|
79 | -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\ | |
80 | -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\ |
|
80 | -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\ | |
81 | -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\ |
|
81 | -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\ | |
82 | -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\ |
|
82 | -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\ | |
83 | -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\ |
|
83 | -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\ | |
84 | -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\ |
|
84 | -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\ | |
85 | -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\ |
|
85 | -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\ | |
86 | -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\ |
|
86 | -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\ | |
87 | -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\ |
|
87 | -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\ | |
88 | -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\ |
|
88 | -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\ | |
89 | "${KERNEL_DIR}/.config" |
|
89 | "${KERNEL_DIR}/.config" | |
90 | fi |
|
90 | fi | |
91 |
|
91 | |||
92 | if [ "$KERNELSRC_CONFIG" = true ] ; then |
|
92 | if [ "$KERNELSRC_CONFIG" = true ] ; then | |
93 | # Load default raspberry kernel configuration |
|
93 | # Load default raspberry kernel configuration | |
94 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" |
|
94 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}" | |
95 |
|
95 | |||
96 | #Switch to KERNELSRC_DIR so we can use set_kernel_config |
|
96 | #Switch to KERNELSRC_DIR so we can use set_kernel_config | |
97 | cd "${KERNEL_DIR}" || exit |
|
97 | cd "${KERNEL_DIR}" || exit | |
98 |
|
98 | |||
99 | # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap |
|
99 | # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap | |
100 | if [ "$KERNEL_ZSWAP" = true ] ; then |
|
100 | if [ "$KERNEL_ZSWAP" = true ] ; then | |
101 | set_kernel_config CONFIG_ZPOOL y |
|
101 | set_kernel_config CONFIG_ZPOOL y | |
102 | set_kernel_config CONFIG_ZSWAP y |
|
102 | set_kernel_config CONFIG_ZSWAP y | |
103 | set_kernel_config CONFIG_ZBUD y |
|
103 | set_kernel_config CONFIG_ZBUD y | |
104 | set_kernel_config CONFIG_Z3FOLD y |
|
104 | set_kernel_config CONFIG_Z3FOLD y | |
105 | set_kernel_config CONFIG_ZSMALLOC y |
|
105 | set_kernel_config CONFIG_ZSMALLOC y | |
106 | set_kernel_config CONFIG_PGTABLE_MAPPING y |
|
106 | set_kernel_config CONFIG_PGTABLE_MAPPING y | |
107 | fi |
|
107 | fi | |
108 |
|
108 | |||
109 | # enable basic KVM support; see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453 |
|
109 | # enable basic KVM support; see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453 | |
110 | if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then |
|
110 | if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then | |
111 | set_kernel_config CONFIG_VIRTUALIZATION y |
|
111 | set_kernel_config CONFIG_VIRTUALIZATION y | |
112 | set_kernel_config CONFIG_KVM y |
|
112 | set_kernel_config CONFIG_KVM y | |
113 | set_kernel_config CONFIG_VHOST_NET m |
|
113 | set_kernel_config CONFIG_VHOST_NET m | |
114 | set_kernel_config CONFIG_VHOST_CROSS_ENDIAN_LEGACY y |
|
114 | set_kernel_config CONFIG_VHOST_CROSS_ENDIAN_LEGACY y | |
115 | fi |
|
115 | fi | |
116 |
|
116 | |||
117 | # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406 |
|
117 | # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406 | |
118 | if [ "$KERNEL_NF" = true ] ; then |
|
118 | if [ "$KERNEL_NF" = true ] ; then | |
119 | set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m |
|
119 | set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m | |
120 | set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m |
|
120 | set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m | |
121 | set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m |
|
121 | set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m | |
122 | set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m |
|
122 | set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m | |
123 | set_kernel_config CONFIG_NFT_FIB_INET m |
|
123 | set_kernel_config CONFIG_NFT_FIB_INET m | |
124 | set_kernel_config CONFIG_NFT_FIB_IPV4 m |
|
124 | set_kernel_config CONFIG_NFT_FIB_IPV4 m | |
125 | set_kernel_config CONFIG_NFT_FIB_IPV6 m |
|
125 | set_kernel_config CONFIG_NFT_FIB_IPV6 m | |
126 | set_kernel_config CONFIG_NFT_FIB_NETDEV m |
|
126 | set_kernel_config CONFIG_NFT_FIB_NETDEV m | |
127 | set_kernel_config CONFIG_NFT_OBJREF m |
|
127 | set_kernel_config CONFIG_NFT_OBJREF m | |
128 | set_kernel_config CONFIG_NFT_RT m |
|
128 | set_kernel_config CONFIG_NFT_RT m | |
129 | set_kernel_config CONFIG_NFT_SET_BITMAP m |
|
129 | set_kernel_config CONFIG_NFT_SET_BITMAP m | |
130 | set_kernel_config CONFIG_NF_CONNTRACK_TIMEOUT y |
|
130 | set_kernel_config CONFIG_NF_CONNTRACK_TIMEOUT y | |
131 | set_kernel_config CONFIG_NF_LOG_ARP m |
|
131 | set_kernel_config CONFIG_NF_LOG_ARP m | |
132 | set_kernel_config CONFIG_NF_SOCKET_IPV4 m |
|
132 | set_kernel_config CONFIG_NF_SOCKET_IPV4 m | |
133 | set_kernel_config CONFIG_NF_SOCKET_IPV6 m |
|
133 | set_kernel_config CONFIG_NF_SOCKET_IPV6 m | |
134 | set_kernel_config CONFIG_BRIDGE_EBT_BROUTE m |
|
134 | set_kernel_config CONFIG_BRIDGE_EBT_BROUTE m | |
135 | set_kernel_config CONFIG_BRIDGE_EBT_T_FILTER m |
|
135 | set_kernel_config CONFIG_BRIDGE_EBT_T_FILTER m | |
136 | set_kernel_config CONFIG_BRIDGE_NF_EBTABLES m |
|
136 | set_kernel_config CONFIG_BRIDGE_NF_EBTABLES m | |
137 | set_kernel_config CONFIG_IP6_NF_IPTABLES m |
|
137 | set_kernel_config CONFIG_IP6_NF_IPTABLES m | |
138 | set_kernel_config CONFIG_IP6_NF_MATCH_AH m |
|
138 | set_kernel_config CONFIG_IP6_NF_MATCH_AH m | |
139 | set_kernel_config CONFIG_IP6_NF_MATCH_EUI64 m |
|
139 | set_kernel_config CONFIG_IP6_NF_MATCH_EUI64 m | |
140 | set_kernel_config CONFIG_IP6_NF_NAT m |
|
140 | set_kernel_config CONFIG_IP6_NF_NAT m | |
141 | set_kernel_config CONFIG_IP6_NF_TARGET_MASQUERADE m |
|
141 | set_kernel_config CONFIG_IP6_NF_TARGET_MASQUERADE m | |
142 | set_kernel_config CONFIG_IP6_NF_TARGET_NPT m |
|
142 | set_kernel_config CONFIG_IP6_NF_TARGET_NPT m | |
143 | set_kernel_config CONFIG_IP_SET_BITMAP_IPMAC m |
|
143 | set_kernel_config CONFIG_IP_SET_BITMAP_IPMAC m | |
144 | set_kernel_config CONFIG_IP_SET_BITMAP_PORT m |
|
144 | set_kernel_config CONFIG_IP_SET_BITMAP_PORT m | |
145 | set_kernel_config CONFIG_IP_SET_HASH_IP m |
|
145 | set_kernel_config CONFIG_IP_SET_HASH_IP m | |
146 | set_kernel_config CONFIG_IP_SET_HASH_IPMARK m |
|
146 | set_kernel_config CONFIG_IP_SET_HASH_IPMARK m | |
147 | set_kernel_config CONFIG_IP_SET_HASH_IPPORT m |
|
147 | set_kernel_config CONFIG_IP_SET_HASH_IPPORT m | |
148 | set_kernel_config CONFIG_IP_SET_HASH_IPPORTIP m |
|
148 | set_kernel_config CONFIG_IP_SET_HASH_IPPORTIP m | |
149 | set_kernel_config CONFIG_IP_SET_HASH_IPPORTNET m |
|
149 | set_kernel_config CONFIG_IP_SET_HASH_IPPORTNET m | |
150 | set_kernel_config CONFIG_IP_SET_HASH_MAC m |
|
150 | set_kernel_config CONFIG_IP_SET_HASH_MAC m | |
151 | set_kernel_config CONFIG_IP_SET_HASH_NET m |
|
151 | set_kernel_config CONFIG_IP_SET_HASH_NET m | |
152 | set_kernel_config CONFIG_IP_SET_HASH_NETIFACE m |
|
152 | set_kernel_config CONFIG_IP_SET_HASH_NETIFACE m | |
153 | set_kernel_config CONFIG_IP_SET_HASH_NETNET m |
|
153 | set_kernel_config CONFIG_IP_SET_HASH_NETNET m | |
154 | set_kernel_config CONFIG_IP_SET_HASH_NETPORT m |
|
154 | set_kernel_config CONFIG_IP_SET_HASH_NETPORT m | |
155 | set_kernel_config CONFIG_IP_SET_HASH_NETPORTNET m |
|
155 | set_kernel_config CONFIG_IP_SET_HASH_NETPORTNET m | |
156 | set_kernel_config CONFIG_IP_SET_LIST_SET m |
|
156 | set_kernel_config CONFIG_IP_SET_LIST_SET m | |
157 | set_kernel_config CONFIG_NETFILTER_XTABLES m |
|
157 | set_kernel_config CONFIG_NETFILTER_XTABLES m | |
158 | set_kernel_config CONFIG_NETFILTER_XTABLES m |
|
158 | set_kernel_config CONFIG_NETFILTER_XTABLES m | |
159 | set_kernel_config CONFIG_NFT_BRIDGE_META m |
|
159 | set_kernel_config CONFIG_NFT_BRIDGE_META m | |
160 | set_kernel_config CONFIG_NFT_BRIDGE_REJECT m |
|
160 | set_kernel_config CONFIG_NFT_BRIDGE_REJECT m | |
161 | set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV4 m |
|
161 | set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV4 m | |
162 | set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m |
|
162 | set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m | |
163 | set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV4 m |
|
163 | set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV4 m | |
164 | set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m |
|
164 | set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m | |
165 | set_kernel_config CONFIG_NFT_COMPAT m |
|
165 | set_kernel_config CONFIG_NFT_COMPAT m | |
166 | set_kernel_config CONFIG_NFT_COUNTER m |
|
166 | set_kernel_config CONFIG_NFT_COUNTER m | |
167 | set_kernel_config CONFIG_NFT_CT m |
|
167 | set_kernel_config CONFIG_NFT_CT m | |
168 | set_kernel_config CONFIG_NFT_DUP_IPV4 m |
|
168 | set_kernel_config CONFIG_NFT_DUP_IPV4 m | |
169 | set_kernel_config CONFIG_NFT_DUP_IPV6 m |
|
169 | set_kernel_config CONFIG_NFT_DUP_IPV6 m | |
170 | set_kernel_config CONFIG_NFT_DUP_NETDEV m |
|
170 | set_kernel_config CONFIG_NFT_DUP_NETDEV m | |
171 | set_kernel_config CONFIG_NFT_EXTHDR m |
|
171 | set_kernel_config CONFIG_NFT_EXTHDR m | |
172 | set_kernel_config CONFIG_NFT_FWD_NETDEV m |
|
172 | set_kernel_config CONFIG_NFT_FWD_NETDEV m | |
173 | set_kernel_config CONFIG_NFT_HASH m |
|
173 | set_kernel_config CONFIG_NFT_HASH m | |
174 | set_kernel_config CONFIG_NFT_LIMIT m |
|
174 | set_kernel_config CONFIG_NFT_LIMIT m | |
175 | set_kernel_config CONFIG_NFT_LOG m |
|
175 | set_kernel_config CONFIG_NFT_LOG m | |
176 | set_kernel_config CONFIG_NFT_MASQ m |
|
176 | set_kernel_config CONFIG_NFT_MASQ m | |
177 | set_kernel_config CONFIG_NFT_MASQ_IPV4 m |
|
177 | set_kernel_config CONFIG_NFT_MASQ_IPV4 m | |
178 | set_kernel_config CONFIG_NFT_MASQ_IPV6 m |
|
178 | set_kernel_config CONFIG_NFT_MASQ_IPV6 m | |
179 | set_kernel_config CONFIG_NFT_META m |
|
179 | set_kernel_config CONFIG_NFT_META m | |
180 | set_kernel_config CONFIG_NFT_NAT m |
|
180 | set_kernel_config CONFIG_NFT_NAT m | |
181 | set_kernel_config CONFIG_NFT_NUMGEN m |
|
181 | set_kernel_config CONFIG_NFT_NUMGEN m | |
182 | set_kernel_config CONFIG_NFT_QUEUE m |
|
182 | set_kernel_config CONFIG_NFT_QUEUE m | |
183 | set_kernel_config CONFIG_NFT_QUOTA m |
|
183 | set_kernel_config CONFIG_NFT_QUOTA m | |
184 | set_kernel_config CONFIG_NFT_REDIR m |
|
184 | set_kernel_config CONFIG_NFT_REDIR m | |
185 | set_kernel_config CONFIG_NFT_REDIR_IPV4 m |
|
185 | set_kernel_config CONFIG_NFT_REDIR_IPV4 m | |
186 | set_kernel_config CONFIG_NFT_REDIR_IPV6 m |
|
186 | set_kernel_config CONFIG_NFT_REDIR_IPV6 m | |
187 | set_kernel_config CONFIG_NFT_REJECT m |
|
187 | set_kernel_config CONFIG_NFT_REJECT m | |
188 | set_kernel_config CONFIG_NFT_REJECT_INET m |
|
188 | set_kernel_config CONFIG_NFT_REJECT_INET m | |
189 | set_kernel_config CONFIG_NFT_REJECT_IPV4 m |
|
189 | set_kernel_config CONFIG_NFT_REJECT_IPV4 m | |
190 | set_kernel_config CONFIG_NFT_REJECT_IPV6 m |
|
190 | set_kernel_config CONFIG_NFT_REJECT_IPV6 m | |
191 | set_kernel_config CONFIG_NFT_SET_HASH m |
|
191 | set_kernel_config CONFIG_NFT_SET_HASH m | |
192 | set_kernel_config CONFIG_NFT_SET_RBTREE m |
|
192 | set_kernel_config CONFIG_NFT_SET_RBTREE m | |
193 | set_kernel_config CONFIG_NF_CONNTRACK_IPV4 m |
|
193 | set_kernel_config CONFIG_NF_CONNTRACK_IPV4 m | |
194 | set_kernel_config CONFIG_NF_CONNTRACK_IPV6 m |
|
194 | set_kernel_config CONFIG_NF_CONNTRACK_IPV6 m | |
195 | set_kernel_config CONFIG_NF_DEFRAG_IPV4 m |
|
195 | set_kernel_config CONFIG_NF_DEFRAG_IPV4 m | |
196 | set_kernel_config CONFIG_NF_DEFRAG_IPV6 m |
|
196 | set_kernel_config CONFIG_NF_DEFRAG_IPV6 m | |
197 | set_kernel_config CONFIG_NF_DUP_IPV4 m |
|
197 | set_kernel_config CONFIG_NF_DUP_IPV4 m | |
198 | set_kernel_config CONFIG_NF_DUP_IPV6 m |
|
198 | set_kernel_config CONFIG_NF_DUP_IPV6 m | |
199 | set_kernel_config CONFIG_NF_DUP_NETDEV m |
|
199 | set_kernel_config CONFIG_NF_DUP_NETDEV m | |
200 | set_kernel_config CONFIG_NF_LOG_BRIDGE m |
|
200 | set_kernel_config CONFIG_NF_LOG_BRIDGE m | |
201 | set_kernel_config CONFIG_NF_LOG_IPV4 m |
|
201 | set_kernel_config CONFIG_NF_LOG_IPV4 m | |
202 | set_kernel_config CONFIG_NF_LOG_IPV6 m |
|
202 | set_kernel_config CONFIG_NF_LOG_IPV6 m | |
203 | set_kernel_config CONFIG_NF_NAT_IPV4 m |
|
203 | set_kernel_config CONFIG_NF_NAT_IPV4 m | |
204 | set_kernel_config CONFIG_NF_NAT_IPV6 m |
|
204 | set_kernel_config CONFIG_NF_NAT_IPV6 m | |
205 | set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV4 m |
|
205 | set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV4 m | |
206 | set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV6 m |
|
206 | set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV6 m | |
207 | set_kernel_config CONFIG_NF_NAT_PPTP m |
|
207 | set_kernel_config CONFIG_NF_NAT_PPTP m | |
208 | set_kernel_config CONFIG_NF_NAT_PROTO_GRE m |
|
208 | set_kernel_config CONFIG_NF_NAT_PROTO_GRE m | |
209 | set_kernel_config CONFIG_NF_NAT_REDIRECT m |
|
209 | set_kernel_config CONFIG_NF_NAT_REDIRECT m | |
210 | set_kernel_config CONFIG_NF_NAT_SIP m |
|
210 | set_kernel_config CONFIG_NF_NAT_SIP m | |
211 | set_kernel_config CONFIG_NF_NAT_SNMP_BASIC m |
|
211 | set_kernel_config CONFIG_NF_NAT_SNMP_BASIC m | |
212 | set_kernel_config CONFIG_NF_NAT_TFTP m |
|
212 | set_kernel_config CONFIG_NF_NAT_TFTP m | |
213 | set_kernel_config CONFIG_NF_REJECT_IPV4 m |
|
213 | set_kernel_config CONFIG_NF_REJECT_IPV4 m | |
214 | set_kernel_config CONFIG_NF_REJECT_IPV6 m |
|
214 | set_kernel_config CONFIG_NF_REJECT_IPV6 m | |
215 | set_kernel_config CONFIG_NF_TABLES m |
|
215 | set_kernel_config CONFIG_NF_TABLES m | |
216 | set_kernel_config CONFIG_NF_TABLES_ARP m |
|
216 | set_kernel_config CONFIG_NF_TABLES_ARP m | |
217 | set_kernel_config CONFIG_NF_TABLES_BRIDGE m |
|
217 | set_kernel_config CONFIG_NF_TABLES_BRIDGE m | |
218 | set_kernel_config CONFIG_NF_TABLES_INET m |
|
218 | set_kernel_config CONFIG_NF_TABLES_INET m | |
219 | set_kernel_config CONFIG_NF_TABLES_IPV4 m |
|
219 | set_kernel_config CONFIG_NF_TABLES_IPV4 m | |
220 | set_kernel_config CONFIG_NF_TABLES_IPV6 m |
|
220 | set_kernel_config CONFIG_NF_TABLES_IPV6 m | |
221 | set_kernel_config CONFIG_NF_TABLES_NETDEV m |
|
221 | set_kernel_config CONFIG_NF_TABLES_NETDEV m | |
222 | fi |
|
222 | fi | |
223 |
|
223 | |||
224 | # Enables BPF syscall for systemd-journald see https://github.com/torvalds/linux/blob/master/init/Kconfig#L848 or https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA |
|
224 | # Enables BPF syscall for systemd-journald see https://github.com/torvalds/linux/blob/master/init/Kconfig#L848 or https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA | |
225 | if [ "$KERNEL_BPF" = true ] ; then |
|
225 | if [ "$KERNEL_BPF" = true ] ; then | |
226 | set_kernel_config CONFIG_BPF_SYSCALL y |
|
226 | set_kernel_config CONFIG_BPF_SYSCALL y | |
227 | set_kernel_config CONFIG_BPF_EVENTS y |
|
227 | set_kernel_config CONFIG_BPF_EVENTS y | |
228 | set_kernel_config CONFIG_BPF_STREAM_PARSER y |
|
228 | set_kernel_config CONFIG_BPF_STREAM_PARSER y | |
229 | set_kernel_config CONFIG_CGROUP_BPF y |
|
229 | set_kernel_config CONFIG_CGROUP_BPF y | |
230 | fi |
|
230 | fi | |
231 |
|
231 | |||
232 | # KERNEL_DEFAULT_GOV was set by user |
|
232 | # KERNEL_DEFAULT_GOV was set by user | |
233 | if ! [ "$KERNEL_DEFAULT_GOV" = POWERSAVE ] && [ -n "$KERNEL_DEFAULT_GOV" ]; then |
|
233 | if ! [ "$KERNEL_DEFAULT_GOV" = POWERSAVE ] && [ -n "$KERNEL_DEFAULT_GOV" ]; then | |
234 | # unset default governor |
|
234 | # unset default governor | |
235 | unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE |
|
235 | unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE | |
236 |
|
236 | |||
237 | case "$KERNEL_DEFAULT_GOV" in |
|
237 | case "$KERNEL_DEFAULT_GOV" in | |
238 | "PERFORMANCE") |
|
238 | "PERFORMANCE") | |
239 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y |
|
239 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y | |
240 | ;; |
|
240 | ;; | |
241 | "USERSPACE") |
|
241 | "USERSPACE") | |
242 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y |
|
242 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y | |
243 | ;; |
|
243 | ;; | |
244 | "ONDEMAND") |
|
244 | "ONDEMAND") | |
245 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y |
|
245 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y | |
246 | ;; |
|
246 | ;; | |
247 | "CONSERVATIVE") |
|
247 | "CONSERVATIVE") | |
248 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y |
|
248 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y | |
249 | ;; |
|
249 | ;; | |
250 | "CONSERVATIVE") |
|
250 | "CONSERVATIVE") | |
251 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y |
|
251 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y | |
252 | ;; |
|
252 | ;; | |
253 | *) |
|
253 | *) | |
254 | echo "error: unsupported default cpu governor" |
|
254 | echo "error: unsupported default cpu governor" | |
255 | exit 1 |
|
255 | exit 1 | |
256 | ;; |
|
256 | ;; | |
257 | esac |
|
257 | esac | |
258 | fi |
|
258 | fi | |
259 |
|
259 | |||
260 |
|
260 | |||
261 |
|
261 | |||
262 | #Revert to previous directory |
|
262 | #Revert to previous directory | |
263 | cd "${WORKDIR}" || exit |
|
263 | cd "${WORKDIR}" || exit | |
264 |
|
264 | |||
265 | # Set kernel configuration parameters to enable qemu emulation |
|
265 | # Set kernel configuration parameters to enable qemu emulation | |
266 | if [ "$ENABLE_QEMU" = true ] ; then |
|
266 | if [ "$ENABLE_QEMU" = true ] ; then | |
267 | echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config |
|
267 | echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config | |
268 | echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config |
|
268 | echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config | |
269 |
|
269 | |||
270 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
270 | if [ "$ENABLE_CRYPTFS" = true ] ; then | |
271 | { |
|
271 | { | |
272 | echo "CONFIG_EMBEDDED=y" |
|
272 | echo "CONFIG_EMBEDDED=y" | |
273 | echo "CONFIG_EXPERT=y" |
|
273 | echo "CONFIG_EXPERT=y" | |
274 | echo "CONFIG_DAX=y" |
|
274 | echo "CONFIG_DAX=y" | |
275 | echo "CONFIG_MD=y" |
|
275 | echo "CONFIG_MD=y" | |
276 | echo "CONFIG_BLK_DEV_MD=y" |
|
276 | echo "CONFIG_BLK_DEV_MD=y" | |
277 | echo "CONFIG_MD_AUTODETECT=y" |
|
277 | echo "CONFIG_MD_AUTODETECT=y" | |
278 | echo "CONFIG_BLK_DEV_DM=y" |
|
278 | echo "CONFIG_BLK_DEV_DM=y" | |
279 | echo "CONFIG_BLK_DEV_DM_BUILTIN=y" |
|
279 | echo "CONFIG_BLK_DEV_DM_BUILTIN=y" | |
280 | echo "CONFIG_DM_CRYPT=y" |
|
280 | echo "CONFIG_DM_CRYPT=y" | |
281 | echo "CONFIG_CRYPTO_BLKCIPHER=y" |
|
281 | echo "CONFIG_CRYPTO_BLKCIPHER=y" | |
282 | echo "CONFIG_CRYPTO_CBC=y" |
|
282 | echo "CONFIG_CRYPTO_CBC=y" | |
283 | echo "CONFIG_CRYPTO_XTS=y" |
|
283 | echo "CONFIG_CRYPTO_XTS=y" | |
284 | echo "CONFIG_CRYPTO_SHA512=y" |
|
284 | echo "CONFIG_CRYPTO_SHA512=y" | |
285 | echo "CONFIG_CRYPTO_MANAGER=y" |
|
285 | echo "CONFIG_CRYPTO_MANAGER=y" | |
286 | } >> "${KERNEL_DIR}"/.config |
|
286 | } >> "${KERNEL_DIR}"/.config | |
287 | fi |
|
287 | fi | |
288 | fi |
|
288 | fi | |
289 |
|
289 | |||
290 | # Copy custom kernel configuration file |
|
290 | # Copy custom kernel configuration file | |
291 | if [ -n "$KERNELSRC_USRCONFIG" ] ; then |
|
291 | if [ -n "$KERNELSRC_USRCONFIG" ] ; then | |
292 | cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config |
|
292 | cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config | |
293 | fi |
|
293 | fi | |
294 |
|
294 | |||
295 | # Set kernel configuration parameters to their default values |
|
295 | # Set kernel configuration parameters to their default values | |
296 | if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then |
|
296 | if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then | |
297 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig |
|
297 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig | |
298 | fi |
|
298 | fi | |
299 |
|
299 | |||
300 | # Start menu-driven kernel configuration (interactive) |
|
300 | # Start menu-driven kernel configuration (interactive) | |
301 | if [ "$KERNEL_MENUCONFIG" = true ] ; then |
|
301 | if [ "$KERNEL_MENUCONFIG" = true ] ; then | |
302 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig |
|
302 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig | |
303 | fi |
|
303 | fi | |
304 | # end if "$KERNELSRC_CONFIG" = true |
|
304 | # end if "$KERNELSRC_CONFIG" = true | |
305 | fi |
|
305 | fi | |
306 |
|
306 | |||
307 | # Use ccache to cross compile the kernel |
|
307 | # Use ccache to cross compile the kernel | |
308 | if [ "$KERNEL_CCACHE" = true ] ; then |
|
308 | if [ "$KERNEL_CCACHE" = true ] ; then | |
309 | cc="ccache ${CROSS_COMPILE}gcc" |
|
309 | cc="ccache ${CROSS_COMPILE}gcc" | |
310 | else |
|
310 | else | |
311 | cc="${CROSS_COMPILE}gcc" |
|
311 | cc="${CROSS_COMPILE}gcc" | |
312 | fi |
|
312 | fi | |
313 |
|
313 | |||
314 | # Cross compile kernel and dtbs |
|
314 | # Cross compile kernel and dtbs | |
315 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs |
|
315 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs | |
316 |
|
316 | |||
317 | # Cross compile kernel modules |
|
317 | # Cross compile kernel modules | |
318 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then |
|
318 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
319 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules |
|
319 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules | |
320 | fi |
|
320 | fi | |
321 | # end if "$KERNELSRC_PREBUILT" = false |
|
321 | # end if "$KERNELSRC_PREBUILT" = false | |
322 | fi |
|
322 | fi | |
323 |
|
323 | |||
324 | # Check if kernel compilation was successful |
|
324 | # Check if kernel compilation was successful | |
325 | if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then |
|
325 | if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then | |
326 | echo "error: kernel compilation failed! (kernel image not found)" |
|
326 | echo "error: kernel compilation failed! (kernel image not found)" | |
327 | cleanup |
|
327 | cleanup | |
328 | exit 1 |
|
328 | exit 1 | |
329 | fi |
|
329 | fi | |
330 |
|
330 | |||
331 | # Install kernel modules |
|
331 | # Install kernel modules | |
332 | if [ "$ENABLE_REDUCE" = true ] ; then |
|
332 | if [ "$ENABLE_REDUCE" = true ] ; then | |
333 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then |
|
333 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
334 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install |
|
334 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install | |
335 | fi |
|
335 | fi | |
336 | else |
|
336 | else | |
337 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then |
|
337 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
338 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install |
|
338 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install | |
339 | fi |
|
339 | fi | |
340 |
|
340 | |||
341 | # Install kernel firmware |
|
341 | # Install kernel firmware | |
342 | if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then |
|
342 | if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then | |
343 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install |
|
343 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install | |
344 | fi |
|
344 | fi | |
345 | fi |
|
345 | fi | |
346 |
|
346 | |||
347 | # Install kernel headers |
|
347 | # Install kernel headers | |
348 | if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then |
|
348 | if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then | |
349 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install |
|
349 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install | |
350 | fi |
|
350 | fi | |
351 | # make tar.gz kernel package - missing os bzw. modules |
|
351 | # make tar.gz kernel package - missing os bzw. modules | |
352 | #** ** ** WARNING ** ** ** |
|
352 | #** ** ** WARNING ** ** ** | |
353 | #Your architecture did not define any architecture-dependent files |
|
353 | #Your architecture did not define any architecture-dependent files | |
354 | #to be placed into the tarball. Please add those to ./scripts/package/buildtar . |
|
354 | #to be placed into the tarball. Please add those to ./scripts/package/buildtar . | |
355 | # make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" targz-pkg |
|
355 | # make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" targz-pkg | |
356 |
|
356 | |||
357 | # Prepare boot (firmware) directory |
|
357 | # Prepare boot (firmware) directory | |
358 | mkdir "${BOOT_DIR}" |
|
358 | mkdir "${BOOT_DIR}" | |
359 |
|
359 | |||
360 | # Get kernel release version |
|
360 | # Get kernel release version | |
361 | KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release") |
|
361 | KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release") | |
362 |
|
362 | |||
363 | # Copy kernel configuration file to the boot directory |
|
363 | # Copy kernel configuration file to the boot directory | |
364 | install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}" |
|
364 | install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}" | |
365 |
|
365 | |||
366 | # Prepare device tree directory |
|
366 | # Prepare device tree directory | |
367 | mkdir "${BOOT_DIR}/overlays" |
|
367 | mkdir "${BOOT_DIR}/overlays" | |
368 |
|
368 | |||
369 | # Ensure the proper .dtb is located |
|
369 | # Ensure the proper .dtb is located | |
370 | if [ "$KERNEL_ARCH" = "arm" ] ; then |
|
370 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |
371 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do |
|
371 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do | |
372 | if [ -f "${dtb}" ] ; then |
|
372 | if [ -f "${dtb}" ] ; then | |
373 | install_readonly "${dtb}" "${BOOT_DIR}/" |
|
373 | install_readonly "${dtb}" "${BOOT_DIR}/" | |
374 | fi |
|
374 | fi | |
375 | done |
|
375 | done | |
376 | else |
|
376 | else | |
377 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do |
|
377 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do | |
378 | if [ -f "${dtb}" ] ; then |
|
378 | if [ -f "${dtb}" ] ; then | |
379 | install_readonly "${dtb}" "${BOOT_DIR}/" |
|
379 | install_readonly "${dtb}" "${BOOT_DIR}/" | |
380 | fi |
|
380 | fi | |
381 | done |
|
381 | done | |
382 | fi |
|
382 | fi | |
383 |
|
383 | |||
384 | # Copy compiled dtb device tree files |
|
384 | # Copy compiled dtb device tree files | |
385 | if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then |
|
385 | if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then | |
386 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb ; do |
|
386 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb ; do | |
387 | if [ -f "${dtb}" ] ; then |
|
387 | if [ -f "${dtb}" ] ; then | |
388 | install_readonly "${dtb}" "${BOOT_DIR}/overlays/" |
|
388 | install_readonly "${dtb}" "${BOOT_DIR}/overlays/" | |
389 | fi |
|
389 | fi | |
390 | done |
|
390 | done | |
391 |
|
391 | |||
392 | if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then |
|
392 | if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then | |
393 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" |
|
393 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" | |
394 | fi |
|
394 | fi | |
395 | fi |
|
395 | fi | |
396 |
|
396 | |||
397 | if [ "$ENABLE_UBOOT" = false ] ; then |
|
397 | if [ "$ENABLE_UBOOT" = false ] ; then | |
398 | # Convert and copy kernel image to the boot directory |
|
398 | # Convert and copy kernel image to the boot directory | |
399 | "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" |
|
399 | "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" | |
400 | else |
|
400 | else | |
401 | # Copy kernel image to the boot directory |
|
401 | # Copy kernel image to the boot directory | |
402 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" |
|
402 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" | |
403 | fi |
|
403 | fi | |
404 |
|
404 | |||
405 | # Remove kernel sources |
|
405 | # Remove kernel sources | |
406 | if [ "$KERNEL_REMOVESRC" = true ] ; then |
|
406 | if [ "$KERNEL_REMOVESRC" = true ] ; then | |
407 | rm -fr "${KERNEL_DIR}" |
|
407 | rm -fr "${KERNEL_DIR}" | |
408 | else |
|
408 | else | |
409 | # Prepare compiled kernel modules |
|
409 | # Prepare compiled kernel modules | |
410 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then |
|
410 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
411 | if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then |
|
411 | if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then | |
412 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare |
|
412 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare | |
413 | fi |
|
413 | fi | |
414 |
|
414 | |||
415 | # Create symlinks for kernel modules |
|
415 | # Create symlinks for kernel modules | |
416 | chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build" |
|
416 | chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build" | |
417 | chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source" |
|
417 | chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source" | |
418 | fi |
|
418 | fi | |
419 | fi |
|
419 | fi | |
420 |
|
420 | |||
421 | else # BUILD_KERNEL=false |
|
421 | else # BUILD_KERNEL=false | |
422 | # echo Install precompiled kernel... |
|
422 | # echo Install precompiled kernel... | |
423 | # echo error: not implemented |
|
423 | # echo error: not implemented | |
424 | if [ "$SET_ARCH" = 64 ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then |
|
424 | if [ "$SET_ARCH" = 64 ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then | |
425 |
|
425 | |||
426 | # Use Sakakis modified kernel if ZSWAP is active |
|
426 | # Use Sakakis modified kernel if ZSWAP is active | |
427 | if [ "$KERNEL_ZSWAP" = true ] || [ "$KERNEL_VIRT" = true ] || [ "$KERNEL_NF" = true ] || [ "$KERNEL_BPF" = true ] ; then |
|
427 | if [ "$KERNEL_ZSWAP" = true ] || [ "$KERNEL_VIRT" = true ] || [ "$KERNEL_NF" = true ] || [ "$KERNEL_BPF" = true ] ; then | |
428 | RPI3_64_KERNEL_URL="${RPI3_64_BIS_KERNEL_URL}" |
|
428 | RPI3_64_KERNEL_URL="${RPI3_64_BIS_KERNEL_URL}" | |
429 | fi |
|
429 | fi | |
430 |
|
430 | |||
431 | # Create temporary directory for dl |
|
431 | # Create temporary directory for dl | |
432 | temp_dir=$(as_nobody mktemp -d) |
|
432 | temp_dir=$(as_nobody mktemp -d) | |
433 |
|
433 | |||
434 | # Fetch kernel dl |
|
434 | # Fetch kernel dl | |
435 | as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL" |
|
435 | as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL" | |
436 |
|
436 | |||
437 | #extract download |
|
437 | #extract download | |
438 | tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}" |
|
438 | tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}" | |
439 |
|
439 | |||
440 | #move extracted kernel to /boot/firmware |
|
440 | #move extracted kernel to /boot/firmware | |
441 | mkdir "${R}/boot/firmware" |
|
441 | mkdir "${R}/boot/firmware" | |
442 | cp "${temp_dir}"/boot/* "${R}"/boot/firmware/ |
|
442 | cp "${temp_dir}"/boot/* "${R}"/boot/firmware/ | |
443 | cp -r "${temp_dir}"/lib/* "${R}"/lib/ |
|
443 | cp -r "${temp_dir}"/lib/* "${R}"/lib/ | |
444 |
|
444 | |||
445 | # Remove temporary directory for kernel sources |
|
445 | # Remove temporary directory for kernel sources | |
446 | rm -fr "${temp_dir}" |
|
446 | rm -fr "${temp_dir}" | |
447 |
|
447 | |||
448 | # Set permissions of the kernel sources |
|
448 | # Set permissions of the kernel sources | |
449 | chown -R root:root "${R}/boot/firmware" |
|
449 | chown -R root:root "${R}/boot/firmware" | |
450 | chown -R root:root "${R}/lib/modules" |
|
450 | chown -R root:root "${R}/lib/modules" | |
451 | fi |
|
451 | fi | |
452 |
|
452 | |||
453 | # Install Kernel from hypriot comptabile with all Raspberry PI |
|
453 | # Install Kernel from hypriot comptabile with all Raspberry PI | |
454 | if [ "$SET_ARCH" = 32 ] ; then |
|
454 | if [ "$SET_ARCH" = 32 ] ; then | |
455 | # Create temporary directory for dl |
|
455 | # Create temporary directory for dl | |
456 | temp_dir=$(as_nobody mktemp -d) |
|
456 | temp_dir=$(as_nobody mktemp -d) | |
457 |
|
457 | |||
458 | # Fetch kernel |
|
458 | # Fetch kernel | |
459 | as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL" |
|
459 | as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL" | |
460 |
|
460 | |||
461 | # Copy downloaded U-Boot sources |
|
461 | # Copy downloaded U-Boot sources | |
462 | mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb |
|
462 | mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb | |
463 |
|
463 | |||
464 | # Set permissions |
|
464 | # Set permissions | |
465 | chown -R root:root "${R}"/tmp/kernel.deb |
|
465 | chown -R root:root "${R}"/tmp/kernel.deb | |
466 |
|
466 | |||
467 | # Install kernel |
|
467 | # Install kernel | |
468 | chroot_exec dpkg -i /tmp/kernel.deb |
|
468 | chroot_exec dpkg -i /tmp/kernel.deb | |
469 |
|
469 | |||
470 | # move /boot to /boot/firmware to fit script env. |
|
470 | # move /boot to /boot/firmware to fit script env. | |
471 | #mkdir "${BOOT_DIR}" |
|
471 | #mkdir "${BOOT_DIR}" | |
472 | mkdir "${temp_dir}"/firmware |
|
472 | mkdir "${temp_dir}"/firmware | |
473 | mv "${R}"/boot/* "${temp_dir}"/firmware/ |
|
473 | mv "${R}"/boot/* "${temp_dir}"/firmware/ | |
474 | mv "${temp_dir}"/firmware "${R}"/boot/ |
|
474 | mv "${temp_dir}"/firmware "${R}"/boot/ | |
475 |
|
475 | |||
476 | #same for kernel headers |
|
476 | #same for kernel headers | |
477 | if [ "$KERNEL_HEADERS" = true ] ; then |
|
477 | if [ "$KERNEL_HEADERS" = true ] ; then | |
478 | # Fetch kernel header |
|
478 | # Fetch kernel header | |
479 | as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL" |
|
479 | as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL" | |
480 | mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb |
|
480 | mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb | |
481 | chown -R root:root "${R}"/tmp/kernel-header.deb |
|
481 | chown -R root:root "${R}"/tmp/kernel-header.deb | |
482 | # Install kernel header |
|
482 | # Install kernel header | |
483 | chroot_exec dpkg -i /tmp/kernel-header.deb |
|
483 | chroot_exec dpkg -i /tmp/kernel-header.deb | |
484 | rm -f "${R}"/tmp/kernel-header.deb |
|
484 | rm -f "${R}"/tmp/kernel-header.deb | |
485 | fi |
|
485 | fi | |
486 |
|
486 | |||
487 | # Remove temporary directory and files |
|
487 | # Remove temporary directory and files | |
488 | rm -fr "${temp_dir}" |
|
488 | rm -fr "${temp_dir}" | |
489 | rm -f "${R}"/tmp/kernel.deb |
|
489 | rm -f "${R}"/tmp/kernel.deb | |
490 | fi |
|
490 | fi | |
491 |
|
491 | |||
492 | # Check if kernel installation was successful |
|
492 | # Check if kernel installation was successful | |
493 | KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)" |
|
493 | KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)" | |
494 | if [ -z "$KERNEL" ] ; then |
|
494 | if [ -z "$KERNEL" ] ; then | |
495 | echo "error: kernel installation failed! (/boot/kernel* not found)" |
|
495 | echo "error: kernel installation failed! (/boot/kernel* not found)" | |
496 | cleanup |
|
496 | cleanup | |
497 | exit 1 |
|
497 | exit 1 | |
498 | fi |
|
498 | fi | |
499 | fi |
|
499 | fi |
@@ -1,864 +1,866 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 | ######################################################################## |
|
2 | ######################################################################## | |
3 | # rpi23-gen-image.sh 2015-2017 |
|
3 | # rpi23-gen-image.sh 2015-2017 | |
4 | # |
|
4 | # | |
5 | # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi |
|
5 | # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi | |
6 | # |
|
6 | # | |
7 | # This program is free software; you can redistribute it and/or |
|
7 | # This program is free software; you can redistribute it and/or | |
8 | # modify it under the terms of the GNU General Public License |
|
8 | # modify it under the terms of the GNU General Public License | |
9 | # as published by the Free Software Foundation; either version 2 |
|
9 | # as published by the Free Software Foundation; either version 2 | |
10 | # of the License, or (at your option) any later version. |
|
10 | # of the License, or (at your option) any later version. | |
11 | # |
|
11 | # | |
12 | # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu> |
|
12 | # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu> | |
13 | # |
|
13 | # | |
14 | # Big thanks for patches and enhancements by 20+ github contributors! |
|
14 | # Big thanks for patches and enhancements by 20+ github contributors! | |
15 | ######################################################################## |
|
15 | ######################################################################## | |
16 |
|
16 | |||
17 | # Are we running as root? |
|
17 | # Are we running as root? | |
18 | if [ "$(id -u)" -ne "0" ] ; then |
|
18 | if [ "$(id -u)" -ne "0" ] ; then | |
19 | echo "error: this script must be executed with root privileges!" |
|
19 | echo "error: this script must be executed with root privileges!" | |
20 | exit 1 |
|
20 | exit 1 | |
21 | fi |
|
21 | fi | |
22 |
|
22 | |||
23 | # Check if ./functions.sh script exists |
|
23 | # Check if ./functions.sh script exists | |
24 | if [ ! -r "./functions.sh" ] ; then |
|
24 | if [ ! -r "./functions.sh" ] ; then | |
25 | echo "error: './functions.sh' required script not found!" |
|
25 | echo "error: './functions.sh' required script not found!" | |
26 | exit 1 |
|
26 | exit 1 | |
27 | fi |
|
27 | fi | |
28 |
|
28 | |||
29 | # Load utility functions |
|
29 | # Load utility functions | |
30 | . ./functions.sh |
|
30 | . ./functions.sh | |
31 |
|
31 | |||
32 | # Load parameters from configuration template file |
|
32 | # Load parameters from configuration template file | |
33 | if [ -n "$CONFIG_TEMPLATE" ] ; then |
|
33 | if [ -n "$CONFIG_TEMPLATE" ] ; then | |
34 | use_template |
|
34 | use_template | |
35 | fi |
|
35 | fi | |
36 |
|
36 | |||
37 | # Introduce settings |
|
37 | # Introduce settings | |
38 | set -e |
|
38 | set -e | |
39 | echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n" |
|
39 | echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n" | |
40 | set -x |
|
40 | set -x | |
41 |
|
41 | |||
42 | # Raspberry Pi model configuration |
|
42 | # Raspberry Pi model configuration | |
43 | RPI_MODEL=${RPI_MODEL:=2} |
|
43 | RPI_MODEL=${RPI_MODEL:=2} | |
44 |
|
44 | |||
45 | # Debian release |
|
45 | # Debian release | |
46 | RELEASE=${RELEASE:=buster} |
|
46 | RELEASE=${RELEASE:=buster} | |
47 |
|
47 | |||
48 | # Kernel Branch |
|
48 | # Kernel Branch | |
49 | KERNEL_BRANCH=${KERNEL_BRANCH:=""} |
|
49 | KERNEL_BRANCH=${KERNEL_BRANCH:=""} | |
50 |
|
50 | |||
51 | # URLs |
|
51 | # URLs | |
52 | KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} |
|
52 | KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} | |
53 | FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot} |
|
53 | FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot} | |
54 | WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm} |
|
54 | WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm} | |
55 | COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian} |
|
55 | COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian} | |
56 | FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} |
|
56 | FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} | |
57 | UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} |
|
57 | UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} | |
58 | VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland} |
|
58 | VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland} | |
59 | BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} |
|
59 | BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} | |
60 | NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git} |
|
60 | NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git} | |
61 | SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git} |
|
61 | SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git} | |
62 |
|
62 | |||
63 | # Kernel deb packages for 32bit kernel |
|
63 | # Kernel deb packages for 32bit kernel | |
64 | RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb} |
|
64 | RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb} | |
65 | RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb} |
|
65 | RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb} | |
66 | # Kernel has KVM and zswap enabled - use if KERNEL_* parameters and precompiled kernel are used |
|
66 | # Kernel has KVM and zswap enabled - use if KERNEL_* parameters and precompiled kernel are used | |
67 | RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel-bis/releases/download/4.14.80.20181113/bcmrpi3-kernel-bis-4.14.80.20181113.tar.xz} |
|
67 | RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel-bis/releases/download/4.14.80.20181113/bcmrpi3-kernel-bis-4.14.80.20181113.tar.xz} | |
68 | # Default precompiled 64bit kernel |
|
68 | # Default precompiled 64bit kernel | |
69 | RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.14.80.20181113/bcmrpi3-kernel-4.14.80.20181113.tar.xz} |
|
69 | RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.14.80.20181113/bcmrpi3-kernel-4.14.80.20181113.tar.xz} | |
70 | # Generic |
|
70 | # Generic | |
71 | RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL} |
|
71 | RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL} | |
|
72 | # Kali kernel src - used if ENABLE_NEXMON=true (they patch the wlan kernel modul) | |||
|
73 | KALI_KERNEL_URL=${KALI_KERNEL_URL:=https://github.com/Re4son/re4son-raspberrypi-linux.git} | |||
72 |
|
74 | |||
73 | # Build directories |
|
75 | # Build directories | |
74 | WORKDIR=$(pwd) |
|
76 | WORKDIR=$(pwd) | |
75 | BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}} |
|
77 | BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}} | |
76 | BUILDDIR="${BASEDIR}/build" |
|
78 | BUILDDIR="${BASEDIR}/build" | |
77 |
|
79 | |||
78 | # Chroot directories |
|
80 | # Chroot directories | |
79 | R="${BUILDDIR}/chroot" |
|
81 | R="${BUILDDIR}/chroot" | |
80 | ETC_DIR="${R}/etc" |
|
82 | ETC_DIR="${R}/etc" | |
81 | LIB_DIR="${R}/lib" |
|
83 | LIB_DIR="${R}/lib" | |
82 | BOOT_DIR="${R}/boot/firmware" |
|
84 | BOOT_DIR="${R}/boot/firmware" | |
83 | KERNEL_DIR="${R}/usr/src/linux" |
|
85 | KERNEL_DIR="${R}/usr/src/linux" | |
84 | WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm" |
|
86 | WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm" | |
85 | BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt" |
|
87 | BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt" | |
86 |
|
88 | |||
87 | # Firmware directory: Blank if download from github |
|
89 | # Firmware directory: Blank if download from github | |
88 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} |
|
90 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} | |
89 |
|
91 | |||
90 | # General settings |
|
92 | # General settings | |
91 | SET_ARCH=${SET_ARCH:=32} |
|
93 | SET_ARCH=${SET_ARCH:=32} | |
92 | HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} |
|
94 | HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} | |
93 | PASSWORD=${PASSWORD:=raspberry} |
|
95 | PASSWORD=${PASSWORD:=raspberry} | |
94 | USER_PASSWORD=${USER_PASSWORD:=raspberry} |
|
96 | USER_PASSWORD=${USER_PASSWORD:=raspberry} | |
95 | DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} |
|
97 | DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} | |
96 | TIMEZONE=${TIMEZONE:="Europe/Berlin"} |
|
98 | TIMEZONE=${TIMEZONE:="Europe/Berlin"} | |
97 | EXPANDROOT=${EXPANDROOT:=true} |
|
99 | EXPANDROOT=${EXPANDROOT:=true} | |
98 |
|
100 | |||
99 | # Keyboard settings |
|
101 | # Keyboard settings | |
100 | XKB_MODEL=${XKB_MODEL:=""} |
|
102 | XKB_MODEL=${XKB_MODEL:=""} | |
101 | XKB_LAYOUT=${XKB_LAYOUT:=""} |
|
103 | XKB_LAYOUT=${XKB_LAYOUT:=""} | |
102 | XKB_VARIANT=${XKB_VARIANT:=""} |
|
104 | XKB_VARIANT=${XKB_VARIANT:=""} | |
103 | XKB_OPTIONS=${XKB_OPTIONS:=""} |
|
105 | XKB_OPTIONS=${XKB_OPTIONS:=""} | |
104 |
|
106 | |||
105 | # Network settings (DHCP) |
|
107 | # Network settings (DHCP) | |
106 | ENABLE_DHCP=${ENABLE_DHCP:=true} |
|
108 | ENABLE_DHCP=${ENABLE_DHCP:=true} | |
107 |
|
109 | |||
108 | # Network settings (static) |
|
110 | # Network settings (static) | |
109 | NET_ADDRESS=${NET_ADDRESS:=""} |
|
111 | NET_ADDRESS=${NET_ADDRESS:=""} | |
110 | NET_GATEWAY=${NET_GATEWAY:=""} |
|
112 | NET_GATEWAY=${NET_GATEWAY:=""} | |
111 | NET_DNS_1=${NET_DNS_1:=""} |
|
113 | NET_DNS_1=${NET_DNS_1:=""} | |
112 | NET_DNS_2=${NET_DNS_2:=""} |
|
114 | NET_DNS_2=${NET_DNS_2:=""} | |
113 | NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""} |
|
115 | NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""} | |
114 | NET_NTP_1=${NET_NTP_1:=""} |
|
116 | NET_NTP_1=${NET_NTP_1:=""} | |
115 | NET_NTP_2=${NET_NTP_2:=""} |
|
117 | NET_NTP_2=${NET_NTP_2:=""} | |
116 |
|
118 | |||
117 | # APT settings |
|
119 | # APT settings | |
118 | APT_PROXY=${APT_PROXY:=""} |
|
120 | APT_PROXY=${APT_PROXY:=""} | |
119 | APT_SERVER=${APT_SERVER:="ftp.debian.org"} |
|
121 | APT_SERVER=${APT_SERVER:="ftp.debian.org"} | |
120 |
|
122 | |||
121 | # Feature settings |
|
123 | # Feature settings | |
122 | ENABLE_PRINTK=${ENABLE_PRINTK:=false} |
|
124 | ENABLE_PRINTK=${ENABLE_PRINTK:=false} | |
123 | ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false} |
|
125 | ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false} | |
124 | ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false} |
|
126 | ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false} | |
125 | ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} |
|
127 | ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} | |
126 | ENABLE_I2C=${ENABLE_I2C:=false} |
|
128 | ENABLE_I2C=${ENABLE_I2C:=false} | |
127 | ENABLE_SPI=${ENABLE_SPI:=false} |
|
129 | ENABLE_SPI=${ENABLE_SPI:=false} | |
128 | ENABLE_IPV6=${ENABLE_IPV6:=true} |
|
130 | ENABLE_IPV6=${ENABLE_IPV6:=true} | |
129 | ENABLE_SSHD=${ENABLE_SSHD:=true} |
|
131 | ENABLE_SSHD=${ENABLE_SSHD:=true} | |
130 | ENABLE_NONFREE=${ENABLE_NONFREE:=false} |
|
132 | ENABLE_NONFREE=${ENABLE_NONFREE:=false} | |
131 | ENABLE_WIRELESS=${ENABLE_WIRELESS:=false} |
|
133 | ENABLE_WIRELESS=${ENABLE_WIRELESS:=false} | |
132 | ENABLE_SOUND=${ENABLE_SOUND:=true} |
|
134 | ENABLE_SOUND=${ENABLE_SOUND:=true} | |
133 | ENABLE_DBUS=${ENABLE_DBUS:=true} |
|
135 | ENABLE_DBUS=${ENABLE_DBUS:=true} | |
134 | ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true} |
|
136 | ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true} | |
135 | ENABLE_MINGPU=${ENABLE_MINGPU:=false} |
|
137 | ENABLE_MINGPU=${ENABLE_MINGPU:=false} | |
136 | ENABLE_XORG=${ENABLE_XORG:=false} |
|
138 | ENABLE_XORG=${ENABLE_XORG:=false} | |
137 | ENABLE_WM=${ENABLE_WM:=""} |
|
139 | ENABLE_WM=${ENABLE_WM:=""} | |
138 | ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true} |
|
140 | ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true} | |
139 | ENABLE_USER=${ENABLE_USER:=true} |
|
141 | ENABLE_USER=${ENABLE_USER:=true} | |
140 | USER_NAME=${USER_NAME:="pi"} |
|
142 | USER_NAME=${USER_NAME:="pi"} | |
141 | ENABLE_ROOT=${ENABLE_ROOT:=false} |
|
143 | ENABLE_ROOT=${ENABLE_ROOT:=false} | |
142 | ENABLE_QEMU=${ENABLE_QEMU:=false} |
|
144 | ENABLE_QEMU=${ENABLE_QEMU:=false} | |
143 | ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false} |
|
145 | ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false} | |
144 |
|
146 | |||
145 | # SSH settings |
|
147 | # SSH settings | |
146 | SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} |
|
148 | SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} | |
147 | SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false} |
|
149 | SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false} | |
148 | SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false} |
|
150 | SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false} | |
149 | SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""} |
|
151 | SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""} | |
150 | SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""} |
|
152 | SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""} | |
151 |
|
153 | |||
152 | # Advanced settings |
|
154 | # Advanced settings | |
153 | ENABLE_SYSTEMDSWAP=${ENABLE_MINBASE:=false} |
|
155 | ENABLE_SYSTEMDSWAP=${ENABLE_MINBASE:=false} | |
154 | ENABLE_MINBASE=${ENABLE_MINBASE:=false} |
|
156 | ENABLE_MINBASE=${ENABLE_MINBASE:=false} | |
155 | ENABLE_REDUCE=${ENABLE_REDUCE:=false} |
|
157 | ENABLE_REDUCE=${ENABLE_REDUCE:=false} | |
156 | ENABLE_UBOOT=${ENABLE_UBOOT:=false} |
|
158 | ENABLE_UBOOT=${ENABLE_UBOOT:=false} | |
157 | UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} |
|
159 | UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} | |
158 | ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false} |
|
160 | ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false} | |
159 | ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} |
|
161 | ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} | |
160 | ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false} |
|
162 | ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false} | |
161 | ENABLE_NEXMON=${ENABLE_NEXMON:=false} |
|
163 | ENABLE_NEXMON=${ENABLE_NEXMON:=false} | |
162 | VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""} |
|
164 | VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""} | |
163 | FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} |
|
165 | FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} | |
164 | NEXMONSRC_DIR=${NEXMONSRC_DIR:=""} |
|
166 | NEXMONSRC_DIR=${NEXMONSRC_DIR:=""} | |
165 | ENABLE_HARDNET=${ENABLE_HARDNET:=false} |
|
167 | ENABLE_HARDNET=${ENABLE_HARDNET:=false} | |
166 | ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} |
|
168 | ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} | |
167 | ENABLE_SPLITFS=${ENABLE_SPLITFS:=false} |
|
169 | ENABLE_SPLITFS=${ENABLE_SPLITFS:=false} | |
168 | ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false} |
|
170 | ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false} | |
169 | ENABLE_IFNAMES=${ENABLE_IFNAMES:=true} |
|
171 | ENABLE_IFNAMES=${ENABLE_IFNAMES:=true} | |
170 | DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=} |
|
172 | DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=} | |
171 |
|
173 | |||
172 | # Kernel compilation settings |
|
174 | # Kernel compilation settings | |
173 | BUILD_KERNEL=${BUILD_KERNEL:=true} |
|
175 | BUILD_KERNEL=${BUILD_KERNEL:=true} | |
174 | KERNEL_REDUCE=${KERNEL_REDUCE:=false} |
|
176 | KERNEL_REDUCE=${KERNEL_REDUCE:=false} | |
175 | KERNEL_THREADS=${KERNEL_THREADS:=1} |
|
177 | KERNEL_THREADS=${KERNEL_THREADS:=1} | |
176 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} |
|
178 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} | |
177 | KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} |
|
179 | KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} | |
178 | KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} |
|
180 | KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} | |
179 | KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} |
|
181 | KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} | |
180 | KERNEL_CCACHE=${KERNEL_CCACHE:=false} |
|
182 | KERNEL_CCACHE=${KERNEL_CCACHE:=false} | |
181 | KERNEL_ZSWAP=${KERNEL_ZSWAP:=false} |
|
183 | KERNEL_ZSWAP=${KERNEL_ZSWAP:=false} | |
182 | KERNEL_VIRT=${KERNEL_VIRT:=false} |
|
184 | KERNEL_VIRT=${KERNEL_VIRT:=false} | |
183 | KERNEL_BPF=${KERNEL_BPF:=false} |
|
185 | KERNEL_BPF=${KERNEL_BPF:=false} | |
184 | KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=POWERSAVE} |
|
186 | KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=POWERSAVE} | |
185 |
|
187 | |||
186 | # Kernel compilation from source directory settings |
|
188 | # Kernel compilation from source directory settings | |
187 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} |
|
189 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} | |
188 | KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} |
|
190 | KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} | |
189 | KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true} |
|
191 | KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true} | |
190 | KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false} |
|
192 | KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false} | |
191 |
|
193 | |||
192 | # Reduce disk usage settings |
|
194 | # Reduce disk usage settings | |
193 | REDUCE_APT=${REDUCE_APT:=true} |
|
195 | REDUCE_APT=${REDUCE_APT:=true} | |
194 | REDUCE_DOC=${REDUCE_DOC:=true} |
|
196 | REDUCE_DOC=${REDUCE_DOC:=true} | |
195 | REDUCE_MAN=${REDUCE_MAN:=true} |
|
197 | REDUCE_MAN=${REDUCE_MAN:=true} | |
196 | REDUCE_VIM=${REDUCE_VIM:=false} |
|
198 | REDUCE_VIM=${REDUCE_VIM:=false} | |
197 | REDUCE_BASH=${REDUCE_BASH:=false} |
|
199 | REDUCE_BASH=${REDUCE_BASH:=false} | |
198 | REDUCE_HWDB=${REDUCE_HWDB:=true} |
|
200 | REDUCE_HWDB=${REDUCE_HWDB:=true} | |
199 | REDUCE_SSHD=${REDUCE_SSHD:=true} |
|
201 | REDUCE_SSHD=${REDUCE_SSHD:=true} | |
200 | REDUCE_LOCALE=${REDUCE_LOCALE:=true} |
|
202 | REDUCE_LOCALE=${REDUCE_LOCALE:=true} | |
201 |
|
203 | |||
202 | # Encrypted filesystem settings |
|
204 | # Encrypted filesystem settings | |
203 | ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false} |
|
205 | ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false} | |
204 | CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""} |
|
206 | CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""} | |
205 | CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"} |
|
207 | CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"} | |
206 | CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"} |
|
208 | CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"} | |
207 | CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512} |
|
209 | CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512} | |
208 | #Dropbear-initramfs supports unlocking encrypted filesystem via SSH on bootup |
|
210 | #Dropbear-initramfs supports unlocking encrypted filesystem via SSH on bootup | |
209 | CRYPTFS_DROPBEAR=${CRYPTFS_DROPBEAR:=false} |
|
211 | CRYPTFS_DROPBEAR=${CRYPTFS_DROPBEAR:=false} | |
210 | #Provide your own Dropbear Public RSA-OpenSSH Key otherwise it will be generated |
|
212 | #Provide your own Dropbear Public RSA-OpenSSH Key otherwise it will be generated | |
211 | CRYPTFS_DROPBEAR_PUBKEY=${CRYPTFS_DROPBEAR_PUBKEY:=""} |
|
213 | CRYPTFS_DROPBEAR_PUBKEY=${CRYPTFS_DROPBEAR_PUBKEY:=""} | |
212 |
|
214 | |||
213 | # Chroot scripts directory |
|
215 | # Chroot scripts directory | |
214 | CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} |
|
216 | CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} | |
215 |
|
217 | |||
216 | # Packages required in the chroot build environment |
|
218 | # Packages required in the chroot build environment | |
217 | APT_INCLUDES=${APT_INCLUDES:=""} |
|
219 | APT_INCLUDES=${APT_INCLUDES:=""} | |
218 | APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd" |
|
220 | APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd" | |
219 |
|
221 | |||
220 | #Packages to exclude from chroot build environment |
|
222 | #Packages to exclude from chroot build environment | |
221 | APT_EXCLUDES=${APT_EXCLUDES:=""} |
|
223 | APT_EXCLUDES=${APT_EXCLUDES:=""} | |
222 |
|
224 | |||
223 | # Packages required for bootstrapping |
|
225 | # Packages required for bootstrapping | |
224 | REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt" |
|
226 | REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt" | |
225 | MISSING_PACKAGES="" |
|
227 | MISSING_PACKAGES="" | |
226 |
|
228 | |||
227 | # Packages installed for c/c++ build environment in chroot (keep empty) |
|
229 | # Packages installed for c/c++ build environment in chroot (keep empty) | |
228 | COMPILER_PACKAGES="" |
|
230 | COMPILER_PACKAGES="" | |
229 |
|
231 | |||
230 | #Check if apt-cacher-ng has port 3142 open and set APT_PROXY |
|
232 | #Check if apt-cacher-ng has port 3142 open and set APT_PROXY | |
231 | APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d') |
|
233 | APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d') | |
232 | if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then |
|
234 | if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then | |
233 | APT_PROXY=http://127.0.0.1:3142/ |
|
235 | APT_PROXY=http://127.0.0.1:3142/ | |
234 | fi |
|
236 | fi | |
235 |
|
237 | |||
236 | #netselect-apt does not know buster yet |
|
238 | #netselect-apt does not know buster yet | |
237 | if [ "$RELEASE" = "buster" ] ; then |
|
239 | if [ "$RELEASE" = "buster" ] ; then | |
238 | RLS=testing |
|
240 | RLS=testing | |
239 | else |
|
241 | else | |
240 | RLS="$RELEASE" |
|
242 | RLS="$RELEASE" | |
241 | fi |
|
243 | fi | |
242 |
|
244 | |||
243 | if [ -f "$(pwd)/files/apt/sources.list" ] ; then |
|
245 | if [ -f "$(pwd)/files/apt/sources.list" ] ; then | |
244 | rm "$(pwd)/files/apt/sources.list" |
|
246 | rm "$(pwd)/files/apt/sources.list" | |
245 | fi |
|
247 | fi | |
246 |
|
248 | |||
247 | if [ "$ENABLE_NONFREE" = true ] ; then |
|
249 | if [ "$ENABLE_NONFREE" = true ] ; then | |
248 | netselect-apt --arch "$RELEASE_ARCH" -t 3 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" |
|
250 | netselect-apt --arch "$RELEASE_ARCH" -t 3 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" | |
249 | else |
|
251 | else | |
250 | netselect-apt --arch "$RELEASE_ARCH" -t 3 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" |
|
252 | netselect-apt --arch "$RELEASE_ARCH" -t 3 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" | |
251 | fi |
|
253 | fi | |
252 |
|
254 | |||
253 | #sed and cut the result string so we can use it as APT_SERVER |
|
255 | #sed and cut the result string so we can use it as APT_SERVER | |
254 | APT_SERVER=$(grep -m 1 http files/apt/sources.list | sed "s|http://| |g" | cut -d ' ' -f 3 | sed 's|/$|''|') |
|
256 | APT_SERVER=$(grep -m 1 http files/apt/sources.list | sed "s|http://| |g" | cut -d ' ' -f 3 | sed 's|/$|''|') | |
255 |
|
257 | |||
256 | #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! |
|
258 | #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! | |
257 | if [ -n "$SET_ARCH" ] ; then |
|
259 | if [ -n "$SET_ARCH" ] ; then | |
258 | # 64-bit configuration |
|
260 | # 64-bit configuration | |
259 | if [ "$SET_ARCH" = 64 ] ; then |
|
261 | if [ "$SET_ARCH" = 64 ] ; then | |
260 | # General 64-bit depended settings |
|
262 | # General 64-bit depended settings | |
261 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} |
|
263 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} | |
262 | KERNEL_ARCH=${KERNEL_ARCH:=arm64} |
|
264 | KERNEL_ARCH=${KERNEL_ARCH:=arm64} | |
263 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} |
|
265 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} | |
264 |
|
266 | |||
265 | # Raspberry Pi model specific settings |
|
267 | # Raspberry Pi model specific settings | |
266 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then |
|
268 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
267 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" |
|
269 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" | |
268 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} |
|
270 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} | |
269 | RELEASE_ARCH=${RELEASE_ARCH:=arm64} |
|
271 | RELEASE_ARCH=${RELEASE_ARCH:=arm64} | |
270 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} |
|
272 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} | |
271 | CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-} |
|
273 | CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-} | |
272 | else |
|
274 | else | |
273 | echo "error: Only Raspberry PI 3 and 3B+ support 64-bit" |
|
275 | echo "error: Only Raspberry PI 3 and 3B+ support 64-bit" | |
274 | exit 1 |
|
276 | exit 1 | |
275 | fi |
|
277 | fi | |
276 | fi |
|
278 | fi | |
277 |
|
279 | |||
278 | # 32-bit configuration |
|
280 | # 32-bit configuration | |
279 | if [ "$SET_ARCH" = 32 ] ; then |
|
281 | if [ "$SET_ARCH" = 32 ] ; then | |
280 | # General 32-bit dependend settings |
|
282 | # General 32-bit dependend settings | |
281 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} |
|
283 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} | |
282 | KERNEL_ARCH=${KERNEL_ARCH:=arm} |
|
284 | KERNEL_ARCH=${KERNEL_ARCH:=arm} | |
283 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} |
|
285 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} | |
284 |
|
286 | |||
285 | # Raspberry Pi model specific settings |
|
287 | # Raspberry Pi model specific settings | |
286 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then |
|
288 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then | |
287 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel" |
|
289 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel" | |
288 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig} |
|
290 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig} | |
289 | RELEASE_ARCH=${RELEASE_ARCH:=armel} |
|
291 | RELEASE_ARCH=${RELEASE_ARCH:=armel} | |
290 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img} |
|
292 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img} | |
291 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-} |
|
293 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-} | |
292 | fi |
|
294 | fi | |
293 |
|
295 | |||
294 | # Raspberry Pi model specific settings |
|
296 | # Raspberry Pi model specific settings | |
295 | if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then |
|
297 | if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
296 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" |
|
298 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" | |
297 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} |
|
299 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} | |
298 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} |
|
300 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} | |
299 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} |
|
301 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} | |
300 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} |
|
302 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} | |
301 | fi |
|
303 | fi | |
302 | fi |
|
304 | fi | |
303 | #SET_ARCH not set |
|
305 | #SET_ARCH not set | |
304 | else |
|
306 | else | |
305 | echo "error: Please set '32' or '64' as value for SET_ARCH" |
|
307 | echo "error: Please set '32' or '64' as value for SET_ARCH" | |
306 | exit 1 |
|
308 | exit 1 | |
307 | fi |
|
309 | fi | |
308 | # Device specific configuration and U-Boot configuration |
|
310 | # Device specific configuration and U-Boot configuration | |
309 | case "$RPI_MODEL" in |
|
311 | case "$RPI_MODEL" in | |
310 | 0) |
|
312 | 0) | |
311 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb} |
|
313 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb} | |
312 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} |
|
314 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |
313 | ;; |
|
315 | ;; | |
314 | 1) |
|
316 | 1) | |
315 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb} |
|
317 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb} | |
316 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} |
|
318 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |
317 | ;; |
|
319 | ;; | |
318 | 1P) |
|
320 | 1P) | |
319 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb} |
|
321 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb} | |
320 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} |
|
322 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |
321 | ;; |
|
323 | ;; | |
322 | 2) |
|
324 | 2) | |
323 | DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb} |
|
325 | DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb} | |
324 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig} |
|
326 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig} | |
325 | ;; |
|
327 | ;; | |
326 | 3) |
|
328 | 3) | |
327 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} |
|
329 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |
328 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} |
|
330 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} | |
329 | ;; |
|
331 | ;; | |
330 | 3P) |
|
332 | 3P) | |
331 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} |
|
333 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |
332 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} |
|
334 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} | |
333 | ;; |
|
335 | ;; | |
334 | *) |
|
336 | *) | |
335 | echo "error: Raspberry Pi model $RPI_MODEL is not supported!" |
|
337 | echo "error: Raspberry Pi model $RPI_MODEL is not supported!" | |
336 | exit 1 |
|
338 | exit 1 | |
337 | ;; |
|
339 | ;; | |
338 | esac |
|
340 | esac | |
339 |
|
341 | |||
340 | # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard |
|
342 | # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard | |
341 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then |
|
343 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
342 | # Include bluetooth packages on supported boards |
|
344 | # Include bluetooth packages on supported boards | |
343 | if [ "$ENABLE_BLUETOOTH" = true ] ; then |
|
345 | if [ "$ENABLE_BLUETOOTH" = true ] ; then | |
344 | APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" |
|
346 | APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" | |
345 | fi |
|
347 | fi | |
346 | else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard |
|
348 | else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard | |
347 | # Check if the internal wireless interface is not supported by the RPi model |
|
349 | # Check if the internal wireless interface is not supported by the RPi model | |
348 | if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then |
|
350 | if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then | |
349 | echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth" |
|
351 | echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth" | |
350 | exit 1 |
|
352 | exit 1 | |
351 | fi |
|
353 | fi | |
352 | fi |
|
354 | fi | |
353 |
|
355 | |||
354 | if [ "$BUILD_KERNEL" = false ] && [ "$ENABLE_NEXMON" = true ]; then |
|
356 | if [ "$BUILD_KERNEL" = false ] && [ "$ENABLE_NEXMON" = true ]; then | |
355 | echo "error: You have to compile kernel sources, if you want to enable nexmon" |
|
357 | echo "error: You have to compile kernel sources, if you want to enable nexmon" | |
356 | exit 1 |
|
358 | exit 1 | |
357 | fi |
|
359 | fi | |
358 |
|
360 | |||
359 | # Prepare date string for default image file name |
|
361 | # Prepare date string for default image file name | |
360 | DATE="$(date +%Y-%m-%d)" |
|
362 | DATE="$(date +%Y-%m-%d)" | |
361 | if [ -z "$KERNEL_BRANCH" ] ; then |
|
363 | if [ -z "$KERNEL_BRANCH" ] ; then | |
362 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} |
|
364 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |
363 | else |
|
365 | else | |
364 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} |
|
366 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |
365 | fi |
|
367 | fi | |
366 |
|
368 | |||
367 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported |
|
369 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported | |
368 | if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then |
|
370 | if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then | |
369 | if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then |
|
371 | if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then | |
370 | echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported" |
|
372 | echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported" | |
371 | exit 1 |
|
373 | exit 1 | |
372 | fi |
|
374 | fi | |
373 | fi |
|
375 | fi | |
374 |
|
376 | |||
375 | set +x |
|
377 | set +x | |
376 |
|
378 | |||
377 | # Add cmake to compile videocore sources |
|
379 | # Add cmake to compile videocore sources | |
378 | if [ "$ENABLE_VIDEOCORE" = true ] ; then |
|
380 | if [ "$ENABLE_VIDEOCORE" = true ] ; then | |
379 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake" |
|
381 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake" | |
380 | fi |
|
382 | fi | |
381 |
|
383 | |||
382 | # Add deps for nexmon |
|
384 | # Add deps for nexmon | |
383 | if [ "$ENABLE_NEXMON" = true ] ; then |
|
385 | if [ "$ENABLE_NEXMON" = true ] ; then | |
384 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libgmp3-dev gawk qpdf bison flex make autoconf automake build-essential libtool" |
|
386 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libgmp3-dev gawk qpdf bison flex make autoconf automake build-essential libtool" | |
385 | fi |
|
387 | fi | |
386 |
|
388 | |||
387 | # Add libncurses5 to enable kernel menuconfig |
|
389 | # Add libncurses5 to enable kernel menuconfig | |
388 | if [ "$KERNEL_MENUCONFIG" = true ] ; then |
|
390 | if [ "$KERNEL_MENUCONFIG" = true ] ; then | |
389 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev" |
|
391 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev" | |
390 | fi |
|
392 | fi | |
391 |
|
393 | |||
392 | # Add ccache compiler cache for (faster) kernel cross (re)compilation |
|
394 | # Add ccache compiler cache for (faster) kernel cross (re)compilation | |
393 | if [ "$KERNEL_CCACHE" = true ] ; then |
|
395 | if [ "$KERNEL_CCACHE" = true ] ; then | |
394 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache" |
|
396 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache" | |
395 | fi |
|
397 | fi | |
396 |
|
398 | |||
397 | # Add cryptsetup package to enable filesystem encryption |
|
399 | # Add cryptsetup package to enable filesystem encryption | |
398 | if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then |
|
400 | if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then | |
399 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup" |
|
401 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup" | |
400 | APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup" |
|
402 | APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup" | |
401 |
|
403 | |||
402 | #If cryptfs,dropbear and initramfs are enabled include dropbear-initramfs package |
|
404 | #If cryptfs,dropbear and initramfs are enabled include dropbear-initramfs package | |
403 | if [ "$CRYPTFS_DROPBEAR" = true ] && [ "$ENABLE_INITRAMFS" = true ]; then |
|
405 | if [ "$CRYPTFS_DROPBEAR" = true ] && [ "$ENABLE_INITRAMFS" = true ]; then | |
404 | APT_INCLUDES="${APT_INCLUDES},dropbear-initramfs" |
|
406 | APT_INCLUDES="${APT_INCLUDES},dropbear-initramfs" | |
405 | fi |
|
407 | fi | |
406 |
|
408 | |||
407 | if [ -z "$CRYPTFS_PASSWORD" ] ; then |
|
409 | if [ -z "$CRYPTFS_PASSWORD" ] ; then | |
408 | echo "error: no password defined (CRYPTFS_PASSWORD)!" |
|
410 | echo "error: no password defined (CRYPTFS_PASSWORD)!" | |
409 | exit 1 |
|
411 | exit 1 | |
410 | fi |
|
412 | fi | |
411 | ENABLE_INITRAMFS=true |
|
413 | ENABLE_INITRAMFS=true | |
412 | fi |
|
414 | fi | |
413 |
|
415 | |||
414 | # Add initramfs generation tools |
|
416 | # Add initramfs generation tools | |
415 | if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then |
|
417 | if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then | |
416 | APT_INCLUDES="${APT_INCLUDES},initramfs-tools" |
|
418 | APT_INCLUDES="${APT_INCLUDES},initramfs-tools" | |
417 | fi |
|
419 | fi | |
418 |
|
420 | |||
419 | # Add device-tree-compiler required for building the U-Boot bootloader |
|
421 | # Add device-tree-compiler required for building the U-Boot bootloader | |
420 | if [ "$ENABLE_UBOOT" = true ] ; then |
|
422 | if [ "$ENABLE_UBOOT" = true ] ; then | |
421 | APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc" |
|
423 | APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc" | |
422 | else |
|
424 | else | |
423 | if [ "$ENABLE_UBOOTUSB" = true ] ; then |
|
425 | if [ "$ENABLE_UBOOTUSB" = true ] ; then | |
424 | echo "error: Enabling UBOOTUSB requires u-boot to be enabled" |
|
426 | echo "error: Enabling UBOOTUSB requires u-boot to be enabled" | |
425 | exit 1 |
|
427 | exit 1 | |
426 | fi |
|
428 | fi | |
427 | fi |
|
429 | fi | |
428 |
|
430 | |||
429 | # Check if root SSH (v2) public key file exists |
|
431 | # Check if root SSH (v2) public key file exists | |
430 | if [ -n "$SSH_ROOT_PUB_KEY" ] ; then |
|
432 | if [ -n "$SSH_ROOT_PUB_KEY" ] ; then | |
431 | if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then |
|
433 | if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then | |
432 | echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!" |
|
434 | echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!" | |
433 | exit 1 |
|
435 | exit 1 | |
434 | fi |
|
436 | fi | |
435 | fi |
|
437 | fi | |
436 |
|
438 | |||
437 | # Check if $USER_NAME SSH (v2) public key file exists |
|
439 | # Check if $USER_NAME SSH (v2) public key file exists | |
438 | if [ -n "$SSH_USER_PUB_KEY" ] ; then |
|
440 | if [ -n "$SSH_USER_PUB_KEY" ] ; then | |
439 | if [ ! -f "$SSH_USER_PUB_KEY" ] ; then |
|
441 | if [ ! -f "$SSH_USER_PUB_KEY" ] ; then | |
440 | echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!" |
|
442 | echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!" | |
441 | exit 1 |
|
443 | exit 1 | |
442 | fi |
|
444 | fi | |
443 | fi |
|
445 | fi | |
444 |
|
446 | |||
445 | if [ "$ENABLE_NEXMON" = true ] && [ -n "$KERNEL_BRANCH" ] ; then |
|
447 | if [ "$ENABLE_NEXMON" = true ] && [ -n "$KERNEL_BRANCH" ] ; then | |
446 | echo "error: Please unset KERNEL_BRANCH if using ENABLE_NEXMON" |
|
448 | echo "error: Please unset KERNEL_BRANCH if using ENABLE_NEXMON" | |
447 | exit 1 |
|
449 | exit 1 | |
448 | fi |
|
450 | fi | |
449 |
|
451 | |||
450 | # Check if all required packages are installed on the build system |
|
452 | # Check if all required packages are installed on the build system | |
451 | for package in $REQUIRED_PACKAGES ; do |
|
453 | for package in $REQUIRED_PACKAGES ; do | |
452 | if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then |
|
454 | if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then | |
453 | MISSING_PACKAGES="${MISSING_PACKAGES} $package" |
|
455 | MISSING_PACKAGES="${MISSING_PACKAGES} $package" | |
454 | fi |
|
456 | fi | |
455 | done |
|
457 | done | |
456 |
|
458 | |||
457 | # If there are missing packages ask confirmation for install, or exit |
|
459 | # If there are missing packages ask confirmation for install, or exit | |
458 | if [ -n "$MISSING_PACKAGES" ] ; then |
|
460 | if [ -n "$MISSING_PACKAGES" ] ; then | |
459 | echo "the following packages needed by this script are not installed:" |
|
461 | echo "the following packages needed by this script are not installed:" | |
460 | echo "$MISSING_PACKAGES" |
|
462 | echo "$MISSING_PACKAGES" | |
461 |
|
463 | |||
462 | printf "\ndo you want to install the missing packages right now? [y/n] " |
|
464 | printf "\ndo you want to install the missing packages right now? [y/n] " | |
463 | read -r confirm |
|
465 | read -r confirm | |
464 | [ "$confirm" != "y" ] && exit 1 |
|
466 | [ "$confirm" != "y" ] && exit 1 | |
465 |
|
467 | |||
466 | # Make sure all missing required packages are installed |
|
468 | # Make sure all missing required packages are installed | |
467 | apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"` |
|
469 | apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"` | |
468 | fi |
|
470 | fi | |
469 |
|
471 | |||
470 | # Check if ./bootstrap.d directory exists |
|
472 | # Check if ./bootstrap.d directory exists | |
471 | if [ ! -d "./bootstrap.d/" ] ; then |
|
473 | if [ ! -d "./bootstrap.d/" ] ; then | |
472 | echo "error: './bootstrap.d' required directory not found!" |
|
474 | echo "error: './bootstrap.d' required directory not found!" | |
473 | exit 1 |
|
475 | exit 1 | |
474 | fi |
|
476 | fi | |
475 |
|
477 | |||
476 | # Check if ./files directory exists |
|
478 | # Check if ./files directory exists | |
477 | if [ ! -d "./files/" ] ; then |
|
479 | if [ ! -d "./files/" ] ; then | |
478 | echo "error: './files' required directory not found!" |
|
480 | echo "error: './files' required directory not found!" | |
479 | exit 1 |
|
481 | exit 1 | |
480 | fi |
|
482 | fi | |
481 |
|
483 | |||
482 | # Check if specified KERNELSRC_DIR directory exists |
|
484 | # Check if specified KERNELSRC_DIR directory exists | |
483 | if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then |
|
485 | if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then | |
484 | echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!" |
|
486 | echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!" | |
485 | exit 1 |
|
487 | exit 1 | |
486 | fi |
|
488 | fi | |
487 |
|
489 | |||
488 | # Check if specified UBOOTSRC_DIR directory exists |
|
490 | # Check if specified UBOOTSRC_DIR directory exists | |
489 | if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then |
|
491 | if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then | |
490 | echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!" |
|
492 | echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!" | |
491 | exit 1 |
|
493 | exit 1 | |
492 | fi |
|
494 | fi | |
493 |
|
495 | |||
494 | # Check if specified VIDEOCORESRC_DIR directory exists |
|
496 | # Check if specified VIDEOCORESRC_DIR directory exists | |
495 | if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then |
|
497 | if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then | |
496 | echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!" |
|
498 | echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!" | |
497 | exit 1 |
|
499 | exit 1 | |
498 | fi |
|
500 | fi | |
499 |
|
501 | |||
500 | # Check if specified FBTURBOSRC_DIR directory exists |
|
502 | # Check if specified FBTURBOSRC_DIR directory exists | |
501 | if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then |
|
503 | if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then | |
502 | echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!" |
|
504 | echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!" | |
503 | exit 1 |
|
505 | exit 1 | |
504 | fi |
|
506 | fi | |
505 |
|
507 | |||
506 | # Check if specified NEXMONSRC_DIR directory exists |
|
508 | # Check if specified NEXMONSRC_DIR directory exists | |
507 | if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then |
|
509 | if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then | |
508 | echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!" |
|
510 | echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!" | |
509 | exit 1 |
|
511 | exit 1 | |
510 | fi |
|
512 | fi | |
511 |
|
513 | |||
512 | # Check if specified CHROOT_SCRIPTS directory exists |
|
514 | # Check if specified CHROOT_SCRIPTS directory exists | |
513 | if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then |
|
515 | if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then | |
514 | echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!" |
|
516 | echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!" | |
515 | exit 1 |
|
517 | exit 1 | |
516 | fi |
|
518 | fi | |
517 |
|
519 | |||
518 | # Check if specified device mapping already exists (will be used by cryptsetup) |
|
520 | # Check if specified device mapping already exists (will be used by cryptsetup) | |
519 | if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then |
|
521 | if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then | |
520 | echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding" |
|
522 | echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding" | |
521 | exit 1 |
|
523 | exit 1 | |
522 | fi |
|
524 | fi | |
523 |
|
525 | |||
524 | # Don't clobber an old build |
|
526 | # Don't clobber an old build | |
525 | if [ -e "$BUILDDIR" ] ; then |
|
527 | if [ -e "$BUILDDIR" ] ; then | |
526 | echo "error: directory ${BUILDDIR} already exists, not proceeding" |
|
528 | echo "error: directory ${BUILDDIR} already exists, not proceeding" | |
527 | exit 1 |
|
529 | exit 1 | |
528 | fi |
|
530 | fi | |
529 |
|
531 | |||
530 | # Setup chroot directory |
|
532 | # Setup chroot directory | |
531 | mkdir -p "${R}" |
|
533 | mkdir -p "${R}" | |
532 |
|
534 | |||
533 | # Check if build directory has enough of free disk space >512MB |
|
535 | # Check if build directory has enough of free disk space >512MB | |
534 | if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then |
|
536 | if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then | |
535 | echo "error: ${BUILDDIR} not enough space left to generate the output image!" |
|
537 | echo "error: ${BUILDDIR} not enough space left to generate the output image!" | |
536 | exit 1 |
|
538 | exit 1 | |
537 | fi |
|
539 | fi | |
538 |
|
540 | |||
539 | set -x |
|
541 | set -x | |
540 |
|
542 | |||
541 | # Call "cleanup" function on various signals and errors |
|
543 | # Call "cleanup" function on various signals and errors | |
542 | trap cleanup 0 1 2 3 6 |
|
544 | trap cleanup 0 1 2 3 6 | |
543 |
|
545 | |||
544 | # Add required packages for the minbase installation |
|
546 | # Add required packages for the minbase installation | |
545 | if [ "$ENABLE_MINBASE" = true ] ; then |
|
547 | if [ "$ENABLE_MINBASE" = true ] ; then | |
546 | APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown" |
|
548 | APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown" | |
547 | fi |
|
549 | fi | |
548 |
|
550 | |||
549 | # Add parted package, required to get partprobe utility |
|
551 | # Add parted package, required to get partprobe utility | |
550 | if [ "$EXPANDROOT" = true ] ; then |
|
552 | if [ "$EXPANDROOT" = true ] ; then | |
551 | APT_INCLUDES="${APT_INCLUDES},parted" |
|
553 | APT_INCLUDES="${APT_INCLUDES},parted" | |
552 | fi |
|
554 | fi | |
553 |
|
555 | |||
554 | # Add dbus package, recommended if using systemd |
|
556 | # Add dbus package, recommended if using systemd | |
555 | if [ "$ENABLE_DBUS" = true ] ; then |
|
557 | if [ "$ENABLE_DBUS" = true ] ; then | |
556 | APT_INCLUDES="${APT_INCLUDES},dbus" |
|
558 | APT_INCLUDES="${APT_INCLUDES},dbus" | |
557 | fi |
|
559 | fi | |
558 |
|
560 | |||
559 | # Add iptables IPv4/IPv6 package |
|
561 | # Add iptables IPv4/IPv6 package | |
560 | if [ "$ENABLE_IPTABLES" = true ] ; then |
|
562 | if [ "$ENABLE_IPTABLES" = true ] ; then | |
561 | APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent" |
|
563 | APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent" | |
562 | fi |
|
564 | fi | |
563 |
|
565 | |||
564 | # Add openssh server package |
|
566 | # Add openssh server package | |
565 | if [ "$ENABLE_SSHD" = true ] ; then |
|
567 | if [ "$ENABLE_SSHD" = true ] ; then | |
566 | APT_INCLUDES="${APT_INCLUDES},openssh-server" |
|
568 | APT_INCLUDES="${APT_INCLUDES},openssh-server" | |
567 | fi |
|
569 | fi | |
568 |
|
570 | |||
569 | # Add alsa-utils package |
|
571 | # Add alsa-utils package | |
570 | if [ "$ENABLE_SOUND" = true ] ; then |
|
572 | if [ "$ENABLE_SOUND" = true ] ; then | |
571 | APT_INCLUDES="${APT_INCLUDES},alsa-utils" |
|
573 | APT_INCLUDES="${APT_INCLUDES},alsa-utils" | |
572 | fi |
|
574 | fi | |
573 |
|
575 | |||
574 | # Add rng-tools package |
|
576 | # Add rng-tools package | |
575 | if [ "$ENABLE_HWRANDOM" = true ] ; then |
|
577 | if [ "$ENABLE_HWRANDOM" = true ] ; then | |
576 | APT_INCLUDES="${APT_INCLUDES},rng-tools" |
|
578 | APT_INCLUDES="${APT_INCLUDES},rng-tools" | |
577 | fi |
|
579 | fi | |
578 |
|
580 | |||
579 | # Add fbturbo video driver |
|
581 | # Add fbturbo video driver | |
580 | if [ "$ENABLE_FBTURBO" = true ] ; then |
|
582 | if [ "$ENABLE_FBTURBO" = true ] ; then | |
581 | # Enable xorg package dependencies |
|
583 | # Enable xorg package dependencies | |
582 | ENABLE_XORG=true |
|
584 | ENABLE_XORG=true | |
583 | fi |
|
585 | fi | |
584 |
|
586 | |||
585 | # Add user defined window manager package |
|
587 | # Add user defined window manager package | |
586 | if [ -n "$ENABLE_WM" ] ; then |
|
588 | if [ -n "$ENABLE_WM" ] ; then | |
587 | APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}" |
|
589 | APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}" | |
588 |
|
590 | |||
589 | # Enable xorg package dependencies |
|
591 | # Enable xorg package dependencies | |
590 | ENABLE_XORG=true |
|
592 | ENABLE_XORG=true | |
591 | fi |
|
593 | fi | |
592 |
|
594 | |||
593 | # Add xorg package |
|
595 | # Add xorg package | |
594 | if [ "$ENABLE_XORG" = true ] ; then |
|
596 | if [ "$ENABLE_XORG" = true ] ; then | |
595 | APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11" |
|
597 | APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11" | |
596 | fi |
|
598 | fi | |
597 |
|
599 | |||
598 | # Replace selected packages with smaller clones |
|
600 | # Replace selected packages with smaller clones | |
599 | if [ "$ENABLE_REDUCE" = true ] ; then |
|
601 | if [ "$ENABLE_REDUCE" = true ] ; then | |
600 | # Add levee package instead of vim-tiny |
|
602 | # Add levee package instead of vim-tiny | |
601 | if [ "$REDUCE_VIM" = true ] ; then |
|
603 | if [ "$REDUCE_VIM" = true ] ; then | |
602 | APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")" |
|
604 | APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")" | |
603 | fi |
|
605 | fi | |
604 |
|
606 | |||
605 | # Add dropbear package instead of openssh-server |
|
607 | # Add dropbear package instead of openssh-server | |
606 | if [ "$REDUCE_SSHD" = true ] ; then |
|
608 | if [ "$REDUCE_SSHD" = true ] ; then | |
607 | APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")" |
|
609 | APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")" | |
608 | fi |
|
610 | fi | |
609 | fi |
|
611 | fi | |
610 |
|
612 | |||
611 | # Configure systemd-sysv exclude to make halt/reboot/shutdown scripts available |
|
613 | # Configure systemd-sysv exclude to make halt/reboot/shutdown scripts available | |
612 | if [ "$ENABLE_SYSVINIT" = false ] ; then |
|
614 | if [ "$ENABLE_SYSVINIT" = false ] ; then | |
613 | APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv" |
|
615 | APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv" | |
614 | fi |
|
616 | fi | |
615 |
|
617 | |||
616 | # Configure kernel sources if no KERNELSRC_DIR |
|
618 | # Configure kernel sources if no KERNELSRC_DIR | |
617 | if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then |
|
619 | if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then | |
618 | KERNELSRC_CONFIG=true |
|
620 | KERNELSRC_CONFIG=true | |
619 | fi |
|
621 | fi | |
620 |
|
622 | |||
621 | # Configure reduced kernel |
|
623 | # Configure reduced kernel | |
622 | if [ "$KERNEL_REDUCE" = true ] ; then |
|
624 | if [ "$KERNEL_REDUCE" = true ] ; then | |
623 | KERNELSRC_CONFIG=false |
|
625 | KERNELSRC_CONFIG=false | |
624 | fi |
|
626 | fi | |
625 |
|
627 | |||
626 | # Configure qemu compatible kernel |
|
628 | # Configure qemu compatible kernel | |
627 | if [ "$ENABLE_QEMU" = true ] ; then |
|
629 | if [ "$ENABLE_QEMU" = true ] ; then | |
628 | DTB_FILE=vexpress-v2p-ca15_a7.dtb |
|
630 | DTB_FILE=vexpress-v2p-ca15_a7.dtb | |
629 | UBOOT_CONFIG=vexpress_ca15_tc2_defconfig |
|
631 | UBOOT_CONFIG=vexpress_ca15_tc2_defconfig | |
630 | KERNEL_DEFCONFIG="vexpress_defconfig" |
|
632 | KERNEL_DEFCONFIG="vexpress_defconfig" | |
631 | if [ "$KERNEL_MENUCONFIG" = false ] ; then |
|
633 | if [ "$KERNEL_MENUCONFIG" = false ] ; then | |
632 | KERNEL_OLDDEFCONFIG=true |
|
634 | KERNEL_OLDDEFCONFIG=true | |
633 | fi |
|
635 | fi | |
634 | fi |
|
636 | fi | |
635 |
|
637 | |||
636 | # Execute bootstrap scripts |
|
638 | # Execute bootstrap scripts | |
637 | for SCRIPT in bootstrap.d/*.sh; do |
|
639 | for SCRIPT in bootstrap.d/*.sh; do | |
638 | head -n 3 "$SCRIPT" |
|
640 | head -n 3 "$SCRIPT" | |
639 | . "$SCRIPT" |
|
641 | . "$SCRIPT" | |
640 | done |
|
642 | done | |
641 |
|
643 | |||
642 | ## Execute custom bootstrap scripts |
|
644 | ## Execute custom bootstrap scripts | |
643 | if [ -d "custom.d" ] ; then |
|
645 | if [ -d "custom.d" ] ; then | |
644 | for SCRIPT in custom.d/*.sh; do |
|
646 | for SCRIPT in custom.d/*.sh; do | |
645 | . "$SCRIPT" |
|
647 | . "$SCRIPT" | |
646 | done |
|
648 | done | |
647 | fi |
|
649 | fi | |
648 |
|
650 | |||
649 | # Execute custom scripts inside the chroot |
|
651 | # Execute custom scripts inside the chroot | |
650 | if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then |
|
652 | if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then | |
651 | cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts" |
|
653 | cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts" | |
652 | chroot_exec /bin/bash -x <<'EOF' |
|
654 | chroot_exec /bin/bash -x <<'EOF' | |
653 | for SCRIPT in /chroot_scripts/* ; do |
|
655 | for SCRIPT in /chroot_scripts/* ; do | |
654 | if [ -f $SCRIPT -a -x $SCRIPT ] ; then |
|
656 | if [ -f $SCRIPT -a -x $SCRIPT ] ; then | |
655 | $SCRIPT |
|
657 | $SCRIPT | |
656 | fi |
|
658 | fi | |
657 | done |
|
659 | done | |
658 | EOF |
|
660 | EOF | |
659 | rm -rf "${R}/chroot_scripts" |
|
661 | rm -rf "${R}/chroot_scripts" | |
660 | fi |
|
662 | fi | |
661 |
|
663 | |||
662 | # Remove c/c++ build environment from the chroot |
|
664 | # Remove c/c++ build environment from the chroot | |
663 | chroot_remove_cc |
|
665 | chroot_remove_cc | |
664 |
|
666 | |||
665 | # Generate required machine-id |
|
667 | # Generate required machine-id | |
666 | MACHINE_ID=$(dbus-uuidgen) |
|
668 | MACHINE_ID=$(dbus-uuidgen) | |
667 | echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id" |
|
669 | echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id" | |
668 | echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id" |
|
670 | echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id" | |
669 |
|
671 | |||
670 | # APT Cleanup |
|
672 | # APT Cleanup | |
671 | chroot_exec apt-get -y clean |
|
673 | chroot_exec apt-get -y clean | |
672 | chroot_exec apt-get -y autoclean |
|
674 | chroot_exec apt-get -y autoclean | |
673 | chroot_exec apt-get -y autoremove |
|
675 | chroot_exec apt-get -y autoremove | |
674 |
|
676 | |||
675 | # Unmount mounted filesystems |
|
677 | # Unmount mounted filesystems | |
676 | umount -l "${R}/proc" |
|
678 | umount -l "${R}/proc" | |
677 | umount -l "${R}/sys" |
|
679 | umount -l "${R}/sys" | |
678 |
|
680 | |||
679 | # Clean up directories |
|
681 | # Clean up directories | |
680 | rm -rf "${R}/run/*" |
|
682 | rm -rf "${R}/run/*" | |
681 | rm -rf "${R}/tmp/*" |
|
683 | rm -rf "${R}/tmp/*" | |
682 |
|
684 | |||
683 | # Clean up files |
|
685 | # Clean up files | |
684 | rm -f "${ETC_DIR}/ssh/ssh_host_*" |
|
686 | rm -f "${ETC_DIR}/ssh/ssh_host_*" | |
685 | rm -f "${ETC_DIR}/dropbear/dropbear_*" |
|
687 | rm -f "${ETC_DIR}/dropbear/dropbear_*" | |
686 | rm -f "${ETC_DIR}/apt/sources.list.save" |
|
688 | rm -f "${ETC_DIR}/apt/sources.list.save" | |
687 | rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original" |
|
689 | rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original" | |
688 | rm -f "${ETC_DIR}/*-" |
|
690 | rm -f "${ETC_DIR}/*-" | |
689 | rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy" |
|
691 | rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy" | |
690 | rm -f "${ETC_DIR}/resolv.conf" |
|
692 | rm -f "${ETC_DIR}/resolv.conf" | |
691 | rm -f "${R}/root/.bash_history" |
|
693 | rm -f "${R}/root/.bash_history" | |
692 | rm -f "${R}/var/lib/urandom/random-seed" |
|
694 | rm -f "${R}/var/lib/urandom/random-seed" | |
693 | rm -f "${R}/initrd.img" |
|
695 | rm -f "${R}/initrd.img" | |
694 | rm -f "${R}/vmlinuz" |
|
696 | rm -f "${R}/vmlinuz" | |
695 | rm -f "${R}${QEMU_BINARY}" |
|
697 | rm -f "${R}${QEMU_BINARY}" | |
696 |
|
698 | |||
697 | if [ "$ENABLE_QEMU" = true ] ; then |
|
699 | if [ "$ENABLE_QEMU" = true ] ; then | |
698 | # Setup QEMU directory |
|
700 | # Setup QEMU directory | |
699 | mkdir "${BASEDIR}/qemu" |
|
701 | mkdir "${BASEDIR}/qemu" | |
700 |
|
702 | |||
701 | # Copy kernel image to QEMU directory |
|
703 | # Copy kernel image to QEMU directory | |
702 | install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}" |
|
704 | install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}" | |
703 |
|
705 | |||
704 | # Copy kernel config to QEMU directory |
|
706 | # Copy kernel config to QEMU directory | |
705 | install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}" |
|
707 | install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}" | |
706 |
|
708 | |||
707 | # Copy kernel dtbs to QEMU directory |
|
709 | # Copy kernel dtbs to QEMU directory | |
708 | for dtb in "${BOOT_DIR}/"*.dtb ; do |
|
710 | for dtb in "${BOOT_DIR}/"*.dtb ; do | |
709 | if [ -f "${dtb}" ] ; then |
|
711 | if [ -f "${dtb}" ] ; then | |
710 | install_readonly "${dtb}" "${BASEDIR}/qemu/" |
|
712 | install_readonly "${dtb}" "${BASEDIR}/qemu/" | |
711 | fi |
|
713 | fi | |
712 | done |
|
714 | done | |
713 |
|
715 | |||
714 | # Copy kernel overlays to QEMU directory |
|
716 | # Copy kernel overlays to QEMU directory | |
715 | if [ -d "${BOOT_DIR}/overlays" ] ; then |
|
717 | if [ -d "${BOOT_DIR}/overlays" ] ; then | |
716 | # Setup overlays dtbs directory |
|
718 | # Setup overlays dtbs directory | |
717 | mkdir "${BASEDIR}/qemu/overlays" |
|
719 | mkdir "${BASEDIR}/qemu/overlays" | |
718 |
|
720 | |||
719 | for dtb in "${BOOT_DIR}/overlays/"*.dtb ; do |
|
721 | for dtb in "${BOOT_DIR}/overlays/"*.dtb ; do | |
720 | if [ -f "${dtb}" ] ; then |
|
722 | if [ -f "${dtb}" ] ; then | |
721 | install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/" |
|
723 | install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/" | |
722 | fi |
|
724 | fi | |
723 | done |
|
725 | done | |
724 | fi |
|
726 | fi | |
725 |
|
727 | |||
726 | # Copy u-boot files to QEMU directory |
|
728 | # Copy u-boot files to QEMU directory | |
727 | if [ "$ENABLE_UBOOT" = true ] ; then |
|
729 | if [ "$ENABLE_UBOOT" = true ] ; then | |
728 | if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then |
|
730 | if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then | |
729 | install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin" |
|
731 | install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin" | |
730 | fi |
|
732 | fi | |
731 | if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then |
|
733 | if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then | |
732 | install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage" |
|
734 | install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage" | |
733 | fi |
|
735 | fi | |
734 | if [ -f "${BOOT_DIR}/boot.scr" ] ; then |
|
736 | if [ -f "${BOOT_DIR}/boot.scr" ] ; then | |
735 | install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr" |
|
737 | install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr" | |
736 | fi |
|
738 | fi | |
737 | fi |
|
739 | fi | |
738 |
|
740 | |||
739 | # Copy initramfs to QEMU directory |
|
741 | # Copy initramfs to QEMU directory | |
740 | if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then |
|
742 | if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then | |
741 | install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}" |
|
743 | install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}" | |
742 | fi |
|
744 | fi | |
743 | fi |
|
745 | fi | |
744 |
|
746 | |||
745 | # Calculate size of the chroot directory in KB |
|
747 | # Calculate size of the chroot directory in KB | |
746 | CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')") |
|
748 | CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')") | |
747 |
|
749 | |||
748 | # Calculate the amount of needed 512 Byte sectors |
|
750 | # Calculate the amount of needed 512 Byte sectors | |
749 | TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512) |
|
751 | TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512) | |
750 | FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512) |
|
752 | FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512) | |
751 | ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}") |
|
753 | ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}") | |
752 |
|
754 | |||
753 | # The root partition is EXT4 |
|
755 | # The root partition is EXT4 | |
754 | # This means more space than the actual used space of the chroot is used. |
|
756 | # This means more space than the actual used space of the chroot is used. | |
755 | # As overhead for journaling and reserved blocks 35% are added. |
|
757 | # As overhead for journaling and reserved blocks 35% are added. | |
756 | ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512) |
|
758 | ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512) | |
757 |
|
759 | |||
758 | # Calculate required image size in 512 Byte sectors |
|
760 | # Calculate required image size in 512 Byte sectors | |
759 | IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}") |
|
761 | IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}") | |
760 |
|
762 | |||
761 | # Prepare image file |
|
763 | # Prepare image file | |
762 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
764 | if [ "$ENABLE_SPLITFS" = true ] ; then | |
763 | dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}" |
|
765 | dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}" | |
764 | dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}" |
|
766 | dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}" | |
765 | dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}" |
|
767 | dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}" | |
766 | dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}" |
|
768 | dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}" | |
767 |
|
769 | |||
768 | # Write firmware/boot partition tables |
|
770 | # Write firmware/boot partition tables | |
769 | sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM |
|
771 | sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM | |
770 | ${TABLE_SECTORS},${FRMW_SECTORS},c,* |
|
772 | ${TABLE_SECTORS},${FRMW_SECTORS},c,* | |
771 | EOM |
|
773 | EOM | |
772 |
|
774 | |||
773 | # Write root partition table |
|
775 | # Write root partition table | |
774 | sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM |
|
776 | sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM | |
775 | ${TABLE_SECTORS},${ROOT_SECTORS},83 |
|
777 | ${TABLE_SECTORS},${ROOT_SECTORS},83 | |
776 | EOM |
|
778 | EOM | |
777 |
|
779 | |||
778 | # Setup temporary loop devices |
|
780 | # Setup temporary loop devices | |
779 | FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)" |
|
781 | FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)" | |
780 | ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)" |
|
782 | ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)" | |
781 | else # ENABLE_SPLITFS=false |
|
783 | else # ENABLE_SPLITFS=false | |
782 | dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}" |
|
784 | dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}" | |
783 | dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}" |
|
785 | dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}" | |
784 |
|
786 | |||
785 | # Write partition table |
|
787 | # Write partition table | |
786 | sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM |
|
788 | sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM | |
787 | ${TABLE_SECTORS},${FRMW_SECTORS},c,* |
|
789 | ${TABLE_SECTORS},${FRMW_SECTORS},c,* | |
788 | ${ROOT_OFFSET},${ROOT_SECTORS},83 |
|
790 | ${ROOT_OFFSET},${ROOT_SECTORS},83 | |
789 | EOM |
|
791 | EOM | |
790 |
|
792 | |||
791 | # Setup temporary loop devices |
|
793 | # Setup temporary loop devices | |
792 | FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)" |
|
794 | FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)" | |
793 | ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)" |
|
795 | ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)" | |
794 | fi |
|
796 | fi | |
795 |
|
797 | |||
796 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
798 | if [ "$ENABLE_CRYPTFS" = true ] ; then | |
797 | # Create dummy ext4 fs |
|
799 | # Create dummy ext4 fs | |
798 | mkfs.ext4 "$ROOT_LOOP" |
|
800 | mkfs.ext4 "$ROOT_LOOP" | |
799 |
|
801 | |||
800 | # Setup password keyfile |
|
802 | # Setup password keyfile | |
801 | touch .password |
|
803 | touch .password | |
802 | chmod 600 .password |
|
804 | chmod 600 .password | |
803 | echo -n ${CRYPTFS_PASSWORD} > .password |
|
805 | echo -n ${CRYPTFS_PASSWORD} > .password | |
804 |
|
806 | |||
805 | # Initialize encrypted partition |
|
807 | # Initialize encrypted partition | |
806 | echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password |
|
808 | echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password | |
807 |
|
809 | |||
808 | # Open encrypted partition and setup mapping |
|
810 | # Open encrypted partition and setup mapping | |
809 | cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}" |
|
811 | cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}" | |
810 |
|
812 | |||
811 | # Secure delete password keyfile |
|
813 | # Secure delete password keyfile | |
812 | shred -zu .password |
|
814 | shred -zu .password | |
813 |
|
815 | |||
814 | # Update temporary loop device |
|
816 | # Update temporary loop device | |
815 | ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}" |
|
817 | ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}" | |
816 |
|
818 | |||
817 | # Wipe encrypted partition (encryption cipher is used for randomness) |
|
819 | # Wipe encrypted partition (encryption cipher is used for randomness) | |
818 | dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")" |
|
820 | dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")" | |
819 | fi |
|
821 | fi | |
820 |
|
822 | |||
821 | # Build filesystems |
|
823 | # Build filesystems | |
822 | mkfs.vfat "$FRMW_LOOP" |
|
824 | mkfs.vfat "$FRMW_LOOP" | |
823 | mkfs.ext4 "$ROOT_LOOP" |
|
825 | mkfs.ext4 "$ROOT_LOOP" | |
824 |
|
826 | |||
825 | # Mount the temporary loop devices |
|
827 | # Mount the temporary loop devices | |
826 | mkdir -p "$BUILDDIR/mount" |
|
828 | mkdir -p "$BUILDDIR/mount" | |
827 | mount "$ROOT_LOOP" "$BUILDDIR/mount" |
|
829 | mount "$ROOT_LOOP" "$BUILDDIR/mount" | |
828 |
|
830 | |||
829 | mkdir -p "$BUILDDIR/mount/boot/firmware" |
|
831 | mkdir -p "$BUILDDIR/mount/boot/firmware" | |
830 | mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware" |
|
832 | mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware" | |
831 |
|
833 | |||
832 | # Copy all files from the chroot to the loop device mount point directory |
|
834 | # Copy all files from the chroot to the loop device mount point directory | |
833 | rsync -a "${R}/" "$BUILDDIR/mount/" |
|
835 | rsync -a "${R}/" "$BUILDDIR/mount/" | |
834 |
|
836 | |||
835 | # Unmount all temporary loop devices and mount points |
|
837 | # Unmount all temporary loop devices and mount points | |
836 | cleanup |
|
838 | cleanup | |
837 |
|
839 | |||
838 | # Create block map file(s) of image(s) |
|
840 | # Create block map file(s) of image(s) | |
839 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
841 | if [ "$ENABLE_SPLITFS" = true ] ; then | |
840 | # Create block map files for "bmaptool" |
|
842 | # Create block map files for "bmaptool" | |
841 | bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img" |
|
843 | bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img" | |
842 | bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img" |
|
844 | bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img" | |
843 |
|
845 | |||
844 | # Image was successfully created |
|
846 | # Image was successfully created | |
845 | echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" |
|
847 | echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" | |
846 | echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" |
|
848 | echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" | |
847 | else |
|
849 | else | |
848 | # Create block map file for "bmaptool" |
|
850 | # Create block map file for "bmaptool" | |
849 | bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img" |
|
851 | bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img" | |
850 |
|
852 | |||
851 | # Image was successfully created |
|
853 | # Image was successfully created | |
852 | echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" |
|
854 | echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created" | |
853 |
|
855 | |||
854 | # Create qemu qcow2 image |
|
856 | # Create qemu qcow2 image | |
855 | if [ "$ENABLE_QEMU" = true ] ; then |
|
857 | if [ "$ENABLE_QEMU" = true ] ; then | |
856 | QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} |
|
858 | QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |
857 | QEMU_SIZE=16G |
|
859 | QEMU_SIZE=16G | |
858 |
|
860 | |||
859 | qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2 |
|
861 | qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2 | |
860 | qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE |
|
862 | qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE | |
861 |
|
863 | |||
862 | echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created" |
|
864 | echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created" | |
863 | fi |
|
865 | fi | |
864 | fi |
|
866 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant