Polished and documented MIPS booting option
This commit is contained in:
@ -455,6 +455,28 @@ int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path,
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_boot_status_mips(struct XorrisO *xorriso, IsoImage *image,
|
||||
char *filter, FILE *fp, int flag)
|
||||
{
|
||||
int i, num_boots;
|
||||
char *paths[15], *line;
|
||||
|
||||
line= xorriso->result_line;
|
||||
|
||||
num_boots= iso_image_get_mips_boot_files(image, paths, 0);
|
||||
Xorriso_process_msg_queues(xorriso, 0);
|
||||
if(num_boots <= 0)
|
||||
return(num_boots);
|
||||
for(i= 0; i < num_boots; i++) {
|
||||
strcpy(line,"-boot_image any mips_path=");
|
||||
Text_shellsafe(paths[i], line, 1);
|
||||
strcat(line, "\n");
|
||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||
}
|
||||
return(num_boots);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bit0= do only report non-default settings
|
||||
bit1= do only report to fp
|
||||
@ -477,7 +499,21 @@ int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp,
|
||||
line= xorriso->result_line;
|
||||
no_defaults= flag & 1;
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to print boot info", 2 | 16);
|
||||
if(ret<=0)
|
||||
goto no_image;
|
||||
image= isoburn_get_attached_image(drive);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(image == NULL)
|
||||
goto no_image;
|
||||
|
||||
ret= Xorriso_boot_status_mips(xorriso, image, filter, fp, 0);
|
||||
if(ret < 0) /* == 0 is normal */
|
||||
{ret= 0; goto ex;}
|
||||
|
||||
if(xorriso->boot_count == 0 && xorriso->boot_image_bin_path[0] == 0) {
|
||||
no_image:;
|
||||
if(xorriso->patch_isolinux_image & 1) {
|
||||
sprintf(line, "-boot_image %s patch\n",
|
||||
xorriso->patch_isolinux_image & 2 ? "grub" : form);
|
||||
@ -494,14 +530,6 @@ int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp,
|
||||
ret= 1; goto ex;
|
||||
}
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to print boot info", 16);
|
||||
if(ret<=0)
|
||||
{ret= 0; goto ex;}
|
||||
image= isoburn_get_attached_image(drive);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(image == NULL)
|
||||
{ret= 0; goto ex;}
|
||||
|
||||
if(xorriso->boot_image_bin_path[0] || xorriso->boot_count > 0)
|
||||
bin_path_in_use= 1;
|
||||
@ -972,6 +1000,8 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= give up all boot file paths
|
||||
*/
|
||||
int Xorriso_add_mips_boot_file(struct XorrisO *xorriso, char *path, int flag)
|
||||
{
|
||||
int ret;
|
||||
@ -980,6 +1010,10 @@ int Xorriso_add_mips_boot_file(struct XorrisO *xorriso, char *path, int flag)
|
||||
ret= Xorriso_get_volume(xorriso, &image, 0);
|
||||
if(ret <= 0)
|
||||
return ret;
|
||||
if(flag & 1) {
|
||||
iso_image_give_up_mips_boot(image, 0);
|
||||
return(1);
|
||||
}
|
||||
ret = iso_image_add_mips_boot_file(image, path, 0);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if (ret < 0) {
|
||||
@ -992,3 +1026,37 @@ int Xorriso_add_mips_boot_file(struct XorrisO *xorriso, char *path, int flag)
|
||||
}
|
||||
|
||||
|
||||
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[2] = {"MBR", "MIPS Big Endian Volume Header"};
|
||||
|
||||
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");
|
||||
if(old_type == 0 && old_options == 2)
|
||||
strcat(xorriso->info_text, " for ISOLINUX isohybrid");
|
||||
if(old_type == 0 && old_options == 1)
|
||||
strcat(xorriso->info_text, " for partition table");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
goto hint_revoke;
|
||||
}
|
||||
xorriso->system_area_options= ((sa_type << 2) & 0xfc) | (options & ~0xfc);
|
||||
if(sa_type == 0)
|
||||
xorriso->patch_system_area= xorriso->system_area_options;
|
||||
return(1);
|
||||
|
||||
hint_revoke:;
|
||||
if(old_type == 0)
|
||||
sprintf(xorriso->info_text, "Revokable by -boot_image any discard");
|
||||
else if(old_type == 1)
|
||||
sprintf(xorriso->info_text, "Revokable by -boot_image any mips_discard");
|
||||
if(old_type < 2)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user