Index: trunk/i386/libsaio/console.c =================================================================== --- trunk/i386/libsaio/console.c (revision 890) +++ trunk/i386/libsaio/console.c (revision 891) @@ -71,15 +71,16 @@ char * last_str; }; -static void sputc(int c, struct putc_info * pi) +static int sputc(int c, struct putc_info * pi) { if (pi->last_str) if (pi->str == pi->last_str) { *(pi->str) = '\0'; - return; + return 0; } *(pi->str)++ = c; + return c; } void initBooterLog(void) @@ -123,20 +124,22 @@ /* * write one character to console */ -void putchar(int c) +int putchar(int c) { if ( c == '\t' ) { - for (c = 0; c < 8; c++) putc(' '); - return; + for (c = 0; c < 8; c++) bios_putchar(' '); + return c; } if ( c == '\n' ) { - putc('\r'); + bios_putchar('\r'); } - putc(c); + bios_putchar(c); + + return c; } int getc() Index: trunk/i386/libsaio/biosfn.c =================================================================== --- trunk/i386/libsaio/biosfn.c (revision 890) +++ trunk/i386/libsaio/biosfn.c (revision 891) @@ -446,7 +446,7 @@ return bb.eax.r.h; } -void putc(int ch) +void bios_putchar(int ch) { bb.intno = 0x10; bb.ebx.r.h = 0x00; /* background black */ Index: trunk/i386/libsaio/saio_internal.h =================================================================== --- trunk/i386/libsaio/saio_internal.h (revision 890) +++ trunk/i386/libsaio/saio_internal.h (revision 891) @@ -47,7 +47,7 @@ extern int ebioswrite(int dev, long sec, int count); extern int get_drive_info(int drive, struct driveInfo *dp); extern int ebiosEjectMedia(int biosdev); -extern void putc(int ch); +extern void bios_putchar(int ch); extern void putca(int ch, int attr, int repeat); extern int getc(void); extern void pause(); @@ -91,7 +91,7 @@ extern bool gErrors; extern void initBooterLog(void); extern void setupBooterLog(void); -extern void putchar(int ch); +extern int putchar(int ch); extern int getchar(void); extern void msglog(const char * format, ...); extern int printf(const char *format, ...); Index: trunk/i386/boot2/graphics.c =================================================================== --- trunk/i386/boot2/graphics.c (revision 890) +++ trunk/i386/boot2/graphics.c (revision 891) @@ -1209,8 +1209,8 @@ { currentIndicator = 0; } - putc(indicator[currentIndicator++]); - putc('\b'); + putchar(indicator[currentIndicator++]); + putchar('\b'); } } @@ -1219,8 +1219,8 @@ { if ( getVideoMode() == VGA_TEXT_MODE ) { - putc(' '); - putc('\b'); + putchar(' '); + putchar('\b'); } } Index: trunk/i386/boot2/Makefile =================================================================== --- trunk/i386/boot2/Makefile (revision 890) +++ trunk/i386/boot2/Makefile (revision 891) @@ -7,6 +7,8 @@ IMGSKELROOT = $(SRCROOT)/imgskel CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot +VPATH = $(SYMROOT) + # Makefile for i386 boot program # define FLOPPY and SMALL using DEFINES macro as necessary @@ -41,7 +43,7 @@ # The ordering is important; # boot2.o must be first. OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o \ - ramdisk.o picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o modules_support.o + ramdisk.o picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o modules_support.o boot_modules.o # button.o browser.o scrollbar.o == NOTYET UTILDIR = ../util @@ -61,7 +63,6 @@ PATCH_ADDR = $(shell echo ${SYMBOL_ADDR}-${DATA_ADDR}+${DATA_OFFSET} | bc) - all: $(DIRS_NEEDED) boot ifeq (${CONFIG_EMBED_THEME}, y) @@ -76,9 +77,9 @@ endif @echo "\t[LD] boot.sys" - @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ - -nostdlib -arch i386 -Wl,-segalign,20 \ - -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext + @$(CC) -Wl,-segaddr,__INIT,$(BOOT2ADDR) -Wl,-segalign,20 -Wl,-preload \ + -nostdlib -arch i386 -static \ + -o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) -lcc_kext ifeq (${CONFIG_MODULES}, y) @@ -92,7 +93,7 @@ @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ -nostdlib -arch i386 -Wl,-segalign,20 \ -Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \ - -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext + -o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) -lcc_kext @# Second pass, fixup global var locations @${RM} $(SYMROOT)/${SYMBOLS_MODULE} @@ -106,7 +107,7 @@ @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \ -nostdlib -arch i386 -Wl,-segalign,20 \ -Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \ - -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext + -o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) -lcc_kext @$(LD) -arch i386 \ -undefined dynamic_lookup \ Index: trunk/i386/boot2/gui.c =================================================================== --- trunk/i386/boot2/gui.c (revision 890) +++ trunk/i386/boot2/gui.c (revision 891) @@ -1032,15 +1032,16 @@ char * last_str; }; -static void +static int sputc(int c, struct putc_info * pi) { if (pi->last_str) if (pi->str == pi->last_str) { *(pi->str) = '\0'; - return; + return 0; } *(pi->str)++ = c; + return c; } int gprintf( window_t * window, const char * fmt, ...) Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 890) +++ trunk/i386/boot2/options.c (revision 891) @@ -1486,7 +1486,7 @@ default: if (isxdigit(key & kASCIIKeyMask) && digitsI < 2) { - putc(key & kASCIIKeyMask); + putchar(key & kASCIIKeyMask); digits[digitsI++] = key & kASCIIKeyMask; } else { // TODO: Beep or something Index: trunk/i386/modules/Resolution/Makefile =================================================================== --- trunk/i386/modules/Resolution/Makefile (revision 890) +++ trunk/i386/modules/Resolution/Makefile (revision 891) @@ -1,7 +1,7 @@ MODULE_NAME = Resolution MODULE_VERSION = "1.0.0" MODULE_COMPAT_VERSION = "1.0.0" -MODULE_START = _$(MODULE_NAME)_start +MODULE_START = $(MODULE_NAME)_start MODULE_DEPENDENCIES = @@ -9,41 +9,4 @@ MODULE_OBJS = Resolution.o edid.o 915resolution.o -OPTIM = -Os -Oz -DEBUG = -DNOTHING -#DEBUG = -DDEBUG_HELLO_WORLD=1 -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ - -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ - -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ - -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common - -DEFINES= -CONFIG = hd -INC = -I. -I.. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(BOOT2DIR) -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif -AS = as -LD = ld -# LIBS= -lc_static -LIBS= - -VPATH = $(OBJROOT):$(SYMROOT) - -SFILES = -CFILES = -HFILES = -EXPORTED_HFILES = -INSTALLED_HFILES = -OTHERFILES = Makefile -ALLSRC = $(SFILES) $(CFILES) \ - $(HFILES) $(OTHERFILES) -DIRS_NEEDED = $(OBJROOT) $(SYMROOT) - -all embedtheme optionrom: dylib - include ../MakeInc.dir \ No newline at end of file Index: trunk/i386/modules/MakeInc.dir =================================================================== --- trunk/i386/modules/MakeInc.dir (revision 890) +++ trunk/i386/modules/MakeInc.dir (revision 891) @@ -7,17 +7,30 @@ IMGSKELROOT = $(SRCROOT)/imgskel CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot + +ifeq ($(BUILT_IN),yes) +override OBJROOT = $(SRCROOT)/obj/i386/boot2_modules/$(DIR) +override SYMROOT = $(SRCROOT)/sym/i386/ +endif + include ${SRCROOT}/Make.rules -UTILDIR = ../../util -LIBSADIR = ../../libsa -LIBSAIODIR = ../../libsaio -BOOT2DIR = ../../boot2 +ifeq ($(BUILT_IN),yes) -INC = -I$(SRCROOT)/i386/modules/include/ -Iinclude/ -I$(SRCROOT)/i386/modules/module_includes/ -I$(SRCROOT)/i386/libsaio/ -I$(SRCROOT)/i386/libsa/ -I$(SRCROOT)/i386/include/ -I$(SRCROOT)/i386/boot2/ -DEFINES := -D__KLIBC__ $(DEFINES) +CFLAGS := $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \ + -fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \ + -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ + -march=pentium4 -msse2 -mfpmath=sse -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h + +CPPFLAGS := $(CPPFLAGS) -arch i386 -static -nostdinc++ -Wmost -Werror \ + -fno-builtin -mpreferred-stack-boundary=2 \ + -fno-align-functions -fno-stack-protector \ + -march=pentium4 -msse2 -mfpmath=sse -msoft-float \ + -arch i386 -include $(SRCROOT)/autoconf.h +else + CFLAGS := $(CLFAGS) -nostdinc -Wmost -Werror \ -fno-builtin -mpreferred-stack-boundary=2 \ -fno-align-functions -fno-stack-protector \ @@ -30,18 +43,67 @@ -march=pentium4 -msse2 -mfpmath=sse -msoft-float \ -arch i386 -include $(SRCROOT)/autoconf.h +endif + + +UTILDIR = ../../util +LIBSADIR = ../../libsa +LIBSAIODIR = ../../libsaio +BOOT2DIR = ../../boot2 + +INC = -I$(SRCROOT)/i386/modules/include/ -Iinclude/ -I$(SRCROOT)/i386/modules/module_includes/ -I$(SRCROOT)/i386/libsaio/ -I$(SRCROOT)/i386/libsa/ -I$(SRCROOT)/i386/include/ -I$(SRCROOT)/i386/boot2/ +DEFINES := -D__KLIBC__ $(DEFINES) + MODULE_DEPENDENCIES := $(foreach x,$(MODULE_DEPENDENCIES),-weak_library $(SYMROOT)/modules/$(x).dylib) INSTALLDIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/standalone +##$(error DEFINED AS $(MODULE_DEFINITION)) + +MODULE_DEFINITION := $(CONFIG_$(shell echo $(MODULE_NAME) | tr '[:lower:]' '[:upper:]')_MODULE) + + +ifeq ($(MODULE_DEFINITION),m) +ifneq ($(BUILT_IN),yes) + +# Make this as a *MODULE* +all: dylib + +else +# Module not selected to be compiled as a module +all: + +endif + +else + +ifeq ($(MODULE_DEFINITION),y) +ifeq ($(BUILT_IN),yes) + +# Make this *BUILT IN* +all: ${OBJROOT} ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) $(SYMROOT)/boot_modules.h $(SYMROOT)/boot_modules.c + +else +# Module not selected to be built in +all: + +endif +else + +# Don't compile this module +all: + +endif +endif + dylib: ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) $(SYMROOT)/modules/$(MODULE_NAME).dylib $(SYMROOT)/modules/$(MODULE_NAME).dylib: @echo "\t[LD] $(MODULE_NAME).dylib" @ld -arch i386 \ - -alias $(MODULE_START) start \ + -alias _$(MODULE_START) start \ -dylib -read_only_relocs suppress \ -S -x -Z -dead_strip_dylibs \ -no_uuid \ @@ -75,7 +137,15 @@ +.PHONY: $(SYMROOT)/boot_modules.h +.PHONY: $(SYMROOT)/boot_modules.c +$(SYMROOT)/boot_modules.c: + @echo "\t$(MODULE_START)(); // $(MODULE_NAME)" >> $@ + +$(SYMROOT)/boot_modules.h: + @echo "void $(MODULE_START)(); // $(MODULE_NAME)" >> $@ + + #dependencies -#-include $(OBJROOT)/Makedep - +-include $(OBJROOT)/Makedep \ No newline at end of file Index: trunk/i386/modules/klibc/klibc.c =================================================================== --- trunk/i386/modules/klibc/klibc.c (revision 890) +++ trunk/i386/modules/klibc/klibc.c (revision 891) @@ -12,8 +12,10 @@ { } -void _exit() +void _exit(int status) { + stop("exit() called\n"); + while(1) halt(); // this is never reached } char __toupper(char c) Index: trunk/i386/modules/klibc/Makefile =================================================================== --- trunk/i386/modules/klibc/Makefile (revision 890) +++ trunk/i386/modules/klibc/Makefile (revision 891) @@ -1,7 +1,7 @@ MODULE_NAME = klibc MODULE_VERSION = "1.5.20" MODULE_COMPAT_VERSION = "1.5.20" -MODULE_START = _$(MODULE_NAME)_start +MODULE_START = $(MODULE_NAME)_start MODULE_DEPENDENCIES = DIR = klibc @@ -11,8 +11,8 @@ __lshrdi3.o __moddi3.o __modsi3.o __udivdi3.o \ __udivmoddi4.o __udivmodsi4.o __udivsi3.o \ __umoddi3.o __umodsi3.o \ - strntoumax.o strntoimax.o atoi.o atol.o atoll.o \ - strcasecmp.o strncasecmp.o strdup.o strlcat.o strndup.o strnlen.o \ + strntoumax.o strntoimax.o atol.o atoll.o \ + strcasecmp.o strncasecmp.o strlcat.o strndup.o strnlen.o \ strsep.o strtoimax.o strtok_r.o strtok.o strtol.o strtoll.o strtotimespec.o strtotimeval.o \ strtoul.o strtoull.o strtoumax.o strxspn.o strpbrk.o \ bsearch.o calloc.o \ @@ -21,44 +21,4 @@ qsort.o sha1hash.o onexit.o atexit.o exit.o \ snprintf.o vsnprintf.o sscanf.o vsscanf.o\ -OPTIM = -Os -Oz -DEBUG = -DNOTHING -#DEBUG = -DDEBUG_HELLO_WORLD=1 -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ - -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ - -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ - -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common - -DEFINES= -CONFIG = hd -INC = -I. -I.. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(BOOT2DIR) -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif -AS = as -LD = ld -# LIBS= -lc_static -LIBS= - -VPATH = $(OBJROOT):$(SYMROOT) - - - - -SFILES = -CFILES = -HFILES = -EXPORTED_HFILES = -INSTALLED_HFILES = -OTHERFILES = Makefile -ALLSRC = $(SFILES) $(CFILES) \ - $(HFILES) $(OTHERFILES) -DIRS_NEEDED = $(OBJROOT) $(SYMROOT) - -all embedtheme optionrom: dylib - include ../MakeInc.dir \ No newline at end of file Index: trunk/i386/modules/uClibc++/Makefile =================================================================== --- trunk/i386/modules/uClibc++/Makefile (revision 890) +++ trunk/i386/modules/uClibc++/Makefile (revision 891) @@ -1,8 +1,8 @@ -MODULE_NAME = uClibc++ +MODULE_NAME = uClibcxx MODULE_VERSION = "0.2.2" MODULE_COMPAT_VERSION = "0.2.2" -MODULE_START = _uClibcxx_start +MODULE_START = $(MODULE_NAME)_start MODULE_DEPENDENCIES = klibc DIR = uClibc++ @@ -18,41 +18,4 @@ utility.o valarray.o vector.o support.o \ ios.o iostream.o istream.o ostream.o -OPTIM = -Os -Oz -DEBUG = -DNOTHING -#DEBUG = -DDEBUG_HELLO_WORLD=1 -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ - -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ - -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ - -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common - -DEFINES= -CONFIG = hd -INC = -I. -I.. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(BOOT2DIR) -Iinclude -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif -AS = as -LD = ld -# LIBS= -lc_static -LIBS= - -VPATH = $(OBJROOT):$(SYMROOT) - -SFILES = -CFILES = -HFILES = -EXPORTED_HFILES = -INSTALLED_HFILES = -OTHERFILES = Makefile -ALLSRC = $(SFILES) $(CFILES) \ - $(HFILES) $(OTHERFILES) -DIRS_NEEDED = $(OBJROOT) $(SYMROOT) - -all embedtheme optionrom: dylib - include ../MakeInc.dir \ No newline at end of file Index: trunk/i386/modules/HelloWorld/Makefile =================================================================== --- trunk/i386/modules/HelloWorld/Makefile (revision 890) +++ trunk/i386/modules/HelloWorld/Makefile (revision 891) @@ -1,7 +1,7 @@ MODULE_NAME = HelloWorld MODULE_VERSION = "1.0.0" MODULE_COMPAT_VERSION = "1.0.0" -#MODULE_START = _$(MODULE_NAME)_start +#MODULE_START = $(MODULE_NAME)_start MODULE_START = __Z16HelloWorld_startv MODULE_DEPENDENCIES = uClibc++ @@ -9,35 +9,4 @@ MODULE_OBJS = HelloWorld.o -OPTIM = -Os -Oz -DEBUG = -DNOTHING -#DEBUG = -DDEBUG_HELLO_WORLD=1 -CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \ - -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \ - -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \ - -fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \ - -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \ - -march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common - -DEFINES= -CONFIG = hd -INC = -I. -I.. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(BOOT2DIR) -LIBS= - -VPATH = $(OBJROOT):$(SYMROOT) - - - -SFILES = -CFILES = -HFILES = -EXPORTED_HFILES = -INSTALLED_HFILES = -OTHERFILES = Makefile -ALLSRC = $(SFILES) $(CFILES) \ - $(HFILES) $(OTHERFILES) -DIRS_NEEDED = $(OBJROOT) $(SYMROOT) - -all embedtheme optionrom: dylib - include ../MakeInc.dir \ No newline at end of file Index: trunk/i386/modules/Makefile =================================================================== --- trunk/i386/modules/Makefile (revision 890) +++ trunk/i386/modules/Makefile (revision 891) @@ -11,7 +11,7 @@ include ${SRCROOT}/Make.rules # The order of building is important. -SUBDIRS = klibc uClibc++ Resolution +SUBDIRS = klibc uClibc++ Resolution HelloWorld CFLAGS= -O3 $(MORECPP) -arch i386 -g -static @@ -22,7 +22,7 @@ ifeq (${CONFIG_MODULES}, y) -all install: $(SYMROOT) $(OBJROOT) objroot_dirs +all install: $(SYMROOT) $(OBJROOT) objroot_dirs $(SYMROOT)/boot_modules.c $(SYMROOT)/boot_modules.h @for i in ${SUBDIRS}; \ do \ echo ================= make $@ for $$i =================; \ @@ -37,13 +37,32 @@ "RC_CFLAGS=$(RC_CFLAGS)" $@ \ ) || exit $$?; \ done + + @# Finish up boot_modules.c + @echo "}" >> $(SYMROOT)/boot_modules.c + + else all: endif .PHONY: objroot_dirs +.PHONY: $(SYMROOT)/boot_modules.h +.PHONY: $(SYMROOT)/boot_modules.c + objroot_dirs: @rm -rf module_includes @mkdir module_includes @rm -rf "$(SYMROOT)/modules/" - @mkdir "$(SYMROOT)/modules/" \ No newline at end of file + @mkdir "$(SYMROOT)/modules/" + + +$(SYMROOT)/boot_modules.c: ${OBJROOT} ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) + @echo "// Autogenerated - do not modify" > $@ + @echo "#include \"boot_modules.h\"" >> $@ + @echo "void start_built_in_modules() {" >> $@ + +$(SYMROOT)/boot_modules.h: ${OBJROOT} ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) + @echo "// Autogenerated - do not modify" > $@ + @echo "void start_built_in_modules(); " > $@ + Index: trunk/i386/libsa/libsa.h =================================================================== --- trunk/i386/libsa/libsa.h (revision 890) +++ trunk/i386/libsa/libsa.h (revision 891) @@ -98,7 +98,7 @@ extern char * strstr(const char *in, const char *str); extern int atoi(const char * str); extern int ptol(const char * str); -extern int strlen(const char * str); +extern size_t strlen(const char * str); extern char * strcat(char * s1, const char * s2); extern char * strncat(char * s1, const char * s2, size_t n); extern char * strdup(const char *s1); @@ -128,7 +128,7 @@ /* * prf.c */ -extern void prf(const char * fmt, va_list ap, void (*putfn_p)(), +extern void prf(const char * fmt, va_list ap, int (*putfn_p)(), void * putfn_arg); /* Index: trunk/i386/libsa/printf.c =================================================================== --- trunk/i386/libsa/printf.c (revision 890) +++ trunk/i386/libsa/printf.c (revision 891) @@ -33,15 +33,16 @@ char * last_str; }; -static void +static int sputc(int c, struct putc_info * pi) { if (pi->last_str) if (pi->str == pi->last_str) { *(pi->str) = '\0'; - return; + return 0; } *(pi->str)++ = c; + return c; } /*VARARGS1*/ Index: trunk/i386/libsa/string.c =================================================================== --- trunk/i386/libsa/string.c (revision 890) +++ trunk/i386/libsa/string.c (revision 891) @@ -108,7 +108,7 @@ #define tolower(c) ((int)((c) & ~0x20)) #define toupper(c) ((int)((c) | 0x20)) -int strlen(const char * s) +size_t strlen(const char * s) { int n = 0; while (*s++) n++; Index: trunk/i386/libsa/prf.c =================================================================== --- trunk/i386/libsa/prf.c (revision 890) +++ trunk/i386/libsa/prf.c (revision 891) @@ -93,7 +93,7 @@ void prf( char *fmt, unsigned int *adx, - void (*putfn_p)(), + int (*putfn_p)(), void *putfn_arg ) { Index: trunk/i386/Makefile =================================================================== --- trunk/i386/Makefile (revision 890) +++ trunk/i386/Makefile (revision 891) @@ -1,5 +1,4 @@ # Makefile for i386 boot program -# define FLOPPY and SMALL using DEFINES macro as necessary # # these paths are only valid in subdirectories of this directory @@ -15,13 +14,11 @@ include ${SRCROOT}/Make.rules - -VPATH = $(OBJROOT):$(SYMROOT) - # The order of building is important. SUBDIRS = util libsa libsaio boot0 boot1 boot2 cdboot modules all: + @cd modules; ${MAKE} BUILT_IN=yes all @for i in ${SUBDIRS}; \ do \ echo ================= make $@ for $$i =================; \ Index: trunk/TODO =================================================================== --- trunk/TODO (revision 890) +++ trunk/TODO (revision 891) @@ -1,6 +1,5 @@ TODO List for Chameleon Boot Loader ==================================== -- Setup makefile to use module config for determining which modules to compile in and which to compile as modules - Fix the module system when booting chameleon with multiboot. Cleanup the xcode 4 fix. - Integrate Prasys current work on options and quick shortcut modified version of 18seven Index: trunk/Make.rules =================================================================== --- trunk/Make.rules (revision 890) +++ trunk/Make.rules (revision 891) @@ -88,6 +88,12 @@ -MD -dependency-file $*.d @md -u $(OBJROOT)/Makedep -f -d $*.d +#$(OBJROOT)/boot_modules.o: +# @echo "\t[AS] boot_modules.s" +# @cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $(SYMROOT)/boot_modules.s \ +# -MD -dependency-file $*.d +# @md -u $(OBJROOT)/Makedep -f -d $*.d + $(OBJROOT)/%.o: %.s @echo "\t[AS] $<" Index: trunk/CHANGES =================================================================== --- trunk/CHANGES (revision 890) +++ trunk/CHANGES (revision 891) @@ -1,3 +1,4 @@ +- Modules can now be selected between not compiled, compiled into chameleon, or compiled as modules. - New makefile + configuration system. - Added the BOOT2_MAX_LENGTH constant in memory.h. This is now used in mboot.c to relocate the correct number of bytes for boot2. - Added new ATi/AMD Graphics Card Enabler.