FreeNOS
|
Create system boot image. More...
#include <BootImageCreate.h>
Public Member Functions | |
BootImageCreate (int argc, char **argv) | |
Constructor. More... | |
virtual | ~BootImageCreate () |
Destructor. More... | |
virtual Result | exec () |
Execute the application. More... | |
Public Member Functions inherited from Application | |
Application (int argc, char **argv) | |
Class constructor. More... | |
virtual | ~Application () |
Class destructor. More... | |
virtual int | run () |
Run the application. More... | |
Protected Member Functions | |
virtual Result | output (const char *string) const |
Print text to output. More... | |
Protected Member Functions inherited from Application | |
virtual Result | initialize () |
Initialize the application. More... | |
virtual Result | output (String &string) const |
Print string to output. More... | |
ArgumentParser & | parser () |
Get program arguments parser. More... | |
const ArgumentParser & | parser () const |
Get constant program arguments parser. More... | |
const ArgumentContainer & | arguments () const |
Get program arguments. More... | |
void | setVersion (const String &version) |
Set program version. More... | |
Private Member Functions | |
Size | readBootSymbols (const char *file, const char *prefix, Vector< BootEntry * > *entries) |
Read boot symbols using a configuration file. More... | |
Static Private Attributes | |
static const Size | PageSize = 4096U |
Size of memory pages as supported by this program. More... | |
Additional Inherited Members | |
Public Types inherited from Application | |
enum | Result { Success, NotFound, IOError, InvalidArgument, ShowUsage, TimedOut, OutOfMemory } |
Result codes. More... | |
Protected Attributes inherited from Application | |
int | m_argc |
Input argument count. More... | |
char ** | m_argv |
Input argument values. More... | |
Create system boot image.
Definition at line 55 of file BootImageCreate.h.
BootImageCreate::BootImageCreate | ( | int | argc, |
char ** | argv | ||
) |
Constructor.
Definition at line 29 of file BootImageCreate.cpp.
References Application::parser(), ArgumentParser::registerFlag(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().
|
virtual |
Destructor.
Definition at line 38 of file BootImageCreate.cpp.
|
virtual |
Execute the application.
Implements Application.
Definition at line 193 of file BootImageCreate.cpp.
References Application::arguments(), BOOTIMAGE_MAGIC0, BOOTIMAGE_MAGIC1, BOOTIMAGE_NAMELEN, BOOTIMAGE_REVISION, BootImage::bootImageSize, Vector< T >::count(), BootSymbol::entry, errno, fclose(), fopen(), fwrite(), ArgumentContainer::get(), Application::IOError, BootImage::layoutRevision, BootImage::magic, memset(), ArgumentParser::name(), NULL, BootSegment::offset, PageSize, Application::parser(), readBootSymbols(), SEEK_SET, BootSymbol::segmentsCount, BootSymbol::segmentsOffset, BootImage::segmentsTableCount, BootImage::segmentsTableOffset, BootSymbol::segmentsTotalSize, BootSegment::size, strerror(), strncpy(), Application::Success, BootImage::symbolTableCount, BootImage::symbolTableOffset, BootSymbol::type, and BootSegment::virtualAddress.
|
protectedvirtual |
Print text to output.
string | Text to print to program output. |
Implements Application.
Definition at line 42 of file BootImageCreate.cpp.
References printf(), and Application::Success.
|
private |
Read boot symbols using a configuration file.
file | Name of the boot configuration file. |
prefix | Prefix each entry from the config file with the given path or NULL |
entries | Pointer to Vector with BootEntry's |
Definition at line 48 of file BootImageCreate.cpp.
References BootData, BOOTENTRY_MAX_REGIONS, BOOTIMAGE_NAMELEN, BootPrivProgram, BootProgram, entry, ExecutableFormat::entry(), errno, exit(), EXIT_FAILURE, fclose(), ExecutableFormat::find(), fopen(), fread(), Vector< T >::insert(), ArgumentParser::name(), NULL, Application::parser(), PATH_MAX, printf(), Memory::Readable, ExecutableFormat::regions(), snprintf(), stat::st_size, stat(), strerror(), strlen(), strncmp(), strncpy(), ExecutableFormat::Success, Memory::User, and Memory::Writable.
Referenced by exec().
|
staticprivate |
Size of memory pages as supported by this program.
Definition at line 60 of file BootImageCreate.h.
Referenced by exec().