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