* drop objdir/srcdir

* seperate vsprintf to a seperate file as it was in v2.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@83 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-02-23 09:20:15 +00:00
parent 6a6535b204
commit ef81173a39
5 changed files with 70 additions and 35 deletions

View file

@ -34,10 +34,8 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
have_dotconfig := $(wildcard .config)
srcdir:=$(shell pwd)
src:=$(srcdir)
objdir:=$(shell pwd)/lbobj
obj:=$(objdir)
src:=$(shell pwd)
obj:=$(shell pwd)/lbobj
# Do not print "Entering directory ..."
@ -59,7 +57,7 @@ LINUXBIOSINCLUDE := -I$(src) -Iinclude \
CPPFLAGS := $(LINUXBIOSINCLUDE)
export srcdir src objdir obj KERNELVERSION
export src obj KERNELVERSION
ifeq ($(strip $(have_dotconfig)),)
all:
@ -80,14 +78,14 @@ MAINBOARDDIR=$(shell echo $(CONFIG_MAINBOARD_NAME))
prepare:
@mkdir -p $(objdir)
@mkdir -p $(obj)
prepare2:
@cp $(src)/.tmpconfig.h $(obj)/config.h
clean:
@echo "Cleaning up..."
rm -rf $(objdir)
rm -rf $(obj)
%.o: %.c

View file

@ -18,9 +18,6 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
obj:=$(objdir)
src:=$(srcdir)
$(obj)/linuxbios.rom: $(obj)/linuxbios.lar $(obj)/stage0.init $(obj)/linuxbios.vpd
@cat $(obj)/linuxbios.lar \
$(obj)/linuxbios.vpd \
@ -66,8 +63,10 @@ $(obj)/linuxbios.stage2: $(obj)/stage0.init $(obj)/statictree.o
$(Q)$(CC) $(INITCFLAGS) -c mainboard/$(MAINBOARDDIR)/mainboard.c -o $(obj)/mainboard.o
# leave a .o with full symbols in it for debugging.
$(Q)cd $(obj); $(LD) -R stage0.o -Ttext 0x0 stage2.o \
-o $(obj)/linuxbios.stage2.o device.o device_util.o mem.o malloc.o clog2.o mainboard.o statictree.o
$(Q)cd $(obj); $(LD) -R $(obj)/stage0.o -Ttext 0x0 \
-o $(obj)/linuxbios.stage2.o stage2.o device.o \
device_util.o mem.o malloc.o clog2.o mainboard.o \
statictree.o
objcopy -O binary $(obj)/linuxbios.stage2.o $(obj)/linuxbios.stage2
$(Q)chmod 644 $(obj)/linuxbios.stage2
@ -119,12 +118,13 @@ $(obj)/stage0.init:
@$(CC) $(INITCFLAGS) -c $(src)/arch/x86/console.c -o $(obj)/console.o
@$(CC) $(INITCFLAGS) -c $(src)/arch/x86/serial.c -o $(obj)/serial.o
@$(CC) $(INITCFLAGS) -c $(src)/console/vtxprintf.c -o $(obj)/vtxprintf.o
@$(CC) $(INITCFLAGS) -c $(src)/console/vsprintf.c -o $(obj)/vsprintf.o
@$(CC) $(INITCFLAGS) -c $(src)/lib/uart8250.c -o $(obj)/uart8250.o
# other lib parts
@$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o
@cd $(obj); $(CC) -m32 -nostdlib -static -T $(src)/arch/x86/ldscript.ld cachemain.o console.o uart8250.o \
serial.o vtxprintf.o lar.o mem.o stage0_i586.o -o stage0.o
serial.o vtxprintf.o vsprintf.o lar.o mem.o stage0_i586.o -o stage0.o
@objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init.pre
# Pad boot block to 0x2000 - 0x100

59
console/vsprintf.c Normal file
View file

@ -0,0 +1,59 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* linux/lib/vsprintf.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
/*
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <stdarg.h>
#include <string.h>
int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args);
/* FIXME this global makes vsprintf non-reentrant */
static char *str_buf;
static void str_tx_byte(unsigned char byte)
{
*str_buf = byte;
str_buf++;
}
int vsprintf(char * buf, const char *fmt, va_list args)
{
int i;
str_buf = buf;
i = vtxprintf(str_tx_byte, fmt, args);
*str_buf = '\0';
return i;
}
int sprintf(char * buf, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i=vsprintf(buf,fmt,args);
va_end(args);
return i;
}

View file

@ -307,23 +307,3 @@ int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args
return count;
}
/* very gross simple thing that is non-reentrant. This should not matter though. */
static unsigned char *ssp;
static void stxbyte(unsigned char byte)
{
*ssp++ = byte;
}
int sprintf(char *str, const char *format, ...)
{
va_list args;
int i;
ssp = (unsigned char *) str;
va_start(args, format);
i = vtxprintf(stxbyte, format, args);
va_end(args);
return i;
}

View file

@ -24,8 +24,6 @@ SOURCE := lar.c create.c extract.c list.c lib.c
HOSTCC=gcc
HOSTCFLAGS=-O2 -Wall -W
obj:=$(objdir)
$(obj)/util/lar/lar: $(patsubst %,$(src)/util/lar/%,$(SOURCE))
@mkdir -p $(obj)/util/lar
@$(HOSTCC) $(HOSTCFLAGS) -o $@ $^