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