From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6755821036247187456 X-Received: by 2002:adf:e5cc:: with SMTP id a12mr7104303wrn.258.1573197760276; Thu, 07 Nov 2019 23:22:40 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a5d:4645:: with SMTP id j5ls5368209wrs.0.gmail; Thu, 07 Nov 2019 23:22:39 -0800 (PST) X-Google-Smtp-Source: APXvYqwXCJCvapaSFYcg+zPBmhE76B4KSFVzbu8cae727AbH6iLBwR3rTD0IjYOlC1ljstxZ6kn9 X-Received: by 2002:adf:c402:: with SMTP id v2mr7305487wrf.323.1573197759933; Thu, 07 Nov 2019 23:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573197759; cv=none; d=google.com; s=arc-20160816; b=xsOxeDhUz3fBRs43e2CImPm1odONlUUcOkye/vY8VmOVNtLTgBgmrmBUJba8tJZ1sx oyTNUTrWbt6meQWk8KJAJ2xzIVVt4xr1bSRcbdOpNOIi21Gxj63WbRUZf4AFAVr5bqt4 uCmpNrrC5xdtfY/8b4L922lRBT7KILDruUBYf/MjxG1VIEySsrKH78/R+LSGEqLiPPO1 1QvAhdad7nCvRAy2ZMG8x9e2ev1QIW7uZ2LOET5VZ8WbrQczmXGBfBiOY8LEEdFtGVHA mp05fA6DMnsugcgerz2pkMDOD3HwAPd+OShyYj7mC11QSPWV38+ZPUliCIqbG5VIHHV8 Jt1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject:ironport-sdr :ironport-sdr; bh=KzoWPQg8Rg+FasuavyT4zQl0gXg2NUmwK2qOXA3PZKY=; b=vkWiNKy7OsvWfrusJLfVhFRqvwY4IZ5omB3c1oIzRLDaivOtDNwRKQil3s0vKOTgHa mKrD1VuOaiQ6HYTNpOxg9he9zMPutZ690kM8ymqVtsIw3UYf54d2Zt/2x+tVInuHTOE0 0LM5ElHDd9NBbhFK0DYsYNVi/K18HWU/VWEk/yRnUO9yQpy/h7FzMe8C3RL7AR/tcKrE Vnng2rYw1MD1lrv0EwH3EnHse3Q5rws7tCnAP9DYhePjyENOW0pfYNDfUoFFxZxikYYk xX7K1TBpEekU2xWI3U0hwUQeSeui5Vq2GXLLIMd/CXmydHJlK6ZeTPfRfSuIR41iKeOF vRlA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.137.180 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com. [68.232.137.180]) by gmr-mx.google.com with ESMTPS id s126si926451wme.1.2019.11.07.23.22.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2019 23:22:39 -0800 (PST) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.137.180 as permitted sender) client-ip=68.232.137.180; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 68.232.137.180 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com IronPort-SDR: ERdJtwjujuATkNW4dc7/SnbXw51qv7mO9OxAYA6zy3EU8Ns1kqPK+mzdlAHPNmKmked8lJYPxJ 5KqNdn3PM9PdvLug0Bj7sWSMDEglJpZ9W2O0dQ9O6dH2F7AMjtK6BCoOQWd2REnY/OECU6pqcm hRbWNGJaflE6BNtlhHjB+OqKtK0w/Rq5FddnORE6OeX7r95l7lof/Y33dOmTR89kBjntJung96 7FguUJnTjyc1HFSTJcuOpBmjkurwPWSLusKFx5cro6h0XWs2VHeaOcnxh6imr/xGotwnDQadY3 nSw= X-IronPort-AV: E=Sophos;i="5.68,280,1569312000"; d="scan'208";a="42990243" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 07 Nov 2019 23:22:37 -0800 IronPort-SDR: HpqW2XyuM1YLpevOtblGCIXI1MurGIMzERUnkBhlEDaUx9LN3vZURhVKr1XUjg819lKqCjKa/y a3dKAsUUvgzuRw+HoRuEAO5AWBchKBtZtQ1I9OrPDDtO88wjB7oLZcXn1TZkOX15Gl6INmGIT9 QMKSkcM7Ij2iNQJe7c8elhWS+fQYmCs0UgMOc/QVfjjt+uPVP2fItUtozpOj4bMfFjlbqDQa9X dNlcP/OWUXrqT2cqpy3C4Ez1Jeq2+DY77xYOLAxc+nY6UWxPKiZyx0tnIPaYYH/eFjNiaiMY9k eEE= Subject: Re: [PATCH L-C v3 6/7] buildchroot-host: install qemu-static to support hybrid cross-compiles To: Jan Kiszka , 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> From: Cedric Hombourger Message-ID: <84c9fbd7-aef5-2e06-ee38-5e9d44dc609a@mentor.com> Date: Fri, 8 Nov 2019 08:22:31 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <28a6ef09-18f0-8e82-c464-2d2d530718b2@siemens.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Return-Path: Cedric_Hombourger@mentor.com X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: Dyao6ZsZBxnI 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: (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.... > > Jan >