Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp358828rdh; Tue, 19 Dec 2023 00:38:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZckuYfYn318bPYZDBufEEIzErlGljIxWfl6J6fLP+I8fYmkKlb/aofTWGedxFOpUOx/jv X-Received: by 2002:a05:6214:20cd:b0:67b:e155:7bd4 with SMTP id 13-20020a05621420cd00b0067be1557bd4mr1261727qve.46.1702975123429; Tue, 19 Dec 2023 00:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702975123; cv=none; d=google.com; s=arc-20160816; b=mU7j1Tcx4JjFC+JN6jROXGsNAir9B4clSqje/k51kGHq6U0JbW07oQCuo+jEnLftfj VJHImXADO/PTvECX0kJhlTuYb/PHs5lykChJaEncX9coP876Z9YhFZYGlLWfO7UHPti0 gsgQQiNgFu9tax+L7fnco356TXlGbI3MXx8JaMu8E8EM3zE9+iLNsAMqzCBq6IDqhgf8 WqQCHZMznDfZtYW7YC7ClNCm1OTvRb+9MKcMq9Tp8HyjN5PgVE4MndkK0KbmH9mUwxts pK+i+3dlBRv1oHXMQd8dDbnhvwiz7lCoyNH+VVyAygfM9N6PqS0vs+JNzE4vddKeOFKZ TZ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=fKA5dMviNgwauA0OXjCTBjONUU/EGvN7IEl5NJJGw8s=; fh=3+Df5D7pAuenkMZihnQxzxlxFzi4WHklUp8kftXT5E8=; b=PMIdBbWhWy4ZF0luNULHGNb/i2BXI98da9GnJ00Qk6BxaclV3OClT9GRY6Dy905Iqn jsZAP25s+qb3tx6/N2BvqDkh9GeZ/grV9YACROhNk/z+mDuNTi4Ije8jwMPvMRu/wXxz oMYJz0SDONoGd/mF1ijBwLyNZf3GyPYxtwrPW62MBYRgJoLPOdyLda3+QeufF/kp6vbL 5ToOBJAtzes0hq7YEKEn/THZRT+HWLjgOz+fA+817hh9od49O0HcM6yiYJdvyHM7KyzF VRcUxzLhAuUR4o7lo3zugPcImtl6UHu6Z/sJ4JUUAm97qaqixeMOuzSj39mGvCc58uSt Bk5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HP7l7z+Q; spf=pass (google.com: domain of linux-kernel+bounces-4900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b3-20020a0cc983000000b0067f50018012si2559068qvk.236.2023.12.19.00.38.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 00:38:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HP7l7z+Q; spf=pass (google.com: domain of linux-kernel+bounces-4900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4900-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1DB111C239A8 for ; Tue, 19 Dec 2023 08:38:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31335125A6; Tue, 19 Dec 2023 08:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HP7l7z+Q" X-Original-To: linux-kernel@vger.kernel.org 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 5AB3813ADA; Tue, 19 Dec 2023 08:38:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAF48C433CD; Tue, 19 Dec 2023 08:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702975088; bh=iCFasj7oQ8kELGDaFQzx7jdz0lyUtU1jgfLGIGZWdBc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HP7l7z+Q5SAoL9UkP6fV1d/Nd9MdPl9y/WMAT9sJLJjhqxoU2/tNDK1oVt4tcZ46j 4MPU6V2TYHfyBBY7u/WNWPMN/lQs6MH04sq9h5IPNY03qYTGECf7bg8Czv/LlXm+Cf A4NR6luTTkuEw3nM5kz2C+aWvHCJu33cdr0phrLudGhhjvOrnVODfc+Cc4zPG0fiiJ UZIkevRCbl2TSUMR4RBcF/otjNXjcoKg2RDJwv845uFbhQt/q6u4JYRhmnX5yLpt/G JWS8FS0GWjdebBdt6NmiXweHQfadNeWroH6effeQSOVyNUvFSiDjjIQVQqdnehCRu+ vMrT6zpYlnZWw== Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3ba41c956d5so1651419b6e.0; Tue, 19 Dec 2023 00:38:08 -0800 (PST) X-Gm-Message-State: AOJu0YxCQg4K2uqkX9ICqPgAw0erCDkakzrpoEAd20o6Y5Tf+XIW3NiO bWCZqjpyARUZW6y7lLlDOZY26nzQaUh15NQ4wws= X-Received: by 2002:a05:6808:1a1d:b0:3b8:61ac:2348 with SMTP id bk29-20020a0568081a1d00b003b861ac2348mr332846oib.24.1702975088233; Tue, 19 Dec 2023 00:38:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Masahiro Yamada Date: Tue, 19 Dec 2023 17:37:31 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/2] kmod /usr support To: Lucas De Marchi Cc: Michal Suchanek , linux-modules@vger.kernel.org, Takashi Iwai , Lucas De Marchi , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Jiri Slaby , Jan Engelhardt , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 7, 2023 at 3:37=E2=80=AFAM Lucas De Marchi wrote: > > On Fri, Nov 10, 2023 at 01:13:53PM +0100, Michal Suchanek wrote: > >Hello, > > > >This is resend of the last patch in the series that adds prefix support > >to kernel module location together with additional patch for validating > >the user supplied input to options that are interpreted as directories. > > > >Thanks > > applied, thanks > > Lucas De Marchi If I understood this correctly, MODULE_DIRECTORY is determined by "configure --with-module-directory=3D...", and there is no way to change it after that. If so, how to work with cross-building? Cross-building is typical when building embedded Linux systems. Consider this scenario: - Your build machine adopts MODULE_DIRECTORY=3D/usr/lib/modules - The target embedded system adopts MODULE_DIRECTORY=3D/lib/modules (or vice a versa) depmod is used also for cross-building because it is executed as a part of "make module_install". The counterpart patch set for Kbuild provides KERNEL_MODULE_DIRECTORY, which only changes the destination directory to which *.ko are copied. You cannot change the directory where the depmod searches for modules, as it is fixed at the compile-time of kmod. In this case, what we can do is to build another instance of kmod configured for the target system, and use it for modules_install: 1. In the kmod source directory ./configure --with=3Dmodule-directory=3D/lib/modules make 2. make modules_install INSTALL_MOD_PATH=3D KERNEL_MODULE_DIRECTORY=3D/lib/modules DEPMOD=3D If you use OpenEmbedded etc., this is what you do because host tools are built from sources. But, should it be required all the time? Even when the target embedded system uses busybox-based modprobe instead of kmod? depmod provides --basedir option, which changes the prefix part, but there is no way to override the stem part, MODULE_DIRECTRY. In the review of the counter patch set, I am suggesting an option to override MODULE_DIRECTRY (let's say --moduledir) at least for depmod. (Perhaps modinfo too, as it also supports --basedir) Then, we can change scripts/depmod.sh so that Kbuild can propagate KERNEL_MODULE_DIRECTORY to depmod. if ; then set -- "$@" --moduledir "${KERNEL_MODULE_DIRECTORY}" fi Does it make sense? --=20 Best Regards Masahiro Yamada