source: libcaca/trunk/build-kernel @ 4235

Last change on this file since 4235 was 4219, checked in by Sam Hocevar, 10 years ago

Clean up files generated by build-kernel in make clean.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#! /bin/sh
2
3##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@zoy.org>
4##  $Id: build-kernel 4219 2010-01-03 02:54:17Z sam $
5
6set -x
7set -e
8
9CFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
10LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
11
12./configure --disable-slang --disable-ncurses --disable-win32 \
13            --disable-conio --disable-x11 --disable-gl --disable-network \
14            --enable-vga --disable-imlib2 --disable-doc \
15            --host i386
16
17# Compile cacademo, leave it as an object
18cd caca && make && cd ..
19cd examples && make dithering.o && cd ..
20
21
22cd kernel
23
24# Bootsector
25nasm -f bin -o bootsect.bin boot/bootsect.asm
26# Interruption handlers
27nasm -f elf -o int.o boot/int.asm
28
29##### Boot (x86)
30# Stage2, loads GDT, PIC, IDT, interrupts, then calls kmain()
31gcc $CFLAGS boot/stage2.c -c
32# GDT installation, called by stage2
33gcc $CFLAGS boot/gdt.c -c
34# PIC installation, called by stage2
35gcc $CFLAGS boot/pic.c -c
36# IDT installation, called by stage2
37gcc $CFLAGS boot/idt.c -c
38# Interruptions installation, called by stage2
39gcc $CFLAGS boot/interruptions.c -c
40
41##### Drivers
42# Floppy driver
43gcc $CFLAGS drivers/floppy.c -c
44# Processor driver
45gcc $CFLAGS drivers/processor.c -c
46# Keyboard handler
47gcc $CFLAGS drivers/keyboard.c -c
48# Memory driver
49gcc $CFLAGS drivers/memory.c -c
50# Programmable Interval Timer driver
51gcc $CFLAGS drivers/timer.c -c
52
53# Minimalistic libc
54gcc $CFLAGS klibc.c -c
55
56# Kernel by itself, contains cmain() which calls main()
57gcc $CFLAGS kernel.c -c
58
59# Link everything but bootsector, kernel.o MUST be at the very end
60ld --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
61   
62ls -ail kern.bin
63cd ..
64
65# Copy bootsector at the very beginning of the floppy (first sector/512 bytes of the image), then kernel right after
66cat kernel/bootsect.bin  kernel/kern.bin /dev/zero | dd of=cacademo.img bs=512 count=2500
67
Note: See TracBrowser for help on using the repository browser.