* [PATCH v4 1/3] u-boot: Switch to use DEB_BUILD_PROFILES
2021-11-20 6:39 [PATCH v4 0/3] UBoot refactor Vijai Kumar K
@ 2021-11-20 6:39 ` Vijai Kumar K
2021-11-20 6:39 ` [PATCH v4 2/3] meta/u-boot: Include libssl-dev only when building tools Vijai Kumar K
2021-11-20 6:39 ` [PATCH v4 3/3] meta-isar: u-boot: Migrate to U_BOOT_BUILD_PROFILES Vijai Kumar K
2 siblings, 0 replies; 6+ messages in thread
From: Vijai Kumar K @ 2021-11-20 6:39 UTC (permalink / raw)
To: isar-users; +Cc: Vijai Kumar K
Use DEB_BUILD_PROFILES to select packages to build.
This patch drops the U_BOOT_TOOLS_PACKAGE and U_BOOT_CONFIG_PACKAGE
variables and introduces U_BOOT_BUILD_PROFILES through which we can
enable particular packages like u-boot-tools, u-boot-dev and
u-boot-config.
Also, provide backward compatibility with U_BOOT_*_PACKAGES
variable and prompt a deprecation warning to user.
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
RECIPE-API-CHANGELOG.md | 12 +++++
.../u-boot/files/debian/control.tmpl | 13 +++++
meta/recipes-bsp/u-boot/files/debian/rules | 9 +++-
meta/recipes-bsp/u-boot/u-boot-custom.inc | 52 ++++++++++---------
4 files changed, 60 insertions(+), 26 deletions(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 7312d4d..3b926bd 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -301,3 +301,15 @@ Kernel update with "apt-get" will not work since bootloader configuration will
not be updated. It used to "kind of work" for grub and efi, that hack is gone.
When using the plugins it is advised to name the partition "/boot" and to exclude boot from the follwing rootfs to not waste space.
+
+### Deprecate U_BOOT_TOOLS_PACKAGE and U_BOOT_CONFIG_PACKAGE
+
+Use U_BOOT_BUILD_PROFILES instead of U_BOOT_TOOLS_PACKAGE and U_BOOT_CONFIG_PACKAGE
+
+U_BOOT_TOOLS_PACKAGE = "1" is achieved by U_BOOT_BUILD_PROFILES += "tools"
+U_BOOT_CONFIG_PACKAGE = "1" is achieved by U_BOOT_BUILD_PROFILES += "config"
+
+u-boot-${MACHINE}-dev package build can also be controlled now. Enabled by default
+in u-boot-custom.inc. To remove use the below code in your recipe.
+
+U_BOOT_BUILD_PROFILES_remove = "dev"
diff --git a/meta/recipes-bsp/u-boot/files/debian/control.tmpl b/meta/recipes-bsp/u-boot/files/debian/control.tmpl
index 9379be7..7ac11ad 100644
--- a/meta/recipes-bsp/u-boot/files/debian/control.tmpl
+++ b/meta/recipes-bsp/u-boot/files/debian/control.tmpl
@@ -11,4 +11,17 @@ Description: ${DESCRIPTION}, bootloader binaries
Package: u-boot-${MACHINE}-dev
Architecture: ${DISTRO_ARCH}
+Build-Profiles: <dev>
Description: ${DESCRIPTION}, bootloader libraries
+
+Package: u-boot-tools
+Architecture: linux-any
+Build-Profiles: <tools>
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: ${DESCRIPTION}, companion tools
+
+Package: u-boot-${MACHINE}-config
+Build-Profiles: <config>
+Provides: u-boot-config
+Architecture: ${DISTRO_ARCH}
+Description: ${DESCRIPTION}, environment configuration
diff --git a/meta/recipes-bsp/u-boot/files/debian/rules b/meta/recipes-bsp/u-boot/files/debian/rules
index 3d66762..121b00e 100755
--- a/meta/recipes-bsp/u-boot/files/debian/rules
+++ b/meta/recipes-bsp/u-boot/files/debian/rules
@@ -20,10 +20,17 @@ override_dh_auto_build:
else \
./scripts/get_default_envs.sh >u-boot-initial-env; \
fi
- $(MAKE) $(PARALLEL_MAKE) $(SET_CROSS_BUILD_TOOLS) NO_SDL=1 tools-only envtools
+ifneq (,$(filter dev,$(DEB_BUILD_PROFILES)))
+ $(MAKE) $(PARALLEL_MAKE) $(SET_CROSS_BUILD_TOOLS) NO_SDL=1 envtools
+endif
+ifneq (,$(filter tools,$(DEB_BUILD_PROFILES)))
+ $(MAKE) $(PARALLEL_MAKE) $(SET_CROSS_BUILD_TOOLS) NO_SDL=1 tools-only
+endif
override_dh_auto_install:
+ifneq (,$(filter dev,$(DEB_BUILD_PROFILES)))
mv tools/env/lib.a tools/env/libubootenv.a
+endif
override_dh_auto_test:
diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc
index 3680f01..5e8a15b 100644
--- a/meta/recipes-bsp/u-boot/u-boot-custom.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc
@@ -9,10 +9,13 @@ FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/files:"
DESCRIPTION ?= "Custom U-Boot"
-PROVIDES += "u-boot-${MACHINE} u-boot-${MACHINE}-dev"
-PROVIDES += "${@'u-boot-tools' if d.getVar('U_BOOT_TOOLS_PACKAGE') == '1' else ''}"
+PROVIDES += "u-boot-${MACHINE}"
+PROVIDES += "${@'u-boot-tools' \
+ if bb.utils.contains('U_BOOT_BUILD_PROFILES', 'tools', 1, 0, d) else ''}"
PROVIDES += "${@('u-boot-config u-boot-' + d.getVar('MACHINE') + '-config') \
- if d.getVar('U_BOOT_CONFIG_PACKAGE') == '1' else ''}"
+ if bb.utils.contains('U_BOOT_BUILD_PROFILES', 'config', 1, 0, d) else ''}"
+PROVIDES += "${@('u-boot-' + d.getVar('MACHINE') + '-dev') \
+ if bb.utils.contains('U_BOOT_BUILD_PROFILES', 'dev', 1, 0, d) else ''}"
inherit dpkg
@@ -22,6 +25,20 @@ python() {
if d.getVar('BUILD_DEPENDS'):
bb.warn("u-boot-custom: Deprecated use of BUILD_DEPENDS, please switch to DEBIAN_BUILD_DEPENDS")
d.setVar('DEBIAN_BUILD_DEPENDS', d.getVar('BUILD_DEPENDS'))
+
+ if d.getVar('U_BOOT_TOOLS_PACKAGE') is not None:
+ bb.warn("u-boot-custom: Deprecated use of U_BOOT_TOOLS_PACKAGE, please switch to U_BOOT_BUILD_PROFILES")
+ if d.getVar('U_BOOT_TOOLS_PACKAGE') == "1":
+ d.appendVar('U_BOOT_BUILD_PROFILES', " tools")
+ else:
+ d.setVar('U_BOOT_BUILD_PROFILES_remove', "tools")
+
+ if d.getVar('U_BOOT_CONFIG_PACKAGE') is not None:
+ bb.warn("u-boot-custom: Deprecated use of U_BOOT_CONFIG_PACKAGE, please switch to U_BOOT_BUILD_PROFILES")
+ if d.getVar('U_BOOT_CONFIG_PACKAGE') == "1":
+ d.appendVar('U_BOOT_BUILD_PROFILES', " config")
+ else:
+ d.setVar('U_BOOT_BUILD_PROFILES_remove', "config")
}
DEBIAN_BUILD_DEPENDS ?= "bc, bison, flex, device-tree-compiler, git, libssl-dev:native"
@@ -30,8 +47,8 @@ DEBIAN_BUILD_DEPENDS += "${@', libssl-dev' if d.getVar('ISAR_CROSS_COMPILE') ==
TEMPLATE_FILES = "debian/control.tmpl"
TEMPLATE_VARS += "MACHINE DEBIAN_BUILD_DEPENDS"
-U_BOOT_TOOLS_PACKAGE ?= "0"
-U_BOOT_CONFIG_PACKAGE ?= "0"
+
+U_BOOT_BUILD_PROFILES ?= "dev"
do_prepare_build() {
cp -r ${WORKDIR}/debian ${S}/
@@ -41,31 +58,15 @@ do_prepare_build() {
echo "${U_BOOT_BIN} /usr/lib/u-boot/${MACHINE}" > \
${S}/debian/u-boot-${MACHINE}.install
- echo "tools/env/libubootenv.a usr/lib" > \
- ${S}/debian/u-boot-${MACHINE}-dev.install
-
- if [ "${U_BOOT_TOOLS_PACKAGE}" = "1" ]; then
- cat <<EOF >>${S}/debian/control
-
-Package: u-boot-tools
-Architecture: linux-any
-Depends: \${shlibs:Depends}, \${misc:Depends}
-Description: ${DESCRIPTION}, companion tools
-EOF
+ if [ "${@bb.utils.contains('U_BOOT_BUILD_PROFILES', 'dev', 'yes', 'no', d)}" = "yes" ];then
+ echo "tools/env/libubootenv.a usr/lib" > \
+ ${S}/debian/u-boot-${MACHINE}-dev.install
fi
- if [ "${U_BOOT_CONFIG_PACKAGE}" = "1" ]; then
+ if [ "${@bb.utils.contains('U_BOOT_BUILD_PROFILES', 'config', 'yes', 'no', d)}" = "yes" ];then
cp ${WORKDIR}/fw_env.config ${S}/ || \
die "U_BOOT_CONFIG_PACKAGE requires a fw_env.config in SRC_URI"
- cat <<EOF >>${S}/debian/control
-
-Package: u-boot-${MACHINE}-config
-Provides: u-boot-config
-Architecture: ${DISTRO_ARCH}
-Description: ${DESCRIPTION}, environment configuration
-EOF
-
cat <<EOF >>${S}/debian/u-boot-${MACHINE}-config.install
u-boot-initial-env /etc
fw_env.config /etc
@@ -76,4 +77,5 @@ EOF
dpkg_runbuild_prepend() {
export U_BOOT_CONFIG="${U_BOOT_CONFIG}"
export U_BOOT_BIN="${U_BOOT_BIN}"
+ export DEB_BUILD_PROFILES="${U_BOOT_BUILD_PROFILES}"
}
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 2/3] meta/u-boot: Include libssl-dev only when building tools
2021-11-20 6:39 [PATCH v4 0/3] UBoot refactor Vijai Kumar K
2021-11-20 6:39 ` [PATCH v4 1/3] u-boot: Switch to use DEB_BUILD_PROFILES Vijai Kumar K
@ 2021-11-20 6:39 ` Vijai Kumar K
2021-11-22 6:24 ` Jan Kiszka
2021-11-20 6:39 ` [PATCH v4 3/3] meta-isar: u-boot: Migrate to U_BOOT_BUILD_PROFILES Vijai Kumar K
2 siblings, 1 reply; 6+ messages in thread
From: Vijai Kumar K @ 2021-11-20 6:39 UTC (permalink / raw)
To: isar-users; +Cc: Vijai Kumar K
libssl-dev of the host architecture is needed only when you
cross compile u-boot-tools.
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
meta/recipes-bsp/u-boot/u-boot-custom.inc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc
index 5e8a15b..4001f8c 100644
--- a/meta/recipes-bsp/u-boot/u-boot-custom.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc
@@ -42,7 +42,8 @@ python() {
}
DEBIAN_BUILD_DEPENDS ?= "bc, bison, flex, device-tree-compiler, git, libssl-dev:native"
-DEBIAN_BUILD_DEPENDS += "${@', libssl-dev' if d.getVar('ISAR_CROSS_COMPILE') == '1' else ''}"
+DEBIAN_BUILD_DEPENDS += "${@', libssl-dev' if (d.getVar('ISAR_CROSS_COMPILE') == '1' and \
+ bb.utils.contains('U_BOOT_BUILD_PROFILES', 'tools', 1, 0, d)) else ''}"
TEMPLATE_FILES = "debian/control.tmpl"
TEMPLATE_VARS += "MACHINE DEBIAN_BUILD_DEPENDS"
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread