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 00/12] Cross-compilation
Date: Sat, 30 Jun 2018 11:05:41 +0200	[thread overview]
Message-ID: <3a2ba0b9-0461-991a-df26-c4b46437d7f8@web.de> (raw)
In-Reply-To: <2cfafe36-f81b-8493-3ddc-f154194c7fbc@web.de>


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

On 2018-06-29 20:28, Jan Kiszka wrote:
> On 2018-06-28 10:27, Alexander Smirnov wrote:
>> Hi all,
>>
>> [NOTE]
>>   Cover letter is too long, so I don't expect that you read it all. So I'd
>> like to start with this message to avoid possible question. :-) This series
>> has intersection with SDK one, so it should be rebased after SDK is applied
>> to next. Thanks!
>> [/NOTE]
>>
>> here is the second version of cross-compilation support.
>> This version adds support for cross-compiling stretch-armhf target.
>>
>> What's new here:
>>  - Build dependencies are resolved automatically, so isar-image-base could be
>>    built using cross-compilation only (libhello, example-hello, example-raw)
>>  - Linux kernel could be also cross-compiled now for arm
>>
>> Test scenarios:
>> 1. Build isar-image-base:
>>  - Set variable in local.conf ISAR_CROSS_COMPILE to "1"
>>  - Edit recipes: libhello and example-hello and replace
>>    "inherit dpkg" by "inherit dpkg-cross"
>>  - Build using "bitbake multiconfig:qemuarm-stretch:isar-image-base"
>>  - With cross-compilation the image is generated twice faster
>>
>> 2. Build arm kernel:
>>  - Set variable in local.conf ISAR_CROSS_COMPILE to "1"
>>  - There is no default arm config, so I derived the one from linux-cip
>>    tree: "zx_config" and add it to recipe
>>  - Build it "bitbake multiconfig:qemuarm-stretch:linux-cip"
>>  - Aftewards I have the following packages:
>>    * linux-image-4.4.112-cip18_4.4.112-cip18-1_armhf.deb
>>    * linux-image-4.4.112-cip18-dbg_4.4.112-cip18-1_armhf.deb
>>    * linux-headers-4.4.112-cip18_4.4.112-cip18-1_armhf.deb
>>  - The compilation tooks me about 2-3 minutes. Much faster than in QEMU
>>
>> Issue:
>> 1. No support for jessie. The main issue here, that jessie doesn't have
>>    armhf compiler in default apt. Official wiki asks you to use embian
>>    apt to get it
>> 2. mk-build-deps has two params: --host-arch, --cross-arch. But they seem
>>    to work incorrectly. If set both of them in deps list I got unexisting
>>    packages. Now I use --host-arch only and it works good. I want to check
>>    this in buster and then probably ask Debian community reagrding this
>> 3. i386 architecture for now is not considered as a target for cross
>>    compilation
>> 4. Currently libhello and example-hello applications have hardcoded native
>>    compilation (inherit dpkg). This should be reworked to depend on
>>    ISAR_CROSS_COMPILE variable
>>
>> Huh, no more ideas, let's start with this.
> 
> I've started to play with this series (on top of next before the SDK
> series got merged).
> 
> Setup:
>  - https://github.com/siemens/jailhouse-images
>  - KAS_TARGET=multiconfig:orangepi-zero-jailhouse:xradio ./build-images.sh
> 
> Findings:
>  - Kernel build works
>  - Module build does not yet. So I've hacked this in:
> 
> ---8<---
> diff --git a/meta/recipes-kernel/linux-module/files/debian/control b/meta/recipes-kernel/linux-module/files/debian/control
> index 1ee634c..e4af37e 100644
> --- a/meta/recipes-kernel/linux-module/files/debian/control
> +++ b/meta/recipes-kernel/linux-module/files/debian/control
> @@ -2,7 +2,7 @@ Source: @PN@
>  Section: kernel
>  Priority: optional
>  Standards-Version: 3.9.6
> -Build-Depends: linux-headers-@KERNEL_NAME@
> +Build-Depends: linux-headers-@KERNEL_NAME@:amd64
>  Maintainer: ISAR project <isar-users@googlegroups.com>
>  
>  Package: @PN@
> diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
> index 3075f44..86776c3 100644
> --- a/meta/recipes-kernel/linux-module/module.inc
> +++ b/meta/recipes-kernel/linux-module/module.inc
> @@ -15,7 +15,7 @@ SRC_URI += "file://debian/"
>  
>  AUTOLOAD ?= "0"
>  
> -inherit dpkg
> +inherit dpkg-cross
>  
>  dpkg_runbuild_prepend() {
>      cp -r ${WORKDIR}/debian ${S}/
> ---8<---
> 
>    An interesting pattern is that I had to add the host architecture to
>    the cross-built kernel headers package, or it would not have been
>    found. This will be needed again below.
> 
>    Still, modules don't built, we also need to feed in ARCH=<kernel-
>    target-arch> to the build. Didn't hack that up so far.
> 
>  - This, well, interesting package I was able to "cross"-compile as
>    well:
> 
>    https://github.com/siemens/jailhouse-images/blob/master/recipes-core/non-root-initramfs/non-root-initramfs_2018.05.bb
> 
>    It required the following change (beside "inherit dpkg-cross"):
> 
> ---8<---
> diff --git a/recipes-core/non-root-initramfs/files/debian/control b/recipes-core/non-root-initramfs/files/debian/control
> index b57ee83..f5eeef1 100644
> --- a/recipes-core/non-root-initramfs/files/debian/control
> +++ b/recipes-core/non-root-initramfs/files/debian/control
> @@ -2,7 +2,7 @@ Source: non-root-initramfs
>  Section: misc
>  Priority: optional
>  Standards-Version: 3.9.6
> -Build-Depends: build-essential, wget, cpio, unzip, rsync, python, bc
> +Build-Depends: build-essential:amd64, wget, cpio, unzip, rsync, python:amd64, bc
>  Maintainer: Jan Kiszka <jan.kiszka@siemens.com>
>  
>  Package: non-root-initramfs
> ---8<---
> 
>    Again, dependency installation failed without explicit host arch
>    specification for the two packages, but this time they come from
>    upstream. Any idea why? Obviously, this hack breaks native
>    compilation now.
> 
> That said, I'm excited to see this nice progress. I suspect we will
> quickly sort the issues above out as well, and then more recipes - and
> the whole jailhouse-images - will be cross-buildable.
> 

And another finding:

ISAR_CROSS_COMPILE has no impact on recipes when the inherit dpkg-cross.
This seems to be because of the hard assignment in dpgk-cross.bbclass.
But the logic should be:

inherit dpkg -> not cross-compatible, only build natively
inherit dpkg-cross -> can cross-compile, ISAR_CROSS_COMPILE decides

Should be fixed for v3.

Thanks
Jan

> Thanks,
> Jan
> 



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

  reply	other threads:[~2018-06-30  9:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28  8:27 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
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 [this message]
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=3a2ba0b9-0461-991a-df26-c4b46437d7f8@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