* [PATCH] let kbuild mkdir for dir/file.o
2013-06-28 22:44 ` [PATCH] let kbuild mkdir for dir/file.o Michal Marek
@ 2013-06-30 8:01 ` 张忠山
2013-06-30 9:02 ` 张忠山
2013-06-30 9:09 ` 张忠山
2 siblings, 0 replies; 6+ messages in thread
From: 张忠山 @ 2013-06-30 8:01 UTC (permalink / raw)
To: mmarek; +Cc: linux-kbuild, linux-kernel, 张忠山
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
Signed-off-by: 张忠山 <zzs0213@gmail.com>
---
scripts/Makefile.lib | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 51bb3de..6bae5a9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] let kbuild mkdir for dir/file.o
2013-06-28 22:44 ` [PATCH] let kbuild mkdir for dir/file.o Michal Marek
2013-06-30 8:01 ` 张忠山
@ 2013-06-30 9:02 ` 张忠山
2013-06-30 9:09 ` 张忠山
2 siblings, 0 replies; 6+ messages in thread
From: 张忠山 @ 2013-06-30 9:02 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild, lkml
> > # $(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.
>
> > +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.
--
Best Regards,
zzs
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] let kbuild mkdir for dir/file.o
2013-06-28 22:44 ` [PATCH] let kbuild mkdir for dir/file.o Michal Marek
2013-06-30 8:01 ` 张忠山
2013-06-30 9:02 ` 张忠山
@ 2013-06-30 9:09 ` 张忠山
2013-07-03 20:49 ` Michal Marek
2 siblings, 1 reply; 6+ messages in thread
From: 张忠山 @ 2013-06-30 9:09 UTC (permalink / raw)
To: mmarek; +Cc: linux-kbuild, linux-kernel, 张忠山
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 51bb3de..cddd2c9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] let kbuild mkdir for dir/file.o
2013-06-30 9:09 ` 张忠山
@ 2013-07-03 20:49 ` Michal Marek
2013-07-04 1:35 ` 张忠山
0 siblings, 1 reply; 6+ messages in thread
From: Michal Marek @ 2013-07-03 20:49 UTC (permalink / raw)
To: 张忠山; +Cc: linux-kbuild, linux-kernel
Dne 30.6.2013 11:09, 张忠山 napsal(a):
> 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
> ---
You forgot to sign off this patch, can I add
Signed-off-by: 张忠山 <zzs0213@gmail.com>
like you did in the previous versions? Otherwise, the patch looks OK.
Michal
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] let kbuild mkdir for dir/file.o
2013-07-03 20:49 ` Michal Marek
@ 2013-07-04 1:35 ` 张忠山
0 siblings, 0 replies; 6+ messages in thread
From: 张忠山 @ 2013-07-04 1:35 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild, linux-kernel, zzs0213
> >
> > this bug caused by commit
> > f5fb976520a53f45f8bbf2e851f16b3b5558d485
> > ---
>
> You forgot to sign off this patch, can I add
>
> Signed-off-by: 张忠山 <zzs0213@gmail.com>
>
> like you did in the previous versions? Otherwise, the patch looks OK.
>
> Michal
Of course, you can.
--
Best Regards,
zzs
^ permalink raw reply [flat|nested] 6+ messages in thread