All of lore.kernel.org
 help / color / mirror / Atom feed
From: Otavio Salvador <otavio@ossystems.com.br>
To: meta-freescale Mailing List <meta-freescale@yoctoproject.org>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Subject: [PATCH] imx-base.inc: Generate a default IMAGE_BOOT_FILES
Date: Wed,  4 Oct 2017 17:40:48 -0300	[thread overview]
Message-ID: <20171004204048.5246-1-otavio@ossystems.com.br> (raw)

When the machine requires a boot partition, it needs to define the
IMAGE_BOOT_FILES to include the device tree files and Linux kernel
image. This is essentially a generic solution so instead of defining
it for all machines we are providing a default value for them.

To implement that, we borrowed an utility function from Raspberry Pi
BSP. It is copied as is at conf/machine/include/utilities.inc file.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

 conf/machine/include/imx-base.inc  |  7 +++++++
 conf/machine/include/utilities.inc | 28 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 conf/machine/include/utilities.inc

diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc
index 06f93fcb..c96216de 100644
--- a/conf/machine/include/imx-base.inc
+++ b/conf/machine/include/imx-base.inc
@@ -3,6 +3,8 @@
 include conf/machine/include/fsl-default-settings.inc
 include conf/machine/include/fsl-default-versions.inc
 
+require conf/machine/include/utilities.inc
+
 # Set specific make target and binary suffix
 PREFERRED_PROVIDER_u-boot ??= "u-boot-fslc"
 PREFERRED_PROVIDER_virtual/bootloader ??= "u-boot-fslc"
@@ -226,6 +228,11 @@ SOC_DEFAULT_IMAGE_FSTYPES_mxs = "uboot-mxsboot-sdcard sdcard.gz"
 SDCARD_ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4"
 IMAGE_FSTYPES ?= "${SOC_DEFAULT_IMAGE_FSTYPES}"
 
+IMAGE_BOOT_FILES ?= " \
+    ${KERNEL_IMAGETYPE} \
+    ${@make_dtb_boot_files(d)} \
+"    
+
 ### wic default support
 WKS_FILE_DEPENDS ?= " \
     virtual/bootloader \
diff --git a/conf/machine/include/utilities.inc b/conf/machine/include/utilities.inc
new file mode 100644
index 00000000..bcb1c2a7
--- /dev/null
+++ b/conf/machine/include/utilities.inc
@@ -0,0 +1,28 @@
+### Machine definition file utilities
+
+def make_dtb_boot_files(d):
+    # Generate IMAGE_BOOT_FILES entries for device tree files listed in
+    # KERNEL_DEVICETREE.
+    alldtbs = d.getVar('KERNEL_DEVICETREE')
+    imgtyp = d.getVar('KERNEL_IMAGETYPE')
+
+    def transform(dtb):
+        if dtb.endswith('dtb'):
+            # eg: whatever/bcm2708-rpi-b.dtb has:
+            #     DEPLOYDIR file: ${KERNEL_IMAGETYPE}-bcm2708-rpi-b.dtb
+            #     destination: bcm2708-rpi-b.dtb
+            base = os.path.basename(dtb)
+            src = '{}-{}'.format(imgtyp, base)
+            dst = base
+            return '{};{}'.format(src, dst)
+        elif dtb.endswith('dtbo'):
+            # overlay dtb:
+            # eg: overlays/hifiberry-amp.dtbo has:
+            #     DEPLOYDIR file: ${KERNEL_IMAGETYPE}-hifiberry-amp.dtbo
+            #     destination: overlays/hifiberry-amp.dtbo
+            base = os.path.basename(dtb)
+            src = '{}-{}'.format(imgtyp, base)
+            dst = dtb
+            return '{};{}'.format(src, dtb)
+
+    return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb])
-- 
2.14.2



             reply	other threads:[~2017-10-04 20:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 20:40 Otavio Salvador [this message]
2017-10-05 17:45 ` [PATCH] imx-base.inc: Generate a default IMAGE_BOOT_FILES Daiane Angolini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171004204048.5246-1-otavio@ossystems.com.br \
    --to=otavio@ossystems.com.br \
    --cc=meta-freescale@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.