diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2008-03-24 15:47:49 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2008-03-24 15:47:49 +0000 |
commit | 2216d1b46a86fd5beb20a8e99f176f28c527e0ec (patch) | |
tree | 502b194aa5e728f03099a44c453b92dbe16e56f6 /payloads/coreinfo/Makefile | |
parent | 0bfb5c4fb2a8626ccc6f663d1c8ca8e88f6d6666 (diff) |
Add a recent kconfig version to coreinfo, in order to make the
supported features configurable later (currently unused). Store all
build files and results (coreinfo.elf) in build/ now.
I'm self-acking this as (though non-"trivial") it doesn't affect coreinfo
in its functionality, this is more or less a "cosmetic" change to the
build interface ("make" -> "make menuconfig && make").
This is a kconfig checkout from the Linux kernel (where kconfig is being
actively maintained) from 03/2008. The hash identifying the last commit
to kconfig is 587c90616a5b44e6ccfac38e64d4fecee51d588c.
The amount of changes to kconfig itself has been kept as small as possible
to keep the diff small and to ease updating/porting to newer kconfig versions.
The following changes were performed on the upstream Linux kconfig:
- s/kernel/coreinfo/, and s/Linux/coreinfo/ in various strings.
- Consistently use the env. variable KERNELVERSION in all kconfig
interfaces -- e.g. config/menuconfig/gconfig/xconfig -- as version number.
- Hardcode our paths/filenames in some places (could be improved upstream).
- Always write .config and build/config.h, no matter which kconfig
interface is used (config/menuconfig/gconfig/xconfig). We want to
include build/config.h in our code.
- Adapt the kconfig Makefile for our purposes (build/ directory, rules, etc).
In addition, a few items in the coreinfo Makefile are needed for this to work.
This kconfig setup is successfully tested with all targets from 'make help':
config - Update current config utilising a line-oriented program
menuconfig - Update current config utilising a menu based program
xconfig - Update current config utilising a QT based front-end
gconfig - Update current config utilising a GTK based front-end
oldconfig - Update current config utilising a provided .config as base
silentoldconfig - Same as oldconfig, but quietly
randconfig - New config with random answer to all options
defconfig - New config with default answer to all options
allmodconfig - New config selecting modules when possible
allyesconfig - New config where all options are accepted with yes
allnoconfig - New config where all options are answered with no
For 'make defconfig' to work you have to do (which we don't need in coreinfo):
$ mkdir configs; touch configs/defconfig
You can also use 'make foo_defconfig' in which case kconfig will use a
file called 'configs/foo_defconfig' as basis.
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3188 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/coreinfo/Makefile')
-rw-r--r-- | payloads/coreinfo/Makefile | 86 |
1 files changed, 70 insertions, 16 deletions
diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile index 5b3852b877..c3f102e836 100644 --- a/payloads/coreinfo/Makefile +++ b/payloads/coreinfo/Makefile @@ -2,6 +2,7 @@ ## This file is part of the coreinfo project. ## ## Copyright (C) 2008 Advanced Micro Devices, Inc. +## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de> ## ## 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 @@ -17,32 +18,85 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -CC = gcc -CROSS_CFLAGS = -m32 +export src := $(shell pwd) +export srctree := $(src) +export srck := $(src)/util/kconfig +export obj := $(src)/build +export objk := $(src)/build/util/kconfig + +export KERNELVERSION := 0.1.0 +export KCONFIG_AUTOHEADER := $(obj)/config.h +export KCONFIG_AUTOCONFIG := $(obj)/auto.conf + +CONFIG_SHELL := sh +KBUILD_DEFCONFIG := configs/defconfig +UNAME_RELEASE := $(shell uname -r) +HAVE_DOTCONFIG := $(wildcard .config) +MAKEFLAGS += -rR --no-print-directory + +# Make is silent per default, but 'make V=1' will show all compiler calls. +ifneq ($(V),1) +Q := @ +endif -INCLUDES = -I../libpayload/include -INCLUDES += -I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | head -n 1 | cut -d' ' -f2)include +HOSTCC = gcc +HOSTCXX = g++ +HOSTCFLAGS := -I$(srck) -I$(objk) +HOSTCXXFLAGS := -I$(srck) -I$(objk) +CC = gcc +CROSS_CFLAGS = -m32 +INCLUDES = -I../libpayload/include \ + -I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | \ + head -n 1 | cut -d' ' -f2)include LIBPAYLOAD = ../libpayload/libpayload.a LIBGCC := $(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name) CFLAGS := -Wall -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES) - -MODULES = cpuinfo_module.o cpuid.o pci_module.o coreboot_module.o +MODULES = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o OBJECTS = coreinfo.o -TARGET = coreinfo.elf +OBJS = $(patsubst %,$(obj)/%,$(OBJECTS)) $(patsubst %,$(obj)/%,$(MODULES)) +TARGET = $(obj)/coreinfo.elf + +ifeq ($(strip $(HAVE_DOTCONFIG)),) + +all: + $(Q)printf "Please run make config/menuconfig/xconfig/gconfig first.\n" + +else + +include $(src)/.config all: $(TARGET) +$(TARGET): $(OBJS) + $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" + $(Q)#ld --verbose -T ../libpayload/libpayload.ldscript -o $@ $(OBJS) \ + #--whole-archive $(LIBPAYLOAD) --no-whole-archive $(LIBGCC) + $(Q)ld -T ../libpayload/libpayload.ldscript -o $@ $(OBJS) \ + ../libpayload/i386/head.o $(LIBPAYLOAD) $(LIBGCC) + $(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n" + $(Q)strip -s $@ + +$(obj)/%.S.o: $(src)/%.S + $(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n" + $(Q)$(AS) --32 -o $@ $< + +$(obj)/%.o: $(src)/%.c + $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" + $(Q)$(CC) $(CROSS_CFLAGS) $(CFLAGS) -c -o $@ $< + +endif + +prepare: + $(Q)mkdir -p $(obj)/util/kconfig/lxdialog + clean: - @rm -f $(TARGET) $(MODULES) $(OBJECTS) + $(Q)rm -rf build + +distclean: clean + $(Q)rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* -$(TARGET): $(OBJECTS) $(MODULES) - @#ld --verbose -T ../libpayload/libpayload.ldscript -o $@ $(OBJECTS) --whole-archive $(LIBPAYLOAD) --no-whole-archive $(LIBGCC) - ld -T ../libpayload/libpayload.ldscript -o $@ $(OBJECTS) $(MODULES) ../libpayload/i386/head.o $(LIBPAYLOAD) $(LIBGCC) - @strip $@ +include util/kconfig/Makefile -.S.o: - $(AS) --32 -o $@ $< +.PHONY: $(PHONY) prepare clean distclean -.c.o: - $(CC) $(CROSS_CFLAGS) $(CFLAGS) -c -o $@ $< |