mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
* cleanup/refactor makefiles.
* remove some warnings Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@95 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
0c11caa5e0
commit
281cd76b38
5 changed files with 102 additions and 78 deletions
1
Makefile
1
Makefile
|
@ -75,6 +75,7 @@ all: prepare prepare2 $(obj)/linuxbios.rom
|
||||||
|
|
||||||
MAINBOARDDIR=$(shell echo $(CONFIG_MAINBOARD_NAME))
|
MAINBOARDDIR=$(shell echo $(CONFIG_MAINBOARD_NAME))
|
||||||
|
|
||||||
|
include lib/Makefile
|
||||||
include arch/$(ARCH)/Makefile
|
include arch/$(ARCH)/Makefile
|
||||||
include mainboard/$(MAINBOARDDIR)/Makefile
|
include mainboard/$(MAINBOARDDIR)/Makefile
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -18,68 +18,30 @@
|
||||||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
##
|
##
|
||||||
|
|
||||||
|
INITCFLAGS := $(CFLAGS) -I$(src)/include/cpu/generic/x86 -I$(src)/include \
|
||||||
|
-fno-builtin
|
||||||
|
|
||||||
SILENT := &> /dev/null
|
SILENT := &> /dev/null
|
||||||
|
|
||||||
$(obj)/linuxbios.rom: $(obj)/linuxbios.lar $(obj)/stage0.init $(obj)/linuxbios.vpd
|
# Build the final ROM image
|
||||||
$(Q)cat $(obj)/linuxbios.lar \
|
|
||||||
$(obj)/linuxbios.vpd \
|
|
||||||
$(obj)/stage0.init > \
|
|
||||||
$(obj)/linuxbios.rom
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# This part takes care of compression. It should build the compression modules
|
# These are the main linuxbios components. Do not change the order unless you
|
||||||
# in a way that they can be put in the lar. FIXME it belongs in lib/
|
# know exactly what you are doing.
|
||||||
#
|
#
|
||||||
|
|
||||||
lzma:
|
LINUXBIOS_COMPONENTS := linuxbios.lar linuxbios.vpd stage0.init
|
||||||
$(Q)echo "Building lzma... skipped"
|
|
||||||
|
$(obj)/linuxbios.rom: $(patsubst %,$(obj)/%,$(LINUXBIOS_COMPONENTS))
|
||||||
|
$(Q)cat $^ > $@
|
||||||
|
|
||||||
#
|
#
|
||||||
# this is the rest of linuxbios (v2: linuxbios_ram.rom)
|
# LinuxBIOS v3 is completely modular and based on a very small startup
|
||||||
# Is this maybe platform independent, except for the "drivers"?
|
# code (stage0) plus a LAR archive. The LAR archive may contain any number
|
||||||
# Where should it be built?
|
# of stages, payloads and option roms.
|
||||||
#
|
#
|
||||||
# This needs to be compressed with the default compressor
|
# Build the LAR archive:
|
||||||
#
|
#
|
||||||
|
|
||||||
$(obj)/linuxbios.stage2: $(obj)/stage0.init $(obj)/statictree.o
|
|
||||||
$(Q)echo "Building linuxbios.stage2"
|
|
||||||
#
|
|
||||||
# main
|
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/stage2.c -o $(obj)/stage2.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/mem.c -o $(obj)/mem.o
|
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/malloc.c -o $(obj)/malloc.o
|
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/clog2.c -o $(obj)/clog2.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
|
|
||||||
|
|
||||||
# leave a .o with full symbols in it for debugging.
|
|
||||||
$(Q)cd $(obj); $(LD) -R $(obj)/stage0.o -Ttext 0x1000 \
|
|
||||||
-o $(obj)/linuxbios.stage2.o stage2.o device.o \
|
|
||||||
device_util.o root_device.o mem.o malloc.o clog2.o mainboard.o \
|
|
||||||
statictree.o
|
|
||||||
$(Q)objcopy -O binary $(obj)/linuxbios.stage2.o $(obj)/linuxbios.stage2
|
|
||||||
|
|
||||||
$(Q)chmod 644 $(obj)/linuxbios.stage2
|
|
||||||
|
|
||||||
#
|
|
||||||
# The payload as we love it. Get it from somewhere.
|
|
||||||
# Is this a place to incorporate buildrom?
|
|
||||||
#
|
|
||||||
# This needs to be compressed with the default compressor
|
|
||||||
#
|
|
||||||
|
|
||||||
payload:
|
|
||||||
$(Q)echo "Building payload... skipped"
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# build the lar archive
|
|
||||||
#
|
|
||||||
|
|
||||||
$(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 payload
|
$(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 payload
|
||||||
$(Q)echo "Building LinuxBIOS archive..."
|
$(Q)echo "Building LinuxBIOS archive..."
|
||||||
$(Q)rm -rf $(obj)/lar.tmp
|
$(Q)rm -rf $(obj)/lar.tmp
|
||||||
|
@ -93,42 +55,92 @@ $(obj)/linuxbios.lar: $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/l
|
||||||
bs=253952 count=1 conv=sync $(SILENT)
|
bs=253952 count=1 conv=sync $(SILENT)
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# this is going to be the enable car code, lar parser and such:
|
|
||||||
#
|
|
||||||
|
|
||||||
INITCFLAGS := $(CFLAGS) -I$(src)/include/cpu/generic/x86 -I$(src)/include -fno-builtin
|
#
|
||||||
|
# LinuxBIOS stage0. This is the LinuxBIOS "boot block code".
|
||||||
|
# It enables Cache-as-RAM and parses the LAR archive for an
|
||||||
|
# initram module and the various stages and payload files.
|
||||||
|
#
|
||||||
|
|
||||||
$(obj)/stage0.init:
|
$(obj)/stage0.init:
|
||||||
$(Q)echo Building linuxbios.init
|
$(Q)echo "Building stage0.init"
|
||||||
# Building asm stub
|
$(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)$(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)$(AS) $(obj)/stage0_i586.s -o $(obj)/stage0_i586.o
|
||||||
# Building cachemain
|
$(Q)# Building cachemain
|
||||||
$(CC) $(INITCFLAGS) -c $(src)/arch/x86/cachemain.c -o $(obj)/cachemain.o
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/cachemain.c -o $(obj)/cachemain.o
|
||||||
#
|
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/lar.c -o $(obj)/lar.o
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/lar.c -o $(obj)/lar.o
|
||||||
#
|
|
||||||
# console lib
|
$(Q)# console lib
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/arch/x86/console.c -o $(obj)/console.o
|
$(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/serial.c -o $(obj)/serial.o
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/console/vtxprintf.c -o $(obj)/vtxprintf.o
|
$(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)/console/vsprintf.c -o $(obj)/vsprintf.o
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/uart8250.c -o $(obj)/uart8250.o
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/uart8250.c -o $(obj)/uart8250.o
|
||||||
# other lib parts
|
$(Q)# other lib parts
|
||||||
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/mem.c -o $(obj)/mem.o
|
||||||
|
|
||||||
$(Q)cd $(obj); $(CC) -m32 -nostdlib -static -T $(src)/arch/x86/ldscript.ld cachemain.o console.o uart8250.o \
|
$(Q)cd $(obj); $(CC) -m32 -nostdlib -static \
|
||||||
serial.o vtxprintf.o vsprintf.o lar.o mem.o stage0_i586.o -o stage0.o
|
-T $(src)/arch/x86/ldscript.ld cachemain.o \
|
||||||
|
console.o uart8250.o serial.o vtxprintf.o \
|
||||||
|
vsprintf.o lar.o mem.o stage0_i586.o -o stage0.o
|
||||||
|
|
||||||
$(Q)objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init.pre
|
$(Q)objcopy -O binary $(obj)/stage0.o $(obj)/stage0.init.pre
|
||||||
|
|
||||||
# Pad boot block to 0x2000 - 0x100
|
# Pad boot block to 0x2000 - 0x100
|
||||||
# we will probably remove this step -- not needed if we continue with ldscript.ld
|
# we will probably remove this step -- not needed if we continue with ldscript.ld
|
||||||
$(Q)dd if=$(obj)/stage0.init.pre of=$(obj)/stage0.init bs=7936 conv=sync
|
$(Q)dd if=$(obj)/stage0.init.pre of=$(obj)/stage0.init \
|
||||||
|
bs=7936 conv=sync $(SILENT)
|
||||||
$(Q)echo "Len: `wc -c < $(obj)/stage0.init.pre`"
|
$(Q)echo "Len: `wc -c < $(obj)/stage0.init.pre`"
|
||||||
#
|
|
||||||
$(Q)test `wc -c < $(obj)/stage0.init.pre` -gt 7936 && echo "Error. Bootblock got too big" || true
|
$(Q)test `wc -c < $(obj)/stage0.init.pre` -gt 7936 && echo "Error. Bootblock got too big" || true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is the rest of linuxbios (v2: linuxbios_ram.rom)
|
||||||
|
# Is this maybe platform independent, except for the "drivers"?
|
||||||
|
# Where should it be built, maybe in device/ ?
|
||||||
|
#
|
||||||
|
# TODO: This should be compressed with the default compressor
|
||||||
|
#
|
||||||
|
|
||||||
|
$(obj)/linuxbios.stage2: $(obj)/stage0.init $(obj)/statictree.o
|
||||||
|
$(Q)echo "Building linuxbios.stage2"
|
||||||
|
$(Q)# main
|
||||||
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/stage2.c -o $(obj)/stage2.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/mem.c -o $(obj)/mem.o
|
||||||
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/malloc.c -o $(obj)/malloc.o
|
||||||
|
$(Q)$(CC) $(INITCFLAGS) -c $(src)/lib/clog2.c -o $(obj)/clog2.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
|
||||||
|
|
||||||
|
$(Q)# leave a .o with full symbols in it for debugging.
|
||||||
|
$(Q)cd $(obj); $(LD) -R $(obj)/stage0.o -Ttext 0x1000 \
|
||||||
|
-o $(obj)/linuxbios.stage2.o stage2.o device.o \
|
||||||
|
device_util.o root_device.o mem.o malloc.o clog2.o mainboard.o \
|
||||||
|
statictree.o
|
||||||
|
$(Q)objcopy -O binary $(obj)/linuxbios.stage2.o $(obj)/linuxbios.stage2
|
||||||
|
|
||||||
|
$(Q)chmod 644 $(obj)/linuxbios.stage2
|
||||||
|
|
||||||
|
#
|
||||||
|
# The payload as we love it. Get it from somewhere.
|
||||||
|
# Is this a place to incorporate buildrom?
|
||||||
|
#
|
||||||
|
# TODO: This is not implemented yet.
|
||||||
|
# TODO: This needs to be compressed with the default compressor
|
||||||
|
#
|
||||||
|
|
||||||
|
payload:
|
||||||
|
$(Q)echo "Building payload... skipped"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
19
lib/Makefile
19
lib/Makefile
|
@ -18,6 +18,21 @@
|
||||||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
##
|
##
|
||||||
|
|
||||||
compressors-$(CONFIG_COMPRESSION_LZMA) += lzma.o
|
COMPRESSORS :=
|
||||||
compressors-$(CONFIG_COMPRESSION_NRV2B) += nrv2b.o
|
ifdef $(CONFIG_COMPRESSION_LZMA)
|
||||||
|
COMPRESSORS += lzma.o
|
||||||
|
endif
|
||||||
|
ifdef $(CONFIG_COMPRESSION_NRV2B)
|
||||||
|
COMPRESSORS += nrv2b.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
# This part takes care of compression. It should build the compression modules
|
||||||
|
# in a way that they can be put in the lar.
|
||||||
|
#
|
||||||
|
|
||||||
|
lzma:
|
||||||
|
$(Q)echo "Building lzma... skipped"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
#include <arch/types.h>
|
#include <arch/types.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <console/loglevel.h>
|
#include <console/loglevel.h>
|
||||||
|
#include <console/console.h>
|
||||||
|
|
||||||
int printk(int msg_level, const char *fmt, ...);
|
int printk(int msg_level, const char *fmt, ...);
|
||||||
void die(const char *msg);
|
void die(const char *msg);
|
||||||
static void post_code(u8 value);
|
void post_code(u8 value);
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
@ -35,8 +35,4 @@ int main(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void post_code(u8 value)
|
|
||||||
{
|
|
||||||
outb(value, 0x80);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ $(obj)/lex.yy.c: $(src)/util/dtc/dtc-lexer.l
|
||||||
$(obj)/dtc.o: $(src)/util/dtc/dtc.c
|
$(obj)/dtc.o: $(src)/util/dtc/dtc.c
|
||||||
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
||||||
$(obj)/livetree.o: $(src)/util/dtc/livetree.c
|
$(obj)/livetree.o: $(src)/util/dtc/livetree.c
|
||||||
$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
||||||
$(obj)/flattree.o: $(src)/util/dtc/flattree.c
|
$(obj)/flattree.o: $(src)/util/dtc/flattree.c
|
||||||
$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
||||||
$(obj)/data.o: $(src)/util/dtc/data.c
|
$(obj)/data.o: $(src)/util/dtc/data.c
|
||||||
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
$(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
|
||||||
$(obj)/treesource.o: $(src)/util/dtc/treesource.c
|
$(obj)/treesource.o: $(src)/util/dtc/treesource.c
|
||||||
|
|
Loading…
Add table
Reference in a new issue