New -boot_image bootspecs grub2_mbr= and grub2_boot_info=

This commit is contained in:
Thomas Schmitt 2013-04-13 07:42:18 +00:00
parent 92ec54105f
commit fe245e7131
5 changed files with 54 additions and 5 deletions

View File

@ -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)); is_default= ((patch_isolinux & 1) == 0 || bin_path[0] == 0 || (flag & 4));
sprintf(line, "-boot_image %s boot_info_table=%s\n", 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)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); 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 */ if(ret < 0) /* == 0 is normal */
{ret= 0; goto ex;} {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) { if(xorriso->boot_count == 0 && xorriso->boot_image_bin_path[0] == 0) {
no_image:; no_image:;
if(xorriso->patch_isolinux_image & 1) { if(xorriso->patch_isolinux_image & 1) {
@ -633,7 +642,7 @@ no_image:;
else else
media_type= 0; media_type= 0;
ret= Xorriso_boot_item_status(xorriso, xorriso->boot_image_cat_path, 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", load_size, id_string, sel_crit, "any",
filter, fp, 16 | (flag & 3)); filter, fp, 16 | (flag & 3));
if(ret <= 0) 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); " , platform_id=0x%-2.2X ", (unsigned int) platform_id);
if(el_torito_seems_boot_info_table(bootimg, 0)) if(el_torito_seems_boot_info_table(bootimg, 0))
sprintf(line + strlen(line), " , boot_info_table=on"); 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); 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", "MBR", "MIPS Big Endian Volume Header", "MIPS Little Endian Boot Block",
"SUN Disk Label"}; "SUN Disk Label"};
/* >>> GRUB2: Take into respect GRUB2 patched MBR */;
old_type= (xorriso->system_area_options & 0xfc) >> 2; old_type= (xorriso->system_area_options & 0xfc) >> 2;
old_options= xorriso->system_area_options & ~0xfc; old_options= xorriso->system_area_options & ~0xfc;
if((old_type != 0 || old_options != 0) && if((old_type != 0 || old_options != 0) &&

View File

@ -869,6 +869,14 @@ treatment_patch:;
else else
was_ok= 0; 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) { } else if(strncmp(treatpt, "load_size=", 10) == 0) {
num= Scanf_io_size(treatpt + 10, 0); num= Scanf_io_size(treatpt + 10, 0);
if(num < 512 && isolinux_grub) { if(num < 512 && isolinux_grub) {
@ -1118,6 +1126,25 @@ treatment_patch:;
#endif /* ! Xorriso_with_isohybriD */ #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 } else
was_ok= 0; was_ok= 0;

View File

@ -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 */ /* 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) { if((flag & 1) && num_boots > 1) {
ret= el_torito_set_isolinux_options(boots[num_boots - 1], patch_table, 0); ret= el_torito_set_isolinux_options(boots[num_boots - 1], patch_table, 0);
ret= (ret == 1); goto ex; 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 /* Handle patching of first attached boot image or of imported boot images
*/ */
for(i= 0; i < num_boots; i++) { 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(patch_table && !(flag & 1)) {
if(!el_torito_seems_boot_info_table(boots[i], 0)) if(!el_torito_seems_boot_info_table(boots[i], 0))
patch_table&= ~1; patch_table&= ~1;

View File

@ -364,6 +364,7 @@ struct XorrisO { /* the global context of xorriso */
bit2-7= Mentioning in isohybrid GPT bit2-7= Mentioning in isohybrid GPT
1=EFI, 2=HFS+ 1=EFI, 2=HFS+
bit8= Mention in isohybrid Apple Partition Map bit8= Mention in isohybrid Apple Partition Map
bit9= GRUB2 boot provisions (patch at byte 1012)
*/ */
int boot_image_emul; /* 0=no emulation int boot_image_emul; /* 0=no emulation
1=emulation as hard disk 1=emulation as hard disk
@ -405,6 +406,14 @@ struct XorrisO { /* the global context of xorriso */
any other feature which any other feature which
needs to have own MBR needs to have own MBR
partition entries. 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. int patch_system_area; /* Bits as of system_area_options.
to be applied to the loaded system to be applied to the loaded system

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.04.13.064738" #define Xorriso_timestamP "2013.04.13.074117"