Jak*_*nek 4 boot grub2 customization iso uefi
在我们公司,我们使用修改后的 Ubuntu 安装 ISO 映像。由于 Ubuntu 22.04 更改了安装映像的结构(ISOLINUX 已被删除,取而代之的是 GRUB2),因此我需要有关如何构建同时支持 MBR 和 EFI 的新 ISO(在同一映像上)的建议,如 Ubuntu 22.04。
在 Ubuntu 20.04 中,我使用以下命令构建了 ISO 映像。
那么问题是:如何为 Ubuntu 22.04 构建 ISO 映像?谢谢。
dd if="/opt/ubnt/ubuntu-20.04.4-desktop-amd64.iso" bs=1 count=432 of="/opt/ubnt/isohdpfx.bin"
xorriso -osirrox on -indev /opt/ubnt/ubuntu-20.04.4-desktop-amd64.iso -extract / /opt/ubnt/ubuntu-MODIF
Run Code Online (Sandbox Code Playgroud)
...这里有一些自定义...
xorriso -as mkisofs -r
-V 'Ubuntu 20.04 LTS MODIF (EFIBIOS)'
-o /opt/ubnt/ubuntu-modif.iso
-isohybrid-mbr /opt/ubnt/isohdpfx.bin
-J -joliet-long -b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4
-boot-info-table -no-emul-boot -eltorito-alt-boot
-e boot/grub/efi.img
-no-emul-boot
-isohybrid-gpt-basdat /opt/ubnt/ubuntu-MODIF
Run Code Online (Sandbox Code Playgroud)
小智 8
Ubuntu 22.04 构建 ISO(两者:MBR 和 EFI)
xorriso 的最新版本 (1.5.4) 可以看出:
$ xorriso -indev ubuntu-22.04-desktop-amd64.iso -report_el_torito as_mkisofs
-V 'Ubuntu 22.04 LTS amd64'
--modification-date='2022041910231900'
--grub2-mbr --interval:local_fs:0s-15s:zero_mbrpt,zero_gpt:'ubuntu-22.04-desktop-amd64.iso'
--protective-msdos-label
-partition_cyl_align off
-partition_offset 16
--mbr-force-bootable
-append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b --interval:local_fs:7129428d-7137923d::'ubuntu-22.04-desktop-amd64.iso'
-appended_part_as_gpt
-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7
-c '/boot.catalog'
-b '/boot/grub/i386-pc/eltorito.img'
-no-emul-boot
-boot-load-size 4
-boot-info-table
--grub2-boot-info
-eltorito-alt-boot
-e '--interval:appended_partition_2_start_1782357s_size_8496d:all::'
-no-emul-boot
-boot-load-size 8496
Run Code Online (Sandbox Code Playgroud)
旧版本猜测错误。新的布局让他们有些惊讶。但他们可以创造它。原版由 xorriso-1.5.2 制作。
显示的选项用于尽可能准确地再现 ISO。对于修改后的 ISO,人们会希望省略其中一些以获得默认设置,并通过以后不需要原始 ISO 映像存在的操作来替换其他设置。
# Extract the MBR template for --grub2-mbr
# We only need the x86 code. All partition stuff will be newly created.
dd if=ubuntu-22.04-desktop-amd64.iso bs=1 count=432 of=/opt/ubnt/boot_hybrid.img
# The EFI partition is not a data file inside the ISO any more.
# So extract the EFI partition image image for -append_partition
# 7129428d-7137923d : 7137923 - 7129428 + 1 = 8496
dd if=ubuntu-22.04-desktop-amd64.iso bs=512 skip=7129428 count=8496 of=/opt/ubnt/efi.img
# Extract file tree as usual ...
# Finally pack up an ISO the new way
xorriso -as mkisofs -r \
-V 'Ubuntu 22.04 LTS MODIF (EFIBIOS)' \
-o /opt/ubnt/ubuntu-modif.iso \
--grub2-mbr /opt/ubnt/boot_hybrid.img \
-partition_offset 16 \
--mbr-force-bootable \
-append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b /opt/ubnt/efi.img \
-appended_part_as_gpt \
-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \
-c '/boot.catalog' \
-b '/boot/grub/i386-pc/eltorito.img' \
-no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
-eltorito-alt-boot \
-e '--interval:appended_partition_2:::' \
-no-emul-boot \
/opt/ubnt/ubuntu-MODIF
Run Code Online (Sandbox Code Playgroud)
优点是 USB 记忆棒上的 ISO 将被识别为 GPT 分区,分区整齐分开。
$ /sbin/fdisk -l ubuntu-22.04-desktop-amd64.iso
Disk ubuntu-22.04-desktop-amd64.iso: 3.4 GiB, 3654957056 bytes, 7138588 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A09DB2B8-B5F6-43AE-AFB3-91E0A90189A1
Device Start End Sectors Size Type
ubuntu-22.04-desktop-amd64.iso1 64 7129427 7129364 3.4G Microsoft basic da
ubuntu-22.04-desktop-amd64.iso2 7129428 7137923 8496 4.2M EFI System
ubuntu-22.04-desktop-amd64.iso3 7137924 7138523 600 300K Microsoft basic da
Run Code Online (Sandbox Code Playgroud)
(分区 3 涵盖了 300 KiB 的传统末尾填充,实际上仅在通过写入类型 Track-At-Once 写入的 CD 介质上才需要。选项 -no-pad 会阻止它。)
| 归档时间: |
|
| 查看次数: |
12341 次 |
| 最近记录: |