bayou compile fixes

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5468 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2010-04-20 23:04:46 +00:00 committed by Stefan Reinauer
parent bda29314c2
commit 7b769126d0
6 changed files with 2683 additions and 25 deletions

View File

@ -24,9 +24,14 @@ CONFIG_BUILTIN_LAR=y
PBUILDER_CONFIG=bayou.xml
BUILTIN_LAR=builtin.lar
LIBPAYLOAD_DIR := ../libpayload
export src := $(shell pwd)
export obj := $(src)/build
CC=gcc
LIBPAYLOAD_DIR := $(obj)/libpayload
CC?=gcc
STRIP?=strip
OBJCOPY?=objcopy
FFLAGS-y=
FFLAGS-$(CONFIG_BUILTIN_LAR) += -DCONFIG_BUILTIN_LAR
@ -46,22 +51,22 @@ LPCC=$(LIBPAYLOAD_DIR)/bin/lpgcc
bayou.elf: $(OBJECTS-y)
$(LPCC) $(LDFLAGS) -m32 -o $@ $(OBJECTS-y)
@ strip $@
@$(STRIP) $@
builtin-lar.o: $(BUILTIN_LAR)
@ objcopy -I binary -B i386 -O elf32-i386 $(BUILTIN_LAR) $@
@$(OBJCOPY) -I binary -B i386 -O elf32-i386 $(BUILTIN_LAR) $@
builtin.lar: util/pbuilder/pbuilder
@ rm -f $@
@rm -f $@
util/pbuilder/pbuilder -c $(PBUILDER_CONFIG) create $@
util/pbuilder/pbuilder:
make -C util/pbuilder
$(MAKE) -C util/pbuilder
%.o: %.c
$(LPCC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o bayou.elf builtin.lar
make -C util/pbuilder clean
$(MAKE) -C util/pbuilder clean

View File

@ -17,10 +17,11 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
CC=gcc
PBUILDOBJS := config.o create.o show.o main.o
INCLUDES := -Iliblar/
CFLAGS=-Wall -Werror -g
HOSTCXX=g++
HOSTCC=gcc
HOSTCFLAGS=-Wall -Werror -g
all: pbuilder
@ -29,39 +30,39 @@ LZMA_OBJ += lzma/StreamUtils.o lzma/OutBuffer.o lzma/Alloc.o lzma/CRC.o
LZMA_OBJ += lzma/lzma-compress.o
lzma/lzma-compress.o: lzma/minilzma.cc
g++ -o $@ -c -DCOMPACT $<
$(HOSTCXX) -o $@ -c -DCOMPACT $<
lzma/%.o: lzma/C/7zip/Compress/LZMA/%.cpp
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
lzma/%.o: lzma/C/7zip/Compress/LZ/%.cpp
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
lzma/%.o: lzma/C/7zip/Compress/RangeCoder/%.cpp
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
lzma/%.o: lzma/C/7zip/Decompress/%.cpp
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
lzma/%.o: lzma/C/7zip/Common/%.cpp
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
lzma/%.o: lzma/C/Common/%.cpp
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
lzma/%.o: lzma/%.cc
g++ -o $@ -c $<
$(HOSTCXX) -o $@ -c $<
pbuilder: $(PBUILDOBJS) $(LZMA_OBJ) liblar/liblar.a
$(CXX) -o $@ $(PBUILDOBJS) $(LZMA_OBJ) -L ./liblar -llar -lexpat
$(HOSTCXX) -o $@ $(PBUILDOBJS) $(LZMA_OBJ) liblar/liblar.a -lexpat
liblar/liblar.a:
make -C liblar
$(MAKE) -C liblar
%.o: %.c
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
$(HOSTCC) -c $(HOSTCFLAGS) $(INCLUDES) -o $@ $<
clean:
rm -f pbuilder *.o lzma/*.o
make -C liblar clean
$(MAKE) -C liblar clean

View File

@ -66,6 +66,20 @@ static struct {
{NULL},
};
#ifndef __LINUX__
static char *strndup (const char *s, size_t n)
{
size_t len = strlen (s);
len = (len<n)?len:n;
char *cpy = malloc (len + 1);
if (cpy == NULL)
return NULL;
cpy[len] = '\0';
memcpy (cpy, s, len);
return cpy;
}
#endif
static struct pentry *newPayload(struct config *config)
{
struct pentry **tmp, *ret;

View File

@ -17,15 +17,16 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
CC = gcc
HOSTCC = gcc
AR?=ar
LAROBJS = self.o lib.o
CFLAGS = -g -Wall
liblar.a: $(LAROBJS)
ar rc $@ $(LAROBJS)
$(AR) rc $@ $(LAROBJS)
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
$(HOSTCC) -c $(CFLAGS) -o $@ $<
clean:
rm -f liblar.a *.o

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <elf.h>
#include "elf.h"
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>