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