Makefile and compiling the linux kernel
Hi all,
I want to be able to compile the Linux kernel from 2 directories above :
(I'm creating my own distribution "eZonix" ) :
Here is my tree :
eZonix
|
---kernels
| |
| ---linux ( its the linux kernel v2.6.12)
|
|
(then other stuffs)
here is my top Makefile ( eZonix/Makefile ):
----------------------------------------------------------------------------------------------------
TARGET=i386
TOP_DIR= $(shell pwd)
export
SUBDIRS=kernels
all: subdirs
subdirs:
for i in $(SUBDIRS) ; do $(MAKE) -C $$i || exit $$i ; done
menuconfig:
for i in $(SUBDIRS) ; do $(MAKE) -C $$i menuconfig || exit $$i ; done
clean:
for i in $(SUBDIRS) ; do [ ! -d $$i ] || $(MAKE) -C $$i clean; done
----------------------------------------------------------------------------------------------------
then here is the sub Makefile ( kernels/Makefile ):
-------------------------------------------------------------------------------------------------------
TARGET=i386
DIR=linux
all:
for i in $(DIR) ; do $(MAKE) ARCH=$(TARGET)
CROSS_COMPILE=$(TARGET)-linux- -C $$i || exit $$i ; done
menuconfig:
for i in $(DIR) ; do $(MAKE) ARCH=$(TARGET) CROSS_COMPILE=$(TARGET)-linux- -C $$i menuconfig || exit $$i ; done
clean:
for i in $(DIR) ; do $(MAKE) -C $$i clean|| exit $$i ; done
---------------------------------------------------------------------------------------------------------------
here is my problem :
When I run make from the Top directory( from eZonix) I have the following error :
[ayoub@pine eZonix]$ make clean
for i in kernels ; do [ ! -d $i ] || make -C $i clean; done
make[1]: Entering directory `/home/ayoub/SW/eZonix/kernels'
for i in linux ; do make -C $i clean|| exit $i ; done
make[2]: Entering directory `/home/ayoub/SW/eZonix/kernels/linux-2.6.12'
scripts/Makefile.clean:10: kernels/Makefile: No such file or directory
make[3]: *** No rule to make target `kernels/Makefile'. Stop.
make[2]: *** [_clean_kernels] Error 2
make[2]: Leaving directory `/home/ayoub/SW/eZonix/kernels/linux-2.6.12'
/bin/sh: line 0: exit: linux: numeric argument required
make[1]: *** [clean] Error 255
make[1]: Leaving directory `/home/ayoub/SW/eZonix/kernels'
make: *** [clean] Error 2
[ayoub@pine eZonix]$
But when I'running it from kernels(eZonix/kernels) directory it works fine !!!:
[ayoub@pine kernels]$ make clean
for i in linux ; do make -C $i clean|| exit $i ; done
make[1]: Entering directory `/home/ayoub/SW/eZonix/kernels/linux-2.6.12'
make[1]: Leaving directory `/home/ayoub/SW/eZonix/kernels/linux-2.6.12'
[ayoub@pine kernels]$
NB: it the same problem with ( make or make menuconfig )
I have replace eZonix/kernels/linux by just a simple directory eZonix/kernels/hello ( containing just a Makefile and hello.c ) / (I have also rplace DIR=linux by DIR=hello in the second Makefile )
In this case the compilation run without error form the top directory.
Maybe I've missed something in the makefiles but I don't know what?
Can someone please help me ?
I'm very confused.
Thank you very much
--ayoub
|