1. WrmOS: build system

2. WrmOS: configuration →

Contents
1.1 Overview
1.2 Configuration
1.3 Build options
1.4 Building
1.5 Building of external project

1.1 Overview [up]


WrmOS has make based building system. It allows easy to modify the build system to fit your needs.

WrmOS contains the next directories:

mk/ Makefiles.
cfg/ Configuration files. This directory contains project configurations that describe target system parameters, building parameters, toolchain path, kernel parameters, list of target applications, alpha config and other. See configuration clause for detail.
lib/ Libraries. Each library has own directory. It contents C/C++ sources, header-files, and Makefile to build library. Some libraries may contents header-files only.
krn/ Kernel sources. It includes kernel common part and arch part.
app/ Applications. Each application has own directory. It contents C/C++ sources, header-files, and Makefile to build application.
ldr/ Bootloader. Content bootloader sources and Makefile to generate RAMFS image.


During building the following steps are taken:

  1. Read configuration files
  2. Generate C-headers with configuration parameters
  3. Build libraries
  4. Build kernel
  5. Build applications
  6. Create RAMFS image containing kernel, Alpha configuration file and applications
  7. Build bootloader containing startup code and RAMFS image
make-param-P --> cfg/prj/project-name.prj --> build-system
                               ↑  ↑  ↑          ↓
   cfg/plt/platform-name.plt --+  |  |          +--> environment variables
   cfg/alph/alpha-config.alph ----+  |          +--> generate configuration h-file
   cfg/base.cfg ---------------------+          +--> build libraries
                                                +--> build kernel
                                                +--> build applications
                                                +--> build RAMFS with alpha config and ELFs
                                                +--> build bootloader with RAMFS image

1.2 Configuration [up]


Project parameters can be specified in cfg/prj/project-file-name.prj. Project parameters include:

  • target system parameters (CPU, memory, base system devices, system clock frequency, ...);
  • libraries build parameters (debug flags);
  • kernel build parameters (debug flags, UART, timer, MMU);
  • application build parameters (debug flags);
  • applications list;
  • Alpha run-time configuration.

See configuration clause for detail.

1.3 Build options [up]


Build options are command line or shell environment variables. Generally build starts by such command:

make build P=cfg/prj/hello-qemu-x86.prj B=../build/hello-qemu-x86 -j

Build system support the next options:

target mandatory can be build, clean or rebuild (clean & build)
P=project-file-name.prj mandatory specifies project file
B=build-dir-name mandatory specifies build directory, all build files will be here
E=external-project-dir-name optional specifies external project directory, it is using for external projects (see below)
V=0|1 optional verbose flag, may be 0 or 1, allows hide detail of building (V=0, by default) or print it (V=1)
-j optional make parameter, allows to do parallel building and make it faster

1.4 Building [up]


Before building need to create project configuration file. See configuration clause for detail. Also may be used predefined demo WrmOS projects — "hello" and "console".

Build starts by command:

make build P=cfg/prj/hello-qemu-x86.prj B=../build/hello-qemu-x86 -j

Intermediate build files (generated headers, objects, ELFs) will be in build directory that was specified. The main building result is bootloader executable file:

../build/hello-qemu-x86/ldr/bootloader.elf

or bootloader disk image:

../build/hello-qemu-x86/ldr/bootloader.img

This file may be loaded on target board or run on QEMU virtual machine:

qemu-system-i386 -display none -serial stdio -drive \
    format=raw,file=$(realpath ../build/hello-qemu-x86/ldr/bootloader.img)

1.5 Building of external project [up]


In previous clause was described how to build example preconfigured project Hello for architecture x86. In this example was used files (configuration, libraries, applications) from WrmOS directory. For real project need to create own configuration, libraries and applications. To do not modify original WrmOS directory there is ability to build external projects.

For this need to create external directory such is describing below:

ext-project-dir -+- cfg -+- prj --+- ext-proj-file.prj
                 |       +- plt --+- ext-plat-file.plt
                 |       +- alph -+- ext-alph-file.alph
                 |
                 +- lib -+- ext-lib-name-1
                 |       +- ext-lib-name-2
                 |       +- ext-lib-name-...
                 |
                 +- app -+- ext-app-name-1
                         +- ext-app-name-2
                         +- ext-app-name-...

and to specify building option E=<ext-project-dir> while run building:

make build P=<ext-project-dir>/cfg/prj/hello-qemu-x86.prj \
    B=../build/hello-qemu-x86 E=<ext-project-dir> -j

In this case build system will use configuration, libraries and applications from <ext-project-dir>. If original WrmOS directory is containing libraries and applications with same name as <ext-project-dir>, build system will use instance from <ext-project-dir>. This allows to override original WrmOS instances.

See additional information in the article Simplest project Hello World.

2. WrmOS: configuration →