Lines 246-299
case ${clst_hostarch} in
Link Here
|
246 |
|
246 |
|
247 |
;; |
247 |
;; |
248 |
x86|amd64) |
248 |
x86|amd64) |
249 |
if [ -e "${clst_target_path}/boot/elilo.efi" ] |
249 |
# detect if an EFI bootloader is desired |
|
|
250 |
if [ -d "${clst_target_path}/boot/efi" ] || \ |
251 |
[ -d "${clst_target_path}/boot/EFI" ] || \ |
252 |
[ -e "${clst_target_path}/gentoo.efimg" ] |
250 |
then |
253 |
then |
251 |
if [ ! -e "${clst_target_path}/gentoo.efimg" ] |
254 |
if [ -e "${clst_target_path}/gentoo.efimg" ] |
252 |
then |
255 |
then |
|
|
256 |
echo "Found prepared EFI boot image at \ |
257 |
${clst_target_path}/gentoo.efimg" |
258 |
# /boot must exist and be empty for later logic |
259 |
echo "Removing /boot contents" |
260 |
rm -rf "${clst_target_path}"/boot |
261 |
mkdir -p "${clst_target_path}"/boot |
262 |
else |
263 |
echo "Preparing EFI boot image" |
264 |
# prepare gentoo.efimg from cdtar's /boot dir |
253 |
iaSizeTemp=$(du -sk "${clst_target_path}/boot" 2>/dev/null) |
265 |
iaSizeTemp=$(du -sk "${clst_target_path}/boot" 2>/dev/null) |
254 |
iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1) |
266 |
iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1) |
255 |
iaSize=$((${iaSizeB}+32)) # Add slack |
267 |
iaSize=$((${iaSizeB}+32)) # Add slack |
256 |
|
268 |
echo "Creating loopback file of size ${iaSize}kB" |
257 |
dd if=/dev/zero of="${clst_target_path}/gentoo.efimg" bs=1k \ |
269 |
dd if=/dev/zero of="${clst_target_path}/gentoo.efimg" bs=1k \ |
258 |
count=${iaSize} |
270 |
count=${iaSize} |
|
|
271 |
echo "Formatting loopback file with FAT16 FS" |
259 |
mkfs.vfat -F 16 -n GENTOO "${clst_target_path}/gentoo.efimg" |
272 |
mkfs.vfat -F 16 -n GENTOO "${clst_target_path}/gentoo.efimg" |
260 |
|
273 |
|
261 |
mkdir "${clst_target_path}/gentoo.efimg.mountPoint" |
274 |
mkdir "${clst_target_path}/gentoo.efimg.mountPoint" |
|
|
275 |
echo "Mounting FAT16 loopback file" |
262 |
mount -t vfat -o loop "${clst_target_path}/gentoo.efimg" \ |
276 |
mount -t vfat -o loop "${clst_target_path}/gentoo.efimg" \ |
263 |
"${clst_target_path}/gentoo.efimg.mountPoint" |
277 |
"${clst_target_path}/gentoo.efimg.mountPoint" |
264 |
|
278 |
|
265 |
echo "Populating EFI image" |
279 |
echo "Populating EFI image file from ${clst_target_path}/boot" |
266 |
cp -rv "${clst_target_path}"/boot/* \ |
280 |
cp -rv "${clst_target_path}"/boot/* \ |
267 |
"${clst_target_path}/gentoo.efimg.mountPoint" |
281 |
"${clst_target_path}/gentoo.efimg.mountPoint" |
268 |
|
282 |
|
269 |
umount "${clst_target_path}/gentoo.efimg.mountPoint" |
283 |
umount "${clst_target_path}/gentoo.efimg.mountPoint" |
270 |
rmdir "${clst_target_path}/gentoo.efimg.mountPoint" |
284 |
rmdir "${clst_target_path}/gentoo.efimg.mountPoint" |
271 |
if [ ! -e "${clst_target_path}/boot/grub/stage2_eltorito" ] |
285 |
|
272 |
then |
286 |
echo "Removing /boot contents" |
273 |
echo "Removing /boot" |
287 |
rm -rf "${clst_target_path}"/boot |
274 |
rm -rf "${clst_target_path}/boot" |
288 |
mkdir -p "${clst_target_path}"/boot |
275 |
fi |
|
|
276 |
else |
277 |
echo "Found populated EFI image at \ |
278 |
${clst_target_path}/gentoo.efimg" |
279 |
fi |
289 |
fi |
280 |
fi |
290 |
fi |
281 |
|
291 |
|
282 |
if [ -e "${clst_target_path}/isolinux/isolinux.bin" ] |
292 |
if [ -e "${clst_target_path}/isolinux/isolinux.bin" ] |
283 |
then |
293 |
then |
|
|
294 |
echo "** Found ISOLINUX bootloader" |
284 |
if [ -d "${clst_target_path}/boot" ] |
295 |
if [ -d "${clst_target_path}/boot" ] |
285 |
then |
296 |
then |
286 |
if [ -n "$(ls ${clst_target_path}/boot)" ] |
297 |
if [ -n "$(ls ${clst_target_path}/boot)" ] |
|
|
298 |
# have stray files in /boot, assume ISOLINUX only |
287 |
then |
299 |
then |
|
|
300 |
echo "** boot dir not empty, moving files to isolinux/ then removing it" |
288 |
mv "${clst_target_path}"/boot/* "${clst_target_path}/isolinux" |
301 |
mv "${clst_target_path}"/boot/* "${clst_target_path}/isolinux" |
289 |
rm -r "${clst_target_path}/boot" |
302 |
rm -r "${clst_target_path}/boot" |
290 |
echo "Creating ISO using ISOLINUX bootloader" |
303 |
echo "Creating ISO using ISOLINUX bootloader" |
291 |
run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ |
304 |
run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ |
292 |
isohybrid "${1}" |
305 |
isohybrid "${1}" |
293 |
elif [ -e "${clst_target_path}/gentoo.efimg" ] |
306 |
elif [ -e "${clst_target_path}/gentoo.efimg" ] |
|
|
307 |
# have BIOS isolinux, plus an EFI loader image |
294 |
then |
308 |
then |
295 |
echo "Creating ISO using both ISOLINUX and EFI bootloader" |
309 |
echo "Creating ISO using both ISOLINUX and EFI bootloader" |
296 |
run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z "${clst_target_path}"/ |
310 |
run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/ |
|
|
311 |
isohybrid --uefi "${1}" |
297 |
fi |
312 |
fi |
298 |
else |
313 |
else |
299 |
echo "Creating ISO using ISOLINUX bootloader" |
314 |
echo "Creating ISO using ISOLINUX bootloader" |