diff mbox series

[v2] build: create $(PKG_SYMVERS_DIR) if non-existent

Message ID 20201117215908.GA3894@darth.lan
State Superseded
Headers show
Series [v2] build: create $(PKG_SYMVERS_DIR) if non-existent | expand

Commit Message

Sebastian Kemper Nov. 17, 2020, 9:59 p.m. UTC
Commit 5d76065 moved the creation of the symvers directory to
include/kernel-build.mk. This is fine when building from scratch. But
when unpacking an SDK the directory doesn't exist and because the kernel
won't be built (again) this directory will not be created by the build
system, causing build failure if make tries to copy files into it.

This moves the creation of the symvers directory back into
include/kernel.mk so that the directory is created in any case.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
---
 include/kernel-build.mk | 1 -
 include/kernel.mk       | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

--
2.26.2

Comments

Paul Spooren Nov. 18, 2020, 4:28 a.m. UTC | #1
On Tue Nov 17, 2020 at 11:59 AM HST, Sebastian Kemper wrote:
> Commit 5d76065 moved the creation of the symvers directory to
> include/kernel-build.mk. This is fine when building from scratch. But
> when unpacking an SDK the directory doesn't exist and because the kernel
> won't be built (again) this directory will not be created by the build
> system, causing build failure if make tries to copy files into it.
>
> This moves the creation of the symvers directory back into
> include/kernel.mk so that the directory is created in any case.
>
> Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>

Acked-by: Paul Spooren <mail@aparcar.org>

> ---
> include/kernel-build.mk | 1 -
> include/kernel.mk | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/kernel-build.mk b/include/kernel-build.mk
> index a698deec3c..22f7c4c7c7 100644
> --- a/include/kernel-build.mk
> +++ b/include/kernel-build.mk
> @@ -136,7 +136,6 @@ define BuildKernel
> $(LINUX_DIR)/.modules: export
> PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
> $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
> $(Kernel/CompileModules)
> - mkdir -p $(PKG_SYMVERS_DIR)
> touch $$@
>
> $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
> diff --git a/include/kernel.mk b/include/kernel.mk
> index 1ae9c6be29..e803ff44e7 100644
> --- a/include/kernel.mk
> +++ b/include/kernel.mk
> @@ -140,6 +140,7 @@ endif
> PKG_EXTMOD_SUBDIRS ?= .
>
> PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
> +$(shell mkdir -p $(PKG_SYMVERS_DIR))
>
> define collect_module_symvers
> for subdir in $(PKG_EXTMOD_SUBDIRS); do \
> --
> 2.26.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Oldřich Jedlička Nov. 18, 2020, 5:54 a.m. UTC | #2
út 17. 11. 2020 v 23:00 odesílatel Sebastian Kemper
<sebastian_ml@gmx.net> napsal:
>
> Commit 5d76065 moved the creation of the symvers directory to
> include/kernel-build.mk. This is fine when building from scratch. But
> when unpacking an SDK the directory doesn't exist and because the kernel
> won't be built (again) this directory will not be created by the build
> system, causing build failure if make tries to copy files into it.
>
> This moves the creation of the symvers directory back into
> include/kernel.mk so that the directory is created in any case.
>
> Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
> ---
>  include/kernel-build.mk | 1 -
>  include/kernel.mk       | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/kernel-build.mk b/include/kernel-build.mk
> index a698deec3c..22f7c4c7c7 100644
> --- a/include/kernel-build.mk
> +++ b/include/kernel-build.mk
> @@ -136,7 +136,6 @@ define BuildKernel
>    $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
>    $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
>         $(Kernel/CompileModules)
> -       mkdir -p $(PKG_SYMVERS_DIR)
>         touch $$@
>
>    $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
> diff --git a/include/kernel.mk b/include/kernel.mk
> index 1ae9c6be29..e803ff44e7 100644
> --- a/include/kernel.mk
> +++ b/include/kernel.mk
> @@ -140,6 +140,7 @@ endif
>  PKG_EXTMOD_SUBDIRS ?= .
>
>  PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
> +$(shell mkdir -p $(PKG_SYMVERS_DIR))

Wouldn't it be better to move this few lines below to the place which actually
uses the folder - into collect_module_symvers? Just before

  mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers

To have the same usage pattern as it is in ModuleAutoload (creation of
/etc/modules-boot.d before usage) and kmod-*/install (creation of MODULES_SUBDIR
before usage),

Or are there any other dependencies on PKG_SYMBERS_DIR existence before the
actual install step?

>
>  define collect_module_symvers
>         for subdir in $(PKG_EXTMOD_SUBDIRS); do \
> --
> 2.26.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Oldrich.
Felix Fietkau Nov. 18, 2020, 7:05 a.m. UTC | #3
On 2020-11-18 06:54, Oldřich Jedlička wrote:
> út 17. 11. 2020 v 23:00 odesílatel Sebastian Kemper
> <sebastian_ml@gmx.net> napsal:
>>
>> Commit 5d76065 moved the creation of the symvers directory to
>> include/kernel-build.mk. This is fine when building from scratch. But
>> when unpacking an SDK the directory doesn't exist and because the kernel
>> won't be built (again) this directory will not be created by the build
>> system, causing build failure if make tries to copy files into it.
>>
>> This moves the creation of the symvers directory back into
>> include/kernel.mk so that the directory is created in any case.
>>
>> Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
>> ---
>>  include/kernel-build.mk | 1 -
>>  include/kernel.mk       | 1 +
>>  2 files changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/kernel-build.mk b/include/kernel-build.mk
>> index a698deec3c..22f7c4c7c7 100644
>> --- a/include/kernel-build.mk
>> +++ b/include/kernel-build.mk
>> @@ -136,7 +136,6 @@ define BuildKernel
>>    $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
>>    $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
>>         $(Kernel/CompileModules)
>> -       mkdir -p $(PKG_SYMVERS_DIR)
>>         touch $$@
>>
>>    $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
>> diff --git a/include/kernel.mk b/include/kernel.mk
>> index 1ae9c6be29..e803ff44e7 100644
>> --- a/include/kernel.mk
>> +++ b/include/kernel.mk
>> @@ -140,6 +140,7 @@ endif
>>  PKG_EXTMOD_SUBDIRS ?= .
>>
>>  PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
>> +$(shell mkdir -p $(PKG_SYMVERS_DIR))
> 
> Wouldn't it be better to move this few lines below to the place which actually
> uses the folder - into collect_module_symvers? Just before
> 
>   mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers
Yes, that's a much better solution. Running mkdir inside make context
shell expansion can easily trigger some really nasty build system
performance issues.

- Felix
Paul Spooren Nov. 18, 2020, 6:39 p.m. UTC | #4
On Tue Nov 17, 2020 at 9:05 PM HST, Felix Fietkau wrote:
>
> On 2020-11-18 06:54, Oldřich Jedlička wrote:
> > út 17. 11. 2020 v 23:00 odesílatel Sebastian Kemper
> > <sebastian_ml@gmx.net> napsal:
> >>
> >> Commit 5d76065 moved the creation of the symvers directory to
> >> include/kernel-build.mk. This is fine when building from scratch. But
> >> when unpacking an SDK the directory doesn't exist and because the kernel
> >> won't be built (again) this directory will not be created by the build
> >> system, causing build failure if make tries to copy files into it.
> >>
> >> This moves the creation of the symvers directory back into
> >> include/kernel.mk so that the directory is created in any case.
> >>
> >> Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
> >> ---
> >>  include/kernel-build.mk | 1 -
> >>  include/kernel.mk       | 1 +
> >>  2 files changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/include/kernel-build.mk b/include/kernel-build.mk
> >> index a698deec3c..22f7c4c7c7 100644
> >> --- a/include/kernel-build.mk
> >> +++ b/include/kernel-build.mk
> >> @@ -136,7 +136,6 @@ define BuildKernel
> >>    $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
> >>    $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
> >>         $(Kernel/CompileModules)
> >> -       mkdir -p $(PKG_SYMVERS_DIR)
> >>         touch $$@
> >>
> >>    $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
> >> diff --git a/include/kernel.mk b/include/kernel.mk
> >> index 1ae9c6be29..e803ff44e7 100644
> >> --- a/include/kernel.mk
> >> +++ b/include/kernel.mk
> >> @@ -140,6 +140,7 @@ endif
> >>  PKG_EXTMOD_SUBDIRS ?= .
> >>
> >>  PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
> >> +$(shell mkdir -p $(PKG_SYMVERS_DIR))
> > 
> > Wouldn't it be better to move this few lines below to the place which actually
> > uses the folder - into collect_module_symvers? Just before
> > 
> >   mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers
> Yes, that's a much better solution. Running mkdir inside make context
> shell expansion can easily trigger some really nasty build system
> performance issues.

That's good to know. Sebastian can you please create a v3?

>
> - Felix
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index a698deec3c..22f7c4c7c7 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -136,7 +136,6 @@  define BuildKernel
   $(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
   $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
 	$(Kernel/CompileModules)
-	mkdir -p $(PKG_SYMVERS_DIR)
 	touch $$@

   $(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
diff --git a/include/kernel.mk b/include/kernel.mk
index 1ae9c6be29..e803ff44e7 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -140,6 +140,7 @@  endif
 PKG_EXTMOD_SUBDIRS ?= .

 PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
+$(shell mkdir -p $(PKG_SYMVERS_DIR))

 define collect_module_symvers
 	for subdir in $(PKG_EXTMOD_SUBDIRS); do \