From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 073F7C48BE6 for ; Wed, 16 Jun 2021 20:23:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF9EF6023D for ; Wed, 16 Jun 2021 20:23:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF9EF6023D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FLq6obyeAjCUcP/fuVh/wPZO4qNw6sUfCD/nQqr/5So=; b=T41vRM+Jl4rNOf yEY0K9zTzk4YlZwdINS+T351Q5pkQ9r/giCNgG/6TIYli+c7CWQuOeCTPGdtclbMeVBrgh65yEL8u 7RGIbdG7q4GOJBLCQHfhbB/bfe+OGpxKudKlWQSUpN5JtuxAeiFvmf5WW43dRS0aC1JcfJ12bDM8R j3EEUiO5XoXISWSgg1F9h9CStnpfHm3HRtvZGL1ftW0RBxiPJkZJqIPpoT1ddy+gQs9FylpD2/Bf5 qLTzXABa+QZQY0NWp8CumubdhImt/YOwl0xLNEls5cytJsCf5lxwoCh4IKSFBXneEDACnLSiwYEMl 2DdWf3TvFnHCNzLom1eA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltc2q-007eSN-1l; Wed, 16 Jun 2021 20:21:52 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltc2m-007eRs-Lp for linux-arm-kernel@lists.infradead.org; Wed, 16 Jun 2021 20:21:50 +0000 Received: by mail-pf1-x42a.google.com with SMTP id h12so3155504pfe.2 for ; Wed, 16 Jun 2021 13:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zaDlZTPTQJooxxIS5nbQQyev1n81XTsuc8sKeXI28Sk=; b=oH5zNziG0OxnbfcN99NWbVioLfobbL06MN2ZttE8B+YOiAZ2Zw85am6URVjcz3I59v zZhKDoyDM3bldFbl6qwvDwkGxGLY1EZWVB1qYHh3NGYC/mwl5oIodeTEMGyR6fs+ZFB1 pCOREw6/OPy8qtPmmwByKqIJiTYgEWhuZAZyaSyNkEPY7aaYloL0KCUN/OYeF/1TlCb6 32zPxqNkFv3ICB/hmndQjNJ/9WUnekgYdhB2ZAhkMhxWVh1HCYSga0Ol+8EN9XeUWVdw +eL58jjo8eKqZX62BtGU5XlJ5ZQLEXrAlC5qi1tiERmlCWI1rDCJgCNZoaQPnO5X2N1O HqiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zaDlZTPTQJooxxIS5nbQQyev1n81XTsuc8sKeXI28Sk=; b=i7YhEEnIeC5lrHQgPqOt1g/wpVz0UHWdnrlw8c0d57PkbCa80o7mh8fIVoP7Gyj4QK ZGZAWrHwu/n236rV5RklP5RKXoZhCZ65nCUGoGO4ci+x1FqEz4G+ijBZivcYlpf2ucAY xwMUmTnUeOYYdlEoS5Vg6zN4UGinAsB3FO74PF081mJm7HKSnii6jHXuQBXhFLGVA6nV yAJl4qeNU8bGFNWiHeNWM6hDPJbQ1aOeKKMLUDYGRPx8qBKflNG5sBSIEVhv24Yi4fzZ V2uQHylGsBMGcZO1Fjk5I0xS6pO4JpmuxA3H3uCXCtcD4+6ztqWSrCCSMgtkYByswIQw EnEg== X-Gm-Message-State: AOAM533aqFNsf1C8se12S3rNkwgFzy4EhGEo2gfSvgze2cBBUTu9oV9P XOD1CsIiLe0Oc1ZzK4iqRuBUBHAw0SS3oVH9bA/ux/gsThjJUuw5 X-Google-Smtp-Source: ABdhPJzwAbv1C62g7dxJSwbrYVxGSWeev83yLZ0dYd8MOICtYUq3mxvN5k8vh2+7veBi68kr0dO+Xu2lAqWtckfv+hw= X-Received: by 2002:a62:ae03:0:b029:2f8:b04f:c012 with SMTP id q3-20020a62ae030000b02902f8b04fc012mr1604229pff.62.1623874907548; Wed, 16 Jun 2021 13:21:47 -0700 (PDT) MIME-Version: 1.0 References: <20210616195529.GI22278@shell.armlinux.org.uk> In-Reply-To: <20210616195529.GI22278@shell.armlinux.org.uk> From: Tim Harvey Date: Wed, 16 Jun 2021 13:21:36 -0700 Message-ID: Subject: Re: make modules_prepare failing To: "Russell King (Oracle)" Cc: Linux ARM Mailing List X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210616_132148_779528_2BE559D2 X-CRM114-Status: GOOD ( 43.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 16, 2021 at 12:55 PM Russell King (Oracle) wrote: > > On Wed, Jun 16, 2021 at 12:35:16PM -0700, Tim Harvey wrote: > > Greetings, > > > > I'm trying to understand how to use the 'modules_prepare' target to > > prepare kernel headers on a dev host appropriate for building > > out-of-tree modules on a target board. I'm interested in the minimum > > headers necessary and have noticed the Ubuntu 'linux-headers-*' > > packages are only about 24MiB. > > > > I've looked over > > https://www.kernel.org/doc/Documentation/kbuild/modules.txt and it > > does not provide an example showing how to build the headers in a > > different directory. > > > > $ make O=foo modules_prepare > > make[1]: Entering directory '/usr/src/venice/bsp/linux/foo' > > *** > > *** The source tree is not clean, please run 'make mrproper' > > *** in /usr/src/venice/bsp/linux > > *** > > /usr/src/venice/bsp/linux/Makefile:512: recipe for target > > 'outputmakefile' failed > > make[1]: *** [outputmakefile] Error 1 > > make[1]: Leaving directory '/usr/src/venice/bsp/linux/foo' > > Makefile:179: recipe for target 'sub-make' failed > > make: *** [sub-make] Error 2 > > This means your tree (/usr/src/venice/bsp/linux) is not clean, it > is not referring to "foo". It is only possible to do a split source/ > object tree build with a clean source tree. > > So, this is telling you to do "make mrproper" with nothing else in > the source directory - no O= argument. If that is still failing, > then it suggests there is a file somewhere in the source tree that > shouldn't be there. > > > The 'modules_prepare' does work if I don't try to output to a > > different directory but then it isn't clear what to package compared > > to the entire >1GiB kernel source tree. > > I'm not sure you're going about this in the correct way. Doing a > split object tree build does not mean everything you need to build > modules is in the object tree - much depends on the source tree for > the kernel build infrastructure and the other header files in the > include subdirectory, as well as other places (such as picking up > architecture options from arch/*/Makefile and the architecture > specific header files.) > > So, if you are thinking "I can just package up the object tree to > build modules" that is not correct. > > > I wish https://www.kernel.org/doc/Documentation/kbuild/modules.txt had > > an example expalining how a distro packager would create > > linux-headers-. I'm not familiar enough with Ubuntu packaging to > > understand how to disect how their packages are created. > > Isn't that package used for building the C library rather than for > modules? That will likely be created by "make headers_install" which > gives you all the headers for userspace to use with kernel internals > sanitised away. Russell, Thanks for the response. I thought that Ubuntu's linux-headers-* package also provided enough to build out of tree modules but perhaps I'm wrong. Here is what I did to try and figure out what was in the linux-headers file on an Ubuntu bionic system: $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS" $ uname -r 5.4.0-73-generic $ dpkg -S /usr/src/linux-headers-5.4.0-73-generic linux-headers-5.4.0-73-generic: /usr/src/linux-headers-5.4.0-73-generic $ dpkg -L linux-headers-5.4.0-73-generic /. /lib /lib/modules /lib/modules/5.4.0-73-generic /usr /usr/share /usr/share/doc /usr/share/doc/linux-headers-5.4.0-73-generic /usr/share/doc/linux-headers-5.4.0-73-generic/changelog.Debian.gz /usr/share/doc/linux-headers-5.4.0-73-generic/copyright /usr/src /usr/src/linux-headers-5.4.0-73-generic /usr/src/linux-headers-5.4.0-73-generic/.config /usr/src/linux-headers-5.4.0-73-generic/.config.old /usr/src/linux-headers-5.4.0-73-generic/.gitignore /usr/src/linux-headers-5.4.0-73-generic/.missing-syscalls.d /usr/src/linux-headers-5.4.0-73-generic/Module.symvers /usr/src/linux-headers-5.4.0-73-generic/arch ... $ dpkg -L linux-headers-5.4.0-73-generic | grep -v "^/usr/src/linux-headers-5.4.0-73-generic" /. /lib /lib/modules /lib/modules/5.4.0-73-generic /usr /usr/share /usr/share/doc /usr/share/doc/linux-headers-5.4.0-73-generic /usr/share/doc/linux-headers-5.4.0-73-generic/changelog.Debian.gz /usr/share/doc/linux-headers-5.4.0-73-generic/copyright /usr/src /lib/modules/5.4.0-73-generic/build $ ls -l /lib/modules/5.4.0-73-generic/build lrwxrwxrwx 1 root root 39 Apr 16 07:44 /lib/modules/5.4.0-73-generic/build -> /usr/src/linux-headers-5.4.0-73-generic $ du -h /usr/src/linux-headers-5.4.0-73-generic/ | tail -n1 24M /usr/src/linux-headers-5.4.0-73-generic/ When I started poking around to see how I could create this I did find this guide here but it did not work (the whole mrproper clean issue): https://unix.stackexchange.com/questions/270123/how-to-create-usr-src-linux-headers-version-files What I am after is trying to see if I can easily appease users on embedded Linux boards that want to build out-of-tree modules on their target because they can't seem to wrap their head around building the kernel+modules on a development host with a cross-toolchain (the 'proper' way to do it but which has a huge barrier to entry for many users). They run into instructions online such as: # build out-of-tree module apt install build-essential apt install linux-headers-$(uname -r) # some out-of-tree modules have you point to kernel source via a non-std env var make KSRC=/lib/modules/$(uname -r)/build # others follow what the kernel docs have you do which is to do a make in the kernel dir make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules make install Best regards, Tim _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel