Changeset 4155


Ignore:
Timestamp:
12/20/09 14:36:15 (3 years ago)
Author:
jylam
Message:
  • Forgot kernel build script
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/build-kernel

    r4148 r4155  
    11#! /bin/sh 
    22 
    3 ##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@hocevar.net> 
     3##  Kernel-mode libcaca compilation script -- Sam Hocevar <sam@zoy.org> 
    44##  $Id$ 
    55 
     
    77set -e 
    88 
    9 CFLAGS="-fno-builtin -O2 -I. -I.. -I../caca/ -Wall" 
    10 CPPFLAGS="-D__KERNEL__ -nostdinc -include kernel/kernel.h" 
     9CFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32" 
    1110LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000" 
    1211 
    1312./configure --disable-slang --disable-ncurses --disable-win32 \ 
    14             --disable-conio --disable-x11 --disable-gl --disable-network \ 
    15             --enable-vga --disable-imlib2 --disable-doc \ 
    16             --host i386 
     13                    --disable-conio --disable-x11 --disable-gl --disable-network \ 
     14                    --enable-vga --disable-imlib2 --disable-doc \ 
     15                    --host i386 
    1716 
    18 # We need this. 
    19 make clean 
     17# Compile cacademo, leave it as an object 
     18cd caca && make && cd .. 
     19cd examples && make dithering.o && cd .. 
    2020 
    21 cd caca && make && cd .. 
    2221 
    23 cd src && make cacademo.o && cd .. 
     22cd kernel 
    2423 
    25 cd kernel && 
    26     gcc $CFLAGS -c multiboot.S -o multiboot.o && 
    27     gcc $CFLAGS $CPPFLAGS -c kernel.c -o kernel.o && 
     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 -Map kernel.map ../caca/.libs/libcaca.a   -o kern.bin  
     61    
     62ls -ail kern.bin 
    2863cd .. 
    2964 
    30 gcc $LDFLAGS -o src/cacademo kernel/multiboot.o kernel/kernel.o src/cacademo.o caca/.libs/libcaca.a 
    31  
    32 objcopy -O binary src/cacademo cacademo.boot 
    33  
    34 # For further development: create floppy images using the kernel 
    35 gcc -traditional -c -o bootsect.o kernel/bootsect.S 
    36 ld -Ttext 0x0 -s --oformat binary bootsect.o -o cacademo.img 
    37  
     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 
Note: See TracChangeset for help on using the changeset viewer.