cd9660_eltorito.h revision 1.6 1 1.6 nonaka /* $NetBSD: cd9660_eltorito.h,v 1.6 2017/01/24 11:22:43 nonaka Exp $ */
2 1.5 ahoka
3 1.5 ahoka /*
4 1.5 ahoka * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
5 1.5 ahoka * Perez-Rathke and Ram Vedam. All rights reserved.
6 1.5 ahoka *
7 1.5 ahoka * This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys,
8 1.5 ahoka * Alan Perez-Rathke and Ram Vedam.
9 1.5 ahoka *
10 1.5 ahoka * Redistribution and use in source and binary forms, with or
11 1.5 ahoka * without modification, are permitted provided that the following
12 1.5 ahoka * conditions are met:
13 1.5 ahoka * 1. Redistributions of source code must retain the above copyright
14 1.5 ahoka * notice, this list of conditions and the following disclaimer.
15 1.5 ahoka * 2. Redistributions in binary form must reproduce the above
16 1.5 ahoka * copyright notice, this list of conditions and the following
17 1.5 ahoka * disclaimer in the documentation and/or other materials provided
18 1.5 ahoka * with the distribution.
19 1.5 ahoka *
20 1.5 ahoka * THIS SOFTWARE IS PROVIDED BY DANIEL WATT, WALTER DEIGNAN, RYAN
21 1.5 ahoka * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR
22 1.5 ahoka * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.5 ahoka * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 1.5 ahoka * DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN
25 1.5 ahoka * GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.5 ahoka * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.5 ahoka * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 1.5 ahoka * USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 1.5 ahoka * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 1.5 ahoka * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.5 ahoka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32 1.5 ahoka * OF SUCH DAMAGE.
33 1.5 ahoka */
34 1.5 ahoka
35 1.5 ahoka #ifndef _CD9660_ELTORITO_H_
36 1.5 ahoka #define _CD9660_ELTORITO_H_
37 1.5 ahoka
38 1.5 ahoka /* Boot defines */
39 1.5 ahoka #define ET_ID "EL TORITO SPECIFICATION"
40 1.5 ahoka #define ET_SYS_X86 0
41 1.5 ahoka #define ET_SYS_PPC 1
42 1.5 ahoka #define ET_SYS_MAC 2
43 1.6 nonaka #define ET_SYS_EFI 0xef /* Platform ID at section header entry */
44 1.5 ahoka
45 1.5 ahoka #define ET_BOOT_ENTRY_SIZE 0x20
46 1.5 ahoka
47 1.5 ahoka #define ET_BOOTABLE 0x88
48 1.5 ahoka #define ET_NOT_BOOTABLE 0
49 1.5 ahoka
50 1.5 ahoka #define ET_MEDIA_NOEM 0
51 1.5 ahoka #define ET_MEDIA_12FDD 1
52 1.5 ahoka #define ET_MEDIA_144FDD 2
53 1.5 ahoka #define ET_MEDIA_288FDD 3
54 1.5 ahoka #define ET_MEDIA_HDD 4
55 1.5 ahoka
56 1.5 ahoka #define ET_INDICATOR_HEADERMORE 0x90
57 1.5 ahoka #define ET_INDICATOR_HEADERLAST 0x91
58 1.5 ahoka #define ET_INDICATOR_EXTENSION 0x44
59 1.5 ahoka
60 1.5 ahoka /*** Boot Structures ***/
61 1.5 ahoka
62 1.5 ahoka typedef struct _boot_volume_descriptor {
63 1.5 ahoka u_char boot_record_indicator [ISODCL(0x00,0x00)];
64 1.5 ahoka u_char identifier [ISODCL(0x01,0x05)];
65 1.5 ahoka u_char version [ISODCL(0x06,0x06)];
66 1.5 ahoka u_char boot_system_identifier [ISODCL(0x07,0x26)];
67 1.5 ahoka u_char unused1 [ISODCL(0x27,0x46)];
68 1.5 ahoka u_char boot_catalog_pointer [ISODCL(0x47,0x4A)];
69 1.5 ahoka u_char unused2 [ISODCL(0x4B,0x7FF)];
70 1.5 ahoka } boot_volume_descriptor;
71 1.5 ahoka
72 1.5 ahoka typedef struct _boot_catalog_validation_entry {
73 1.5 ahoka u_char header_id [ISODCL(0x00,0x00)];
74 1.5 ahoka u_char platform_id [ISODCL(0x01,0x01)];
75 1.5 ahoka u_char reserved1 [ISODCL(0x02,0x03)];
76 1.5 ahoka u_char manufacturer [ISODCL(0x04,0x1B)];
77 1.5 ahoka u_char checksum [ISODCL(0x1C,0x1D)];
78 1.5 ahoka u_char key [ISODCL(0x1E,0x1F)];
79 1.5 ahoka } boot_catalog_validation_entry;
80 1.5 ahoka
81 1.5 ahoka typedef struct _boot_catalog_initial_entry {
82 1.5 ahoka u_char boot_indicator [ISODCL(0x00,0x00)];
83 1.5 ahoka u_char media_type [ISODCL(0x01,0x01)];
84 1.5 ahoka u_char load_segment [ISODCL(0x02,0x03)];
85 1.5 ahoka u_char system_type [ISODCL(0x04,0x04)];
86 1.5 ahoka u_char unused_1 [ISODCL(0x05,0x05)];
87 1.5 ahoka u_char sector_count [ISODCL(0x06,0x07)];
88 1.5 ahoka u_char load_rba [ISODCL(0x08,0x0B)];
89 1.5 ahoka u_char unused_2 [ISODCL(0x0C,0x1F)];
90 1.5 ahoka } boot_catalog_initial_entry;
91 1.5 ahoka
92 1.5 ahoka #define ET_SECTION_HEADER_MORE 0x90
93 1.5 ahoka #define ET_SECTION_HEADER_LAST 0x91
94 1.5 ahoka
95 1.5 ahoka typedef struct _boot_catalog_section_header {
96 1.5 ahoka u_char header_indicator [ISODCL(0x00,0x00)];
97 1.5 ahoka u_char platform_id [ISODCL(0x01,0x01)];
98 1.5 ahoka u_char num_section_entries [ISODCL(0x02,0x03)];
99 1.5 ahoka u_char id_string [ISODCL(0x04,0x1F)];
100 1.5 ahoka } boot_catalog_section_header;
101 1.5 ahoka
102 1.5 ahoka typedef struct _boot_catalog_section_entry {
103 1.5 ahoka u_char boot_indicator [ISODCL(0x00,0x00)];
104 1.5 ahoka u_char media_type [ISODCL(0x01,0x01)];
105 1.5 ahoka u_char load_segment [ISODCL(0x02,0x03)];
106 1.5 ahoka u_char system_type [ISODCL(0x04,0x04)];
107 1.5 ahoka u_char unused_1 [ISODCL(0x05,0x05)];
108 1.5 ahoka u_char sector_count [ISODCL(0x06,0x07)];
109 1.5 ahoka u_char load_rba [ISODCL(0x08,0x0B)];
110 1.5 ahoka u_char selection_criteria [ISODCL(0x0C,0x0C)];
111 1.5 ahoka u_char vendor_criteria [ISODCL(0x0D,0x1F)];
112 1.5 ahoka } boot_catalog_section_entry;
113 1.5 ahoka
114 1.5 ahoka typedef struct _boot_catalog_section_entry_extension {
115 1.5 ahoka u_char extension_indicator [ISODCL(0x00,0x00)];
116 1.5 ahoka u_char flags [ISODCL(0x01,0x01)];
117 1.5 ahoka u_char vendor_criteria [ISODCL(0x02,0x1F)];
118 1.5 ahoka } boot_catalog_section_entry_extension;
119 1.5 ahoka
120 1.5 ahoka #define ET_ENTRY_VE 1
121 1.5 ahoka #define ET_ENTRY_IE 2
122 1.5 ahoka #define ET_ENTRY_SH 3
123 1.5 ahoka #define ET_ENTRY_SE 4
124 1.5 ahoka #define ET_ENTRY_EX 5
125 1.5 ahoka
126 1.5 ahoka struct boot_catalog_entry {
127 1.5 ahoka char entry_type;
128 1.5 ahoka union {
129 1.5 ahoka boot_catalog_validation_entry VE;
130 1.5 ahoka boot_catalog_initial_entry IE;
131 1.5 ahoka boot_catalog_section_header SH;
132 1.5 ahoka boot_catalog_section_entry SE;
133 1.5 ahoka boot_catalog_section_entry_extension EX;
134 1.5 ahoka } entry_data;
135 1.5 ahoka
136 1.5 ahoka LIST_ENTRY(boot_catalog_entry) ll_struct;
137 1.5 ahoka };
138 1.5 ahoka
139 1.5 ahoka /* Temporary structure */
140 1.5 ahoka struct cd9660_boot_image {
141 1.5 ahoka char *filename;
142 1.5 ahoka int size;
143 1.5 ahoka int sector; /* copied to LoadRBA */
144 1.5 ahoka int num_sectors;
145 1.5 ahoka unsigned int loadSegment;
146 1.5 ahoka u_char targetMode;
147 1.5 ahoka u_char system;
148 1.5 ahoka u_char bootable;
149 1.6 nonaka u_char platform_id; /* for section header entry */
150 1.5 ahoka /*
151 1.5 ahoka * If the boot image exists in the filesystem
152 1.5 ahoka * already, this is a pointer to that node. For the sake
153 1.5 ahoka * of simplicity in future versions, this pointer is only
154 1.5 ahoka * to the node in the primary volume. This SHOULD be done
155 1.5 ahoka * via a hashtable lookup.
156 1.5 ahoka */
157 1.5 ahoka struct _cd9660node *boot_image_node;
158 1.5 ahoka TAILQ_ENTRY(cd9660_boot_image) image_list;
159 1.5 ahoka int serialno;
160 1.5 ahoka };
161 1.5 ahoka
162 1.5 ahoka
163 1.5 ahoka #endif /* _CD9660_ELTORITO_H_ */
164 1.5 ahoka
165