1710d3
diff --git a/doc/icedax/tracknames.pl b/doc/icedax/tracknames.pl
1710d3
old mode 100755
1710d3
new mode 100644
1710d3
index 09f0fcf..801b89e
1710d3
--- a/doc/icedax/tracknames.pl
1710d3
+++ b/doc/icedax/tracknames.pl
1710d3
@@ -1,4 +1,4 @@
1710d3
-#!/usr/local/bin/perl 
1710d3
+#!/usr/bin/perl 
1710d3
 # A quick perl hack to get rename files pulled in with icedax.
1710d3
 # by billo@billo.com
1710d3
 #
1710d3
diff --git a/genisoimage/eltorito.c b/genisoimage/eltorito.c
1710d3
index b97bdf1..5d7c2d1 100644
1710d3
--- a/genisoimage/eltorito.c
1710d3
+++ b/genisoimage/eltorito.c
1710d3
@@ -59,7 +59,7 @@ static	void	get_torito_desc(struct eltorito_boot_descriptor *boot_desc);
1710d3
 static	void	fill_boot_desc(struct eltorito_defaultboot_entry *boot_desc_entry,
1710d3
 										struct eltorito_boot_entry_info *boot_entry);
1710d3
 void	get_boot_entry(void);
1710d3
-void	new_boot_entry(void);
1710d3
+void	new_boot_entry();
1710d3
 static	int	tvd_write(FILE *outfile);
1710d3
 
1710d3
 
1710d3
@@ -283,6 +283,7 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
1710d3
 	int			i;
1710d3
 	int			offset;
1710d3
 	struct eltorito_defaultboot_entry boot_desc_record;
1710d3
+	struct eltorito_sectionheader_entry section_header;
1710d3
 
1710d3
 	memset(boot_desc, 0, sizeof (*boot_desc));
1710d3
 	boot_desc->type[0] = 0;
1710d3
@@ -317,7 +318,7 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
1710d3
 	 */
1710d3
 	memset(&valid_desc, 0, sizeof (valid_desc));
1710d3
 	valid_desc.headerid[0] = 1;
1710d3
-	valid_desc.arch[0] = EL_TORITO_ARCH_x86;
1710d3
+	valid_desc.arch[0] = first_boot_entry->arch;
1710d3
 
1710d3
 	/*
1710d3
 	 * we'll shove start of publisher id into id field,
1710d3
@@ -347,10 +348,53 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
1710d3
 	/* now write it to the virtual boot catalog */
1710d3
 	memcpy(de2->table, &valid_desc, 32);
1710d3
 
1710d3
-	for (current_boot_entry = first_boot_entry, offset = sizeof (valid_desc);
1710d3
-		current_boot_entry != NULL;
1710d3
-		current_boot_entry = current_boot_entry->next,
1710d3
-		offset += sizeof (boot_desc_record)) {
1710d3
+	/* Fill the first entry, since it's special and already has the
1710d3
+	 * matching header via the validation header... */
1710d3
+	offset = sizeof (valid_desc);
1710d3
+	current_boot_entry = first_boot_entry;
1710d3
+
1710d3
+	if (offset >= SECTOR_SIZE) {
1710d3
+#ifdef	USE_LIBSCHILY
1710d3
+		comerrno(EX_BAD, "Too many El Torito boot entries\n");
1710d3
+#else
1710d3
+		fprintf(stderr,	"Too many El Torito boot entries\n");
1710d3
+		exit(1);
1710d3
+#endif
1710d3
+	}
1710d3
+	fill_boot_desc(&boot_desc_record, current_boot_entry);
1710d3
+	memcpy(de2->table + offset, &boot_desc_record,
1710d3
+				sizeof (boot_desc_record));
1710d3
+
1710d3
+	offset += sizeof(boot_desc_record);
1710d3
+
1710d3
+	for (current_boot_entry = current_boot_entry->next;
1710d3
+			current_boot_entry != NULL;
1710d3
+			current_boot_entry = current_boot_entry->next) {
1710d3
+		struct eltorito_sectionheader_entry section_header;
1710d3
+
1710d3
+		if (offset >= SECTOR_SIZE) {
1710d3
+#ifdef	USE_LIBSCHILY
1710d3
+			comerrno(EX_BAD,
1710d3
+			"Too many El Torito boot entries\n");
1710d3
+#else
1710d3
+			fprintf(stderr,
1710d3
+			"Too many El Torito boot entries\n");
1710d3
+			exit(1);
1710d3
+#endif
1710d3
+		}
1710d3
+
1710d3
+		memset(&section_header, '\0', sizeof(section_header));
1710d3
+		if (current_boot_entry->next)
1710d3
+			section_header.headerid[0] = EL_TORITO_SECTION_HEADER;
1710d3
+		else
1710d3
+			section_header.headerid[0] = EL_TORITO_LAST_SECTION_HEADER;
1710d3
+
1710d3
+		section_header.arch[0] = current_boot_entry->arch;
1710d3
+		set_721(section_header.num_entries, 1);
1710d3
+
1710d3
+		memcpy(de2->table + offset, &section_header,
1710d3
+					sizeof(section_header));
1710d3
+		offset += sizeof(section_header);
1710d3
 
1710d3
 		if (offset >= SECTOR_SIZE) {
1710d3
 #ifdef	USE_LIBSCHILY
1710d3
@@ -365,6 +409,8 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
1710d3
 		fill_boot_desc(&boot_desc_record, current_boot_entry);
1710d3
 		memcpy(de2->table + offset, &boot_desc_record,
1710d3
 					sizeof (boot_desc_record));
1710d3
+		offset += sizeof (boot_desc_record);
1710d3
+
1710d3
 	}
1710d3
 }/* get_torito_desc(... */
1710d3
 
1710d3
diff --git a/genisoimage/genisoimage.c b/genisoimage/genisoimage.c
1710d3
index a5b0b46..8add1ac 100644
1710d3
--- a/genisoimage/genisoimage.c
1710d3
+++ b/genisoimage/genisoimage.c
1710d3
@@ -47,6 +47,7 @@
1710d3
 
1710d3
 #include <mconfig.h>
1710d3
 #include "genisoimage.h"
1710d3
+#include "iso9660.h"
1710d3
 #include <errno.h>
1710d3
 #include <timedefs.h>
1710d3
 #include <fctldefs.h>
1710d3
@@ -523,6 +524,8 @@ static const struct ld_option ld_options[] =
1710d3
 	'\0', NULL, "Set debug flag", ONE_DASH},
1710d3
 	{{"eltorito-boot", required_argument, NULL, 'b'},
1710d3
 	'b', "FILE", "Set El Torito boot image name", ONE_DASH},
1710d3
+	{{"efi-boot", required_argument, NULL, 'e'},
1710d3
+	'e', "FILE", "Set EFI boot image name", ONE_DASH},
1710d3
 	{{"eltorito-alt-boot", no_argument, NULL, OPTION_ALT_BOOT},
1710d3
 	'\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH},
1710d3
 	{{"sparc-boot", required_argument, NULL, 'B'},
1710d3
@@ -1502,6 +1505,7 @@ int main(int argc, char *argv[])
1710d3
 			all_files = 0;
1710d3
 			break;
1710d3
 		case 'b':
1710d3
+		case 'e':
1710d3
 			do_sort++;		/* We sort bootcat/botimage */
1710d3
 			use_eltorito++;
1710d3
 			boot_image = optarg;	/* pathname of the boot image */
1710d3
@@ -1517,6 +1521,10 @@ int main(int argc, char *argv[])
1710d3
 #endif
1710d3
 			}
1710d3
 			get_boot_entry();
1710d3
+			if (c == 'e')
1710d3
+				current_boot_entry->arch = EL_TORITO_ARCH_EFI;
1710d3
+			else
1710d3
+				current_boot_entry->arch = EL_TORITO_ARCH_x86;
1710d3
 			current_boot_entry->boot_image = boot_image;
1710d3
 			break;
1710d3
 		case OPTION_ALT_BOOT:
1710d3
diff --git a/genisoimage/genisoimage.h b/genisoimage/genisoimage.h
1710d3
index bbedfb0..76e5e21 100644
1710d3
--- a/genisoimage/genisoimage.h
1710d3
+++ b/genisoimage/genisoimage.h
1710d3
@@ -293,6 +293,7 @@ struct deferred_write {
1710d3
 struct eltorito_boot_entry_info {
1710d3
 	struct eltorito_boot_entry_info *next;
1710d3
 	char		*boot_image;
1710d3
+	char		arch;
1710d3
 	int		not_bootable;
1710d3
 	int		no_emul_boot;
1710d3
 	int		hard_disk_boot;
1710d3
diff --git a/genisoimage/iso9660.h b/genisoimage/iso9660.h
1710d3
index c74c2a9..c8b7a05 100644
1710d3
--- a/genisoimage/iso9660.h
1710d3
+++ b/genisoimage/iso9660.h
1710d3
@@ -62,10 +62,14 @@ struct iso_volume_descriptor {
1710d3
 #define	EL_TORITO_ARCH_x86	0
1710d3
 #define	EL_TORITO_ARCH_PPC	1
1710d3
 #define	EL_TORITO_ARCH_MAC	2
1710d3
+#define	EL_TORITO_ARCH_EFI	0xef
1710d3
 
1710d3
 #define	EL_TORITO_BOOTABLE	0x88
1710d3
 #define	EL_TORITO_NOT_BOOTABLE	0
1710d3
 
1710d3
+#define	EL_TORITO_SECTION_HEADER	0x90
1710d3
+#define	EL_TORITO_LAST_SECTION_HEADER	0x91
1710d3
+
1710d3
 #define	EL_TORITO_MEDIA_NOEMUL	0
1710d3
 #define	EL_TORITO_MEDIA_12FLOP	1
1710d3
 #define	EL_TORITO_MEDIA_144FLOP	2
1710d3
@@ -173,7 +177,7 @@ struct eltorito_validation_entry {
1710d3
 struct eltorito_defaultboot_entry {
1710d3
 	char boot_id			[ISODCL(1,    1)]; /* 711 */
1710d3
 	char boot_media			[ISODCL(2,    2)];
1710d3
-	char loadseg			[ISODCL(3,    4)]; /* 711 */
1710d3
+	char loadseg			[ISODCL(3,    4)]; /* 712 */
1710d3
 	char sys_type			[ISODCL(5,    5)];
1710d3
 	char pad1			[ISODCL(6,    6)];
1710d3
 	char nsect			[ISODCL(7,    8)];
1710d3
@@ -181,6 +185,14 @@ struct eltorito_defaultboot_entry {
1710d3
 	char pad2			[ISODCL(13,  32)];
1710d3
 };
1710d3
 
1710d3
+/* El Torito Section Header Entry in boot catalog */
1710d3
+struct eltorito_sectionheader_entry {
1710d3
+	char headerid			[ISODCL(1,    1)]; /* 711 */
1710d3
+	char arch			[ISODCL(2,    2)];
1710d3
+	char num_entries		[ISODCL(3,    4)]; /* 711 */
1710d3
+	char id				[ISODCL(5,   32)];
1710d3
+};
1710d3
+
1710d3
 /*
1710d3
  * XXX JS: The next two structures have odd lengths!
1710d3
  * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length.