public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH 5/9] buildchroot-cross: Initial implementation
Date: Wed, 13 Jun 2018 15:08:03 +0200	[thread overview]
Message-ID: <20180613130807.2461-6-asmirnov@ilbers.de> (raw)
In-Reply-To: <20180613130807.2461-1-asmirnov@ilbers.de>

Add initial generation of buildchroot for cross-compilation.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 meta/conf/isar-bitbake.conf                        |  1 +
 .../buildchroot/buildchroot-cross.bb               | 53 ++++++++++++++++++++++
 .../buildchroot/files/build-cross.sh               | 29 ++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 meta/recipes-devtools/buildchroot/buildchroot-cross.bb
 create mode 100644 meta/recipes-devtools/buildchroot/files/build-cross.sh

diff --git a/meta/conf/isar-bitbake.conf b/meta/conf/isar-bitbake.conf
index ead7798..1412508 100644
--- a/meta/conf/isar-bitbake.conf
+++ b/meta/conf/isar-bitbake.conf
@@ -22,6 +22,7 @@ WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PF}"
 DL_DIR = "${TOPDIR}/downloads"
 SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
 BUILDCHROOT_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot/rootfs"
+BUILDCHROOT_CROSS_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/buildchroot-cross/rootfs"
 CACHE = "${TMPDIR}/cache"
 
 OVERRIDES_append = ":${DISTRO}:${DISTRO_ARCH}"
diff --git a/meta/recipes-devtools/buildchroot/buildchroot-cross.bb b/meta/recipes-devtools/buildchroot/buildchroot-cross.bb
new file mode 100644
index 0000000..935a626
--- /dev/null
+++ b/meta/recipes-devtools/buildchroot/buildchroot-cross.bb
@@ -0,0 +1,53 @@
+# Root filesystem for packages cross-building
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2016 ilbers GmbH
+
+DESCRIPTION = "Isar development cross-filesystem"
+
+LICENSE = "gpl-2.0"
+LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
+
+FILESPATH_prepend := "${THISDIR}/files:"
+SRC_URI = "file://configscript.sh \
+           file://build-cross.sh"
+PV = "1.0"
+
+inherit isar-bootstrap-helper
+
+BUILDCHROOT_CROSS_PREINSTALL ?= "gcc-multilib \
+                                 make \
+                                 build-essential \
+                                 debhelper \
+                                 autotools-dev \
+                                 dpkg \
+                                 locales \
+                                 docbook-to-man \
+                                 apt \
+                                 automake \
+                                 devscripts \
+                                 equivs"
+
+# TODO: make this inclusion depending on the target arch
+BUILDCHROOT_CROSS_PREINSTALL += "binutils"
+
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
+
+do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_build[root_cleandirs] = "${BUILDCHROOT_CROSS_DIR} \
+                            ${BUILDCHROOT_CROSS_DIR}/isar-apt \
+                            ${BUILDCHROOT_CROSS_DIR}/downloads \
+                            ${BUILDCHROOT_CROSS_DIR}/home/builder"
+do_build[depends] = "isar-apt:do_cache_config isar-bootstrap-host:do_deploy"
+
+do_build() {
+    setup_root_file_system --host-arch "${BUILDCHROOT_CROSS_DIR}" ${BUILDCHROOT_CROSS_PREINSTALL}
+
+    # Install package builder script
+    sudo chmod -R a+rw "${BUILDCHROOT_CROSS_DIR}/home/builder"
+    sudo install -m 755 ${WORKDIR}/build-cross.sh ${BUILDCHROOT_CROSS_DIR}/build.sh
+
+    # Configure root filesystem
+    sudo install -m 755 ${WORKDIR}/configscript.sh ${BUILDCHROOT_CROSS_DIR}
+    sudo chroot ${BUILDCHROOT_CROSS_DIR} /configscript.sh
+}
diff --git a/meta/recipes-devtools/buildchroot/files/build-cross.sh b/meta/recipes-devtools/buildchroot/files/build-cross.sh
new file mode 100644
index 0000000..8c3ddaf
--- /dev/null
+++ b/meta/recipes-devtools/buildchroot/files/build-cross.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2017 ilbers GmbH
+# Copyright (c) 2018 Siemens AG
+
+set -e
+
+# Go to build directory
+cd $1
+
+# Add target architecture
+dpkg --add-architecture $2
+
+# To avoid Perl locale warnings:
+export LC_ALL=C
+export LANG=C
+export LANGUAGE=C
+
+# If autotools files have been created, update their timestamp to
+# prevent them from being regenerated
+for i in configure aclocal.m4 Makefile.am Makefile.in; do
+    if [ -f "${i}" ]; then
+        touch "${i}"
+    fi
+done
+
+# Build the package
+dpkg-buildpackage -a$2
-- 
2.1.4


  parent reply	other threads:[~2018-06-13 13:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 13:07 [RFC] [PATCH 0/9] Initial cross-compilation support Alexander Smirnov
2018-06-13 13:07 ` [PATCH 1/9] isar-bootstrap: Add routin to determine host arch Alexander Smirnov
2018-06-14 11:23   ` Henning Schild
2018-06-15 11:11     ` Alexander Smirnov
2018-06-15 11:15       ` Jan Kiszka
2018-06-13 13:08 ` [PATCH 2/9] isar-bootstrap: Move common part to include Alexander Smirnov
2018-06-13 13:08 ` [PATCH 3/9] isar-bootstrap: Add host architecture support Alexander Smirnov
2018-06-14 11:27   ` Henning Schild
2018-06-15 11:09     ` Alexander Smirnov
2018-06-13 13:08 ` [PATCH 4/9] isar-bootstrap-helper: Add parameter to set arch Alexander Smirnov
2018-06-13 13:08 ` Alexander Smirnov [this message]
2018-06-14 11:36   ` [PATCH 5/9] buildchroot-cross: Initial implementation Henning Schild
2018-06-15 11:16     ` Alexander Smirnov
2018-06-14 15:55   ` Jan Kiszka
2018-06-15 10:56     ` Alexander Smirnov
2018-06-15 11:12       ` Jan Kiszka
2018-06-17 19:28         ` Alexander Smirnov
2018-06-13 13:08 ` [PATCH 6/9] classes/dpkg*: Relocate dependency from buildchroot Alexander Smirnov
2018-06-14  6:44   ` Jan Kiszka
2018-06-15 10:52     ` Alexander Smirnov
2018-06-13 13:08 ` [PATCH 7/9] classes/dpkg*: Drop hardcoded buildchroot blobs Alexander Smirnov
2018-06-13 13:08 ` [PATCH 8/9] classes/dpkg-cross: Initial implementation Alexander Smirnov
2018-06-13 13:08 ` [PATCH 9/9] [FOR TESTING] libhello: Switch to cross compilation Alexander Smirnov
2018-06-13 13:57 ` [RFC] [PATCH 0/9] Initial cross-compilation support Jan Kiszka
2018-06-14 11:20 ` Henning Schild
2018-06-17 19:41   ` Alexander Smirnov
2018-06-18  7:04     ` Henning Schild
2018-06-14 12:01 ` Henning Schild
2018-06-14 12:04 ` Claudius Heine
2018-06-14 12:24   ` Henning Schild
2018-06-14 12:36     ` Claudius Heine
2018-06-14 12:30   ` Jan Kiszka
2018-06-14 12:42     ` Claudius Heine
2018-06-14 12:55       ` Claudius Heine
2018-06-15 10:50   ` Alexander Smirnov
2018-06-15 13:17     ` Claudius Heine

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=20180613130807.2461-6-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --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