Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp839827lqp; Sun, 14 Apr 2024 01:49:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKo0xm7BEbhceUWK1+BsoZBEDkUQUHAwj0ACbyC3RcYwxwEo44j4ns7huZHLUo12RqbLJsp81PbvfnNwrPkRobd30SrENzPkd91mIzsA== X-Google-Smtp-Source: AGHT+IEXvn8qEpMy9rtrLguQu7LtQy0URwqrgmuPAbQpxuiN8euzlkNCKnE8FBbJgMVc4fVxSQ43 X-Received: by 2002:a50:8712:0:b0:56e:2452:f864 with SMTP id i18-20020a508712000000b0056e2452f864mr5651575edb.35.1713084547920; Sun, 14 Apr 2024 01:49:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713084547; cv=pass; d=google.com; s=arc-20160816; b=we91UG4r/0omAEiVcywfHYhO5UCc5civ98pejRqpjnaVoxKfyXtT87pZSNFEwZnZt4 Hh69PP+ckO9hTdiKo/iOqBv4A/jmhNNTZJITm1OSIe9aPu/glZ+wyqcVMonqONdit1s4 utiTvDnfUmfatOFLV5mTuoSwLqGIXI81T4jF6mj/oMMSEb3cCxp/3i4ODKvqk1eSl8/4 BAu8gKBqSG71WG8A7Cv8ktuEl/ti+EGqUahmhfhe1/iceYthgU8EvMYw4IU5qGwJH1M9 oRLMr3uqZVRKBl4M2HcewKAnzV4m8RQC/URNUnTGteupM/QKZyLI5+IZF+Gz6UKRtUBV ddfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=w4ehbscFdltWJ09ilTAIgkOFC3rMe/2DrGf8HJH9J/Y=; fh=DJWpvPKpQXqf9JimLqiy30WiNWwgowXQmwaMKLqh7N0=; b=uK7h9KR8/kIVPe7tG7LNcwEJ4is3jrXKFZMwWTzjjcGqQ7Ruj/eIQaUBVlqdJIJE9r 3xrRxdaq1ZIAkwOUC3JFTWPhXrMmv4DRI8RPwl6zOFO5uPaWiSR8nNVqez6SHMZrs6sT gFrt4jPwHruvqHSwp6BPi8dRoxgqV8eRHWxP3v7VzNTV7pW3v76mJCJragvL9SBtLA6H Sy13aq2c9CE+4Xtr/SLCDMSug8xxEezFbNdqKKT2d76KY3jlOW95yPF4cXYF4q/mtBJq iQnDPt4QT6cUVVh32xWmo6UPBHJnix7886Ni6u619z6mEpaWUHtdQQ81Iqbfb0ZuhKMC DdfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IILAy9SM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-144057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t24-20020a50ab58000000b0056e0dffc7casi3404572edc.19.2024.04.14.01.49.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 01:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IILAy9SM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-144057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A49521F2123E for ; Sun, 14 Apr 2024 08:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 367A4225AE; Sun, 14 Apr 2024 08:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IILAy9SM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F2A8442F; Sun, 14 Apr 2024 08:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713084542; cv=none; b=KUvX6vxfbzhq7SlwikmQvC3ybr3aZbG7OxOHwjye/kqk/P56i9UTA482R9orGyTbHPI2bJ2MFRSEdOLKoWnfr9CFN1pZYoBrpnVl1z+eU3YmY7dyUNKtPpXvgZpPgKSDNBvblf5Whve6ZZ/81XtMNJjwSGiHFT5DXy0hUJwdHNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713084542; c=relaxed/simple; bh=WA4Z5y4LzUg1wHvgxOr562MTNIGpCk9DcL/aFmv8r7s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ISiWUbzG5jAdyt3FC2Q9Tl1Zi+R4f/qKJuk3YQ2VqudVtuGtDcU8p5ttqIHQErBd5GiwxStV30qIKowrazfowxrNHewf9ThGMGvIDU+WsjAEJwDeHvQQ1K9sORrF70T1fatEB5+KAcBLjZwATOxzcn1jPhGQVtdjcGkGWgPIuas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IILAy9SM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC7ABC4AF08; Sun, 14 Apr 2024 08:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713084541; bh=WA4Z5y4LzUg1wHvgxOr562MTNIGpCk9DcL/aFmv8r7s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IILAy9SMbVFryjOp1yaDSBTcXqEp6F1G6uFaPUq/p2iNPnpUgweQkot9YK5ckFodO +54tZEVIKpkB6iZ2VeceNGfv0+nuV82qYYNoVT3/53Ceqd0lOk+vSIYU5Zrjmk4tyz L4q/2lBG93rXYXI5yra3YIGh0e3IX64h1f6e0MRE7EazTxN1p/HJeLFVro/5XzSf1/ 1LBqcmd3F4cz9cG2pd6OOw+Pc1tXlTc0Txr2nfDzrmvX5JLgK9IZa4hpEcPPrNb3O8 0naa/IgMDgqCVXwcW4P+r+q4B5MSnPFt1yXgIwO5CWMKlZdf7QrjEvXXJpHZnd4CV/ W4V6wn1fl+nLw== Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2d47a92cfefso27037331fa.1; Sun, 14 Apr 2024 01:49:01 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWps8bp8nJ8vbAx91HG0LDlYGoCEKgByj8zgMzwB5WY0BvZ9UTagUWCmVmhB2eOdDnDiZP1uAwnjigFAcGpTzf+Gq0FcqnWxqtFTV9HyKFCVofFpPRfY+mD7xSLbwQtzrSBhjhlriWa2ecOeYAi78DYxZgmAnmzE3ylq6hsph1jz0mhbIem X-Gm-Message-State: AOJu0YwOFdam0GAGQJmyVP+y3tC7TNEb0eKS5GGwWe99JjP4v0tajPIi 4MUw2FIo7kySh75v7Jpb9du78gPOrFW34Opj20y87MFLNYtQZLR+L0j+n+40GlpbxwETGkKGT+V SnTHlK/FS/XZmKQcIIkWYhbP3XlU= X-Received: by 2002:a2e:8012:0:b0:2d8:d23a:f440 with SMTP id j18-20020a2e8012000000b002d8d23af440mr3946646ljg.6.1713084540184; Sun, 14 Apr 2024 01:49:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240405165610.1537698-1-vchernou@cisco.com> In-Reply-To: From: Masahiro Yamada Date: Sun, 14 Apr 2024 17:48:23 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] Add MO(mod objs) variable to process ext modules with subdirs To: "Valerii Chernous -X (vchernou - GLOBALLOGIC INC at Cisco)" Cc: Nicolas Schier , "Daniel Walker (danielwa)" , Nicolas Schier , Nathan Chancellor , "xe-linux-external(mailer list)" , Jonathan Corbet , "linux-kbuild@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" The workaround described in the commit message (overwrite 'src') is different from what I know. As I explained to Daniel before, the point is, O= refers to the kernel output directory, and M= specifies a relative path to your downstream module directory. Say, you have a linux source tree and external modules under ~/my-project-src/, and you want to output all build artifacts under ~/my-build-dir/. my-project-src |-- linux \-- my-modules masahiro@zoe:~/my-project-src/my-modules$ tree . |-- Kbuild |-- dir1 | |-- Kbuild | |-- bar.c | `-- dir2 | |-- Kbuild | `-- baz.c `-- foo.c 3 directories, 6 files masahiro@zoe:~/my-project-src/my-modules$ cat Kbuild obj-m += foo.o obj-m += dir1/ masahiro@zoe:~/my-project-src/my-modules$ cat dir1/Kbuild obj-m += bar.o obj-m += dir2/ masahiro@zoe:~/my-project-src/my-modules$ cat dir1/dir2/Kbuild obj-m += baz.o First, build the kernel and external modules in separate output directories. masahiro@zoe:~/my-project-src/linux$ make O=~/my-build-dir/linux defconfig all [ snip ] masahiro@zoe:~/my-project-src/linux$ make O=~/my-build-dir/linux M=../my-modules make[1]: Entering directory '/home/masahiro/my-build-dir/linux' CC [M] ../my-modules/dir1/dir2/baz.o CC [M] ../my-modules/dir1/bar.o CC [M] ../my-modules/foo.o MODPOST ../my-modules/Module.symvers CC [M] ../my-modules/foo.mod.o LD [M] ../my-modules/foo.ko CC [M] ../my-modules/dir1/bar.mod.o LD [M] ../my-modules/dir1/bar.ko CC [M] ../my-modules/dir1/dir2/baz.mod.o LD [M] ../my-modules/dir1/dir2/baz.ko make[1]: Leaving directory '/home/masahiro/my-build-dir/linux' masahiro@zoe:~/my-build-dir/my-modules$ tree . |-- Module.symvers |-- dir1 | |-- bar.ko | |-- bar.mod | |-- bar.mod.c | |-- bar.mod.o | |-- bar.o | |-- dir2 | | |-- baz.ko | | |-- baz.mod | | |-- baz.mod.c | | |-- baz.mod.o | | |-- baz.o | | `-- modules.order | `-- modules.order |-- foo.ko |-- foo.mod |-- foo.mod.c |-- foo.mod.o |-- foo.o `-- modules.order 3 directories, 19 files I saw this before somewhere. I believe it is a well-known workaround that works with recursion. This patch submission is not helpful. Kbuild does not support the external module builds in a separate output directory. Most people know this limitation for a long time. You are not the first person to discover it. Second, anybody can write a patch like yours in several minutes. There already exists a similar (but more correct) patch: https://lore.kernel.org/linux-kbuild/e58cba84c90c40108ac678500f33655e@xiaomi.com/ That one works more correctly than yours, because modpost works with no error, and 'make clean' works too. I am not suggesting to fix scripts/{Makefile.modpost,Makefile.clean}. If such a patch had been acceptable, it would have been accepted many years before. Things are, the decision is postponed until we are confident about a solution. I must avoid a situation where a bad solution is upstreamed as official. That is worse than nothing. And, I am pretty sure that your patch is not the right solution. -- Best Regards Masahiro Yamada