source: libcaca/trunk/build-kernel @ 4320

Last change on this file since 4320 was 4317, checked in by Sam Hocevar, 11 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
RevLine 
[568]1#! /bin/sh
2
[4155]3##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@zoy.org>
[573]4##  $Id: build-kernel 4317 2010-02-07 00:22:31Z sam $
[568]5
6set -x
7set -e
8
[4317]9MYCFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
[568]10
[4317]11./configure --enable-kernel --disable-doc --host i386
[568]12
[4155]13# Compile cacademo, leave it as an object
[573]14cd caca && make && cd ..
[4155]15cd examples && make dithering.o && cd ..
[568]16
[4155]17cd kernel
[573]18
[4155]19# Bootsector
20nasm -f bin -o bootsect.bin boot/bootsect.asm
21# Interruption handlers
[4317]22nasm -f elf -o int.o boot/int.asm
[568]23
[4155]24##### Boot (x86)
25# Stage2, loads GDT, PIC, IDT, interrupts, then calls kmain()
[4317]26gcc $MYCFLAGS boot/stage2.c -c
[4155]27# GDT installation, called by stage2
[4317]28gcc $MYCFLAGS boot/gdt.c -c
[4155]29# PIC installation, called by stage2
[4317]30gcc $MYCFLAGS boot/pic.c -c
[4155]31# IDT installation, called by stage2
[4317]32gcc $MYCFLAGS boot/idt.c -c
[4155]33# Interruptions installation, called by stage2
[4317]34gcc $MYCFLAGS boot/interruptions.c -c
[568]35
[4317]36##### Drivers
[4155]37# Floppy driver
[4317]38gcc $MYCFLAGS drivers/floppy.c -c
[4155]39# Processor driver
[4317]40gcc $MYCFLAGS drivers/processor.c -c
[4155]41# Keyboard handler
[4317]42gcc $MYCFLAGS drivers/keyboard.c -c
[4155]43# Memory driver
[4317]44gcc $MYCFLAGS drivers/memory.c -c
[4155]45# Programmable Interval Timer driver
[4317]46gcc $MYCFLAGS drivers/timer.c -c
[573]47
[4155]48# Minimalistic libc
[4317]49gcc $MYCFLAGS klibc.c -c
[4155]50
51# Kernel by itself, contains cmain() which calls main()
[4317]52gcc $MYCFLAGS kernel.c -c
[4155]53
54# Link everything but bootsector, kernel.o MUST be at the very end
[4317]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
[4155]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
[4219]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.