New -as mkisofs option -eltorito-platform
This commit is contained in:
@@ -664,7 +664,7 @@ int Xorriso_genisofs_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
||||
"-hfsplus-block-size", "-apm-block-size", "--grub2-mbr",
|
||||
"--grub2-sparc-core", "--sort-weight-list", "--sort-weight-patterns",
|
||||
"-hppa-hdrversion", "-file_name_limit", "--set_all_file_dates",
|
||||
"--gpt_disk_guid", "-iso_mbr_part_type",
|
||||
"--gpt_disk_guid", "-iso_mbr_part_type", "-eltorito-platform",
|
||||
""
|
||||
};
|
||||
static char arg2_options[][41]= {
|
||||
@@ -857,6 +857,7 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
|
||||
" 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",
|
||||
@@ -1269,6 +1270,44 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_genisofs_platform(struct XorrisO *xorriso, char *id, int flag)
|
||||
{
|
||||
unsigned int u;
|
||||
char re_id[64];
|
||||
|
||||
if(strcmp(id, "x86") == 0)
|
||||
return(0);
|
||||
else if(strcmp(id, "PPC") == 0)
|
||||
return(1);
|
||||
else if(strcmp(id, "Mac") == 0)
|
||||
return(2);
|
||||
else if(strcmp(id, "efi") == 0)
|
||||
return(0xef);
|
||||
|
||||
u= 0x100;
|
||||
if(strncmp(id, "0x", 2) == 0) {
|
||||
sscanf(id + 2, "%x", &u);
|
||||
} else {
|
||||
sscanf(id, "%u", &u);
|
||||
sprintf(re_id, "%u", u);
|
||||
if(strcmp(id, re_id) != 0)
|
||||
goto wrong_id;
|
||||
}
|
||||
if(u <= 0xff)
|
||||
return((int) u);
|
||||
|
||||
wrong_id:;
|
||||
sprintf(xorriso->info_text,
|
||||
"Unrecognized El Torito Platform Id : '%.16s%s'",
|
||||
id, strlen(id) > 16 ? "..." : "");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
sprintf(xorriso->info_text,
|
||||
"Recognizable are: x86, PPC, Mac, efi, [0...255], [0x00...0xff]");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/* micro emulation of mkisofs */
|
||||
int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
int argc, char **argv, int flag)
|
||||
@@ -1284,6 +1323,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
int old_root_md5= 1, old_root_dev= 0, old_root_ino= 1, sort_file_pattern= 0;
|
||||
int *weight_list= NULL, weight_count= 0;
|
||||
int *delay_opt_list= NULL, delay_opt_count= 0;
|
||||
int mkisofs_b_platform_id= 0x00;
|
||||
char *sfe= NULL, *adr= NULL, ra_text[80], *pathspec= NULL, *sort_file= NULL;
|
||||
char *ept, *add_pt, *eff_path= NULL, *indev= NULL, msc[80], *cpt;
|
||||
char *old_root= NULL, *argpt, *hargv[1];
|
||||
@@ -1892,6 +1932,7 @@ not_enough_args:;
|
||||
delay_opt_list[delay_opt_count - 1]|= 1<<31;
|
||||
} else if(strcmp(argpt, "-b") == 0 ||
|
||||
strcmp(argpt, "-eltorito-boot") == 0 ||
|
||||
strcmp(argpt, "-eltorito-platform") == 0 ||
|
||||
strcmp(argpt, "--efi-boot") == 0 ||
|
||||
strcmp(argpt, "-e") == 0 ||
|
||||
strcmp(argpt, "-mips-boot") == 0 ||
|
||||
@@ -2414,7 +2455,7 @@ problem_handler_2:;
|
||||
if(strcmp(argpt, "-e") == 0)
|
||||
xorriso->boot_platform_id= 0xef;
|
||||
else
|
||||
xorriso->boot_platform_id= 0x00;
|
||||
xorriso->boot_platform_id= mkisofs_b_platform_id;
|
||||
xorriso->boot_efi_default= 0;
|
||||
if(xorriso->boot_emul_default)
|
||||
xorriso->boot_image_emul= 2;
|
||||
@@ -2432,6 +2473,21 @@ problem_handler_2:;
|
||||
}
|
||||
xorriso->keep_boot_image= 0;
|
||||
with_boot_image= 1;
|
||||
} else if(strcmp(argpt, "-eltorito-platform") == 0) {
|
||||
if(i + 1>=argc)
|
||||
goto not_enough_args;
|
||||
i++;
|
||||
if(xorriso->boot_image_bin_path[0] != 0) {
|
||||
ret= Xorriso_genisofs_add_boot(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_boot;
|
||||
}
|
||||
mkisofs_b_platform_id= Xorriso_genisofs_platform(xorriso, argv[i], 0);
|
||||
if(mkisofs_b_platform_id < 0) {
|
||||
mkisofs_b_platform_id= 0;
|
||||
goto problem_handler_boot;
|
||||
}
|
||||
|
||||
} else if(strcmp(argpt, "-c") == 0 ||
|
||||
strcmp(argpt, "-eltorito-catalog") == 0) {
|
||||
if(i+1>=argc)
|
||||
|
Reference in New Issue
Block a user