linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kill include symlinks for sh?
@ 2008-07-28 11:57 Sam Ravnborg
  2008-07-28 23:19 ` Paul Mundt
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2008-07-28 11:57 UTC (permalink / raw)
  To: Paul Mundt; +Cc: linux-sh, linux-kernel, linux-kbuild

Hi Paul.

Now that kbuild has proper support for
include/$ARCH/* maybe this is a good time
to kill the use of symlinks for sh?

The idea is to do the following:
1) move all cpu specific directories to:
   arch/sh/include/$CPU/cpu

   then we can continue to use "#include <cpu/foo.h>" if
   we just tell gcc to pick up include
   files in the correct directory.

2) move all mach specific directories to:
   arch/sh/$ARCH/mach

   then we can continue to use "#include <mach/foo.h>
   But this does NOT address the mach's that relied on
   the mach symlink that pointed one level below.
   I do not know how big his issue is.

3) move remaining header files to
   arch/sh/include/asm

4) adjust arch/sh/Makefile

   Test and enjoy....

I do not have sh toolchina on this box so I have
not tried to do a full patch myself. And the mach stuff
obviously worries me with the link to the parent directory.

But apart form this is is simple. See below for my take on it.
You can put an
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
or
Acked-by: Sam Ravnborg <sam@ravnborg.org>

as you like on the final patch.

Questions / comments are welcome.

PS. sparc is the first to use arch/$ARCH/include and will
hit -linus soon,
	Sam

To complete step 1) to 3) the following script can
be used:
# CPU dirs
mkdir -p arch/sh/include/cpu-sh2/cpu
mkdir -p arch/sh/include/cpu-sh2a/cpu
mkdir -p arch/sh/include/cpu-sh3/cpu
mkdir -p arch/sh/include/cpu-sh4/cpu
mkdir -p arch/sh/include/cpu-sh5/cpu

git mv include/asm-sh/cpu-sh2 arch/sh/include/cpu-sh2/cpu
git mv include/asm-sh/cpu-sh2a arch/sh/include/cpu-sh2a/cpu
git mv include/asm-sh/cpu-sh3 arch/sh/include/cpu-sh3/cpu
git mv include/asm-sh/cpu-sh4 arch/sh/include/cpu-sh4/cpu
git mv include/asm-sh/cpu-sh5 arch/sh/include/cpu-sh5/cpu

# mach dirs
mkdir -p arch/sh/include/dreamcast/mach
mkdir -p arch/sh/include/landisk/mach
mkdir -p arch/sh/include/hd64465/mach
mkdir -p arch/sh/include/sh03/mach

git mv include/asm-sh/dreamcast arch/sh/include/dreamcast/mach
git mv include/asm-sh/landisk arch/sh/include/landisk/mach
git mv include/asm-sh/hd64465 arch/sh/include/hd64465/mach
git mv include/asm-sh/sh03 arch/sh/include/sh03/mach

# asm-sh header files
mkdir -p arch/sh/include/asm
git mv include/asm-sh arch/sh/include/asm

Step 4) is the following patch:
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index fb7b1b1..7a514a6 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -156,52 +156,8 @@ drivers-$(CONFIG_OPROFILE)	+= arch/sh/oprofile/
 
 boot := arch/sh/boot
 
-ifneq ($(KBUILD_SRC),)
-incdir-prefix	:= $(srctree)/include/asm-sh/
-else
-incdir-prefix	:=
-endif
-
-#	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/auto.conf FORCE
-	@echo '  SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
-	$(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
-	$(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
-	@touch $@
-
-#	Most boards have their own mach directories.  For the ones that
-#	don't, just reference the parent directory so the semantics are
-#	kept roughly the same.
-#
-#	When multiple boards are compiled in at the same time, preference
-#	for the mach link is given to whichever has a directory for its
-#	headers. However, this is only a workaround until platforms that
-#	can live in the same kernel image back away from relying on the
-#	mach link.
-
-include/asm-sh/.mach: $(wildcard include/config/sh/*.h) \
-		      include/config/auto.conf FORCE
-	$(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
-	$(Q)rm -f include/asm-sh/mach
-	$(Q)for i in $(incdir-y); do \
-	if [ -d $(srctree)/include/asm-sh/$$i ]; then \
-		echo -n '  SYMLINK include/asm-sh/mach -> '; \
-		echo -e "include/asm-sh/$$i"; \
-		ln -fsn $(incdir-prefix)$$i \
-			include/asm-sh/mach; \
-	else \
-		if [ ! -d include/asm-sh/mach ]; then \
-			echo -n '  SYMLINK include/asm-sh/mach -> '; \
-			echo -e 'include/asm-sh'; \
-			ln -fsn $(incdir-prefix)../asm-sh include/asm-sh/mach; \
-		fi; \
-	fi; \
-	done
-	@touch $@
+KBUILD_CFLAGS += -Iarch/sh/include/$(cpuincdir-y)
+KBUILD_CFLAGS += $(foreach d, $(incdir-y), -Iarch/sh/include/$(d))
 
 PHONY += maketools FORCE
 
@@ -215,8 +171,7 @@ zImage uImage uImage.srec vmlinux.srec: vmlinux
 
 compressed: zImage
 
-archprepare: include/asm-sh/.cpu include/asm-sh/.mach maketools \
-	     arch/sh/lib64/syscalltab.h
+archprepare: maketools arch/sh/lib64/syscalltab.h
 
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: kill include symlinks for sh?
  2008-07-28 11:57 kill include symlinks for sh? Sam Ravnborg
@ 2008-07-28 23:19 ` Paul Mundt
  2008-07-29  6:40   ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mundt @ 2008-07-28 23:19 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-sh, linux-kernel, linux-kbuild

Hi Sam,

On Mon, Jul 28, 2008 at 01:57:35PM +0200, Sam Ravnborg wrote:
> Now that kbuild has proper support for
> include/$ARCH/* maybe this is a good time
> to kill the use of symlinks for sh?
> 
Good idea, I just saw the sparc change go by earlier today and remembered
we had talked about this before.

> I do not have sh toolchina on this box so I have
> not tried to do a full patch myself. And the mach stuff
> obviously worries me with the link to the parent directory.
> 
This didn't end up being _too_ painful, though it did take a bit of time
to hunt down all of the guilty parties. I've pushed out what I have now,
which you can see at:

http://git.kernel.org/?p=linux/kernel/git/lethal/sh-2.6.git;a=commitdiff;h=f15cbe6f1a4b4d9df59142fc8e4abb973302cf44

It's been holding up to all of the random builds I've thrown at it so
far, so there shouldn't be any really nasty surprises left over.

I'm glad git supports renames.. :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kill include symlinks for sh?
  2008-07-28 23:19 ` Paul Mundt
@ 2008-07-29  6:40   ` Sam Ravnborg
  2008-07-29  8:54     ` Paul Mundt
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2008-07-29  6:40 UTC (permalink / raw)
  To: Paul Mundt, linux-sh, linux-kernel, linux-kbuild

Hi Paul

> This didn't end up being _too_ painful, though it did take a bit of time
> to hunt down all of the guilty parties. I've pushed out what I have now,
> which you can see at:
> 
> http://git.kernel.org/?p=linux/kernel/git/lethal/sh-2.6.git;a=commitdiff;h=f15cbe6f1a4b4d9df59142fc8e4abb973302cf44
> 
> It's been holding up to all of the random builds I've thrown at it so
> far, so there shouldn't be any really nasty surprises left over.

I took a quick look at it and the header re-org looks good.
I like that you added the 'mach-' prefix to the directory names.

But I also noticed several changes like this:
-#include <asm/landisk/iodata_landisk.h>
+#include <mach/iodata_landisk.h>

In this case you _know_ that this is a landisk so
the less magic option would have been the longer
include form like this:
+#include <mach-landisk/mach/iodata_landisk.h>

It would be preferable that we use the gcc -I
directive:

    -Iarch/sh/include/mach-$MACH

only to automagically select between identical named
files for the different platforms and not like
the above where we use it simply to cut off the include
path a little.

Another note is that you decided to move the generated
file over to arch/sh/include too.
I really do not know if I think this is the right approach.
What I like is that we some day end up with generated files
in a common place. But I have not really thought it through
and thus I have no final idea how to do it.
So in other words - keep it as is and lets re-visit it should
we one day decide to do this in a common way across architectures.

Thanks for looking into this so quickly!

	Sam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: kill include symlinks for sh?
  2008-07-29  6:40   ` Sam Ravnborg
@ 2008-07-29  8:54     ` Paul Mundt
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Mundt @ 2008-07-29  8:54 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-sh, linux-kernel, linux-kbuild

On Tue, Jul 29, 2008 at 08:40:49AM +0200, Sam Ravnborg wrote:
> Hi Paul
> 
> > This didn't end up being _too_ painful, though it did take a bit of time
> > to hunt down all of the guilty parties. I've pushed out what I have now,
> > which you can see at:
> > 
> > http://git.kernel.org/?p=linux/kernel/git/lethal/sh-2.6.git;a=commitdiff;h=f15cbe6f1a4b4d9df59142fc8e4abb973302cf44
> > 
> > It's been holding up to all of the random builds I've thrown at it so
> > far, so there shouldn't be any really nasty surprises left over.
> 
> I took a quick look at it and the header re-org looks good.
> I like that you added the 'mach-' prefix to the directory names.
> 
> But I also noticed several changes like this:
> -#include <asm/landisk/iodata_landisk.h>
> +#include <mach/iodata_landisk.h>
> 
> In this case you _know_ that this is a landisk so
> the less magic option would have been the longer
> include form like this:
> +#include <mach-landisk/mach/iodata_landisk.h>
> 
> It would be preferable that we use the gcc -I
> directive:
> 
>     -Iarch/sh/include/mach-$MACH
> 
> only to automagically select between identical named
> files for the different platforms and not like
> the above where we use it simply to cut off the include
> path a little.
> 
Yes, I had thought about that as well. We certainly need to go this route
if we are building multiple mach types at the same time. Fortunately the
vast majority of mach types do not have their own include structure, so
it's not been something that's popped up yet as a real problem.

> Another note is that you decided to move the generated
> file over to arch/sh/include too.
> I really do not know if I think this is the right approach.

This was before I realized that asm-offsets.h was being placed in
include/asm-sh anyways, despite the directory not existing until Kbuild
created it. I don't have any problems with moving it back, I just thought
the idea of multiple include directories for the same asm/ prefix seemed
non-intuitive.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-29  8:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-28 11:57 kill include symlinks for sh? Sam Ravnborg
2008-07-28 23:19 ` Paul Mundt
2008-07-29  6:40   ` Sam Ravnborg
2008-07-29  8:54     ` Paul Mundt

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).