Reporting grub2_mbr= with -status -boot_image

This commit is contained in:
Thomas Schmitt 2013-04-14 17:46:29 +00:00
parent a2afe4092b
commit a5bc372c6e
3 changed files with 38 additions and 14 deletions

View File

@ -581,8 +581,6 @@ int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp,
if(ret < 0) /* == 0 is normal */
{ret= 0; goto ex;}
/* >>> GRUB2 et.al. : report about system_area_disk_path */
if(xorriso->boot_count == 0 && xorriso->boot_image_bin_path[0] == 0) {
no_image:;
if(xorriso->patch_isolinux_image & 1) {
@ -1177,10 +1175,8 @@ int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type,
"MBR", "MIPS Big Endian Volume Header", "MIPS Little Endian Boot Block",
"SUN Disk Label"};
/* >>> GRUB2: Take into respect GRUB2 patched MBR */;
old_type= (xorriso->system_area_options & 0xfc) >> 2;
old_options= xorriso->system_area_options & ~0xfc;
old_options= xorriso->system_area_options & ~0x40fc;
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",
@ -1192,7 +1188,8 @@ int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
goto hint_revoke;
}
xorriso->system_area_options= ((sa_type << 2) & 0xfc) | (options & ~0xfc);
xorriso->system_area_options= (xorriso->system_area_options & 0x4000) |
((sa_type << 2) & 0xfc) | (options & ~0x40fc);
if(sa_type == 0)
xorriso->patch_system_area= xorriso->system_area_options;
return(1);

View File

@ -2380,6 +2380,39 @@ bit1= do only report to fp
}
/*
bit0= do only report non-default settings
bit1= do only report to fp
*/
int Xorriso_boot_status_sysarea(struct XorrisO *xorriso, char *filter,
FILE *fp, int flag)
{
char *line, *form= "any", *spec= "system_area=";
int sa_type;
line= xorriso->result_line;
sa_type= (xorriso->system_area_options & 0xfc) >> 2;
if(sa_type != 0)
return(2);
if (xorriso->system_area_disk_path[0] == 0 && (flag & 1))
return(2);
if(xorriso->system_area_options & 1) {
form= "grub";
if(xorriso->system_area_options & (1 << 14))
spec= "grub2_mbr=";
} else if(xorriso->system_area_options & 2) {
form= "isolinux";
}
sprintf(line, "-boot_image %s %s", form, spec);
Text_shellsafe(xorriso->system_area_disk_path, line, 1);
strcat(line, "\n");
Xorriso_status_result(xorriso, filter, fp, flag & 2);
return(1);
}
int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
/*
bit0= do only report non-default settings
@ -2618,13 +2651,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_boot_image_status(xorriso, filter, fp, flag & 3);
is_default= (xorriso->system_area_disk_path[0] == 0);
sprintf(line,"-boot_image %s system_area=%s\n",
xorriso->system_area_disk_path[0] && (xorriso->system_area_options & 2)
? "isolinux" : "any",
Text_shellsafe(xorriso->system_area_disk_path, sfe, 0));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
Xorriso_boot_status_sysarea(xorriso, filter, fp, flag & 3);
is_default= (xorriso->partition_offset == 0);
sprintf(line,"-boot_image any partition_offset=%lu\n",

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.04.13.205450"
#define Xorriso_timestamP "2013.04.14.174539"