From 21bd5b5d426e7fbf337adfd4c6bc7e2067039843 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 5 Sep 2010 11:37:45 +0000 Subject: [PATCH] New boot_image boot specs partition_offset, partition_hd_cyl, partition_sec_hd --- xorriso/base_obj.c | 3 ++ xorriso/opts_a_c.c | 34 ++++++++++++++++ xorriso/text_io.c | 26 +++++++++++-- xorriso/write_run.c | 26 +++++++++++++ xorriso/xorriso.1 | 18 ++++++++- xorriso/xorriso.info | 78 ++++++++++++++++++++++--------------- xorriso/xorriso.texi | 19 ++++++++- xorriso/xorriso_private.h | 16 ++++++++ xorriso/xorriso_timestamp.h | 2 +- 9 files changed, 183 insertions(+), 39 deletions(-) diff --git a/xorriso/base_obj.c b/xorriso/base_obj.c index e08cddf8..fa328ddd 100644 --- a/xorriso/base_obj.c +++ b/xorriso/base_obj.c @@ -207,6 +207,9 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->system_area_disk_path[0]= 0; m->system_area_options= 0; m->patch_system_area= 0; + m->partition_offset= 0; + m->partition_secs_per_head= 0; + m->partition_heads_per_cyl= 0; m->vol_creation_time= 0; m->vol_modification_time= 0; m->vol_expiration_time= 0; diff --git a/xorriso/opts_a_c.c b/xorriso/opts_a_c.c index becf2b1c..cd9bd014 100644 --- a/xorriso/opts_a_c.c +++ b/xorriso/opts_a_c.c @@ -791,6 +791,40 @@ treatment_patch:; } else was_ok= 0; + } else if(strncmp(treatpt, "partition_offset=", 17)==0) { + u= 0; + sscanf(treatpt + 17, "%u", &u); + if(u > 0 && u < 16) { + sprintf(xorriso->info_text, + "-boot_image %s partition_offset= : Non-zero number too small (<16).", + formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + xorriso->partition_offset= u; + + } else if(strncmp(treatpt, "partition_hd_cyl=", 17)==0) { + u= 0; + sscanf(treatpt + 17, "%u", &u); + if(u > 255) { + sprintf(xorriso->info_text, + "-boot_image %s partition_hd_cyl= : Number too large (>255).", formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + xorriso->partition_heads_per_cyl= u; + + } else if(strncmp(treatpt, "partition_sec_hd=", 17)==0) { + u= 0; + sscanf(treatpt + 17, "%u", &u); + if(u > 63) { + sprintf(xorriso->info_text, + "-boot_image %s partition_sec_hd= : Number too large (>63).", formpt); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + return(0); + } + xorriso->partition_secs_per_head= u; + } else if(strncmp(treatpt, "platform_id=", 12)==0) { if(strncmp(treatpt + 12, "0x", 2) == 0) sscanf(treatpt + 14, "%x", &u); diff --git a/xorriso/text_io.c b/xorriso/text_io.c index 4fa01dee..890e53db 100644 --- a/xorriso/text_io.c +++ b/xorriso/text_io.c @@ -512,7 +512,7 @@ int Xorriso_write_to_channel(struct XorrisO *xorriso, bit15= with bit1 or bit2: close depicted log file */ { - char *rpt, *npt, *text; + char *rpt, *npt, *text= NULL; int ret= 1, info_redirected= 0, result_redirected= 0; char prefix[16]; FILE *logfile_fp, *pktlog_fp; @@ -520,11 +520,11 @@ bit15= with bit1 or bit2: close depicted log file static int num_channels= 4; static char channel_prefixes[4][4]= {".","R","I","M"}; + text= in_text; /* might change due to backslash encoding */ + if(channel_no<0 || channel_no>=num_channels) {ret= -1; goto ex;} - text= in_text; /* might change due to backslash encoding */ - /* Logfiles */ logfile_fp= xorriso->logfile_fp[channel_no]; pktlog_fp= xorriso->pktlog_fp; @@ -1278,7 +1278,25 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) Text_shellsafe(xorriso->system_area_disk_path, sfe, 0)); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); - if(xorriso->system_area_disk_path[0] || !part_table_implicit) { + + is_default= (xorriso->partition_offset == 0); + sprintf(line,"-boot_image any partition_offset=%lu\n", + (unsigned long int) xorriso->partition_offset); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->partition_secs_per_head == 0); + sprintf(line,"-boot_image any partition_sec_hd=%lu\n", + (unsigned long int) xorriso->partition_secs_per_head); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->partition_heads_per_cyl == 0); + sprintf(line,"-boot_image any partition_hd_cyl=%lu\n", + (unsigned long int) xorriso->partition_heads_per_cyl); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + if((xorriso->system_area_disk_path[0] || !part_table_implicit) && + (xorriso->partition_offset == 0 || (xorriso->system_area_options & 2))) { is_default= ((xorriso->system_area_options & 3) == 0); sprintf(line,"-boot_image %s partition_table=%s\n", xorriso->system_area_options & 2 ? "isolinux" : "grub", diff --git a/xorriso/write_run.c b/xorriso/write_run.c index 5c4ca23b..ea58e473 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -308,6 +308,15 @@ do_set:; 0, "FAILURE", 1); {ret= 0; goto ex;} } + ret= isoburn_igopt_set_part_offset(sopts, xorriso->partition_offset, + xorriso->partition_secs_per_head, + xorriso->partition_heads_per_cyl); + if(ret != ISO_SUCCESS) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when setting partition offset", 0, "FAILURE", 1); + {ret= 0; goto ex;} + } ret= 1; ex:; if(fp != NULL && fp != stdin) @@ -522,6 +531,18 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) "on attempt to write", 2); if(ret<=0) return(0); + + /* <<< TWINTREE: preliminary */ + if(xorriso->partition_offset > 0) { + s= isoburn_disc_get_status(drive); + if(s != BURN_DISC_BLANK) { + sprintf(xorriso->info_text, + "Output drive not blank with non-zero partition offset"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + if(xorriso->out_drive_handle == xorriso->in_drive_handle) { source_drive= drive; } else { @@ -680,6 +701,11 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) ((!!(xorriso->do_md5 & 8)) * isoburn_igopt_file_stability); if(xorriso->no_emul_toc & 1) ext|= isoburn_igopt_no_emul_toc; + + /* <<< TWINTREE: preliminary */ + if(xorriso->partition_offset > 0) + ext|= isoburn_igopt_no_emul_toc; + isoburn_igopt_set_extensions(sopts, ext); isoburn_igopt_set_relaxed(sopts, relax); isoburn_igopt_set_sort_files(sopts, 1); diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index ceb00f10..3cadcac8 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 "Jul 30, 2010" +.TH XORRISO 1 "Sep 04, 2010" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -2393,6 +2393,22 @@ 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 eventually was loaded with the ISO image. .br +\fBpartition_offset=\fR2kb_block_adr causes a partition table where the +first partition begins at the given block address. This is counted in 2 kB +blocks, not in 512 byte blocks. If the block address is non-zero then it must +be at least 16. A non-zero partition offset causes two susperblocks to be +generated and two sets of directory trees. The image is then mountable from its +absolute start as well as from the partition start. +.br +Preliminary restrictions: Non-zero offset works only with blank output media +and implies -compliance no_emul_toc. +.br +\fBpartition_sec_hd=\fRnumber gives the number of sectors per head for +partition offset. 0 chooses a default value. +.br +\fBpartition_hd_cyl=\fRnumber gives the number of heads per cylinder for +partition offset. 0 chooses a default value. +.br .TP .B Character sets: .PP diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index 9d720067..f8977055 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -2129,6 +2129,19 @@ of the existing sessions, unless one can assume overwriteable media. when the new System Area is written. Special "system_area=/dev/zero" causes 32k of NUL-bytes. Use this to discard an MBR which eventually was loaded with the ISO image. + *partition_offset=*2kb_block_adr causes a partition table where the + first partition begins at the given block address. This is counted + in 2 kB blocks, not in 512 byte blocks. If the block address is + non-zero then it must be at least 16. A non-zero partition offset + causes two susperblocks to be generated and two sets of directory + trees. The image is then mountable from its absolute start as well + as from the partition start. + Preliminary restrictions: Non-zero offset works only with blank + output media and implies -compliance no_emul_toc. + *partition_sec_hd=*number gives the number of sectors per head for + partition offset. 0 chooses a default value. + *partition_hd_cyl=*number gives the number of heads per cylinder + for partition offset. 0 chooses a default value.  File: xorriso.info, Node: Charset, Next: Exception, Prev: Bootable, Up: Options @@ -4071,6 +4084,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Ownership, global in ISO image, -uid: SetWrite. (line 162) * Ownership, in ISO image, -chown: Manip. (line 42) * Ownership, in ISO image, -chown_r: Manip. (line 47) +* Partition offset, _definiton: Bootable. (line 142) * Partition table, _definiton: Bootable. (line 124) * Pathspec, _definition: SetInsert. (line 120) * Pattern expansion, _definition: Processing. (line 22) @@ -4183,37 +4197,37 @@ Node: Filter75390 Node: Writing79739 Node: SetWrite86028 Node: Bootable97977 -Node: Charset106184 -Node: Exception108938 -Node: DialogCtl113453 -Node: Inquiry115798 -Node: Navigate119928 -Node: Verify127526 -Node: Restore135946 -Node: Emulation142602 -Node: Scripting150325 -Node: Frontend155887 -Node: Examples157088 -Node: ExDevices158257 -Node: ExCreate158891 -Node: ExDialog160165 -Node: ExGrowing161427 -Node: ExModifying162229 -Node: ExBootable162730 -Node: ExCharset163277 -Node: ExPseudo164105 -Node: ExCdrecord164999 -Node: ExMkisofs165314 -Node: ExGrowisofs166317 -Node: ExException167441 -Node: ExTime167895 -Node: ExIncBackup168354 -Node: ExRestore171826 -Node: ExRecovery172795 -Node: Files173361 -Node: Seealso174589 -Node: Legal175113 -Node: CommandIdx176035 -Node: ConceptIdx189841 +Node: Charset107016 +Node: Exception109770 +Node: DialogCtl114285 +Node: Inquiry116630 +Node: Navigate120760 +Node: Verify128358 +Node: Restore136778 +Node: Emulation143434 +Node: Scripting151157 +Node: Frontend156719 +Node: Examples157920 +Node: ExDevices159089 +Node: ExCreate159723 +Node: ExDialog160997 +Node: ExGrowing162259 +Node: ExModifying163061 +Node: ExBootable163562 +Node: ExCharset164109 +Node: ExPseudo164937 +Node: ExCdrecord165831 +Node: ExMkisofs166146 +Node: ExGrowisofs167149 +Node: ExException168273 +Node: ExTime168727 +Node: ExIncBackup169186 +Node: ExRestore172658 +Node: ExRecovery173627 +Node: Files174193 +Node: Seealso175421 +Node: Legal175945 +Node: CommandIdx176867 +Node: ConceptIdx190673  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index 9e278583..57635ead 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -44,7 +44,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 "Jul 30, 2010" +@c man .TH XORRISO 1 "Sep 04, 2010" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -2861,6 +2861,23 @@ 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 eventually was loaded with the ISO image. @* +@cindex Partition offset, _definiton +@strong{partition_offset=}2kb_block_adr causes a partition table where the +first partition begins at the given block address. This is counted in 2 kB +blocks, not in 512 byte blocks. If the block address is non-zero then it must +be at least 16. A non-zero partition offset causes two susperblocks to be +generated and two sets of directory trees. The image is then mountable from its +absolute start as well as from the partition start. +@* +Preliminary restrictions: Non-zero offset works only with blank output media +and implies -compliance no_emul_toc. +@* +@strong{partition_sec_hd=}number gives the number of sectors per head for +partition offset. 0 chooses a default value. +@* +@strong{partition_hd_cyl=}number gives the number of heads per cylinder for +partition offset. 0 chooses a default value. +@* @end table @c man .TP @c man .B Character sets: diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 23cf899b..a5468c2c 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -19,6 +19,10 @@ #define Xorriso_private_includeD yes +/* for uint32_t */ +#include + + /** The source code release timestamp */ #include "xorriso_timestamp.h" #ifndef Xorriso_timestamP @@ -302,6 +306,18 @@ struct XorrisO { /* the global context of xorriso */ area of the image, if no system_area_disk_path is set. */ + + /* TWINTREE: The number of unclaimed 2K blocks before + start of partition 1 as of the MBR in system area. + If not 0 this will cause double volume descriptor sets + and double tree. + */ + uint32_t partition_offset; + /* TWINTREE: Partition table parameter: 1 to 63, 0= disabled/default */ + int partition_secs_per_head; + /* TWINTREE: 1 to 255, 0= disabled/default */ + int partition_heads_per_cyl; + /* User settable PVD time stamps */ time_t vol_creation_time; time_t vol_modification_time; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 03942b96..c935d854 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.09.05.113621" +#define Xorriso_timestamP "2010.09.05.113655"