bringing back 'make symlinks'?
In the 2.4 kernel, 'make symlinks' created the symlinks needed to use the kernel tree's headers for building a gcc/glibc toolchain.
In the 2.6 kernel, you can do the same thing with 'include include/asm'. Unless you're trying to build arm or cris, or maybe others, in which case you also need 'include/asm-$(ARCH)/.arch'.
That's fine, but it means that a script (like crosstool) or a book (like LFS) that's trying to build a gcc/glibc toolchain for both 2.4 and 2.6 ends up with a section like
case "$KERNEL_VERSION.$KERNEL_PATCHLEVEL.x" in
2.2.x|2.4.x) make ARCH=$ARCH symlinks include/linux/version.h
;;
2.6.x) make ARCH=$ARCH include/asm include/linux/version.h
case $ARCH in
arm*|cris*) make ARCH=$ARCH include/asm-$ARCH/.arch
;;
esac
;;
*) abort "Unsupported kernel version $KERNEL_VERSION.$KERNEL_PATCHLEVEL"
esac
which is a bit ugly. It'd be nice if 'make symlinks' did the neccesary stuff in 2.6, too. Think a patch to do that would be accepted?
- Dan
Signature · 2 lines
My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
Quoted 16 lines · Dan Kegel
In the 2.4 kernel, 'make symlinks' created the symlinks needed to use the kernel tree's headers for building a gcc/glibc toolchain.
In the 2.6 kernel, you can do the same thing with 'include
include/asm'. Unless you're trying to build arm or cris, or maybe others, in which case you also need
'include/asm-$(ARCH)/.arch'.That's fine, but it means that a script (like crosstool) or a book (like LFS)
that's trying to build a gcc/glibc toolchain for both 2.4 and 2.6 ends up with a section likecase "$KERNEL_VERSION.$KERNEL_PATCHLEVEL.x" in
2.2.x|2.4.x) make ARCH=$ARCH symlinksinclude/linux/version.h;;
Quoted 9 lines
2.6.x) make ARCH=$ARCH
include/asminclude/linux/version.h
case $ARCH in
arm*|cris*) make ARCH=$ARCHinclude/asm-$ARCH/.arch
;;
esac
;;
*) abort "Unsupported kernel version
$KERNEL_VERSION.$KERNEL_PATCHLEVEL"
esac
In current 2.6 there exitst a target named: modules_prepare It does a bit more than what symlinks did in 2.4 - actually prepare for building external modules.
Sam
Quoted 5 lines · Sam Ravnborg
Quoted 3 lines · Dan Kegel
In the 2.4 kernel, 'make symlinks' created the symlinks needed to use the kernel tree's headers for building a gcc/glibc toolchain.
Quoted 7 lines
Quoted 2 lines
In the 2.6 kernel, you can do the same thing with 'include
include/asm'.
Unless you're trying to build arm or cris, or maybe others, in which case you also need 'include/asm-$(ARCH)/.arch'....
In current 2.6 there exitst a target named:
modules_prepareIt does a bit more than what symlinks did in 2.4 - actually prepare for building external modules.
Right, and that's a problem, because the 'bit more' it does requires a target compiler -- which isn't available while bootstrapping the target compiler!
The way things are now, I can build toolchains for everything except the sh architecture (though my toolchain bootstrap script is ugly as noted due to the lack of 'make symlinks'). I'm not sure if the sh architecture makefile even has targets to make all the needed symlinks in the absense of a working target compiler; I'll look at that and maybe submit a minimal patch when I get a chance.
- Dan
Signature · 2 lines
My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
Quoted 4 lines · Dan Kegel
The way things are now, I can build toolchains for everything except the sh architecture (though my toolchain bootstrap script is ugly as noted due to the lack of 'make symlinks').
Does the following meet the needs of your cross-tool scripts?
Sam
===== Makefile 1.492 vs edited =====
Makefile +4 -0
@@ -632,6 +632,10 @@ # All the preparing.. prepare-all: prepare0 prepare +# symlinks provided for compatibility with 2.4 - this allows boot-strapping +# tool chains to be simpler +symlinks: prepare-all + # Leave this as default for preprocessing vmlinux.lds.S, which is now # done in arch/$(ARCH)/kernel/Makefile
Quoted 12 lines · Sam Ravnborg
Quoted 3 lines
The way things are now, I can build toolchains for everything except the sh architecture (though my toolchain bootstrap script is ugly as noted due to the lack of 'make symlinks').
Does the following meet the needs of your cross-tool scripts?
Sam
=====
Makefile1.492 vs edited =====
Makefile line 640
Quoted 9 lines
Makefile +4
-0@@ -632,6 +632,10 @@ # All the preparing.. prepare-all: prepare0 prepare +# symlinks provided for compatibility with 2.4 - this allows boot-strapping +# tool chains to be simpler +symlinks: prepare-all + # Leave this as default for preprocessing vmlinux.lds.S, which is now # done in arch/$(ARCH)/kernel/Makefile
Well, let's try it:
$ make ARCH=sh prepare Making asm-sh/cpu -> asm-sh/ link Making asm-sh/mach -> asm-sh/ link Generating include/asm-sh/machtypes.h
So far so good (excellent, in fact, since there is no other way at the moment to create those two links).
$ make ARCH=ppc prepare HOSTCC scripts/conmakehash HOSTCC scripts/kallsyms CC scripts/empty.o cc1: invalid option `multiple' cc1: invalid option `string' cc1: warning: unknown register name: r2 make[1]: *** [scripts/empty.o] Error 1
Whoops, bad luck. Let's try another:
$ make ARCH=arm prepare SPLIT include/linux/autoconf.h -> include/config/* HOSTCC scripts/conmakehash HOSTCC scripts/kallsyms CC scripts/empty.o cc1: invalid option `apcs' cc1: invalid option `no-sched-prolog' cc1: invalid option `little-endian' cc1: invalid option `apcs-32' cc1: invalid option `short-load-bytes' make[1]: *** [scripts/empty.o] Error 1 make: *** [scripts] Error 2
Bad luck again.
Your change works for some architectures, but for those that try to build something with the target compilers, it fails because at this point in the bootstrap process, there *is* no target compiler. (That's the next step. We have to install the kernel headers to build the target compiler...)
By the way, the mips architecture doesn't even make symlinks anymore,
preferring instead to use -I's. This makes emulating 'make symlinks'
a bit more challenging.
For what it's worth, here's my current workaround. I'm up and happy on all architectures with this, I think. (Well, happy but ugly and afraid of future breakage, I guess. And maybe not so happy on mips.)
case "$KERNEL_VERSION.$KERNEL_PATCHLEVEL.x" in
2.2.x|2.4.x) make ARCH=$ARCH symlinks include/linux/version.h
;;
2.6.x) case $ARCH in
sh*) # sh does secret stuff in 'make prepare' that can't be triggered separately,
# but happily, it doesn't use target gcc, so we can use it
make ARCH=$ARCH prepare
;;
arm*|cris*) make ARCH=$ARCH include/asm include/linux/version.h include/asm-$ARCH/.arch
;;
mips*) # for linux-2.6, 'make prepare' for mips doesn't
# actually create any symlinks. Hope generic is ok.
# Note that glibc ignores all -I flags passed in CFLAGS,
# so you have to use -isystem.
make ARCH=$ARCH include/asm include/linux/version.h TARGET_CFLAGS="$TARGET_CFLAGS -isystem $LINUX_DIR/include/asm-mips/mach-generic" ;;
*) make ARCH=$ARCH include/asm include/linux/version.h
;;
esac
;;
*) abort "Unsupported kernel version $KERNEL_VERSION.$KERNEL_PATCHLEVEL"
esac
- Dan
Signature · 2 lines
My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
Quoted 10 lines · Dan Kegel
$ make ARCH=ppc prepare HOSTCC scripts/conmakehash HOSTCC scripts/kallsyms CC scripts/empty.o cc1: invalid option `multiple' cc1: invalid option `string' cc1: warning: unknown register name: r2 make[1]: *** [scripts/empty.o] Error 1Whoops, bad luck. Let's try another:
OK - now I got the picture.
For 2.6 I'm not prepared to make a change that would allow what you need. I know for 2.7 we will start to take a new approach with the kernel headers, so I hope we do do it right there.
For 2.6 you have to live with the ugly workaround.
Sam