From a5bc372c6edcb8628cf46616119f9d659f0fa5f9 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 14 Apr 2013 17:46:29 +0000 Subject: [PATCH] Reporting grub2_mbr= with -status -boot_image --- xorriso/iso_img.c | 9 +++----- xorriso/text_io.c | 41 ++++++++++++++++++++++++++++++------- xorriso/xorriso_timestamp.h | 2 +- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index b7169ce5..23f510cf 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -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); diff --git a/xorriso/text_io.c b/xorriso/text_io.c index 4f25d412..3e72df2b 100644 --- a/xorriso/text_io.c +++ b/xorriso/text_io.c @@ -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", diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 93678829..d934aa31 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2013.04.13.205450" +#define Xorriso_timestamP "2013.04.14.174539"