public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: Jan Kiszka <jan.kiszka@web.de>, isar-users@googlegroups.com
Subject: Re: [PATCH v2 00/12] Cross-compilation
Date: Wed, 4 Jul 2018 22:40:15 +0300	[thread overview]
Message-ID: <d135d1c2-0111-bf7b-cdd1-e4f172eccfc9@ilbers.de> (raw)
In-Reply-To: <2cfafe36-f81b-8493-3ddc-f154194c7fbc@web.de>



On 06/29/2018 09:28 PM, 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:

Yeah, unfortunately I didn't have time to take a look on module 
cross-compilation support. And forgot to mention this in cover letter, 
sorry :-(

> 
> ---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

Could please clarify why you added build-essential package to deps? This 
could be problem for cross-compilation, because we always need 
build-essential of *host* architecture, but for example for ARM the 
package with different name should be installed: 
'crossbuild-essential-armhf', i.e. build-essential:armhf is invalid (it 
will pull lots of other host utils with armhf arch, what will totally 
break cross-buildchroot :-(.

To be honest, I can't remember if I have ever seen build-essentials in 
debian/control. I've quickly checked Debian policy:

https://www.debian.org/doc/debian-policy/#relationships-between-source-and-binary-packages-build-depends-build-depends-indep-build-depends-arch-build-conflicts-build-conflicts-indep-build-conflicts-arch

so build-essential is optional, so I'd suggest to drop it.

>   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.

Thank you for the detailed feedback, this is very helpful for me!

Alex

> 
> Thanks,
> Jan
> 

  parent reply	other threads:[~2018-07-04 19:40 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
2018-07-04 19:40   ` Alexander Smirnov [this message]
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=d135d1c2-0111-bf7b-cdd1-e4f172eccfc9@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@web.de \
    /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