let kbuild mkdir for dir/file.o
PATCH 1/1 let kbuild mkdir for dir/file.o
Last week I send this patch, but no reply.
Now I try to explain it clearly:
When I try to add a file(which in a subdir) to my board's obj-y, the build progress crashed.
for example, I use at91rm9200ek board, and in kernel dir run:
mkdir objtree
make O=objtree at91rm9200-defconfig
mkdir arch/arm/mach-at91/dir
touch arch/arm/mach-at91/dir/file.c
and edit arch/arm/mach-at91/dir/file.c to add some code. then edit arch/arm/mach-at91/Makefile, change the flowwing line:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o
to:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o dir/file.o
Now build it:
make O=objtree
Then the error appears:
... CC arch/arm/mach-at91/board-rm9200dk.o CC arch/arm/mach-at91/board-rm9200ek.o CC arch/arm/mach-at91/dir/file.o linux-2.6/arch/arm/mach-at91/dir/file.c:5: fatal error: opening dependency file arch/arm/mach-at91/dir/.file.o.d: No such file or directory
Check the objtree:
LANG=en ls objtree/arch/arm/mach-at91/dir
ls: cannot access objtree/arch/arm/mach-at91/dir: No such file or directory
It's appearantly that the target dir not created for file.o
I check kbuild source code. It seems that kbuild create dirs for that in $(obj-dirs). But if the dir need not to create a built-in.o, It should never in $(obj-dirs).
So I make this patch to make sure It in $(obj-dirs)
Anybody Anyidea?
张忠山 (1):
let kbuild mkdir for dir/file.o
scripts/Makefile.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
PATCH 1/1 let kbuild mkdir for dir/file.o
when add a obj with dir to obj-y, like this
obj-y += dir/file.o
the $(obj)/dir not created, this patch fix this
this bug caused by commit
f5fb976520a53f45f8bbf2e851f16b3b5558d485
--- scripts/Makefile.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.lib +2 -1
@@ -63,7 +63,8 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) subdir-obj-y := $(filter %/built-in.o, $(obj-y)) # $(obj-dirs) is a list of directories that contain object files -obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) +__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) +obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y)) # Replace multi-part objects by their individual parts, look at local dir only real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
Signature · 1 line
1.7.9.5
Hi,
sorry for the late feedback.
Dne 4.6.2013 10:45, 张忠山 napsal(a):
Quoted 8 lines
when add a obj with dir to obj-y, like this
obj-y += dir/file.othe $(obj)/dir not created, this patch fix this
this bug caused by commit
f5fb976520a53f45f8bbf2e851f16b3b5558d485
Please also include the wonderful explanation including the error message that you posted separately
(http://permalink.gmane.org/gmane.linux.kbuild.devel/10050). Also, please CC linux-kernel in addition to linux-kbuild.
Quoted 11 lines
Signed-off-by 张忠山 <[email protected]>--- scripts/Makefile.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/Makefile.lib +0
-0
scripts/Makefile.lib multi-objs := $(multi-objs-y) $(multi-objs-m) · line 66
Quoted 5 lines
scripts/Makefile.lib +1
-1@@ -63,7 +63,8 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) subdir-obj-y := $(filter %/built-in.o, $(obj-y)) # $(obj-dirs) is a list of directories that contain object files -obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) +__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
This complicated filter returns entries from $(obj-y) that contain a slash, is that correct? If so, is it really necessary? Why not simply add whole $(obj-y) to $(obj-dirs) and be done? $(multi-objs) is also added without any filtering.
scripts/Makefile.lib multi-objs := $(multi-objs-y) $(multi-objs-m) · line 67
Quoted 1 line
scripts/Makefile.lib +1
-0+obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y))
thanks,
Michal
PATCH 1/1 let kbuild mkdir for dir/file.o
When add a obj with dir to obj-y, like this
obj-y += dir/file.o
The $(obj)/dir not created, this patch fix this.
When try to add a file(which in a subdir) to my board's obj-y, the build progress crashed.
For example, I use at91rm9200ek board, and in kernel dir run:
mkdir objtree
make O=objtree at91rm9200-defconfig
mkdir arch/arm/mach-at91/dir
touch arch/arm/mach-at91/dir/file.c
and edit arch/arm/mach-at91/dir/file.c to add some code. then edit arch/arm/mach-at91/Makefile, change the following line:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o
to:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o dir/file.o
Now build it:
make O=objtree
Then the error appears:
...
CC arch/arm/mach-at91/board-rm9200dk.o CC arch/arm/mach-at91/board-rm9200ek.o CC arch/arm/mach-at91/dir/file.o
linux-2.6/arch/arm/mach-at91/dir/file.c:5:
fatal error: opening dependency file arch/arm/mach-at91/dir/.file.o.d: No such file or directory
Check the objtree:
LANG=en ls objtree/arch/arm/mach-at91/dir
ls: cannot access objtree/arch/arm/mach-at91/dir: No such file or directory
It's apparently that the target dir not created for file.o
Check kbuild source code. It seems that kbuild create dirs for that in $(obj-dirs). But if the dir need not to create a built-in.o, It should never in $(obj-dirs).
So I make this patch to make sure It in $(obj-dirs)
this bug caused by commit
f5fb976520a53f45f8bbf2e851f16b3b5558d485
--- scripts/Makefile.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.lib +2 -1
@@ -63,7 +63,8 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) subdir-obj-y := $(filter %/built-in.o, $(obj-y)) # $(obj-dirs) is a list of directories that contain object files -obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) +__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) +obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y)) # Replace multi-part objects by their individual parts, look at local dir only real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
Signature · 1 line
1.7.9.5
Quoted 10 lines
scripts/Makefile.lib multi-objs := $(multi-objs-y) $(multi-objs-m) · line 66
Quoted 3 lines
# $(obj-dirs) is a list of directories that contain object files
scripts/Makefile.lib +1
-1-obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) +__subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))This complicated filter returns entries from $(obj-y) that contain a slash, is that correct? If so, is it really necessary? Why not simply add whole $(obj-y) to $(obj-dirs) and be done? $(multi-objs) is also added without any filtering.
Quoted 1 line
+obj-dirs := $(dir $(multi-objs) $(__subdir-obj-y))
Yes, You are right.
It is enough that just add $(obj-y) to $(obj-dirs) directly. I will resend the patch.
Signature · 2 lines
Best Regards, zzs
PATCH 1/1 let kbuild mkdir for dir/file.o
In reply to Michal MarekWhen add a obj with dir to obj-y, like this
obj-y += dir/file.o
The $(obj)/dir not created, this patch fix this.
When try to add a file(which in a subdir) to my board's obj-y, the build progress crashed.
For example, I use at91rm9200ek board, and in kernel dir run:
mkdir objtree
make O=objtree at91rm9200_defconfig
mkdir arch/arm/mach-at91/dir
touch arch/arm/mach-at91/dir/file.c
and edit arch/arm/mach-at91/dir/file.c to add some code. then edit arch/arm/mach-at91/Makefile, change the following line:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o
to:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o dir/file.o
Now build it:
make O=objtree
Then the error appears:
...
CC arch/arm/mach-at91/board-rm9200dk.o CC arch/arm/mach-at91/board-rm9200ek.o CC arch/arm/mach-at91/dir/file.o
linux-2.6/arch/arm/mach-at91/dir/file.c:5:
fatal error: opening dependency file arch/arm/mach-at91/dir/.file.o.d: No such file or directory
Check the objtree:
LANG=en ls objtree/arch/arm/mach-at91/dir
ls: cannot access objtree/arch/arm/mach-at91/dir: No such file or directory
It's apparently that the target dir not created for file.o
Check kbuild source code. It seems that kbuild create dirs for that in $(obj-dirs). But if the dir need not to create a built-in.o, It should never in $(obj-dirs).
So I make this patch to make sure It in $(obj-dirs)
this bug caused by commit
f5fb976520a53f45f8bbf2e851f16b3b5558d485
--- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
@@ -63,7 +63,7 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) subdir-obj-y := $(filter %/built-in.o, $(obj-y)) # $(obj-dirs) is a list of directories that contain object files -obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) +obj-dirs := $(dir $(multi-objs) $(obj-y)) # Replace multi-part objects by their individual parts, look at local dir only real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
Signature · 1 line
1.7.9.5
Dne 30.6.2013 11:09, 张忠山 napsal(a):
Quoted 48 lines
When add a obj with dir to obj-y, like this
obj-y += dir/file.oThe $(obj)/dir not created, this patch fix this.
When try to add a file(which in a subdir) to my board's obj-y, the build progress crashed.
For example, I use at91rm9200ek board, and in kernel dir run:
mkdir objtree
make O=objtreeat91rm9200_defconfig
mkdirarch/arm/mach-at91/dir
toucharch/arm/mach-at91/dir/file.cand edit
arch/arm/mach-at91/dir/file.cto add some code. then editarch/arm/mach-at91/Makefile, change the following line:obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.oto:
obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o dir/file.oNow build it:
make O=objtree
Then the error appears:
...CC arch/arm/mach-at91/board-rm9200dk.o CC arch/arm/mach-at91/board-rm9200ek.o CC arch/arm/mach-at91/dir/file.o
linux-2.6/arch/arm/mach-at91/dir/file.c:5:
fatal error: opening dependency filearch/arm/mach-at91/dir/.file.o.d: No such file or directoryCheck the objtree:
LANG=en ls objtree/arch/arm/mach-at91/dir
ls: cannot access objtree/arch/arm/mach-at91/dir: No such file or directoryIt's apparently that the target dir not created for file.o
Check kbuild source code. It seems that kbuild create dirs for that in $(obj-dirs). But if the dir need not to create a built-in.o, It should never in $(obj-dirs).
Quoted 5 lines
So I make this patch to make sure It in $(obj-dirs)
this bug caused by commit
f5fb976520a53f45f8bbf2e851f16b3b5558d485
---
You forgot to sign off this patch, can I add
like you did in the previous versions? Otherwise, the patch looks OK.
Michal
Quoted 5 lines
Quoted 4 lines
this bug caused by commit
f5fb976520a53f45f8bbf2e851f16b3b5558d485
---
Quoted 7 lines
You forgot to sign off this patch, can I add
Signed-off-by 张忠山 <[email protected]>like you did in the previous versions? Otherwise, the patch looks OK.
Michal
Of course, you can.
Signature · 2 lines
Best Regards, zzs
Anybody review this path? Why no reply
Am i make a mistake or kbuild not need to make a dir for dir/file.o?
Signature · 2 lines
Best Regards, zzs
Dne 14.6.2013 07:39, zzs napsal(a):
Quoted 3 lines
Anybody review this path? Why no reply
Am i make a mistake or kbuild not need to make a dir for
dir/file.o?
The patch is probably fine, but I need to take a closer look. Sorry to keep you waiting.
Michal