uefi and bios style boot images with mkisofs

This commit is contained in:
cvoges12 2021-10-07 22:47:00 +00:00
parent 0078535118
commit 1868029f7b
1 changed files with 47 additions and 8 deletions

View File

@ -4,29 +4,68 @@ printf '%b\n' "\n\033[1m"WINDOWS_INIT:"\033[0m"" Executing extract_iso.sh"
src/extract_iso.sh
EXTRACT="win/"
printf '%b\n' "\n\033[1m"WINDOWS_INIT:"\033[0m"" Executing bootsect.sh"
src/bootsect.sh
#printf '%b\n' "\n\033[1m"WINDOWS_INIT:"\033[0m"" Executing bootsect.sh"
#./src/bootsect.sh
#BOOT="bootsect.bin"
# add answerfile
cp data/autounattend.xml ${EXTRACT}
BOOT="bootsect.bin"
# data for mkisofs
BOOT="boot/etfsboot.com"
EFI="efi/boot/bootx64.efi"
LOAD_SEG="$(dumpet -i Win*.iso \
| grep "Media load segment: " \
| cut -d ':' -f2 \
| cut -d ' ' -f2)"
LOAD_SIZE="$(dumpet -i Win*.iso \
| grep "Load Sectors: " \
| grep -o "[^:]*$" \
| cut -d ' ' -f2 \
| head -1)"
LDA="$(dumpet -i Win*.iso \
| grep "LDA" \
| tail -n 1 \
| awk '{printf $3}')"
CDROM_SECTOR_SIZE=2048
FLOPPY_SECTOR_SIZE=512
# number of floppy disk sectors
dd if=Win*.iso bs=${CDROM_SECTOR_SIZE} skip=${LDA} count=1 > win.dmp
FLOPPY_SECTORS="$(file win.dmp \
| sed -e "s/.*sectors\ //" \
| awk '{printf $1}')"
rm win.dmp
CDROM_SECTORS=`expr $FLOPPY_SECTOR_SIZE \
\* $FLOPPY_SECTORS \
/ $CDROM_SECTOR_SIZE`
dd if=Win*.iso bs=${CDROM_SECTOR_SIZE} skip=${LDA} count=${CDROM_SECTORS} of=win_efi_boot.img
# install mkisofs
# recreate iso
cd ${EXTRACT}
mkisofs \
-allow-limited-size \
-b ${BOOT} \
-no-emul-boot \
-boot-load-seg 1984 \
-boot-load-size 4 \
-b ${BOOT} \
-boot-load-seg ${LOAD_SEG} \
-boot-load-size ${LOAD_SIZE} \
-eltorito-alt-boot \
-b ${EFI} \
-eltorito-platform efi \
-iso-level 2 \
-J -l -D -N -joliet-long -relaxed-filenames \
-boot-info-table
-udf
-J -l -joliet-long \
-D \
-N \
-relaxed-filenames \
-V "WINSP" \
-o winsp.iso \
.
cp winsp.iso ../
mv winsp.iso ../
# clean up bootsect and iso extract
cd ..