Bug fix: -boot_image grub2_mbr= prevented -boot_image partition_table=on

This commit is contained in:
Thomas Schmitt 2014-04-04 15:35:34 +00:00
parent 8ff3ed7b6b
commit a06759135a
3 changed files with 30 additions and 13 deletions

View File

@ -1364,32 +1364,47 @@ int Xorriso_set_hppa_boot_parm(struct XorrisO *xorriso, char *text, char *what,
}
/* @param flag bit0= do not set xorriso->system_area_options, just check
bit1= only check for grub2_mbr <-> isolinux partition_table
*/
int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type,
int options, char *cmd, int flag)
{
int old_type, old_options, new_options;
static char *type_names[4] = {
static char *type_names[6] = {
"MBR", "MIPS Big Endian Volume Header", "MIPS Little Endian Boot Block",
"SUN Disk Label"};
"SUN Disk Label", "HP-PA PALO v4", "HP-PA PALO v5"};
old_type= (xorriso->system_area_options & 0xfc) >> 2;
old_options= xorriso->system_area_options & 0x7c03;
new_options= options & 0x7c03;
old_options= xorriso->system_area_options & 0x3c03;
new_options= options & 0x3c03;
if(((options & (1 << 14)) && (xorriso->system_area_options & 2)) ||
((options & 2) && (xorriso->system_area_options & (1 << 14))))
goto reject;
if(flag & 2)
return(1);
if((old_type != 0 || old_options != 0) &&
(old_type != sa_type || (old_options != 0 && old_options != new_options))){
reject:;
sprintf(xorriso->info_text, "%s : First sector already occupied by %s",
cmd, old_type < 4 ? type_names[old_type] : "other boot facility");
cmd, old_type < 6 ? 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))
else if (old_type == 0 && (xorriso->system_area_options & (1 << 14))) {
strcat(xorriso->info_text, " for GRUB2 patching");
if(old_type == 0 && (old_options & 1))
strcat(xorriso->info_text, " with partition table");
} else 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= (xorriso->system_area_options & ~0x7cff) |
((sa_type << 2) & 0xfc) | (options & 0x7c03);
if(sa_type == 0)
xorriso->patch_system_area= xorriso->system_area_options;
if(!(flag & 1)) {
xorriso->system_area_options= (xorriso->system_area_options & ~0x3cff) |
((sa_type << 2) & 0xfc) | (options & 0x3c03);
if(sa_type == 0)
xorriso->patch_system_area= xorriso->system_area_options;
}
return(1);
hint_revoke:;

View File

@ -1177,14 +1177,16 @@ treatment_patch:;
#endif /* ! Xorriso_with_isohybriD */
} else if(strncmp(treatpt, "grub2_mbr=", 10) == 0) {
ret= Xorriso_coordinate_system_area(xorriso, 0, (1 << 14), eff_path, 1 | 2);
if(ret <= 0)
goto ex;
ret= Xorriso_set_system_area_path(xorriso, treatpt + 10, 0);
if(ret <= 0)
goto ex;
if(treatpt [10] == 0)
xorriso->system_area_options&= ~0x4000;
else
xorriso->system_area_options=
(xorriso->system_area_options & ~2) | 0x4000;
xorriso->system_area_options|= 0x4000;
} else
was_ok= 0;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2014.04.04.142016"
#define Xorriso_timestamP "2014.04.04.153505"