Skip to content

Commit 81c3028

Browse files
committed
Add infos about compilation
1 parent 9a8fd38 commit 81c3028

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Chapter-4/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,26 @@ int strncmp( const char* s1, const char* s2, int c );
3030

3131
These functions are defined in [string.cc](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/runtime/string.cc), [memory.cc](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/runtime/memory.cc), [itoa.cc](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/runtime/itoa.cc)
3232

33+
#### Compile our kernel
34+
35+
Compiling a kernel is not the same thing as compile a linux executable, we can't use standard library and need no dependencies to the system.
36+
37+
Our [Makefile](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/Makefile) will define the process to compile and link our kernel.
38+
39+
For x86 architecture, the followings arguments will be used for gcc/g++/ld:
40+
41+
```
42+
# Linker
43+
LD=ld
44+
LDFLAG= -melf_i386 -static -L ./ -T ./arch/$(ARCH)/linker.ld
45+
46+
# C++ compiler
47+
SC=g++
48+
FLAG= $(INCDIR) -g -O2 -w -trigraphs -fno-builtin -fno-exceptions -fno-stack-protector -O0 -m32 -fno-rtti -nostdlib -nodefaultlibs
49+
50+
# Assembly compiler
51+
ASM=nasm
52+
ASMFLAG=-f elf -o
53+
```
54+
55+

0 commit comments

Comments
 (0)