Bug fix: -as mkisofs -no-emul-boot without -boot-load-size defaulted to size 4

This commit is contained in:
2016-11-13 11:13:33 +01:00
parent 76ac0d87a8
commit 8adbb1de7e
13 changed files with 194 additions and 129 deletions

View File

@ -372,6 +372,7 @@ int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag)
bit2= is_default
bit3= append -boot_image any next
bit4= concentrate boot options
bit5= override load_size by "full"
*/
int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path,
char *bin_path, int platform_id,
@ -389,6 +390,8 @@ int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path,
no_defaults= flag & 1;
line= xorriso->result_line;
if(flag & 32)
load_size= -1;
if((flag & 16) && bin_path[0] != 0) {
/* Concentrate boot options. */
@ -422,11 +425,14 @@ int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path,
file_size= 0;
ret= Xorriso_iso_lstat(xorriso, bin_path, &stbuf, 2 | 4);
if(ret == 0)
if(ret == 0) {
file_size= ((stbuf.st_size / (off_t) 512) +
!!(stbuf.st_size % (off_t) 512)) * 512;
if(flag & 32)
load_size= file_size * 512;
}
if(platform_id == 0xef && (patch_isolinux & 0x3ff) == 0 &&
load_size == file_size && is_default_id && emul == 0) {
load_size / 512 == file_size && is_default_id && emul == 0) {
sprintf(line, "-boot_image any efi_path=");
Text_shellsafe(bin_path, line, 1);
strcat(line, "\n");
@ -466,9 +472,14 @@ int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path,
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (load_size == 2048 || (flag & 4));
sprintf(line, "-boot_image %s load_size=%lu\n",
form, (unsigned long) load_size);
if(flag & 32) {
is_default= 0;
sprintf(line, "-boot_image %s load_size=full", form);
} else {
is_default= (load_size == 2048 || (flag & 4));
sprintf(line, "-boot_image %s load_size=%lu\n",
form, (unsigned long) load_size);
}
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);