linux kernel - how to run make for a local subdirectory -
i trying port existing code larger project. larger project has main makefile makefiles in each sub-directory. sure path below tells how setup. want port code
/working_directory/drivers/char/example
and here content:
sansari@ubuntu:~/working_directory/drivers/char/examples$ ls hello1.c makefile
my question 1- should modify local makefile or main one? setting modify one, not sure.
2- other question if modify local file, can run make here , validate configuration instead of running make entire project? know make updates files changed; feel better when clean build environment before each make. have run situations, alone fixed issue.
just background, did try include make file of target project, 1 trying import here -f command. did was: make -f makefile -f ../mytarget/core/makefile
ran issues make not doing of normal things in primary project. instance, there include statement relative path header file, make gave me error not seeing it. abandoning strategy time being.
@ahmad masoud - hey man, thanks. here makefile. hey man, link needed. think address other questions also. see, cross compiled code, , when flashed phone, following
uname -r: 1|root@hltespr:/lib/modules # uname -r uname -r 3.4.0-g7e6fbf7-dirty
and have been wondering "dirty" means , comes from. if know please tell me. link sent, states perhaps make insert linux kernel version there? ask since, modprobe not work when try load module. instead insmod works, , can validate module in. main issue don't know how execute file make sure runs. know how run file using modprobe, , can not use it. gives me following error:
1|root@hltespr:/ # modprobe /lib/modules/hello1.ko modprobe /lib/modules/hello1.ko modprobe: can't change directory '3.4.0-g7e6fbf7-dirty': no such file or directory
update of 06/20/15 -i put in include /home/sansari/mytree2/tbt/makefile
in module's make file. following error: makefile:3: *** missing separator. stop.
@ahmad - update of 062415. info. goal make external directory, collect source files , build them me. suggest? stuck because stands, know make looks examples directory, no other changes make local make file in examples directory shows in make. instance tried adding ($warning ....) , @echo messages, not show up.
update on 070215- previous comments , support. feel should reopen thread since did not explain goal in detail, , feel can describe better, , resolution other. issue command:
target=msm8974 platform=msm8974 make drivers/char/examples
but message stating: nothing done, while have added number of tasks do. below make file, , i'll elaborate on have added right after:
lib_tbt := ../../../m/shahin/tbt lib_daemon := ../../../m/shahin/daemon lib_lib := ../../../m/shahin/lib lib_tasks := ../../../m/shahin/tasks lib_tbt_driver := ../../../m/shahin/tbt_driver lib_tbt_make := ../../../m/shahin/tbt/make lib_tbt_msm_common := ../../../m/shahin/tbt/platform/msm8974/common lib_tbt_msm8974 := ../../../m/shahin/tbt/platform/msm8974 lib_asm_generic = ../../../m/shahin/tbt/platform/msm8974/include/asm-generic $(warning in lib_asm_generic $(lib_asm_generic)) #include $(lib_tbt_make)/macros.mk .phony: $(lib_tbt) $(lib_tbt) $(lib_daemon) $(lib_lib) $(lib_tasks) $(lib_tbt_driver) $(lib_tbt_make) $(lib_tbt_msm_common) $(lib_tbt_msm8974) $(lib_asmgeneric) : $(make) --directory=$@ $(lib_*): $(make) --directory=$@ obj-$(config_examples) += hello1.o _
initially had obj-$(config_examples) += hello1.o
statement in make file. proceeded add directory variables @ top of makefile , added $(lib_*): $(make) --directory=$@
directing make compile in directory. believe does. please let me know if mistaken. , although same make file proceeds create object files when put different directory within project, won't when in device driver directory. , not understand why. other directory /external directory , @ top of tree. should not matter right. have done first make sure can compile hello program in device driver directory called /examples. want add more source code section. believe correct term module? want know if should copy of source files /examples directory or referencing them via path ok. should move source code directory under /examples directory or not?
it lot simpler if using kernel uses kbuild.
highly recommend reading
http://www.tldp.org/ldp/lkmpg/2.6/html/x181.html
situation - source sub-tree of kernel source
you not modify top-level makefile, ensure ~/working_directory/drivers/char/examples/makefile
, ~/working_directory/drivers/char/examples/kbuild
set correctly/normally. @ top-level of kernel build directory (assuming have separate build directory) type:
foo@bar:~/build-dir$ make drivers/char/examples
the kernel top-level makefile builds sub-tree. can try out on part of kernel, example:
foo@bar:~/build-dir$ make fs
note:
build-dir
can same kernel source directory
situation b - building external module
then use normal module kbuild / makefile process.
p.s.
if post makefile / kbuild may able actual build processing.
Comments
Post a Comment