* [PATCH 1/1] add support for non-default modules dir in linux-module
@ 2023-12-06 11:33 Felix Moessbauer
2023-12-07 0:57 ` Jan Kiszka
2023-12-14 7:14 ` Uladzimir Bely
0 siblings, 2 replies; 3+ messages in thread
From: Felix Moessbauer @ 2023-12-06 11:33 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, Felix Moessbauer
When building a custom kernel module, the `KBuild` file might be located in
a subdirectory. To support this use-case, set `MODULE_DIR=$(PWD)/subdir` in
the module build recipe.
Previously some sed replacements of the generated rules file where
needed to support this, in case the modules dir referenced files in
parent directories.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
RECIPE-API-CHANGELOG.md | 6 ++++++
meta/recipes-kernel/linux-module/files/debian/rules.tmpl | 6 +++---
meta/recipes-kernel/linux-module/module.inc | 3 +++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 9d1fa540..bea12871 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -560,3 +560,9 @@ Default value is '-I' which sets filter to:
Use `IMAGER_INSTALL:wic` instead of `WIC_IMAGER_INSTALL`. The latter is still
supported, but a warning is issued when it is used. Future versions will drop
`WIC_IMAGER_INSTALL` completely.
+
+### Add MODULE_DIR to decouple sources dir from modules dir in custom-module
+
+When building a custom kernel module, the `KBuild` file might be located in
+a subdirectory. To support this use-case, set `MODULE_DIR=$(PWD)/subdir` in
+the module build recipe.
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
index 7d950e38..bc4e09cb 100755
--- a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
+++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
@@ -46,16 +46,16 @@ KDIR := $(shell dpkg -L $(KERNEL_DEP) | grep "/lib/modules/.*/build")
endif
override_dh_auto_clean:
- $(MAKE) -C $(KDIR) M=$(PWD) clean
+ $(MAKE) -C $(KDIR) M=${MODULE_DIR} clean
override_dh_auto_build:
- $(MAKE) -C $(KDIR) M=$(PWD) $(PARALLEL_MAKE) modules
+ $(MAKE) -C $(KDIR) M=${MODULE_DIR} $(PARALLEL_MAKE) modules
ifneq ($(filter pkg.sign,$(DEB_BUILD_PROFILES)),)
find . -name "*.ko" -print -exec $(KDIR)/scripts/sign-file ${SIGNATURE_HASHFN} ${SIGNATURE_KEYFILE} ${SIGNATURE_CERTFILE} {} \;
endif
override_dh_auto_install:
- $(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
+ $(MAKE) -C $(KDIR) M=${MODULE_DIR} INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
%:
CFLAGS= LDFLAGS= dh $@
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 333c66bc..269da6ae 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -10,6 +10,8 @@ FILESPATH:append := ":${FILE_DIRNAME}/files"
DESCRIPTION ?= "Custom kernel module ${PN}"
KERNEL_NAME ?= ""
+# directory with KBuild file (M=${MODULE_DIR})
+MODULE_DIR ?= "$(PWD)"
PN .= "-${KERNEL_NAME}"
@@ -36,6 +38,7 @@ TEMPLATE_VARS += " \
KERNEL_TYPE \
KERNEL_IMAGE_PKG \
KERNEL_HEADERS_PKG \
+ MODULE_DIR \
DEBIAN_BUILD_DEPENDS \
SIGNATURE_KEYFILE \
SIGNATURE_CERTFILE \
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] add support for non-default modules dir in linux-module
2023-12-06 11:33 [PATCH 1/1] add support for non-default modules dir in linux-module Felix Moessbauer
@ 2023-12-07 0:57 ` Jan Kiszka
2023-12-14 7:14 ` Uladzimir Bely
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2023-12-07 0:57 UTC (permalink / raw)
To: Felix Moessbauer, isar-users
On 06.12.23 19:33, Felix Moessbauer wrote:
> When building a custom kernel module, the `KBuild` file might be located in
> a subdirectory. To support this use-case, set `MODULE_DIR=$(PWD)/subdir` in
> the module build recipe.
>
> Previously some sed replacements of the generated rules file where
> needed to support this, in case the modules dir referenced files in
> parent directories.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> RECIPE-API-CHANGELOG.md | 6 ++++++
> meta/recipes-kernel/linux-module/files/debian/rules.tmpl | 6 +++---
> meta/recipes-kernel/linux-module/module.inc | 3 +++
> 3 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 9d1fa540..bea12871 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -560,3 +560,9 @@ Default value is '-I' which sets filter to:
> Use `IMAGER_INSTALL:wic` instead of `WIC_IMAGER_INSTALL`. The latter is still
> supported, but a warning is issued when it is used. Future versions will drop
> `WIC_IMAGER_INSTALL` completely.
> +
> +### Add MODULE_DIR to decouple sources dir from modules dir in custom-module
> +
> +When building a custom kernel module, the `KBuild` file might be located in
> +a subdirectory. To support this use-case, set `MODULE_DIR=$(PWD)/subdir` in
> +the module build recipe.
> diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
> index 7d950e38..bc4e09cb 100755
> --- a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
> +++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
> @@ -46,16 +46,16 @@ KDIR := $(shell dpkg -L $(KERNEL_DEP) | grep "/lib/modules/.*/build")
> endif
>
> override_dh_auto_clean:
> - $(MAKE) -C $(KDIR) M=$(PWD) clean
> + $(MAKE) -C $(KDIR) M=${MODULE_DIR} clean
>
> override_dh_auto_build:
> - $(MAKE) -C $(KDIR) M=$(PWD) $(PARALLEL_MAKE) modules
> + $(MAKE) -C $(KDIR) M=${MODULE_DIR} $(PARALLEL_MAKE) modules
> ifneq ($(filter pkg.sign,$(DEB_BUILD_PROFILES)),)
> find . -name "*.ko" -print -exec $(KDIR)/scripts/sign-file ${SIGNATURE_HASHFN} ${SIGNATURE_KEYFILE} ${SIGNATURE_CERTFILE} {} \;
> endif
>
> override_dh_auto_install:
> - $(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
> + $(MAKE) -C $(KDIR) M=${MODULE_DIR} INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
>
> %:
> CFLAGS= LDFLAGS= dh $@
> diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
> index 333c66bc..269da6ae 100644
> --- a/meta/recipes-kernel/linux-module/module.inc
> +++ b/meta/recipes-kernel/linux-module/module.inc
> @@ -10,6 +10,8 @@ FILESPATH:append := ":${FILE_DIRNAME}/files"
> DESCRIPTION ?= "Custom kernel module ${PN}"
>
> KERNEL_NAME ?= ""
> +# directory with KBuild file (M=${MODULE_DIR})
> +MODULE_DIR ?= "$(PWD)"
>
> PN .= "-${KERNEL_NAME}"
>
> @@ -36,6 +38,7 @@ TEMPLATE_VARS += " \
> KERNEL_TYPE \
> KERNEL_IMAGE_PKG \
> KERNEL_HEADERS_PKG \
> + MODULE_DIR \
> DEBIAN_BUILD_DEPENDS \
> SIGNATURE_KEYFILE \
> SIGNATURE_CERTFILE \
Looks good to me.
Thanks,
Jan
--
Siemens AG, Technology
Linux Expert Center
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] add support for non-default modules dir in linux-module
2023-12-06 11:33 [PATCH 1/1] add support for non-default modules dir in linux-module Felix Moessbauer
2023-12-07 0:57 ` Jan Kiszka
@ 2023-12-14 7:14 ` Uladzimir Bely
1 sibling, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2023-12-14 7:14 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: jan.kiszka
On Wed, 2023-12-06 at 19:33 +0800, 'Felix Moessbauer' via isar-users
wrote:
> When building a custom kernel module, the `KBuild` file might be
> located in
> a subdirectory. To support this use-case, set
> `MODULE_DIR=$(PWD)/subdir` in
> the module build recipe.
>
> Previously some sed replacements of the generated rules file where
> needed to support this, in case the modules dir referenced files in
> parent directories.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> RECIPE-API-CHANGELOG.md | 6 ++++++
> meta/recipes-kernel/linux-module/files/debian/rules.tmpl | 6 +++---
> meta/recipes-kernel/linux-module/module.inc | 3 +++
> 3 files changed, 12 insertions(+), 3 deletions(-)
Applied to next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-14 7:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 11:33 [PATCH 1/1] add support for non-default modules dir in linux-module Felix Moessbauer
2023-12-07 0:57 ` Jan Kiszka
2023-12-14 7:14 ` Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox