From 4dc5edc56521b16c87881e3201d63ebaac2d6c59 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 13 May 2024 12:22:04 +0200 Subject: [PATCH] Bug fix: -boot_image system_area=/dev/zero preserved system area of loaded ISO --- xorriso/write_run.c | 7 +- xorriso/xorriso.1 | 31 +++++--- xorriso/xorriso.info | 154 +++++++++++++++++++----------------- xorriso/xorriso.texi | 31 +++++--- xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 121 insertions(+), 104 deletions(-) diff --git a/xorriso/write_run.c b/xorriso/write_run.c index e3bcafd7..80dbb39a 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -447,7 +447,8 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, Xorriso_alloc_meM(buf, char, 32768); memset(buf, 0, 32768); system_area_options= xorriso->system_area_options; - if(xorriso->system_area_clear_loaded) + if(xorriso->system_area_clear_loaded || + (in_drive != out_drive && in_drive != NULL)) sa_loaded= 0; else sa_loaded= iso_image_get_system_area(img, buf, &options, 0); @@ -457,8 +458,8 @@ int Xorriso_set_system_area(struct XorrisO *xorriso, "Error when inquiring System Area data of ISO 9660 image", 0, "FAILURE", 1); {ret= 0; goto ex;} - } if(sa_loaded > 0) - bufpt= buf; + } + bufpt= buf; if(xorriso->system_area_disk_path[0] == 0) { if(xorriso->patch_system_area && xorriso->system_area_options == 0 && sa_loaded > 0) { diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 69af2f12..44dba057 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -3767,13 +3767,27 @@ which can be used to boot from USB stick or hard disk. Other than an El Torito boot image, the file disk_path needs not to be added to the ISO image. .br +In multi\-session situations the existing System Area is preserved by default. +In in this case, the special disk_path "." prevents reading of +a disk file but nevertheless causes adjustments in the +loaded system area data. Such adjustments may get ordered by \-boot_image +commands. +.br +Special "system_area=/dev/zero" causes 32k of 0\-bytes. +Use this to e.g. discard partition tables which were loaded with the ISO image. +.br +This setting is the default with the write method of Modifying, when \-indev +and \-outdev are both used and not the same drive. If you indeed need to copy +the unchanged system area from \-indev to \-outdev, use +"system_area=\-\-interval:imported_iso:0s\-15s::" , which was the default in older +versions of xorriso. +.br \fB\-boot_image isolinux system_area=\fR implies "partition_table=on". In this case, the disk path should lead to one of the SYSLINUX files isohdp[fp]x*.bin or to a file which was derived from one of those files. E.g. to the first 512 bytes from an ISOLINUX isohybrid ISO image. .br -In this case, El Torito boot images (dir=, bin_path=, efi_path=) -may be augmented by +El Torito boot images (dir=, bin_path=, efi_path=) may then be augmented by \fBisolinux partition_entry=gpt_basdat\fR or \fBisolinux partition_entry=gpt_hfsplus\fR, and by \fBisolinux partition_entry=apm_hfsplus\fR. @@ -3783,12 +3797,6 @@ The first three GPT partitions will also be marked by MBR partitions. The MBR partition of type 0xEF is what actually is used by EFI firmware for booting from USB stick. .br -In multi\-session situations the existing System Area is preserved by default. -In in this case, the special disk_path "." prevents reading of -a disk file but nevertheless causes adjustments in the -loaded system area data. Such adjustments may get ordered by \-boot_image -commands. -.br \fB\-boot_image any gpt_disk_guid=\fRvalue controls whether an emerging GPT shall get a randomly generated disk GUID or whether the GUID is supplied by the user. @@ -3856,9 +3864,6 @@ In this case the existing System Area gets checked whether it bears addresses and sizes as if it had been processed by "partition_table=on". If so, then those parameters get updated when the new System Area is written. .br -Special "system_area=/dev/zero" causes 32k of NUL\-bytes. -Use this to discard an MBR which was loaded with the ISO image. -.br \fBappended_part_as=gpt\fR marks partitions from \-append_partition in GPT rather than in MBR. In this case the MBR shows a single partition of type 0xee which covers the whole output data. @@ -4014,8 +4019,8 @@ DEC Alpha SRM Secondary Bootstrap Loader and causes production of a boot sector which points to it. This is mutually exclusive with production of other boot blocks like MBR. .br -\fBmips_discard\fR, \fBsparc_discard\fR, \fBhppa_discard\fR, -\fBalpha_discard\fR +\fBmips_discard\fR, \fBmipsel_discard\fR, \fBsparc_discard\fR, +\fBhppa_discard\fR, \fBalpha_discard\fR revoke any boot file declarations made for mips/mipsel, sparc, hppa, or alpha, respectively. This removes the ban on production of other boot blocks. diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index aca6f74b..2cb365be 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -3175,25 +3175,33 @@ Examples: be used to boot from USB stick or hard disk. Other than an El Torito boot image, the file disk_path needs not to be added to the ISO image. + In multi-session situations the existing System Area is preserved + by default. In in this case, the special disk_path "." prevents + reading of a disk file but nevertheless causes adjustments in the + loaded system area data. Such adjustments may get ordered by + -boot_image commands. + Special "system_area=/dev/zero" causes 32k of 0-bytes. Use this to + e.g. discard partition tables which were loaded with the ISO + image. + This setting is the default with the write method of Modifying, + when -indev and -outdev are both used and not the same drive. If + you indeed need to copy the unchanged system area from -indev to + -outdev, use "system_area=-interval:imported_iso:0s-15s::" , which + was the default in older versions of xorriso. *-boot_image isolinux system_area=* implies "partition_table=on". In this case, the disk path should lead to one of the SYSLINUX files isohdp[fp]x*.bin or to a file which was derived from one of those files. E.g. to the first 512 bytes from an ISOLINUX isohybrid ISO image. - In this case, El Torito boot images (dir=, bin_path=, efi_path=) - may be augmented by *isolinux partition_entry=gpt_basdat* or - *isolinux partition_entry=gpt_hfsplus*, and by *isolinux + El Torito boot images (dir=, bin_path=, efi_path=) may then be + augmented by *isolinux partition_entry=gpt_basdat* or *isolinux + partition_entry=gpt_hfsplus*, and by *isolinux partition_entry=apm_hfsplus*. The boot image will then be mentioned in an invalid GPT as Basic Data or GPT HFS+ partition, and in a valid APM as HFS+ partition. The first three GPT partitions will also be marked by MBR partitions. The MBR partition of type 0xEF is what actually is used by EFI firmware for booting from USB stick. - In multi-session situations the existing System Area is preserved - by default. In in this case, the special disk_path "." prevents - reading of a disk file but nevertheless causes adjustments in the - loaded system area data. Such adjustments may get ordered by - -boot_image commands. *-boot_image any gpt_disk_guid=*value controls whether an emerging GPT shall get a randomly generated disk GUID or whether the GUID is supplied by the user. Value "random" is default. Value @@ -3251,8 +3259,6 @@ Examples: addresses and sizes as if it had been processed by "partition_table=on". If so, then those parameters get updated when the new System Area is written. - Special "system_area=/dev/zero" causes 32k of NUL-bytes. Use this - to discard an MBR which was loaded with the ISO image. *appended_part_as=gpt* marks partitions from -append_partition in GPT rather than in MBR. In this case the MBR shows a single partition of type 0xee which covers the whole output data. The @@ -3387,10 +3393,10 @@ Examples: the DEC Alpha SRM Secondary Bootstrap Loader and causes production of a boot sector which points to it. This is mutually exclusive with production of other boot blocks like MBR. - *mips_discard*, *sparc_discard*, *hppa_discard*, *alpha_discard* - revoke any boot file declarations made for mips/mipsel, sparc, - hppa, or alpha, respectively. This removes the ban on production - of other boot blocks. + *mips_discard*, *mipsel_discard*, *sparc_discard*, *hppa_discard*, + *alpha_discard* revoke any boot file declarations made for + mips/mipsel, sparc, hppa, or alpha, respectively. This removes the + ban on production of other boot blocks. *hfsplus_serial=*hexstring sets a string of 16 digits "0" to "9" and letters "a" to "f", which will be used as unique serial number of an emerging HFS+ filesystem. @@ -5754,7 +5760,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -alter_date sets timestamps in ISO image: Manip. (line 139) * -alter_date_r sets timestamps in ISO image: Manip. (line 174) * -append_partition adds arbitrary file after image end: Bootable. - (line 464) + (line 470) * -application_id sets application id: SetWrite. (line 218) * -application_use sets application use field: SetWrite. (line 293) * -as emulates mkisofs or cdrecord: Emulation. (line 13) @@ -6006,14 +6012,14 @@ 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 455) +* APM block size: Bootable. (line 461) * APM, _definition: Extras. (line 42) * Appendable media, _definition: Media. (line 43) -* Appended Filesystem Image, -append_partition: Bootable. (line 464) -* Appended partition, in APM: Bootable. (line 320) -* Appended partition, in MBR or GPT: Bootable. (line 311) -* Appended partitions, GPT: Bootable. (line 493) -* Appended partitions, MBR: Bootable. (line 474) +* Appended Filesystem Image, -append_partition: Bootable. (line 470) +* Appended partition, in APM: Bootable. (line 326) +* Appended partition, in MBR or GPT: Bootable. (line 317) +* Appended partitions, GPT: Bootable. (line 499) +* Appended partitions, MBR: Bootable. (line 480) * Automatic execution order, of arguments, -x: ArgSort. (line 16) * Backslash Interpretation, _definition: Processing. (line 57) * Backup, enable fast incremental, -disk_dev_ino: Loading. (line 255) @@ -6031,15 +6037,15 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Character set, learn from image, -auto_charset: Loading. (line 117) * Character Set, of terminal, -local_charset: Charset. (line 57) * Character Set, _definition: Charset. (line 6) -* CHRP partition, _definition: Bootable. (line 327) +* CHRP partition, _definition: Bootable. (line 333) * Closed media, _definition: Media. (line 49) * 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 371) -* Cylinder size, _definition: Bootable. (line 356) +* Cylinder alignment, _definition: Bootable. (line 377) +* Cylinder size, _definition: Bootable. (line 362) * Damaged track and session, close, -close_damaged: Writing. (line 209) -* DEC Alpha SRM boot sector, production: Bootable. (line 441) +* DEC Alpha SRM boot sector, production: Bootable. (line 447) * Delete, from ISO image, -rm: Manip. (line 20) * Delete, from ISO image, -rm_r: Manip. (line 26) * Delete, ISO directory, -rmdir: Manip. (line 29) @@ -6071,7 +6077,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 336) +* EFI system partition, _definition: Bootable. (line 342) * El Torito, _definition: Extras. (line 19) * Emulation, -as: Emulation. (line 13) * Emulation, .mkisofsrc, -read_mkisofsrc: Emulation. (line 155) @@ -6096,19 +6102,19 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Filter, _definition: Filter. (line 6) * Frontend program, start at pipes, -launch_frontend: Frontend. (line 141) -* GPT Legacy BIOS bootable flag, set for ISO: Bootable. (line 393) -* GPT read-only flag, do not set for ISO: Bootable. (line 398) -* GPT, control GUID, -boot_image gpt_disk_guid=: Bootable. (line 252) +* GPT Legacy BIOS bootable flag, set for ISO: Bootable. (line 399) +* GPT read-only flag, do not set for ISO: Bootable. (line 404) +* GPT, control GUID, -boot_image gpt_disk_guid=: Bootable. (line 260) * GPT, _definition: Extras. (line 39) * Group, global in ISO image, -gid: SetWrite. (line 314) * Group, in ISO image, -chgrp: Manip. (line 49) * Group, in ISO image, -chgrp_r: Manip. (line 53) * Growing, _definition: Methods. (line 20) * Hard links, control handling, -hardlinks: Loading. (line 128) -* HFS+ allocation block size: Bootable. (line 452) -* HFS+ serial number: Bootable. (line 449) +* HFS+ allocation block size: Bootable. (line 458) +* HFS+ serial number: Bootable. (line 455) * hidden, set in ISO image, -hide: Manip. (line 177) -* HP-PA boot sector, production: Bootable. (line 424) +* HP-PA boot sector, production: Bootable. (line 430) * Image reading, cache size, -data_cache_size: Loading. (line 361) * Image, demand volume ID, -assert_volid: Loading. (line 105) * Image, discard pending changes, -rollback: Writing. (line 9) @@ -6165,7 +6171,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Linux device type, -scsi_dev_family: AqDrive. (line 95) * List delimiter, _definition: Processing. (line 13) * Local Character Set, _definition: Charset. (line 11) -* MBR bootable/active flag, enforce: Bootable. (line 382) +* MBR bootable/active flag, enforce: Bootable. (line 388) * MBR, set, -boot_image system_area=: Bootable. (line 227) * MBR, _definition: Extras. (line 27) * MD5, control handling, -md5: Loading. (line 183) @@ -6173,7 +6179,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Media, format, -format: Writing. (line 87) * Media, list formats, -list_formats: Writing. (line 128) * Media, list write speeds, -list_speeds: Writing. (line 139) -* MIPS boot file, activation: Bootable. (line 403) +* MIPS boot file, activation: Bootable. (line 409) * mkisofs, Emulation: Emulation. (line 17) * Modifying, _definition: Methods. (line 28) * Multi-session media, _definition: Media. (line 7) @@ -6201,15 +6207,15 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Ownership, global in ISO image, -uid: SetWrite. (line 311) * Ownership, in ISO image, -chown: Manip. (line 43) * Ownership, in ISO image, -chown_r: Manip. (line 47) -* Partition offset, _definition: Bootable. (line 346) -* Partition table, _definition: Bootable. (line 292) +* Partition offset, _definition: Bootable. (line 352) +* Partition table, _definition: Bootable. (line 300) * Pathspec, _definition: SetInsert. (line 126) * 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 29) * Permissions, in ISO image, -chmod: Manip. (line 55) * Permissions, in ISO image, -chmod_r: Manip. (line 66) -* PReP partition, _definition: Bootable. (line 331) +* PReP partition, _definition: Bootable. (line 337) * Problems, reporting: Bugreport. (line 6) * Process, consolidate text output, -pkt_output: Frontend. (line 7) * Process, control abort on error, -abort_on: Exception. (line 27) @@ -6271,8 +6277,8 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Session, select as input, -load: Loading. (line 54) * Session, _definition: Model. (line 6) * Sorting order, for -x, -list_arg_sorting: ArgSort. (line 26) -* SUN Disk Label, production: Bootable. (line 414) -* SUN SPARC boot images, activation: Bootable. (line 511) +* SUN Disk Label, production: Bootable. (line 420) +* SUN SPARC boot images, activation: Bootable. (line 517) * Symbolic link, create, -lns: Insert. (line 192) * System area, _definition: Bootable. (line 227) * Table-of-content, search sessions, -rom_toc_scan: Loading. (line 307) @@ -6342,40 +6348,40 @@ Node: Filter110633 Node: Writing115255 Node: SetWrite127749 Node: Bootable159024 -Node: Jigdo189944 -Node: Charset194947 -Node: Exception198276 -Node: DialogCtl204405 -Node: Inquiry207007 -Node: Navigate218879 -Node: Verify227586 -Node: Restore238735 -Node: Emulation250942 -Node: Scripting261398 -Node: Frontend269181 -Node: Examples278807 -Node: ExDevices279985 -Node: ExCreate280646 -Node: ExDialog281946 -Node: ExGrowing283217 -Node: ExModifying284026 -Node: ExBootable284536 -Node: ExCharset285091 -Node: ExPseudo285987 -Node: ExCdrecord286914 -Node: ExMkisofs287234 -Node: ExGrowisofs289131 -Node: ExException290284 -Node: ExTime290742 -Node: ExIncBackup291200 -Node: ExRestore295226 -Node: ExRecovery296172 -Node: Files296744 -Node: Environ298078 -Node: Seealso298826 -Node: Bugreport299543 -Node: Legal300134 -Node: CommandIdx301146 -Node: ConceptIdx319044 +Node: Jigdo190306 +Node: Charset195309 +Node: Exception198638 +Node: DialogCtl204767 +Node: Inquiry207369 +Node: Navigate219241 +Node: Verify227948 +Node: Restore239097 +Node: Emulation251304 +Node: Scripting261760 +Node: Frontend269543 +Node: Examples279169 +Node: ExDevices280347 +Node: ExCreate281008 +Node: ExDialog282308 +Node: ExGrowing283579 +Node: ExModifying284388 +Node: ExBootable284898 +Node: ExCharset285453 +Node: ExPseudo286349 +Node: ExCdrecord287276 +Node: ExMkisofs287596 +Node: ExGrowisofs289493 +Node: ExException290646 +Node: ExTime291104 +Node: ExIncBackup291562 +Node: ExRestore295588 +Node: ExRecovery296534 +Node: Files297106 +Node: Environ298440 +Node: Seealso299188 +Node: Bugreport299905 +Node: Legal300496 +Node: CommandIdx301508 +Node: ConceptIdx319406  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 6a07b997..57769bab 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -4324,13 +4324,27 @@ which can be used to boot from USB stick or hard disk. Other than an El Torito boot image, the file disk_path needs not to be added to the ISO image. @* +In multi-session situations the existing System Area is preserved by default. +In in this case, the special disk_path "." prevents reading of +a disk file but nevertheless causes adjustments in the +loaded system area data. Such adjustments may get ordered by -boot_image +commands. +@* +Special "system_area=/dev/zero" causes 32k of 0-bytes. +Use this to e.g. discard partition tables which were loaded with the ISO image. +@* +This setting is the default with the write method of Modifying, when -indev +and -outdev are both used and not the same drive. If you indeed need to copy +the unchanged system area from -indev to -outdev, use +"system_area=--interval:imported_iso:0s-15s::" , which was the default in older +versions of xorriso. +@* @strong{-boot_image isolinux system_area=} implies "partition_table=on". In this case, the disk path should lead to one of the SYSLINUX files isohdp[fp]x*.bin or to a file which was derived from one of those files. E.g. to the first 512 bytes from an ISOLINUX isohybrid ISO image. @* -In this case, El Torito boot images (dir=, bin_path=, efi_path=) -may be augmented by +El Torito boot images (dir=, bin_path=, efi_path=) may then be augmented by @strong{isolinux partition_entry=gpt_basdat} or @strong{isolinux partition_entry=gpt_hfsplus}, and by @strong{isolinux partition_entry=apm_hfsplus}. @@ -4340,12 +4354,6 @@ The first three GPT partitions will also be marked by MBR partitions. The MBR partition of type 0xEF is what actually is used by EFI firmware for booting from USB stick. @* -In multi-session situations the existing System Area is preserved by default. -In in this case, the special disk_path "." prevents reading of -a disk file but nevertheless causes adjustments in the -loaded system area data. Such adjustments may get ordered by -boot_image -commands. -@* @cindex GPT, control GUID, -boot_image gpt_disk_guid= @strong{-boot_image any gpt_disk_guid=}value controls whether an emerging GPT shall get a randomly generated disk GUID or whether the GUID is supplied by @@ -4415,9 +4423,6 @@ In this case the existing System Area gets checked whether it bears addresses and sizes as if it had been processed by "partition_table=on". If so, then those parameters get updated when the new System Area is written. @* -Special "system_area=/dev/zero" causes 32k of NUL-bytes. -Use this to discard an MBR which was loaded with the ISO image. -@* @cindex Appended partition, in MBR or GPT @strong{appended_part_as=gpt} marks partitions from -append_partition in GPT rather than in MBR. In this case the MBR shows a single partition @@ -4588,8 +4593,8 @@ DEC Alpha SRM Secondary Bootstrap Loader and causes production of a boot sector which points to it. This is mutually exclusive with production of other boot blocks like MBR. @* -@strong{mips_discard}, @strong{sparc_discard}, @strong{hppa_discard}, -@strong{alpha_discard} +@strong{mips_discard}, @strong{mipsel_discard}, @strong{sparc_discard}, +@strong{hppa_discard}, @strong{alpha_discard} revoke any boot file declarations made for mips/mipsel, sparc, hppa, or alpha, respectively. This removes the ban on production of other boot blocks. diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index fce27dcd..9bb0bc24 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2024.05.12.153800" +#define Xorriso_timestamP "2024.05.13.101913"