From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6572049490740510720 X-Received: by 2002:a1c:cc0e:: with SMTP id h14-v6mr339404wmb.4.1530733223465; Wed, 04 Jul 2018 12:40:23 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:7508:: with SMTP id o8-v6ls542166wmc.1.canary-gmail; Wed, 04 Jul 2018 12:40:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpesH2FfE95P01KDV4AK/rUM5qThhME8VZKxGipu/0K1BwZL004qMj0Sisf2LVzsq3mS1CiC X-Received: by 2002:a1c:9cc2:: with SMTP id f185-v6mr334050wme.29.1530733223024; Wed, 04 Jul 2018 12:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530733222; cv=none; d=google.com; s=arc-20160816; b=mOO7FBVHB1w5DZoFZvRKALBJXAjGS6T8fldEwPfgp94Df/hyTcy7cK88F9TM1PH2xS AbuXYazFj7GhVOLC3VH87Ra9H5ZLk2MxLZFUTofs07xRC2CsnBJsz+BlGGQrpcfTAEVS vCCS0hs+pmuibKRmPiukDl/SJrOYu3iTzZD2VhU6D+jIfJPGAofHfcrF78+MLIdRqCsf cdBiWMVqYuUKegyrb15xY6aYDXYc/sYlDjr31rU7FLW80pW/sjoWdhct6m1Chpga4G61 oIRjdmSuVd2C5UlPEEWQQxoD4HCUOwf40Dv5TxRz02S3GgpXbToZu4HLlw0A7yF/Uo+8 ibZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=1QRXlK1qjJ0pJehX4LCgWMC4FKJKLrPcUeLlKpS5K5Y=; b=dWs7HwErbmSnezSbouArWadJaqqo4YADD4VkZTwREXs/0H4YN3Ox4IefjSjK+dd6tX 3h9fjn1BCNdEaVbGTyioZY14g3C8L4TOJ3yT9Sk7XZGke+s+yArKA6JudB55s0ipp1uZ H9HnuYSCF31JxZffjIDTi8mRT45MpAlVHk248ilDTumiG08bmqBonMJsvjw3wP2no+vi CPd/YGyjSRYn2aNLh02CR8Z0u98vNK6n0RGCaWta3x1UqEnevCP8rPOeQ9KotGgyDj3x 4gDqKEBKrd7LKDtKJ83HuMMvJC1OBVG5hTEYb7fvZcap5kqOht1BX3bQ++dHPt1GA80T 5kdw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id x21-v6si12152wmh.3.2018.07.04.12.40.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 12:40:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from [10.0.2.15] ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w64JeKsO013050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 4 Jul 2018 21:40:21 +0200 Subject: Re: [PATCH v2 00/12] Cross-compilation To: Jan Kiszka , isar-users@googlegroups.com References: <20180628082810.3571-1-asmirnov@ilbers.de> <2cfafe36-f81b-8493-3ddc-f154194c7fbc@web.de> From: Alexander Smirnov Message-ID: Date: Wed, 4 Jul 2018 22:40:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <2cfafe36-f81b-8493-3ddc-f154194c7fbc@web.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: YjM9pmarjLGW 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 > > 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= 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 > > 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 >