diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index 05fb4213..c54124d9 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -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:; diff --git a/xorriso/opts_a_c.c b/xorriso/opts_a_c.c index 2b23f1ad..bf0e923d 100644 --- a/xorriso/opts_a_c.c +++ b/xorriso/opts_a_c.c @@ -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; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index e4cb3fd2..0948e0cc 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2014.04.04.142016" +#define Xorriso_timestamP "2014.04.04.153505"