Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp484000pxb; Wed, 20 Jan 2021 11:50:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6Ac2JwqQyS49CE10WtDssz50CPBGFSX/V+LI16kN3iCQlk7aWfcNYccY7N6nWmi5hbYR6 X-Received: by 2002:a17:906:1d1a:: with SMTP id n26mr7373741ejh.481.1611172225005; Wed, 20 Jan 2021 11:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611172224; cv=none; d=google.com; s=arc-20160816; b=rOI9lbonHOLz4VtBO3qYTwwKVi3LKB43j7T2+S9dxwZJ/P/bckOtMwfcNWLG9ciOIC QU1RMT1f9EvzG1o99na6uPr4b5UC3PDWxZikL6H6AYLXEFgLhqaV/YYOqNLhKs0P8TFH KAj68XRf38txJUx4dJgDUvvKhCd34zMRmy/qWUt5OJIBd+ziXVxUpWekvz9F1w6Mn64Y gWJmZf9EcwVxiRt9FgcbUujCm+l3vRcKyaLd7QveHJv9k8fmmdfXl9yVe2gG1Wr+RCvJ K1Lf/sAs6JG5BjxKyPPSbhUXdzT1ZBf8LlakunLm4rvJFl1ga8+O0BXvANCLKHNa1TNT nb5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=ti5t2+h/e4Lbyj+1QRC0zgdTTPkyy4j846BUxXsIkR4=; b=o79NbfKTt2yxYNTkXEuZaMyKa/8ER9XunBlRqdIZTkFMWGoVEABjvZBkK8z5It+esh mRL+Rtkb96SqmFKFK3NdaEEj5cE4rJquR0jk899iaZYSeII1t6jiKyj7Sbi3YGDL3N1C A1+qaIfWvKHlRmUFXKD65+mkI+m/EEwVtpwrU09NMupYacBDUvtD4RqOUsMhr+Qg8ZNe meoDJzi2KBUfe9b4RUvsGzZ+58flW0SK4Py0Xn2QET/NfFjIOhdJjgBbKlwp3ibWz7fZ a2LwrmP44v9FEBIhgOsnjhqX5F2kYwRb4fbEV/GL2kYXqZLiCAstNaUv5PObFCIPjvoT TeHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=13qZrKqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si975080eje.652.2021.01.20.11.50.00; Wed, 20 Jan 2021 11:50:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=13qZrKqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392577AbhATTsO (ORCPT + 99 others); Wed, 20 Jan 2021 14:48:14 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:20333 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388299AbhATTnJ (ORCPT ); Wed, 20 Jan 2021 14:43:09 -0500 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 10KJfoZX026396; Thu, 21 Jan 2021 04:41:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 10KJfoZX026396 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1611171711; bh=ti5t2+h/e4Lbyj+1QRC0zgdTTPkyy4j846BUxXsIkR4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=13qZrKqmZQfNbu92u5lKRiqL5lSDM/wWFqKSnFIjDrJVoyPEsCVUbw6TOAph0nG35 by/htD/qjAG2s08c+Pac2wiRlhA1oIfQpJmLC6TiV4ASMQX5QVaqtDEZarTArEyHsR vxEgCiitVwTyhLOZnL0SDqhs0gVFYphGWjJKm4Sdn6oTVVshGJzBu0Gi2zUSkMWHxY 44EAbILzkb5YgNcO9Flh6tsW58uNRP9bQEft+uxVw/SjpvGo7GhDtAHfNytDnBF/TP vMN9NkNOqYXtRTgEex1WuVvxI4f3fM3ikIuVhwSqkUZ46VDIXoGSX6H358yt7p3FVS qMddgv8hY+n1A== X-Nifty-SrcIP: [209.85.216.51] Received: by mail-pj1-f51.google.com with SMTP id kx7so2825409pjb.2; Wed, 20 Jan 2021 11:41:50 -0800 (PST) X-Gm-Message-State: AOAM532TMe7zNs9jJ3jZ/UQkynk/ZFVwFUSjKFA1sNYFC5pD4xioKmo6 u4D++s9NQRx+JT4GyyfDfgBdWKibkHeJMGO28uw= X-Received: by 2002:a17:90a:3481:: with SMTP id p1mr7454548pjb.198.1611171710150; Wed, 20 Jan 2021 11:41:50 -0800 (PST) MIME-Version: 1.0 References: <20210108003035.1930475-1-willmcvicker@google.com> In-Reply-To: From: Masahiro Yamada Date: Thu, 21 Jan 2021 04:41:13 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5] modules: introduce the MODULE_SCMVERSION config To: Will McVicker Cc: Jessica Yu , Michal Marek , Greg Kroah-Hartman , Christoph Hellwig , Saravana Kannan , Linux Kernel Mailing List , Linux Kbuild mailing list , "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 9:19 AM Will McVicker wrote: > > Hi Masahiro, > > After testing your suggestions for module_srcpath, I remembered why I > needed this: > > +ifneq ($(realpath $(srctree)/$(KBUILD_EXTMOD) 2>/dev/null),) > + module_srcpath := $(srctree)/$(KBUILD_EXTMOD) > +else > + module_srcpath := $(KBUILD_EXTMOD) > +endif > > Basically KBUILD_EXTMOD actually has two uses when defined as a relative path: > > (1) defines the path to the external module's source relative to $(srctree) > (2) defines the path to the external module's build artifacts relative > to $(objtree) > > Since setlocalversion is run from $(objtree), we need to use > $(srctree)/$(KBUILD_EXTMOD) when it's a relative path. Just to note, > if I do just use KBUILD_EXTMOD, then the script setlocalversion fails > to find the srctree and returns an empty string. > > Please correct me if I'm wrong. I messed around with this by adding > many prints to Makefile.modpost and setlocalversion to make sure > everything was defined as expected. Hmm, you are right. I did not know the current Kbuild works like that. But, I do not want to uglify the code just for supporting this rare use-case. Rather, I want to apply this https://lore.kernel.org/patchwork/patch/1368277/ and, still want to see as simple code as the following: --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -66,6 +66,7 @@ ifeq ($(KBUILD_EXTMOD),) input-symdump := vmlinux.symvers output-symdump := Module.symvers +module-srcpath := $(srctree) else @@ -82,9 +83,20 @@ MODPOST += -e input-symdump := Module.symvers $(KBUILD_EXTRA_SYMBOLS) output-symdump := $(KBUILD_EXTMOD)/Module.symvers +module-srcpath := $(KBUILD_EXTMOD) endif -- Best Regards Masahiro Yamada