Codebase list live-build / debian/4.0.4-1kali1
Update on top of live-build 4.0.4-1 Remaining changes: - skip comments in package list - EFI support - disable ixp4xx flavour on armel Raphaël Hertzog 9 years ago
11 changed file(s) with 439 addition(s) and 546 deletion(s). Raw diff Collapse all Expand all
0 live-build (4.0.4-1kali1) kali-dev; urgency=medium
1
2 * Update on top of live-build 4.0.4-1. Remaining changes:
3 - skip comments in package list
4 - EFI support
5 - disable ixp4xx flavour on armel
6
7 -- Raphaël Hertzog <[email protected]> Wed, 10 Dec 2014 09:14:54 +0100
8
09 live-build (4.0.4-1) unstable; urgency=low
110
211 [ Daniel Baumann ]
+0
-51
debian/patches/0001-Update-linux-flavours-for-armhf-armel.patch less more
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:36:27 +0100
2 Subject: Update linux flavours for armhf/armel
3
4 With linux 3.16 of Debian Jessie, armmp and armmp-lpae are the
5 only armhf flavours availale. On armel, we lost the support of
6 the iop32x flavors.
7
8 Linux 3.14 used in Kali doesn't build the ixp4xx flavor, so keep that
9 one disabled too.
10 ---
11 functions/defaults.sh | 6 +++---
12 1 file changed, 3 insertions(+), 3 deletions(-)
13
14 diff --git a/functions/defaults.sh b/functions/defaults.sh
15 index feebdee..0d5fa4f 100755
16 --- a/functions/defaults.sh
17 +++ b/functions/defaults.sh
18 @@ -525,15 +525,29 @@ Set_defaults ()
19 *)
20 # armel will have special images: one rootfs image and many additional kernel images.
21 # therefore we default to all available armel flavours
22 - LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-iop32x ixp4xx kirkwood orion5x versatile}"
23 + case "${LB_DISTRIBUTION}" in
24 + wheezy)
25 + LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-iop32x ixp4xx kirkwood orion5x versatile}"
26 + ;;
27 + *)
28 + LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-kirkwood orion5x versatile}"
29 + ;;
30 + esac
31 ;;
32 esac
33 ;;
34
35 armhf)
36 # armhf will have special images: one rootfs image and many additional kernel images.
37 - # therefore we default to all available armel flavours
38 - LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-mx5 omap}"
39 + # therefore we default to all available armhf flavours
40 + case "${LB_DISTRIBUTION}" in
41 + wheezy)
42 + LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-mx5 omap}"
43 + ;;
44 + *)
45 + LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-armmp armmp-lpae}"
46 + ;;
47 + esac
48 ;;
49
50 amd64)
+0
-366
debian/patches/0002-Add-support-for-EFI-boot-with-syslinux-efi.patch less more
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:36:27 +0100
2 Subject: Add support for EFI boot with syslinux-efi.
3
4 Bug-Debian: http://bugs.debian.org/731709
5 Bug-Kali: https://bugs.kali.org/view.php?id=680
6 ---
7 scripts/build/binary | 3 +
8 scripts/build/binary_efi | 278 +++++++++++++++++++++++++++++++++++++++++++++++
9 scripts/build/binary_iso | 37 +++++++
10 3 files changed, 318 insertions(+)
11 create mode 100644 scripts/build/binary_efi
12
13 diff --git a/scripts/build/binary b/scripts/build/binary
14 index c1f9ec6..b893988 100755
15 --- a/scripts/build/binary
16 +++ b/scripts/build/binary
17 @@ -69,6 +69,9 @@ lb binary_loadlin ${@}
18 lb binary_win32-loader ${@}
19 lb binary_includes ${@}
20 lb binary_hooks ${@}
21 +lb binary_efi ${@} # After includes/hooks because it copies in efi.img
22 + # files that can be overriden by binary_includes and
23 + # modified by binary_hooks
24 lb binary_checksums ${@}
25
26 if [ "${LB_BUILD_WITH_CHROOT}" != "true" ]
27 diff --git a/scripts/build/binary_efi b/scripts/build/binary_efi
28 new file mode 100644
29 index 0000000..f98a5bf
30 --- /dev/null
31 +++ b/scripts/build/binary_efi
32 @@ -0,0 +1,278 @@
33 +#!/bin/sh
34 +
35 +## live-build(7) - System Build Scripts
36 +## Copyright (C) 2014 Raphaël Hertzog <[email protected]>
37 +##
38 +## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
39 +## This is free software, and you are welcome to redistribute it
40 +## under certain conditions; see COPYING for details.
41 +
42 +
43 +set -e
44 +
45 +# Including common functions
46 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
47 +
48 +# Setting static variables
49 +DESCRIPTION="$(Echo 'prepares and installs EFI support into binary')"
50 +HELP=""
51 +USAGE="${PROGRAM} [--force]"
52 +
53 +Arguments "${@}"
54 +
55 +# Reading configuration files
56 +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
57 +Set_defaults
58 +
59 +if [ "${LB_BOOTLOADER}" != "syslinux" ]
60 +then
61 + exit 0
62 +fi
63 +
64 +Echo_message "Begin preparing EFI support..."
65 +
66 +# Requiring stage file
67 +Require_stagefile .build/config .build/bootstrap
68 +
69 +# Checking stage file
70 +Check_stagefile .build/binary_efi
71 +
72 +# Checking lock file
73 +Check_lockfile .lock
74 +
75 +# Creating lock file
76 +Create_lockfile .lock
77 +
78 +# Check architecture
79 +Check_architectures amd64 i386
80 +Check_crossarchitectures
81 +
82 +case "$LIVE_IMAGE_ARCHITECTURE" in
83 + amd64)
84 + _EFI_TYPE=efi64
85 + ;;
86 + i386)
87 + _EFI_TYPE=efi32
88 + ;;
89 + *)
90 + echo "ERROR: can't provide EFI boot support to architecture $LIVE_IMAGE_ARCHITECTURE" >&2
91 + exit 1
92 + ;;
93 +esac
94 +
95 +# Assembling image specifics
96 +case "${LIVE_IMAGE_TYPE}" in
97 + iso*)
98 + _BOOTLOADER="isolinux"
99 +
100 + case "${LB_MODE}" in
101 + progress-linux)
102 + _CONFDIR="binary/boot"
103 + ;;
104 +
105 + *)
106 + _CONFDIR="binary/isolinux"
107 + ;;
108 + esac
109 + ;;
110 +
111 + netboot)
112 + _BOOTLOADER="pxelinux"
113 + _CONFDIR="tftpboot"
114 + ;;
115 +
116 + hdd*|*)
117 + case ${LB_BINARY_FILESYSTEM} in
118 + fat*|ntfs)
119 + _BOOTLOADER=syslinux
120 +
121 + case "${LB_MODE}" in
122 + progress-linux)
123 + _CONFDIR="binary/boot"
124 + ;;
125 +
126 + *)
127 + _CONFDIR="binary/syslinux"
128 + ;;
129 + esac
130 + ;;
131 +
132 + ext[234]|btrfs)
133 + _BOOTLOADER=extlinux
134 + _CONFDIR="binary/boot/extlinux"
135 + ;;
136 +
137 + *)
138 + Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
139 + exit 1
140 + ;;
141 + esac
142 + ;;
143 +esac
144 +
145 +# Checking depends
146 +case "${LB_BUILD_WITH_CHROOT}" in
147 + true)
148 + _CHROOT_DIR=""
149 + _SYSLINUX_EFI_DIR="chroot/usr/lib/SYSLINUX.EFI/$_EFI_TYPE"
150 +
151 + Check_package chroot/usr/bin/syslinux syslinux
152 + Check_package chroot/usr/lib/syslinux syslinux-common
153 + Check_package chroot/usr/lib/SYSLINUX.EFI syslinux-efi
154 + Check_package chroot/usr/bin/mcopy mtools
155 + Check_package chroot/sbin/mkfs.msdos dosfstools
156 + ;;
157 +
158 + false)
159 + _CHROOT_DIR="chroot"
160 + _SYSLINUX_EFI_DIR="/usr/lib/syslinux/$_EFI_TYPE"
161 +
162 + if [ ! -e /usr/bin/syslinux ]
163 + then
164 + # syslinux
165 + Echo_error "/usr/bin/syslinux - no such file."
166 + exit 1
167 + fi
168 +
169 + if [ ! -e /usr/lib/syslinux ]
170 + then
171 + # syslinux-common
172 + Echo_error "/usr/lib/syslinux - no such directory"
173 + exit 1
174 + fi
175 +
176 + if [ ! -e /usr/lib/SYSLINUX.EFI ]
177 + then
178 + # syslinux-efi
179 + Echo_error "/usr/lib/SYSLINUX.EFI - no such directory"
180 + exit 1
181 + fi
182 +
183 + if [ ! -e /usr/bin/mcopy ]
184 + then
185 + # mtools
186 + Echo_error "/usr/bin/mcopy - no such file."
187 + exit 1
188 + fi
189 +
190 + if [ ! -e /sbin/mkfs.msdos ]
191 + then
192 + # dosfstools
193 + Echo_error "/sbin/mkfs.msdos - no such file."
194 + exit 1
195 + fi
196 + ;;
197 +esac
198 +
199 +# Restoring cache
200 +Restore_cache cache/packages.binary
201 +
202 +# Installing depends
203 +Install_package
204 +
205 +# Abort if we don't have the required EFI files
206 +if [ ! -e $_SYSLINUX_EFI_DIR/syslinux.efi ]; then
207 + Echo_warning "$_SYSLINUX_EFI_DIR/syslinux.efi missing, no EFI support included."
208 + case "${LB_BUILD_WITH_CHROOT}" in
209 + true)
210 + # Saving cache
211 + Save_cache cache/packages.binary
212 +
213 + # Removing depends
214 + Remove_package
215 + ;;
216 + esac
217 + exit 0
218 +fi
219 +
220 +# Cleanup files that we generate
221 +rm -rf chroot/efi-temp chroot/efi.img binary/boot/efi.img
222 +
223 +# Copy syslinux and its config files in the temporary EFI image
224 +mkdir -p chroot/efi-temp/live
225 +mkdir -p chroot/efi-temp/EFI/BOOT
226 +for _F in $_CONFDIR/*.cfg $_CONFDIR/*.png $_SYSLINUX_EFI_DIR/*.*32 $_SYSLINUX_EFI_DIR/*.*64; do
227 + if [ -e $_F ]; then
228 + cp $_F chroot/efi-temp/EFI/BOOT/
229 + fi
230 +done
231 +cp $_SYSLINUX_EFI_DIR/syslinux.efi chroot/efi-temp/EFI/BOOT/BOOTX64.efi
232 +cp $_SYSLINUX_EFI_DIR/syslinux.efi chroot/efi-temp/EFI/BOOT/syslinux.efi
233 +
234 +# Copy the various kernel images
235 +cp binary/live/vmlinuz* binary/live/initrd.img* chroot/efi-temp/live/
236 +if [ -d binary/install ]; then
237 + cp -r binary/install chroot/efi-temp/
238 +fi
239 +
240 +# Edit the menu to differentiate the EFI version
241 +if [ -e chroot/efi-temp/EFI/BOOT/menu.cfg ]; then
242 + sed -i -e "s/^menu title/menu title EFI/" chroot/efi-temp/EFI/BOOT/menu.cfg
243 +else
244 + Echo "No menu.cfg file that can be edited to indicate that we boot on EFI!"
245 +fi
246 +
247 +# Ensure we have a syslinux.cfg
248 +if [ ! -e chroot/efi-temp/EFI/BOOT/syslinux.cfg ]; then
249 + for _F in isolinux.cfg pxelinux.cfg/default extlinux.conf; do
250 + if [ -f chroot/efi-temp/EFI/BOOT/$_F ]; then
251 + cp chroot/efi-temp/EFI/BOOT/$_F chroot/efi-temp/EFI/BOOT/syslinux.cfg
252 + break
253 + fi
254 + done
255 +fi
256 +
257 +# Define the EFI filesystem size
258 +_TOTALSIZE=$(du -sk chroot/efi-temp/ | awk '{print $1}')
259 +# Add 5% safety margin
260 +_TOTALSIZE=$(( $_TOTALSIZE * 21 / 20 ))
261 +# Required size rounded to upper 32kb
262 +_BLOCKS=$(( ($_TOTALSIZE + 31) / 32 * 32 ))
263 +Echo "EFI boot image needs $_TOTALSIZE Kb, thus allocating $_BLOCKS blocks."
264 +
265 +# Script to generate the EFI boot image
266 +cat >binary.sh <<END
267 +#!/bin/sh
268 +
269 +set -e
270 +
271 +mkfs.msdos -C $_CHROOT_DIR/efi.img $_BLOCKS
272 +mcopy -s -v -i $_CHROOT_DIR/efi.img $_CHROOT_DIR/efi-temp/* ::
273 +END
274 +
275 +# Copying files
276 +case "${LB_BUILD_WITH_CHROOT}" in
277 + true)
278 + mv binary.sh chroot/
279 + Chroot chroot "sh binary.sh"
280 + rm -f chroot/binary.sh
281 +
282 + # Saving cache
283 + Save_cache cache/packages.binary
284 +
285 + # Removing depends
286 + Remove_package
287 + ;;
288 +
289 + false)
290 + sh binary.sh
291 + rm -f binary.sh
292 + ;;
293 +esac
294 +
295 +mkdir -p binary/boot
296 +mv chroot/efi.img binary/boot/
297 +rm -rf chroot/efi-temp
298 +
299 +case "${LB_BUILD_WITH_CHROOT}" in
300 + true)
301 + # Saving cache
302 + Save_cache cache/packages.binary
303 +
304 + # Removing depends
305 + Remove_package
306 + ;;
307 +esac
308 +
309 +# Creating stage file
310 +Create_stagefile .build/binary_efi
311 diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
312 index 7abfc69..62fcf9c 100755
313 --- a/scripts/build/binary_iso
314 +++ b/scripts/build/binary_iso
315 @@ -82,6 +82,23 @@ fi
316 # Handle xorriso generic options
317 XORRISO_OPTIONS="-R -r -J -joliet-long -l -cache-inodes"
318
319 +case "${LB_BUILD_WITH_CHROOT}" in
320 + true)
321 + XORRISO_VER=$(Chroot chroot xorriso --version 2>&1 | awk '
322 + /^xorriso version/ {
323 + split($4, ver, ".")
324 + print ver[1]*10000+ver[2]*100+ver[3]
325 + }')
326 + ;;
327 + false)
328 + XORRISO_VER=$(xorriso --version 2>&1 | awk '
329 + /^xorriso version/ {
330 + split($4, ver, ".")
331 + print ver[1]*10000+ver[2]*100+ver[3]
332 + }')
333 + ;;
334 +esac
335 +
336 # Handle xorriso live-build specific options
337 if [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]
338 then
339 @@ -155,6 +172,26 @@ case "${LB_BOOTLOADER}" in
340 ;;
341 esac
342
343 +if [ -e binary/boot/efi.img ]; then
344 + #if [ "$XORRISO_VER" -le 10202 ]; then
345 + # 1.2.2 shipping in wheezy
346 + Echo "Using older EFI command line for xorriso $XORRISO_VER"
347 + # Tell xorriso to create a secondary ElTorito boot record for the
348 + # EFI bootloader
349 + XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot --efi-boot boot/efi.img"
350 + # Add the efi image as a FAT partition too, so our CD image will
351 + # also boot on a USB key (like isohybrid, just implemented
352 + # differently)
353 + XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0x01 binary/boot/efi.img"
354 + #else
355 + # Echo "Using newer EFI support in xorriso $XORRISO_VER"
356 + # XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
357 + # XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat"
358 + #fi
359 +else
360 + Echo "No EFI boot code to include in the ISO"
361 +fi
362 +
363 #if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
364 #then
365 # XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
+0
-36
debian/patches/0003-Lookup-LIVE_IMAGE_-foo-and-LB_-foo-for-if-tests-in-p.patch less more
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:41:16 +0100
2 Subject: Lookup $LIVE_IMAGE_<foo> and $LB_<foo> for #if tests in package lists
3
4 The old LB_ARCHITECTURES and LB_ARCHIVE_AREAS got renamed to
5 LIVE_IMAGE_ARCHITECTURE and LIVE_IMAGE_ARCHIVE_AREAS in live-build 4.x
6 whereas LB_DISTRIBUTION has not been renamed. Is thus required
7 to lookup variables with both prefixes.
8 ---
9 functions/packagelists.sh | 6 ++++--
10 1 file changed, 4 insertions(+), 2 deletions(-)
11
12 diff --git a/functions/packagelists.sh b/functions/packagelists.sh
13 index 8470d9a..3660f0f 100755
14 --- a/functions/packagelists.sh
15 +++ b/functions/packagelists.sh
16 @@ -63,7 +63,8 @@ Expand_packagelist ()
17 _LB_NESTED=1
18
19 _LB_NEEDLE="$(echo "${_LB_LINE}" | cut -d' ' -f3-)"
20 - _LB_HAYSTACK="$(eval "echo \$LB_$(echo "${_LB_LINE}" | cut -d' ' -f2)")"
21 + _LB_HAYSTACK_VAR="$(echo "${_LB_LINE}" | cut -d' ' -f2)"
22 + _LB_HAYSTACK="$(eval "echo \${LB_$_LB_HAYSTACK_VAR:-\$LIVE_IMAGE_$_LB_HAYSTACK_VAR}")"
23
24 _LB_ENABLED=0
25 for _LB_NEEDLE_PART in ${_LB_NEEDLE}
26 @@ -87,7 +88,8 @@ Expand_packagelist ()
27 _LB_NESTED=1
28
29 _LB_NEEDLE="$(echo "${_LB_LINE}" | cut -d' ' -f3-)"
30 - _LB_HAYSTACK="$(eval "echo \$LB_$(echo "${_LB_LINE}" | cut -d' ' -f2)")"
31 + _LB_HAYSTACK_VAR="$(echo "${_LB_LINE}" | cut -d' ' -f2)"
32 + _LB_HAYSTACK="$(eval "echo \${LB_$_LB_HAYSTACK_VAR:-\$LIVE_IMAGE_$_LB_HAYSTACK_VAR}")"
33
34 _LB_ENABLED=0
35 for _LB_NEEDLE_PART in ${_LB_NEEDLE}
+0
-28
debian/patches/0004-Skip-comments-in-package-lists.patch less more
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:45:40 +0100
2 Subject: Skip comments in package lists
3
4 Comments in package lists used to work in live-build 3.x (although
5 possibly only as a side-effect of some other logic) and being able to
6 comment package is a useful feature (to explain why some packages are
7 included and to make it easy to uncomment some lines to add more useful
8 packages).
9 ---
10 functions/packagelists.sh | 4 ++++
11 1 file changed, 4 insertions(+)
12
13 diff --git a/functions/packagelists.sh b/functions/packagelists.sh
14 index 3660f0f..5327591 100755
15 --- a/functions/packagelists.sh
16 +++ b/functions/packagelists.sh
17 @@ -109,6 +109,10 @@ Expand_packagelist ()
18 _LB_ENABLED=1
19 ;;
20
21 + \#*)
22 + # Skip comments
23 + ;;
24 +
25 *)
26 if [ ${_LB_ENABLED} -eq 1 ]
27 then
+0
-35
debian/patches/0005-Properly-support-empty-package-lists.patch less more
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:53:13 +0100
2 Subject: Properly support empty package lists
3
4 The user might not have created any package list or it might have
5 created a packages list that end up being empty due to various #if tests.
6 We should not fail in those cases.
7 ---
8 scripts/build/binary_package-lists | 6 +++++-
9 1 file changed, 5 insertions(+), 1 deletion(-)
10
11 diff --git a/scripts/build/binary_package-lists b/scripts/build/binary_package-lists
12 index 0584c59..496d631 100755
13 --- a/scripts/build/binary_package-lists
14 +++ b/scripts/build/binary_package-lists
15 @@ -101,7 +101,7 @@ then
16 Expand_packagelist "${LIST}" "config/package-lists" > chroot/root/"$(basename ${LIST})"
17
18 # Downloading additional packages
19 - Chroot chroot "xargs --arg-file=/root/$(basename ${LIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install"
20 + Chroot chroot "xargs --no-run-if-empty --arg-file=/root/$(basename ${LIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install"
21
22 # Remove package list
23 rm chroot/root/"$(basename ${LIST})"
24 @@ -110,6 +110,10 @@ then
25
26 for FILE in chroot/binary.deb/archives/*.deb
27 do
28 + if [ ! -e ${FILE} ]; then
29 + break # Do nothing if the package lists were empty...
30 + fi
31 +
32 SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
33 SECTION="$(dpkg -f ${FILE} Section | awk '{ print $1 }')"
34
+0
-24
debian/patches/0006-binary_syslinux-correct-the-path-used-to-check-if-th.patch less more
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Tue, 9 Dec 2014 16:48:00 +0100
2 Subject: binary_syslinux: correct the path used to check if the bootloader is
3 available
4
5 The {iso,pxe,ext,sys}linux packages use /usr/lib/{ISO,PXE,EXT,SYS}LINUX/
6 directories and not /share/{ISO,PXE,EXT,SYS}LINUX/.
7 ---
8 scripts/build/binary_syslinux | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11 diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux
12 index abd900a..f0dba0e 100755
13 --- a/scripts/build/binary_syslinux
14 +++ b/scripts/build/binary_syslinux
15 @@ -143,7 +143,7 @@ case "${LB_BUILD_WITH_CHROOT}" in
16 ;;
17
18 *)
19 - Check_package chroot/share/$(echo ${_BOOTLOADER} | tr [a-z] [A-Z]) ${_BOOTLOADER}
20 + Check_package chroot/usr/lib/$(echo ${_BOOTLOADER} | tr [a-z] [A-Z]) ${_BOOTLOADER}
21 Check_package chroot/usr/lib/syslinux syslinux-common
22 ;;
23 esac
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:36:27 +0100
2 Subject: Add support for EFI boot with syslinux-efi.
3
4 Bug-Debian: http://bugs.debian.org/731709
5 Bug-Kali: https://bugs.kali.org/view.php?id=680
6 ---
7 scripts/build/binary | 3 +
8 scripts/build/binary_efi | 278 +++++++++++++++++++++++++++++++++++++++++++++++
9 scripts/build/binary_iso | 37 +++++++
10 3 files changed, 318 insertions(+)
11 create mode 100644 scripts/build/binary_efi
12
13 diff --git a/scripts/build/binary b/scripts/build/binary
14 index c1f9ec6..b893988 100755
15 --- a/scripts/build/binary
16 +++ b/scripts/build/binary
17 @@ -69,6 +69,9 @@ lb binary_loadlin ${@}
18 lb binary_win32-loader ${@}
19 lb binary_includes ${@}
20 lb binary_hooks ${@}
21 +lb binary_efi ${@} # After includes/hooks because it copies in efi.img
22 + # files that can be overriden by binary_includes and
23 + # modified by binary_hooks
24 lb binary_checksums ${@}
25
26 if [ "${LB_BUILD_WITH_CHROOT}" != "true" ]
27 diff --git a/scripts/build/binary_efi b/scripts/build/binary_efi
28 new file mode 100644
29 index 0000000..f98a5bf
30 --- /dev/null
31 +++ b/scripts/build/binary_efi
32 @@ -0,0 +1,278 @@
33 +#!/bin/sh
34 +
35 +## live-build(7) - System Build Scripts
36 +## Copyright (C) 2014 Raphaël Hertzog <[email protected]>
37 +##
38 +## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
39 +## This is free software, and you are welcome to redistribute it
40 +## under certain conditions; see COPYING for details.
41 +
42 +
43 +set -e
44 +
45 +# Including common functions
46 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
47 +
48 +# Setting static variables
49 +DESCRIPTION="$(Echo 'prepares and installs EFI support into binary')"
50 +HELP=""
51 +USAGE="${PROGRAM} [--force]"
52 +
53 +Arguments "${@}"
54 +
55 +# Reading configuration files
56 +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
57 +Set_defaults
58 +
59 +if [ "${LB_BOOTLOADER}" != "syslinux" ]
60 +then
61 + exit 0
62 +fi
63 +
64 +Echo_message "Begin preparing EFI support..."
65 +
66 +# Requiring stage file
67 +Require_stagefile .build/config .build/bootstrap
68 +
69 +# Checking stage file
70 +Check_stagefile .build/binary_efi
71 +
72 +# Checking lock file
73 +Check_lockfile .lock
74 +
75 +# Creating lock file
76 +Create_lockfile .lock
77 +
78 +# Check architecture
79 +Check_architectures amd64 i386
80 +Check_crossarchitectures
81 +
82 +case "$LIVE_IMAGE_ARCHITECTURE" in
83 + amd64)
84 + _EFI_TYPE=efi64
85 + ;;
86 + i386)
87 + _EFI_TYPE=efi32
88 + ;;
89 + *)
90 + echo "ERROR: can't provide EFI boot support to architecture $LIVE_IMAGE_ARCHITECTURE" >&2
91 + exit 1
92 + ;;
93 +esac
94 +
95 +# Assembling image specifics
96 +case "${LIVE_IMAGE_TYPE}" in
97 + iso*)
98 + _BOOTLOADER="isolinux"
99 +
100 + case "${LB_MODE}" in
101 + progress-linux)
102 + _CONFDIR="binary/boot"
103 + ;;
104 +
105 + *)
106 + _CONFDIR="binary/isolinux"
107 + ;;
108 + esac
109 + ;;
110 +
111 + netboot)
112 + _BOOTLOADER="pxelinux"
113 + _CONFDIR="tftpboot"
114 + ;;
115 +
116 + hdd*|*)
117 + case ${LB_BINARY_FILESYSTEM} in
118 + fat*|ntfs)
119 + _BOOTLOADER=syslinux
120 +
121 + case "${LB_MODE}" in
122 + progress-linux)
123 + _CONFDIR="binary/boot"
124 + ;;
125 +
126 + *)
127 + _CONFDIR="binary/syslinux"
128 + ;;
129 + esac
130 + ;;
131 +
132 + ext[234]|btrfs)
133 + _BOOTLOADER=extlinux
134 + _CONFDIR="binary/boot/extlinux"
135 + ;;
136 +
137 + *)
138 + Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
139 + exit 1
140 + ;;
141 + esac
142 + ;;
143 +esac
144 +
145 +# Checking depends
146 +case "${LB_BUILD_WITH_CHROOT}" in
147 + true)
148 + _CHROOT_DIR=""
149 + _SYSLINUX_EFI_DIR="chroot/usr/lib/SYSLINUX.EFI/$_EFI_TYPE"
150 +
151 + Check_package chroot/usr/bin/syslinux syslinux
152 + Check_package chroot/usr/lib/syslinux syslinux-common
153 + Check_package chroot/usr/lib/SYSLINUX.EFI syslinux-efi
154 + Check_package chroot/usr/bin/mcopy mtools
155 + Check_package chroot/sbin/mkfs.msdos dosfstools
156 + ;;
157 +
158 + false)
159 + _CHROOT_DIR="chroot"
160 + _SYSLINUX_EFI_DIR="/usr/lib/syslinux/$_EFI_TYPE"
161 +
162 + if [ ! -e /usr/bin/syslinux ]
163 + then
164 + # syslinux
165 + Echo_error "/usr/bin/syslinux - no such file."
166 + exit 1
167 + fi
168 +
169 + if [ ! -e /usr/lib/syslinux ]
170 + then
171 + # syslinux-common
172 + Echo_error "/usr/lib/syslinux - no such directory"
173 + exit 1
174 + fi
175 +
176 + if [ ! -e /usr/lib/SYSLINUX.EFI ]
177 + then
178 + # syslinux-efi
179 + Echo_error "/usr/lib/SYSLINUX.EFI - no such directory"
180 + exit 1
181 + fi
182 +
183 + if [ ! -e /usr/bin/mcopy ]
184 + then
185 + # mtools
186 + Echo_error "/usr/bin/mcopy - no such file."
187 + exit 1
188 + fi
189 +
190 + if [ ! -e /sbin/mkfs.msdos ]
191 + then
192 + # dosfstools
193 + Echo_error "/sbin/mkfs.msdos - no such file."
194 + exit 1
195 + fi
196 + ;;
197 +esac
198 +
199 +# Restoring cache
200 +Restore_cache cache/packages.binary
201 +
202 +# Installing depends
203 +Install_package
204 +
205 +# Abort if we don't have the required EFI files
206 +if [ ! -e $_SYSLINUX_EFI_DIR/syslinux.efi ]; then
207 + Echo_warning "$_SYSLINUX_EFI_DIR/syslinux.efi missing, no EFI support included."
208 + case "${LB_BUILD_WITH_CHROOT}" in
209 + true)
210 + # Saving cache
211 + Save_cache cache/packages.binary
212 +
213 + # Removing depends
214 + Remove_package
215 + ;;
216 + esac
217 + exit 0
218 +fi
219 +
220 +# Cleanup files that we generate
221 +rm -rf chroot/efi-temp chroot/efi.img binary/boot/efi.img
222 +
223 +# Copy syslinux and its config files in the temporary EFI image
224 +mkdir -p chroot/efi-temp/live
225 +mkdir -p chroot/efi-temp/EFI/BOOT
226 +for _F in $_CONFDIR/*.cfg $_CONFDIR/*.png $_SYSLINUX_EFI_DIR/*.*32 $_SYSLINUX_EFI_DIR/*.*64; do
227 + if [ -e $_F ]; then
228 + cp $_F chroot/efi-temp/EFI/BOOT/
229 + fi
230 +done
231 +cp $_SYSLINUX_EFI_DIR/syslinux.efi chroot/efi-temp/EFI/BOOT/BOOTX64.efi
232 +cp $_SYSLINUX_EFI_DIR/syslinux.efi chroot/efi-temp/EFI/BOOT/syslinux.efi
233 +
234 +# Copy the various kernel images
235 +cp binary/live/vmlinuz* binary/live/initrd.img* chroot/efi-temp/live/
236 +if [ -d binary/install ]; then
237 + cp -r binary/install chroot/efi-temp/
238 +fi
239 +
240 +# Edit the menu to differentiate the EFI version
241 +if [ -e chroot/efi-temp/EFI/BOOT/menu.cfg ]; then
242 + sed -i -e "s/^menu title/menu title EFI/" chroot/efi-temp/EFI/BOOT/menu.cfg
243 +else
244 + Echo "No menu.cfg file that can be edited to indicate that we boot on EFI!"
245 +fi
246 +
247 +# Ensure we have a syslinux.cfg
248 +if [ ! -e chroot/efi-temp/EFI/BOOT/syslinux.cfg ]; then
249 + for _F in isolinux.cfg pxelinux.cfg/default extlinux.conf; do
250 + if [ -f chroot/efi-temp/EFI/BOOT/$_F ]; then
251 + cp chroot/efi-temp/EFI/BOOT/$_F chroot/efi-temp/EFI/BOOT/syslinux.cfg
252 + break
253 + fi
254 + done
255 +fi
256 +
257 +# Define the EFI filesystem size
258 +_TOTALSIZE=$(du -sk chroot/efi-temp/ | awk '{print $1}')
259 +# Add 5% safety margin
260 +_TOTALSIZE=$(( $_TOTALSIZE * 21 / 20 ))
261 +# Required size rounded to upper 32kb
262 +_BLOCKS=$(( ($_TOTALSIZE + 31) / 32 * 32 ))
263 +Echo "EFI boot image needs $_TOTALSIZE Kb, thus allocating $_BLOCKS blocks."
264 +
265 +# Script to generate the EFI boot image
266 +cat >binary.sh <<END
267 +#!/bin/sh
268 +
269 +set -e
270 +
271 +mkfs.msdos -C $_CHROOT_DIR/efi.img $_BLOCKS
272 +mcopy -s -v -i $_CHROOT_DIR/efi.img $_CHROOT_DIR/efi-temp/* ::
273 +END
274 +
275 +# Copying files
276 +case "${LB_BUILD_WITH_CHROOT}" in
277 + true)
278 + mv binary.sh chroot/
279 + Chroot chroot "sh binary.sh"
280 + rm -f chroot/binary.sh
281 +
282 + # Saving cache
283 + Save_cache cache/packages.binary
284 +
285 + # Removing depends
286 + Remove_package
287 + ;;
288 +
289 + false)
290 + sh binary.sh
291 + rm -f binary.sh
292 + ;;
293 +esac
294 +
295 +mkdir -p binary/boot
296 +mv chroot/efi.img binary/boot/
297 +rm -rf chroot/efi-temp
298 +
299 +case "${LB_BUILD_WITH_CHROOT}" in
300 + true)
301 + # Saving cache
302 + Save_cache cache/packages.binary
303 +
304 + # Removing depends
305 + Remove_package
306 + ;;
307 +esac
308 +
309 +# Creating stage file
310 +Create_stagefile .build/binary_efi
311 diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso
312 index ddb3e64..8ced525 100755
313 --- a/scripts/build/binary_iso
314 +++ b/scripts/build/binary_iso
315 @@ -82,6 +82,23 @@ fi
316 # Handle xorriso generic options
317 XORRISO_OPTIONS="-R -r -J -joliet-long -l -cache-inodes"
318
319 +case "${LB_BUILD_WITH_CHROOT}" in
320 + true)
321 + XORRISO_VER=$(Chroot chroot xorriso --version 2>&1 | awk '
322 + /^xorriso version/ {
323 + split($4, ver, ".")
324 + print ver[1]*10000+ver[2]*100+ver[3]
325 + }')
326 + ;;
327 + false)
328 + XORRISO_VER=$(xorriso --version 2>&1 | awk '
329 + /^xorriso version/ {
330 + split($4, ver, ".")
331 + print ver[1]*10000+ver[2]*100+ver[3]
332 + }')
333 + ;;
334 +esac
335 +
336 # Handle xorriso live-build specific options
337 if [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]
338 then
339 @@ -155,6 +172,26 @@ case "${LB_BOOTLOADER}" in
340 ;;
341 esac
342
343 +if [ -e binary/boot/efi.img ]; then
344 + #if [ "$XORRISO_VER" -le 10202 ]; then
345 + # 1.2.2 shipping in wheezy
346 + Echo "Using older EFI command line for xorriso $XORRISO_VER"
347 + # Tell xorriso to create a secondary ElTorito boot record for the
348 + # EFI bootloader
349 + XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot --efi-boot boot/efi.img"
350 + # Add the efi image as a FAT partition too, so our CD image will
351 + # also boot on a USB key (like isohybrid, just implemented
352 + # differently)
353 + XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0x01 binary/boot/efi.img"
354 + #else
355 + # Echo "Using newer EFI support in xorriso $XORRISO_VER"
356 + # XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
357 + # XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat"
358 + #fi
359 +else
360 + Echo "No EFI boot code to include in the ISO"
361 +fi
362 +
363 #if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
364 #then
365 # XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:36:27 +0100
2 Subject: Drop the ixp4xx flavour on armel as Kali does not have it
3
4 The main kali release includes linux 3.14 which had this flavour disabled.
5
6 This patch should be dropped once the main kali release is based on
7 Debian 8 with Linux 3.16 or newer.
8
9 Forwarded: not-needed
10 Origin: vendor
11 ---
12 functions/defaults.sh | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15 diff --git a/functions/defaults.sh b/functions/defaults.sh
16 index b419232..bff4cc8 100755
17 --- a/functions/defaults.sh
18 +++ b/functions/defaults.sh
19 @@ -538,7 +538,7 @@ Set_defaults ()
20 LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-iop32x ixp4xx kirkwood orion5x versatile}"
21 ;;
22 *)
23 - LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-ixp4xx kirkwood orion5x versatile}"
24 + LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-kirkwood orion5x versatile}"
25 ;;
26 esac
27 ;;
0 From: =?utf-8?q?Rapha=C3=ABl_Hertzog?= <[email protected]>
1 Date: Fri, 5 Dec 2014 09:45:40 +0100
2 Subject: Skip comments in package lists
3
4 Comments in package lists used to work in live-build 3.x (although
5 possibly only as a side-effect of some other logic) and being able to
6 comment package is a useful feature (to explain why some packages are
7 included and to make it easy to uncomment some lines to add more useful
8 packages).
9
10 This patch has been merged in live-build 5.x.
11
12 Applied-Upstream: 5.0~a1
13 Forwarded: directly committed upstream
14 ---
15 functions/packagelists.sh | 4 ++++
16 1 file changed, 4 insertions(+)
17
18 diff --git a/functions/packagelists.sh b/functions/packagelists.sh
19 index 8470d9a..02a879d 100755
20 --- a/functions/packagelists.sh
21 +++ b/functions/packagelists.sh
22 @@ -107,6 +107,10 @@ Expand_packagelist ()
23 _LB_ENABLED=1
24 ;;
25
26 + \#*)
27 + # Skip comments
28 + ;;
29 +
30 *)
31 if [ ${_LB_ENABLED} -eq 1 ]
32 then
0 0001-Update-linux-flavours-for-armhf-armel.patch
1 0002-Add-support-for-EFI-boot-with-syslinux-efi.patch
2 0003-Lookup-LIVE_IMAGE_-foo-and-LB_-foo-for-if-tests-in-p.patch
3 0004-Skip-comments-in-package-lists.patch
4 0005-Properly-support-empty-package-lists.patch
5 0006-binary_syslinux-correct-the-path-used-to-check-if-th.patch
0 Add-support-for-EFI-boot-with-syslinux-efi.patch
1 Skip-comments-in-package-lists.patch
2 Drop-the-ixp4xx-flavour-on-armel-as-Kali-does-not-ha.patch