前回までにxorrisoのさまざまな機能を紹介してきました。紹介したのはxorrisoの機能のごく一部にすぎないものの、
xorrisoはこのように強力なソフトウェアなものの、
また、
作者もそのあたりは気になったようで、
xorrisoのエミュレーション機能
xorrisoには-as <personality>という指定で、
xorrisoのmanページからこの機能を紹介した部分を引いてみましょう。参考のために私訳も付しておきます。
Command compatibility emulations: Writing of ISO 9660 on CD is traditionally done by program mkisofs as ISO 9660 image producer and cdrecord as burn program. xorriso does not strive for their comprehensive emulation. Nevertheless it is ready to perform some of its core tasks under control of commands which in said programs trigger comparable actions. -as personality option [options] -- Perform the variable length option list as sparse emulation of the program depicted by the personality word.
互換コマンド用エミュレーション
CDにISO9660を書き込むには、
-as personality option [options] --
personalityとして指定したプログラムに、
すなわち、
$ xorriso -as mkisofs -help Usage: xorriso -as mkisofs [options] file... Note: This is not mkisofs. See xorriso -help, xorriso -version, man xorrisofs Options: -f, -follow-links Follow symbolic links -graft-points Allow to use graft points for filenames -help Print option help -hfsplus Generate HFS+ filesystem -hfsplus-file-creator-type CREATOR TYPE iso_rr_path Attach creator and type to a File ...
この結果を"mkisofs -help"で表示されるmkisofsのオプション一覧と比較してみると、
事実、
この"-as <personality>"には、
エミュレーション機能でもうひとつ重要なpersonalityがcdrecordです。
$ xorriso -as cdrecord -help GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. Usage: xorriso -as cdrecord [options|source_addresses] Note: This is not cdrecord. See xorriso -help, xorriso -version, man xorrecord Options: -version print version information and exit emulation --devices print list of available MMC drives and exit emulation dev=target pseudo-SCSI target to use as CD-Recorder drive_scsi_dev_family=sr|scd|sg select Linux device type -v increment verbose level by one -V increment SCSI command transport verbose level by one -checkdrive check if a driver for the drive is present -inq do an inquiry for the drive ...
こちらの方もcdrecordの主要な機能のみをカバーしている程度ですが、
エミュレーション機能を使えば、
xorrisofsとBIOS/UEFIデュアルブート
さて、
xorrisoを取り上げた最初の回にも触れたように、
たとえば、
$ iso_label="ARCH_201209" $ xorriso -as mkisofs \ -iso-level 3 \ -full-iso9660-filenames \ -volid "${iso_label}" \ -eltorito-boot isolinux/isolinux.bin \ -eltorito-catalog isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -isohybrid-mbr ~/customiso/isolinux/isohdpfx.bin \ -eltorito-alt-boot -e EFI/archiso/efiboot.img \ -no-emul-boot -isohybrid-gpt-basdat \ -output arch-custom.iso \ ~/customiso
一方、
$ mkisofs -v -J -r -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -eltorito-platform efi -eltorito-boot isolinux/efiboot.img \ -V UEFI-test -o UEFI-test.iso DVD_contents
xorrirsoのコマンドラインは最初に"-as mkisofs"を指定しているので、
まず、
上記使用例にあるように、
起動メディアがCD/
一方、
isohybridはこの間を繋ぐための開発されたツールで、
この処理を施したISOファイルをベタ書きしたUSBメモリから起動すると、
mkisofsを使っていたPlamo Linuxの場合、
一方、
擬似的なMBRは単純に書き込むだけではだめで、
もう一つ-isohybrid-gpt-basdatもmkisofsにはないxorrisoの独自機能で、
言葉で説明するだけではわかりにくいと思うので、
まず、
$ ls -R Test Test: EFI/ efiboot.img isolinux/ Test/EFI: BOOT/ Test/EFI/BOOT: BOOTx64.efi bootia32.efi grub.cfg Test/isolinux: System.map config initrd.gz isolinux.cfg libcom32.c32 plamo41.lss sample.msg vmlinuz boot.cat efiboot.img isolinux.bin ldlinux.c32 libutil.c32 plamo61.lss vesamenu.c32
このディレクトリからxorrisoを使って起動可能なISOファイルを作ります。
$ xorriso -as mkisofs -o test01.iso \ -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -e efiboot.img -no-emul-boot Test GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. Drive current: -outdev 'stdio:test01.iso' Media current: stdio file, overwriteable ...
もう1つ、
$ xorriso -as mkisofs -o test02.iso \ -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \ -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -e efiboot.img -no-emul-boot -isohybrid-gpt-basdat Test GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. Drive current: -outdev 'stdio:test02.iso' ...
作成された2つのISOファイルのサイズは同じです。
$ ls -l test01.iso test02.iso -rw-r--r-- 1 kojima users 128,974,848 7月 10日 14:28 test01.iso -rw-r--r-- 1 kojima users 128,974,848 7月 10日 14:31 test02.iso
一方、
$ file test0[12].iso test01.iso: DOS/MBR boot sector ISO 9660 CD-ROM filesystem data 'ISOIMAGE' (bootable); partition 1 : ID=0x17, active, start-CHS (0x0,0,1), end-CHS (0x7a,63,32), startsector 0, 251904 sectors test02.iso: DOS/MBR boot sector ISO 9660 CD-ROM filesystem data 'ISOIMAGE' (bootable); partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 136, 65536 sectors
ISOファイルは一種のファイルシステムなので、
$ /sbin/fdisk -l test01.iso ディスク test01.iso: 123 MiB, 128974848 バイト, 251904 セクタ 単位: セクタ (1 * 512 = 512 バイト) セクタサイズ (論理 / 物理): 512 バイト / 512 バイト ... デバイス 起動 開始位置 最後から セクタ サイズ Id タイプ test01.iso1 * 0 251903 251904 123M 17 隠し HPFS/NTFS $ /sbin/fdisk -l test02.iso ディスク test02.iso: 123 MiB, 128974848 バイト, 251904 セクタ ... デバイス 起動 開始位置 最後から セクタ サイズ Id タイプ test02.iso1 * 0 251903 251904 123M 0 空 test02.iso2 136 65671 65536 32M ef EFI (FAT-12/16/32)
この結果を見ると、
この領域は実際にはISOファイルの一部なわけですが、
本来、
一方、
これらの流れを整理してみましょう。
従来のPC BIOSから起動する場合、
一方、
ISOファイルの先頭部分には未使用領域があることを利用して、
以前触れたように、
今回、
ソフトウェアの世界では、