public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Alexander Smirnov <asmirnov@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH v2 05/12] buildchroot-cross: Initial implementation
Date: Wed, 4 Jul 2018 22:05:53 +0200	[thread overview]
Message-ID: <fa93604e-7c38-5b10-b8a3-b35b203d6be5@web.de> (raw)
In-Reply-To: <7113034c-bf3e-a210-e070-b39d8115a576@ilbers.de>


[-- Attachment #1.1: Type: text/plain, Size: 6703 bytes --]

On 2018-07-04 21:56, Alexander Smirnov wrote:
> 
> On 06/29/2018 08:36 PM, Jan Kiszka wrote:
>> On 2018-06-28 10:28, Alexander Smirnov wrote:
>>> Add initial generation of buildchroot for cross-compilation.
>>>
>>> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
>>> ---
>>>   meta/classes/isar-bootstrap-helper.bbclass         |  5 ++
>>>   meta/conf/isar-bitbake.conf                        |  1 +
>>>   .../buildchroot/buildchroot-cross.bb               | 57
>>> ++++++++++++++++++++++
>>>   3 files changed, 63 insertions(+)
>>>   create mode 100644
>>> meta/recipes-devtools/buildchroot/buildchroot-cross.bb
>>>
>>> diff --git a/meta/classes/isar-bootstrap-helper.bbclass
>>> b/meta/classes/isar-bootstrap-helper.bbclass
>>> index d4f8d9a..a3ef19d 100644
>>> --- a/meta/classes/isar-bootstrap-helper.bbclass
>>> +++ b/meta/classes/isar-bootstrap-helper.bbclass
>>> @@ -70,6 +70,11 @@ setup_root_file_system() {
>>>           -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
>>>           -o Dir::Etc::sourceparts="-" \
>>>           -o APT::Get::List-Cleanup="0"
>>> +    # Add multiarch for cross-target
>>> +    if [ "${ROOTFS_ARCH}" != "${DISTRO_ARCH}" ]; then
>>> +        sudo -E chroot "$ROOTFSDIR" /usr/bin/dpkg --add-architecture
>>> ${DISTRO_ARCH}
>>> +        sudo -E chroot "$ROOTFSDIR" /usr/bin/apt-get update
>>> +    fi
>>>       sudo -E chroot "$ROOTFSDIR" \
>>>           /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
>>>               ${IMAGE_TRANSIENT_PACKAGES}
>>> 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..bc0bc66
>>> --- /dev/null
>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot-cross.bb
>>> @@ -0,0 +1,57 @@
>>> +# 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.sh"
>>> +PV = "1.0"
>>> +
>>> +inherit isar-bootstrap-helper
>>> +
>>> +BUILDCHROOT_CROSS_PREINSTALL ?= "make \
>>> +                                 debhelper \
>>> +                                 autotools-dev \
>>> +                                 dpkg \
>>> +                                 locales \
>>> +                                 docbook-to-man \
>>> +                                 apt \
>>> +                                 automake \
>>> +                                 devscripts \
>>> +                                 equivs \
>>> +                                 libc6:${DISTRO_ARCH}"
>>> +
>>> +# Please note: this works for Stretch distro only. According to the
>>> wiki page:
>>> +#     https://wiki.debian.org/CrossToolchains
>>> +# Jessie doesn't contain toolchain. It should be fetched from the
>>> external
>>> +# repository:
>>> +#     http://emdebian.org/tools/debian/
>>> +BUILDCHROOT_CROSS_PREINSTALL_append_armhf +=
>>> "binutils-arm-linux-gnueabihf \
>>> +                                             
>>> crossbuild-essential-armhf"
>>> +
>>> +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.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
>>> +}
>>>
>>
>> This is almost identical to buildchroot:do_build - except for one
>> differently named variable, the first line, and missing fix
>> 39e0c488d8b2. Please avoid those duplications.
>>
> 
> Sorry, didn't get this. It's absolutely different logical units:

No, the code is identical. Step back, look at it again.

>  - crossbuildchroot has its own lifecycle including stamps, so it could
> not be shared with the original buildchroot (only via common include)
>  - crossbuildchroot and buildchroot have different default packages to
> install and they are incompatible due to possibly different
> architectures (cross has always host one, bchroot has target one).
> 
> Could you please clarify what you mean here?

I'm not suggesting to have only a single recipe. I'm asking to pull out
identical code into a shared function, class, whatever so that we can
maintain identical logic in one place (and fix bugs only once).

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2018-07-04 20:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28  8:27 [PATCH v2 00/12] Cross-compilation Alexander Smirnov
2018-06-28  8:27 ` [PATCH v2 01/12] isar-bootstrap: Add routine to determine host arch Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 02/12] isar-bootstrap: Move common part to include Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 03/12] isar-bootstrap: Add host architecture support Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 04/12] isar-bootstrap-helper: Add parameter to set arch Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 05/12] buildchroot-cross: Initial implementation Alexander Smirnov
2018-06-29 17:36   ` Jan Kiszka
2018-07-04 19:56     ` Alexander Smirnov
2018-07-04 20:05       ` Jan Kiszka [this message]
2018-06-28  8:28 ` [PATCH v2 06/12] classes/dpkg*: Relocate dependency from buildchroot Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 07/12] classes/dpkg*: Drop hardcoded buildchroot blobs Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 08/12] build.sh: Add target parameter Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 09/12] classes/dpkg-cross: Initial implementation Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 10/12] dpkg: Resolve dep from buildchroot Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 11/12] linux: Add cross-compilation support Alexander Smirnov
2018-06-28  8:28 ` [PATCH v2 12/12] local.conf: Add cross-compilation option Alexander Smirnov
2018-06-29 13:31 ` [PATCH v2 00/12] Cross-compilation Henning Schild
2018-06-29 18:28 ` Jan Kiszka
2018-06-30  9:05   ` Jan Kiszka
2018-07-04 19:40   ` Alexander Smirnov
2018-07-04 20:03     ` Jan Kiszka

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=fa93604e-7c38-5b10-b8a3-b35b203d6be5@web.de \
    --to=jan.kiszka@web.de \
    --cc=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