mkisofs指令的使用

mkisofs

mkisofs指令主要是用于生成iso文件的,这个指令的功能很是强大,但是就是因为其很强大,导致在使用的过程中很多时候都是不了解的,总的来说,在直走iso文件的使用,其主要有两种的使用方式,一种是生成常规的legacy模式的iso,当用这个模式iso制作出来的u盘启动就只能打开legacy才能够识别出来这个u盘启动盘了,另外一种就是EFI模式,当用这个模式iso制作出来的u盘启动就只能打开EFI才能够识别出来这个u盘启动盘了。
其实在很多时候都不太需要用到后者区分这个制作出来的iso到底支不支持efi(基本上所有的iso都支持legacy),因为现在市面上有很多的制作U盘启动盘的工具,这些工具都会有一套自己的U盘引导,当使用这些工具制作U盘启动盘的时候,这些引导就会被打入到U盘,但是当使用linux字符界面的时候或者更为准确的说只能使用dd指令,那么这个iso支不支持efi就显得极为重要了

mkisofs xorriso xorrisofs

xorriso其实和mkisofs类似,但是其比mkisofs更为强大,具体的博主也不算清楚,只是在处理问题的时候用过一次,所以在这里点出而已。
mkisofs指令

[root@localhost ~]# 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
-hfs-bless FOLDER_NAME      Name of Folder to be blessed
-hfs-bless-by BLESS_TYPE ISO_RR_PATH
                          Bless ISO_RR_PATH by BLESS_TYPE {p,i,s,9,x}
-hfsplus-serial-no HEXSTRING
                          HFS serial number: 16 characters [0-9a-fA-F]
-hfsplus-block-size NUMBER  Set HFS+ block size
-apm-block-size NUMBER      Set Apple Partition Map block size
-hide GLOBFILE              Hide ISO9660/RR file
-hide-list FILE             File with list of ISO9660/RR files to hide
-hide-joliet GLOBFILE       Hide Joliet file
-hide-joliet-list FILE      File with list of Joliet files to hide
-hide-hfsplus GLOBFILE      Hide HFS+ file
-hide-hfsplus-list FILE     File with list of HFS+ files to hide
-input-charset CHARSET      Local input charset for file name conversion
-output-charset CHARSET     Output charset for file name conversion
-iso-level LEVEL            Set ISO9660 conformance level (1..3) or 4 for ISO9660 version 2
-disallow_dir_id_ext        Do not allow dot in ISO directory names
-J, -joliet                 Generate Joliet directory information
-joliet-long                Allow Joliet file names to be 103 Unicode characters
-joliet-utf16               Encode Joliet names in UTF-16BE rather than UCS-2
-U, -untranslated-filenames Allow Untranslated filenames (for HPUX & AIX - violates ISO9660).
-untranslated_name_len LEN  Allow up to LEN (1..96) name characters (heavily violates ISO9660).
-allow-lowercase            Allow lower case characters in addition to the current character set (violates ISO9660)
-relaxed-filenames          Allow 7 bit ASCII except lower case characters (violates ISO9660)
-d, -omit-period            Omit trailing periods from filenames (violates ISO9660)
-l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names
-max-iso9660-filenames      Allow 37 character filenames for ISO9660 names (violates ISO9660)
-N, -omit-version-number    Omit version number from ISO9660 filename (violates ISO9660)
-D, -disable-deep-relocation
                          Disable deep directory relocation (violates ISO9660)
-hide-rr-moved              Relocate deep directories to /.rr_moved
-rr_reloc_dir NAME          Set deep directory relocation target in root
-uid uid                    Make the owner of all files this uid.
-gid gid                    Make the group owner of all files this gid.
-o FILE, -output FILE       Set output file name
-m GLOBFILE, -exclude GLOBFILE
                          Exclude file name
-x FILE, -old-exclude FILE  Exclude file name
-exclude-list FILE          File with list of file names to exclude
-pad                        Pad output by 300k (default)
-no-pad                     Do not pad output
-M FILE, -prev-session FILE Set path to previous session to merge
-C PARAMS, -cdrecord-params PARAMS
                          Magic paramters from cdrecord
-dir-mode mode              Make the mode of all directories this mode.
-file-mode mode             Make the mode of all plain files this mode.
-path-list FILE             File with list of pathnames to process
--quoted_path_list FILE     File with list of quoted pathnames to process
-print-size                 Print estimated filesystem size and exit
-quiet                      Run quietly
-gui                        Switch behaviour for GUI
-R, -rock                   Generate Rock Ridge directory information
-r, -rational-rock          Generate rationalized Rock Ridge directory information
--norock                    Disable Rock Ridge. (Strongly discouraged !)
-file_name_limit LEN        Set truncation limit for Rock Ridge names
--hardlinks                 Record eventual hard link relations of files
--acl                       Record eventual ACLs of files
--xattr                     Record eventual user space xattr of files
--xattr-any                 Record xattr of any namespace, not only user.
--md5                       Compute and record MD5 checksums of data files
--scdbackup_tag PATH NAME   With --md5 record a scdbackup checksum tag
--for_backup                Use all options which improve backup fidelity
-V ID, -volid ID            Set Volume ID
-volset ID                  Set Volume set ID
-publisher PUB              Set Volume publisher
-A ID, -appid ID            Set Application ID
-sysid ID                   Set System ID
-p PREP, -preparer PREP     Set Volume preparer
-abstract FILE              Set Abstract filename
-biblio FILE                Set Bibliographic filename
-copyright FILE             Set Copyright filename
--application_use CHAR|PATH  Set content of Application Use field
-jigdo-jigdo FILE           Produce a jigdo .jigdo file as well as the .iso
-jigdo-template FILE        Produce a jigdo .template file as well as the .iso
-jigdo-min-file-size SIZE   Minimum size for a file to be listed in the jigdo file
-jigdo-force-checksum PTRN  Pattern(s) where files MUST match an externally-supplied checksum
-jigdo-force-md5 PATTERN    Outdated alias of -jigdo-force-checksum
-jigdo-exclude PATTERN      Pattern(s) to exclude from the jigdo file
-jigdo-map PATTERN1=PATTERN2
                          Pattern(s) to map paths (e.g. Debian=/mirror/debian)
-checksum-list FILE         File containing checksums of the files that should be checked
-md5-list FILE              Outdated alias of -checksum-list
-jigdo-checksum-algorithm ALGORITHM
                          Choose algorithm for file matching checksums: md5, sha256
                          Expected in the -checksum-list FILE, written into .jigdo file.
-jigdo-template-compress ALGORITHM
                          Choose to use gzip or bzip2 compression for template data; default is gzip
-checksum_algorithm_iso alg1,alg2,...
                          Specify the checksum types desired for the output image (in .jigdo)
-checksum_algorithm_template alg1,alg2,...
                          Specify the checksum types desired for the output jigdo template
-eltorito-platform          Set El Torito platform id for the next boot entry
-b FILE, -eltorito-boot FILE
                          Set El Torito boot image name
-eltorito-alt-boot          Start specifying alternative El Torito boot parameters
--efi-boot FILE             Set El Torito EFI boot image name and type
-e FILE                     Set EFI boot image name (more rawly)
-c FILE, -eltorito-catalog FILE
                          Set El Torito boot catalog name
--boot-catalog-hide         Hide boot catalog from ISO9660/RR and Joliet
-boot-load-size #           Set numbers of load sectors
-hard-disk-boot             Boot image is a hard disk image
-no-emul-boot               Boot image is 'no emulation' image
-boot-info-table            Patch boot image with info table
--grub2-boot-info           Patch boot image at byte 2548
-eltorito-id ID             Set El Torito Id String
-eltorito-selcrit HEXBYTES  Set El Torito Selection Criteria
-isohybrid-gpt-basdat       Mark El Torito boot image as Basic Data in GPT
-isohybrid-gpt-hfsplus      Mark El Torito boot image as HFS+ in GPT
-isohybrid-apm-hfsplus      Mark El Torito boot image as HFS+ in APM
-part_like_isohybrid        Mark in MBR, GPT, APM without -isohybrid-mbr
-iso_mbr_part_type          Set type byte or GUID of ISO partition in MBR
                          or type GUID if a GPT ISO partition emerges.
--gpt_disk_guid GUID        Set GPT disk GUID or choose automatic GUID
-G FILE, -generic-boot FILE Set generic boot image name
--embedded-boot FILE        Alias of -G
--protective-msdos-label    Patch System Area by partition table
--mbr-force-bootable        Enforce existence of bootable flag in MBR
-partition_offset LBA       Make image mountable by first partition, too
-partition_sec_hd NUMBER    Define number of sectors per head
-partition_hd_cyl NUMBER    Define number of heads per cylinder
-partition_cyl_align MODE   Control cylinder alignment: off, on, auto, all
-mips-boot FILE             Set mips boot image name (relative to image root)
-mipsel-boot FILE           Set mipsel boot image name (relative to image root)
-B FILES, -sparc-boot FILES Set sparc boot image names
-sparc-label label text     Set sparc boot disk label
-hppa-cmdline CMDLINE       Set hppa boot command line
-hppa-kernel-32 FILE        Set hppa 32-bit image name (relative to image root)
-hppa-kernel-64 FILE        Set hppa 64-bit image name (relative to image root)
-hppa-bootloader FILE       Set hppa boot loader file name (relative to image root)
-hppa-ramdisk FILE          Set hppa ramdisk file name (relative to image root)
-hppa-hdrversion NUMBER     Set hppa PALO header version to 4 or 5
-alpha-boot FILE            Set alpha boot image name (relative to image root)
--grub2-sparc-core FILE     Set path of core file for disk label patching
-efi-boot-part DISKFILE|--efi-boot-image
                          Set data source for EFI System Partition
-chrp-boot-part             Mark ISO image size by MBR partition type 0x96
-chrp-boot                  Alias of -chrp-boot-part
-prep-boot-part DISKFILE    Set data source for MBR partition type 0x41
-append_partition NUMBER TYPE FILE
                          Append FILE after image. TYPE is hex: 0x.. or
                          a GUID to be used if -appended_part_as_gpt.
-appended_part_as_gpt       mark appended partitions in GPT instead of MBR.
-appended_part_as_apm       mark appended partitions in APM.
--modification-date=YYYYMMDDhhmmsscc
                          Override date of creation and modification
--set_all_file_dates TIME   Override mtime, atime, ctime in all files
-isohybrid-mbr FILE         Set SYSLINUX mbr/isohdp[fp]x*.bin for isohybrid
--grub2-mbr FILE            Set GRUB2 MBR for boot image address patching
--sort-weight NUMBER FILE   Set LBA weight number to file or file tree
--sort-weight-list DISKFILE Read list of NUMBER FILE pairs for --sort-weight
--sort-weight-patterns DISKFILE  --sort-weight-list with pattern expansion
--stdio_sync on|off|number  Control forced output to disk files
--no-emul-toc               Save 64 kB size on random access output files
--emul-toc                  Multi-session history on such output files
--old-empty                 Use old style block addresses for empty files
-z, -transparent-compression
                          Enable transparent compression of files
--zisofs-version-2          Enable processing of zisofs version 2 files
--zisofs2-susp-z2           Produce Z2 entries for zisofs version 2
--zisofs2-susp-zf           Produce ZF entries for zisofs version 2
-root DIR                   Set root directory for all new files and directories
-old-root DIR               Set root directory in previous session that is searched for files
--old-root-no-md5           Do not record and use MD5 with -old-root
--old-root-no-ino           Do not use disk inode numbers with -old-root
--old-root-devno            Use disk device numbers with -old-root
-log-file LOG_FILE          Re-direct messages to LOG_FILE
--no_rc                     Do not execute startup files
-v, -verbose                Verbose
-version                    Print the current version

Report any bugs to bug-xorriso@gnu.org or in private to scdbackup@gmx.net .

其实这一串也没什么用,主要还是下面两个指令,则两个指令都是在自己定制的iso文件夹执行,主要以centos stream9为例
直接编译legacy模式iso:
mkisofs -o …/iso_name.iso -input-charset utf-8 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -T -joliet-long -V CENTOS-STRE os_path
直接编译efi模式iso:
mkisofs -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 images/efiboot.img -no-emul-boot -isohybrid-gpt-basdat -o …/os_name.iso os_path
主要解释efi相关的:
/usr/share/syslinux/isohdpfx.bin:因为efi模式还涉及到了分区所以,就需要引入这个,不然不会成功,以为efi会有一个单独的分区进行调用的,isohdpfx.bin这个很重要,路径可以需要。
images/efiboot.img:这个文件很多人在使用的时候会感觉是grubx64.efi这个执行程序,但是其实不是,这个文件里面主要包含了efi的相关程序,可以使用mount指令挂载之后直接查看里面的内容,同时有对应需求修改grub.cfg文件也是可以直接挂载修改的.
-isohybrid-gpt-basdat:这个指令需要加上设计到了gpt分区格式

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值