Browse Source

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

tags/v0.99.beta17
Sam Hocevar sam 15 years ago
parent
commit
561a13ee5e
4 changed files with 50 additions and 38 deletions
  1. +18
    -23
      build-kernel
  2. +1
    -1
      build-win32
  3. +26
    -13
      configure.ac
  4. +5
    -1
      kernel/klibc.h

+ 18
- 23
build-kernel View File

@@ -6,59 +6,54 @@
set -x
set -e

CFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000"
MYCFLAGS="-fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"

./configure --disable-slang --disable-ncurses --disable-win32 \
--disable-conio --disable-x11 --disable-gl --disable-network \
--enable-vga --disable-imlib2 --disable-doc \
--host i386
./configure --enable-kernel --disable-doc --host i386

# Compile cacademo, leave it as an object
cd caca && make && cd ..
cd examples && make dithering.o && cd ..


cd kernel

# Bootsector
nasm -f bin -o bootsect.bin boot/bootsect.asm
# Interruption handlers
nasm -f elf -o int.o boot/int.asm
nasm -f elf -o int.o boot/int.asm

##### Boot (x86)
# Stage2, loads GDT, PIC, IDT, interrupts, then calls kmain()
gcc $CFLAGS boot/stage2.c -c
gcc $MYCFLAGS boot/stage2.c -c
# GDT installation, called by stage2
gcc $CFLAGS boot/gdt.c -c
gcc $MYCFLAGS boot/gdt.c -c
# PIC installation, called by stage2
gcc $CFLAGS boot/pic.c -c
gcc $MYCFLAGS boot/pic.c -c
# IDT installation, called by stage2
gcc $CFLAGS boot/idt.c -c
gcc $MYCFLAGS boot/idt.c -c
# Interruptions installation, called by stage2
gcc $CFLAGS boot/interruptions.c -c
gcc $MYCFLAGS boot/interruptions.c -c

##### Drivers
##### Drivers
# Floppy driver
gcc $CFLAGS drivers/floppy.c -c
gcc $MYCFLAGS drivers/floppy.c -c
# Processor driver
gcc $CFLAGS drivers/processor.c -c
gcc $MYCFLAGS drivers/processor.c -c
# Keyboard handler
gcc $CFLAGS drivers/keyboard.c -c
gcc $MYCFLAGS drivers/keyboard.c -c
# Memory driver
gcc $CFLAGS drivers/memory.c -c
gcc $MYCFLAGS drivers/memory.c -c
# Programmable Interval Timer driver
gcc $CFLAGS drivers/timer.c -c
gcc $MYCFLAGS drivers/timer.c -c

# Minimalistic libc
gcc $CFLAGS klibc.c -c
gcc $MYCFLAGS klibc.c -c

# Kernel by itself, contains cmain() which calls main()
gcc $CFLAGS kernel.c -c
gcc $MYCFLAGS kernel.c -c

# Link everything but bootsector, kernel.o MUST be at the very end
ld --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
ld --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
ls -ail kern.bin
cd ..



+ 1
- 1
build-win32 View File

@@ -20,7 +20,7 @@ make distclean || true

cd "${BUILDDIR}"
# Build for win32
"${SRCDIR}/configure" --host=i586-mingw32msvc --prefix=/ --bindir=/bin --libdir=/lib --disable-imlib2 --disable-doc "$@"
"${SRCDIR}/configure" --host=i586-mingw32msvc --prefix=/ --bindir=/bin --libdir=/lib --disable-imlib2 --disable-java --disable-doc "$@"
make pkglibdir=/lib pkgdatadir=/data bindir=/bin
# Install into our private directory
make install DESTDIR="${INSTALLDIR}" pkglibdir=/lib/ pkgdatadir=/ bindir=/bin/


+ 26
- 13
configure.ac View File

@@ -55,6 +55,10 @@ esac
AC_MSG_RESULT($LT_SUFFIX)
AC_SUBST(LT_SUFFIX)

dnl global configuration features
AC_ARG_ENABLE(kernel,
[ --enable-kernel kernel mode (default no)])

dnl output driver features
AC_ARG_ENABLE(slang,
[ --enable-slang slang graphics support (autodetected)])
@@ -71,9 +75,9 @@ AC_ARG_ENABLE(gl,
AC_ARG_ENABLE(cocoa,
[ --enable-cocoa Cocoa support (autodetected)])
AC_ARG_ENABLE(network,
[ --enable-network Network support (autodetected)])
[ --enable-network network support (autodetected)])
AC_ARG_ENABLE(vga,
[ --enable-vga VGA support (default disabled)])
[ --enable-vga VGA support for kernel mode (autodetected)])

dnl language bindings
AC_ARG_ENABLE(csharp,
@@ -103,6 +107,17 @@ AC_ARG_ENABLE(cppunit,
AC_ARG_ENABLE(zzuf,
[ --enable-zzuf use zzuf for fuzzing tests (autodetected)])

ac_cv_my_have_kernel="no"
if test "${enable_kernel}" = "yes"; then
ac_cv_my_have_kernel="yes"
CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/klibc.h -fno-stack-protector"
CCASFLAGS="${CCASFLAGS} -I. -fno-stack-protector"
CFLAGS="${CFLAGS} -fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 -fno-stack-protector"
AC_DEFINE(USE_KERNEL, 1, Define to 1 to activate kernel mode)
fi
AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_kernel}" = "yes")

AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h)
AC_CHECK_FUNCS(signal ioctl snprintf vsnprintf getenv putenv strcasecmp htons)
AC_CHECK_FUNCS(usleep gettimeofday atexit)
@@ -308,16 +323,14 @@ if test "${enable_ncurses}" != "no"; then
fi
fi

if test "${enable_vga}" = "yes"; then
ac_cv_my_have_vga="yes"
CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/klibc.h -fno-stack-protector"
CFLAGS="${CFLAGS} -fno-builtin -O2 -Wall -fno-stack-protector"
CCASFLAGS="${CCASFLAGS} -I. -fno-stack-protector"
LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 -fno-stack-protector"
AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
CACA_DRIVERS="${CACA_DRIVERS} vga"
if test "${enable_vga}" != "no"; then
if test "${ac_cv_my_have_kernel}" = "yes"; then
AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
CACA_DRIVERS="${CACA_DRIVERS} vga"
elif test "${enable_vga}" = "yes"; then
AC_MSG_ERROR([--enable-vga requires --enable-kernel])
fi
fi
AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_vga}" = "yes")

if test "${enable_debug}" = "yes"; then
AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
@@ -358,7 +371,7 @@ AC_SUBST(GL_LIBS)

# How to get the C99 types. See caca/caca_types.h.in for details about
# the CACA_TYPES variable
if test "${ac_cv_my_have_vga}" = "yes"; then
if test "${ac_cv_my_have_kernel}" = "yes"; then
CACA_TYPES=0
else
AC_CHECK_HEADERS(stdint.h,
@@ -412,7 +425,7 @@ AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")

# Build the Java bindings?
ac_cv_my_have_java="no"
if test "${enable_java}" != "no"; then
if test "${enable_java}" != "no" -a "${ac_cv_my_have_kernel}" != "yes"; then
AC_PATH_PROG(JAVAC, javac, no)
AC_PATH_PROG(JAVAH, javah, no)
AC_PATH_PROG(JAR, jar, no)


+ 5
- 1
kernel/klibc.h View File

@@ -1,5 +1,4 @@
/*
* libcaca
* libcaca Colour ASCII-Art library
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
* 2009 Jean-Yves Lamoureux <jylam@lnxscene.org>
@@ -19,6 +18,8 @@
* that must be used when building libcaca and libcaca into a kernel.
*/

#if !defined HAVE_KLIBC_H
#define HAVE_KLIBC_H

/* Various typedefs -- some are x86-specific */
#define CUSTOM_INTTYPES
@@ -146,3 +147,6 @@ unsigned int htonl(unsigned int hostlong);
unsigned short htons(unsigned short hostlong);

void print(char *str);

#endif /* HAVE_KLIBC_H */


Loading…
Cancel
Save