FreeNOS
BootImageCreate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 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 __BIN_IMG_BOOTIMAGECREATE_H
19 #define __BIN_IMG_BOOTIMAGECREATE_H
20 
21 #include <Application.h>
22 #include <ExecutableFormat.h>
23 #include <BootImage.h>
24 
31 #define BOOTENTRY_MAX_REGIONS 16
32 
36 typedef struct BootEntry
37 {
40 
42  u8 *data;
43 
46 
49 }
50 BootEntry;
51 
56 {
57  private:
58 
60  static const Size PageSize = 4096U;
61 
62  public:
63 
70  BootImageCreate(int argc, char **argv);
71 
75  virtual ~BootImageCreate();
76 
82  virtual Result exec();
83 
84  protected:
85 
92  virtual Result output(const char *string) const;
93 
94  private:
95 
105  Size readBootSymbols(const char *file,
106  const char *prefix,
107  Vector<BootEntry *> *entries);
108 };
109 
114 #endif /* __BIN_IMG_BOOTIMAGECREATE_H */
ExecutableFormat.h
ExecutableFormat::Region
Memory region.
Definition: ExecutableFormat.h:55
Application
Generic application.
Definition: Application.h:38
BootImageCreate::output
virtual Result output(const char *string) const
Print text to output.
Definition: BootImageCreate.cpp:42
BootImageCreate::PageSize
static const Size PageSize
Size of memory pages as supported by this program.
Definition: BootImageCreate.h:60
BootImageCreate::exec
virtual Result exec()
Execute the application.
Definition: BootImageCreate.cpp:193
BootEntry
Executable entry for use inside a boot image.
Definition: BootImageCreate.h:36
BootImage.h
BootEntry::regions
ExecutableFormat::Region regions[BOOTENTRY_MAX_REGIONS]
Memory regions for this symbol.
Definition: BootImageCreate.h:45
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Application::Result
Result
Result codes.
Definition: Application.h:53
BOOTENTRY_MAX_REGIONS
#define BOOTENTRY_MAX_REGIONS
Maximum memory regions.
Definition: BootImageCreate.h:31
BootEntry::data
u8 * data
Input data buffer read from the original file.
Definition: BootImageCreate.h:42
BootSymbol
Program embedded in the BootImage.
Definition: BootImage.h:84
BootImageCreate::BootImageCreate
BootImageCreate(int argc, char **argv)
Constructor.
Definition: BootImageCreate.cpp:29
u8
unsigned char u8
Unsigned 8-bit number.
Definition: Types.h:59
BootEntry::symbol
BootSymbol symbol
BootSymbol definition.
Definition: BootImageCreate.h:39
BootImageCreate
Create system boot image.
Definition: BootImageCreate.h:55
BootEntry::numRegions
Size numRegions
Number of memory regions.
Definition: BootImageCreate.h:48
BootEntry
struct BootEntry BootEntry
Executable entry for use inside a boot image.
Vector
Vectors are dynamically resizeable Arrays.
Definition: Vector.h:41
BootImageCreate::~BootImageCreate
virtual ~BootImageCreate()
Destructor.
Definition: BootImageCreate.cpp:38
BootImageCreate::readBootSymbols
Size readBootSymbols(const char *file, const char *prefix, Vector< BootEntry * > *entries)
Read boot symbols using a configuration file.
Definition: BootImageCreate.cpp:48
Application.h