* [PATCH v3 0/8] Avoid using shell environment during the build
@ 2022-02-01 16:52 Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 1/8] template: Copy template attributes on transform Uladzimir Bely
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:52 UTC (permalink / raw)
To: isar-users
This patchset is a subseries of 'Sbuild/Schroot migration' patchset
including only preparation patches. It doesn't require any changes
in host machine configuration for downstreams (meta-iot2050 and
xenomai-images were tested) so can be merged independently.
In this patchset the main topic is a migration to template files that
allows to use cleaner build environment.
When this patchset is merged, it will make maintenance of remaining
sbuild-related patches easier and will shorten their number.
Changes since v2:
- Removed `dpkg_build_export` while a way to continue using
shell exports for sbuild was found.
Changes since v1:
- Introduced `dpkg_build_export` function to be used for passing
variables to build environment;
- Linux kernel framgments handling is done in Debian way.
Anton Mikanovich (6):
linux-module: Do not use shell environment
u-boot: Do not use shell environment
trusted-firmware: Do not use shell environment
optee-os: Do not use shell environment
kselftest: Do not use shell environment
linux-mainline: Move cfg fragment test to debian/rules
Uladzimir Bely (2):
template: Copy template attributes on transform
linux-custom: Move cfg fragments applying to debian/rules
.../linux/linux-mainline_5.4.70.bb | 16 +++--
meta/classes/template.bbclass | 4 +-
.../files/debian/{rules => rules.tmpl} | 4 +-
meta/recipes-bsp/optee-os/optee-os-custom.inc | 9 +--
.../files/debian/{rules => rules.tmpl} | 4 +-
.../trusted-firmware-a-custom.inc | 9 +--
.../u-boot/files/debian/{rules => rules.tmpl} | 2 +-
meta/recipes-bsp/u-boot/u-boot-custom.inc | 9 +--
.../kselftest/files/{rules => rules.tmpl} | 0
meta/recipes-kernel/kselftest/kselftest.inc | 21 +++---
.../linux-module/files/debian/rules | 37 ----------
.../linux-module/files/debian/rules.tmpl | 67 +++++++++++++++++++
meta/recipes-kernel/linux-module/module.inc | 34 +---------
.../linux/files/debian/isar/configure.tmpl | 19 ++++++
.../linux/files/debian/rules.tmpl | 3 +
meta/recipes-kernel/linux/linux-custom.inc | 12 +---
16 files changed, 126 insertions(+), 124 deletions(-)
rename meta/recipes-bsp/optee-os/files/debian/{rules => rules.tmpl} (75%)
rename meta/recipes-bsp/trusted-firmware-a/files/debian/{rules => rules.tmpl} (77%)
rename meta/recipes-bsp/u-boot/files/debian/{rules => rules.tmpl} (94%)
rename meta/recipes-kernel/kselftest/files/{rules => rules.tmpl} (100%)
delete mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules.tmpl
create mode 100644 meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/8] template: Copy template attributes on transform
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
@ 2022-02-01 16:52 ` Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 2/8] linux-module: Do not use shell environment Uladzimir Bely
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:52 UTC (permalink / raw)
To: isar-users
Output file should have exactly the same flags as input one,
which is usefull for the cases like debian/rules or other executables.
So we should copy this part of metadata after the conversion.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
meta/classes/template.bbclass | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/meta/classes/template.bbclass b/meta/classes/template.bbclass
index fb9d1186..e6bcc362 100644
--- a/meta/classes/template.bbclass
+++ b/meta/classes/template.bbclass
@@ -8,7 +8,7 @@ TEMPLATE_VARS ?= "PN PV DESCRIPTION HOMEPAGE MAINTAINER DISTRO_ARCH"
do_transform_template[vardeps] = "TEMPLATE_FILES ${TEMPLATE_VARS}"
python do_transform_template() {
- import subprocess, contextlib
+ import subprocess, contextlib, shutil
workdir = os.path.normpath(d.getVar('WORKDIR', True))
@@ -56,5 +56,7 @@ python do_transform_template() {
stdout=output, env=env))
if process.wait() != 0:
bb.fatal("processing of template failed")
+
+ shutil.copymode(template_file, output_file)
}
addtask do_transform_template after do_unpack
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/8] linux-module: Do not use shell environment
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 1/8] template: Copy template attributes on transform Uladzimir Bely
@ 2022-02-01 16:52 ` Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 3/8] u-boot: " Uladzimir Bely
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:52 UTC (permalink / raw)
To: isar-users
From: Anton Mikanovich <amikan@ilbers.de>
To make package build process independent of the shell environment we
should remove KDIR and PN passing through export call.
KDIR can be prepared during package build. This also will allow not to
rely on previous builddeps install task.
To pass PN variable we can just migrate to template-based debian/rules
file.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
.../linux-module/files/debian/rules | 37 ----------
.../linux-module/files/debian/rules.tmpl | 67 +++++++++++++++++++
meta/recipes-kernel/linux-module/module.inc | 34 +---------
3 files changed, 70 insertions(+), 68 deletions(-)
delete mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules.tmpl
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
deleted file mode 100755
index 59720b37..00000000
--- a/meta/recipes-kernel/linux-module/files/debian/rules
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/make -f
-
-# Debian rules for custom kernel module build
-#
-# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
-#
-# SPDX-License-Identifier: MIT
-
-export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
-
-export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
-
-ifeq ($(DEB_HOST_GNU_CPU), arm)
-export ARCH=arm
-endif
-ifeq ($(DEB_HOST_GNU_CPU), aarch64)
-export ARCH=arm64
-endif
-ifeq ($(DEB_HOST_GNU_CPU), riscv64)
-export ARCH=riscv
-endif
-ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU)))
-export ARCH=x86
-endif
-
-override_dh_auto_clean:
- $(MAKE) -C $(KDIR) M=$(PWD) clean
-
-override_dh_auto_build:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
-
-override_dh_auto_install:
- $(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/$(PN) modules_install
-
-%:
- CFLAGS= LDFLAGS= dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
new file mode 100755
index 00000000..054a7b83
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
@@ -0,0 +1,67 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom kernel module build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
+
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+
+ifeq ($(DEB_HOST_GNU_CPU), arm)
+export ARCH=arm
+endif
+ifeq ($(DEB_HOST_GNU_CPU), aarch64)
+export ARCH=arm64
+endif
+ifeq ($(DEB_HOST_GNU_CPU), riscv64)
+export ARCH=riscv
+endif
+ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU)))
+export ARCH=x86
+endif
+
+ifeq (${KERNEL_TYPE}, raspios)
+# In RaspiOS one package provides several headers
+KERNEL_SUFFIX := "+"
+ifeq (${KERNEL_NAME}, kernel8)
+KERNEL_SUFFIX := "-v8+"
+else ifeq (${KERNEL_NAME}, kernel7l)
+KERNEL_SUFFIX := "-v7l+"
+else ifeq (${KERNEL_NAME}, kernel7)
+KERNEL_SUFFIX := "-v7+"
+endif
+KDIR := $(shell dpkg -L ${KERNEL_HEADERS_PKG} | grep "/lib/modules/.*${KERNEL_SUFFIX}/build" | head -n1)
+endif
+
+ifeq ($(KDIR),)
+# Custom kernels contain the build folder directly.
+KDIR := $(shell dpkg -L ${KERNEL_HEADERS_PKG} | grep "/lib/modules/.*/build")
+endif
+ifeq ($(KDIR),)
+# Debian kernels install that folder indirectly via a dependency.
+KERNEL_DEP := $(shell dpkg-query -W -f '$${Depends}' ${KERNEL_HEADERS_PKG} | sed 's/.*\(linux-headers-[[:graph:]]*\).*/\1/')
+KDIR := $(shell dpkg -L $(KERNEL_DEP) | grep "/lib/modules/.*/build")
+endif
+
+# With some build systems like sbuild `dh clean` can be called twice:
+# first, by build system itself before chroot's apt database updated,
+# second, by dpkg-buildpackage during build. So, KDIR may be empty
+# in first case (while no dependencies are yet installed), and a broken
+# 'make ... clean' command is produced. Just skip override in this case.
+ifneq ($(KDIR),)
+override_dh_auto_clean:
+ $(MAKE) -C $(KDIR) M=$(PWD) clean
+endif
+
+override_dh_auto_build:
+ $(MAKE) -C $(KDIR) M=$(PWD) modules
+
+override_dh_auto_install:
+ $(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
+
+%:
+ CFLAGS= LDFLAGS= dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 968ac4c7..75dc4374 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -24,8 +24,9 @@ AUTOLOAD ?= ""
inherit dpkg
TEMPLATE_FILES = "debian/control.tmpl \
- debian/changelog.tmpl"
-TEMPLATE_VARS += "KERNEL_IMAGE_PKG KERNEL_HEADERS_PKG"
+ debian/changelog.tmpl \
+ debian/rules.tmpl"
+TEMPLATE_VARS += "KERNEL_NAME KERNEL_TYPE KERNEL_IMAGE_PKG KERNEL_HEADERS_PKG PN"
do_prepare_build() {
cp -r ${WORKDIR}/debian ${S}/
@@ -34,32 +35,3 @@ do_prepare_build() {
echo "echo $module >> /etc/modules" >> ${S}/debian/postinst
done
}
-
-dpkg_runbuild_prepend() {
- if [ "${KERNEL_TYPE}" = "raspios" ]; then
- # In RaspiOS one package provides several headers
- KERNEL_SUFFIX="+"
- if [ "${KERNEL_NAME}" = "kernel8" ]; then
- KERNEL_SUFFIX="-v8+"
- elif [ "${KERNEL_NAME}" = "kernel7l" ]; then
- KERNEL_SUFFIX="-v7l+"
- elif [ "${KERNEL_NAME}" = "kernel7" ]; then
- KERNEL_SUFFIX="-v7+"
- fi
- export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} ${KERNEL_HEADERS_PKG} | \
- grep "/lib/modules/.*${KERNEL_SUFFIX}/build" | head -n1)
- fi
- if [ -z "$KDIR" ]; then
- # Custom kernels contain the build folder directly.
- export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} ${KERNEL_HEADERS_PKG} | \
- grep "/lib/modules/.*/build")
- fi
- if [ -z "$KDIR" ]; then
- # Debian kernels install that folder indirectly via a dependency.
- KERNEL_DEP=$(dpkg-query -W -f '${Depends}' --admindir=${BUILDCHROOT_DIR}/var/lib/dpkg \
- ${KERNEL_HEADERS_PKG} | sed 's/.*\(linux-headers-[[:graph:]]*\).*/\1/')
- export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} ${KERNEL_DEP} | \
- grep "/lib/modules/.*/build")
- fi
- export PN=${PN}
-}
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/8] u-boot: Do not use shell environment
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 1/8] template: Copy template attributes on transform Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 2/8] linux-module: Do not use shell environment Uladzimir Bely
@ 2022-02-01 16:52 ` Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 4/8] trusted-firmware: " Uladzimir Bely
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:52 UTC (permalink / raw)
To: isar-users
From: Anton Mikanovich <amikan@ilbers.de>
To make package build process independent of the shell environment we
should remove U_BOOT_CONFIG and U_BOOT_BIN passing through export call.
So we migrate to template-based debian/rules file.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
.../u-boot/files/debian/{rules => rules.tmpl} | 2 +-
meta/recipes-bsp/u-boot/u-boot-custom.inc | 9 ++-------
2 files changed, 3 insertions(+), 8 deletions(-)
rename meta/recipes-bsp/u-boot/files/debian/{rules => rules.tmpl} (94%)
diff --git a/meta/recipes-bsp/u-boot/files/debian/rules b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
similarity index 94%
rename from meta/recipes-bsp/u-boot/files/debian/rules
rename to meta/recipes-bsp/u-boot/files/debian/rules.tmpl
index 3d667620..806b01fe 100755
--- a/meta/recipes-bsp/u-boot/files/debian/rules
+++ b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
@@ -13,7 +13,7 @@ SET_CROSS_BUILD_TOOLS=CROSS_BUILD_TOOLS=y
endif
override_dh_auto_build:
- $(MAKE) $(PARALLEL_MAKE) $(U_BOOT_CONFIG)
+ $(MAKE) $(PARALLEL_MAKE) ${U_BOOT_CONFIG}
$(MAKE) $(PARALLEL_MAKE) ${U_BOOT_BIN}
$(MAKE) -n u-boot-initial-env >/dev/null 2>&1; if [ $$? -ne 2 ]; then \
$(MAKE) $(PARALLEL_MAKE) u-boot-initial-env; \
diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc
index 9984d8cc..2af7ada1 100644
--- a/meta/recipes-bsp/u-boot/u-boot-custom.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc
@@ -26,8 +26,8 @@ python() {
DEBIAN_BUILD_DEPENDS ?= "bc, bison, flex, device-tree-compiler, git"
-TEMPLATE_FILES = "debian/control.tmpl"
-TEMPLATE_VARS += "MACHINE DEBIAN_BUILD_DEPENDS"
+TEMPLATE_FILES = "debian/control.tmpl debian/rules.tmpl"
+TEMPLATE_VARS += "MACHINE DEBIAN_BUILD_DEPENDS U_BOOT_CONFIG U_BOOT_BIN"
U_BOOT_TOOLS_PACKAGE ?= "0"
U_BOOT_CONFIG_PACKAGE ?= "0"
@@ -71,8 +71,3 @@ fw_env.config /etc
EOF
fi
}
-
-dpkg_runbuild_prepend() {
- export U_BOOT_CONFIG="${U_BOOT_CONFIG}"
- export U_BOOT_BIN="${U_BOOT_BIN}"
-}
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 4/8] trusted-firmware: Do not use shell environment
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
` (2 preceding siblings ...)
2022-02-01 16:52 ` [PATCH v3 3/8] u-boot: " Uladzimir Bely
@ 2022-02-01 16:53 ` Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 5/8] optee-os: " Uladzimir Bely
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:53 UTC (permalink / raw)
To: isar-users
From: Anton Mikanovich <amikan@ilbers.de>
To make package build process independent of the shell environment we
should remove TF_A_PLATFORM and TF_A_EXTRA_BUILDARGS passing through
export call. So we migrate to template-based debian/rules file.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
.../files/debian/{rules => rules.tmpl} | 4 ++--
.../trusted-firmware-a/trusted-firmware-a-custom.inc | 9 ++-------
2 files changed, 4 insertions(+), 9 deletions(-)
rename meta/recipes-bsp/trusted-firmware-a/files/debian/{rules => rules.tmpl} (77%)
diff --git a/meta/recipes-bsp/trusted-firmware-a/files/debian/rules b/meta/recipes-bsp/trusted-firmware-a/files/debian/rules.tmpl
similarity index 77%
rename from meta/recipes-bsp/trusted-firmware-a/files/debian/rules
rename to meta/recipes-bsp/trusted-firmware-a/files/debian/rules.tmpl
index 70e1dd66..6dbf44db 100755
--- a/meta/recipes-bsp/trusted-firmware-a/files/debian/rules
+++ b/meta/recipes-bsp/trusted-firmware-a/files/debian/rules.tmpl
@@ -12,8 +12,8 @@ export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
endif
override_dh_auto_build:
- CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLAT=$(TF_A_PLATFORM) \
- $(TF_A_EXTRA_BUILDARGS)
+ CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLAT=${TF_A_PLATFORM} \
+ ${TF_A_EXTRA_BUILDARGS}
%:
dh $@
diff --git a/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc b/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
index 1142bfce..64153c6b 100644
--- a/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
+++ b/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
@@ -22,8 +22,8 @@ DEBIAN_BUILD_DEPENDS ?= ""
PROVIDES += "trusted-firmware-a-${TF_A_NAME}"
-TEMPLATE_FILES = "debian/control.tmpl"
-TEMPLATE_VARS += "TF_A_NAME DEBIAN_BUILD_DEPENDS"
+TEMPLATE_FILES = "debian/control.tmpl debian/rules.tmpl"
+TEMPLATE_VARS += "TF_A_NAME DEBIAN_BUILD_DEPENDS TF_A_PLATFORM TF_A_EXTRA_BUILDARGS"
do_prepare_build() {
cp -r ${WORKDIR}/debian ${S}/
@@ -36,8 +36,3 @@ do_prepare_build() {
${S}/debian/trusted-firmware-a-${TF_A_NAME}.install
done
}
-
-dpkg_runbuild_prepend() {
- export TF_A_PLATFORM="${TF_A_PLATFORM}"
- export TF_A_EXTRA_BUILDARGS="${TF_A_EXTRA_BUILDARGS}"
-}
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 5/8] optee-os: Do not use shell environment
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
` (3 preceding siblings ...)
2022-02-01 16:53 ` [PATCH v3 4/8] trusted-firmware: " Uladzimir Bely
@ 2022-02-01 16:53 ` Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 6/8] kselftest: " Uladzimir Bely
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:53 UTC (permalink / raw)
To: isar-users
From: Anton Mikanovich <amikan@ilbers.de>
To make package build process independent of the shell environment we
should remove OPTEE_PLATFORM and OPTEE_EXTRA_BUILDARGS passing through
export call. So we migrate to template-based debian/rules file.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
.../optee-os/files/debian/{rules => rules.tmpl} | 4 ++--
meta/recipes-bsp/optee-os/optee-os-custom.inc | 9 ++-------
2 files changed, 4 insertions(+), 9 deletions(-)
rename meta/recipes-bsp/optee-os/files/debian/{rules => rules.tmpl} (75%)
diff --git a/meta/recipes-bsp/optee-os/files/debian/rules b/meta/recipes-bsp/optee-os/files/debian/rules.tmpl
similarity index 75%
rename from meta/recipes-bsp/optee-os/files/debian/rules
rename to meta/recipes-bsp/optee-os/files/debian/rules.tmpl
index d2e9900f..9ab80dfe 100755
--- a/meta/recipes-bsp/optee-os/files/debian/rules
+++ b/meta/recipes-bsp/optee-os/files/debian/rules.tmpl
@@ -12,8 +12,8 @@ export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
endif
override_dh_auto_build:
- CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=$(OPTEE_PLATFORM) \
- $(OPTEE_EXTRA_BUILDARGS)
+ CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=${OPTEE_PLATFORM} \
+ ${OPTEE_EXTRA_BUILDARGS}
%:
dh $@
diff --git a/meta/recipes-bsp/optee-os/optee-os-custom.inc b/meta/recipes-bsp/optee-os/optee-os-custom.inc
index 1bd51969..23612d81 100644
--- a/meta/recipes-bsp/optee-os/optee-os-custom.inc
+++ b/meta/recipes-bsp/optee-os/optee-os-custom.inc
@@ -22,8 +22,8 @@ DEBIAN_BUILD_DEPENDS ?= "python3-pycryptodome:native, python3-pyelftools"
PROVIDES += "optee-os-${OPTEE_NAME}"
-TEMPLATE_FILES = "debian/control.tmpl"
-TEMPLATE_VARS += "OPTEE_NAME DEBIAN_BUILD_DEPENDS"
+TEMPLATE_FILES = "debian/control.tmpl debian/rules.tmpl"
+TEMPLATE_VARS += "OPTEE_NAME DEBIAN_BUILD_DEPENDS OPTEE_PLATFORM OPTEE_EXTRA_BUILDARGS"
# split strip platform flavor, if any, from the specified platform string
OPTEE_PLATFORM_BASE = "${@d.getVar('OPTEE_PLATFORM').split('-')[0]}"
@@ -39,8 +39,3 @@ do_prepare_build() {
${S}/debian/optee-os-${OPTEE_NAME}.install
done
}
-
-dpkg_runbuild_prepend() {
- export OPTEE_PLATFORM="${OPTEE_PLATFORM}"
- export OPTEE_EXTRA_BUILDARGS="${OPTEE_EXTRA_BUILDARGS}"
-}
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 6/8] kselftest: Do not use shell environment
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
` (4 preceding siblings ...)
2022-02-01 16:53 ` [PATCH v3 5/8] optee-os: " Uladzimir Bely
@ 2022-02-01 16:53 ` Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 7/8] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 8/8] linux-custom: Move cfg fragments applying " Uladzimir Bely
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:53 UTC (permalink / raw)
To: isar-users
From: Anton Mikanovich <amikan@ilbers.de>
To make package build process independent of the shell environment we
should remove KSELFTEST_ARGS passing through export call. The same
logic can be done by internal recipe parser and then pass variable to
template-based debian/rules file.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
.../kselftest/files/{rules => rules.tmpl} | 0
meta/recipes-kernel/kselftest/kselftest.inc | 21 +++++++------------
2 files changed, 8 insertions(+), 13 deletions(-)
rename meta/recipes-kernel/kselftest/files/{rules => rules.tmpl} (100%)
diff --git a/meta/recipes-kernel/kselftest/files/rules b/meta/recipes-kernel/kselftest/files/rules.tmpl
similarity index 100%
rename from meta/recipes-kernel/kselftest/files/rules
rename to meta/recipes-kernel/kselftest/files/rules.tmpl
diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc
index 2a76028b..6187d8e4 100644
--- a/meta/recipes-kernel/kselftest/kselftest.inc
+++ b/meta/recipes-kernel/kselftest/kselftest.inc
@@ -33,26 +33,21 @@ DEBIAN_BUILD_DEPENDS ?= " \
llvm:native, \
"
-SRC_URI += "file://rules"
+SRC_URI += "file://rules.tmpl"
S = "${WORKDIR}/linux-${PV}"
+TEMPLATE_FILES = "rules.tmpl"
+TEMPLATE_VARS += "KSELFTEST_ARGS"
+
KSELFTEST_TARGETS ?= ""
KSELFTEST_SKIP_TARGETS ?= ""
KSELFTEST_FORCE_TARGETS ?= "0"
+KSELFTEST_ARGS = "${@ "TARGETS=\"${KSELFTEST_TARGETS}\"" if d.getVar('KSELFTEST_TARGETS', True) else ''}"
+KSELFTEST_ARGS_append = "${@ " FORCE_TARGETS=1" if d.getVar('KSELFTEST_FORCE_TARGETS', True) == '1' else ''}"
+KSELFTEST_ARGS_append .= "${@ " SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" if d.getVar('KSELFTEST_SKIP_TARGETS', True) else ''}"
+
do_prepare_build[cleandirs] += "${S}/debian"
do_prepare_build() {
deb_debianize
}
-
-dpkg_runbuild_prepend() {
- if [ -n "${KSELFTEST_TARGETS}" ];then
- export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\""
- fi
- if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then
- export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1"
- fi
- if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then
- export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\""
- fi
-}
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 7/8] linux-mainline: Move cfg fragment test to debian/rules
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
` (5 preceding siblings ...)
2022-02-01 16:53 ` [PATCH v3 6/8] kselftest: " Uladzimir Bely
@ 2022-02-01 16:53 ` Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 8/8] linux-custom: Move cfg fragments applying " Uladzimir Bely
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:53 UTC (permalink / raw)
To: isar-users
From: Anton Mikanovich <amikan@ilbers.de>
Perform all config fragments checking in Debian way.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
.../linux/linux-mainline_5.4.70.bb | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb b/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb
index 980e137b..28e51c0d 100644
--- a/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb
+++ b/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb
@@ -25,11 +25,13 @@ LINUX_VERSION_EXTENSION = "-isar"
# For testing purposes only
dpkg_configure_kernel_append() {
- if ! grep "# CONFIG_MTD is not set" ${S}/${KERNEL_BUILD_DIR}/.config && \
- ! grep "# CONFIG_MTD_UBI is not set" ${S}/${KERNEL_BUILD_DIR}/.config; then
- grep "# CONFIG_UBIFS_FS is not set" ${S}/${KERNEL_BUILD_DIR}/.config || \
- bbfatal "Self-check failed: CONFIG_UBIFS_FS still enabled"
- fi
- grep "CONFIG_ROOT_NFS=y" ${S}/${KERNEL_BUILD_DIR}/.config || \
- bbfatal "Self-check failed: CONFIG_ROOT_NFS not enabled"
+cat << EOF | sed -i '/^override_dh_auto_build/ r /dev/stdin' ${S}/debian/rules
+ if ! grep "# CONFIG_MTD is not set" \$(O)/.config && \\
+ ! grep "# CONFIG_MTD_UBI is not set" \$(O)/.config; then \\
+ grep "# CONFIG_UBIFS_FS is not set" \$(O)/.config || \\
+ (echo "Self-check failed: CONFIG_UBIFS_FS still enabled" && exit 1); \\
+ fi
+ grep "CONFIG_ROOT_NFS=y" \$(O)/.config || \\
+ (echo "Self-check failed: CONFIG_ROOT_NFS not enabled" && exit 1)
+EOF
}
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 8/8] linux-custom: Move cfg fragments applying to debian/rules
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
` (6 preceding siblings ...)
2022-02-01 16:53 ` [PATCH v3 7/8] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
@ 2022-02-01 16:53 ` Uladzimir Bely
7 siblings, 0 replies; 9+ messages in thread
From: Uladzimir Bely @ 2022-02-01 16:53 UTC (permalink / raw)
To: isar-users
Prepare linux fragments applying in Debian way.
This allows to avoid pre-build chroot call used for merging
kernel config file and custom config fragments.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
.../linux/files/debian/isar/configure.tmpl | 19 +++++++++++++++++++
.../linux/files/debian/rules.tmpl | 3 +++
meta/recipes-kernel/linux/linux-custom.inc | 12 +++---------
3 files changed, 25 insertions(+), 9 deletions(-)
create mode 100644 meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
diff --git a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
new file mode 100644
index 00000000..83871baa
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright (c) Mentor Graphics, a Siemens business, 2019
+# SPDX-License-Identifier: MIT
+
+# Load common stuff
+. ${S}/debian/isar/common || exit ${?}
+
+do_configure() {
+
+ # Process kernel config target and fragments
+ ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} || exit ${?}
+ ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
+ ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
+
+ # Stop tracing
+ set +x
+}
+
+main configure ${*}
diff --git a/meta/recipes-kernel/linux/files/debian/rules.tmpl b/meta/recipes-kernel/linux/files/debian/rules.tmpl
index 05a26fe2..a1166287 100755
--- a/meta/recipes-kernel/linux/files/debian/rules.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/rules.tmpl
@@ -22,6 +22,9 @@ isar_env=$(strip \
override_dh_auto_clean:
$(isar_env) && bash $(deb_top_dir)/isar/clean
+override_dh_auto_configure:
+ $(isar_env) && bash $(deb_top_dir)/isar/configure
+
override_dh_auto_build:
$(isar_env) && bash $(deb_top_dir)/isar/build
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index ed89aa09..4fc3d65b 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -52,6 +52,7 @@ TEMPLATE_FILES += " \
debian/isar/build.tmpl \
debian/isar/clean.tmpl \
debian/isar/common.tmpl \
+ debian/isar/configure.tmpl \
debian/isar/install.tmpl \
debian/isar/version.cfg.tmpl \
debian/linux-image.postinst.tmpl \
@@ -164,15 +165,8 @@ dpkg_configure_kernel() {
(cd ${WORKDIR} && cp ${src_frags} ${S}/debian/fragments/)
fi
- sudo -E chroot --userspec=$(id -u):$(id -g) ${BUILDCHROOT_DIR} sh -c " \
- export ARCH=${KERNEL_ARCH} && \
- cd ${PP}/${PPS} && \
- make O=${KERNEL_BUILD_DIR} ${config_target} && \
- ./scripts/kconfig/merge_config.sh \
- -O ${KERNEL_BUILD_DIR}/ \
- ${KERNEL_BUILD_DIR}/.config \
- ${out_frags} \
- "
+ export KERNEL_CONFIG_TARGET="${config_target}"
+ export KERNEL_CONFIG_FRAGMENTS="${out_frags}"
}
dpkg_runbuild_prepend() {
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-02-01 16:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 16:52 [PATCH v3 0/8] Avoid using shell environment during the build Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 1/8] template: Copy template attributes on transform Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 2/8] linux-module: Do not use shell environment Uladzimir Bely
2022-02-01 16:52 ` [PATCH v3 3/8] u-boot: " Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 4/8] trusted-firmware: " Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 5/8] optee-os: " Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 6/8] kselftest: " Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 7/8] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
2022-02-01 16:53 ` [PATCH v3 8/8] linux-custom: Move cfg fragments applying " Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox