public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH 5/5] meta: Add custom U-Boot recipe include
Date: Wed,  5 Sep 2018 20:18:04 +0200	[thread overview]
Message-ID: <4e945fe0d12981b2a7f60f14a0317117d69cfdaa.1536171484.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1536171484.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1536171484.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

This simplifies the building of custom U-Boot versions significantly.
Just include u-boot-custom.inc in a recipe, define the source as well as
U_BOOT_CONFIG and the target U_BOOT_BIN (binary). The latter will be
packaged and can then be deployed via IMAGER_INSTALL + IMAGER_BUILD_DEPS
to the buildchroot for installation by the imager (e.g. wic).

The package structure this generates is similar though no identical to
Debian upstream:
 - u-boot-${MACHINE}: contains U_BOOT_BIN
 - u-boot-${MACHINE}-dev: contains tools/env/lib.a as libubootenv.a
   which is needed by SWUpdate (recipe for the latter will eventually be
   contributed)
 - u-boot-tools which replaces the upstream package (minus some special
   SOC-specific tools we skip for simplicity reasons)

There is no plain "u-boot" package as we have no use case for it here.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/recipes-bsp/u-boot/files/debian/changelog     |  5 +++
 meta/recipes-bsp/u-boot/files/debian/compat        |  1 +
 meta/recipes-bsp/u-boot/files/debian/control       | 19 ++++++++++++
 meta/recipes-bsp/u-boot/files/debian/rules         | 28 +++++++++++++++++
 .../u-boot/files/debian/u-boot-tools.conffiles     |  1 +
 .../u-boot/files/debian/u-boot-tools.install       |  5 +++
 .../u-boot/files/debian/u-boot-tools.links         |  1 +
 meta/recipes-bsp/u-boot/u-boot-custom.inc          | 36 ++++++++++++++++++++++
 8 files changed, 96 insertions(+)
 create mode 100644 meta/recipes-bsp/u-boot/files/debian/changelog
 create mode 100644 meta/recipes-bsp/u-boot/files/debian/compat
 create mode 100644 meta/recipes-bsp/u-boot/files/debian/control
 create mode 100755 meta/recipes-bsp/u-boot/files/debian/rules
 create mode 100644 meta/recipes-bsp/u-boot/files/debian/u-boot-tools.conffiles
 create mode 100644 meta/recipes-bsp/u-boot/files/debian/u-boot-tools.install
 create mode 100644 meta/recipes-bsp/u-boot/files/debian/u-boot-tools.links
 create mode 100644 meta/recipes-bsp/u-boot/u-boot-custom.inc

diff --git a/meta/recipes-bsp/u-boot/files/debian/changelog b/meta/recipes-bsp/u-boot/files/debian/changelog
new file mode 100644
index 0000000..c1c3516
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/changelog
@@ -0,0 +1,5 @@
+@PN@ (@PV@) unstable; urgency=low
+
+  * Generated package.
+
+ -- ISAR project <isar-users@googlegroups.com>  Tue, 6 Feb 2018 00:00:00 +0000
diff --git a/meta/recipes-bsp/u-boot/files/debian/compat b/meta/recipes-bsp/u-boot/files/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/meta/recipes-bsp/u-boot/files/debian/control b/meta/recipes-bsp/u-boot/files/debian/control
new file mode 100644
index 0000000..df23a69
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/control
@@ -0,0 +1,19 @@
+Source: @PN@
+Section: admin
+Priority: optional
+Standards-Version: 3.9.6
+Build-Depends: bc, bison, flex, device-tree-compiler
+Maintainer: ISAR project <isar-users@googlegroups.com>
+
+Package: u-boot-@MACHINE@
+Architecture: @DISTRO_ARCH@
+Description: @DESCRIPTION@, bootloader binaries
+
+Package: u-boot-@MACHINE@-dev
+Architecture: @DISTRO_ARCH@
+Description: @DESCRIPTION@, bootloader libraries
+
+Package: u-boot-tools
+Architecture: linux-any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: @DESCRIPTION@, companion tools
diff --git a/meta/recipes-bsp/u-boot/files/debian/rules b/meta/recipes-bsp/u-boot/files/debian/rules
new file mode 100755
index 0000000..deb7c8e
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/rules
@@ -0,0 +1,28 @@
+#!/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
+
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+SET_CROSS_BUILD_TOOLS=CROSS_BUILD_TOOLS=y
+endif
+
+PARALLEL_BUILD=-j $(shell $$(($$(nproc) * 2)))
+
+override_dh_auto_build:
+	$(MAKE) $(PARALLEL_BUILD) $(U_BOOT_CONFIG)
+	$(MAKE) $(PARALLEL_BUILD) ${U_BOOT_BIN}
+	$(MAKE) $(PARALLEL_BUILD) $(SET_CROSS_BUILD_TOOLS) NO_SDL=1 tools-only envtools
+
+override_dh_auto_install:
+	mv tools/env/lib.a tools/env/libubootenv.a
+
+override_dh_auto_test:
+
+%:
+	dh $@ --parallel
diff --git a/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.conffiles b/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.conffiles
new file mode 100644
index 0000000..d49a8fb
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.conffiles
@@ -0,0 +1 @@
+/etc/fw_env.config
diff --git a/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.install b/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.install
new file mode 100644
index 0000000..d1ae3e0
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.install
@@ -0,0 +1,5 @@
+tools/dumpimage		/usr/bin/
+tools/env/fw_printenv	/usr/bin/
+tools/mkenvimage	/usr/bin/
+tools/mkimage		/usr/bin/
+tools/env/fw_env.config	/etc
diff --git a/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.links b/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.links
new file mode 100644
index 0000000..92f5a6c
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/debian/u-boot-tools.links
@@ -0,0 +1 @@
+/usr/bin/fw_printenv /usr/bin/fw_setenv
diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc
new file mode 100644
index 0000000..07fd597
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc
@@ -0,0 +1,36 @@
+# Custom U-Boot build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux/files:"
+
+DESCRIPTION ?= "Custom U-Boot"
+
+PROVIDES += "u-boot-${MACHINE} u-boot-tools"
+
+inherit dpkg
+
+SRC_URI += "file://debian/"
+
+do_prepare_build() {
+    cp -r ${WORKDIR}/debian ${S}/
+    sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
+        -e 's/@MACHINE@/${MACHINE}/g' \
+        -e 's/@DISTRO_ARCH@/${DISTRO_ARCH}/g' \
+        -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
+        ${S}/debian/changelog ${S}/debian/control
+
+    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
+}
+
+dpkg_runbuild_prepend() {
+    export U_BOOT_CONFIG=${U_BOOT_CONFIG}
+    export U_BOOT_BIN=${U_BOOT_BIN}
+}
-- 
2.16.4


  parent reply	other threads:[~2018-09-05 18:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
2018-09-05 18:18 ` [PATCH 1/5] meta: Factor out buildchroot class Jan Kiszka
2018-09-05 18:18 ` [PATCH 2/5] image: Add imager dependency installation task Jan Kiszka
2018-09-05 18:18 ` [PATCH 3/5] wic-img: Require explicit setting of WKS_FILE Jan Kiszka
2018-09-05 18:18 ` [PATCH 4/5] Install wic and bootloader dependencies via imager_install_deps Jan Kiszka
2018-09-05 18:18 ` Jan Kiszka [this message]
2018-09-07 18:27   ` [PATCH v2 5/5] meta: Add custom U-Boot recipe include Jan Kiszka
2018-09-05 18:19 ` [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
2018-09-11  8:33 ` Maxim Yu. Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e945fe0d12981b2a7f60f14a0317117d69cfdaa.1536171484.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox