[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-xorriso] Creating a data partition after writing iso-hybrid ima
From: |
Thomas Schmitt |
Subject: |
Re: [Bug-xorriso] Creating a data partition after writing iso-hybrid image |
Date: |
Thu, 01 Dec 2016 12:44:20 +0100 |
Hi,
i made this successful experiment with a Debian amd64 ISO:
Obtain an MBR template file from the existing MBR. Ubuntu uses local
disk file /usr/lib/syslinux/isohdpfx.bin instead. Both are supposed
to yield the same result after -isohybrid-mbr.
dd if=debian-8.4.0-amd64-netinst.iso bs=512 count=1 \
of=debian-8.4.0-amd64-netinst.mbr
Mount the ISO for copying its files
mount debian-8.4.0-amd64-netinst.iso /mnt/iso
Mix original ISO bootability options (learned from
-report_system_area "as_mkisofs") with options used by the grub-mkrescue
wrapper in mode "mbr_only" and with -partition_offset 16 from the Ubuntu
ISO generation:
xorriso -as mkisofs \
-o test.iso \
-partition_offset 16 \
-V 'Debian 8.4.0 amd64 1' \
-isohybrid-mbr debian-8.4.0-amd64-netinst.mbr \
-no-pad \
-append_partition 2 0xef /mnt/iso/boot/grub/efi.img \
-c /isolinux/boot.cat \
-b /isolinux/isolinux.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-eltorito-alt-boot \
-e --interval:appended_partition_2:all:: \
-no-emul-boot \
/mnt/iso
--------------------------------------------------------------------------
Inspecting the result by
xorriso -indev test.iso -report_system_area plain -report_el_torito plain
yields:
Volume id : 'Debian 8.4.0 amd64 1'
System area options: 0x00000102
System area summary: MBR isohybrid cyl-align-on
ISO image size/512 : 569344
Partition offset : 16
MBR heads per cyl : 64
MBR secs per head : 32
MBR partition table: N Status Type Start Blocks
MBR partition : 1 0x80 0x17 64 569280
MBR partition : 2 0x00 0xef 569344 832
El Torito catalog : 1039 1
El Torito cat path : /isolinux/boot.cat
El Torito images : N Pltf B Emul Ld_seg Hdpt Ldsiz LBA
El Torito boot img : 1 BIOS y none 0x0000 0x00 4 1040
El Torito boot img : 2 UEFI y none 0x0000 0x00 832 142336
El Torito img path : 1 /isolinux/isolinux.bin
El Torito img opts : 1 boot-info-table isohybrid-suitable
El Torito img blks : 2 208
There is still a copy of the EFI boot image in the ISO, because i did not
remove it from the input tree. This file /boot/grub/efi.img is not used
for booting, though, but rather its copy in partition 2 outside the ISO
filesystem is published by El Torito and MBR partition table.
/sbin/fdisk -l test.iso
reports
Disk /dvdbuffer/test.iso: 278.4 MiB, 291930112 bytes, 570176 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: dos
Disk identifier: 0x7c277999
Device Boot Start End Sectors Size Id Type
/dvdbuffer/test.iso1 * 64 569343 569280 278M 17 Hidden HPFS/NTFS
/dvdbuffer/test.iso2 569344 570175 832 416K ef EFI (FAT-12/16/32)
There have been reports that some EFI firmware does not boot if there is
no partition with boot flag. But there is also the EFI prescription that
the EFI System Partition shall not be the one marked by this flag.
So we can leave it where isohybrid prescribes it to be.
(Afaik, it is obeyed only by certain Windows-ish boot loaders which
then chainload the bootloader in the marked partition.)
Putting the ISO onto an USB stick, i get a mountable partition 1:
mount /dev/sdc1 /mnt/iso2
diff -r /mnt/iso /mnt/iso2
yields only these lines
diff: /mnt/iso/debian: recursive directory loop
Binary files /mnt/iso/isolinux/boot.cat and /mnt/iso2/isolinux/boot.cat differ
Binary files /mnt/iso/isolinux/isolinux.bin and
/mnt/iso2/isolinux/isolinux.bin differ
The files differ because they contain the block address of the BIOS boot
image, which differs between both ISOs.
It boots as BIOS -hda on qemu of Debian 8
qemu-system-x86_64 -enable-kvm -m 512 -hda test.iso
as EFI -hda
qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -enable-kvm -m 512 -hda
test.iso
and with both virtual firmwares as -cdrom instead of -hda.
--------------------------------------------------------------------------
Now i am curious whether this suits better your intentions and needs.
One disadvantage is that the ISO filesystem size does not cover the
full size of the image file. If you have copying instructions or verification
instructions, which depend on the result of program "isosize", then you
would have to modify them to rather use the size of the image file.
Have a nice day :)
Thomas