[1/3] linux-custom: optimization on kernel's make command

Message ID 20240813115521.381481-1-nicusor.huhulea@siemens.com
State Superseded, archived
Headers show
Series [1/3] linux-custom: optimization on kernel's make command | expand

Commit Message

nicusor.huhulea@siemens.com Aug. 13, 2024, 11:55 a.m. UTC
Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com>
---
 .../recipes-kernel/linux/files/debian/isar/build.tmpl | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Jan Kiszka Aug. 13, 2024, 12:31 p.m. UTC | #1
- series is missing a cover letter
- series is missing a version update (we are at v3 IIRC)
- series is sent as reply to older patches which may cause them to be
  overlooked
- patch commit message provides no reason and is also not more specific
  on what aspect of make it optimizes

Jan

On 13.08.24 13:55, 'Nicusor Huhulea' via isar-users wrote:
> Signed-off-by: Nicusor Huhulea <nicusor.huhulea@siemens.com>
> ---
>  .../recipes-kernel/linux/files/debian/isar/build.tmpl | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
> index bafc5ca4..1fd6f948 100644
> --- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
> @@ -21,15 +21,16 @@ do_build() {
>      KR=$(${MAKE} O=${KERNEL_BUILD_DIR} -s --no-print-directory kernelrelease)
>      sed -i "s/@KR@/${KR}/g" ${S}/debian/control ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.*
>  
> -    if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then # Build kernel scripts and tools
> -        ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}"
> +    MAKE_COMMON_ARGS="O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=${KCFLAGS} KAFLAGS=${KAFLAGS}"
> +    if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then # Full build
> +        ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS}
>      elif echo "${DEB_BUILD_PROFILES}" | grep -q "kbuild"; then # Build kernel scripts and tools
> -        ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" scripts
> +        ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS} scripts
>          if grep -q -E "CONFIG_STACK_VALIDATION=y|CONFIG_HAVE_OBJTOOL=y" ${KERNEL_BUILD_DIR}/.config && [ -d "tools/objtool" ]; then
> -            ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" tools/objtool || true
> +            ${MAKE} ${MAKE_COMMON_ARGS} tools/objtool || true
>          fi
>          if grep -q "CONFIG_MODULES=y" ${KERNEL_BUILD_DIR}/.config; then
> -            ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" modules_prepare
> +            ${MAKE} ${MAKE_COMMON_ARGS} modules_prepare
>          fi
>      fi
>

Patch

diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
index bafc5ca4..1fd6f948 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl
@@ -21,15 +21,16 @@  do_build() {
     KR=$(${MAKE} O=${KERNEL_BUILD_DIR} -s --no-print-directory kernelrelease)
     sed -i "s/@KR@/${KR}/g" ${S}/debian/control ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.*
 
-    if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then # Build kernel scripts and tools
-        ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}"
+    MAKE_COMMON_ARGS="O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=${KCFLAGS} KAFLAGS=${KAFLAGS}"
+    if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then # Full build
+        ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS}
     elif echo "${DEB_BUILD_PROFILES}" | grep -q "kbuild"; then # Build kernel scripts and tools
-        ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" scripts
+        ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS} scripts
         if grep -q -E "CONFIG_STACK_VALIDATION=y|CONFIG_HAVE_OBJTOOL=y" ${KERNEL_BUILD_DIR}/.config && [ -d "tools/objtool" ]; then
-            ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" tools/objtool || true
+            ${MAKE} ${MAKE_COMMON_ARGS} tools/objtool || true
         fi
         if grep -q "CONFIG_MODULES=y" ${KERNEL_BUILD_DIR}/.config; then
-            ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" modules_prepare
+            ${MAKE} ${MAKE_COMMON_ARGS} modules_prepare
         fi
     fi