Codebase list live-build / 0d65be4
Reset to plain debian state Raphaël Hertzog 7 years ago
5 changed file(s) with 0 addition(s) and 298 deletion(s). Raw diff Collapse all Expand all
+0
-1
.gitignore less more
0 .pc/
+0
-5
debian/README.kali less more
0 Changes to do when we introduce a new release
1 ---------------------------------------------
2 * Update functions/releases.sh with the version
3 (via Add-versions-for-Kali-releases.patch)
4 * Add the required symlink in debian/live-build.links
+0
-6
debian/live-build.links less more
0 usr/share/live/build/data/debian-cd/sid usr/share/live/build/data/debian-cd/moto
1 usr/share/live/build/data/debian-cd/sid usr/share/live/build/data/debian-cd/sana
2 usr/share/live/build/data/debian-cd/sid usr/share/live/build/data/debian-cd/safi
3 usr/share/live/build/data/debian-cd/sid usr/share/live/build/data/debian-cd/kali-current
4 usr/share/live/build/data/debian-cd/sid usr/share/live/build/data/debian-cd/kali-dev
5 usr/share/live/build/data/debian-cd/sid usr/share/live/build/data/debian-cd/kali-rolling
+0
-249
scripts/build/binary_efi less more
0 #!/bin/sh
1
2 ## live-build(7) - System Build Scripts
3 ## Copyright (C) 2014 Raphaël Hertzog <[email protected]>
4 ##
5 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
6 ## This is free software, and you are welcome to redistribute it
7 ## under certain conditions; see COPYING for details.
8
9
10 set -e
11
12 # Including common functions
13 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
14
15 # Setting static variables
16 DESCRIPTION="$(Echo 'prepares and installs EFI support into binary')"
17 HELP=""
18 USAGE="${PROGRAM} [--force]"
19
20 Arguments "${@}"
21
22 # Reading configuration files
23 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
24 Set_defaults
25
26 LB_PRIMARY_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk -F, '{ print $1 }')
27
28 if [ "${LB_PRIMARY_BOOTLOADER}" != "syslinux" ]
29 then
30 exit 0
31 fi
32
33 Echo_message "Begin preparing EFI support..."
34
35 # Requiring stage file
36 Require_stagefile .build/config .build/bootstrap
37
38 # Checking stage file
39 Check_stagefile .build/binary_efi
40
41 # Checking lock file
42 Check_lockfile .lock
43
44 # Creating lock file
45 Create_lockfile .lock
46
47 # Check architecture
48 Check_architectures amd64 i386
49 Check_crossarchitectures
50
51 case "${LB_ARCHITECTURES}" in
52 amd64)
53 _EFI_TYPE=efi64
54 ;;
55 i386)
56 _EFI_TYPE=efi32
57 ;;
58 *)
59 echo "ERROR: can't provide EFI boot support to architecture ${LB_ARCHITECTURES}" >&2
60 exit 1
61 ;;
62 esac
63
64 # Assembling image specifics
65 case "${LIVE_IMAGE_TYPE}" in
66 iso*)
67 _BOOTLOADER="isolinux"
68
69 case "${LB_MODE}" in
70 progress-linux)
71 _CONFDIR="binary/boot"
72 ;;
73
74 *)
75 _CONFDIR="binary/isolinux"
76 ;;
77 esac
78 ;;
79
80 netboot)
81 _BOOTLOADER="pxelinux"
82 _CONFDIR="tftpboot"
83 ;;
84
85 hdd*|*)
86 case ${LB_BINARY_FILESYSTEM} in
87 fat*|ntfs)
88 _BOOTLOADER=syslinux
89
90 case "${LB_MODE}" in
91 progress-linux)
92 _CONFDIR="binary/boot"
93 ;;
94
95 *)
96 _CONFDIR="binary/syslinux"
97 ;;
98 esac
99 ;;
100
101 ext[234]|btrfs)
102 _BOOTLOADER=extlinux
103 _CONFDIR="binary/boot/extlinux"
104 ;;
105
106 *)
107 Echo_error "syslinux/extlinux doesn't support ${LB_BINARY_FILESYSTEM}"
108 exit 1
109 ;;
110 esac
111 ;;
112 esac
113
114 # Checking depends
115 Check_package chroot /usr/bin/syslinux syslinux
116 Check_package chroot /usr/lib/syslinux syslinux-common
117 Check_package chroot /usr/lib/SYSLINUX.EFI syslinux-efi
118 Check_package chroot /usr/bin/mcopy mtools
119 Check_package chroot /sbin/mkfs.msdos dosfstools
120
121 case "${LB_BUILD_WITH_CHROOT}" in
122 true)
123 _CHROOT_DIR="" ## Chroot dir is root dir within the chroot...
124 _SYSLINUX_EFI_DIR="chroot/usr/lib/SYSLINUX.EFI/$_EFI_TYPE"
125 _SYSLINUX_COMMON_DIR="chroot/usr/lib/syslinux/modules/$_EFI_TYPE"
126 ;;
127
128 false)
129 _CHROOT_DIR="chroot"
130 _SYSLINUX_EFI_DIR="/usr/lib/syslinux/$_EFI_TYPE"
131 _SYSLINUX_COMMON_DIR="/usr/lib/syslinux/modules/$_EFI_TYPE"
132 ;;
133 esac
134
135 # Restoring cache
136 Restore_cache cache/packages.binary
137
138 # Installing depends
139 Install_package
140
141 # Abort if we don't have the required EFI files
142 if [ ! -e $_SYSLINUX_EFI_DIR/syslinux.efi ]; then
143 Echo_warning "$_SYSLINUX_EFI_DIR/syslinux.efi missing, no EFI support included."
144 case "${LB_BUILD_WITH_CHROOT}" in
145 true)
146 # Saving cache
147 Save_cache cache/packages.binary
148
149 # Removing depends
150 Remove_package
151 ;;
152 esac
153 exit 0
154 fi
155
156 # Cleanup files that we generate
157 rm -rf chroot/efi-temp chroot/efi.img binary/boot/efi.img
158
159 # Copy syslinux and its config files in the temporary EFI image
160 mkdir -p chroot/efi-temp/live
161 mkdir -p chroot/efi-temp/EFI/BOOT
162 for _F in $_CONFDIR/*.cfg $_CONFDIR/*.png $_SYSLINUX_COMMON_DIR/*.*32 $_SYSLINUX_COMMON_DIR/*.*64; do
163 if [ -e $_F ]; then
164 cp $_F chroot/efi-temp/EFI/BOOT/
165 else
166 Echo_warning "No file matching $_F, EFI support might be broken."
167 fi
168 done
169 cp $_SYSLINUX_EFI_DIR/syslinux.efi chroot/efi-temp/EFI/BOOT/BOOTX64.efi
170 cp $_SYSLINUX_EFI_DIR/syslinux.efi chroot/efi-temp/EFI/BOOT/syslinux.efi
171
172 # Copy the various kernel images
173 cp binary/live/vmlinuz* binary/live/initrd.img* chroot/efi-temp/live/
174 if [ -d binary/install ]; then
175 cp -r binary/install chroot/efi-temp/
176 fi
177
178 # Edit the menu to differentiate the EFI version
179 if [ -e chroot/efi-temp/EFI/BOOT/menu.cfg ]; then
180 sed -i -e "s/^menu title/menu title EFI/" chroot/efi-temp/EFI/BOOT/menu.cfg
181 else
182 Echo_warning "No menu.cfg file that can be edited to indicate that we boot on EFI!"
183 fi
184
185 # Ensure we have a syslinux.cfg
186 if [ ! -e chroot/efi-temp/EFI/BOOT/syslinux.cfg ]; then
187 for _F in isolinux.cfg pxelinux.cfg/default extlinux.conf; do
188 if [ -f chroot/efi-temp/EFI/BOOT/$_F ]; then
189 cp chroot/efi-temp/EFI/BOOT/$_F chroot/efi-temp/EFI/BOOT/syslinux.cfg
190 break
191 fi
192 done
193 fi
194
195 # Define the EFI filesystem size
196 _TOTALSIZE=$(du -sk chroot/efi-temp/ | awk '{print $1}')
197 # Add 5% safety margin
198 _TOTALSIZE=$(( $_TOTALSIZE * 21 / 20 ))
199 # Required size rounded to upper 32kb
200 _BLOCKS=$(( ($_TOTALSIZE + 31) / 32 * 32 ))
201 Echo "EFI boot image needs $_TOTALSIZE Kb, thus allocating $_BLOCKS blocks."
202
203 # Script to generate the EFI boot image
204 cat >binary.sh <<END
205 #!/bin/sh
206
207 set -e
208
209 mkfs.msdos -C $_CHROOT_DIR/efi.img $_BLOCKS
210 mcopy -s -v -i $_CHROOT_DIR/efi.img $_CHROOT_DIR/efi-temp/* ::
211 END
212
213 # Copying files
214 case "${LB_BUILD_WITH_CHROOT}" in
215 true)
216 mv binary.sh chroot/
217 Chroot chroot "sh binary.sh"
218 rm -f chroot/binary.sh
219
220 # Saving cache
221 Save_cache cache/packages.binary
222
223 # Removing depends
224 Remove_package
225 ;;
226
227 false)
228 sh binary.sh
229 rm -f binary.sh
230 ;;
231 esac
232
233 mkdir -p binary/boot
234 mv chroot/efi.img binary/boot/
235 rm -rf chroot/efi-temp
236
237 case "${LB_BUILD_WITH_CHROOT}" in
238 true)
239 # Saving cache
240 Save_cache cache/packages.binary
241
242 # Removing depends
243 Remove_package
244 ;;
245 esac
246
247 # Creating stage file
248 Create_stagefile .build/binary_efi
6969
7070 # Handle xorriso generic options
7171 XORRISO_OPTIONS="-R -r -J -joliet-long -l -cache-inodes -iso-level 3"
72
73 case "${LB_BUILD_WITH_CHROOT}" in
74 true)
75 XORRISO_VER=$(Chroot chroot xorriso --version 2>&1 | awk '
76 /^xorriso version/ {
77 split($4, ver, ".")
78 print ver[1]*10000+ver[2]*100+ver[3]
79 }')
80 ;;
81 false)
82 XORRISO_VER=$(xorriso --version 2>&1 | awk '
83 /^xorriso version/ {
84 split($4, ver, ".")
85 print ver[1]*10000+ver[2]*100+ver[3]
86 }')
87 ;;
88 esac
8972
9073 # Handle xorriso live-build specific options
9174 if [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]
190173 done
191174 IFS="$OLDIFS"
192175
193 if [ -e binary/boot/efi.img ]; then
194 #if [ "$XORRISO_VER" -le 10202 ]; then
195 # 1.2.2 shipping in wheezy
196 Echo "Using older EFI command line for xorriso $XORRISO_VER"
197 # Tell xorriso to create a secondary ElTorito boot record for the
198 # EFI bootloader
199 XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot --efi-boot boot/efi.img"
200 # Add the efi image as a FAT partition too, so our CD image will
201 # also boot on a USB key (like isohybrid, just implemented
202 # differently)
203 XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0x01 binary/boot/efi.img"
204 #else
205 # Echo "Using newer EFI support in xorriso $XORRISO_VER"
206 # XORRISO_OPTIONS="${XORRISO_OPTIONS} -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
207 # XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat"
208 #fi
209 else
210 Echo "No EFI boot code to include in the ISO"
211 fi
212
213176 #if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
214177 #then
215178 # XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"