From: Tom R. <tr...@ke...> - 2004-09-23 22:51:51
|
[ oops, forgot the m17n.org list... ] On Thu, Sep 23, 2004 at 10:59:54AM -0700, Tom Rini wrote: > The following patch makes SH work (admittedly 2.6.9-rc2 + > se7751_defconfig doens't get far at all w/ or w/o this patch and no O=) > with O=. The changes bring SH back in line with the Makefile and > machtypes stuff that ARM uses. > > Signed-off-by: Tom Rini <tr...@ke...> And the following is against CVS as of linux-2_6_8 : --- linux-2.6.8.1.orig/arch/sh/tools/Makefile +++ linux-2.6.8.1/arch/sh/tools/Makefile @@ -10,7 +10,6 @@ # Shamelessly cloned from ARM. # -include/asm-sh/machtypes.h: $(obj)/machgen.sh $(obj)/mach-types +include/asm-sh/machtypes.h: $(src)/gen-mach-types $(src)/mach-types @echo ' Generating $@' - @$(CONFIG_SHELL) $(obj)/machgen.sh $(obj)/mach-types > $@ - + $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } --- linux-2.6.8.1.orig/arch/sh/tools/machgen.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# -# include/asm-sh/machtype.h header generation script for SuperH -# -# Copyright (C) 2003 Paul Mundt -# -# This is pretty much a quick and dirty hack based off of the awk -# script written by rmk that ARM uses to achieve the same sort of -# thing. -# -# Unfortunately this script has a dependance on bash/sed/cut/tr, -# though they should be prevalent enough for this dependancy not -# to matter overly much. -# -# As a note for anyone attempting to manually invoke this script, -# it expects to be run straight out of the arch/sh/tools/ directory -# as it doesn't look at TOPDIR to figure out where asm-sh is -# located. -# -# See the note at the top of the generated header for additional -# information. -# -# Released under the terms of the GNU GPL v2.0. -# - -[ $# -ne 1 ] && echo "Usage: $0 <mach defs>" && exit 1 - -cat << EOF > tmp.h -/* - * Automagically generated, don't touch. - */ -#ifndef __ASM_SH_MACHTYPES_H -#define __ASM_SH_MACHTYPES_H - -#include <linux/config.h> - -/* - * We'll use the following MACH_xxx defs for placeholders for the time - * being .. these will all go away once sh_machtype is assigned per-board. - * - * For now we leave things the way they are for backwards compatibility. - */ - -/* Mach types */ -EOF - -newline=' -' -IFS=$newline - -rm -f tmp2.h - -for entry in `cat $1 | sed -e 's/\#.*$//g;/^$/d' | tr '\t' ' ' | tr -s ' '`; do - board=`echo $entry | cut -f1 -d' '` - - printf "#ifdef CONFIG_`echo $entry | cut -f2 -d' '`\n" >> tmp.h - printf " #define MACH_$board\t\t1\n#else\n #define MACH_$board\t\t0\n#endif\n" >> tmp.h - printf "#define mach_is_`echo $board | tr '[A-Z]' '[a-z]'`()\t\t\t(MACH_$board)\n" >> tmp2.h -done - -printf "\n/* Machtype checks */\n" >> tmp.h -cat tmp2.h >> tmp.h && rm -f tmp2.h - -cat << EOF >> tmp.h - -#endif /* __ASM_SH_MACHTYPES_H */ -EOF - -cat tmp.h -rm -f tmp.h - --- linux-2.6.8.1.orig/arch/sh/Makefile +++ linux-2.6.8.1/arch/sh/Makefile @@ -128,26 +128,42 @@ boot := arch/sh/boot AFLAGS_vmlinux.lds.o := -traditional -prepare: target_links include/asm-sh/asm-offsets.h +include/asm-sh/asm-offsets.h: arch/sh/kernel/asm-offsets.s \ + include/asm include/linux/version.h + $(call filechk,gen-asm-offsets) -.PHONY: target_links FORCE +# Update machine arch and proc symlinks if something which affects +# them changed. We use .arch and .mach to indicate when they were +# updated last, otherwise make uses the target directory mtime. + +include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) include/config/MARKER + @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)' +ifneq ($(KBUILD_SRC),) + $(Q)mkdir -p include/asm-sh + $(Q)ln -fsn $(srctree)/include/asm-sh/$(cpuincdir-y) include/asm-sh/cpu +else + $(Q)ln -fsn $(cpuincdir-y) include/asm-sh/cpu +endif + @touch $@ + +include/asm-sh/.mach: $(wildcard include/config/sh/*.h) include/config/MARKER + @echo ' SYMLINK include/asm-sh/mach -> include/asm-sh/$(incdir-y)' +ifneq ($(KBUILD_SRC),) + $(Q)mkdir -p include/asm-sh + $(Q)ln -fsn $(srctree)/include/asm-sh/$(incdir-y) include/asm-sh/mach +else + $(Q)ln -fsn $(incdir-y) include/asm-sh/mach +endif + @touch $@ -all: zImage -target_links: - @echo ' Making asm-sh/cpu -> asm-sh/$(cpuincdir-y) link' - @rm -f include/asm-sh/cpu - @ln -sf $(cpuincdir-y) include/asm-sh/cpu - - @echo ' Making asm-sh/mach -> asm-sh/$(incdir-y) link' - @rm -f include/asm-sh/mach - @ln -sf $(incdir-y) include/asm-sh/mach +prepare: maketools include/asm-sh/.cpu include/asm-sh/.mach +.PHONY: maketools FORCE +maketools: include/asm-sh/asm-offsets.h include/linux/version.h FORCE $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h -include/asm-sh/asm-offsets.h: arch/sh/kernel/asm-offsets.s \ - include/asm include/linux/version.h - $(call filechk,gen-asm-offsets) +all: zImage zImage: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ --- /dev/null +++ linux-2.6.8.1/arch/sh/tools/gen-mach-types @@ -0,0 +1,49 @@ +#!/bin/awk +# +# Awk script to generate include/asm-sh/machtypes.h +# Heavily based on arch/arm/tools/gen-mach-types +# +BEGIN { nr = 0 } +/^#/ { next } +/^[ ]*$/ { next } + +NF == 2 { + mach[nr] = $1; + config[nr] = "CONFIG_"$2; + nr++; + } + +END { + printf("/*\n"); + printf(" * Automagically generated, don't touch.\n"); + printf(" */\n"); + printf("#ifndef __ASM_SH_MACHTYPES_H\n"); + printf("#define __ASM_SH_MACHTYPES_H\n"); + printf("\n"); + printf("#include <linux/config.h>\n"); + printf("\n"); + printf("/*\n"); + printf(" * We'll use the following MACH_xxx defs for placeholders for the time\n"); + printf(" * being .. these will all go away once sh_machtype is assigned per-board.\n"); + printf(" *\n"); + printf(" * For now we leave things the way they are for backwards compatibility.\n"); + printf(" */\n"); + printf("\n"); + printf("/* Mach types */\n"); + + for (i = 0; i < nr; i++) { + printf("#ifdef %s\n", config[i]); + printf(" #define MACH_%s\t\t1\n", mach[i]); + printf("#else\n"); + printf(" #define MACH_%s\t\t0\n", mach[i]); + printf("#endif\n"); + } + + printf("\n"); + printf("/* Machtype checks */\n"); + for (i = 0; i < nr; i++) + printf("#define mach_is_%s()\t\t\t(MACH_%s)\n", + tolower(mach[i]), mach[i]); + printf("\n"); + printf("#endif /* __ASM_SH_MACHTYPES_H */\n"); + } -- Tom Rini http://gate.crashing.org/~trini/ |