[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help making bootable ISO
From: |
Thomas Schmitt |
Subject: |
Re: Help making bootable ISO |
Date: |
Sat, 14 Dec 2024 10:20:37 +0100 |
Hi,
> I need help troubleshooting my xorriso command, [...]
>
> [xorriso arguments spread to separate lines for clarity]
>
> xorriso \
> -x \
> -as mkisofs \
> -root ~/iso-work \
> -o ~/ferretos-1.iso \
> -iso-level 3 \
> -U \
> -R \
> -r \
> -D \
> --for_backup \
> -J \
> -joliet-long \
> -V "FERRETOS" \
> -P "CONFIDOWORKS" \
> -p "Feli Flitzberg" \
> -eltorito_platform efi \
> --efi-boot ~/iso-work/boot.img \
> --protective-msdos-label \
> --gpt-iso-bootable \
> -append_partition 2 0xef ~/iso-work/boot.img \
> -appended_part_as_gpt \
> -efi-boot-part ~/iso-work/boot.img \
> $PWD
----------------------------------------------------------------------
This is somewhat overdone.
I propose:
xorriso -as mkisofs \
-o ~/ferretos-1.iso \
-iso-level 3 \
-r \
-D \
--for_backup \
-J \
-joliet-long \
-V "FERRETOS" \
-P "CONFIDOWORKS" \
-p "Feli Flitzberg" \
-append_partition 2 0xef ~/iso-work/boot.img \
-appended_part_as_gpt \
-e --interval:appended_partition_2:all:: \
-no-emul-boot \
$PWD
"-iso-level 3" is needed if one of your data files exceeds the size of
4 GiB - 1. It does not harm if no such file is present.
"--for_backup" adds MD5 checksums for data files and the overall
filesystem. It gives you the opportunity to checkread the ISO before and
after copying it to the target medium:
xorriso -for_backup -indev ~/ferretos-1.iso -check_media --
xorriso -for_backup -indev /dev/sr0 -check_media --
xorriso -for_backup -indev stdio:/dev/sdd -check_media --
"-e --interval:appended_partition_2:all::" tells xorriso to use the
appended partition as El Torito boot image for booting from optical media.
You will possibly get a warning:
xorriso : WARNING : EFI boot equipment is provided but no directory /EFI/BOOT
xorriso : WARNING : will emerge in the ISO filesystem. A popular method to
xorriso : WARNING : prepare a USB stick on MS-Windows relies on having in the
xorriso : WARNING : ISO filesystem a copy of the EFI System Partition tree.
This warning is on behalf of people who do not dd the ISO to the whole
USB stick but rather unpack it into an existing FAT filesystem of the USB
stick. MS-Windows users are familiar with this gesture.
You may safely ignore this warning, especially since your boot.img is
still quite large.
Inspection of the boot equipment in the resulting ISO by
xorriso -indev ~/ferretos-1.iso \
-report_el_torito plain -report_system_area plain
should yield something like this (with larger block and size numbers):
Drive current: -indev '/home/feli/ferretos-1.iso'
Media current: stdio file, overwriteable
Media status : is written , is appendable
Boot record : El Torito , MBR protective-msdos-label cyl-align-off GPT
Media summary: 1 session, 37 data blocks, 74.0k data, ... free
Volume id : 'FERRETOS'
El Torito catalog : 33 1
El Torito cat path : /boot.catalog
El Torito images : N Pltf B Emul Ld_seg Hdpt Ldsiz LBA
El Torito boot img : 1 UEFI y none 0x0000 0x00 5760 37
El Torito img blks : 1 1440
System area options: 0x00000201
System area summary: MBR protective-msdos-label cyl-align-off GPT
ISO image size/512 : 148
Partition offset : 0
MBR heads per cyl : 64
MBR secs per head : 32
MBR partition table: N Status Type Start Blocks
MBR partition : 1 0x00 0xee 1 6571
GPT : N Info
GPT disk GUID : 14cee12d566bf84f903c61f680e4be26
GPT entry array : 2 248 separated
GPT lba range : 64 6508 6571
GPT partition name : 1 4700610070003000
GPT partname local : 1 Gap0
GPT partition GUID : 1 14cee12d566bf84f903d61f680e4be26
GPT type GUID : 1 a2a0d0ebe5b9334487c068b6b72699c7
GPT partition flags: 1 0x1000000000000001
GPT start and size : 1 64 84
GPT partition name : 2 41007000700065006e006400650064003200
GPT partname local : 2 Appended2
GPT partition GUID : 2 14cee12d566bf84f903e61f680e4be26
GPT type GUID : 2 28732ac11ff8d211ba4b00a0c93ec93b
GPT partition flags: 2 0x0000000000000000
GPT start and size : 2 148 5760
GPT partition name : 3 4700610070003100
GPT partname local : 3 Gap1
GPT partition GUID : 3 14cee12d566bf84f903f61f680e4be26
GPT type GUID : 3 a2a0d0ebe5b9334487c068b6b72699c7
GPT partition flags: 3 0x1000000000000001
GPT start and size : 3 5908 600
With
/sbin/fdisk -l ferretos-1.iso
you will get something like:
Disklabel type: gpt
Disk identifier: 2DE1CE14-6B56-4FF8-903C-61F680E4BE26
Device Start End Sectors Size Type
ferretos-1.iso1 64 147 84 42K Microsoft basic data
ferretos-1.iso2 148 5907 5760 2.8M EFI System
ferretos-1.iso3 5908 6507 600 300K Microsoft basic data
Partition 1 covers most of the ISO 9660 filesystem.
It is not mountable because the ISO starts at block address 0 but the
first possible GPT partition start is at 512-byte-block 64 (= 32 KiB).
The first partition will get mountable if you add option
-partition_offset 16
which will create a second ISO 9660 superblock and file tree which
are suitable for a content offset of 32 KiB.
Partition 2 is the EFI partition with the content of boot.img.
Partition 3 covers the end padding which is added by default to prevent
the old Linux TAO CD Read-Ahead Bug.
If the ISO will never be written to a CD, then you may add option
-no-pad
in order to get rid of these trailing 300 KiB of zero-bytes.
----------------------------------------------------------------------
Detailed reasoning about unnecessary or unhelpful arguments:
xorriso native command -x , which sorts the commands to a more or less
reasonable sequence, is not needed, because the only other command in
the argument list is -as, which starts mkisofs emulation.
mkisofs emulation option -root is probably unhelpful, because it would
put all files in the ISO underneath the given path ~/iso-work. The shell
expands "~" to the path of your home directory, e.g. /home/feli/iso-work.
I assume that you don't want to do that.
(-root belongs to a peculiar way of original mkisofs to perform
incremental backups.)
Option -U is problematic, because it ignores all file name rules of
ISO 9600. Unix-like operating systems will not use these rogue names
anyways, but rather the names recorded in the Rock Ridge add-ons to the
ISO 9660 tree (options -R and -r). MS-Windows will not use these names
but rather the names from the Joliet tree (option -J).
So there is few reason to disable the rules of dull ISO 9660 file names.
Option -R is not needed if you also give option -r. Both enable recording
of Rock Ridge add-on information which make the ISO compliant to POSIX
rules about file names and attributes. "-r" additionally will take away
w-permissions and add r-permissions of all files in the emerging ISO.
Option "-eltorito_platform efi" is not needed, because option --efi-boot
already sets the platform id for the El Torito boot image (boot.img).
(I will discuss that option away in favor of option -e. Both can serve
as reason to eliminate -eltorito_platform.)
Option --protective-msdos-label is not needed, because option
-append_partition will cause a partition table, too.
Option --gpt-iso-bootable is of few use. There is no firmware or boot
loader known which would react on the GPT "Legacy BIOS bootable" flag.
Actually you don't strive for legacy BIOS bootability at all but for EFI
bootability.
Option -efi-boot-part "~/iso-work/boot.img" is not needed, because you
already appended the EFI boot image by -append_partition.
-------------------------------------------------------------------------
One option would need to be corrected, if it would stay:
Option --efi-boot gets as parameter the path "~/iso-work/boot.img" which
is most probably the path to the EFI boot image on your hard disk.
But --efi-boot expects a path in the emerging ISO filesystem.
So the option will cause an error if not $PWD contains the path
./home/feli/iso-work/boot.img ("home/feli" is guessed).
The option --efi-boot would cause a copy of boot.img as file in the ISO
fileystem. Since you already append a copy as partition 2 outside of the
filesystem range, this would be waste of filesystem space. (Especially
if you boot.img is large.)
So i propose to replace
--efi-boot ~/iso-work/boot.img
by
-e --interval:appended_partition_2:all::
-no-emul-boot
which will re-use the appended partition, which EFI will recognize on
a USB stick, as El Torito boot image, which EFI will recognize on an
optical medium (CD, DVD, BD).
(If you would add a boot image for Legacy BIOS by option -b, there would
be the need for option -eltorito-alt-boot to separate the sub-options of
-b from the sub option -no-emul-boot of -e:
-b ...path.and.sub.options... \
-eltorito-alt-boot \
-e ...pseudo.path... -no-emul-boot \
)
-------------------------------------------------------------------------
Have a nice day :)
Thomas