From patchwork Tue Jun 27 10:16:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 26523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BED3DEB64DD for ; Tue, 27 Jun 2023 10:17:46 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.9552.1687861057555200929 for ; Tue, 27 Jun 2023 03:17:37 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=jSx5luCX; spf=pass (domain: gmail.com, ip: 209.85.128.44, mailfrom: quaresma.jose@gmail.com) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-3fa96fd79feso23540985e9.2 for ; Tue, 27 Jun 2023 03:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687861055; x=1690453055; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yuOeKya0grYAlXw9cC4BVdyy8UOr0G9YXcgSAHW9Cvo=; b=jSx5luCXOvNuLHwQ2nG9/RL+yFeC6MpxwwTwuVGyIZE8izpXwEy/6kGL0LxQ5rTPgs 6Krmso4BrVIUXYDgXr95Ozb5mRXkBGRqHL9S0z3tSpSoF1X0CZgou8XfbEC4Wrbgq45e kderzCo9MRsgbKD9Pb8yhXSQ8hEyQYn9VkrmHURfSOQxil580NUanDcPI+igpil7Wgw4 cFUuXI4T6Xdidz81Y1hCLqI01ve8OrNkdKo3uoas8FW3292PYTiK/158PfhWuhCtKaNv yK4rix+Sza18+OFMuiQyRk5DNO7lRs3Qp03QkUaOcEAH90kiwTUDvkURaL+sBCjO4l5L Vxag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687861056; x=1690453056; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yuOeKya0grYAlXw9cC4BVdyy8UOr0G9YXcgSAHW9Cvo=; b=V5vE3urrQN082+HgR5tCiL1GdjbVeeTR5gx5ESkKM7f7z7SrM7RouBaoyBy6vbKK8E FsC19KHWr1bRVxv3ipzc/ULlZ4wCaZPjjkLzctCM5aw5GsP/KKoHFsBZitfBGAJn4ge0 lTrcoX+VGzViJoor6jeLNZGFdy55+WG3LUxp/rfNmCsK20mikgnWbX+YqzyPQ+CZUFK1 AVjiCuT/OLKXBWbmuR8HCYA8c7bPi+SV3xfvsSSRRRmeQpDt+0VwABIuyhHAXV9ADR0K UIjfK04RBC5ncLmy2URj+QqK+Hj3srqrLx4f4mCZgiuc6lm/gxk3ahnRQ2PqVdsciOj1 ZLsQ== X-Gm-Message-State: AC+VfDw+YUdakfIw/SfVPvmf5be5C7LO/ekkWVAbRkFBx7lHXo27S69O E2XAJcoVAp+QXsQyIXj23J8I6c2UWKU= X-Google-Smtp-Source: ACHHUZ5EiojA6ytV9WfWLHWJAR0ZWEIQdEt0OckbiESYU2rFephJ2HrPezEDkwqLAL3Ul2Of0wThJQ== X-Received: by 2002:a5d:4a0e:0:b0:30a:e6d2:3ce3 with SMTP id m14-20020a5d4a0e000000b0030ae6d23ce3mr22773524wrq.16.1687861055471; Tue, 27 Jun 2023 03:17:35 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id s6-20020a5d4ec6000000b0030ae849c70csm9961436wrv.37.2023.06.27.03.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 03:17:35 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: openembedded-core@lists.openembedded.org Cc: Jose Quaresma Subject: [PATCH 1/5] kernel: config modules directories are handled by kernel-module-split Date: Tue, 27 Jun 2023 10:16:40 +0000 Message-Id: <20230627101644.881715-1-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 27 Jun 2023 10:17:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/183479 Signed-off-by: Jose Quaresma --- V5: no changes meta/classes-recipe/kernel.bbclass | 2 -- 1 file changed, 2 deletions(-) diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index e82b696d1a..855c784149 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass @@ -483,8 +483,6 @@ kernel_do_install() { install -m 0644 .config ${D}/${KERNEL_IMAGEDEST}/config-${KERNEL_VERSION} install -m 0644 vmlinux ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION} [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION} - install -d ${D}${sysconfdir}/modules-load.d - install -d ${D}${sysconfdir}/modprobe.d } # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile From patchwork Tue Jun 27 10:16:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 26521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEF04EB64D9 for ; Tue, 27 Jun 2023 10:17:46 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web11.9553.1687861057951033356 for ; Tue, 27 Jun 2023 03:17:38 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=hamnsDLH; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: quaresma.jose@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3112f5ab0b1so3934866f8f.0 for ; Tue, 27 Jun 2023 03:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687861056; x=1690453056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SII40r2p5F0qV9wb18AsnZ5voiQK6N0SqqMJWuvAy90=; b=hamnsDLHZ6NDyjN2VJeXau0WPXGTmqp8mscZCxaAGGV+jdtmDdOkgrC6qR7PTbSLtv wH/QbrKnWzIyGazG1UxD93OR7eRtl2JVlbI2FsgC7zlKeD2fJmg/FAJJE4MilvgUxo7s 9THAUZ2bDzZNfQTADyXonOINpemiRlLGUx4iKGVbKXnbgzjH6I82eRlAkdMshSg3iVjU cSQr2/uJuzdOr3PUgBZYtqGAToLgAZEbjQ7jFf+6wcogfz0VcLcbqOqJWZtNbpyBMvsQ 0+3NF56ZAQ5CjhmC0vgFbYSJWgKdW3fWjp8GqyoNw5qAy3tV2Z3DtDefW2OvduAJ8Kz3 Xy8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687861056; x=1690453056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SII40r2p5F0qV9wb18AsnZ5voiQK6N0SqqMJWuvAy90=; b=dUYuBlwExu3kDVUf7qPxMIIcpHFxZPkNHA5NgPRxoioRkGimsDGJYndXSyJCR8iuLg K2Fel74oEvxbTBKkgY8bxMpum8I2eKdxCDkNU3wm3UR8vvseleWh2BMR41Kcj274vG2s +7XXhYtCQiMvIgRH07n+ht0SkrXFA1lINBIZMUGNPzWNuc0vVMwG0k2aX57Z2nEOhdiZ XjEASnv48XcN3YWvjQarSILwuqCxVDN65wNbEiuMJSutP1Bi4xZwvkRnpS3SBV8R1qF/ oY+Bp5jFBXUNCYs6wXjqBnHM5oL2oENYcFoiuMOEn8mUXgLL0ehl6YsqY5P92FKHsZl7 0/PQ== X-Gm-Message-State: AC+VfDxE1ipINd1KUl6OZH7emTclBqAdsC24BQrKgO41Uimt4WF9gUeY iy5hJgOAc/ea8W4EFuvY5UiVMB3FxEI= X-Google-Smtp-Source: ACHHUZ7VfpHylo6wo0w5Ao/YeF/rvr+qTiGxva/x+ZJC6XKTzDfvgc8mJEQQ8G9yxNxUJVmeK6xu6Q== X-Received: by 2002:a5d:5410:0:b0:313:ef24:6fe6 with SMTP id g16-20020a5d5410000000b00313ef246fe6mr4438855wrv.1.1687861056041; Tue, 27 Jun 2023 03:17:36 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id s6-20020a5d4ec6000000b0030ae849c70csm9961436wrv.37.2023.06.27.03.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 03:17:35 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: openembedded-core@lists.openembedded.org Cc: Jose Quaresma Subject: [PATCH 2/5] kernel-module-split: install config modules directories only when they are needed Date: Tue, 27 Jun 2023 10:16:41 +0000 Message-Id: <20230627101644.881715-2-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230627101644.881715-1-jose.quaresma@foundries.io> References: <20230627101644.881715-1-jose.quaresma@foundries.io> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 27 Jun 2023 10:17:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/183480 Instaed of allways create the directories and removing it at the if they are not used, we can just do it when there are modules configuration to be created. So the best thing to do is install the directories only when necessary. Signed-off-by: Jose Quaresma --- v5: introduced in v5 .../kernel-module-split.bbclass | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass index 50882c31a7..9467a28208 100644 --- a/meta/classes-recipe/kernel-module-split.bbclass +++ b/meta/classes-recipe/kernel-module-split.bbclass @@ -30,10 +30,6 @@ fi PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross" -do_install:append() { - install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/ -} - KERNEL_SPLIT_MODULES ?= "1" PACKAGESPLITFUNCS =+ "split_kernel_module_packages" @@ -102,7 +98,9 @@ python split_kernel_module_packages () { if autoload and basename not in autoloadlist: bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename)) if basename in autoloadlist: - name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename) + conf = '/etc/modules-load.d/%s.conf' % basename + name = '%s%s' % (dvar, conf) + os.makedirs(os.path.dirname(name), exist_ok=True) f = open(name, 'w') if autoload: for m in autoload.split(): @@ -110,6 +108,9 @@ python split_kernel_module_packages () { else: f.write('%s\n' % basename) f.close() + conf2append = ' %s' % conf + d.appendVar('FILES:%s' % pkg, conf2append) + d.appendVar('CONFFILES:%s' % pkg, conf2append) postinst = d.getVar('pkg_postinst:%s' % pkg) if not postinst: bb.fatal("pkg_postinst:%s not defined" % pkg) @@ -120,21 +121,19 @@ python split_kernel_module_packages () { modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split() modconf = d.getVar('module_conf_%s' % basename) if modconf and basename in modconflist: - name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) + conf = '/etc/modprobe.d/%s.conf' % basename + name = '%s%s' % (dvar, conf) + os.makedirs(os.path.dirname(name), exist_ok=True) f = open(name, 'w') f.write("%s\n" % modconf) f.close() + conf2append = ' %s' % conf + d.appendVar('FILES:%s' % pkg, conf2append) + d.appendVar('CONFFILES:%s' % pkg, conf2append) + elif modconf: bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename)) - files = d.getVar('FILES:%s' % pkg) - files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) - d.setVar('FILES:%s' % pkg, files) - - conffiles = d.getVar('CONFFILES:%s' % pkg) - conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename) - d.setVar('CONFFILES:%s' % pkg, conffiles) - if "description" in vals: old_desc = d.getVar('DESCRIPTION:' + pkg) or "" d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"]) @@ -184,14 +183,6 @@ python split_kernel_module_packages () { modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version)) if modules: d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules)) - - # If modules-load.d and modprobe.d are empty at this point, remove them to - # avoid warnings. removedirs only raises an OSError if an empty - # directory cannot be removed. - dvar = d.getVar('PKGD') - for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]: - if len(os.listdir(dir)) == 0: - os.rmdir(dir) } do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()))}' From patchwork Tue Jun 27 10:16:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 26522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEF2FEB64DC for ; Tue, 27 Jun 2023 10:17:46 +0000 (UTC) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mx.groups.io with SMTP id smtpd.web11.9555.1687861059151874997 for ; Tue, 27 Jun 2023 03:17:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=kNiTUTfI; spf=pass (domain: gmail.com, ip: 209.85.167.54, mailfrom: quaresma.jose@gmail.com) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4fb7769f15aso2719939e87.0 for ; Tue, 27 Jun 2023 03:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687861057; x=1690453057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vwO47ls3MD4DAEiFfx7RYloDCjCAFAOxxcSF/AFU7xg=; b=kNiTUTfID6eDDsJTf7dCjjCzVKpoyeK4Jl8/Qq4jALAi79QORisEXQRpvPIPd2y2SO b/KyKKZzCbTGBuZG55Pl2VY9sChj1JOuXyxjHBvBXbE/N2xnHV4R72drPlkvSAPRMVbw bXycpEyzApRDcA9JD1nHn8VhKEkyStNNit5MZDqiDIOTs60wMuaSoPqfya6te6BKv7wh dyrBuYJNZEJnTiGwS7K+mSiIT8aD2YGYpoSF4n9xiMYJYyUWPAKpSQ1Vjz7dhtN1wMgQ kU80qlIfTpDTL4VprRloTCIm4kmTXxsG3fqnpuFp3pcMs2RxeElWDQj8ybVx+0bJKNd/ pJnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687861057; x=1690453057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vwO47ls3MD4DAEiFfx7RYloDCjCAFAOxxcSF/AFU7xg=; b=EuRGaSTmy+DfjcYqjLo+t22RSEkVM1D24Wp18Pz9p5Q/znckCRNNzH0rusMZRNkYm3 XskCubfWQ8uqsgDqtqfJT8J7SE9YbHC5FLFU426UTipf5Y3TKLplo0T5QBlMhkTcrgqB 4PuJQyovsttp23mYklLDkQ3uvkhZlUtJ2SRO+JLkNU/ifAg95L7NdFdfVykAlG5Cz0bc MBipo4nK9odlMvo4dZjPo8fr0mJ4dshhbNx8MtfwK5LUmz+AUyWjP1TY8dV1u4MGJxxO tMWQNAESAu8dy2Eynq1xvuZTzTs/JSCD+RvpxvfrFn6dfjpsBT5VA4XfKoKbQkYHKASu BdKw== X-Gm-Message-State: AC+VfDyImE6Klkc8a4VycTUQC8eHeAuLlYKpXaBQeltYrEgRjhNbHITL +mum/XnO/VayckSp1ZedkkwqThJThEE= X-Google-Smtp-Source: ACHHUZ5GcEA02YB5SloUbInQ5obOwbMmKGqilJHZno6DgcMHkPuDJUgkQDm/7KX+kDORjj1ZaxbQuQ== X-Received: by 2002:ac2:558e:0:b0:4fb:7d73:d097 with SMTP id v14-20020ac2558e000000b004fb7d73d097mr1502201lfg.39.1687861056620; Tue, 27 Jun 2023 03:17:36 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id s6-20020a5d4ec6000000b0030ae849c70csm9961436wrv.37.2023.06.27.03.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 03:17:36 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: openembedded-core@lists.openembedded.org Cc: Jose Quaresma Subject: [PATCH 3/5] kernel-module-split: use context manager to open files Date: Tue, 27 Jun 2023 10:16:42 +0000 Message-Id: <20230627101644.881715-3-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230627101644.881715-1-jose.quaresma@foundries.io> References: <20230627101644.881715-1-jose.quaresma@foundries.io> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 27 Jun 2023 10:17:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/183481 Signed-off-by: Jose Quaresma --- V5: no changes .../kernel-module-split.bbclass | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass index 9467a28208..c59e10adcd 100644 --- a/meta/classes-recipe/kernel-module-split.bbclass +++ b/meta/classes-recipe/kernel-module-split.bbclass @@ -69,9 +69,8 @@ python split_kernel_module_packages () { cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile) subprocess.check_call(cmd, shell=True) # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'รถ') - f = open(tmpfile, errors='replace') - l = f.read().split("\000") - f.close() + with open(tmpfile, errors='replace') as f: + l = f.read().split("\000") os.close(tf[0]) os.unlink(tmpfile) if compressed: @@ -101,13 +100,12 @@ python split_kernel_module_packages () { conf = '/etc/modules-load.d/%s.conf' % basename name = '%s%s' % (dvar, conf) os.makedirs(os.path.dirname(name), exist_ok=True) - f = open(name, 'w') - if autoload: - for m in autoload.split(): - f.write('%s\n' % m) - else: - f.write('%s\n' % basename) - f.close() + with open(name, 'w') as f: + if autoload: + for m in autoload.split(): + f.write('%s\n' % m) + else: + f.write('%s\n' % basename) conf2append = ' %s' % conf d.appendVar('FILES:%s' % pkg, conf2append) d.appendVar('CONFFILES:%s' % pkg, conf2append) @@ -124,9 +122,8 @@ python split_kernel_module_packages () { conf = '/etc/modprobe.d/%s.conf' % basename name = '%s%s' % (dvar, conf) os.makedirs(os.path.dirname(name), exist_ok=True) - f = open(name, 'w') - f.write("%s\n" % modconf) - f.close() + with open(name, 'w') as f: + f.write("%s\n" % modconf) conf2append = ' %s' % conf d.appendVar('FILES:%s' % pkg, conf2append) d.appendVar('CONFFILES:%s' % pkg, conf2append) From patchwork Tue Jun 27 10:16:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 26525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB87CC0015E for ; Tue, 27 Jun 2023 10:17:46 +0000 (UTC) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by mx.groups.io with SMTP id smtpd.web10.9630.1687861059764761934 for ; Tue, 27 Jun 2023 03:17:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=Nxogm55t; spf=pass (domain: gmail.com, ip: 209.85.167.52, mailfrom: quaresma.jose@gmail.com) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-4fb7769f15aso2719950e87.0 for ; Tue, 27 Jun 2023 03:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687861057; x=1690453057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xa6cWTwkOVYMf5l8foHZC1PXwc3btdaruKtqtQj3cqA=; b=Nxogm55tj91rwWuyp7xMaINNNx4vVMGEIezZMALyADkQUIZbHLjqAK4BE+ofJ0V9LS czxOB/mUwbPkqx8JUskT9eiMN2IC521F/bdgixMwNDjhF3i3/cWgYbXox1wK1hQ+ngDW 1/EKqfhGgB/wbNu8etujbcN7V/5F1gtHqhBxQmpNTXrU8eeJ9imcOTyKXKtgE4cP3d8+ PDh1DMsQYs74vWUd2CVJk+7Dc6yNHJwauGE1SYucVGgCsCuvDj5ega1Inq8a8pDWqj59 5jOoapa8kW57jIftSiTR6At+6aQyNAV7v6mYEF24UiWv09yDMAcu+4a7q+5jnwHDfq0Y 9uUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687861057; x=1690453057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xa6cWTwkOVYMf5l8foHZC1PXwc3btdaruKtqtQj3cqA=; b=M7kUQczf6hsE4FdTRL3dPGoThRVwqtVPbjAAVTjFzusx8+JCv0RY479YzTypZQOV/A BBWdyRaAh5VsMjT5k4Lv8TOIjc4BDJZG1qiNdY9Hy+KIaZW6aTdKkedC5wXpazMcKDFN dnudfm1BahAyE7XVkeWN6gPYNTyCAIDAOFU9WwGcRkXFJ9nxZT5hGOvFb4Yy3S2oU4VJ G/qF4etZR0lK6QzvDAfmb8u8sSiqbq64D9xa8J4FCeeZ1DDTuwleWGClexbuAhlI3hqA Tg+GAdEirqx6p2l0zaCCILjfLVrzr74uqcSwhjkhn4XNCqS4lti0iPvKEVHVQ9vJQYRe FA0Q== X-Gm-Message-State: AC+VfDwYcwhvwud99nf35kRIB6A3F6zQRZjpbD2N7jMPEvQPu78bGTsY hobcelc3bh0dCSrCLX3RkUSdO0Tik9gZfQ== X-Google-Smtp-Source: ACHHUZ4Tb2nDzsqUpBf1vrCy5yXXXaOhv5doj0Mq3jGGMBerMCkJjtSQsVbI3HUGfUFs7xsjl/ZQ+Q== X-Received: by 2002:a05:6512:32a1:b0:4f8:589d:647b with SMTP id q1-20020a05651232a100b004f8589d647bmr17837018lfe.34.1687861057362; Tue, 27 Jun 2023 03:17:37 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id s6-20020a5d4ec6000000b0030ae849c70csm9961436wrv.37.2023.06.27.03.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 03:17:36 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: openembedded-core@lists.openembedded.org Cc: Jose Quaresma , Ola x Nilsson , Peter Kjellerstedt Subject: [PATCH 4/5] kernel-module-split: make autoload and probeconf distribution specific Date: Tue, 27 Jun 2023 10:16:43 +0000 Message-Id: <20230627101644.881715-4-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230627101644.881715-1-jose.quaresma@foundries.io> References: <20230627101644.881715-1-jose.quaresma@foundries.io> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 27 Jun 2023 10:17:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/183482 The modules-load.d [1] - Configure kernel modules to load at boot should install their configuration files in /usr/lib/modules-load.d. The modprobe.d [2] - Configuration directory for modprobe should install their configuration files in /lib/modprobe.d [1] https://man7.org/linux/man-pages/man5/modules-load.d.5.html [2] https://man7.org/linux/man-pages/man5/modprobe.d.5.html [YOCTO #12212] https://bugzilla.yoctoproject.org/show_bug.cgi?id=12212 CC: Ola x Nilsson CC: Peter Kjellerstedt Signed-off-by: Jose Quaresma --- v5: slipt out systemd config and removing of unused directories kernel-module-split: install config modules directories only when they are needed init-manager-systemd: add modulesloaddir and modprobedir v4: also remove the sysconfdir when systemd is not used as it causes QA Issue: linux-yocto: Files/directories were installed but not shipped in any package v3: fix v2 build issue and only add configuration files to FILES and CONFFILES when they exist and are used. v2: use the same location as before on the class and define the new location just for systemd. meta/classes-recipe/kernel-module-split.bbclass | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass index c59e10adcd..0e4f9a6ec3 100644 --- a/meta/classes-recipe/kernel-module-split.bbclass +++ b/meta/classes-recipe/kernel-module-split.bbclass @@ -30,6 +30,9 @@ fi PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross" +modulesloaddir ??= "${sysconfdir}/modules-load.d" +modprobedir ??= "${sysconfdir}/modprobe.d" + KERNEL_SPLIT_MODULES ?= "1" PACKAGESPLITFUNCS =+ "split_kernel_module_packages" @@ -88,7 +91,7 @@ python split_kernel_module_packages () { dvar = d.getVar('PKGD') - # If autoloading is requested, output /etc/modules-load.d/.conf and append + # If autoloading is requested, output ${modulesloaddir}/.conf and append # appropriate modprobe commands to the postinst autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split() autoload = d.getVar('module_autoload_%s' % basename) @@ -97,7 +100,7 @@ python split_kernel_module_packages () { if autoload and basename not in autoloadlist: bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename)) if basename in autoloadlist: - conf = '/etc/modules-load.d/%s.conf' % basename + conf = '%s/%s.conf' % (d.getVar('modulesloaddir'), basename) name = '%s%s' % (dvar, conf) os.makedirs(os.path.dirname(name), exist_ok=True) with open(name, 'w') as f: @@ -119,7 +122,7 @@ python split_kernel_module_packages () { modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split() modconf = d.getVar('module_conf_%s' % basename) if modconf and basename in modconflist: - conf = '/etc/modprobe.d/%s.conf' % basename + conf = '%s/%s.conf' % (d.getVar('modprobedir'), basename) name = '%s%s' % (dvar, conf) os.makedirs(os.path.dirname(name), exist_ok=True) with open(name, 'w') as f: @@ -165,8 +168,8 @@ python split_kernel_module_packages () { postrm = d.getVar('pkg_postrm:modules') if splitmods != '1': - etcdir = d.getVar('sysconfdir') - d.appendVar('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ %s/modules/' % (etcdir, etcdir, d.getVar("nonarch_base_libdir"))) + d.appendVar('FILES:' + metapkg, '%s %s %s/modules' % + (d.getVar('modulesloaddir'), d.getVar('modprobedir'), d.getVar("nonarch_base_libdir"))) d.appendVar('pkg_postinst:%s' % metapkg, postinst) d.prependVar('pkg_postrm:%s' % metapkg, postrm); return From patchwork Tue Jun 27 10:16:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Quaresma X-Patchwork-Id: 26524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB906C001B0 for ; Tue, 27 Jun 2023 10:17:46 +0000 (UTC) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.groups.io with SMTP id smtpd.web11.9556.1687861059928002312 for ; Tue, 27 Jun 2023 03:17:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=U+h35kMD; spf=pass (domain: gmail.com, ip: 209.85.221.54, mailfrom: quaresma.jose@gmail.com) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3113dabc549so6082925f8f.1 for ; Tue, 27 Jun 2023 03:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687861058; x=1690453058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bMvObPWdIlJ/z/UjnpYHvcV1jsMLsogaUYeDmRJDyFo=; b=U+h35kMDY2Ohu4T6ZWhC/1LYOeGLzdl7l7U8b6niutF3vGME/4+iAOOor25G8lf5bg yJ3VxlkgGqpb/IkLGxEJLYGisNk24wncUG/6tKcAGRaATbqlvKF1DaqLveNRCArNleCY cJxx93aZFHdMuEGnKHVvTSYJNQrrAAR8bNVqI1zK7DuOOdl0+FKKboVNEMGTpifXGrbZ AhNS++++IhpBImf3P1FBxfuHafbF04xb8+4OyuuPTGnRZYE+LeoKcxxnhRYVN3xZnlnf oNypicWQ4L+eDBxXNB5BYucSXwwML7USIkrVzjLt4bmJOTYtKtDgA8eK1MCKLXFO2nD2 dEwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687861058; x=1690453058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bMvObPWdIlJ/z/UjnpYHvcV1jsMLsogaUYeDmRJDyFo=; b=V19o1oNkzQbtTQbQ+ayVOd7DrHx7t4vgZ54u7xDL4uNMtHViQkr6St3vWgjqDZLLU0 Z4dL8f9JKPhIgof5SkcRJcM4IflGDzjBhMC2cJTTc90SPr8OET1Vl+PEa8GBQaLyN/X4 zEBUg8kjGkIYuIlK87QTy08fsGvyFATt4fFxgF6VG0txWEzB8IycEvCzjJMriqYlufnp 6c2zEL9MKyoCPFZ/jk7sBDrbhXxYGIYe1s6UmrMB2s1UKmXpOr3HftqzsJSpw0TkiKoZ Anhe6Ku++4DHnhczPBYs4gBGov0XYeBJAjD/GNVYFEH9jLUjBewRpRDT2hGa8D/mVMW4 H7Ww== X-Gm-Message-State: AC+VfDwHu+s5RcArhnckBsIm6B/pjEoz8/YuVjLiCUJJg0hwD37ycVPX 3FKgFBjo2V3ZZf5PF9h3RtgWHFsF5Th9eg== X-Google-Smtp-Source: ACHHUZ4BjkvVe14KnS7FqjNStUtCDJi5MsLUcz9ot9uPs0kyKfqFUXNfFS1URq62kxfEu5XC6nSHgg== X-Received: by 2002:adf:e801:0:b0:313:f32d:cf96 with SMTP id o1-20020adfe801000000b00313f32dcf96mr5531255wrm.70.1687861057936; Tue, 27 Jun 2023 03:17:37 -0700 (PDT) Received: from og-worker-dev-01.infra.foundries.io.net (51-159-19-113.rev.poneytelecom.eu. [51.159.19.113]) by smtp.gmail.com with ESMTPSA id s6-20020a5d4ec6000000b0030ae849c70csm9961436wrv.37.2023.06.27.03.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 03:17:37 -0700 (PDT) From: Jose Quaresma X-Google-Original-From: Jose Quaresma To: openembedded-core@lists.openembedded.org Cc: Jose Quaresma Subject: [PATCH 5/5] init-manager-systemd: add modulesloaddir and modprobedir Date: Tue, 27 Jun 2023 10:16:44 +0000 Message-Id: <20230627101644.881715-5-jose.quaresma@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230627101644.881715-1-jose.quaresma@foundries.io> References: <20230627101644.881715-1-jose.quaresma@foundries.io> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 27 Jun 2023 10:17:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/183483 Signed-off-by: Jose Quaresma --- v5: introduced in v5 meta/conf/distro/include/init-manager-systemd.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/conf/distro/include/init-manager-systemd.inc b/meta/conf/distro/include/init-manager-systemd.inc index 7867d90028..4989b93502 100644 --- a/meta/conf/distro/include/init-manager-systemd.inc +++ b/meta/conf/distro/include/init-manager-systemd.inc @@ -5,3 +5,7 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd" VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units" VIRTUAL-RUNTIME_login_manager ??= "shadow-base" VIRTUAL-RUNTIME_dev_manager ??= "systemd" + +# Use modules-load and modprobe config path distribution specific +modulesloaddir ?= "${libdir}/modules-load.d" +modprobedir ?= "${nonarch_base_libdir}/modprobe.d"