From fe245e7131b639ef5b17221cf5394d050db5451a Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 13 Apr 2013 07:42:18 +0000 Subject: [PATCH] New -boot_image bootspecs grub2_mbr= and grub2_boot_info= --- libisoburn/trunk/xorriso/iso_img.c | 17 ++++++++++-- libisoburn/trunk/xorriso/opts_a_c.c | 27 ++++++++++++++++++++ libisoburn/trunk/xorriso/write_run.c | 4 +-- libisoburn/trunk/xorriso/xorriso_private.h | 9 +++++++ libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/libisoburn/trunk/xorriso/iso_img.c b/libisoburn/trunk/xorriso/iso_img.c index df6abe0e..207ca272 100644 --- a/libisoburn/trunk/xorriso/iso_img.c +++ b/libisoburn/trunk/xorriso/iso_img.c @@ -433,7 +433,14 @@ int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path, is_default= ((patch_isolinux & 1) == 0 || bin_path[0] == 0 || (flag & 4)); sprintf(line, "-boot_image %s boot_info_table=%s\n", - (patch_isolinux & 2) ? "grub" : form, patch_isolinux ? "on" : "off"); + (patch_isolinux & 2) ? "grub" : form, + (patch_isolinux & 1) ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + is_default= ((patch_isolinux & 512) == 0 || bin_path[0] == 0 || (flag & 4)); + sprintf(line, "-boot_image grub grub2_boot_info=%s\n", + (patch_isolinux & 512) ? "on" : "off"); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); @@ -570,6 +577,8 @@ 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) { @@ -633,7 +642,7 @@ no_image:; else media_type= 0; ret= Xorriso_boot_item_status(xorriso, xorriso->boot_image_cat_path, - path, platform_id, patch & 1, media_type, + path, platform_id, patch, media_type, load_size, id_string, sel_crit, "any", filter, fp, 16 | (flag & 3)); if(ret <= 0) @@ -707,6 +716,8 @@ int Xorriso__append_boot_params(char *line, ElToritoBootImage *bootimg, " , platform_id=0x%-2.2X ", (unsigned int) platform_id); if(el_torito_seems_boot_info_table(bootimg, 0)) sprintf(line + strlen(line), " , boot_info_table=on"); + if(el_torito_seems_boot_info_table(bootimg, 1)) + sprintf(line + strlen(line), " , grub2_boot_info=on"); return(1); } @@ -1162,6 +1173,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; if((old_type != 0 || old_options != 0) && diff --git a/libisoburn/trunk/xorriso/opts_a_c.c b/libisoburn/trunk/xorriso/opts_a_c.c index 5ae4b6ae..64375778 100644 --- a/libisoburn/trunk/xorriso/opts_a_c.c +++ b/libisoburn/trunk/xorriso/opts_a_c.c @@ -869,6 +869,14 @@ treatment_patch:; else was_ok= 0; + } else if(strncmp(treatpt, "grub2_boot_info=", 16)==0) { + if(strcmp(treatpt + 16, "off") == 0) + xorriso->patch_isolinux_image= xorriso->patch_isolinux_image & ~512; + else if(strcmp(treatpt + 16, "on") == 0) + xorriso->patch_isolinux_image= xorriso->patch_isolinux_image | 512; + else + was_ok= 0; + } else if(strncmp(treatpt, "load_size=", 10) == 0) { num= Scanf_io_size(treatpt + 10, 0); if(num < 512 && isolinux_grub) { @@ -1118,6 +1126,25 @@ treatment_patch:; #endif /* ! Xorriso_with_isohybriD */ + } else if(strncmp(treatpt, "grub2_mbr=", 9) == 0 && + strcmp(formpt, "grub")==0) { + + if(strcmp(treatpt + 9, "off") == 0) + xorriso->system_area_options&= ~0x4000; + else if(strcmp(treatpt + 9, "on") == 0) + xorriso->system_area_options= + (xorriso->system_area_options & ~2) | 0x4000; + else { + sprintf(xorriso->info_text, + "Unrecognized keyword with -boot_image %s %s", + form, treatment); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + sprintf(xorriso->info_text, + "Allowed with grub2_mbr= are: off , on"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); + {ret= 0; goto ex;} + } + } else was_ok= 0; diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index 1f50a198..0830aaa8 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -2365,7 +2365,7 @@ int Xorriso_set_isolinux_options(struct XorrisO *xorriso, } /* bit0 : 1=boot-info-table , bit2-7 : 1=EFI , 2=HFS+ , bit8 : 1=APM */ - patch_table = xorriso->patch_isolinux_image & 0x1fd; + patch_table = xorriso->patch_isolinux_image & 0x3fd; if((flag & 1) && num_boots > 1) { ret= el_torito_set_isolinux_options(boots[num_boots - 1], patch_table, 0); ret= (ret == 1); goto ex; @@ -2374,7 +2374,7 @@ int Xorriso_set_isolinux_options(struct XorrisO *xorriso, /* Handle patching of first attached boot image or of imported boot images */ for(i= 0; i < num_boots; i++) { - patch_table = xorriso->patch_isolinux_image & 0x1fd; + patch_table = xorriso->patch_isolinux_image & 0x3fd; if(patch_table && !(flag & 1)) { if(!el_torito_seems_boot_info_table(boots[i], 0)) patch_table&= ~1; diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index 6dde27c9..ddda11bb 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -364,6 +364,7 @@ struct XorrisO { /* the global context of xorriso */ bit2-7= Mentioning in isohybrid GPT 1=EFI, 2=HFS+ bit8= Mention in isohybrid Apple Partition Map + bit9= GRUB2 boot provisions (patch at byte 1012) */ int boot_image_emul; /* 0=no emulation 1=emulation as hard disk @@ -405,6 +406,14 @@ struct XorrisO { /* the global context of xorriso */ any other feature which needs to have own MBR partition entries. + bit14= Only with System area type 0 + GRUB2 boot provisions: + Patch system area at byte 92 to + 99 with 512-block address + 1 + of the first boot image file. + Little-endian 8-byte. + Should be combined with + options bit0. */ int patch_system_area; /* Bits as of system_area_options. to be applied to the loaded system diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index ac466c0f..3f25c37b 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2013.04.13.064738" +#define Xorriso_timestamP "2013.04.13.074117"