我知道有很多类似的问题,但它们不够具体。
我有一个 Windows 10 x64 安装 ISO,我正在尝试提取文件进行一些修改,然后从提取/修改的文件中创建一个新的 ISO。
它基本上工作得很好,但问题是我不知道如何让它再次启动 UEFI(在传统/BIOS 模式下它启动得很好)。
按照有关如何执行此操作的说明,我浏览了无数帖子,但没有一个适用于我的 Windows 10 ISO。这些帖子中的大多数只提到了旧版本的 Windows,而那些提到 Windows 10 的帖子并没有说明他们是否让它与当前的 x64 版本一起工作,以及他们是否能够从它进行 UEFI 引导。(可能不是,因为它肯定不适合我。)
我最终试图尽可能多地复制isoinfo -d -i ./windows10.iso
输出dumpet -i ./windows10.iso
。
这是我所能得到的最接近的:(编辑:更新-eltorito-alt-boot
为电信公司的建议)
原始 ISO(isoinfo):
$ isoinfo -d -i ./original.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: CCCOMA_X64FRE_EN-US_DV9
Volume set id: CCCOMA_X64FRE_EN-US_DV9
Publisher id: MICROSOFT CORPORATION
Data preparer id: MICROSOFT CORPORATION, ONE MICROSOFT WAY, REDMOND WA 98052, (425) 882-8080
Application id: CDIMAGE 2.56 (01/01/2005 TM)
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 2411879
El Torito VD version 1 found, boot catalog is in sector 22
NO Joliet present
NO Rock Ridge present
Eltorito validation header:
Hid 1
Arch 0 (x86)
ID 'Microsoft Corporation'
Key 55 AA
Eltorito defaultboot header:
Bootid 88 (bootable)
Boot media 0 (No Emulation Boot)
Load segment 0
Sys type 0
Nsect 8
Bootoff 202 514
修改后的 ISO (isoinfo):
$ isoinfo -d -i ./modified.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: CCCOMA_X64FRE_EN-US_DV9
Volume set id: CCCOMA_X64FRE_EN-US_DV9
Publisher id: Microsoft Corporation
Data preparer id: MICROSOFT CORPORATION, ONE MICROSOFT WAY, REDMOND WA 98052, (425) 882-8080
Application id: CDIMAGE 2.56 (01/01/2005 TM)
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 2411275
El Torito VD version 1 found, boot catalog is in sector 1506
NO Joliet present
NO Rock Ridge present
Eltorito validation header:
Hid 1
Arch 0 (x86)
ID 'Microsoft Corporation'
Key 55 AA
Eltorito defaultboot header:
Bootid 88 (bootable)
Boot media 0 (No Emulation Boot)
Load segment 0
Sys type 0
Nsect 8
Bootoff 8CD 2253
上述 isoinfo 输出之间的区别:
$ diff <(isoinfo -i ./original.iso) <(isoinfo -i ./modified.iso)
5c5
< Publisher id: MICROSOFT CORPORATION
---
> Publisher id: Microsoft Corporation
14,15c14,15
< Volume size is: 2411879
< El Torito VD version 1 found, boot catalog is in sector 22
---
> Volume size is: 2411275
> El Torito VD version 1 found, boot catalog is in sector 1506
29c29
< Bootoff 202 514
---
> Bootoff 8CD 2253
原始 ISO (dumpet):
$ dumpet -i ./original.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: 514 (0x00000202)
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: 516 (0x00000204)
修改后的 ISO (dumpet):
$ dumpet -i ./modified.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: 2253 (0x000008cd)
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: 2984 (0x0ba8)
Load LBA: 1507 (0x000005e3)
上述转储输出之间的区别:
$ diff <(dumpet -i ./original.iso) <(dumpet -i ./modified.iso)
13c13
< Load LBA: 514 (0x00000202)
---
> Load LBA: 2253 (0x000008cd)
24,25c24,25
< Load Sectors: 1 (0x0001)
< Load LBA: 516 (0x00000204)
---
> Load Sectors: 2984 (0x0ba8)
> Load LBA: 1507 (0x000005e3)
我已经编写了一个脚本,以使用我正在使用的相同 ISO 完全重现该问题:
#!/usr/bin/env bash
##################################
# Download the Windows 10 x64 ISO
WIN10_IMG_DESTINATION="./windows.iso"
WIN10_IMG_ARCH="x64"
if [ ! -f "${WIN10_IMG_DESTINATION}" ]; then
if [[ "$WIN10_IMG_ARCH" == "x86" ]] || [[ "$WIN10_IMG_ARCH" == "i386" ]] ; then
echo "Retrieving the x86 Windows 10 iso URL..."
WINDOWS_10_ISO_URL=$(curl -LsI -o /dev/null -w %{url_effective} "https://windows101tricks.com/1903-iso-32")
else
echo "Retrieving the x64 Windows 10 iso URL..."
WINDOWS_10_ISO_URL=$(curl -LsI -o /dev/null -w %{url_effective} "https://windows101tricks.com/1903-iso-64")
fi
echo "Making sure the URL comes from a trusted Microsoft (sub)domain..."
if [[ $WINDOWS_10_ISO_URL == https://software-download.microsoft.com/* ]] ; then
echo "Downloading the Windows 10 installation iso..."
wget "$WINDOWS_10_ISO_URL" -O "$WIN10_IMG_DESTINATION"
else
echo "URL validation failed. Please download the Windows 10 iso manually."
exit 1
fi
else
echo "Windows 10 iso already exists. Skipping download..."
fi
#
##################################
# Variable containing the path to the windows.iso
WIN10_IMG="$WIN10_IMG_DESTINATION"
TMP="./tmp"
ISO_FILES="${TMP}/iso-files"
ISO_MP="${TMP}/iso-mountpoint"
# Remove ./tmp if it already exists, then create ./tmp/iso-files and ./tmp/iso-mountpoint
rm -rf "${TMP}"
mkdir -p "${ISO_FILES}"
mkdir -p "${ISO_MP}"
# Extract the files fromt he ISO to ./tmp/iso-files
sudo mount -t udf "${WIN10_IMG}" "${ISO_MP}"
sudo cp -Rva ${ISO_MP}/* "${ISO_FILES}"
sudo umount "${ISO_MP}"
# Make modifications to the Windows ISO
#BOOT_DIR="${ISO_FILES}/efi/microsoft/boot"
#sudo mv "${BOOT_DIR}/cdboot.efi" "${BOOT_DIR}/tmp.efi"
#sudo mv "${BOOT_DIR}/cdboot_noprompt.efi" "${BOOT_DIR}/cdboot.efi"
#sudo mv "${BOOT_DIR}/tmp.efi" "${BOOT_DIR}/cdboot_noprompt.efi"
# Extract the boot.img (didn't help at all)
#BOOT_SECTOR_LENGTH="$(isoinfo -d -i "${WIN10_IMG}" | grep "Nsect " | grep -o "[^ ]*$")"
#STARTING_SECTOR="$(isoinfo -d -i ./vm-files/windows10.iso | grep "Bootoff " | grep -o "[^ ]*$")"
#dd if="${WIN10_IMG}" of="${ISO_FILES}/boot.img" bs=2048 count="${BOOT_SECTOR_LENGTH}" skip="${STARTING_SECTOR}"
# Extract boot load segment address and size
BOOT_LOAD_SEG="$(dumpet -i "${WIN10_IMG}" | grep "Media load segment: " | cut -d ':' -f2 | cut -d ' ' -f2)"
BOOT_LOAD_SIZE="$(dumpet -i "${WIN10_IMG}" | grep "Load Sectors: " | grep -o "[^:]*$" | cut -d ' ' -f2 | head -1)"
# Extract meta data :
SYSTEM_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "System id: " | cut -d ' ' -f3-)"
VOLUME_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Volume id: " | cut -d ' ' -f3-)"
VOLUME_SET_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Volume set id: " | cut -d ' ' -f4-)"
#PUBLISHER_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Publisher id: " | cut -d ' ' -f3-)" # Always uppercase
PUBLISHER_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "ID '" | cut -d "'" -f2)"
DATA_PREPARER_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Data preparer id: " | cut -d ' ' -f4-)"
APPLICATION_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Application id: " | cut -d ' ' -f3-)"
COPYRIGHT_FILE_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Copyright file id: " | cut -d ' ' -f4-)"
ABSTRACT_FILE_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Abstract file id: " | cut -d ' ' -f4-)"
BIBLIOGRAPHIC_FILE_ID="$(isoinfo -d -i "${WIN10_IMG}" | grep "Bibliographic file id: " | cut -d ' ' -f4-)"
# Create a new ISO image using mkisofs
# (.mkisofsrc is necessary, because some options are not available on the cli directly)
rm ".mkisofsrc"
echo "APPI=${APPLICATION_ID}" >> ".mkisofsrc"
echo "COPY=${COPYRIGHT_FILE_ID}" >> ".mkisofsrc"
echo "ABST=${ABSTRACT_FILE_ID}" >> ".mkisofsrc"
echo "BIBL=${BIBLIOGRAPHIC_FILE_ID}" >> ".mkisofsrc"
echo "PREP=${DATA_PREPARER_ID}" >> ".mkisofsrc"
echo "PUBL=${PUBLISHER_ID}" >> ".mkisofsrc"
echo "SYSI=${SYSTEM_ID}" >> ".mkisofsrc"
echo "VOLI=${VOLUME_ID}" >> ".mkisofsrc"
echo "VOLS=${VOLUME_SET_ID}" >> ".mkisofsrc"
sudo rm "${WIN10_IMG}.tmp.iso"
sudo mkisofs \
-no-emul-boot \
-b boot/etfsboot.com \
-boot-load-seg "${BOOT_LOAD_SEG}" \
-boot-load-size "${BOOT_LOAD_SIZE}" \
-eltorito-alt-boot \
-e efi/boot/bootx64.efi \
-no-emul-boot \
-iso-level 2 \
-boot-info-table \
-udf \
-D \
-N \
-relaxed-filenames \
-allow-lowercase \
-o "${WIN10_IMG}.tmp.iso" \
"${ISO_FILES}"
rm ".mkisofsrc"
# Print the variables that we gathered
echo
echo "Extracted meta data (form original image):"
echo "BOOT_LOAD_SEG: ${BOOT_LOAD_SEG}"
echo "BOOT_LOAD_SIZE: ${BOOT_LOAD_SIZE}"
echo "-------"
echo "SYSTEM_ID: ${SYSTEM_ID}"
echo "VOLUME_ID: ${VOLUME_ID}"
echo "VOLUME_SET_ID: ${VOLUME_SET_ID}"
echo "PUBLISHER_ID: ${PUBLISHER_ID}"
echo "DATA_PREPARER_ID: ${DATA_PREPARER_ID}"
echo "APPLICATION_ID: ${APPLICATION_ID}"
echo "COPYRIGHT_FILE_ID: ${COPYRIGHT_FILE_ID}"
echo "ABSTRACT_FILE_ID: ${ABSTRACT_FILE_ID}"
echo "BIBLIOGRAPHIC_FILE_ID: ${BIBLIOGRAPHIC_FILE_ID}"
# Show difference between new and old image as reported by isoinfo
echo
echo "-------------- isoinfo diff -----------------"
diff <(isoinfo -d -i "${WIN10_IMG}") <(isoinfo -d -i "${WIN10_IMG}.tmp.iso")
# Show difference between new and old image as reported by dumpet
echo
echo " -------------- dumpet diff -----------------"
diff <(dumpet -i "${WIN10_IMG}") <(dumpet -i "${WIN10_IMG}.tmp.iso")
# Overwrite the original ISO with the new one
#sudo rm "${WIN10_IMG}"
#sudo mv "${WIN10_IMG}.tmp.iso" "${WIN10_IMG}"
输出表明原始
dumpet
文件包含两个 ElTorito 引导映像:一个用于 BIOS 样式引导,另一个用于 UEFI。使用选项为 BIOS 指定第一个引导映像后mkisofs
,您需要使用-eltorito-alt-boot
和-eltorito-platform efi
选项来指定第二个引导映像。像这样的东西:我不确定哪个文件可以用作 UEFI 启动映像。
更新:我得到了一个原始的 Windows 10 ISO 映像,并做了一些实验。在我的版本中,
Load LBA
UEFI 启动项的值为 519。记住 CD-ROM 块大小为 2048 字节,我转储了该块:看起来像 1.4 MB 软盘映像的开头。2880 个软盘扇区 * 每个软盘扇区 512 字节 / 每个 CD-ROM 扇区 2048 字节 = 720 个 CD-ROM 扇区。我猜固件只是忽略了该
Load Sectors
值,并查看 FAT 引导扇区以找到实际大小。是的,它包含一个 (v)FAT12 文件系统,只有一个文件:
\EFI\BOOT\BOOTX64.EFI
,大小为 936352 字节。我还对文件进行了十六进制转储
win_efi_boot.img
:文件结束后BOOTX64.EFI
,软盘映像的其余部分都填充了所有零字节,所以我认为count=720
是准确的。因此,您应该能够执行相同的操作以从原始 ISO(如 my
win_efi_boot.img
)中提取 UEFI 引导文件系统映像,并根据您的-e
选择使用它。To expand on and adumbrate the useful information @telcoM has provided above I provide this procedure which landed me with a working (i.e. EFI bootable,
Wn10_20H2_v2_English_x64.iso
) ISO. My intent was to split theinstall.wim
file as to allow installation from a FAT32 USB drive and simple ISO usage with Ventoy.Quick overview:
mkisofs
issueswim
archiveboofx64.efi
contained within does not appear to be the same file as the one from theefi/boot/
directoryThe script:
看这里:
为 Windows 10 创建自定义 ISO:第 1 部分(共 6 部分)
如果我不得不猜测您的 ISO 不会在 UEFI 中启动,因为您正在直接复制启动扇区。你不能那样做。请参阅第 5 部分,它使用DISM - 部署映像服务和管理。Microsoft 构建了本地工具来完全满足您的需求,但他们希望您使用有效的 Windows 环境来完成任务。如果您遵循我上面链接的博客部分,您可能还需要Windows ADK - Windows 评估和部署工具包。
您可以尝试使用以下命令:
取自这里: http: //forum.imgburn.com/index.php? /topic/24193-problem-i-can-not-create-a-uefi-bootable-iso-image/&do=findComment&comment=158044
I've spent a long time experimenting with the dd method described above. However, that one only partially dumps to EFI boot code and in turn the EFI-Boot will still fail. I found the important hint at: https://docs.microsoft.com/en-us/troubleshoot/windows-server/deployment/create-iso-image-for-uefi-platforms
The boot code for efi is located at "efi/microsoft/boot/efisys.bin"
Knowing that detail the rest is straight forward. It just varies a bit depending on the variant of mkisofs on a specific *nix system. I've successfully tested the following two examples, even UEFI Secure Boot works.
Cent-OS:
MacOS (mac brew):