FreeNOS
BootImage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIBARCH_BOOTIMAGE_H
19 #define __LIBARCH_BOOTIMAGE_H
20 
30 #define BOOTIMAGE_MAGIC0 ('F') + ('r' << 8) + ('e' << 16) + ('e' << 24)
31 
33 #define BOOTIMAGE_MAGIC1 ('N') + ('O' << 8) + ('S' << 16) + (0x1 << 24)
34 
36 #define BOOTIMAGE_REVISION 2
37 
39 #define BOOTIMAGE_NAMELEN 32
40 
44 typedef struct BootImage
45 {
47  u32 magic[2];
48 
51 
54 
57 
60 
63 
66 }
67 BootImage;
68 
72 typedef enum BootSymbolType
73 {
77  BootData = 3
78 }
80 
84 typedef struct BootSymbol
85 {
88 
91 
94 
97 
100 
103 }
104 BootSymbol;
105 
109 typedef struct BootSegment
110 {
113 
116 
119 }
121 
127 #endif /* __LIBARCH_BOOTIMAGE_H */
BootSymbolType
BootSymbolType
Boot symbol types.
Definition: BootImage.h:72
BootProgram
@ BootProgram
Executable program.
Definition: BootImage.h:74
BootSegment
struct BootSegment BootSegment
Memory segment.
BootPrivProgram
@ BootPrivProgram
Privileged executable program.
Definition: BootImage.h:75
BootSymbol
struct BootSymbol BootSymbol
Program embedded in the BootImage.
BootSymbol::type
BootSymbolType type
Type of boot symbol.
Definition: BootImage.h:90
BootSymbol::segmentsOffset
u32 segmentsOffset
Offset in the segments table.
Definition: BootImage.h:96
BootSymbol::name
char name[BOOTIMAGE_NAMELEN]
Name of the boot symbol.
Definition: BootImage.h:87
BOOTIMAGE_NAMELEN
#define BOOTIMAGE_NAMELEN
Maximum length of BootSymbol names.
Definition: BootImage.h:39
BootImage::segmentsTableCount
u16 segmentsTableCount
Number of entries in the segments table.
Definition: BootImage.h:65
BootImage::bootImageSize
u32 bootImageSize
Total size of the boot image in bytes.
Definition: BootImage.h:53
BootData
@ BootData
Binary data.
Definition: BootImage.h:77
BootImage::segmentsTableOffset
u32 segmentsTableOffset
Offset of the segments table.
Definition: BootImage.h:62
u16
unsigned short u16
Unsigned 16-bit number.
Definition: Types.h:56
BootSymbol::segmentsTotalSize
u32 segmentsTotalSize
Total size of the BootSymbol segments.
Definition: BootImage.h:102
BootImage::symbolTableCount
u16 symbolTableCount
Number of entries in the symbols table.
Definition: BootImage.h:59
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
BootFilesystem
@ BootFilesystem
Embedded filesystem.
Definition: BootImage.h:76
BootSymbol
Program embedded in the BootImage.
Definition: BootImage.h:84
BootSegment::virtualAddress
u32 virtualAddress
Virtual memory address to load the segment.
Definition: BootImage.h:112
u8
unsigned char u8
Unsigned 8-bit number.
Definition: Types.h:59
BootSymbol::segmentsCount
u16 segmentsCount
Number of contiguous entries in the segment table.
Definition: BootImage.h:99
BootImage::layoutRevision
u8 layoutRevision
Version of the boot image layout.
Definition: BootImage.h:50
BootImage::symbolTableOffset
u32 symbolTableOffset
Offset of the symbol table.
Definition: BootImage.h:56
BootSymbol::entry
u32 entry
Program entry point (only valid for BootProgram symbols).
Definition: BootImage.h:93
BootImage
struct BootImage BootImage
BootImage contains executable programs to be loaded at system bootup.
BootImage
BootImage contains executable programs to be loaded at system bootup.
Definition: BootImage.h:44
BootSegment::size
u32 size
Total size of the segment.
Definition: BootImage.h:115
BootSegment::offset
u32 offset
Offset in the boot image of the segment contents.
Definition: BootImage.h:118
BootImage::magic
u32 magic[2]
Magic numbers to detect a valid boot image.
Definition: BootImage.h:47
BootSegment
Memory segment.
Definition: BootImage.h:109