LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2005, 04:25 AM   #1
ayoub
LQ Newbie
 
Registered: Nov 2005
Posts: 3

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel compiling: Makefile, SUBDIRS, and sound Woodsman Slackware 6 12-01-2005 05:51 AM
Compiling Xmame - which CFlags in makefile? lets-eat-gary Linux - Games 2 03-12-2005 05:15 AM
Compiling kernel module for linux kernel 2.4 in 2.6 guam Linux - Software 0 01-13-2005 02:02 AM
Compiling old code: Makefile plus config.in cbcallaw Linux - Software 1 04-29-2004 05:35 PM
about linux kernel compiling cmardhekar Linux - Newbie 1 08-30-2001 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration