git: 496478c1dcb1 - stable/13 - makefs: set the validation entry system type

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 14 Apr 2023 12:52:59 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=496478c1dcb1303edbaaa955261d4089af80f58b

commit 496478c1dcb1303edbaaa955261d4089af80f58b
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-03-30 14:31:45 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-04-14 12:10:38 +0000

    makefs: set the validation entry system type
    
    Obtained from:  NetBSD c3cb4dcc9c43
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 22db5e5d03278471c46799016c177abf95f273cb)
---
 usr.sbin/makefs/cd9660/cd9660_eltorito.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
index 6d7a32378b64..f837c0b3c381 100644
--- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c
+++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c
@@ -374,6 +374,7 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int first_sector)
 	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;
+	uint8_t system;
 
 	headp = NULL;
 	x86_head = mac_head = ppc_head = efi_head = NULL;
@@ -388,9 +389,16 @@ cd9660_setup_boot(iso9660_disk *diskStructure, int first_sector)
 	cd9660_731(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;