some dependencies fixes.

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



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@132 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-02-26 13:59:35 +00:00
commit 6b86ee6c96
11 changed files with 137 additions and 82 deletions

View file

@ -79,6 +79,8 @@ all: prepare prepare2 $(obj)/linuxbios.rom
MAINBOARDDIR=$(shell echo $(CONFIG_MAINBOARD_NAME))
include lib/Makefile
include device/Makefile
include console/Makefile
include arch/$(ARCH)/Makefile
include mainboard/$(MAINBOARDDIR)/Makefile
endif

View file

@ -21,3 +21,6 @@
config ARCH_X86
boolean
config CAR_TYPE_I586
boolean

View file

@ -18,6 +18,8 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
ifeq ($(CONFIG_ARCH_X86),y)
INITCFLAGS := $(CFLAGS) -I$(src)/include/cpu/generic/x86 -I$(src)/include \
-fno-builtin
@ -44,16 +46,16 @@ $(obj)/linuxbios.rom: $(patsubst %,$(obj)/%,$(LINUXBIOS_COMPONENTS))
#
$(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 payload
$(Q)echo "Building LinuxBIOS archive... "
$(Q)printf "Building LinuxBIOS archive... \n"
$(Q)rm -rf $(obj)/lar.tmp
$(Q)mkdir $(obj)/lar.tmp
$(Q)mkdir $(obj)/lar.tmp/normal
$(Q)cp $(obj)/linuxbios.initram $(obj)/lar.tmp/normal/initram
$(Q)cp $(obj)/linuxbios.stage2 $(obj)/lar.tmp/normal/stage2
$(Q)cp $(PAYLOAD) $(obj)/lar.tmp/normal/payload
$(Q)echo -n " "
$(Q)printf " "
$(Q)cd $(obj)/lar.tmp && ../util/lar/lar c ../linuxbios.lar.pre normal/initram normal/stage2 normal/payload
$(Q)# TODO: Dynamically pad the LAR archive. bs is image size - bootblock size (8k)
$(Q)# TODO: Dynamically pad the LAR archive. bs is image size - bootblock size (16k)
$(Q)dd if=$(obj)/linuxbios.lar.pre of=$(obj)/linuxbios.lar \
bs=245760 count=1 conv=sync $(SILENT)
@ -64,47 +66,36 @@ $(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/l
# initram module and the various stages and payload files.
#
$(obj)/stage0.init:
$(Q)echo -n "Building stage0.init... "
$(Q)# Building asm stub
$(Q)$(CC) -E $(LINUXBIOSINCLUDE) $(src)/arch/x86/stage0_i586.S \
-o $(obj)/stage0_i586.s -DBOOTBLK=0x1f00 -DRESRVED=0xf0 \
-DDATE=\"`date +%Y/%m/%d`\"
$(Q)$(AS) $(obj)/stage0_i586.s -o $(obj)/stage0_i586.o
$(Q)# Building cachemain
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/cachemain.c \
-o $(obj)/cachemain.o
STAGE0_CONSOLE_OBJ = $(obj)/vtxprintf.o $(obj)/vsprintf.o
STAGE0_LIB_OBJ = $(obj)/uart8250.o $(obj)/mem.o $(obj)/elfboot.o \
$(obj)/lar.o
STAGE0_ARCH_X86_OBJ = $(obj)/cachemain.o $(obj)/console.o $(obj)/serial.o \
$(obj)/archelfboot.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/lar.c -o $(obj)/lar.o
$(Q)# console lib
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/console.c -o $(obj)/console.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/serial.c -o $(obj)/serial.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/archelfboot.c -o $(obj)/archelfboot.o $(SILENT)
$(Q)$(CC) $(INITCFLAGS) -c $(src)/console/vtxprintf.c -o $(obj)/vtxprintf.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/console/vsprintf.c -o $(obj)/vsprintf.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/uart8250.c -o $(obj)/uart8250.o
$(Q)# other lib parts
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/elfboot.c -o $(obj)/elfboot.o $(SILENT)
$(Q)cd $(obj); $(CC) -m32 -nostdlib -static \
-T $(src)/arch/x86/ldscript.ld cachemain.o \
console.o uart8250.o serial.o archelfboot.o vtxprintf.o \
vsprintf.o lar.o elfboot.o mem.o stage0_i586.o -o stage0.o
ifeq ($(CONFIG_CAR_TYPE_I586),y)
STAGE0_CAR_OBJ = $(obj)/stage0_i586.o
else
STAGE0_CAR_OBJ = $(obj)/stage0_i586.o
endif
$(Q)objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init.pre
STAGE0_OBJ := $(STAGE0_CONSOLE_OBJ) $(STAGE0_LIB_OBJ) $(STAGE0_ARCH_X86_OBJ) $(STAGE0_CAR_OBJ)
$(Q)# Pad boot block to 0x4000 - 0x100.
$(Q)# We will probably remove this step -- not needed if we continue
$(Q)# with ldscript.ld.
$(obj)/stage0.init: $(STAGE0_OBJ)
$(Q)printf "Building stage0.init... "
$(Q)dd if=$(obj)/stage0.init.pre of=$(obj)/stage0.init \
bs=16128 conv=sync $(SILENT)
$(Q)# echo "Len: `wc -c < $(obj)/stage0.init.pre`"
$(Q)# We need to be careful. If stage0.o gets bigger than
$(Q)# 0x4000 - 0x100, we will end up with a 4 gig file.
$(Q)# I wonder if that behavior is on purpose.
$(Q)test `wc -c < $(obj)/stage0.init.pre` -gt 16128 && echo "Error. Bootblock got too big" || true
$(Q)echo "done"
$(Q)$(CC) -nostdlib -static -T $(src)/arch/x86/ldscript.ld \
$(STAGE0_OBJ) -o $(obj)/stage0.o
$(Q)objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init
$(Q)test `wc -c < $(obj)/stage0.init` -gt 16128 && \
printf "Error. Bootblock got too big.\n" || true
$(Q)printf "done\n"
#
@ -115,32 +106,24 @@ $(obj)/stage0.init:
# TODO: This should be compressed with the default compressor.
#
$(obj)/linuxbios.stage2: $(obj)/stage0.init $(obj)/statictree.o
$(Q)echo -n "Building linuxbios.stage2... "
$(Q)# main
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/archtables.c -o $(obj)/archtables.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/linuxbios_table.c -o $(obj)/linuxbios_table.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/device/device.c -o $(obj)/device.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/device/device_util.c -o $(obj)/device_util.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/device/root_device.c -o $(obj)/root_device.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/clog2.c -o $(obj)/clog2.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/malloc.c -o $(obj)/malloc.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/stage2.c -o $(obj)/stage2.o
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/tables.c -o $(obj)/tables.o
$(Q)$(CC) $(INITCFLAGS) -c -I$(src) $(obj)/statictree.c -o $(obj)/statictree.o
$(Q)$(CC) $(INITCFLAGS) -c mainboard/$(MAINBOARDDIR)/mainboard.c -o $(obj)/mainboard.o
STAGE2_LIB_OBJ = $(obj)/clog2.o $(obj)/mem.o $(obj)/malloc.o \
$(obj)/stage2.o #$(obj)/tables.o
STAGE2_DEVICE_OBJ = $(obj)/device.o $(obj)/device_util.o \
$(obj)/root_device.o
STAGE2_ARCH_X86_OBJ = $(obj)/archtables.o (obj)/linuxbios_table.o
STAGE2_MAINBOARD_OBJ = $(obj)/mainboard.o
STAGE2_DYNAMIC_OBJ = $(obj)/statictree.o
STAGE2_OBJ := $(STAGE2_LIB_OBJ) $(STAGE2_DEVICE_OBJ) $(STAGE2_ARCH_X86_OBJ)
STAGE2_OBJ += $(STAGE2_MAINBOARD_OBJ) $(STAGE2_DYNAMIC_OBJ)
$(obj)/linuxbios.stage2: $(obj)/stage0.init $(STAGE2_OBJ)
$(Q)printf "Building linuxbios.stage2... "
$(Q)# leave a .o with full symbols in it for debugging.
$(Q)cd $(obj); $(LD) -R $(obj)/stage0.o -Ttext 0x1000 \
--entry=stage2 -o $(obj)/linuxbios.stage2.o \
archtables.o linuxbios_table.o device.o device_util.o root_device.o \
clog2.o mem.o malloc.o mainboard.o stage2.o tables.o\
statictree.o
$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x1000 --entry=stage2 \
-o $(obj)/linuxbios.stage2.o $(STAGE2_OBJ)
$(Q)objcopy -O binary $(obj)/linuxbios.stage2.o $(obj)/linuxbios.stage2
$(Q)chmod 644 $(obj)/linuxbios.stage2
$(Q)echo "done"
$(Q)printf "done\n"
#
# The payload as we love it. Get it from somewhere.
@ -151,5 +134,22 @@ $(obj)/linuxbios.stage2: $(obj)/stage0.init $(obj)/statictree.o
#
payload:
$(Q)echo "Building payload... skipped"
$(Q)printf "Building payload... skipped\n"
# build rules
#
$(obj)/%.o: $(src)/arch/x86/%.c
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
$(obj)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
# Building asm stub
$(obj)/stage0%.o: $(src)/arch/x86/stage0%.S
$(Q)$(CC) -E $(LINUXBIOSINCLUDE) $< \
-o $(obj)/stage0_asm.s -DBOOTBLK=0x1f00 -DRESRVED=0xf0 \
-DDATE=\"`date +%Y/%m/%d`\"
$(Q)$(AS) $(obj)/stage0_asm.s -o $@
endif

View file

@ -73,7 +73,7 @@ int elf_check_arch(Elf_ehdr *ehdr)
*/
void jmp_to_elf_entry(void *entry)
{
int (*v)() = entry;
int (*v)(void) = entry;
v();
}

23
console/Makefile Normal file
View file

@ -0,0 +1,23 @@
##
## This file is part of the LinuxBIOS project.
##
## Copyright (C) 2007 coresystems GmbH
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## 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
##
$(obj)/%.o: $(src)/console/%.c
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@

23
device/Makefile Normal file
View file

@ -0,0 +1,23 @@
##
## This file is part of the LinuxBIOS project.
##
## Copyright (C) 2007 coresystems GmbH
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## 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
##
$(obj)/%.o: $(src)/device/%.c
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@

View file

@ -34,5 +34,6 @@ endif
lzma:
$(Q)echo "Building lzma... skipped"
$(obj)/%.o: $(src)/lib/%.c
$(Q)$(CC) $(INITCFLAGS) -c $< -o $@

View file

@ -89,11 +89,9 @@ static int load_elf_segments(struct lb_memory *mem,unsigned char *header, int he
ehdr = (Elf_ehdr *)header;
phdr = (Elf_phdr *)(&header[ehdr->e_phoff]);
struct segment *ptr;
int i;
int size;
for(i = 0; i < headers; i++) {
struct segment *new;
/* Ignore data that I don't need to handle */
if (phdr[i].p_type != PT_LOAD) {
printk(BIOS_DEBUG, "Dropping non PT_LOAD segment\n");
@ -138,8 +136,6 @@ int elfload(struct lb_memory *mem, unsigned char *header, unsigned long header_s
{
Elf_ehdr *ehdr;
void *entry;
void (*v)(void);
struct verify_callback *cb_chain;
ehdr = (Elf_ehdr *)header;
entry = (void *)(ehdr->e_entry);

View file

@ -5,11 +5,13 @@ choice
config BOARD_EMULATION_QEMU_X86
bool "x86 QEMU"
select ARCH_X86
select CAR_TYPE_I586
help
x86 QEMU variant.
config EMULATION_QEMU_POWERPC
config BOARD_EMULATION_QEMU_POWERPC
bool "PowerPC QEMU"
select ARCH_POWERPC
help
PowerPC QEMU variant.

View file

@ -36,17 +36,14 @@ $(obj)/linuxbios.vpd:
# directory and is built from what was auto.c in v2.
#
$(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o
$(Q)echo -n "Building linuxbios.initram... "
$(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o $(obj)/initram.o
$(Q)printf "Building linuxbios.initram... "
$(Q)# initram links against stage0
$(Q)$(CC) $(INITCFLAGS) -c $(src)/mainboard/$(MAINBOARDDIR)/initram.c \
-o $(obj)/initram.o
$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x80000 $(obj)/initram.o \
$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x80000 $(obj)/initram.o \
--entry=main -o $(obj)/linuxbios.initram.o
$(Q)objcopy -O binary $(obj)/linuxbios.initram.o \
$(obj)/linuxbios.initram
$(Q)chmod 644 $(obj)/linuxbios.initram
$(Q)echo "done"
$(Q)printf "done\n"
#
# Miscellaneous important targets.
@ -60,3 +57,4 @@ $(obj)/statictree.o: $(obj)/statictree.c
$(obj)/statictree.c: mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts >$(obj)/statictree.c 2>/dev/null

View file

@ -18,7 +18,14 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
#
# This stuff is always needed
include util/lar/Makefile
include util/dtc/Makefile
include util/kconfig/Makefile
#
# Compressors
include util/nrv2b/Makefile
include util/lzma/Makefile