cdrkit-1.1.9-efi-boot.patch 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. diff --git a/doc/icedax/tracknames.pl b/doc/icedax/tracknames.pl
  2. old mode 100755
  3. new mode 100644
  4. index 09f0fcf..801b89e
  5. --- a/doc/icedax/tracknames.pl
  6. +++ b/doc/icedax/tracknames.pl
  7. @@ -1,4 +1,4 @@
  8. -#!/usr/local/bin/perl
  9. +#!/usr/bin/perl
  10. # A quick perl hack to get rename files pulled in with icedax.
  11. # by billo@billo.com
  12. #
  13. diff --git a/genisoimage/eltorito.c b/genisoimage/eltorito.c
  14. index b97bdf1..5d7c2d1 100644
  15. --- a/genisoimage/eltorito.c
  16. +++ b/genisoimage/eltorito.c
  17. @@ -59,7 +59,7 @@ static void get_torito_desc(struct eltorito_boot_descriptor *boot_desc);
  18. static void fill_boot_desc(struct eltorito_defaultboot_entry *boot_desc_entry,
  19. struct eltorito_boot_entry_info *boot_entry);
  20. void get_boot_entry(void);
  21. -void new_boot_entry(void);
  22. +void new_boot_entry();
  23. static int tvd_write(FILE *outfile);
  24. @@ -283,6 +283,7 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
  25. int i;
  26. int offset;
  27. struct eltorito_defaultboot_entry boot_desc_record;
  28. + struct eltorito_sectionheader_entry section_header;
  29. memset(boot_desc, 0, sizeof (*boot_desc));
  30. boot_desc->type[0] = 0;
  31. @@ -317,7 +318,7 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
  32. */
  33. memset(&valid_desc, 0, sizeof (valid_desc));
  34. valid_desc.headerid[0] = 1;
  35. - valid_desc.arch[0] = EL_TORITO_ARCH_x86;
  36. + valid_desc.arch[0] = first_boot_entry->arch;
  37. /*
  38. * we'll shove start of publisher id into id field,
  39. @@ -347,10 +348,53 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
  40. /* now write it to the virtual boot catalog */
  41. memcpy(de2->table, &valid_desc, 32);
  42. - for (current_boot_entry = first_boot_entry, offset = sizeof (valid_desc);
  43. - current_boot_entry != NULL;
  44. - current_boot_entry = current_boot_entry->next,
  45. - offset += sizeof (boot_desc_record)) {
  46. + /* Fill the first entry, since it's special and already has the
  47. + * matching header via the validation header... */
  48. + offset = sizeof (valid_desc);
  49. + current_boot_entry = first_boot_entry;
  50. +
  51. + if (offset >= SECTOR_SIZE) {
  52. +#ifdef USE_LIBSCHILY
  53. + comerrno(EX_BAD, "Too many El Torito boot entries\n");
  54. +#else
  55. + fprintf(stderr, "Too many El Torito boot entries\n");
  56. + exit(1);
  57. +#endif
  58. + }
  59. + fill_boot_desc(&boot_desc_record, current_boot_entry);
  60. + memcpy(de2->table + offset, &boot_desc_record,
  61. + sizeof (boot_desc_record));
  62. +
  63. + offset += sizeof(boot_desc_record);
  64. +
  65. + for (current_boot_entry = current_boot_entry->next;
  66. + current_boot_entry != NULL;
  67. + current_boot_entry = current_boot_entry->next) {
  68. + struct eltorito_sectionheader_entry section_header;
  69. +
  70. + if (offset >= SECTOR_SIZE) {
  71. +#ifdef USE_LIBSCHILY
  72. + comerrno(EX_BAD,
  73. + "Too many El Torito boot entries\n");
  74. +#else
  75. + fprintf(stderr,
  76. + "Too many El Torito boot entries\n");
  77. + exit(1);
  78. +#endif
  79. + }
  80. +
  81. + memset(&section_header, '\0', sizeof(section_header));
  82. + if (current_boot_entry->next)
  83. + section_header.headerid[0] = EL_TORITO_SECTION_HEADER;
  84. + else
  85. + section_header.headerid[0] = EL_TORITO_LAST_SECTION_HEADER;
  86. +
  87. + section_header.arch[0] = current_boot_entry->arch;
  88. + set_721(section_header.num_entries, 1);
  89. +
  90. + memcpy(de2->table + offset, &section_header,
  91. + sizeof(section_header));
  92. + offset += sizeof(section_header);
  93. if (offset >= SECTOR_SIZE) {
  94. #ifdef USE_LIBSCHILY
  95. @@ -365,6 +409,8 @@ get_torito_desc(struct eltorito_boot_descriptor *boot_desc)
  96. fill_boot_desc(&boot_desc_record, current_boot_entry);
  97. memcpy(de2->table + offset, &boot_desc_record,
  98. sizeof (boot_desc_record));
  99. + offset += sizeof (boot_desc_record);
  100. +
  101. }
  102. }/* get_torito_desc(... */
  103. diff --git a/genisoimage/genisoimage.c b/genisoimage/genisoimage.c
  104. index a5b0b46..8add1ac 100644
  105. --- a/genisoimage/genisoimage.c
  106. +++ b/genisoimage/genisoimage.c
  107. @@ -47,6 +47,7 @@
  108. #include <mconfig.h>
  109. #include "genisoimage.h"
  110. +#include "iso9660.h"
  111. #include <errno.h>
  112. #include <timedefs.h>
  113. #include <fctldefs.h>
  114. @@ -523,6 +524,8 @@ static const struct ld_option ld_options[] =
  115. '\0', NULL, "Set debug flag", ONE_DASH},
  116. {{"eltorito-boot", required_argument, NULL, 'b'},
  117. 'b', "FILE", "Set El Torito boot image name", ONE_DASH},
  118. + {{"efi-boot", required_argument, NULL, 'e'},
  119. + 'e', "FILE", "Set EFI boot image name", ONE_DASH},
  120. {{"eltorito-alt-boot", no_argument, NULL, OPTION_ALT_BOOT},
  121. '\0', NULL, "Start specifying alternative El Torito boot parameters", ONE_DASH},
  122. {{"sparc-boot", required_argument, NULL, 'B'},
  123. @@ -1502,6 +1505,7 @@ int main(int argc, char *argv[])
  124. all_files = 0;
  125. break;
  126. case 'b':
  127. + case 'e':
  128. do_sort++; /* We sort bootcat/botimage */
  129. use_eltorito++;
  130. boot_image = optarg; /* pathname of the boot image */
  131. @@ -1517,6 +1521,10 @@ int main(int argc, char *argv[])
  132. #endif
  133. }
  134. get_boot_entry();
  135. + if (c == 'e')
  136. + current_boot_entry->arch = EL_TORITO_ARCH_EFI;
  137. + else
  138. + current_boot_entry->arch = EL_TORITO_ARCH_x86;
  139. current_boot_entry->boot_image = boot_image;
  140. break;
  141. case OPTION_ALT_BOOT:
  142. diff --git a/genisoimage/genisoimage.h b/genisoimage/genisoimage.h
  143. index bbedfb0..76e5e21 100644
  144. --- a/genisoimage/genisoimage.h
  145. +++ b/genisoimage/genisoimage.h
  146. @@ -293,6 +293,7 @@ struct deferred_write {
  147. struct eltorito_boot_entry_info {
  148. struct eltorito_boot_entry_info *next;
  149. char *boot_image;
  150. + char arch;
  151. int not_bootable;
  152. int no_emul_boot;
  153. int hard_disk_boot;
  154. diff --git a/genisoimage/iso9660.h b/genisoimage/iso9660.h
  155. index c74c2a9..c8b7a05 100644
  156. --- a/genisoimage/iso9660.h
  157. +++ b/genisoimage/iso9660.h
  158. @@ -62,10 +62,14 @@ struct iso_volume_descriptor {
  159. #define EL_TORITO_ARCH_x86 0
  160. #define EL_TORITO_ARCH_PPC 1
  161. #define EL_TORITO_ARCH_MAC 2
  162. +#define EL_TORITO_ARCH_EFI 0xef
  163. #define EL_TORITO_BOOTABLE 0x88
  164. #define EL_TORITO_NOT_BOOTABLE 0
  165. +#define EL_TORITO_SECTION_HEADER 0x90
  166. +#define EL_TORITO_LAST_SECTION_HEADER 0x91
  167. +
  168. #define EL_TORITO_MEDIA_NOEMUL 0
  169. #define EL_TORITO_MEDIA_12FLOP 1
  170. #define EL_TORITO_MEDIA_144FLOP 2
  171. @@ -173,7 +177,7 @@ struct eltorito_validation_entry {
  172. struct eltorito_defaultboot_entry {
  173. char boot_id [ISODCL(1, 1)]; /* 711 */
  174. char boot_media [ISODCL(2, 2)];
  175. - char loadseg [ISODCL(3, 4)]; /* 711 */
  176. + char loadseg [ISODCL(3, 4)]; /* 712 */
  177. char sys_type [ISODCL(5, 5)];
  178. char pad1 [ISODCL(6, 6)];
  179. char nsect [ISODCL(7, 8)];
  180. @@ -181,6 +185,14 @@ struct eltorito_defaultboot_entry {
  181. char pad2 [ISODCL(13, 32)];
  182. };
  183. +/* El Torito Section Header Entry in boot catalog */
  184. +struct eltorito_sectionheader_entry {
  185. + char headerid [ISODCL(1, 1)]; /* 711 */
  186. + char arch [ISODCL(2, 2)];
  187. + char num_entries [ISODCL(3, 4)]; /* 711 */
  188. + char id [ISODCL(5, 32)];
  189. +};
  190. +
  191. /*
  192. * XXX JS: The next two structures have odd lengths!
  193. * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length.