From 3a41524e63308521e9d4d8d74b870e0813aa3b77 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 27 Feb 2017 10:38:16 +0100 Subject: [PATCH] New -boot_image bootspec iso_mbr_part_type= --- xorriso/base_obj.c | 3 +- xorriso/opts_a_c.c | 22 ++++++- xorriso/opts_d_h.c | 5 +- xorriso/text_io.c | 10 +++ xorriso/write_run.c | 1 + xorriso/xorriso.1 | 13 +++- xorriso/xorriso.info | 122 +++++++++++++++++++----------------- xorriso/xorriso.texi | 15 ++++- xorriso/xorriso_private.h | 7 ++- xorriso/xorriso_timestamp.h | 2 +- 10 files changed, 132 insertions(+), 68 deletions(-) diff --git a/xorriso/base_obj.c b/xorriso/base_obj.c index 9ddeba82..e59db2f6 100644 --- a/xorriso/base_obj.c +++ b/xorriso/base_obj.c @@ -3,7 +3,7 @@ /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2016 Thomas Schmitt, + Copyright 2007-2017 Thomas Schmitt, Provided under GPL version 2 or later. @@ -294,6 +294,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->appended_as_gpt= 0; m->appended_as_apm= 0; m->part_like_isohybrid= 0; + m->iso_mbr_part_type= -1; memset(m->gpt_guid, 0, 16); m->gpt_guid_mode= 0; m->ascii_disc_label[0]= 0; diff --git a/xorriso/opts_a_c.c b/xorriso/opts_a_c.c index 4ee300e4..ab9d0fca 100644 --- a/xorriso/opts_a_c.c +++ b/xorriso/opts_a_c.c @@ -1,7 +1,7 @@ /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2016 Thomas Schmitt, + Copyright 2007-2017 Thomas Schmitt, Provided under GPL version 2 or later. @@ -1095,6 +1095,26 @@ treatment_patch:; else was_ok= 0; + } else if(strncmp(treatpt, "iso_mbr_part_type=", 18) == 0) { + ret= 256; + if(strncmp(treatpt + 18, "default", 2) == 0) { + ret= -1; + } else if(strncmp(treatpt + 18, "0x", 2) == 0) { + u= 256; + sscanf(treatpt + 20, "%x", &u); + ret= u; + } else { + sscanf(treatpt + 18, "%d", &ret); + } + if(ret < -1 || ret > 0xff) { + sprintf(xorriso->info_text, + "-boot_image %s : iso_mbr_part_type='%s' wrong (\"default\", 0 ... 255, 0x00 ... 0xff)", + formpt, treatpt + 18); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + xorriso->iso_mbr_part_type= ret; + } else if(strncmp(treatpt, "partition_hd_cyl=", 17)==0) { u= 0; sscanf(treatpt + 17, "%u", &u); diff --git a/xorriso/opts_d_h.c b/xorriso/opts_d_h.c index ac9e1d4c..b5bd040c 100644 --- a/xorriso/opts_d_h.c +++ b/xorriso/opts_d_h.c @@ -1,7 +1,7 @@ /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2016 Thomas Schmitt, + Copyright 2007-2017 Thomas Schmitt, Provided under GPL version 2 or later. @@ -1857,7 +1857,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " |\"partition_cyl_align=\"|\"mbr_force_bootable=\"", " |\"system_area=\"|\"partition_table=on|off\"", " |\"partition_entry=\"|\"appended_part_as=\"", -" |\"part_like_isohybrid=\"|\"gpt_disk_guid=\"", +" |\"part_like_isohybrid=\"|\"iso_mbr_part_type=\"", +" |\"gpt_disk_guid=\"", " |\"chrp_boot_part=on|off=\"|\"prep_boot_part=\"", " |\"efi_boot_part=\"|\"efi_boot_part=--efi-boot-image\"", " |\"mips_path=\"|\"mipsel_path=\"|\"mips_discard\"", diff --git a/xorriso/text_io.c b/xorriso/text_io.c index f7809608..12a11adc 100644 --- a/xorriso/text_io.c +++ b/xorriso/text_io.c @@ -3065,6 +3065,16 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->iso_mbr_part_type == -1); + sprintf(line, "-boot_image any iso_mbr_part_type="); + if(xorriso->iso_mbr_part_type == -1) + sprintf(line + strlen(line), "default\n"); + else + sprintf(line + strlen(line), "0x%-2.2x\n", + (unsigned int) xorriso->iso_mbr_part_type); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->gpt_guid_mode == 0); sprintf(line, "-boot_image any gpt_disk_guid=%s", xorriso->gpt_guid_mode == 0 ? "random" : diff --git a/xorriso/write_run.c b/xorriso/write_run.c index dfd7335c..5947558e 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -961,6 +961,7 @@ int Xorriso_make_iso_write_opts(struct XorrisO *xorriso, IsoImage *image, isoburn_igopt_set_appended_as_gpt(sopts, xorriso->appended_as_gpt); isoburn_igopt_set_appended_as_apm(sopts, xorriso->appended_as_apm); isoburn_igopt_set_part_like_isohybrid(sopts, xorriso->part_like_isohybrid); + isoburn_igopt_set_iso_mbr_part_type(sopts, xorriso->iso_mbr_part_type); isoburn_igopt_set_gpt_guid(sopts, xorriso->gpt_guid, xorriso->gpt_guid_mode); isoburn_igopt_set_disc_label(sopts, xorriso->ascii_disc_label); isoburn_igopt_set_hfsp_serial_number(sopts, xorriso->hfsp_serial_number); diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index ab052e5b..246f6218 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -9,7 +9,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Version 1.4.7, Feb 22, 2017" +.TH XORRISO 1 "Version 1.4.7, Feb 26, 2017" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -3434,6 +3434,15 @@ No MBR partition of type 0xee emerges, even if GPT gets produced. Gaps between GPT and APM partitions will not be filled by more partitions. Appended partitions get mentioned in APM if other APM partitions emerge. .br +\fB\-boot_image any iso_mbr_part_type=\fRnumber sets the partition type +of the MBR partition which represents the ISO or at least protects it. +Number may be 0x00 to 0xff. The text "default" re\-enables the default types +of the various occasions to create an ISO MBR partition. +.br +This is without effect if no such partition emerges by other settings or +if the partition type is prescribed mandatorily like 0xee for GPT protective +MBR or 0x96 for CHRP. +.br \fBgrub2_mbr=\fRdisk_path works like "any" system_area= with additional patching for modern GRUB MBRs. The content start address of the first boot image is converted to a count of 512 byte blocks, and an offset of 4 is added. @@ -6109,7 +6118,7 @@ Thomas Schmitt .br for libburnia\-project.org .SH COPYRIGHT -Copyright (c) 2007 \- 2016 Thomas Schmitt +Copyright (c) 2007 \- 2017 Thomas Schmitt .br Permission is granted to distribute this text freely. It shall only be modified in sync with the technical properties of \fBxorriso\fR. diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index c1a82091..b36dd173 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -4,7 +4,7 @@ xorriso.texi. xorriso - creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. - Copyright (C) 2007 - 2016 Thomas Schmitt + Copyright (C) 2007 - 2017 Thomas Schmitt Permission is granted to distrubute this text freely. INFO-DIR-SECTION Archiving @@ -2895,6 +2895,14 @@ Examples: if GPT gets produced. Gaps between GPT and APM partitions will not be filled by more partitions. Appended partitions get mentioned in APM if other APM partitions emerge. + *-boot_image any iso_mbr_part_type=*number sets the partition type + of the MBR partition which represents the ISO or at least protects + it. Number may be 0x00 to 0xff. The text "default" re-enables the + default types of the various occasions to create an ISO MBR + partition. + This is without effect if no such partition emerges by other + settings or if the partition type is prescribed mandatorily like + 0xee for GPT protective MBR or 0x96 for CHRP. *grub2_mbr=*disk_path works like "any" system_area= with additional patching for modern GRUB MBRs. The content start address of the first boot image is converted to a count of 512 byte blocks, and an @@ -5170,7 +5178,7 @@ for libburnia-project.org 15.2 Copyright ============== -Copyright (c) 2007 - 2016 Thomas Schmitt +Copyright (c) 2007 - 2017 Thomas Schmitt Permission is granted to distribute this text freely. It shall only be modified in sync with the technical properties of 'xorriso'. If you make use of the license to derive modified versions of 'xorriso' then @@ -5205,7 +5213,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -alter_date sets timestamps in ISO image: Manip. (line 136) * -alter_date_r sets timestamps in ISO image: Manip. (line 171) * -append_partition adds arbitrary file after image end: Bootable. - (line 404) + (line 412) * -application_id sets application id: SetWrite. (line 191) * -application_use sets application use field: SetWrite. (line 266) * -as emulates mkisofs or cdrecord: Emulation. (line 13) @@ -5449,12 +5457,12 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * ACL, show in ISO image, -getfacl: Navigate. (line 60) * ACL, show in ISO image, -getfacl_r: Navigate. (line 66) * ACL, _definition: Extras. (line 50) -* APM block size: Bootable. (line 395) +* APM block size: Bootable. (line 403) * APM, _definition: Extras. (line 42) * Appendable media, _definition: Media. (line 38) -* Appended Filesystem Image, -append_partition: Bootable. (line 404) -* Appended partition, in APM: Bootable. (line 275) -* Appended partition, in MBR or GPT: Bootable. (line 268) +* Appended Filesystem Image, -append_partition: Bootable. (line 412) +* Appended partition, in APM: Bootable. (line 283) +* Appended partition, in MBR or GPT: Bootable. (line 276) * Automatic execution order, of arguments, -x: ArgSort. (line 16) * Backslash Interpretation, _definition: Processing. (line 53) * Backup, enable fast incremental, -disk_dev_ino: Loading. (line 226) @@ -5472,15 +5480,15 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Character set, learn from image, -auto_charset: Loading. (line 123) * Character Set, of terminal, -local_charset: Charset. (line 57) * Character Set, _definition: Charset. (line 6) -* CHRP partition, _definition: Bootable. (line 280) +* CHRP partition, _definition: Bootable. (line 288) * Closed media, _definition: Media. (line 44) * Comment, #: Scripting. (line 156) * Control, signal handling, -signal_handling: Exception. (line 66) * Create, new ISO image, _definition: Methods. (line 7) -* Cylinder alignment, _definition: Bootable. (line 324) -* Cylinder size, _definition: Bootable. (line 309) +* Cylinder alignment, _definition: Bootable. (line 332) +* Cylinder size, _definition: Bootable. (line 317) * Damaged track and session, close, -close_damaged: Writing. (line 164) -* DEC Alpha SRM boot sector, production: Bootable. (line 381) +* DEC Alpha SRM boot sector, production: Bootable. (line 389) * Delete, from ISO image, -rm: Manip. (line 20) * Delete, from ISO image, -rm_r: Manip. (line 26) * Delete, ISO directory, -rmdir: Manip. (line 29) @@ -5511,7 +5519,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Drive, _definition: Drives. (line 6) * EA, _definition: Extras. (line 66) * ECMA-119, _definition: Model. (line 6) -* EFI system partition, _definition: Bootable. (line 289) +* EFI system partition, _definition: Bootable. (line 297) * El Torito, _definition: Extras. (line 19) * Emulation, -as: Emulation. (line 13) * Emulation, .mkisofsrc, -read_mkisofsrc: Emulation. (line 155) @@ -5541,10 +5549,10 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Group, in ISO image, -chgrp_r: Manip. (line 53) * Growing, _definition: Methods. (line 20) * Hard links, control handling, -hardlinks: Loading. (line 134) -* HFS+ allocation block size: Bootable. (line 392) -* HFS+ serial number: Bootable. (line 389) +* HFS+ allocation block size: Bootable. (line 400) +* HFS+ serial number: Bootable. (line 397) * hidden, set in ISO image, -hide: Manip. (line 174) -* HP-PA boot sector, production: Bootable. (line 364) +* HP-PA boot sector, production: Bootable. (line 372) * Image reading, cache size, -data_cache_size: Loading. (line 332) * Image, demand volume ID, -assert_volid: Loading. (line 111) * Image, discard pending changes, -rollback: Writing. (line 9) @@ -5600,7 +5608,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Linux device type, -scsi_dev_family: AqDrive. (line 43) * List delimiter, _definition: Processing. (line 9) * Local Character Set, _definition: Charset. (line 11) -* MBR bootable/active flag, enforce: Bootable. (line 335) +* MBR bootable/active flag, enforce: Bootable. (line 343) * MBR, set, -boot_image system_area=: Bootable. (line 200) * MBR, _definition: Extras. (line 27) * MD5, control handling, -md5: Loading. (line 182) @@ -5608,7 +5616,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Media, format, -format: Writing. (line 87) * Media, list formats, -list_formats: Writing. (line 129) * Media, list write speeds, -list_speeds: Writing. (line 140) -* MIPS boot file, activation: Bootable. (line 343) +* MIPS boot file, activation: Bootable. (line 351) * mkisofs, Emulation: Emulation. (line 17) * Modifying, _definition: Methods. (line 28) * Multi-session media, _definition: Media. (line 7) @@ -5635,15 +5643,15 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Ownership, global in ISO image, -uid: SetWrite. (line 284) * Ownership, in ISO image, -chown: Manip. (line 43) * Ownership, in ISO image, -chown_r: Manip. (line 47) -* Partition offset, _definition: Bootable. (line 299) -* Partition table, _definition: Bootable. (line 249) +* Partition offset, _definition: Bootable. (line 307) +* Partition table, _definition: Bootable. (line 257) * Pathspec, _definition: SetInsert. (line 117) * Pattern expansion, for disk paths, -disk_pattern: Insert. (line 34) * Pattern expansion, for ISO paths, -iso_rr_pattern: Manip. (line 10) * Pattern expansion, _definition: Processing. (line 25) * Permissions, in ISO image, -chmod: Manip. (line 55) * Permissions, in ISO image, -chmod_r: Manip. (line 66) -* PReP partition, _definition: Bootable. (line 284) +* PReP partition, _definition: Bootable. (line 292) * Problems, reporting: Bugreport. (line 6) * Process, consolidate text output, -pkt_output: Frontend. (line 7) * Process, control abort on error, -abort_on: Exception. (line 27) @@ -5703,8 +5711,8 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Session, select as input, -load: Loading. (line 33) * Session, _definition: Model. (line 6) * Sorting order, for -x, -list_arg_sorting: ArgSort. (line 26) -* SUN Disk Label, production: Bootable. (line 354) -* SUN SPARC boot images, activation: Bootable. (line 427) +* SUN Disk Label, production: Bootable. (line 362) +* SUN SPARC boot images, activation: Bootable. (line 435) * Symbolic link, create, -lns: Insert. (line 181) * System area, _definition: Bootable. (line 200) * Table-of-content, search sessions, -rom_toc_scan: Loading. (line 278) @@ -5773,40 +5781,40 @@ Node: Filter102411 Node: Writing107033 Node: SetWrite117189 Node: Bootable141948 -Node: Jigdo167448 -Node: Charset171707 -Node: Exception175036 -Node: DialogCtl181165 -Node: Inquiry183767 -Node: Navigate192555 -Node: Verify200850 -Node: Restore210728 -Node: Emulation219341 -Node: Scripting229800 -Node: Frontend237583 -Node: Examples247209 -Node: ExDevices248387 -Node: ExCreate249048 -Node: ExDialog250348 -Node: ExGrowing251619 -Node: ExModifying252428 -Node: ExBootable252938 -Node: ExCharset253493 -Node: ExPseudo254389 -Node: ExCdrecord255316 -Node: ExMkisofs255636 -Node: ExGrowisofs256993 -Node: ExException258147 -Node: ExTime258605 -Node: ExIncBackup259063 -Node: ExRestore263089 -Node: ExRecovery264035 -Node: Files264607 -Node: Environ265941 -Node: Seealso266647 -Node: Bugreport267364 -Node: Legal267955 -Node: CommandIdx268967 -Node: ConceptIdx286301 +Node: Jigdo167933 +Node: Charset172192 +Node: Exception175521 +Node: DialogCtl181650 +Node: Inquiry184252 +Node: Navigate193040 +Node: Verify201335 +Node: Restore211213 +Node: Emulation219826 +Node: Scripting230285 +Node: Frontend238068 +Node: Examples247694 +Node: ExDevices248872 +Node: ExCreate249533 +Node: ExDialog250833 +Node: ExGrowing252104 +Node: ExModifying252913 +Node: ExBootable253423 +Node: ExCharset253978 +Node: ExPseudo254874 +Node: ExCdrecord255801 +Node: ExMkisofs256121 +Node: ExGrowisofs257478 +Node: ExException258632 +Node: ExTime259090 +Node: ExIncBackup259548 +Node: ExRestore263574 +Node: ExRecovery264520 +Node: Files265092 +Node: Environ266426 +Node: Seealso267132 +Node: Bugreport267849 +Node: Legal268440 +Node: CommandIdx269452 +Node: ConceptIdx286786  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 55a8b1ed..8bc183db 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -50,7 +50,7 @@ @c man .\" First parameter, NAME, should be all caps @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" other parameters are allowed: see man(7), man(1) -@c man .TH XORRISO 1 "Version 1.4.7, Feb 22, 2017" +@c man .TH XORRISO 1 "Version 1.4.7, Feb 26, 2017" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -69,7 +69,7 @@ xorriso - creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. -Copyright @copyright{} 2007 - 2016 Thomas Schmitt +Copyright @copyright{} 2007 - 2017 Thomas Schmitt @quotation Permission is granted to distrubute this text freely. @@ -3982,6 +3982,15 @@ No MBR partition of type 0xee emerges, even if GPT gets produced. Gaps between GPT and APM partitions will not be filled by more partitions. Appended partitions get mentioned in APM if other APM partitions emerge. @* +@strong{-boot_image any iso_mbr_part_type=}number sets the partition type +of the MBR partition which represents the ISO or at least protects it. +Number may be 0x00 to 0xff. The text "default" re-enables the default types +of the various occasions to create an ISO MBR partition. +@* +This is without effect if no such partition emerges by other settings or +if the partition type is prescribed mandatorily like 0xee for GPT protective +MBR or 0x96 for CHRP. +@* @strong{grub2_mbr=}disk_path works like "any" system_area= with additional patching for modern GRUB MBRs. The content start address of the first boot image is converted to a count of 512 byte blocks, and an offset of 4 is added. @@ -7164,7 +7173,7 @@ Thomas Schmitt for libburnia-project.org @c man .SH COPYRIGHT @section Copyright -Copyright (c) 2007 - 2016 Thomas Schmitt +Copyright (c) 2007 - 2017 Thomas Schmitt @* Permission is granted to distribute this text freely. It shall only be modified in sync with the technical properties of @command{xorriso}. diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 0ea6242e..bced3f6e 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -2,7 +2,7 @@ /* Command line oriented batch and dialog tool which creates, loads, manipulates and burns ISO 9660 filesystem images. - Copyright 2007-2016 Thomas Schmitt, + Copyright 2007-2017 Thomas Schmitt, Provided under GPL version 2 or later. @@ -499,6 +499,11 @@ struct XorrisO { /* the global context of xorriso */ /* If 1: Apply isohybrid gestures to non-isohybrid situations */ int part_like_isohybrid; + /* MBR partition type of ISO filesystem partition or protective partition + if not real GPT or CHRP. + */ + int iso_mbr_part_type; + /* See libisoburn.h isoburn_igopt_set_gpt_guid() */ uint8_t gpt_guid[16]; int gpt_guid_mode; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 710a85e0..ad203fb5 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2017.02.27.092840" +#define Xorriso_timestamP "2017.02.27.093756"