From: Cedric Hombourger <Cedric_Hombourger@mentor.com>
To: Jan Kiszka <jan.kiszka@siemens.com>, <isar-users@googlegroups.com>
Subject: Re: [PATCH L-C v3 6/7] buildchroot-host: install qemu-static to support hybrid cross-compiles
Date: Fri, 8 Nov 2019 08:59:47 +0100 [thread overview]
Message-ID: <f19987da-08cc-5ae3-d7ee-e2108c62332b@mentor.com> (raw)
In-Reply-To: <869f9760-f4ed-879f-655f-c03abd34c999@siemens.com>
On 11/8/19 8:35 AM, Jan Kiszka wrote:
> On 08.11.19 08:22, Cedric Hombourger wrote:
>>
>> On 11/8/19 8:14 AM, Jan Kiszka wrote:
>>> On 08.11.19 08:07, Cedric Hombourger wrote:
>>>> The Linux kernel has great support for cross-compiling the kernel
>>>> image
>>>> and modules. There is however no support/mechanism for
>>>> cross-compiling the
>>>> build tools from its "scripts" directory. While HOSTCC may be set
>>>> to use
>>>> our cross-compiler, the kernel build infrasture would then try to run
>>>> foreign-arch binaries such as fixdep. The easiest and least
>>>> intrusive way
>>>> to support this is to enable execution of such binaries via
>>>> binfmt/qemu
>>>> like we do in the buildchroot-target environment.
>>>>
>>>> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
>>>> ---
>>>> meta/recipes-devtools/buildchroot/buildchroot-host.bb | 6 ++++++
>>>> 1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/meta/recipes-devtools/buildchroot/buildchroot-host.bb
>>>> b/meta/recipes-devtools/buildchroot/buildchroot-host.bb
>>>> index 408ad39..2e76acb 100644
>>>> --- a/meta/recipes-devtools/buildchroot/buildchroot-host.bb
>>>> +++ b/meta/recipes-devtools/buildchroot/buildchroot-host.bb
>>>> @@ -15,3 +15,9 @@ BUILDCHROOT_PREINSTALL ?= " \
>>>> ${BUILDCHROOT_PREINSTALL_COMMON} \
>>>> libc6:${DISTRO_ARCH} \
>>>> crossbuild-essential-${DISTRO_ARCH}"
>>>> +
>>>> +buildchroot_install_files_append() {
>>>> + if [ -e '/usr/bin/qemu-${QEMU_ARCH}-static' ]; then
>>>> + sudo cp '/usr/bin/qemu-${QEMU_ARCH}-static'
>>>> '${BUILDCHROOT_DIR}/usr/bin/qemu-${QEMU_ARCH}-static'
>>>> + fi
>>>> +}
>>>>
>>>
>>> You didn't address my comment on this one. I doubt it's the right
>>> approach.
>>
>> More specifically?
>>
>> I do have something in the works but we *still* need to build a
>> linux-kernel-headers package for the target. there are two approaches:
>
> Currently, if you need the package for the target, you need to build
> it natively. The cases of requiring such packages is so far rare
> enough (none in all the many cases I saw so far) to deal with the
> slowdown.
>
>> (1) use the Makefiles from the kernel and "simply" override HOSTCC
>> but you then need qemu-static since the kernel will need to run some
>> of its tools from "scripts/" (fixdep in particular) when it builds
>> the other tools (e.g modpost) or (2) do like upstream manually
>> cross-compile the tools.
>>
>> The downside of (2) is that you need to know what to compile (list of
>> .c files) and how to compile them. That "knowledge" may vary from one
>> kernel to another.
>>
>> I have local patches to produce a linux-kernel-headers-cross-amd64
>> package which will ship headers in /usr/${DEB_HOST_GNU_TYPE} (i.e.
>> next to libc headers) as well as kernel build tools for the build
>> machine (typically amd64). This will allow us to cross-compile
>> out-of-tree kernel modules without running any tools with a
>> foreign-arch (for the avoidance of doubt, we still need
>> qemu-user-static in buildchroot-host while building the kernel)
>>
>> So with all that said, you are more than welcome to suggest a better
>> approach....
>
> Step 1 is to tag the currently generated header package in a way that
> it won't be accidentally selected for target installation when it was
> cross-built for a different host architecture. Step 2 could be
> factoring out the linux-headers package build so that it can run with
> ISAR_CROSS_COMPILE = "0" for the target architecture in the target
> buildchroot - when that special case is actually needed.
If in step1, you are suggesting that our recipe generates packages for
the following "Architecture": ${HOST_ARCH}, all, ${DISTRO_ARCH} then to
the best of my knowledge that isn't possible! I think you can only
generate packages for all, ${DISTRO_ARCH} from a dpkg-buildpackage run
but again, let me know if you think otherwise (could not find anything
in the Debian Standards document suggesting so but I may have overlooked)
If we agree that using debhelper and therefore our generic dpkg class is
a good improvement (compared to kernel's builddeb script crafting
packages on its own and having to specify dependencies manually), I
would suggest we stick with the qemu-user-static approach for now (it is
only needed for a fraction of seconds during the build so to me that is
a non-issue).
As hinted, I am working on a linux-kernel-headers-cross package
generation. I am currently considering running build.sh a second time
but this time targeting HOST_ARCH and with a control file only carrying
that -cross package (it would use the same kernel sources/tree as input)
but I'd like to make this a second step since it needs more work and I a
genuinely believe that the current solution is something we can live
with for now
> Alternatively, though more for the long run, the tools cross-build of
> upstream could be improved.
yes that would be good (if you are referring to the ability to do
something like make scripts O=build-host-tools
HOST_CROSS_COMPILE=${DEB_HOST_GNU_TYPE}- in the kernel)
>
> Jan
>
next prev parent reply other threads:[~2019-11-08 7:59 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 13:55 [PATCH 0/7] linux-custom recipe rework Cedric Hombourger
2019-11-05 13:55 ` [PATCH 1/7] recipes-kernel/linux: make KERNEL_DEFCONFIG support in-tree defconfigs Cedric Hombourger
2019-11-05 13:55 ` [PATCH 2/7] linux-mainline: fix stripping of .0 from the kernel version Cedric Hombourger
2019-11-05 13:55 ` [PATCH 3/7] linux-mainline: update from 4.19.0 to 4.19.80 Cedric Hombourger
2019-11-05 13:55 ` [PATCH 4/7] linux-custom: add support for kernel config fragments Cedric Hombourger
2019-11-05 13:57 ` [PATCH 5/7] linux-mainline: disable support for HFS to demonstrate use of " Cedric Hombourger
2019-11-05 13:57 ` [PATCH 6/7] buildchroot-host: install qemu-static to support hybrid cross-compiles Cedric Hombourger
2019-11-05 14:52 ` Jan Kiszka
2019-11-05 15:00 ` Cedric Hombourger
2019-11-05 15:27 ` Jan Kiszka
2019-11-05 13:57 ` [PATCH 7/7] linux-custom: rewrite to no longer depend on the kernel's builddeb Cedric Hombourger
2019-11-05 15:26 ` Jan Kiszka
2019-11-05 16:20 ` Cedric Hombourger
2019-11-05 16:22 ` Jan Kiszka
2019-11-05 16:25 ` Jan Kiszka
2019-11-05 20:16 ` chombourger
2019-11-05 20:24 ` Jan Kiszka
2019-11-07 11:44 ` Gylstorff Quirin
2019-11-07 11:55 ` Cedric Hombourger
2019-11-07 13:20 ` Cedric Hombourger
2019-11-07 15:43 ` Gylstorff Quirin
2019-11-05 15:32 ` [PATCH 0/7] linux-custom recipe rework Jan Kiszka
2019-11-05 15:55 ` Henning Schild
2019-11-05 16:00 ` Cedric Hombourger
2019-11-05 16:19 ` Henning Schild
2019-11-07 9:23 ` [PATCH L-C v2 " Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 1/7] recipes-kernel/linux: make KERNEL_DEFCONFIG support in-tree defconfigs Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 2/7] linux-mainline: fix stripping of .0 from the kernel version Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 3/7] linux-mainline: update from 4.19.0 to 4.19.80 Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 4/7] linux-custom: add support for kernel config fragments Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 5/7] linux-mainline: disable support for HFS to demonstrate use of " Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 6/7] buildchroot-host: install qemu-static to support hybrid cross-compiles Cedric Hombourger
2019-11-07 9:23 ` [PATCH L-C v2 7/7] linux-custom: rewrite to no longer depend on the kernel's builddeb Cedric Hombourger
2019-11-07 11:50 ` Jan Kiszka
2019-11-07 11:52 ` Jan Kiszka
2019-11-07 11:53 ` Cedric Hombourger
2019-11-07 12:14 ` Jan Kiszka
2019-11-09 8:51 ` Jan Kiszka
2019-11-09 13:43 ` Cedric Hombourger
2019-11-22 18:58 ` Jan Kiszka
2019-11-25 16:04 ` [PATCH L-C v4 0/5] linux-custom recipe rework Cedric Hombourger
2019-11-25 16:04 ` [PATCH L-C v4 1/5] recipes-kernel/linux: make KERNEL_DEFCONFIG support in-tree defconfigs Cedric Hombourger
2019-11-25 16:04 ` [PATCH L-C v4 2/5] linux-mainline: fix stripping of .0 from the kernel version Cedric Hombourger
2019-11-25 16:04 ` [PATCH L-C v4 3/5] linux-mainline: update from 4.19.0 to 4.19.80 Cedric Hombourger
2019-11-25 16:04 ` [PATCH L-C v4 4/5] buildchroot-host: install qemu-static to support hybrid cross-compiles Cedric Hombourger
2019-11-25 16:06 ` [PATCH L-C v4 5/5] linux-custom: rewrite to no longer depend on the kernel's builddeb Cedric Hombourger
2019-11-25 19:55 ` Jan Kiszka
2019-11-26 7:42 ` Cedric Hombourger
2019-11-26 9:13 ` Jan Kiszka
2019-11-26 17:10 ` Gylstorff Quirin
2019-11-25 16:16 ` [PATCH L-C v4 0/5] linux-custom recipe rework Jan Kiszka
2019-11-27 15:49 ` Gylstorff Quirin
2019-12-05 17:01 ` Baurzhan Ismagulov
2019-12-09 7:29 ` Jan Kiszka
2019-12-09 7:40 ` Cedric Hombourger
2019-11-07 11:39 ` [PATCH L-C v2 0/7] " Jan Kiszka
2019-11-07 11:47 ` chombourger
2019-11-07 11:48 ` Jan Kiszka
2019-11-08 7:07 ` [PATCH L-C v3 " Cedric Hombourger
2019-11-08 7:07 ` [PATCH L-C v3 1/7] recipes-kernel/linux: make KERNEL_DEFCONFIG support in-tree defconfigs Cedric Hombourger
2019-11-08 7:07 ` [PATCH L-C v3 2/7] linux-mainline: fix stripping of .0 from the kernel version Cedric Hombourger
2019-11-08 7:07 ` [PATCH L-C v3 3/7] linux-mainline: update from 4.19.0 to 4.19.80 Cedric Hombourger
2019-11-08 7:07 ` [PATCH L-C v3 4/7] linux-custom: add support for kernel config fragments Cedric Hombourger
2019-11-08 7:07 ` [PATCH L-C v3 5/7] linux-mainline: disable support for HFS to demonstrate use of " Cedric Hombourger
2019-11-08 7:07 ` [PATCH L-C v3 6/7] buildchroot-host: install qemu-static to support hybrid cross-compiles Cedric Hombourger
2019-11-08 7:14 ` Jan Kiszka
2019-11-08 7:22 ` Jan Kiszka
2019-11-08 7:23 ` Cedric Hombourger
2019-11-08 7:22 ` Cedric Hombourger
2019-11-08 7:35 ` Jan Kiszka
2019-11-08 7:59 ` Cedric Hombourger [this message]
2019-11-08 8:28 ` Jan Kiszka
2019-11-08 7:07 ` [PATCH L-C v3 7/7] linux-custom: rewrite to no longer depend on the kernel's builddeb Cedric Hombourger
2019-11-08 7:19 ` Jan Kiszka
2019-11-08 7:36 ` Cedric Hombourger
2019-11-08 7:41 ` Jan Kiszka
2019-11-08 7:12 ` [PATCH L-C v3 0/7] linux-custom recipe rework Jan Kiszka
2019-11-08 7:27 ` Cedric Hombourger
2019-11-08 7:37 ` Jan Kiszka
2019-11-08 7:42 ` Cedric Hombourger
2019-11-08 7:54 ` Jan Kiszka
2019-11-08 8:01 ` Cedric Hombourger
2019-11-08 8:16 ` Cedric Hombourger
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=f19987da-08cc-5ae3-d7ee-e2108c62332b@mentor.com \
--to=cedric_hombourger@mentor.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.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