PSARC/2011/154 mkisofs enhancements
7029174 mkisofs needs to support UEFI catalogue entry and setting modification time
7033042 migrate cdrtools to userland
--- cdrtools-3.00/mkisofs/eltorito.c.orig Tue Jun 28 15:30:41 2011
+++ cdrtools-3.00/mkisofs/eltorito.c Tue Jun 28 15:32:46 2011
@@ -46,6 +46,9 @@
LOCAL void get_torito_desc __PR((struct eltorito_boot_descriptor *boot_desc));
LOCAL void fill_boot_desc __PR((struct eltorito_defaultboot_entry *boot_desc_entry,
struct eltorito_boot_entry_info *boot_entry));
+LOCAL void fill_boot_shdr __PR((struct eltorito_sectionheader_entry *boot_shdr_entry,
+ struct eltorito_boot_entry_info *boot_entry));
+
EXPORT void get_boot_entry __PR((void));
EXPORT int new_boot_entry __PR((void));
EXPORT void ex_boot_enoent __PR((char *msg, char *pname));
@@ -72,6 +75,8 @@
cbe != NULL;
cbe = cbe->next) {
char *p;
+ if (cbe->type == ELTORITO_SECTION_HEADER)
+ continue;
if (cbe->boot_image == NULL)
comerrno(EX_BAD, "Missing boot image name, use -eltorito-boot option.\n");
@@ -256,7 +261,12 @@
struct directory_entry *de2; /* Boot catalog */
int i;
int offset;
+ int nentries = 0;
struct eltorito_defaultboot_entry boot_desc_record;
+ struct eltorito_sectionheader_entry boot_shdr_record;
+ struct eltorito_section_entry boot_section_record;
+ struct eltorito_sectionheader_entry *last_section_header = 0;
+ extern int def_platid;
memset(boot_desc, 0, sizeof (*boot_desc));
boot_desc->type[0] = 0;
@@ -285,7 +295,7 @@
*/
memset(&valid_desc, 0, sizeof (valid_desc));
valid_desc.headerid[0] = 1;
- valid_desc.arch[0] = EL_TORITO_ARCH_x86;
+ valid_desc.arch[0] = def_platid;
/*
* we'll shove start of publisher id into id field,
@@ -324,13 +334,65 @@
comerrno(EX_BAD,
"Too many El Torito boot entries\n");
}
- fill_boot_desc(&boot_desc_record, current_boot_entry);
- memcpy(de2->table + offset, &boot_desc_record,
- sizeof (boot_desc_record));
+ if (current_boot_entry->type != ELTORITO_SECTION_HEADER) {
+
+ fill_boot_desc(&boot_desc_record, current_boot_entry);
+ memcpy(de2->table + offset, &boot_desc_record,
+ sizeof (boot_desc_record));
+ }
+ if (current_boot_entry->type == ELTORITO_SECTION_HEADER) {
+ if (last_section_header) {
+ /* XXX - If no entries, that's an error */
+ set_721(&last_section_header->entry_count, nentries);
+ }
+ nentries = 0;
+ last_section_header = (struct eltorito_sectionheader_entry *)(de2->table + offset);
+ fill_boot_shdr(&boot_shdr_record, current_boot_entry);
+ memcpy(de2->table + offset, &boot_shdr_record,
+ sizeof (boot_shdr_record));
+ } else {
+ /*
+ * if there was a section header processed, add this
+ * as a section entry
+ */
+ if (last_section_header) {
+ nentries++;
+ /*
+ * This works because a section entry has the same essential
+ * layout as a default entry (and we do not populate the
+ * selection criteria fields).
+ */
+ fill_boot_desc((struct eltorito_defaultboot_entry *)&boot_section_record,
+ current_boot_entry);
+ memcpy(de2->table + offset, &boot_section_record,
+ sizeof (boot_section_record));
+ } else {
+ fill_boot_desc(&boot_desc_record, current_boot_entry);
+ memcpy(de2->table + offset, &boot_desc_record,
+ sizeof (boot_desc_record));
+ }
+ }
}
+
+ if (last_section_header) {
+ /* XXX - If no entries, that's an error */
+ set_721(&last_section_header->entry_count, nentries);
+ last_section_header->flags[0] = ELTORITO_SHDR_FLAG_LAST_SHDR;
+ }
+
} /* get_torito_desc(... */
LOCAL void
+fill_boot_shdr(boot_shdr_entry, boot_entry)
+ struct eltorito_sectionheader_entry *boot_shdr_entry;
+ struct eltorito_boot_entry_info *boot_entry;
+{
+ memset(boot_shdr_entry, 0, sizeof(struct eltorito_sectionheader_entry));
+ boot_shdr_entry->flags[0] = ELTORITO_SHDR_FLAG_SHDR;
+ boot_shdr_entry->platform_id[0] = boot_entry->boot_platid;
+}
+
+LOCAL void
fill_boot_desc(boot_desc_entry, boot_entry)
struct eltorito_defaultboot_entry *boot_desc_entry;
struct eltorito_boot_entry_info *boot_entry;
@@ -341,7 +403,7 @@
int nsectors;
int geosec;
- if (!boot_desc_entry || !boot_entry)
+ if (!boot_desc_entry || !boot_entry || !boot_entry->boot_image)
return;
/* now adjust boot catalog lets find boot image first */