File: build-kernel

package info (click to toggle)
libcaca 0.99.beta19-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 7,312 kB
  • sloc: ansic: 22,346; python: 2,316; cs: 1,213; cpp: 1,114; java: 916; objc: 836; makefile: 606; sh: 457; ruby: 193; asm: 65
file content (61 lines) | stat: -rwxr-xr-x 1,809 bytes parent folder | download | duplicates (5)
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
#! /bin/sh

##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@hocevar.net>

set -x
set -e

MYCFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"

./configure --enable-kernel --disable-doc --host i386

# Compile cacademo, leave it as an object
cd caca && make && cd ..
cd examples && make dithering.o && cd ..

cd kernel

# Bootsector
nasm -f bin -o bootsect.bin boot/bootsect.asm
# Interruption handlers
nasm -f elf -o int.o boot/int.asm

##### Boot (x86)
# Stage2, loads GDT, PIC, IDT, interrupts, then calls kmain()
gcc $MYCFLAGS boot/stage2.c -c
# GDT installation, called by stage2
gcc $MYCFLAGS boot/gdt.c -c
# PIC installation, called by stage2
gcc $MYCFLAGS boot/pic.c -c
# IDT installation, called by stage2
gcc $MYCFLAGS boot/idt.c -c
# Interruptions installation, called by stage2
gcc $MYCFLAGS boot/interruptions.c -c

##### Drivers
# Floppy driver
gcc $MYCFLAGS drivers/floppy.c -c
# Processor driver
gcc $MYCFLAGS drivers/processor.c -c
# Keyboard handler
gcc $MYCFLAGS drivers/keyboard.c -c
# Memory driver
gcc $MYCFLAGS drivers/memory.c -c
# Programmable Interval Timer driver
gcc $MYCFLAGS drivers/timer.c -c

# Minimalistic libc
gcc $MYCFLAGS klibc.c -c

# Kernel by itself, contains cmain() which calls main()
gcc $MYCFLAGS kernel.c -c

# Link everything but bootsector, kernel.o MUST be at the very end
ld --oformat binary -Ttext 1000 stage2.o gdt.o pic.o int.o idt.o interruptions.o keyboard.o memory.o timer.o floppy.o processor.o klibc.o kernel.o ../caca/.libs/libcaca.a -Map kernel.map    -o kern.bin

ls -ail kern.bin
cd ..

# Copy bootsector at the very beginning of the floppy (first sector/512 bytes of the image), then kernel right after
cat kernel/bootsect.bin  kernel/kern.bin /dev/zero | dd of=cacademo.img bs=512 count=2500