cd9660_eltorito.h revision 1.5 1 1.5 ahoka /* $NetBSD: cd9660_eltorito.h,v 1.5 2009/07/04 14:31:38 ahoka 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.5 ahoka
44 1.5 ahoka #define ET_BOOT_ENTRY_SIZE 0x20
45 1.5 ahoka
46 1.5 ahoka #define ET_BOOTABLE 0x88
47 1.5 ahoka #define ET_NOT_BOOTABLE 0
48 1.5 ahoka
49 1.5 ahoka #define ET_MEDIA_NOEM 0
50 1.5 ahoka #define ET_MEDIA_12FDD 1
51 1.5 ahoka #define ET_MEDIA_144FDD 2
52 1.5 ahoka #define ET_MEDIA_288FDD 3
53 1.5 ahoka #define ET_MEDIA_HDD 4
54 1.5 ahoka
55 1.5 ahoka #define ET_INDICATOR_HEADERMORE 0x90
56 1.5 ahoka #define ET_INDICATOR_HEADERLAST 0x91
57 1.5 ahoka #define ET_INDICATOR_EXTENSION 0x44
58 1.5 ahoka
59 1.5 ahoka /*** Boot Structures ***/
60 1.5 ahoka
61 1.5 ahoka typedef struct _boot_volume_descriptor {
62 1.5 ahoka u_char boot_record_indicator [ISODCL(0x00,0x00)];
63 1.5 ahoka u_char identifier [ISODCL(0x01,0x05)];
64 1.5 ahoka u_char version [ISODCL(0x06,0x06)];
65 1.5 ahoka u_char boot_system_identifier [ISODCL(0x07,0x26)];
66 1.5 ahoka u_char unused1 [ISODCL(0x27,0x46)];
67 1.5 ahoka u_char boot_catalog_pointer [ISODCL(0x47,0x4A)];
68 1.5 ahoka u_char unused2 [ISODCL(0x4B,0x7FF)];
69 1.5 ahoka } boot_volume_descriptor;
70 1.5 ahoka
71 1.5 ahoka typedef struct _boot_catalog_validation_entry {
72 1.5 ahoka u_char header_id [ISODCL(0x00,0x00)];
73 1.5 ahoka u_char platform_id [ISODCL(0x01,0x01)];
74 1.5 ahoka u_char reserved1 [ISODCL(0x02,0x03)];
75 1.5 ahoka u_char manufacturer [ISODCL(0x04,0x1B)];
76 1.5 ahoka u_char checksum [ISODCL(0x1C,0x1D)];
77 1.5 ahoka u_char key [ISODCL(0x1E,0x1F)];
78 1.5 ahoka } boot_catalog_validation_entry;
79 1.5 ahoka
80 1.5 ahoka typedef struct _boot_catalog_initial_entry {
81 1.5 ahoka u_char boot_indicator [ISODCL(0x00,0x00)];
82 1.5 ahoka u_char media_type [ISODCL(0x01,0x01)];
83 1.5 ahoka u_char load_segment [ISODCL(0x02,0x03)];
84 1.5 ahoka u_char system_type [ISODCL(0x04,0x04)];
85 1.5 ahoka u_char unused_1 [ISODCL(0x05,0x05)];
86 1.5 ahoka u_char sector_count [ISODCL(0x06,0x07)];
87 1.5 ahoka u_char load_rba [ISODCL(0x08,0x0B)];
88 1.5 ahoka u_char unused_2 [ISODCL(0x0C,0x1F)];
89 1.5 ahoka } boot_catalog_initial_entry;
90 1.5 ahoka
91 1.5 ahoka #define ET_SECTION_HEADER_MORE 0x90
92 1.5 ahoka #define ET_SECTION_HEADER_LAST 0x91
93 1.5 ahoka
94 1.5 ahoka typedef struct _boot_catalog_section_header {
95 1.5 ahoka u_char header_indicator [ISODCL(0x00,0x00)];
96 1.5 ahoka u_char platform_id [ISODCL(0x01,0x01)];
97 1.5 ahoka u_char num_section_entries [ISODCL(0x02,0x03)];
98 1.5 ahoka u_char id_string [ISODCL(0x04,0x1F)];
99 1.5 ahoka } boot_catalog_section_header;
100 1.5 ahoka
101 1.5 ahoka typedef struct _boot_catalog_section_entry {
102 1.5 ahoka u_char boot_indicator [ISODCL(0x00,0x00)];
103 1.5 ahoka u_char media_type [ISODCL(0x01,0x01)];
104 1.5 ahoka u_char load_segment [ISODCL(0x02,0x03)];
105 1.5 ahoka u_char system_type [ISODCL(0x04,0x04)];
106 1.5 ahoka u_char unused_1 [ISODCL(0x05,0x05)];
107 1.5 ahoka u_char sector_count [ISODCL(0x06,0x07)];
108 1.5 ahoka u_char load_rba [ISODCL(0x08,0x0B)];
109 1.5 ahoka u_char selection_criteria [ISODCL(0x0C,0x0C)];
110 1.5 ahoka u_char vendor_criteria [ISODCL(0x0D,0x1F)];
111 1.5 ahoka } boot_catalog_section_entry;
112 1.5 ahoka
113 1.5 ahoka typedef struct _boot_catalog_section_entry_extension {
114 1.5 ahoka u_char extension_indicator [ISODCL(0x00,0x00)];
115 1.5 ahoka u_char flags [ISODCL(0x01,0x01)];
116 1.5 ahoka u_char vendor_criteria [ISODCL(0x02,0x1F)];
117 1.5 ahoka } boot_catalog_section_entry_extension;
118 1.5 ahoka
119 1.5 ahoka #define ET_ENTRY_VE 1
120 1.5 ahoka #define ET_ENTRY_IE 2
121 1.5 ahoka #define ET_ENTRY_SH 3
122 1.5 ahoka #define ET_ENTRY_SE 4
123 1.5 ahoka #define ET_ENTRY_EX 5
124 1.5 ahoka
125 1.5 ahoka struct boot_catalog_entry {
126 1.5 ahoka char entry_type;
127 1.5 ahoka union {
128 1.5 ahoka boot_catalog_validation_entry VE;
129 1.5 ahoka boot_catalog_initial_entry IE;
130 1.5 ahoka boot_catalog_section_header SH;
131 1.5 ahoka boot_catalog_section_entry SE;
132 1.5 ahoka boot_catalog_section_entry_extension EX;
133 1.5 ahoka } entry_data;
134 1.5 ahoka
135 1.5 ahoka LIST_ENTRY(boot_catalog_entry) ll_struct;
136 1.5 ahoka };
137 1.5 ahoka
138 1.5 ahoka /* Temporary structure */
139 1.5 ahoka struct cd9660_boot_image {
140 1.5 ahoka char *filename;
141 1.5 ahoka int size;
142 1.5 ahoka int sector; /* copied to LoadRBA */
143 1.5 ahoka int num_sectors;
144 1.5 ahoka unsigned int loadSegment;
145 1.5 ahoka u_char targetMode;
146 1.5 ahoka u_char system;
147 1.5 ahoka u_char bootable;
148 1.5 ahoka /*
149 1.5 ahoka * If the boot image exists in the filesystem
150 1.5 ahoka * already, this is a pointer to that node. For the sake
151 1.5 ahoka * of simplicity in future versions, this pointer is only
152 1.5 ahoka * to the node in the primary volume. This SHOULD be done
153 1.5 ahoka * via a hashtable lookup.
154 1.5 ahoka */
155 1.5 ahoka struct _cd9660node *boot_image_node;
156 1.5 ahoka TAILQ_ENTRY(cd9660_boot_image) image_list;
157 1.5 ahoka int serialno;
158 1.5 ahoka };
159 1.5 ahoka
160 1.5 ahoka
161 1.5 ahoka #endif /* _CD9660_ELTORITO_H_ */
162 1.5 ahoka
163