Module Name:    src
Committed By:   jmcneill
Date:           Sun Nov 15 00:18:48 UTC 2020

Modified Files:
        src/usr.sbin/makefs: makefs.8
        src/usr.sbin/makefs/cd9660: cd9660_eltorito.c

Log Message:
Add "efi" as a supported boot image type and derive the platform ID for
the validation entry from the default boot image instead of hard-coding
X86.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.65 src/usr.sbin/makefs/makefs.8:1.66
--- src/usr.sbin/makefs/makefs.8:1.65	Sat Apr  4 13:44:57 2020
+++ src/usr.sbin/makefs/makefs.8	Sun Nov 15 00:18:48 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.65 2020/04/04 13:44:57 reinoud Exp $
+.\"	$NetBSD: makefs.8,v 1.66 2020/11/15 00:18:48 jmcneill Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 6, 2019
+.Dd November 14, 2020
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -358,6 +358,7 @@ Filename of a boot image in the format
 where
 .Dq sysid
 is one of
+.Ql efi ,
 .Ql i386 ,
 .Ql mac68k ,
 .Ql macppc ,

Index: src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.23 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.24
--- src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.23	Wed Mar 28 06:48:55 2018
+++ src/usr.sbin/makefs/cd9660/cd9660_eltorito.c	Sun Nov 15 00:18:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_eltorito.c,v 1.23 2018/03/28 06:48:55 nonaka Exp $	*/
+/*	$NetBSD: cd9660_eltorito.c,v 1.24 2020/11/15 00:18:48 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_eltorito.c,v 1.23 2018/03/28 06:48:55 nonaka Exp $");
+__RCSID("$NetBSD: cd9660_eltorito.c,v 1.24 2020/11/15 00:18:48 jmcneill Exp $");
 #endif  /* !__lint */
 
 #ifdef DEBUG
@@ -109,9 +109,11 @@ cd9660_add_boot_disk(iso9660_disk *diskS
 	else if (strcmp(sysname, "macppc") == 0 ||
 	         strcmp(sysname, "mac68k") == 0)
 		new_image->system = ET_SYS_MAC;
+	else if (strcmp(sysname, "efi") == 0)
+		new_image->system = ET_SYS_EFI;
 	else {
 		warnx("boot disk system must be "
-		      "i386, powerpc, macppc, or mac68k");
+		      "i386, powerpc, macppc, mac68k, or efi");
 		free(temp);
 		free(new_image);
 		return 0;
@@ -363,6 +365,7 @@ cd9660_setup_boot(iso9660_disk *diskStru
 	struct boot_catalog_entry *x86_head, *mac_head, *ppc_head, *efi_head,
 		*valid_entry, *default_entry, *temp, *head, **headp, *next;
 	struct cd9660_boot_image *tmp_disk;
+	u_char system;
 
 	headp = NULL;
 	x86_head = mac_head = ppc_head = efi_head = NULL;
@@ -377,9 +380,16 @@ cd9660_setup_boot(iso9660_disk *diskStru
 	cd9660_bothendian_dword(first_sector,
 		diskStructure->boot_descriptor->boot_catalog_pointer);
 
+	/*
+	 * Use system type of default image for validation entry. Fallback to
+	 * X86 system type if not found.
+	 */
+	system = default_boot_image != NULL ? default_boot_image->system :
+					      ET_SYS_X86; 
+
 	/* Step 1: Generate boot catalog */
 	/* Step 1a: Validation entry */
-	valid_entry = cd9660_boot_setup_validation_entry(ET_SYS_X86);
+	valid_entry = cd9660_boot_setup_validation_entry(system);
 	if (valid_entry == NULL)
 		return -1;
 

Reply via email to