source: libcaca/trunk/build-kernel @ 4328

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

Move some configuration stuff from build-kernel into configure.ac.

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