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