Skip to contentSkip to conversation

wic: fixes for wic support

PATCH In review Maciej Borzecki 2 participants 4 messages Feb 27, 2017 – Mar 11, 2017 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

cover wic: fixes for wic support

A small series with 2 patches that enable using wic (once again).

The first patch moves sdimage-wks to ${LAYERDIR}/wic. This is already implemented in meta-yocto-bsp. The goal is to make wks files easier to find. Since Yocto is in general dumping custom image building methods in favor of wic, one would expect that wic is also usable with meta-raspberrypi.

The second patch adds support for KERNEL_DEVICETREE to IMAGE_BOOT_FILES. Currently, DTs will be copied over to boot partition when building rpi-sdimg. However, when building a wic image, none of this happens and once the process comlpetes, one will get an unbootable image. The patch adds proper entries to IMAGE_BOOT_FILES also taking care of proper file name transformation.

With these 2 patches, a wic image can be built by adding the following settings to conf/local.conf:

IMAGE_FSTYPES_append = " wic"

   # or with your favourite compression, eg. wic.xz
   WKS_FILES = "sdimage-raspberrypi.wks"

Maciej Borzecki (2):
wic: move sdimage-raspberrypi to toplevel wic location
rpi-base: wic: generate entries for device tree files

 conf/machine/include/rpi-base.inc                  | 32 +++++++++++++++++++++-
 .../canned-wks => wic}/sdimage-raspberrypi.wks     |  0
 2 files changed, 31 insertions(+), 1 deletion(-)
 rename {scripts/lib/image/canned-wks => wic}/sdimage-raspberrypi.wks (100%)
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/2 wic: move sdimage-raspberrypi to toplevel wic location

Wic supports picking up image files from toplevel LAYERDIR/wic directory. Using this location has the benefit that image files are easier to find (compare that to previously used scripts/lib/image/canned-wks/ location).

---
 {scripts/lib/image/canned-wks => wic}/sdimage-raspberrypi.wks | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {scripts/lib/image/canned-wks => wic}/sdimage-raspberrypi.wks (100%)
wic/sdimage-raspberrypi.wks renamed from scripts/lib/image/canned-wks/sdimage-raspberrypi.wks +0 -0
similarity index 100%
rename from scripts/lib/image/canned-wks/sdimage-raspberrypi.wks
rename to wic/sdimage-raspberrypi.wks
Signature · 1 line
2.5.5
#2 lore raw

PATCH 2/2 rpi-base: wic: generate entries for device tree files

In reply to Maciej Borzecki

Augment IMAGE_BOOT_FILES with entries picking up proper dtb[o]s. This allows for building usable wic images once again.

---
 conf/machine/include/rpi-base.inc | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
conf/machine/include/rpi-base.inc +31 -1
index e069e7039f166b4503d6709df7bf770dadc6af5d..092cbeb1f7f2ce51b79acb44951373a600e97573 100644
@@ -51,7 +51,37 @@ MACHINE_EXTRA_RRECOMMENDS += " kernel-modules"
 # Set Raspberrypi splash image
 SPLASH = "psplash-raspberrypi"
 
-IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* ${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}"
+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: bcm2708-rpi-b.dtb has:
+            #     DEPLOYDIR file: ${KERNEL_IMAGETYPE}-bcm2708-rpi-b.dtb
+            #     destination: bcm2708-rpi-b.dtb
+            src = '{}-{}'.format(imgtyp, dtb)
+            dst = dtb
+            return '{};{}'.format(src, dst)
+        elif dtb.endswith('dtbo'):
+            # overlay dtb:
+            # eg: overlays/hifiberry-amp.dtbo has:
+            #     DEPLOYDIR file: ${KERNEL_IMAGETYPE}-hifiberry-amp.dtbp
+            #     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])
+
+
+IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \
+                 ${@make_dtb_boot_files(d)} \
+                 ${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE} \
+                 "
 
 # The kernel image is installed into the FAT32 boot partition and does not need
 # to also be installed into the rootfs.
Signature · 1 line
2.5.5
#3 lore raw
In reply to Maciej Borzecki
Quoted 15 lines · Maciej Borzecki

A small series with 2 patches that enable using wic (once again).

The first patch moves sdimage-wks to ${LAYERDIR}/wic. This is already implemented in meta-yocto-bsp. The goal is to make wks files easier to find. Since Yocto is in general dumping custom image building methods in favor of wic, one would expect that wic is also usable with meta-raspberrypi.

The second patch adds support for KERNEL_DEVICETREE to IMAGE_BOOT_FILES. Currently, DTs will be copied over to boot partition when building rpi-sdimg. However, when building a wic image, none of this happens and once the process comlpetes, one will get an unbootable image. The patch adds proper entries to IMAGE_BOOT_FILES also taking care of proper file name transformation.

Quoted 7 lines

With these 2 patches, a wic image can be built by adding the following settings to conf/local.conf:

IMAGE_FSTYPES_append = " wic"

   # or with your favourite compression, eg. wic.xz
   WKS_FILES = "sdimage-raspberrypi.wks"

I have staged it in kraj/master and will test out image generation using wic.

Quoted 10 lines

Maciej Borzecki (2):
wic: move sdimage-raspberrypi to toplevel wic location
rpi-base: wic: generate entries for device tree files

 conf/machine/include/rpi-base.inc                  | 32 +++++++++++++++++++++-
 .../canned-wks => wic}/sdimage-raspberrypi.wks     |  0
 2 files changed, 31 insertions(+), 1 deletion(-)
 rename {scripts/lib/image/canned-wks => wic}/sdimage-raspberrypi.wks (100%)