From patchwork Thu May 23 07:39:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 44071 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 86B83C25B75 for ; Thu, 23 May 2024 07:33:39 +0000 (UTC) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by mx.groups.io with SMTP id smtpd.web10.9950.1716449612402973544 for ; Thu, 23 May 2024 00:33:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LrjLOlUr; spf=pass (domain: gmail.com, ip: 209.85.218.41, mailfrom: marcus.folkesson@gmail.com) Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a59a352bbd9so300107666b.1 for ; Thu, 23 May 2024 00:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716449610; x=1717054410; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+8+w02dJucNbP0Ce+8WYuEQvWonMU+PmXL/RRXTsezE=; b=LrjLOlUrd27c1T9jugRfUmG8Vt+li9h2xciMvNu8YzQJJypEdo8o+lSZWgvDRj9I1U 2+mgqzbxN3e29tPfeFT1BmwBb/HXK5HMjrn27gM+Yt4w3i3izXlRDKYWakbX9TngyHsB g/ptLqTTIP++/Df7/ZqXfL9fqtY6pp8SNtG3V4Do7IZ97NC1ksy7cXDubjh5MopnqKwB caR5F0RlP/dhR7HzAikp6/jX9t14L/LfN52+Wr+SFCqVWiq/uadbbfwFtRFGBTDwyB5Q EX1dGlZ5VufIHJr/oIi7COIpjbxMRu/y3sXFIjXQgT5xy/S668g56lLasQyb0E1d3NVW 8KiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716449610; x=1717054410; 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=+8+w02dJucNbP0Ce+8WYuEQvWonMU+PmXL/RRXTsezE=; b=azwSsx6/2Mv1BrnwGeR3+ndHvpKA5FO+Wab2/Vjx1StdwmAF1CwOPOgfqm7zDIg4eY 5D+q5bcHSEPbCnBP1g7y/enzE1ByT78HD7Y7oG7YKpBgbLHBL9RTzIGHSg8FWZU5X876 91aj4BXBltnTQpWK970wcunw7ZUiSOZmbSjTHVDVNVtLnqDOvNOAAMVIH8jgRIQrnOtQ yEBUebO5N/fi/KC74eKx//HwKm6wT8KVaCF5zQVEipMGnr9umHUW0lgjBzDhfpSTh4NJ KRNjKaDsB0e+AXSY9E9pwoK+dpHyaAGAptWqvl3XgoxjlMf63IhJ874TCE8fiB3q5MGG EaQA== X-Gm-Message-State: AOJu0YzlTtvfaWahdstyNuObU0TIFRGaAEAVaMV1B+PcOrsdAJQzVmf3 R3wc/C15ATLcWcBmn1iD9XZZMGb21kppvWovYL2X8orJEi3GPov7Sn42Zw== X-Google-Smtp-Source: AGHT+IHN/Wzap5/18c+WhaHO8k/ANCJ6f8lQ0YIuHcSnZLXQIs+sjEw4cE1wYj6jTIRNvUyvfbEbhQ== X-Received: by 2002:a17:906:80d2:b0:a5d:3be:f101 with SMTP id a640c23a62f3a-a623e8f72abmr117942666b.18.1716449610092; Thu, 23 May 2024 00:33:30 -0700 (PDT) Received: from goliat.wlan.se.axis.com ([85.235.16.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a90d0e919sm1163469166b.85.2024.05.23.00.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:33:29 -0700 (PDT) From: Marcus Folkesson To: docs@lists.yoctoproject.org Cc: Marcus Folkesson Subject: [PATCH 1/2] image-bootfiles.bbclass: new class, copy boot files to /boot on rfs Date: Thu, 23 May 2024 09:39:37 +0200 Message-ID: <20240523073938.2135-1-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.44.0 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 ; Thu, 23 May 2024 07:33:39 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/5227 image-bootfiles class copy files listed IMAGE_BOOT_FILES to the /boot directory of the root filesystem. This is useful when there is no explicit boot partition but all boot files should instead reside inside the root filesystem. Signed-off-by: Marcus Folkesson --- meta/classes/image-bootfiles.bbclass | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 meta/classes/image-bootfiles.bbclass diff --git a/meta/classes/image-bootfiles.bbclass b/meta/classes/image-bootfiles.bbclass new file mode 100644 index 0000000000..850e14e4bb --- /dev/null +++ b/meta/classes/image-bootfiles.bbclass @@ -0,0 +1,69 @@ +# +# Writes IMAGE_BOOT_FILES to the /boot directory +# +# Copyright (C) 2024 Marcus Folkesson +# Author: Marcus Folkesson +# +# Licensed under the MIT license, see COPYING.MIT for details +# Inspired of bootimg-partition.py +# +# Usage: add INHERIT += "image-bootfiles" to your conf file +# + +def bootfiles_populate(d): + import re + from glob import glob + import shutil + + boot_files = d.getVar("IMAGE_BOOT_FILES") + deploy_image_dir = d.getVar("DEPLOY_DIR_IMAGE") + boot_dir = d.getVar("IMAGE_ROOTFS") + "/boot" + install_files = [] + + if boot_files is None: + return + + # list of tuples (src_name, dst_name) + deploy_files = [] + for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files): + if ';' in src_entry: + dst_entry = tuple(src_entry.split(';')) + if not dst_entry[0] or not dst_entry[1]: + raise bb.parse.SkipRecipe('Malformed boot file entry: %s' % src_entry) + else: + dst_entry = (src_entry, src_entry) + + deploy_files.append(dst_entry) + + for deploy_entry in deploy_files: + src, dst = deploy_entry + if '*' in src: + # by default install files under their basename + entry_name_fn = os.path.basename + if dst != src: + # unless a target name was given, then treat name + # as a directory and append a basename + entry_name_fn = lambda name: \ + os.path.join(dst, + os.path.basename(name)) + + + srcs = glob(os.path.join(deploy_image_dir, src)) + for entry in srcs: + src = os.path.relpath(entry, deploy_mage_dir) + entry_dst_name = entry_name_fn(entry) + install_files.append((src, entry_dst_name)) + else: + install_files.append((src, dst)) + + for entry in install_files: + src, dst = entry + image_src = os.path.join(deploy_image_dir, src) + image_dst = os.path.join(boot_dir, dst) + shutil.copyfile(image_src, image_dst) + +python bootfiles () { + bootfiles_populate(d), +} + +IMAGE_PREPROCESS_COMMAND += "bootfiles;" From patchwork Thu May 23 07:39:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 44070 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 87959C25B7A for ; Thu, 23 May 2024 07:33:39 +0000 (UTC) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by mx.groups.io with SMTP id smtpd.web10.9951.1716449613320670149 for ; Thu, 23 May 2024 00:33:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QUQzcoSN; spf=pass (domain: gmail.com, ip: 209.85.218.51, mailfrom: marcus.folkesson@gmail.com) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a599a298990so1141439966b.2 for ; Thu, 23 May 2024 00:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716449611; x=1717054411; darn=lists.yoctoproject.org; 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=iPMGszLmxqrgRbEUYpOB9JaWRu0yBdrakM2O5lKUkVg=; b=QUQzcoSN7oURgbgO8klRgmTGbYhvtD/WlRCmYHsnmEjgkP1DecSYmqwxvdN1pKryor CxuTGm9gj3eXpJC4yPNs8qg+HfRH52QghWf116Cw48Pejvpm9cEfdJGCTD2ljigK1GC4 RiCENaoAR68CuvDHGjsn1F0AOmst+/iycLwYyHp9KPka7rsVODtoPhbSSvM0RYWgkpOv 6el/owQ2c5acS/YEOJEXLmR+VKUx2eQWmevUZsUtolX1YyMYb11Wa5OwJtmaBnWhb9Nn JHwt2C/qg3V7jJtzgrecdPAEMGuLs9YZrPFaIrmPKc6YHKysZ5EP7PORfK2YaxwL89e7 keow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716449611; x=1717054411; 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=iPMGszLmxqrgRbEUYpOB9JaWRu0yBdrakM2O5lKUkVg=; b=UqNeRGoT4h/HAVke4IZQDE+LNJD9S7Ddh5nrPWO/iZu66HDI8SQRDEjWS6BTNdYfuO Yye1sdktbdoOaX/sPjNLSnWZMg9TfM6NvC9KIxHMDoUpnPhNs7p28F7P08g+nSt/YTWV tra+7v/f5ERp5cgSxS8enM1L+OWV/1+xNJa8DC0i0W2LJm0c94XrHtY01TBbLMZhVqlr ZN/RS6pRue/iy7MLXBk3BDG3TtIc1iFpAkYpMp23ipHR3pT0Bmw1Nwd+skdlqe9CwjkX qqiNUNGqapnyJWsxrrs+NWrLv7qCDL9QDUAIFJmSy2bBvq8ijaT5uxAoEgIjIm6w2Xfi NNVQ== X-Gm-Message-State: AOJu0YzZTQuG6Vq4dSrWC0wPcNzJ5ewpOwpfyrMVYPjvvaLn8XWKgtga SQZn95sM5Y9IZbl2hy9C2zMXY1EBDeXU0/oaGqgHKripoZPqO9CPsrDSfA== X-Google-Smtp-Source: AGHT+IHWrFv6oRsDxFF1dcnd7oT3eUmJRXlCwiV7w3ZU/eN+5AM1lGXzTay73ME1VUATyT7nX3p+ig== X-Received: by 2002:a17:906:f258:b0:a59:9c4d:da38 with SMTP id a640c23a62f3a-a62280a2185mr299396066b.45.1716449610992; Thu, 23 May 2024 00:33:30 -0700 (PDT) Received: from goliat.wlan.se.axis.com ([85.235.16.11]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a90d0e919sm1163469166b.85.2024.05.23.00.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:33:30 -0700 (PDT) From: Marcus Folkesson To: docs@lists.yoctoproject.org Cc: Marcus Folkesson Subject: [PATCH 2/2] ref-manual: classes: add new image-bootfiles class Date: Thu, 23 May 2024 09:39:38 +0200 Message-ID: <20240523073938.2135-2-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240523073938.2135-1-marcus.folkesson@gmail.com> References: <20240523073938.2135-1-marcus.folkesson@gmail.com> 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 ; Thu, 23 May 2024 07:33:39 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/5228 Describe the newly introduced image-bootfiles class. Signed-off-by: Marcus Folkesson --- documentation/ref-manual/classes.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst index 9520d0bf7c..53b3697bee 100644 --- a/documentation/ref-manual/classes.rst +++ b/documentation/ref-manual/classes.rst @@ -1169,6 +1169,20 @@ Yocto Project Overview and Concepts Manual. .. _ref-classes-image-buildinfo: +``image-bootfiles`` +=================== + +The :ref:`ref-classes-image-buildinfo` class copies over files listed +in :ref:`IMAGE_BOOT_FILES` to the /boot directory of the root filesystem. + +This can be useful if no separate boot partition is used but all boot files +should be included into the rootfs image. + +:ref:`IMAGE_BOOT_FILES` is the same space-separated list of files used +by the ``bootimg-partition`` source plugin to populate the boot partition. + +.. _ref-classes-image_types: + ``image-buildinfo`` ===================