source: libcaca/trunk/build-kernel @ 4304

Last change on this file since 4304 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
RevLine 
[568]1#! /bin/sh
2
[4155]3##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@zoy.org>
[573]4##  $Id: build-kernel 4219 2010-01-03 02:54:17Z sam $
[568]5
6set -x
7set -e
8
[4155]9CFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
[568]10LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
11
[4219]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
[568]16
[4155]17# Compile cacademo, leave it as an object
[573]18cd caca && make && cd ..
[4155]19cd examples && make dithering.o && cd ..
[568]20
21
[4155]22cd kernel
[573]23
[4155]24# Bootsector
25nasm -f bin -o bootsect.bin boot/bootsect.asm
26# Interruption handlers
27nasm -f elf -o int.o boot/int.asm
[568]28
[4155]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
[568]40
[4155]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
[573]52
[4155]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
[4160]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
[4155]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
[4219]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.