Browse Source

Warning if EFI boot equipment is present but no /EFI/BOOT directory is in ISO

master
Thomas Schmitt 2 weeks ago
parent
commit
3eef0411d5
  1. 74
      xorriso/write_run.c
  2. 2
      xorriso/xorriso_timestamp.h

74
xorriso/write_run.c

@ -1084,6 +1084,78 @@ int Xorriso_set_all_file_dates(struct XorrisO *xorriso, int flag)
}
/* @return 0= no EFI , 1= EFI but no warning needed , 2= warning was issued
*/
int Xorriso_warn_efi_boot_dir(struct XorrisO *xorriso, IsoImage *image,
int flag)
{
int ret, num_boots, i, filec;
off_t mem= 0;
char *patterns[1], **filev= NULL;
ElToritoBootImage **boots = NULL;
IsoFile **bootnodes = NULL;
IsoNode *node;
/* Check El Torito images for EFI */
ret= iso_image_get_all_boot_imgs(image, &num_boots, &boots, &bootnodes, 0);
Xorriso_process_msg_queues(xorriso,0);
if(ret == 1) {
for(i= 0; i <num_boots; i++) {
if(el_torito_get_boot_platform_id(boots[i]) == 0xef)
goto has_efi;
}
}
/* Check appended partitions for EFI */
for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
if(xorriso->appended_partitions[i] == NULL)
continue;
if(xorriso->appended_partitions[i][0] == 0)
continue;
if(xorriso->appended_part_types[i] == 0xef)
goto has_efi;
}
/* No EFI found */
ret= 0; goto ex;
has_efi:;
/* Check for /[Ee][Ff][Ii]/[Bb][Oo][Oo][Tt]/ in ISO tree */
patterns[0]= "/[Ee][Ff][Ii]/[Bb][Oo][Oo][Tt]";
ret= Xorriso_expand_pattern(xorriso, 1, patterns, 0, &filec, &filev, &mem, 0);
if(ret > 0 && filec > 0) {
ret= Xorriso_node_from_path(xorriso, image, filev[0], &node, 1);
if(ret > 0) {
if(LIBISO_ISDIR(node)) {
ret= 1; goto ex;
}
}
}
Xorriso_msgs_submit(xorriso, 0,
"EFI boot equipment is provided but no directory /EFI/BOOT",
0, "WARNING", 0);
Xorriso_msgs_submit(xorriso, 0,
"will emerge in the ISO filesystem. A popular method to",
0, "WARNING", 0);
Xorriso_msgs_submit(xorriso, 0,
"prepare a USB stick on MS-Windows relies on having in the",
0, "WARNING", 0);
Xorriso_msgs_submit(xorriso, 0,
"ISO filesystem a copy of the EFI System Partition tree.",
0, "WARNING", 0);
ret= 2;
ex:;
Sfile_destroy_argv(&filec, &filev, 0);
if(boots != NULL)
free(boots);
if(bootnodes != NULL)
free(bootnodes);
return(ret);
}
/* @param flag bit0= do not write but only prepare and return size in sectors
@return <=0 error , 1= success
2= failure with DVD-RW, please call Xorriso_retry_write_session()
@ -1335,6 +1407,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
&value_length, &value, 2 | 8);
}
Xorriso_warn_efi_boot_dir(xorriso, image, 0);
ret= Xorriso_make_iso_write_opts(xorriso, image, sopts, flag & 1);
if(ret <= 0)
goto ex;

2
xorriso/xorriso_timestamp.h

@ -1 +1 @@
#define Xorriso_timestamP "2022.06.02.140943"
#define Xorriso_timestamP "2022.06.13.205546"

Loading…
Cancel
Save