* [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include
@ 2018-09-05 18:17 Jan Kiszka
2018-09-05 18:18 ` [PATCH 1/5] meta: Factor out buildchroot class Jan Kiszka
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:17 UTC (permalink / raw)
To: isar-users
This allows to select the bootloader installation for the imager, e.g.
wic, via configuration files rather than hardcoding that into the
buildchroot recipe.
This mechanism can then also be used to select u-boot as bootloader,
including custom builds of it. To simplify the latter, the last patch
provides a u-boot-custom.inc analogously to the kernel build.
This lacks a bit documentation at this stage, so let me sketch the
process to build and deploy the last U-Boot release for, say, the
Orange Pi Zero (MACHINE = "orangepi-zero"):
[u-boot_2017.07.bb]
require recipes-bsp/u-boot/u-boot-custom.inc
SRC_URI += " ftp://ftp.denx.de/pub/u-boot/u-boot-.tar.bz2 "
SRC_URI[sha256sum] = "9f10df88bc91b35642e461217f73256bbaeeca9ae2db8db56197ba5e89e1f6d4"
U_BOOT_CONFIG = "orangepi_zero_defconfig"
U_BOOT_BIN = "u-boot-sunxi-with-spl.bin"
[conf/machine/orangepi-zero.conf]
IMAGE_TYPE = "wic-img"
WKS_FILE ?= "orangepi-zero"
IMAGER_INSTALL += "u-boot-orangepi-zero"
IMAGER_BUILD_DEPS += "u-boot-orangepi-zero"
IMAGE_INSTALL_append = " u-boot-tools u-boot-script"
...
[scripts/lib/wic/canned-wks/orangepi-zero.wks]
part u-boot --source rawcopy --sourceparams="file=/usr/lib/u-boot/orangepi_zero/u-boot-sunxi-with-spl.bin" --ondisk mmcblk --no-table --align 8
...
Hope that explains the required tunings.
The series may depend on some of my pending (but all posted) patches,
didn't check that. It's primarily sent now to request feedback if the
interfaces are useful for further customizations of U-Boot that we have
to do here (to SWUpdate, sign binaries etc.).
Jan
Jan Kiszka (5):
meta: Factor out buildchroot class
image: Add imager dependency installation task
wic-img: Require explicit setting of WKS_FILE
Install wic and bootloader dependencies via imager_install_deps
meta: Add custom U-Boot recipe include
meta-isar/conf/distro/debian-buster.conf | 4 +++
meta-isar/conf/distro/debian-common.conf | 19 ++++++++++
meta-isar/conf/distro/debian-jessie.conf | 2 ++
meta-isar/conf/distro/debian-stretch.conf | 2 ++
meta-isar/conf/distro/debian-wheezy.conf | 2 ++
meta-isar/conf/multiconfig/bananapi-stretch.conf | 2 +-
meta-isar/conf/multiconfig/qemuamd64-buster.conf | 2 ++
meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 2 ++
meta-isar/conf/multiconfig/qemui386-buster.conf | 1 +
meta-isar/conf/multiconfig/qemui386-stretch.conf | 1 +
meta/classes/buildchroot.bbclass | 33 ++++++++++++++++++
meta/classes/dpkg-base.bbclass | 33 ++++--------------
meta/classes/image.bbclass | 40 ++++++++++++++++++++++
meta/classes/wic-img.bbclass | 8 +++--
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 +++++++++++++++++++
.../buildchroot/buildchroot-target.bb | 33 ------------------
23 files changed, 217 insertions(+), 63 deletions(-)
create mode 100644 meta-isar/conf/distro/debian-common.conf
create mode 100644 meta/classes/buildchroot.bbclass
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
--
2.16.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] meta: Factor out buildchroot class
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
@ 2018-09-05 18:18 ` Jan Kiszka
2018-09-05 18:18 ` [PATCH 2/5] image: Add imager dependency installation task Jan Kiszka
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:18 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This makes commonly useful things like BUILDCHROOT_DIR determination as
well as mounting into the builchroot available for reuse outside of the
dpkg scope.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/buildchroot.bbclass | 33 +++++++++++++++++++++++++++++++++
meta/classes/dpkg-base.bbclass | 33 ++++++---------------------------
2 files changed, 39 insertions(+), 27 deletions(-)
create mode 100644 meta/classes/buildchroot.bbclass
diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
new file mode 100644
index 0000000..f67335e
--- /dev/null
+++ b/meta/classes/buildchroot.bbclass
@@ -0,0 +1,33 @@
+# This software is a part of ISAR.
+# Copyright (C) 2018 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+ISAR_CROSS_COMPILE ??= "0"
+
+# Add dependency from the correct buildchroot: host or target
+python __anonymous() {
+ mode = d.getVar('ISAR_CROSS_COMPILE', True)
+ if mode == "0":
+ dep = "buildchroot-target:do_build"
+ rootfs = d.getVar('BUILDCHROOT_TARGET_DIR', True)
+ else:
+ dep = "buildchroot-host:do_build"
+ rootfs = d.getVar('BUILDCHROOT_HOST_DIR', True)
+
+ d.setVarFlag('do_prepare_build', 'depends', dep)
+ d.setVar('BUILDCHROOT_DIR', rootfs)
+}
+
+MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}/mount.lock"
+
+buildchroot_do_mounts() {
+ sudo flock ${MOUNT_LOCKFILE} -c ' \
+ set -e
+ if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
+ mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
+ mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
+ mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
+ mount -t proc none ${BUILDCHROOT_DIR}/proc
+ fi'
+}
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index a2d2ff0..edd111b 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -1,24 +1,12 @@
# This software is a part of ISAR.
-# Copyright (C) 2017 Siemens AG
+# Copyright (C) 2017-2018 Siemens AG
+#
+# SPDX-License-Identifier: MIT
-ISAR_CROSS_COMPILE ??= "0"
+inherit buildchroot
DEPENDS ?= ""
-# Add dependency from the correct buildchroot: host or target
-python __anonymous() {
- mode = d.getVar('ISAR_CROSS_COMPILE', True)
- if mode == "0":
- dep = "buildchroot-target:do_build"
- rootfs = d.getVar('BUILDCHROOT_TARGET_DIR', True)
- else:
- dep = "buildchroot-host:do_build"
- rootfs = d.getVar('BUILDCHROOT_HOST_DIR', True)
-
- d.setVarFlag('do_prepare_build', 'depends', dep)
- d.setVar('BUILDCHROOT_DIR', rootfs)
-}
-
do_adjust_git() {
if [ -f ${S}/.git/objects/info/alternates ]; then
sed -i ${S}/.git/objects/info/alternates \
@@ -45,7 +33,6 @@ def get_package_srcdir(d):
PP = "/home/builder/${PN}"
PPS ?= "${@get_package_srcdir(d)}"
-BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
# Empty do_prepare_build() implementation, to be overwritten if needed
@@ -59,21 +46,13 @@ do_prepare_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
# deployed to isar-apt
do_prepare_build[deptask] = "do_deploy_deb"
-MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}/mount.lock"
+BUILDROOT = "${BUILDCHROOT_DIR}/${PP}"
-# Wrap the function dpkg_runbuild with the bind mount for buildroot
dpkg_do_mounts() {
mkdir -p ${BUILDROOT}
sudo mount --bind ${WORKDIR} ${BUILDROOT}
- sudo flock ${MOUNT_LOCKFILE} -c ' \
- set -e
- if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then
- mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt
- mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
- mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
- mount -t proc none ${BUILDCHROOT_DIR}/proc
- fi'
+ buildchroot_do_mounts
}
dpkg_undo_mounts() {
--
2.16.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/5] image: Add imager dependency installation task
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 ` Jan Kiszka
2018-09-05 18:18 ` [PATCH 3/5] wic-img: Require explicit setting of WKS_FILE Jan Kiszka
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:18 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This adds a way to install dependencies of an imager like wic after
rootfs creation. The interface consists of the to be installed packages
(IMAGER_INSTALL) as well as potential recipe dependencies
(IMAGER_BUILD_DEPS).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/image.bbclass | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 6a5f0e9..d7f71e3 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -104,3 +104,37 @@ do_populate_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
do_populate_sdk[depends] = "sdkchroot:do_build"
addtask populate_sdk after do_rootfs
+
+# Imager are expected to run natively, thus will use the target buildchroot.
+ISAR_CROSS_COMPILE = "0"
+
+inherit buildchroot
+
+IMAGER_INSTALL ??= ""
+IMAGER_BUILD_DEPS ??= ""
+DEPENDS += "${IMAGER_BUILD_DEPS}"
+
+do_install_imager_deps() {
+ if [ -z "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
+ exit
+ fi
+
+ buildchroot_do_mounts
+
+ E="${@bb.utils.export_proxies(d)}"
+ sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
+ apt-get update \
+ -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
+ -o Dir::Etc::sourceparts="-" \
+ -o APT::Get::List-Cleanup="0"
+ apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
+ --allow-unauthenticated install \
+ ${IMAGER_INSTALL}'
+}
+
+do_install_imager_deps[depends] = "buildchroot-target:do_build"
+do_install_imager_deps[deptask] = "do_deploy_deb"
+do_install_imager_deps[lockfiles] += "${DEPLOY_DIR_APT}/isar.lock"
+do_install_imager_deps[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+addtask install_imager_deps before do_build
--
2.16.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/5] wic-img: Require explicit setting of WKS_FILE
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 ` Jan Kiszka
2018-09-05 18:18 ` [PATCH 4/5] Install wic and bootloader dependencies via imager_install_deps Jan Kiszka
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:18 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
Do not default to some meta-isar file, that's both a laying violation
nor helpful once the user also need to specify the bootloader
dependencies for the imager.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/conf/multiconfig/qemuamd64-buster.conf | 1 +
meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 1 +
meta/classes/wic-img.bbclass | 6 +++++-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/meta-isar/conf/multiconfig/qemuamd64-buster.conf b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
index 85404ae..8140d13 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-buster.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
@@ -10,6 +10,7 @@ KERNEL_NAME ?= "amd64"
IMAGE_PREINSTALL += "init"
IMAGE_TYPE ?= "wic-img"
+WKS_FILE ?= "sdimage-efi"
ROOTFS_DEV ?= "sda2"
diff --git a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
index 356d59b..0184617 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
@@ -11,6 +11,7 @@ KERNEL_NAME ?= "amd64"
IMAGE_PREINSTALL += "init"
IMAGE_TYPE ?= "wic-img"
+WKS_FILE ?= "sdimage-efi"
ROOTFS_DEV ?= "sda2"
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index bc405c1..167a54b 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -4,7 +4,11 @@
# this class is heavily inspired by OEs ./meta/classes/image_types_wic.bbclass
#
-WKS_FILE ?= "sdimage-efi"
+python () {
+ if not d.getVar('WKS_FILE', True):
+ bb.fatal("WKS_FILE must be set")
+}
+
ROOTFS_TYPE ?= "ext4"
STAGING_DATADIR ?= "/usr/lib/"
--
2.16.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/5] Install wic and bootloader dependencies via imager_install_deps
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
` (2 preceding siblings ...)
2018-09-05 18:18 ` [PATCH 3/5] wic-img: Require explicit setting of WKS_FILE Jan Kiszka
@ 2018-09-05 18:18 ` Jan Kiszka
2018-09-05 18:18 ` [PATCH 5/5] meta: Add custom U-Boot recipe include Jan Kiszka
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:18 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This removes the wic dependency installation hack from
buildchroot-target, modeling this instead with the new IMAGER_INSTALL
interface. The basic dependencies of wic are still automatically
installed as soon as the image type is switched to wic-img. However,
those of the bootloader now requires explicit statements.
For that, GRUB_BOOTLOADER_INSTALL and SYSLINUX_BOOTLOADER_INSTALL
variables are introduced and set by the distro confs accordingly. So the
user just needs to assign their value to IMAGE_INSTALL if the
corresponding bootloader is selected in a WKS file - or by some other
imaging mechanism.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/conf/distro/debian-buster.conf | 4 +++
meta-isar/conf/distro/debian-common.conf | 19 +++++++++++++
meta-isar/conf/distro/debian-jessie.conf | 2 ++
meta-isar/conf/distro/debian-stretch.conf | 2 ++
meta-isar/conf/distro/debian-wheezy.conf | 2 ++
meta-isar/conf/multiconfig/bananapi-stretch.conf | 2 +-
meta-isar/conf/multiconfig/qemuamd64-buster.conf | 1 +
meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 1 +
meta-isar/conf/multiconfig/qemui386-buster.conf | 1 +
meta-isar/conf/multiconfig/qemui386-stretch.conf | 1 +
meta/classes/image.bbclass | 6 ++++
meta/classes/wic-img.bbclass | 2 +-
.../buildchroot/buildchroot-target.bb | 33 ----------------------
13 files changed, 41 insertions(+), 35 deletions(-)
create mode 100644 meta-isar/conf/distro/debian-common.conf
diff --git a/meta-isar/conf/distro/debian-buster.conf b/meta-isar/conf/distro/debian-buster.conf
index 7d1c921..f3f843c 100644
--- a/meta-isar/conf/distro/debian-buster.conf
+++ b/meta-isar/conf/distro/debian-buster.conf
@@ -1,6 +1,10 @@
# This software is a part of ISAR.
+require debian-common.conf
+
DISTRO_APT_SOURCES += "conf/distro/debian-buster.list"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_KERNELS ?= "4kc-malta 5kc-malta 686 686-pae amd64 arm64 armmp \
armmp-lpae cloud-amd64 loongson-3 marvell octeon powerpc64le s390x"
+
+WIC_IMAGER_INSTALL += "python3-distutils"
diff --git a/meta-isar/conf/distro/debian-common.conf b/meta-isar/conf/distro/debian-common.conf
new file mode 100644
index 0000000..bb74f1e
--- /dev/null
+++ b/meta-isar/conf/distro/debian-common.conf
@@ -0,0 +1,19 @@
+# This software is a part of ISAR.
+# Copyright (C) 2018 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+WIC_IMAGER_INSTALL = "parted \
+ gdisk \
+ util-linux \
+ dosfstools \
+ mtools \
+ e2fsprogs \
+ python3"
+
+GRUB_BOOTLOADER_INSTALL_amd64 = "grub-efi-amd64-bin"
+GRUB_BOOTLOADER_INSTALL_i386 = "grub-efi-ia32-bin"
+GRUB_BOOTLOADER_INSTALL_armhf = "grub-efi-arm-bin"
+GRUB_BOOTLOADER_INSTALL_arm64 = "grub-efi-arm64-bin"
+
+SYSLINUX_BOOTLOADER_INSTALL = "syslinux syslinux-common"
diff --git a/meta-isar/conf/distro/debian-jessie.conf b/meta-isar/conf/distro/debian-jessie.conf
index ea46be6..cbdf791 100644
--- a/meta-isar/conf/distro/debian-jessie.conf
+++ b/meta-isar/conf/distro/debian-jessie.conf
@@ -3,6 +3,8 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2016 ilbers GmbH
+require debian-common.conf
+
DISTRO_APT_SOURCES += "conf/distro/debian-jessie.list"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_KERNELS ?= "486 4kc-malta 586 5kc-malta 686-pae amd64 arm64 armmp \
diff --git a/meta-isar/conf/distro/debian-stretch.conf b/meta-isar/conf/distro/debian-stretch.conf
index 99d1737..cce5493 100644
--- a/meta-isar/conf/distro/debian-stretch.conf
+++ b/meta-isar/conf/distro/debian-stretch.conf
@@ -1,6 +1,8 @@
# This software is a part of ISAR.
# Copyright (C) 2017 ilbers GmbH
+require debian-common.conf
+
DISTRO_APT_SOURCES += "conf/distro/debian-stretch.list"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_KERNELS ?= "4kc-malta 586 5kc-malta 686 686-pae amd64 arm64 armmp \
diff --git a/meta-isar/conf/distro/debian-wheezy.conf b/meta-isar/conf/distro/debian-wheezy.conf
index 5b2e936..a5f52fc 100644
--- a/meta-isar/conf/distro/debian-wheezy.conf
+++ b/meta-isar/conf/distro/debian-wheezy.conf
@@ -3,6 +3,8 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2016 ilbers GmbH
+require debian-common.conf
+
DISTRO_APT_SOURCES += "conf/distro/debian-wheezy.list"
DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh"
DISTRO_KERNELS ?= "486 686-pae amd64 rt-686-pae rt-amd64 versatile vexpress \
diff --git a/meta-isar/conf/multiconfig/bananapi-stretch.conf b/meta-isar/conf/multiconfig/bananapi-stretch.conf
index a78300a..b884b44 100644
--- a/meta-isar/conf/multiconfig/bananapi-stretch.conf
+++ b/meta-isar/conf/multiconfig/bananapi-stretch.conf
@@ -16,9 +16,9 @@ DISTRO_APT_SOURCES_append = " conf/distro/debian-stretch-backports.list"
DISTRO_APT_PREFERENCES += "conf/multiconfig/preferences.bananapi.conf"
IMAGE_INSTALL += "u-boot-script"
-BUILDCHROOT_PREINSTALL_WIC_append = " u-boot-sunxi"
IMAGE_TYPE ?= "wic-img"
WKS_FILE ?= "bananapi"
+IMAGER_INSTALL += "u-boot-sunxi"
ROOTFS_DEV ?= "mmcblk0p1"
diff --git a/meta-isar/conf/multiconfig/qemuamd64-buster.conf b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
index 8140d13..404f48a 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-buster.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-buster.conf
@@ -11,6 +11,7 @@ IMAGE_PREINSTALL += "init"
IMAGE_TYPE ?= "wic-img"
WKS_FILE ?= "sdimage-efi"
+IMAGER_INSTALL += "${GRUB_BOOTLOADER_INSTALL}"
ROOTFS_DEV ?= "sda2"
diff --git a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
index 0184617..3d1ef28 100644
--- a/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
+++ b/meta-isar/conf/multiconfig/qemuamd64-stretch.conf
@@ -12,6 +12,7 @@ IMAGE_PREINSTALL += "init"
IMAGE_TYPE ?= "wic-img"
WKS_FILE ?= "sdimage-efi"
+IMAGER_INSTALL += "${GRUB_BOOTLOADER_INSTALL}"
ROOTFS_DEV ?= "sda2"
diff --git a/meta-isar/conf/multiconfig/qemui386-buster.conf b/meta-isar/conf/multiconfig/qemui386-buster.conf
index e09cd0c..279d321 100644
--- a/meta-isar/conf/multiconfig/qemui386-buster.conf
+++ b/meta-isar/conf/multiconfig/qemui386-buster.conf
@@ -11,6 +11,7 @@ IMAGE_PREINSTALL += "init"
IMAGE_TYPE ?= "wic-img"
WKS_FILE ?= "directdisk-isar"
+IMAGER_INSTALL += "${SYSLINUX_BOOTLOADER_INSTALL}"
ROOTFS_DEV ?= "sda2"
diff --git a/meta-isar/conf/multiconfig/qemui386-stretch.conf b/meta-isar/conf/multiconfig/qemui386-stretch.conf
index 8966c2b..6f3041b 100644
--- a/meta-isar/conf/multiconfig/qemui386-stretch.conf
+++ b/meta-isar/conf/multiconfig/qemui386-stretch.conf
@@ -12,6 +12,7 @@ IMAGE_PREINSTALL += "init"
IMAGE_TYPE ?= "wic-img"
WKS_FILE ?= "directdisk-isar"
+IMAGER_INSTALL += "${SYSLINUX_BOOTLOADER_INSTALL}"
ROOTFS_DEV ?= "sda2"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d7f71e3..55f0b3a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -114,6 +114,12 @@ IMAGER_INSTALL ??= ""
IMAGER_BUILD_DEPS ??= ""
DEPENDS += "${IMAGER_BUILD_DEPS}"
+python () {
+ if d.getVar('IMAGE_TYPE', True) == 'wic-img':
+ d.appendVar('IMAGER_INSTALL',
+ ' ' + d.getVar('WIC_IMAGER_INSTALL', True))
+}
+
do_install_imager_deps() {
if [ -z "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
exit
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 167a54b..635fbbf 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -81,4 +81,4 @@ do_wic_image() {
do_wic_image[depends] = "buildchroot-target:do_build"
-addtask wic_image before do_build after do_copy_boot_files
+addtask wic_image before do_build after do_install_imager_deps
diff --git a/meta/recipes-devtools/buildchroot/buildchroot-target.bb b/meta/recipes-devtools/buildchroot/buildchroot-target.bb
index 34abb72..42f47fc 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot-target.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot-target.bb
@@ -20,37 +20,4 @@ BUILDCHROOT_PREINSTALL ?= "gcc \
devscripts \
equivs"
-BUILDCHROOT_PREINSTALL_WIC = " \
- parted \
- gdisk \
- util-linux \
- dosfstools \
- mtools \
- e2fsprogs \
- python3"
-
-BUILDCHROOT_PREINSTALL_WIC_append_debian-buster = " python3-distutils"
-
-BUILDCHROOT_PREINSTALL_WIC_append_amd64 = " \
- syslinux \
- syslinux-common \
- grub-efi-amd64-bin"
-
-BUILDCHROOT_PREINSTALL_WIC_append_armhf = " \
- grub-efi-arm-bin"
-
-BUILDCHROOT_PREINSTALL_WIC_append_arm64 = " \
- grub-efi-arm64-bin"
-
-BUILDCHROOT_PREINSTALL_WIC_append_i386 = " \
- syslinux \
- syslinux-common \
- grub-efi-ia32-bin"
-
-python () {
- if d.getVar('IMAGE_TYPE', True) == 'wic-img':
- d.appendVar('BUILDCHROOT_PREINSTALL',
- d.getVar('BUILDCHROOT_PREINSTALL_WIC', True))
-}
-
do_build[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_bootstrap"
--
2.16.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/5] meta: Add custom U-Boot recipe include
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
` (3 preceding siblings ...)
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
2018-09-07 18:27 ` [PATCH v2 " 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
6 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:18 UTC (permalink / raw)
To: isar-users
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
` (4 preceding siblings ...)
2018-09-05 18:18 ` [PATCH 5/5] meta: Add custom U-Boot recipe include Jan Kiszka
@ 2018-09-05 18:19 ` Jan Kiszka
2018-09-11 8:33 ` Maxim Yu. Osipov
6 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-05 18:19 UTC (permalink / raw)
To: isar-users
On 2018-09-05 20:17, [ext] Jan Kiszka wrote:
> This allows to select the bootloader installation for the imager, e.g.
> wic, via configuration files rather than hardcoding that into the
> buildchroot recipe.
>
> This mechanism can then also be used to select u-boot as bootloader,
> including custom builds of it. To simplify the latter, the last patch
> provides a u-boot-custom.inc analogously to the kernel build.
>
> This lacks a bit documentation at this stage, so let me sketch the
> process to build and deploy the last U-Boot release for, say, the
> Orange Pi Zero (MACHINE = "orangepi-zero"):
>
> [u-boot_2017.07.bb]
> require recipes-bsp/u-boot/u-boot-custom.inc
>
> SRC_URI += " ftp://ftp.denx.de/pub/u-boot/u-boot-.tar.bz2 "
Great, mangled by local patch series script that I'm too lazy to fix.
Should be:
SRC_URI += " \
ftp://ftp.denx.de/pub/u-boot/u-boot-${PV}.tar.bz2 \
"
> SRC_URI[sha256sum] = "9f10df88bc91b35642e461217f73256bbaeeca9ae2db8db56197ba5e89e1f6d4"
>
> U_BOOT_CONFIG = "orangepi_zero_defconfig"
> U_BOOT_BIN = "u-boot-sunxi-with-spl.bin"
>
> [conf/machine/orangepi-zero.conf]
> IMAGE_TYPE = "wic-img"
> WKS_FILE ?= "orangepi-zero"
> IMAGER_INSTALL += "u-boot-orangepi-zero"
> IMAGER_BUILD_DEPS += "u-boot-orangepi-zero"
>
> IMAGE_INSTALL_append = " u-boot-tools u-boot-script"
> ...
>
> [scripts/lib/wic/canned-wks/orangepi-zero.wks]
> part u-boot --source rawcopy --sourceparams="file=/usr/lib/u-boot/orangepi_zero/u-boot-sunxi-with-spl.bin" --ondisk mmcblk --no-table --align 8
> ...
>
> Hope that explains the required tunings.
>
> The series may depend on some of my pending (but all posted) patches,
> didn't check that. It's primarily sent now to request feedback if the
> interfaces are useful for further customizations of U-Boot that we have
> to do here (to SWUpdate, sign binaries etc.).
>
> Jan
>
> Jan Kiszka (5):
> meta: Factor out buildchroot class
> image: Add imager dependency installation task
> wic-img: Require explicit setting of WKS_FILE
> Install wic and bootloader dependencies via imager_install_deps
> meta: Add custom U-Boot recipe include
>
> meta-isar/conf/distro/debian-buster.conf | 4 +++
> meta-isar/conf/distro/debian-common.conf | 19 ++++++++++
> meta-isar/conf/distro/debian-jessie.conf | 2 ++
> meta-isar/conf/distro/debian-stretch.conf | 2 ++
> meta-isar/conf/distro/debian-wheezy.conf | 2 ++
> meta-isar/conf/multiconfig/bananapi-stretch.conf | 2 +-
> meta-isar/conf/multiconfig/qemuamd64-buster.conf | 2 ++
> meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 2 ++
> meta-isar/conf/multiconfig/qemui386-buster.conf | 1 +
> meta-isar/conf/multiconfig/qemui386-stretch.conf | 1 +
> meta/classes/buildchroot.bbclass | 33 ++++++++++++++++++
> meta/classes/dpkg-base.bbclass | 33 ++++--------------
> meta/classes/image.bbclass | 40 ++++++++++++++++++++++
> meta/classes/wic-img.bbclass | 8 +++--
> 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 +++++++++++++++++++
> .../buildchroot/buildchroot-target.bb | 33 ------------------
> 23 files changed, 217 insertions(+), 63 deletions(-)
> create mode 100644 meta-isar/conf/distro/debian-common.conf
> create mode 100644 meta/classes/buildchroot.bbclass
> 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
>
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 5/5] meta: Add custom U-Boot recipe include
2018-09-05 18:18 ` [PATCH 5/5] meta: Add custom U-Boot recipe include Jan Kiszka
@ 2018-09-07 18:27 ` Jan Kiszka
0 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2018-09-07 18:27 UTC (permalink / raw)
To: isar-users
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>
---
Changes in v2:
- fix copy&paste error in FILESPATH
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..f3fca00
--- /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-bsp/u-boot/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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
` (5 preceding siblings ...)
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
6 siblings, 0 replies; 9+ messages in thread
From: Maxim Yu. Osipov @ 2018-09-11 8:33 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 09/05/2018 09:17 PM, Jan Kiszka wrote:
> This allows to select the bootloader installation for the imager, e.g.
> wic, via configuration files rather than hardcoding that into the
> buildchroot recipe.
>
> This mechanism can then also be used to select u-boot as bootloader,
> including custom builds of it. To simplify the latter, the last patch
> provides a u-boot-custom.inc analogously to the kernel build.
>
> This lacks a bit documentation at this stage, so let me sketch the
> process to build and deploy the last U-Boot release for, say, the
> Orange Pi Zero (MACHINE = "orangepi-zero"):
>
> [u-boot_2017.07.bb]
> require recipes-bsp/u-boot/u-boot-custom.inc
>
> SRC_URI += " ftp://ftp.denx.de/pub/u-boot/u-boot-.tar.bz2 "
> SRC_URI[sha256sum] = "9f10df88bc91b35642e461217f73256bbaeeca9ae2db8db56197ba5e89e1f6d4"
>
> U_BOOT_CONFIG = "orangepi_zero_defconfig"
> U_BOOT_BIN = "u-boot-sunxi-with-spl.bin"
>
> [conf/machine/orangepi-zero.conf]
> IMAGE_TYPE = "wic-img"
> WKS_FILE ?= "orangepi-zero"
> IMAGER_INSTALL += "u-boot-orangepi-zero"
> IMAGER_BUILD_DEPS += "u-boot-orangepi-zero"
>
> IMAGE_INSTALL_append = " u-boot-tools u-boot-script"
> ...
>
> [scripts/lib/wic/canned-wks/orangepi-zero.wks]
> part u-boot --source rawcopy --sourceparams="file=/usr/lib/u-boot/orangepi_zero/u-boot-sunxi-with-spl.bin" --ondisk mmcblk --no-table --align 8
> ...
>
> Hope that explains the required tunings.
>
> The series may depend on some of my pending (but all posted) patches,
> didn't check that. It's primarily sent now to request feedback if the
> interfaces are useful for further customizations of U-Boot that we have
> to do here (to SWUpdate, sign binaries etc.).
Applied to the 'next' (v2 of patch #5 was applied)
Thanks,
Maxim.
> Jan
>
> Jan Kiszka (5):
> meta: Factor out buildchroot class
> image: Add imager dependency installation task
> wic-img: Require explicit setting of WKS_FILE
> Install wic and bootloader dependencies via imager_install_deps
> meta: Add custom U-Boot recipe include
>
> meta-isar/conf/distro/debian-buster.conf | 4 +++
> meta-isar/conf/distro/debian-common.conf | 19 ++++++++++
> meta-isar/conf/distro/debian-jessie.conf | 2 ++
> meta-isar/conf/distro/debian-stretch.conf | 2 ++
> meta-isar/conf/distro/debian-wheezy.conf | 2 ++
> meta-isar/conf/multiconfig/bananapi-stretch.conf | 2 +-
> meta-isar/conf/multiconfig/qemuamd64-buster.conf | 2 ++
> meta-isar/conf/multiconfig/qemuamd64-stretch.conf | 2 ++
> meta-isar/conf/multiconfig/qemui386-buster.conf | 1 +
> meta-isar/conf/multiconfig/qemui386-stretch.conf | 1 +
> meta/classes/buildchroot.bbclass | 33 ++++++++++++++++++
> meta/classes/dpkg-base.bbclass | 33 ++++--------------
> meta/classes/image.bbclass | 40 ++++++++++++++++++++++
> meta/classes/wic-img.bbclass | 8 +++--
> 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 +++++++++++++++++++
> .../buildchroot/buildchroot-target.bb | 33 ------------------
> 23 files changed, 217 insertions(+), 63 deletions(-)
> create mode 100644 meta-isar/conf/distro/debian-common.conf
> create mode 100644 meta/classes/buildchroot.bbclass
> 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
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-09-11 8:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 5/5] meta: Add custom U-Boot recipe include Jan Kiszka
2018-09-07 18:27 ` [PATCH v2 " 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox