1 --- cdrtools-3.00/mkisofs/eltorito.c.orig Tue Jun 28 15:30:41 2011
2 +++ cdrtools-3.00/mkisofs/eltorito.c Tue Jun 28 15:32:46 2011
4 LOCAL void get_torito_desc __PR((struct eltorito_boot_descriptor *boot_desc));
5 LOCAL void fill_boot_desc __PR((struct eltorito_defaultboot_entry *boot_desc_entry,
6 struct eltorito_boot_entry_info *boot_entry));
7 +LOCAL void fill_boot_shdr __PR((struct eltorito_sectionheader_entry *boot_shdr_entry,
8 + struct eltorito_boot_entry_info *boot_entry));
10 EXPORT void get_boot_entry __PR((void));
11 EXPORT int new_boot_entry __PR((void));
12 EXPORT void ex_boot_enoent __PR((char *msg, char *pname));
17 + if (cbe->type == ELTORITO_SECTION_HEADER)
20 if (cbe->boot_image == NULL)
21 comerrno(EX_BAD, "Missing boot image name, use -eltorito-boot option.\n");
23 struct directory_entry *de2; /* Boot catalog */
27 struct eltorito_defaultboot_entry boot_desc_record;
28 + struct eltorito_sectionheader_entry boot_shdr_record;
29 + struct eltorito_section_entry boot_section_record;
30 + struct eltorito_sectionheader_entry *last_section_header = 0;
31 + extern int def_platid;
33 memset(boot_desc, 0, sizeof (*boot_desc));
34 boot_desc->type[0] = 0;
37 memset(&valid_desc, 0, sizeof (valid_desc));
38 valid_desc.headerid[0] = 1;
39 - valid_desc.arch[0] = EL_TORITO_ARCH_x86;
40 + valid_desc.arch[0] = def_platid;
43 * we'll shove start of publisher id into id field,
46 "Too many El Torito boot entries\n");
48 - fill_boot_desc(&boot_desc_record, current_boot_entry);
49 - memcpy(de2->table + offset, &boot_desc_record,
50 - sizeof (boot_desc_record));
51 + if (current_boot_entry->type != ELTORITO_SECTION_HEADER) {
53 + fill_boot_desc(&boot_desc_record, current_boot_entry);
54 + memcpy(de2->table + offset, &boot_desc_record,
55 + sizeof (boot_desc_record));
57 + if (current_boot_entry->type == ELTORITO_SECTION_HEADER) {
58 + if (last_section_header) {
59 + /* XXX - If no entries, that's an error */
60 + set_721(&last_section_header->entry_count, nentries);
63 + last_section_header = (struct eltorito_sectionheader_entry *)(de2->table + offset);
64 + fill_boot_shdr(&boot_shdr_record, current_boot_entry);
65 + memcpy(de2->table + offset, &boot_shdr_record,
66 + sizeof (boot_shdr_record));
69 + * if there was a section header processed, add this
70 + * as a section entry
72 + if (last_section_header) {
75 + * This works because a section entry has the same essential
76 + * layout as a default entry (and we do not populate the
77 + * selection criteria fields).
79 + fill_boot_desc((struct eltorito_defaultboot_entry *)&boot_section_record,
80 + current_boot_entry);
81 + memcpy(de2->table + offset, &boot_section_record,
82 + sizeof (boot_section_record));
84 + fill_boot_desc(&boot_desc_record, current_boot_entry);
85 + memcpy(de2->table + offset, &boot_desc_record,
86 + sizeof (boot_desc_record));
91 + if (last_section_header) {
92 + /* XXX - If no entries, that's an error */
93 + set_721(&last_section_header->entry_count, nentries);
94 + last_section_header->flags[0] = ELTORITO_SHDR_FLAG_LAST_SHDR;
97 } /* get_torito_desc(... */
100 +fill_boot_shdr(boot_shdr_entry, boot_entry)
101 + struct eltorito_sectionheader_entry *boot_shdr_entry;
102 + struct eltorito_boot_entry_info *boot_entry;
104 + memset(boot_shdr_entry, 0, sizeof(struct eltorito_sectionheader_entry));
105 + boot_shdr_entry->flags[0] = ELTORITO_SHDR_FLAG_SHDR;
106 + boot_shdr_entry->platform_id[0] = boot_entry->boot_platid;
110 fill_boot_desc(boot_desc_entry, boot_entry)
111 struct eltorito_defaultboot_entry *boot_desc_entry;
112 struct eltorito_boot_entry_info *boot_entry;
117 - if (!boot_desc_entry || !boot_entry)
118 + if (!boot_desc_entry || !boot_entry || !boot_entry->boot_image)
121 /* now adjust boot catalog lets find boot image first */