Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2555069rwp; Fri, 14 Jul 2023 07:54:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlH46iREwwamUOwTkFA1SkGesynju9QfiF0Xyc4vTildxZIbU5QTBIRVLPyZT+W5IbsWvlvb X-Received: by 2002:a17:903:22d1:b0:1b8:9b5e:6697 with SMTP id y17-20020a17090322d100b001b89b5e6697mr4008746plg.68.1689346492612; Fri, 14 Jul 2023 07:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689346492; cv=none; d=google.com; s=arc-20160816; b=knhlUpVAF9h3jyhKuS9Nt2UusUVjXbjRaArgjRXyAxzFiNaG5ZSHQtn+icmBnitngl 5g9Kg17NVhbKsSgvu7ZBQp1ckmbPeHMPQn5mP2Kr1m6OBOo5Bg9RwUq3j6IsHMILG7zo EsNFvg9k/Hr6I0SzBOrJmsNXVvNuOJJ6gc4asNhTY092nEQl5PiQcOqhUlNt22Zr3n/q F3jHPyFV5dWkGrTJj4ACR6XlRZPPcE8TV9UtmBRQumZVTPZzkeCDDU/cWrPJcKr1fa7f xOdRILo3jPyAjpbHZ8I2qI2v4C/yEFB47jid2HaBgKQho9xFuUPMenLjC+trvGJ/k+HC bjsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=Y14rSYrst8SWS4wBVC5PpuZDd39vrZwzRhMWnB9wDeY=; fh=HDztna6PbmjtuJh8EtYkhtVXFnuILxPdrwf1Wy9pp6k=; b=Wz1YzSs+hp/72CkVGtuJZ1wCw7hHL9XhiWbpbkxmwPwDvo+0lWAFx0IImy03YZ8NMN SOdWYn/orOFeiZs+MWzeESWwMWS+w8C9nHv6GmVB3xThR0J+QjGx0+9P/IXSONuNgfiZ VS3umrNZjadldUIUpxznkJEMX+pQEmIyu6mggR12HeZOI7U7RwwzK9KLiH/MBJGsAky/ FtNux2EjOPmOeYF485f3sAdWOSSI2uaFFxwDfA/cwABSfKGBpGIpQcxfhIy2I3s9jAzl 0ubGJH9vAQtwPQEzAnCvZqT5q7ghPeEhY+8Es1n4czazwzwXP2vrw0+WTA1ZfJAuK/sQ 6pVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KV7DaU4n; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=55BwZG76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a170902f0d500b001b8a3894576si6860181pla.64.2023.07.14.07.54.40; Fri, 14 Jul 2023 07:54:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=KV7DaU4n; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=55BwZG76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235981AbjGNObB (ORCPT + 99 others); Fri, 14 Jul 2023 10:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235843AbjGNOax (ORCPT ); Fri, 14 Jul 2023 10:30:53 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A917D30EA; Fri, 14 Jul 2023 07:30:10 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 1C6D51F86B; Fri, 14 Jul 2023 14:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689345004; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y14rSYrst8SWS4wBVC5PpuZDd39vrZwzRhMWnB9wDeY=; b=KV7DaU4ndwCCQDDq9fydyZw+cqcUGm8lQUTWzXxBHF1P5Qp61uiuA0kdVjGyI5Yz2gQIec MacCyRtK2I50K86ahYDlTocAxFnk4E8bAQrzzKQTH88oTY+Eq5Z211YmAN7Jv0wYa2KsMW 3UAsHBeePqPxlS9SenPa6e//84/v9Wg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689345004; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y14rSYrst8SWS4wBVC5PpuZDd39vrZwzRhMWnB9wDeY=; b=55BwZG76jtRILoZddAJb4ICMqiaB0/z1VqBgGPVXiPAfahcdxIEbKjaBnlAl9jo7BmIlDy 59mIZHTXlcmZR5AA== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CC4E02C142; Fri, 14 Jul 2023 14:30:03 +0000 (UTC) Date: Fri, 14 Jul 2023 16:30:02 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Nicolas Schier Cc: linux-modules@vger.kernel.org, Takashi Iwai , Lucas De Marchi , Michal =?iso-8859-1?Q?Koutn=FD?= , Jiri Slaby , Jan Engelhardt , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] depmod: Handle installing modules under a prefix Message-ID: <20230714143002.GL9196@kitsune.suse.cz> References: <30d8c675-e769-e567-a81f-c1b59c66ad67@suse.com> <20230714122111.7528-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Jul 14, 2023 at 04:05:10PM +0200, Nicolas Schier wrote: > On Fri, Jul 14, 2023 at 02:21:08PM +0200 Michal Suchanek wrote: > > Some distributions aim at not shipping any files in / outside of usr. > > For me, preventing negation often makes things easier, e.g.: "... aim at > shipping files only below /usr". > > > > > The path under which kernel modules are installed is hardcoded to /lib > > which conflicts with this goal. > > > > When kmod provides the config command, use it to determine the correct > > module installation prefix. > > > > This is a prefix under which the modules are searched by kmod on the > > system, and is separate from the temporary staging location already > > supported by INSTALL_MOD_PATH. > > > > With kmod that does not provide the config command empty prefix is used > > as before. > > > > Signed-off-by: Michal Suchanek > > --- > > v2: Avoid error on systems with kmod that does not support config > > command > > v3: More verbose commit message > > --- > > Makefile | 4 +++- > > scripts/depmod.sh | 8 ++++---- > > 2 files changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index 47690c28456a..b1fea135bdec 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1165,7 +1165,9 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE) > > # makefile but the argument can be passed to make if needed. > > # > > > > -MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) > > +export KERNEL_MODULE_PREFIX := $(shell kmod config &> /dev/null && kmod config | jq -r .module_prefix) > > All other calls of `jq` that I could find are located at tools/; as this here > is evaluated on each invocation, this should probably be documented in > Documentation/process/changes.rst? > > (Absence of `jq` will cause error messages, even with CONFIG_MODULES=n.) That's a good point. > > > + > > +MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_PREFIX)/lib/modules/$(KERNELRELEASE) > > export MODLIB > > > > PHONY += prepare0 > > diff --git a/scripts/depmod.sh b/scripts/depmod.sh > > index 3643b4f896ed..88ac79056153 100755 > > --- a/scripts/depmod.sh > > +++ b/scripts/depmod.sh > > @@ -27,16 +27,16 @@ fi > > # numbers, so we cheat with a symlink here > > depmod_hack_needed=true > > tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX) > > -mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE" > > +mkdir -p "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE" > > if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then > > - if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \ > > - -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then > > + if test -e "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE/modules.dep" -o \ > > + -e "$tmp_dir$KERNEL_MODULE_PREFIX/lib/modules/$KERNELRELEASE/modules.dep.bin"; then > > depmod_hack_needed=false > > fi > > fi > > I'd like to come back to the statement from Masahiro: Is the check above, > against some very old versions of depmod [1], the only reason for this patch? > > If we could remove that, would > > make INSTALL_MOD_PATH="$(kmod config | jq -r .module_prefix)" modules_install > > be sufficient? No, the INSTALL_MOD_PATH is passed as the -b argument to depmod while the newly added part is not because it's integral part of where the modules are installed on the system, and not the staging area path. > > Kind regards, > Nicolas > > > [1]: https://lore.kernel.org/linux-kbuild/1307631448-29848-5-git-send-email-mmarek@suse.cz/ Was busybox ever fixed to not require the hack? Thanks Michal