From ad85c7bc173ca89a876593957fc36e4177116f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Thu, 20 Jul 2023 18:47:03 +0200 Subject: [PATCH] aportgen: replace deviceinfo_modules_initfs for modules file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So deviceinfo_modules_initfs is going to be phased out in pmaports!4169 as a preparation for pmaports#1836. The implementation for the alternative of using a modules file has already been merged in pmaports!4193, so stop promoting the soon-to-be-phased-out deviceinfo variable, and instead use the new and already-supported alternative. Related: https://gitlab.com/postmarketOS/pmaports/-/issues/1836 Related: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4169 Related: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4193 Signed-off-by: Pablo Correa Gómez Reviewed-by: Oliver Smith Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230720164706.18936-1-pabloyoyoista@postmarketos.org%3E --- pmb/aportgen/device.py | 25 +++++++++++++++++-- pmb/config/__init__.py | 1 - .../device/testing/device-lg-mako/deviceinfo | 1 - 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pmb/aportgen/device.py b/pmb/aportgen/device.py index 5a4114af..3ab65669 100644 --- a/pmb/aportgen/device.py +++ b/pmb/aportgen/device.py @@ -179,7 +179,6 @@ def generate_deviceinfo(args, pkgname, name, manufacturer, year, arch, deviceinfo_codename="{codename}" deviceinfo_year="{year}" deviceinfo_dtb="" - deviceinfo_modules_initfs="" deviceinfo_arch="{arch}" # Device related @@ -232,6 +231,24 @@ def generate_deviceinfo(args, pkgname, name, manufacturer, year, arch, handle.write(line.lstrip() + "\n") +def generate_modules(args): + content = """\ + # Remove this comment after reading, or the file if unnecessary (CHANGEME!) + # This file can contain a list of modules to be included in the initramfs, + # so that they are available in early boot stages. It should have one + # module name per line. If there are multiple kernel variants with different + # requirements for modules into the initramfs, one modules.$variant file + # should be created for each of them. + """ + + # Write to file + pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"]) + path = args.work + "/aportgen/modules" + with open(path, "w", encoding="utf-8") as handle: + for line in content.rstrip().split("\n"): + handle.write(line.lstrip() + "\n") + + def generate_apkbuild(args, pkgname, name, arch, flash_method): # Dependencies depends = ["postmarketos-base", @@ -258,7 +275,10 @@ def generate_apkbuild(args, pkgname, name, arch, flash_method): {depends} " makedepends="devicepkg-dev" - source="deviceinfo" + source=" + deviceinfo + modules + " build() {{ devicepkg_build $startdir $pkgname @@ -295,4 +315,5 @@ def generate(args, pkgname): generate_deviceinfo(args, pkgname, name, manufacturer, year, arch, chassis, has_keyboard, has_external_storage, flash_method, bootimg) + generate_modules(args) generate_apkbuild(args, pkgname, name, arch, flash_method) diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index df8bbdcc..e8ed39bc 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -770,7 +770,6 @@ deviceinfo_attributes = [ "codename", "year", "dtb", - "modules_initfs", "arch", # device diff --git a/test/testdata/init_questions_device/aports/device/testing/device-lg-mako/deviceinfo b/test/testdata/init_questions_device/aports/device/testing/device-lg-mako/deviceinfo index 7330fea4..c51fcb15 100644 --- a/test/testdata/init_questions_device/aports/device/testing/device-lg-mako/deviceinfo +++ b/test/testdata/init_questions_device/aports/device/testing/device-lg-mako/deviceinfo @@ -7,7 +7,6 @@ deviceinfo_manufacturer="LG" deviceinfo_codename="lg-mako" deviceinfo_year="2012" deviceinfo_dtb="" -deviceinfo_modules_initfs="" deviceinfo_external_storage="false" deviceinfo_flash_method="fastboot" deviceinfo_arch="armhf"