[LinuxBIOS] [PATCH] [v3] create map files, clean up

Uwe Hermann uwe at hermann-uwe.de
Mon Jul 23 11:54:36 CEST 2007


On Sun, Jul 22, 2007 at 05:47:41PM +0200, Stefan Reinauer wrote:
> * move post_code() to a seperate file
> * statically link linuxbios.initram for now (depends on printk, post_code
>   and die)
> * greatly simplify all makefiles by creating a global Rules.make
> * use $(dir $@) in Makefiles instead of absolute paths for mkdir.. 
> * clean up Makefiles by calling components' code locally instead of in the
>   Makefile. (Remember: one day, no code per mainboard)
> * unconditionally create .xcompile in case it changed
> * add NM to xcompile
> * create $(obj)/linuxbios.map with all symbols of all stages
 

> +# These are possibly not permanent
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/console.o
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/vtxprintf.o
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/uart8250.o
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/arch/x86/post_code.o

INITRAM_OBJ := $(obj)/lib/console.o $(obj)/lib/vtxprintf.o \
	       $(obj)/lib/uart8250.o $(obj)/arch/x86/post_code.o

(is a bit shorter)


> +# These are possibly not permanent
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/console.o
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/vtxprintf.o
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/uart8250.o
> +INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/arch/x86/post_code.o

See above (there are multiple occurenceѕ of this).


> Index: device/Makefile
> ===================================================================
> --- device/Makefile	(revision 462)
> +++ device/Makefile	(working copy)
> @@ -20,7 +20,7 @@
>  ##
>  
>  $(obj)/device/%.o: $(src)/device/%.c
> -	$(Q)mkdir -p $(obj)/device
> +	$(Q)mkdir -p $(dir $@)
>  	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
>  	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@

This is for a later patch, but can we have a generic rule for this
kind of thing? So that you only have to say 'FOO_OBJ += foo.o'
in the Makefiles?


> +#
> +# Miscellaneous superio specific build targets!
> +#
> +
> +$(obj)/superio/%.o: $(src)/superio/%.c $(obj)/statictree.h
> +	$(Q)mkdir -p $(dir $@)
> +	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
> +	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
> +
> +#
> +# Miscellaneous northbridge specific build targets!
> +#
> +
> +$(obj)/northbridge/%.o: $(src)/northbridge/%.c $(obj)/statictree.h
> +	$(Q)mkdir -p $(dir $@)
> +	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
> +	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
> +
> +#
> +# Miscellaneous southbridge specific build targets!
> +#
> +
> +$(obj)/southbridge/%.o: $(src)/southbridge/%.c $(obj)/statictree.h
> +	$(Q)mkdir -p $(dir $@)
> +	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
> +	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@

All of the above are almost identical. Can they be merged easily?


> Index: Makefile
> ===================================================================
> --- Makefile	(revision 462)
> +++ Makefile	(working copy)
> @@ -26,7 +26,6 @@
>  SUBLEVEL = 0
>  
>  have_dotconfig := $(wildcard .config)
> -have_dotxcompile := $(wildcard .xcompile)
>  
>  src := $(shell pwd)
>  obj := $(shell pwd)/build
> @@ -60,6 +59,9 @@
>  KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
>  export KERNELVERSION
>  
> +	include $(shell $(src)/util/xcompile/xcompile > $(src)/.xcompile || \
> +		{ echo "complete\\ toolchain" && rm -f $(src)/.xcompile && exit 1; }; echo $(src)/.xcompile)
> +

No indentation needed, I think.


> Index: util/dtc/Makefile
> ===================================================================
> --- util/dtc/Makefile	(revision 462)
> +++ util/dtc/Makefile	(working copy)
> @@ -13,7 +13,7 @@
>  #all: $(TARGETS)
>  
>  $(obj)/util/dtc/dtc: $(patsubst %,$(obj)/util/dtc/%,$(DTC_OBJS))
> -	$(Q)mkdir -p $(obj)/util/dtc/
> +	$(Q)mkdir -p $(dir $@)

Yep, this is definately a good thing.


> Index: arch/x86/Makefile
> ===================================================================
> --- arch/x86/Makefile	(revision 462)
> +++ arch/x86/Makefile	(working copy)
[...]
> @@ -136,8 +146,11 @@
>  	$(Q)printf "  TEST    $(subst $(shell pwd)/,,$(@))\n"
>  	$(Q)test `wc -c < $(obj)/stage0.init` -gt 16128 && \
>  		printf "Error. Bootblock got too big.\n" || true
> +	$(Q)printf "  NM      $(subst $(shell pwd)/,,$(@))\n"
> +	$(Q)$(NM) $(obj)/stage0.o |sort -u > $(obj)/stage0.init.map
                                   ^
                            missing space

I'd rename Rules.make to Makefile.rules, but other than that:

Acked-by: Uwe Hermann <uwe at hermann-uwe.de>


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20070723/e097d7a0/attachment.sig>


More information about the coreboot mailing list