New bootspec sparc_label=, new -as mkisofs options -sparc-boot , -sparc-label

This commit is contained in:
Thomas Schmitt 2010-11-05 14:46:34 +00:00
parent 9d5563538b
commit 3f24f292a3
8 changed files with 146 additions and 30 deletions

View File

@ -225,10 +225,11 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->partition_offset= 0;
m->partition_secs_per_head= 0;
m->partition_heads_per_cyl= 0;
for(i= 0; i < 4; i++) {
m->appended_partitions[i][0]= 0;
for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
m->appended_partitions[i]= NULL;
m->appended_part_types[i]= 0;
}
m->ascii_disc_label[0]= 0;
m->vol_creation_time= 0;
m->vol_modification_time= 0;
m->vol_expiration_time= 0;
@ -424,6 +425,7 @@ int Xorriso_destroy_re(struct XorrisO *m, int flag)
int Xorriso_destroy(struct XorrisO **xorriso, int flag)
{
struct XorrisO *m;
int i;
m= *xorriso;
if(m==NULL)
@ -451,6 +453,10 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
Xorriso_lst_destroy_all(&(m->jigdo_params), 0);
Xorriso_lst_destroy_all(&(m->jigdo_values), 0);
for(i= 0; i < Xorriso_max_appended_partitionS; i++)
if(m->appended_partitions[i] != NULL)
free(m->appended_partitions[i]);
Xorriso_detach_libraries(m, flag&1);
free((char *) m);

View File

@ -755,6 +755,9 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
" -partition_sec_hd NUMBER Define number of sectors per head",
" -partition_hd_cyl NUMBER Define number of heads per cylinder",
" -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",
" -append_partition NUMBER TYPE FILE",
" Append FILE after image. TYPE is hex: 0x..",
" --modification-date=YYYYMMDDhhmmsscc",
@ -874,14 +877,14 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
int ret, i, j, was_path= 0, was_other_option= 0, mem_graft_points, mem;
int do_print_size= 0, fd, idx, iso_level= 0, emul_boot= 2;
int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0;
int dir_mode= -1, file_mode= -1, count;
int dir_mode= -1, file_mode= -1, count, partition_number;
mode_t mode_and, mode_or;
int with_boot_image= 0, with_cat_path= 0;
int *weight_list= NULL, weight_count= 0;
int *delay_opt_list= NULL, delay_opt_count= 0;
char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL];
char *ept, *add_pt, eff_path[SfileadrL], indev[SfileadrL+8], msc[80], *cpt;
char *boot_path;
char *boot_path, partno_text[8];
static char *sort_weight_args[4]= {"", "-exec", "sort_weight", ""};
strcpy(ra_text, xorriso->report_about_text);
@ -1365,6 +1368,59 @@ not_enough_args:;
if(ret <= 0)
goto problem_handler_2;
} else if(strcmp(argv[i], "-B") == 0 ||
strcmp(argv[i], "-sparc-boot") == 0) {
i++;
if(strlen(argv[i]) >= SfileadrL)
continue;
/* Switch system area type to: SUN Disk Label */
strcpy(pathspec, "sparc_label=");
strcat(pathspec, xorriso->ascii_disc_label);
ret= Xorriso_option_boot_image(xorriso, "any", pathspec, 0);
if(ret <= 0)
goto problem_handler_2;
/* Interpret list of boot partition images or "..." */;
cpt= ept= argv[i];
partition_number= 2;
while(ept != NULL) {
ept= strchr(cpt, ',');
if(ept != NULL) {
strncpy(pathspec, cpt, ept - cpt);
pathspec[ept - cpt]= 0;
cpt= ept + 1;
} else
strcpy(pathspec, cpt);
if(strcmp(pathspec, "...") == 0) {
for(; partition_number <= 8; partition_number++) {
sprintf(partno_text, "%d", partition_number);
ret= Xorriso_option_append_partition(xorriso, partno_text, "0x0",
".", 0);
if(ret <= 0)
goto problem_handler_2;
}
} else {
if(partition_number > 8) {
sprintf(xorriso->info_text,
"-as %s -sparc-boot %s : Too many boot images", whom, argv[i]);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE",0);
goto problem_handler_2;
}
sprintf(partno_text, "%d", partition_number);
ret= Xorriso_option_append_partition(xorriso, partno_text, "0x0",
pathspec, 0);
if(ret <= 0)
goto problem_handler_2;
partition_number++;
}
}
} else if(strcmp(argv[i], "-sparc-label") == 0) {
i++;
strncpy(xorriso->ascii_disc_label, argv[i], Xorriso_disc_label_sizE - 1);
xorriso->ascii_disc_label[Xorriso_disc_label_sizE - 1] = 0;
} else if(argv[i][0]=='-' && argv[i][1]!=0) {
ret= Xorriso_genisofs_count_args(xorriso, argc - i, argv + i, &count, 1);
if(ret > 0) {

View File

@ -459,8 +459,8 @@ int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path,
bit0= do only report non-default settings
bit1= do only report to fp
*/
int Xorriso_boot_status_mips(struct XorrisO *xorriso, IsoImage *image,
char *filter, FILE *fp, int flag)
int Xorriso_boot_status_non_mbr(struct XorrisO *xorriso, IsoImage *image,
char *filter, FILE *fp, int flag)
{
int i, num_boots, sa_type;
char *paths[15], *line;
@ -468,6 +468,15 @@ int Xorriso_boot_status_mips(struct XorrisO *xorriso, IsoImage *image,
line= xorriso->result_line;
sa_type= (xorriso->system_area_options & 0xfc) >> 2;
if(sa_type == 3) {
sprintf(line, "-boot_image any sparc_label=");
Text_shellsafe(xorriso->ascii_disc_label, line, 1);
strcat(line, "\n");
Xorriso_status_result(xorriso, filter, fp, flag & 2);
return(0);
}
if(sa_type != 1 && sa_type != 2)
return(0);
num_boots= iso_image_get_mips_boot_files(image, paths, 0);
Xorriso_process_msg_queues(xorriso, 0);
if(num_boots <= 0)
@ -493,8 +502,8 @@ int Xorriso_append_part_status(struct XorrisO *xorriso, IsoImage *image,
{
int i;
for(i= 0; i < 4; i++) {
if(xorriso->appended_partitions[i][0] == 0)
for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
if(xorriso->appended_partitions[i] == NULL)
continue;
sprintf(xorriso->result_line, "-append_partition %d 0x%2.2x ",
i + 1, (unsigned int) xorriso->appended_part_types[i]);
@ -537,7 +546,7 @@ int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp,
if(image == NULL)
goto no_image;
ret= Xorriso_boot_status_mips(xorriso, image, filter, fp, flag & 3);
ret= Xorriso_boot_status_non_mbr(xorriso, image, filter, fp, flag & 3);
if(ret < 0) /* == 0 is normal */
{ret= 0; goto ex;}
@ -1080,15 +1089,16 @@ int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type,
int options, char *cmd, int flag)
{
int old_type, old_options;
static char *type_names[3] = {
"MBR", "MIPS Big Endian Volume Header", "MIPS Little Endian Boot Block"};
static char *type_names[4] = {
"MBR", "MIPS Big Endian Volume Header", "MIPS Little Endian Boot Block",
"SUN Disk Label"};
old_type= (xorriso->system_area_options & 0xfc) >> 2;
old_options= xorriso->system_area_options & ~0xfc;
if((old_type != 0 || old_options != 0) &&
(old_type != sa_type || (old_options != 0 && old_options != options))) {
sprintf(xorriso->info_text, "%s : First sector already occupied by %s",
cmd, old_type < 2 ? type_names[old_type] : "other boot facility");
cmd, old_type < 4 ? type_names[old_type] : "other boot facility");
if(old_type == 0 && old_options == 2)
strcat(xorriso->info_text, " for ISOLINUX isohybrid");
if(old_type == 0 && old_options == 1)
@ -1106,7 +1116,9 @@ hint_revoke:;
sprintf(xorriso->info_text, "Revokable by -boot_image any discard");
else if(old_type == 1 || old_type == 2)
sprintf(xorriso->info_text, "Revokable by -boot_image any mips_discard");
if(old_type < 2)
else if(old_type == 3)
sprintf(xorriso->info_text, "Revokable by -boot_image any sparc_discard");
if(old_type < 4)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
}

View File

@ -262,14 +262,14 @@ int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text,
int partno = 0, type_code= -1, i;
unsigned int unum;
char *tpt;
static char *part_type_names[] = {"FAT12", "FAT16", "Linux", NULL};
static int part_type_codes[] = { 0x01, 0x06, 0x83};
static char *part_type_names[] = {"FAT12", "FAT16", "Linux", "", NULL};
static int part_type_codes[] = { 0x01, 0x06, 0x83, 0x00};
sscanf(partno_text, "%d", &partno);
if(partno < 1 || partno > 4) {
if(partno < 1 || partno > Xorriso_max_appended_partitionS) {
sprintf(xorriso->info_text,
"-append_partition: Partition number '%s' is out of range (1...4)",
partno_text);
"-append_partition: Partition number '%s' is out of range (1...%d)",
partno_text, Xorriso_max_appended_partitionS);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
@ -297,8 +297,13 @@ bad_type:;
type_code= unum;
}
if(Sfile_str(xorriso->appended_partitions[partno - 1], image_path, 0) <= 0)
if(xorriso->appended_partitions[partno - 1] != NULL)
free(xorriso->appended_partitions[partno - 1]);
xorriso->appended_partitions[partno - 1]= strdup(image_path);
if(xorriso->appended_partitions[partno - 1] == NULL) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
return(-1);
}
xorriso->appended_part_types[partno - 1]= type_code;
return(1);
}
@ -808,10 +813,20 @@ treatment_patch:;
return(ret);
} else if(strcmp(treatpt, "mips_discard") == 0 ||
strcmp(treatpt, "mipsel_discard") == 0) {
strcmp(treatpt, "mipsel_discard") == 0 ||
strcmp(treatpt, "sparc_discard") == 0) {
xorriso->system_area_options&= ~0xfc; /* system area type 0 */
Xorriso_add_mips_boot_file(xorriso, "", 1); /* give up MIPS boot files */
} else if(strncmp(treatpt, "sparc_label=", 12) == 0) {
sprintf(eff_path, "-boot_image %s sparc_path=", formpt);
ret= Xorriso_coordinate_system_area(xorriso, 3, 0, eff_path, 0);
if(ret <= 0)
return(ret);
strncpy(xorriso->ascii_disc_label, treatpt + 12,
Xorriso_disc_label_sizE - 1);
xorriso->ascii_disc_label[Xorriso_disc_label_sizE - 1] = 0;
} else if(strncmp(treatpt, "boot_info_table=", 16)==0) {
if(strcmp(treatpt + 16, "off") == 0)
xorriso->patch_isolinux_image= 0;

View File

@ -1391,6 +1391,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" |\"cat_path=\"|\"cat_hidden=on|iso_rr|joliet|off\"",
" |\"load_size=\"|\"system_area=\"|\"partition_table=on|off\"",
" |\"mips_path=\"|\"mipsel_path=\"|\"mips_discard\"",
" |\"sparc_label=\"|\"sparc_discard\"",
" |\"show_status\"",
" Whether to discard or keep an exiting El Torito boot image.",
" ISOLINUX can be made bootable by dir=/ or dir=/isolinux",
@ -1401,8 +1402,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" system_area= and partition_table= are for MBR based booting",
" from USB stick. The system_area= file needs not to be added.",
" mips_path= adds Big Endian MIPS boot files. mipsel_path=",
" sets one Little Endian MIPS boot file. Both are mutually",
" exclusive and exclusive to MBR production.",
" sets one Little Endian MIPS boot file. sparc_label=",
" activates SUN Disk Label. All three are mutually exclusive",
" and exclusive to MBR production.",
" -append_partition partition_number type_code disk_path",
" Append a prepared filesystem image after the end of the",
" ISO image. Caution: Will be overwritten by multi-session.",
@ -1759,9 +1761,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
"Compatibility emulation (argument list may be ended by list delimiter --):",
" -as mkisofs [-help|-version|-o|-R|-r|-J|-V|-P|-f|-m|-exclude-list|",
" -no-pad|-M|-C|-graft-points|-path-list|pathspecs|-z|",
" -no-emul-boot|-b|-c|-boot-info-table|-boot-load-size|-G]",
" -no-emul-boot|-b|-c|-boot-info-table|-boot-load-size|-G|...]",
" Perform some mkisofs gestures, understand pathspecs as mkisofs",
" does. Commit happens outside emulation at usual occasions.",
" For a list of options see -as mkisofs -help.",
" -read_mkisofsrc",
" Read and interpret the .mkisofsrc configuration file.",
" -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|-multi]",

View File

@ -532,7 +532,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{
int ret, relax= 0, i, pacifier_speed= 0, data_lba, ext, is_bootable= 0;
int freshly_bootable= 0, hide_attr;
char xorriso_id[256], *img_id, sfe[5*SfileadrL], *out_cs;
char xorriso_id[256], *img_id, sfe[5*SfileadrL], *out_cs, *part_image;
struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo;
struct burn_drive *drive, *source_drive;
@ -736,12 +736,20 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
isoburn_igopt_set_scdbackup_tag(sopts, xorriso->scdbackup_tag_name,
xorriso->scdbackup_tag_time,
xorriso->scdbackup_tag_written);
for(i= 0; i < 4; i++) {
for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
if(xorriso->appended_partitions[i] == NULL)
continue;
if(xorriso->appended_partitions[i][0] == 0)
continue;
ret= isoburn_igopt_set_partition_img(sopts, i + 1,
xorriso->appended_part_types[i], xorriso->appended_partitions[i]);
if(strcmp(xorriso->appended_partitions[i], ".") == 0)
part_image= "";
else
part_image= xorriso->appended_partitions[i];
isoburn_igopt_set_partition_img(sopts, i + 1,
xorriso->appended_part_types[i], part_image);
}
isoburn_igopt_set_disc_label(sopts, xorriso->ascii_disc_label);
if(image!=NULL && 12+strlen(Xorriso_timestamP)<80) {
strcpy(xorriso_id, xorriso->preparer_id);
img_id= (char *) iso_image_get_data_preparer_id(image);

View File

@ -64,6 +64,18 @@ struct FindjoB; /* Program and status of a find run */
(((off_t) 400) * ((off_t) 1024*1024*1024) - (off_t) 204800)
/* Maximum number of appended partitions. Effectively usable number depends
on system area type.
*/
#define Xorriso_max_appended_partitionS 8
/*
Maximum length of a disc label text plus 1.
*/
#define Xorriso_disc_label_sizE 129
struct XorrisO { /* the global context of xorriso */
int libs_are_started;
@ -323,8 +335,12 @@ struct XorrisO { /* the global context of xorriso */
int partition_heads_per_cyl;
/* Path and type of image files to be appended as MBR partitions */
char appended_partitions[4][SfileadrL];
uint8_t appended_part_types[4];
char *appended_partitions[Xorriso_max_appended_partitionS];
uint8_t appended_part_types[Xorriso_max_appended_partitionS];
/* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
*/
char ascii_disc_label[Xorriso_disc_label_sizE];
/* User settable PVD time stamps */
time_t vol_creation_time;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.11.05.143916"
#define Xorriso_timestamP "2010.11.05.144616"