linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Paul Mundt <lethal@linux-sh.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	David Howells <dhowells@redhat.com>,
	Greg Ungerer <gerg@snapgear.com>, Sam Ravnborg <sam@ravnborg.org>,
	linux arch <linux-arch@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux/m68k <linux-m68k@vger.kernel.org>,
	uClinux list <uclinux-dev@uclinux.org>
Subject: Re: kbuild now support arch/$ARCH/include - time for ARCHs to convert
Date: Thu, 31 Jul 2008 21:47:25 +0200	[thread overview]
Message-ID: <200807312147.25837.arnd@arndb.de> (raw)
In-Reply-To: <20080731032338.GA14296@linux-sh.org>

On Thursday 31 July 2008, Paul Mundt wrote:
> This sort of merging is fairly easy to do incrementally, at least by
> someone that has both platforms available. An easy first step would be to
> move the m68knommu stuff that are implemented differently over as _nommu
> files, similar to how the _32/_64 renames happened, and then set about
> converging the two little by little. This is what I've been doing with
> sh64->sh integration for example, despite fundamental differences like
> having a totally different register layout and instruction set.
 
I've played around with the purely mechanical side of merging the
m68k{,nommu} header files and came up with a script to do it.
All headers that are identical are used from their m68k variant, the
others get an #include magic like x86 has it for 32/64.

This assumes that the kernel ABI is compatible and that user space
can actually use the m68k headers for m68knommu as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
TARGET=arch/m68k/include/asm
SOURCE1=include/asm-m68k
SOURCE2=include/asm-m68knommu
FILES="atomic.h bitops.h bootinfo.h bug.h bugs.h byteorder.h cache.h \
cacheflush.h checksum.h cputime.h current.h delay.h div64.h \
dma-mapping.h dma.h elf.h entry.h fb.h fpu.h hardirq.h hw_irq.h io.h \
irq.h kmap_types.h local.h machdep.h mc146818rtc.h mmu.h mmu_context.h \
module.h page.h page_offset.h param.h pci.h percpu.h pgalloc.h \
pgtable.h processor.h ptrace.h scatterlist.h sections.h segment.h \
setup.h sigcontext.h siginfo.h signal.h string.h system.h \
thread_info.h timex.h tlbflush.h traps.h uaccess.h ucontext.h \
unaligned.h unistd.h"
EXPORTS="byteorder param ptrace sigcontext siginfo signal unistd"

mergefile() {
	BASE=${1%.h}
	mv $SOURCE1/$1 $TARGET/${BASE}_mmu.h
	mv $SOURCE2/$1 $TARGET/${BASE}_nommu.h
cat << EOF > $TARGET/$1
#ifdef __KERNEL__
#ifdef CONFIG_MMU
#include "${BASE}_mmu.h"
#else
#include "${BASE}_nommu.h"
#endif
#else
#include "${BASE}_mmu.h"
#endif
EOF
}

mergefile2() {
	if [ -e ${TARGET}/$1 ] ; then
		rm $SOURCE2/$1
	else
		mv $SOURCE2/$1 ${TARGET}
	fi
}

addexport() {
	echo "unifdef-y += ${1}_mmu.h" >> $TARGET/Kbuild
}

mkdir -p ${TARGET}
# first the incompatible files
for i in $FILES ; do mergefile $i ; done
# move all the remaining m68k files
mv include/asm-m68k/* arch/m68k/include/asm/
# add a few files that are present only on nommu,
# remove the duplicate nommu files.
for i in `ls include/asm-m68knommu/` ; do mergefile2 $i ; done
# make sure the new files get exported where needed.
for i in $EXPORTS ; do addexport $i ; done

  parent reply	other threads:[~2008-07-31 19:47 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28 20:05 kbuild now support arch/$ARCH/include - time for ARCHs to convert Sam Ravnborg
2008-07-28 20:05 ` Sam Ravnborg
2008-07-29  3:06 ` Kyle McMartin
2008-07-29  3:06   ` Kyle McMartin
2008-07-29  3:27   ` Sam Ravnborg
2008-07-29 14:21     ` Kyle McMartin
2008-08-09  2:50       ` Sam Ravnborg
2008-07-30  6:49 ` Greg Ungerer
2008-07-30  7:07   ` Arnd Bergmann
2008-07-30  8:52     ` Sam Ravnborg
2008-07-30  9:34     ` David Howells
2008-07-30 12:26       ` Geert Uytterhoeven
2008-07-30 12:26         ` Geert Uytterhoeven
2008-07-31  3:23         ` Paul Mundt
2008-07-31  7:17           ` Geert Uytterhoeven
2008-07-31 11:26             ` Greg Ungerer
2008-07-31 11:26               ` Greg Ungerer
2008-07-31 19:47           ` Arnd Bergmann [this message]
2008-07-31 20:13             ` Sam Ravnborg
2008-08-01  7:35               ` Arnd Bergmann
2008-08-01 16:46                 ` Sam Ravnborg
2008-07-30  8:38   ` Sam Ravnborg
2008-08-01  6:03     ` Greg Ungerer
2008-08-03 20:16       ` Geert Uytterhoeven
2008-08-04  0:34         ` Greg Ungerer
2008-08-04  5:10           ` Sam Ravnborg
2008-08-04 14:35         ` Arnd Bergmann
2008-08-04 16:00           ` Geert Uytterhoeven
2008-08-04 16:45             ` Sam Ravnborg
2008-07-31 18:23 ` Ralf Baechle
2008-07-31 20:14   ` Sam Ravnborg
2008-08-09  2:52   ` Sam Ravnborg
2008-08-09  3:09     ` Paul Mundt
2008-08-09  7:03       ` Sam Ravnborg
2008-08-09  7:20         ` Russell King
2008-08-09 11:13           ` Sam Ravnborg
2008-08-01  8:35 ` Martin Schwidefsky
2008-08-01 16:49   ` Sam Ravnborg
2008-08-05  4:18 ` Rusty Russell
2008-08-05 17:16   ` Geert Uytterhoeven
2008-08-05 17:16     ` Geert Uytterhoeven
2008-08-05 20:45   ` Sam Ravnborg
2008-08-05 22:06     ` Russell King
2008-08-06 19:21       ` Russell King
2008-08-06 19:28         ` Sam Ravnborg
2008-08-06 19:51           ` Russell King
2008-08-06 19:27       ` Sam Ravnborg
2008-08-09  7:28 ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807312147.25837.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=dhowells@redhat.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@snapgear.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=uclinux-dev@uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).