Solar OS - Formats for building an application
Form or content... does it really matter?
Copyright (c) 2001-2007 Bogdan Valentin Ontanu.
All rights reserved.
Available formats
In how many output formats can one build an application for SOLAR_OS ?
In the current stage of Solar_OS you have the following options:
- Embedded inside the Kernel
- Application in PE format
- Application in Raw Binary format
Applications Embedded inside the kernel
This kind of application has many advantages but it is available only
to the very few that have access to the SOLAR_OS kernel source code.
The advantages of kernel embedded applications
- The code does not have to be position independent.
- Has access to all variables, API and functions
- It is always there, no need to load from HDD or media
- Multiple instances share the very same code
The disadvantages of kernel embedded applications
- Big applications do not fit in Kernel.
- Per instance variables require dynamic allocations.
- Available to original team members only
Applications in PE format
If you intend to run the application from a HDD or other external media
then one option is to build it as a Win32 PE with some specific limitations:
- The PE file must contain relocations.
- The PE must import only SOLAR OS API.
- PE sections must be 4K aligned virtually
and at least 512 bytes aligned in file (standard PE without any tweaks)
At runtime the PE loader inside SOLAR OS will load, map, relocate
and resolve the imported SOLAR_OS API.
The advantages of building as PE
- The code does not have to be position independent.
- The application size can be as big as available memory
- Most assemblers/compilers can generate PE files
- This is usually the only option if you want to use C, C++ or other
high level languages
The disadvantages of building as PE
- The code size will be bigger for simple applications
- Multiple instances might not share the same code.
- Starting an applications does require some intermediate steps
(load, map, run) and the presence of HDD or other storage media
Application in Raw Binary format
One hardcore option is to have the sample compiled as a pure binary.
If you want to build it as a binary and still launch/run it from the HDD
then you will have to add extra code in order to handle position independent code
and resolve API functions at runtime.
The advantages of building as Binary
- The code will be very small.
- Multiple instances can share the same code
The disadvantages of building as Binary
- The code must be position independent
- You must solve API addresses yourself.