Da podijelim svoja otkrića. Ipak sam složio skriptu za ovo jer znam da će mi trebati povremeno a ne da mi se prolaziti opet kroz ovakvu kalvariju.
Poanta priče je da treba izripati floppy boot image iz windows diska da bi normalno bootao EFI. Legacy radi bez problema, ali EFI netje samo tako. Drugi dio problema je vjerojatno mkisofs koji je izgleda neka dobrano zastarjela verzija, ali postoji ažurna verzija od autora "schily".
Da pojasnim korake ukratko. Prvo dumpet pokaže LBA offset bootabilanog imagea. Prvi je legacy bootloader, drugi je floppy image koji sadrži bootx64.efi. Međutim, kako se pokazalo, to nije onaj file koji se nalazi na samom disku (efi/boot/bootx64.efi), vjerojatno MS opet trola. Tu je bitan ovaj zadnji Load LBA, Load sectors je izgleda jednostavno krivi podatak.
Citiraj:
$ dumpet -i Wn10_20H2_v2_English_x64.iso
Validation Entry:
> Header Indicator: 0x01 (Validation Entry)
> PlatformId: 0x00 (80x86)
> ID: "Microsoft Corporation"
> Checksum: 0x494c
> Key bytes: 0x55aa
Boot Catalog Default Entry:
> Entry is bootable
> Boot Media emulation type: no emulation
> Media load segment: 0x0 (0000:7c00)
> System type: 0 (0x00)
> Load Sectors: 8 (0x0008)
> Load LBA: 512 (0x00000200)
Section Header Entry:
> Header Indicator: 0x91 (Final Section Header Entry)
> PlatformId: 0xef (EFI)
> Section Entries: 1
> ID: ""
Boot Catalog Section Entry:
> Entry is bootable
> Boot Media emulation type: no emulation
> Media load address: 0 (0x0000)
> System type: 0 (0x00)
> Load Sectors: 1 (0x0001)
> Load LBA: 514 (0x00000202)
|
Jednom kada imamo offset može se dobiti image sa dd iz isoa, i potom dobijemo da bi image trebao imati 2880 sektora * 512 / 2048 = 720 CD sektora, što je pretpostavljam tako na svakoj verziji instalacijskog diska. To je veličina flopija od 1.44MB.
Citiraj:
$ file win_efi_boot.img
win_efi_boot.img: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "MSDOS5.0", root entries 224, sectors 2880 (volumes <=32 MB), sectors/FAT 9, sectors/track 18, serial number 0xa04878, label: "EFISECTOR ", FAT (12 bit), followed by FAT
|
Kako bilo, konačna procedura bi bila ovakva. Prvo mountam originalni image i kopiram fajlove u working direktorij, splitam install.wim u komade od 2GB, dodam win_efi_boot.img u boot direktorij te onda pozovem schilyjev mkisofs i dam mu legacy boot sector te ovaj izripani za EFI. Odradio sam instalaciju u virtualboxu i čini se da bi ovo trebalo biti OK.
Citiraj:
#!/bin/bash
# provide paths, no closing /
ISO_IMAGE="/path/to/Win10.iso"
ISO_IMAGE_OUT="/path/to/Win10_split.iso"
WORKING_DIR="/home/user/working"
echo "Paths set"
echo "ISO_IMAGE $ISO_IMAGE"
echo "WORKING DIRECTORY: $WORKING_DIR"
# prerequisites
# sudo apt-get install libxml2-dev ntfs-3g-dev libfuse-dev libattr1-dev dumpet
# install schily tools http://schilytools.sourceforge.net/
# alias smake=/opt/schily/bin/smake
# alias mkisofs=/opt/schily/bin/mkisofs
# install wimlib https://wimlib.net/
# git clone git://wimlib.net/wimlib
# cd wimlib
# libtoolize --force
# aclocaldc
# autoheader
# automake --force-missing --add-missing
# autoconf
# ./configure
# sudo make install
# gsudo ldconfig -v
printf "\nRemoving/recreating the working directory\n"
rm -r -d -f $WORKING_DIR
mkdir $WORKING_DIR
printf "\nMounting the ISO image\n"
sudo mount -r -t udf $ISO_IMAGE /media/iso
printf "\nCopying the ISO image contents to the working directory\n"
cp -r /media/iso/* $WORKING_DIR
chmod -R 755 $WORKING_DIR
printf "\nUnmounting the ISO image\n"
sudo umount /media/iso
printf "\nSplitting the install.wim archive\n"
wimsplit $WORKING_DIR/sources/install.wim $WORKING_DIR/sources/install.swm 2000
rm -d -f $WORKING_DIR/sources/install.wim
printf "\nGetting the boot image LBA from the ISO\n----------\n"
dumpet -i $ISO_IMAGE
printf "\nShould be a integer number following the second 'Load LBA': "
read LOAD_LBA
printf "\n"
dd if=$ISO_IMAGE bs=2048 skip=$LOAD_LBA count=1 > $WORKING_DIR/efi/win_efi_boot.img
printf "\nNow we get the boot.img and check the right file size.\nThe below output should detect a 'DOS/MBR boot sector' and sectors size should be 2880 which would mean 2880 * 512 / 2048 = 720.\n----------\n"
file $WORKING_DIR/efi/win_efi_boot.img
printf "\nThat would make the input 720: "
read LOAD_COUNT
printf "\n"
dd if=$ISO_IMAGE bs=2048 skip=$LOAD_LBA count=$LOAD_COUNT > $WORKING_DIR/efi/win_efi_boot.img
printf "\nBuilding an image\n"
/opt/schily/bin/mkisofs \
-no-emul-boot \
-b boot/etfsboot.com \
-boot-load-seg 0 \
-boot-load-size 8 \
-eltorito-alt-boot \
-no-emul-boot \
-b efi/win_efi_boot.img \
-boot-load-size 1 \
-iso-level 4 \
-UDF \
-o $ISO_IMAGE_OUT \
$WORKING_DIR/
printf "\n\nImage ready!\n\n"
|