From patchwork Tue Jul 18 12:01:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 12208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1701141vqt; Tue, 18 Jul 2023 05:21:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrVeX2dFk63ep9grIHA2A8ZHwotKrj1i3cCLX23USc/+3AuL2AY3U9Fujql6ZPVEg1DB2J X-Received: by 2002:aa7:d8d0:0:b0:51e:f9f:460a with SMTP id k16-20020aa7d8d0000000b0051e0f9f460amr2222904eds.4.1689682905477; Tue, 18 Jul 2023 05:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689682905; cv=none; d=google.com; s=arc-20160816; b=kOTjFxO2/FxJalThArlBAIN9AxN75OihGCdq+PPk6N6bR70tUPQamNMnl/ul/aqxnW WPGhAicelNPwynl3Iz4pTzSl7wNPIfj8+bPqnCxNh4X5zHwFTQD4DGxad6lm21CJLi8L OByrgWJKnKVmeelUejyfEXQZFhfzySo++t7jHqLuNm+K/x/Yap8zi+arjlptuLDdeLup JNlSRloLmdP5wMv4ifnh6eDrduA+SJOQ8tQuG3K4GKgt5VcJAxyRzuyIrsMRZH1KYfKB NeLvHEW+jIZCF3ekIKQ9c+mnf5NWD3p/SNLZ+ha/P61+YLmMtTAmEefx3ZYOp7Tx3Bni 1WTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=+REwR7wsQIAE1ApjzI4HGQe8QfCO4TfvhKpuDdfqqrg=; fh=AVdnBkCzYGOB5oRrOKcaACuRLonL9A4Pn6PwCHl69B0=; b=UgF8Cgl5PhbAPmjDgGNJ/bYHGW5rQLuVK1Q7OD0Xn0SN0DLL1w1DQN8L0ykcWhG4Cu WBBdEJQKdKxA4cDWxnlXJ5EMHC5gwZyfE5S+6LFf+C+NbcPF+UL/ugo8EVV5LWC9trW1 KmPBjhqmSLpSLxvWhRvYR/bYMIDMZD6kORvyhbtkx7WHcevEaQ8ZOB0ODZpv/xjIrKJm XBgE3sJdlDJLUXXOfd9ElZZlrMjBij3cxPi7uCZDUUADBW6MqjLBE7Qx/xs+96TgDWCq 3J9LAKDP2H4H0oh+2fxNBuwqICU2+K71SruRIt931lZPEMypjWK1vVKpPM6uBO8VhjUl Szdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=HDu3x6bw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=HDAsCxVb; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020aa7c311000000b0051e2936779fsi1075979edq.380.2023.07.18.05.21.21; Tue, 18 Jul 2023 05:21:45 -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=HDu3x6bw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=HDAsCxVb; 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 S232207AbjGRMDc (ORCPT + 99 others); Tue, 18 Jul 2023 08:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231273AbjGRMD3 (ORCPT ); Tue, 18 Jul 2023 08:03:29 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 488CD1B1; Tue, 18 Jul 2023 05:03:27 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id F12991FD9E; Tue, 18 Jul 2023 12:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689681806; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+REwR7wsQIAE1ApjzI4HGQe8QfCO4TfvhKpuDdfqqrg=; b=HDu3x6bwe48ck+en1M6NG3glgR/hYvXUhPPLutDmYDhAJ5UvuwrJ0jVC04nu54ibRnVF6b ZUnRhNAJFDjUk+lpPlm/ZSpNXaDFsGklX/rUXv1gQhvH5CZZOnFZABZf+6qaQubYPz2O/k BzfGSkiInpH6ib1rONMKA0sYZNFjH1Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689681806; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+REwR7wsQIAE1ApjzI4HGQe8QfCO4TfvhKpuDdfqqrg=; b=HDAsCxVbpCSeBSm67uJoz/0w1Y10TqyGXCUXgPmxSaiIdaXF1aJ/L90tXXjKz82eVNSwDe fBC2zdlFCKiI61DQ== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id DD7B92C142; Tue, 18 Jul 2023 12:03:24 +0000 (UTC) From: Michal Suchanek To: linux-modules@vger.kernel.org Cc: Michal Suchanek , Takashi Iwai , Lucas De Marchi , =?utf-8?q?Michal_Koutn=C3=BD?= , Jiri Slaby , Jan Engelhardt , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH kmod v5 0/5] kmod /usr support Date: Tue, 18 Jul 2023 14:01:51 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771140517896512772 X-GMAIL-MSGID: 1771760941924756218 Hello, with these patches it is possible to install kernel modules in an arbitrary directory - eg. moving the /lib/modules to /usr/lib/modules or /opt/linux. While the modprobe.d and depmod.d search which already includes multiple paths is expanded to also include $(prefix) the module directory still supports only one location, only a different one under $(module_directory). Having kmod search multiple module locations while only one is supported now might break some assumption about relative module path corresponding to a specific file, would require more invasive changes to implement, and is not supportive of the goal of moving the modules away from /lib. Both kmod and the kernel need to be patched to make use of this feature. Patched kernel is backwards compatible with older kmod. Patched kmod with $(module_directory) set to /lib/modules is equivalent to unpatched kmod. Thanks Michal Link: https://lore.kernel.org/linux-modules/20210112160211.5614-1-msuchanek@suse.de/ v4: set whole path to module directory instead of adding prefix v5: use pkg-config instead of jq, fix build on openssl without sm3 support Michal Suchanek (5): configure: Detect openssl sm3 support man/depmod.d: Fix incorrect /usr/lib search path libkmod, depmod: Load modprobe.d, depmod.d from ${prefix}/lib. kmod: Add pkgconfig file with kmod compile time configuration libkmod, depmod, modprobe: Make directory for kernel modules configurable Makefile.am | 6 +- configure.ac | 30 ++++++++ libkmod/libkmod.c | 11 +-- man/Makefile.am | 10 ++- man/depmod.d.xml | 9 ++- man/depmod.xml | 4 +- man/modinfo.xml | 2 +- man/modprobe.d.xml | 1 + man/modprobe.xml | 2 +- man/modules.dep.xml | 6 +- testsuite/module-playground/Makefile | 2 +- testsuite/setup-rootfs.sh | 109 +++++++++++++++------------ testsuite/test-depmod.c | 16 ++-- testsuite/test-testsuite.c | 8 +- tools/depmod.c | 7 +- tools/kmod.pc.in | 10 +++ tools/modinfo.c | 4 +- tools/modprobe.c | 4 +- tools/static-nodes.c | 6 +- 19 files changed, 156 insertions(+), 91 deletions(-) create mode 100644 tools/kmod.pc.in