From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6755821036247187456 X-Received: by 2002:a50:c305:: with SMTP id a5mr8390425edb.136.1573198532520; Thu, 07 Nov 2019 23:35:32 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a50:fb14:: with SMTP id d20ls2371693edq.8.gmail; Thu, 07 Nov 2019 23:35:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyS6IE21ZpI2SMKYr1Y0fylJhU60FyViI7eTwHMk0BQaj15CAVd1v9XboTOY0eGlTPx09pP X-Received: by 2002:aa7:c253:: with SMTP id y19mr8516152edo.151.1573198531929; Thu, 07 Nov 2019 23:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573198531; cv=none; d=google.com; s=arc-20160816; b=jbBdgqG/Yd3Op14WM6BDj9/8qH44qWfg01DstkIH0wZGgfGMxJ/SPPLMCSg6ewiVn1 gKBHTI1YSq/QeMKSBGhNv/hiau/D4blSrB5JnrCJOt4EcOKMF1MoJHbs5RMtTk4207fp 97XITvtnGZB414Uxw8r8mArlhZajcIcE9TubegQJpDA/erjmA5gb0NQnA6osVRKFxw6U 3FuWMQoC/Yvyi4kb3AWnFRc9BluW24chk3C5QknY5UPMiIUwkuJYEs31MwW40e8FOsu1 EpB461K2L86bMn1zBMMZ6F63MuEJoMjCPPm+Fy08gAXbGPfqF46Ypeite7RjrZ/u6Be+ kePA== 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; bh=BAREM7rOTF7vkUUKN3D2XZeY4H7zVtMe4pG+haZ4VX0=; b=lVtYuXPLiBuVZwZ45c9gnO0W1nZlj1AoB4+fyw7+eZF6TQn+es2pEbnfaEjIo2jqoA h07gUuer2Xy6GNSo5++ARxTLt91R/joWXmgGpe07YPbdN6z3AOLKNcag7M4PzUcG2mDm cpqTWhKW2zZnaH46Bd7aKEzqOhYqPU27MQ762uqYFM1D75HjM0jPxlId+UNDdv7ohaH5 JYmBb8HvJLCyt4gLR1Ctf6Q7PrmXKZUmBjrwKKpa/1bktpV5ihwK9qGzZL0tQqx5RRvk 8ibF+uSJRA5CLH04spWEhArbI1RUrGZgIyRuET8bDf8MhmwacoKB/fkAS8reJnPdEucY J3Eg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id q17si648682edi.1.2019.11.07.23.35.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2019 23:35:31 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id xA87ZVuK019442 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Nov 2019 08:35:31 +0100 Received: from [167.87.14.235] ([167.87.14.235]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id xA87ZUOi005156; Fri, 8 Nov 2019 08:35:30 +0100 Subject: Re: [PATCH L-C v3 6/7] buildchroot-host: install qemu-static to support hybrid cross-compiles To: Cedric Hombourger , isar-users@googlegroups.com References: <1573118604-909-1-git-send-email-Cedric_Hombourger@mentor.com> <1573196839-1143-1-git-send-email-Cedric_Hombourger@mentor.com> <1573196839-1143-7-git-send-email-Cedric_Hombourger@mentor.com> <28a6ef09-18f0-8e82-c464-2d2d530718b2@siemens.com> <84c9fbd7-aef5-2e06-ee38-5e9d44dc609a@mentor.com> From: Jan Kiszka Message-ID: <869f9760-f4ed-879f-655f-c03abd34c999@siemens.com> Date: Fri, 8 Nov 2019 08:35:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <84c9fbd7-aef5-2e06-ee38-5e9d44dc609a@mentor.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: eNE7EXukbaqA 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 >>> --- >>>   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. Alternatively, though more for the long run, the tools cross-build of upstream could be improved. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux