crux-musl

Unnamed repository; edit this file 'description' to name the repository.
git clone https://codeberg.org/emmett1/crux-musl
Log | Files | Refs | README | LICENSE

cdrkit-1.1.9-efi-boot.patch (6776B)


      1 diff --git a/doc/icedax/tracknames.pl b/doc/icedax/tracknames.pl
      2 old mode 100755
      3 new mode 100644
      4 index 09f0fcf..801b89e
      5 --- a/doc/icedax/tracknames.pl
      6 +++ b/doc/icedax/tracknames.pl
      7 @@ -1,4 +1,4 @@
      8 -#!/usr/local/bin/perl 
      9 +#!/usr/bin/perl 
     10  # A quick perl hack to get rename files pulled in with icedax.
     11  # by billo@billo.com
     12  #
     13 diff --git a/genisoimage/eltorito.c b/genisoimage/eltorito.c
     14 index b97bdf1..5d7c2d1 100644
     15 --- a/genisoimage/eltorito.c
     16 +++ b/genisoimage/eltorito.c
     17 @@ -59,7 +59,7 @@ static	void	get_torito_desc(struct eltorito_boot_descriptor *boot_desc);
     18  static	void	fill_boot_desc(struct eltorito_defaultboot_entry *boot_desc_entry,
     19  										struct eltorito_boot_entry_info *boot_entry);
     20  void	get_boot_entry(void);
     21 -void	new_boot_entry(void);
     22 +void	new_boot_entry();
     23  static	int	tvd_write(FILE *outfile);
     24  
     25  
     26 @@ -283,6 +283,7 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
     27  	int			i;
     28  	int			offset;
     29  	struct eltorito_defaultboot_entry boot_desc_record;
     30 +	struct eltorito_sectionheader_entry section_header;
     31  
     32  	memset(boot_desc, 0, sizeof (*boot_desc));
     33  	boot_desc->type[0] = 0;
     34 @@ -317,7 +318,7 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
     35  	 */
     36  	memset(&valid_desc, 0, sizeof (valid_desc));
     37  	valid_desc.headerid[0] = 1;
     38 -	valid_desc.arch[0] = EL_TORITO_ARCH_x86;
     39 +	valid_desc.arch[0] = first_boot_entry->arch;
     40  
     41  	/*
     42  	 * we'll shove start of publisher id into id field,
     43 @@ -347,10 +348,53 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
     44  	/* now write it to the virtual boot catalog */
     45  	memcpy(de2->table, &valid_desc, 32);
     46  
     47 -	for (current_boot_entry = first_boot_entry, offset = sizeof (valid_desc);
     48 -		current_boot_entry != NULL;
     49 -		current_boot_entry = current_boot_entry->next,
     50 -		offset += sizeof (boot_desc_record)) {
     51 +	/* Fill the first entry, since it's special and already has the
     52 +	 * matching header via the validation header... */
     53 +	offset = sizeof (valid_desc);
     54 +	current_boot_entry = first_boot_entry;
     55 +
     56 +	if (offset >= SECTOR_SIZE) {
     57 +#ifdef	USE_LIBSCHILY
     58 +		comerrno(EX_BAD, "Too many El Torito boot entries\n");
     59 +#else
     60 +		fprintf(stderr,	"Too many El Torito boot entries\n");
     61 +		exit(1);
     62 +#endif
     63 +	}
     64 +	fill_boot_desc(&boot_desc_record, current_boot_entry);
     65 +	memcpy(de2->table + offset, &boot_desc_record,
     66 +				sizeof (boot_desc_record));
     67 +
     68 +	offset += sizeof(boot_desc_record);
     69 +
     70 +	for (current_boot_entry = current_boot_entry->next;
     71 +			current_boot_entry != NULL;
     72 +			current_boot_entry = current_boot_entry->next) {
     73 +		struct eltorito_sectionheader_entry section_header;
     74 +
     75 +		if (offset >= SECTOR_SIZE) {
     76 +#ifdef	USE_LIBSCHILY
     77 +			comerrno(EX_BAD,
     78 +			"Too many El Torito boot entries\n");
     79 +#else
     80 +			fprintf(stderr,
     81 +			"Too many El Torito boot entries\n");
     82 +			exit(1);
     83 +#endif
     84 +		}
     85 +
     86 +		memset(&section_header, '\0', sizeof(section_header));
     87 +		if (current_boot_entry->next)
     88 +			section_header.headerid[0] = EL_TORITO_SECTION_HEADER;
     89 +		else
     90 +			section_header.headerid[0] = EL_TORITO_LAST_SECTION_HEADER;
     91 +
     92 +		section_header.arch[0] = current_boot_entry->arch;
     93 +		set_721(section_header.num_entries, 1);
     94 +
     95 +		memcpy(de2->table + offset, &section_header,
     96 +					sizeof(section_header));
     97 +		offset += sizeof(section_header);
     98  
     99  		if (offset >= SECTOR_SIZE) {
    100  #ifdef	USE_LIBSCHILY
    101 @@ -365,6 +409,8 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
    102  		fill_boot_desc(&boot_desc_record, current_boot_entry);
    103  		memcpy(de2->table + offset, &boot_desc_record,
    104  					sizeof (boot_desc_record));
    105 +		offset += sizeof (boot_desc_record);
    106 +
    107  	}
    108  }/* get_torito_desc(... */
    109  
    110 diff --git a/genisoimage/genisoimage.c b/genisoimage/genisoimage.c
    111 index a5b0b46..8add1ac 100644
    112 --- a/genisoimage/genisoimage.c
    113 +++ b/genisoimage/genisoimage.c
    114 @@ -47,6 +47,7 @@
    115  
    116  #include <mconfig.h>
    117  #include "genisoimage.h"
    118 +#include "iso9660.h"
    119  #include <errno.h>
    120  #include <timedefs.h>
    121  #include <fctldefs.h>
    122 @@ -523,6 +524,8 @@ static const struct ld_option ld_options[] =
    123  	'\0', NULL, "Set debug flag", ONE_DASH},
    124  	{{"eltorito-boot", required_argument, NULL, 'b'},
    125  	'b', "FILE", "Set El Torito boot image name", ONE_DASH},
    126 +	{{"efi-boot", required_argument, NULL, 'e'},
    127 +	'e', "FILE", "Set EFI boot image name", ONE_DASH},
    128  	{{"eltorito-alt-boot", no_argument, NULL, OPTION_ALT_BOOT},
    129  	'\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH},
    130  	{{"sparc-boot", required_argument, NULL, 'B'},
    131 @@ -1502,6 +1505,7 @@ int main(int argc, char *argv[])
    132  			all_files = 0;
    133  			break;
    134  		case 'b':
    135 +		case 'e':
    136  			do_sort++;		/* We sort bootcat/botimage */
    137  			use_eltorito++;
    138  			boot_image = optarg;	/* pathname of the boot image */
    139 @@ -1517,6 +1521,10 @@ int main(int argc, char *argv[])
    140  #endif
    141  			}
    142  			get_boot_entry();
    143 +			if (c == 'e')
    144 +				current_boot_entry->arch = EL_TORITO_ARCH_EFI;
    145 +			else
    146 +				current_boot_entry->arch = EL_TORITO_ARCH_x86;
    147  			current_boot_entry->boot_image = boot_image;
    148  			break;
    149  		case OPTION_ALT_BOOT:
    150 diff --git a/genisoimage/genisoimage.h b/genisoimage/genisoimage.h
    151 index bbedfb0..76e5e21 100644
    152 --- a/genisoimage/genisoimage.h
    153 +++ b/genisoimage/genisoimage.h
    154 @@ -293,6 +293,7 @@ struct deferred_write {
    155  struct eltorito_boot_entry_info {
    156  	struct eltorito_boot_entry_info *next;
    157  	char		*boot_image;
    158 +	char		arch;
    159  	int		not_bootable;
    160  	int		no_emul_boot;
    161  	int		hard_disk_boot;
    162 diff --git a/genisoimage/iso9660.h b/genisoimage/iso9660.h
    163 index c74c2a9..c8b7a05 100644
    164 --- a/genisoimage/iso9660.h
    165 +++ b/genisoimage/iso9660.h
    166 @@ -62,10 +62,14 @@ struct iso_volume_descriptor {
    167  #define	EL_TORITO_ARCH_x86	0
    168  #define	EL_TORITO_ARCH_PPC	1
    169  #define	EL_TORITO_ARCH_MAC	2
    170 +#define	EL_TORITO_ARCH_EFI	0xef
    171  
    172  #define	EL_TORITO_BOOTABLE	0x88
    173  #define	EL_TORITO_NOT_BOOTABLE	0
    174  
    175 +#define	EL_TORITO_SECTION_HEADER	0x90
    176 +#define	EL_TORITO_LAST_SECTION_HEADER	0x91
    177 +
    178  #define	EL_TORITO_MEDIA_NOEMUL	0
    179  #define	EL_TORITO_MEDIA_12FLOP	1
    180  #define	EL_TORITO_MEDIA_144FLOP	2
    181 @@ -173,7 +177,7 @@ struct eltorito_validation_entry {
    182  struct eltorito_defaultboot_entry {
    183  	char boot_id			[ISODCL(1,    1)]; /* 711 */
    184  	char boot_media			[ISODCL(2,    2)];
    185 -	char loadseg			[ISODCL(3,    4)]; /* 711 */
    186 +	char loadseg			[ISODCL(3,    4)]; /* 712 */
    187  	char sys_type			[ISODCL(5,    5)];
    188  	char pad1			[ISODCL(6,    6)];
    189  	char nsect			[ISODCL(7,    8)];
    190 @@ -181,6 +185,14 @@ struct eltorito_defaultboot_entry {
    191  	char pad2			[ISODCL(13,  32)];
    192  };
    193  
    194 +/* El Torito Section Header Entry in boot catalog */
    195 +struct eltorito_sectionheader_entry {
    196 +	char headerid			[ISODCL(1,    1)]; /* 711 */
    197 +	char arch			[ISODCL(2,    2)];
    198 +	char num_entries		[ISODCL(3,    4)]; /* 711 */
    199 +	char id				[ISODCL(5,   32)];
    200 +};
    201 +
    202  /*
    203   * XXX JS: The next two structures have odd lengths!
    204   * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length.