summaryrefslogtreecommitdiffstats
path: root/BUILD.md
blob: 6ff42557e8ecbef78a2a96fa8016a5be2384ed94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
## Requirements

1. Compiler toolset chose in the toolchain file
    * GCC cross compiler toolchain (arch-elf-tool - i686-elf-g++ for compiler)

    To build and install from source refer to the [documentation](https://gcc.gnu.org/install)

    * Clang cross compiler toolchain
    Clang support cross compile out the box.

    You can download *clang* from your package manager.

    Using *apt*:

    ```bash
    apt-get update && apt-get install clang
    ```

    Using *pacman*:

    ```bash
    pacman -Sy clang
    ```

    Or build from source consider the [documentation](https://clang.llvm.org/get_started.html)

2. Nasm compiler (for x86 only)

    To download from package manager.

    Using *apt*

    ```bash
    apt-get update && apt-get install nasm
    ```

    Using *pacman*

    ```bash
    pacman -Sy nasm
    ```

3. Grub bootloader (only it is currently supported)

    It is reccommended to build grub from source configured target as chose
architecture.

    To build grub from source refer to the
    [documentation](https://www.gnu.org/software/grub/manual/grub/html_node/Obtaining-and-Building-GRUB.html)

## Kernel configuration
You can configure kernel using cmake -D<var>:<type>=<value> option. All cmake build-in options are supported.

### Options
#### Objective project relative options

**IS_BIND_FEATURES_TO_BUILD**:BOOL

    Check run matches features dependencies with the objective project toolset
    (it is a compiler and architecture).

#### Features module relative options

**FEATURES_SUSPEND**:BOOL

    All cmake feature module functions are suppress and print the warning about
    it is suspend.

## Build instructions

### On your host environment
```
cmake -DCMAKE_TOOLCHAIN_FILE=<FILE> -D<OPTION>=<VALUE> -B build
cmake --build build
# Create iso file using *grub-mkrescue*
# Assume GRUB configured and built to a chose architecture
mkdir -p iso/os
cp build/Objective iso/os
grub-mkrescue -o build/kernel.iso iso
```

After you can create virtual machine or using emulator to run kernel.
For qemu and x86 architecture:
```bash
qemu-system-i386 -cdrom build/kernel.iso
```