bzip2: change to new library paths
[unleashed-userland.git] / components / cdrtools / patches / eltorito.c.patch
blobb854ede1d58a6899c955847c515d81192c8b3e91
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
3 @@ -46,6 +46,9 @@
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));
13 @@ -72,6 +75,8 @@
14 cbe != NULL;
15 cbe = cbe->next) {
16 char *p;
17 + if (cbe->type == ELTORITO_SECTION_HEADER)
18 + continue;
20 if (cbe->boot_image == NULL)
21 comerrno(EX_BAD, "Missing boot image name, use -eltorito-boot option.\n");
22 @@ -256,7 +261,12 @@
23 struct directory_entry *de2; /* Boot catalog */
24 int i;
25 int offset;
26 + int nentries = 0;
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;
35 @@ -285,7 +295,7 @@
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,
44 @@ -324,13 +334,65 @@
45 comerrno(EX_BAD,
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));
56 + }
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);
61 + }
62 + nentries = 0;
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));
67 + } else {
68 + /*
69 + * if there was a section header processed, add this
70 + * as a section entry
71 + */
72 + if (last_section_header) {
73 + nentries++;
74 + /*
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).
78 + */
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));
83 + } else {
84 + fill_boot_desc(&boot_desc_record, current_boot_entry);
85 + memcpy(de2->table + offset, &boot_desc_record,
86 + sizeof (boot_desc_record));
87 + }
88 + }
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;
95 + }
97 } /* get_torito_desc(... */
99 LOCAL void
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;
109 +LOCAL void
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;
113 @@ -341,7 +403,7 @@
114 int nsectors;
115 int geosec;
117 - if (!boot_desc_entry || !boot_entry)
118 + if (!boot_desc_entry || !boot_entry || !boot_entry->boot_image)
119 return;
121 /* now adjust boot catalog lets find boot image first */