Openembedded Core Discussions
 help / color / mirror / Atom feed
* [Patch 0/9]: support for generating SD images from wic
@ 2014-09-22 11:35 Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 1/9] wic: minor comment update Maciej Borzecki
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Zanussi, Otavio Salvador, Denys Dmytriyenko

This patch series is a proposal that adds support for generating SD
card images for embedded boards using wic. I did not want to cross
post to meta-ti and meta-freescale so Denys and Otavio are added in
CC. I would be glad to receive some feedback from you.

So far, the 2 most common scenarios I've seen are that either the boot
files need to be located in a specific partition, or the bootloader is
located within the disk image, typically directly following MBR. The
series implements support for the first case. The second case should
be easily supportable on top of this code.

Within the context of boot partition, the proposal adds a new variable
IMAGE_BOOT_FILES. The variable contains a list of files that need to
be copied to the boot partition, possibly being renamed during the
process (example BBB support lists u-boot.img and MLO, analogical
config can be made up for RsPI). By default the files are picked up
from DEPLOY_DIR_IMAGE.

Patches 1-4 solve some general problems in wic, so if these go through
review I'd recommend merging them to master. If that's more convenient
I can post them again as a separate series.

Patches 5-8 implement IMAGE_BOOT_FILES support, wic source plugin and
a kickstart for SD card.

Patch 9 adds IMAGE_BOOT_FILES to yocto-bsp BBB config.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/9] wic: minor comment update
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 2/9] wic: use IMAGE_EXTRA_SPACE for vfat rootfs Maciej Borzecki
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Update comment about types of generated partition images.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 scripts/lib/wic/kickstart/custom_commands/partition.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index abf3498..0b02172 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -184,7 +184,7 @@ class Wic_PartData(Mic_PartData):
         Prepare content for a rootfs partition i.e. create a partition
         and fill it from a /rootfs dir.
 
-        Currently handles ext2/3/4 and btrfs.
+        Currently handles ext2/3/4, btrfs and vfat.
         """
         pseudo = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot
         pseudo += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/9] wic: use IMAGE_EXTRA_SPACE for vfat rootfs
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 1/9] wic: minor comment update Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 3/9] wic: fix vfat partition sector count only if needed Maciej Borzecki
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Functions for generating rootfs use IMAGE_EXTRA_SPACE rather than
BOOTDD_EXTRA_SPACE. The latter is used in boot image source plugins.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 scripts/lib/wic/kickstart/custom_commands/partition.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index 0b02172..f41d136 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -308,8 +308,8 @@ class Wic_PartData(Mic_PartData):
 
         extra_blocks = self.get_extra_block_count(blocks)
 
-        if extra_blocks < BOOTDD_EXTRA_SPACE:
-            extra_blocks = BOOTDD_EXTRA_SPACE
+        if extra_blocks < IMAGE_EXTRA_SPACE:
+            extra_blocks = IMAGE_EXTRA_SPACE
 
         blocks += extra_blocks
 
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/9] wic: fix vfat partition sector count only if needed
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 1/9] wic: minor comment update Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 2/9] wic: use IMAGE_EXTRA_SPACE for vfat rootfs Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 4/9] wic: set bootimg_dir when using image-name artifacts Maciej Borzecki
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

VFAT rootfs partitions sector count would get updated always even if
there is no need. Since parition size in wic is expressed in MB, any
sub MB change will cause the generated partition image to be larger
than allocated space within the disk image. Fortunately, partitions
sized in MB will most of the time have a proper sector count.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 scripts/lib/wic/kickstart/custom_commands/partition.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index f41d136..8b0ace6 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -318,9 +318,11 @@ class Wic_PartData(Mic_PartData):
 
         # Ensure total sectors is an integral number of sectors per
         # track or mcopy will complain. Sectors are 512 bytes, and we
-        # generate images with 32 sectors per track. This calculation is
-        # done in blocks, thus the mod by 16 instead of 32.
-        blocks += (16 - (blocks % 16))
+        # generate images with 32 sectors per track. This calculation
+        # is done in blocks, thus the mod by 16 instead of 32. Apply
+        # sector count fix only when needed.
+        if blocks % 16 != 0:
+            blocks += (16 - (blocks % 16))
 
         dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (rootfs, blocks)
         exec_native_cmd(dosfs_cmd, native_sysroot)
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/9] wic: set bootimg_dir when using image-name artifacts
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (2 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 3/9] wic: fix vfat partition sector count only if needed Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 5/9] ref-manual: document IMAGE_BOOT_FILES Maciej Borzecki
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Running wic with -e to use artifacts from a named image, bootimg_dir was
always passed as empty string to partition source plugins. The patch
sets bootimg_dir to current value of DEPLOY_DIR_IMAGE, as bootloader
artifacts end up in that location as well.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 scripts/lib/image/engine.py | 9 +++++++--
 scripts/wic                 | 7 ++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index f1df8b4..3813fec 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -67,7 +67,8 @@ def find_artifacts(image_name):
     """
     bitbake_env_lines = get_bitbake_env_lines()
 
-    rootfs_dir = kernel_dir = hdddir = staging_data_dir = native_sysroot = ""
+    rootfs_dir = kernel_dir = bootimg_dir = ""
+    hdddir = staging_data_dir = native_sysroot = ""
 
     for line in bitbake_env_lines.split('\n'):
         if (get_line_val(line, "IMAGE_ROOTFS")):
@@ -85,8 +86,12 @@ def find_artifacts(image_name):
         if (get_line_val(line, "STAGING_DIR_NATIVE")):
             native_sysroot = get_line_val(line, "STAGING_DIR_NATIVE")
             continue
+        if (get_line_val(line, "DEPLOY_DIR_IMAGE")):
+            bootimg_dir = get_line_val(line, "DEPLOY_DIR_IMAGE")
+            continue
 
-    return (rootfs_dir, kernel_dir, hdddir, staging_data_dir, native_sysroot)
+    return (rootfs_dir, kernel_dir, bootimg_dir, hdddir, staging_data_dir, \
+            native_sysroot)
 
 
 CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts
diff --git a/scripts/wic b/scripts/wic
index 15cc9b3..7314810 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -134,8 +134,8 @@ def wic_create_subcommand(args, usage_str):
     bootimg_dir = staging_data_dir = hdddir = ""
 
     if options.image_name:
-        (rootfs_dir, kernel_dir, hdddir, staging_data_dir, native_sysroot) = \
-            find_artifacts(options.image_name)
+        (rootfs_dir, kernel_dir, bootimg_dir, hdddir, \
+         staging_data_dir, native_sysroot) = find_artifacts(options.image_name)
 
     wks_file = args[0]
 
@@ -172,7 +172,8 @@ def wic_create_subcommand(args, usage_str):
         not_found = not_found_dir = ""
         if not os.path.isdir(rootfs_dir):
             (not_found, not_found_dir) = ("rootfs-dir", rootfs_dir)
-        elif not os.path.isdir(hdddir) and not os.path.isdir(staging_data_dir):
+        elif not os.path.isdir(bootimg_dir) and not os.path.isdir(hdddir) \
+             and not os.path.isdir(staging_data_dir):
             (not_found, not_found_dir) = ("bootimg-dir", bootimg_dir)
         elif not os.path.isdir(kernel_dir):
             (not_found, not_found_dir) = ("kernel-dir", kernel_dir)
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/9] ref-manual: document IMAGE_BOOT_FILES
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (3 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 4/9] wic: set bootimg_dir when using image-name artifacts Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 12:36   ` Alexandre Belloni
  2014-09-22 11:35 ` [PATCH 6/9] documentation.conf: " Maciej Borzecki
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Document IMAGE_BOOT_FILES variable.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 documentation/ref-manual/ref-variables.xml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml
index 7ea753d..5282790 100644
--- a/documentation/ref-manual/ref-variables.xml
+++ b/documentation/ref-manual/ref-variables.xml
@@ -3235,6 +3235,24 @@
             </glossdef>
         </glossentry>
 
+        <glossentry id='var-IMAGE_BOOT_FILES'><glossterm>IMAGE_BOOT_FILES</glossterm>
+            <glossdef>
+                <para>
+                    Comma separated list of files that will be installed into
+                    boot partition when preparing an image. Source files By default the file
+                    is installed unser tha same name as source file. To change
+                    the destination name, separate it with &quot;;&quot;. Source files
+                    need to be located in
+                    <link linkend='var-DEPLOY_DIR_IMAGE'><filename>DEPLOY_DIR_IMAGE</filename></link>.
+                    Examples:
+
+                    <literallayout class="monospaced">
+     IMAGE_BOOT_FILES = "u-boot.img uImage:kernel"
+     IMAGE_BOOT_FILES = "u-boot.${UBOOT_SUFFIX} ${KERNEL_IMAGETYPE}""
+                    </literallayout></para>
+            </glossdef>
+        </glossentry>
+
         <glossentry id='var-IMAGE_CLASSES'><glossterm>IMAGE_CLASSES</glossterm>
             <glossdef>
                 <para>
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/9] documentation.conf: document IMAGE_BOOT_FILES
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (4 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 5/9] ref-manual: document IMAGE_BOOT_FILES Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 7/9] wic: add new bootimg-partition plugin Maciej Borzecki
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Document IMAGE_BOOT_FILES variable.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 meta/conf/documentation.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index dd55685..66ec093 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -204,6 +204,7 @@ ICECC_USER_CLASS_BL[doc] = "Identifies user classes that you do not want the Ice
 ICECC_USER_PACKAGE_BL[doc] = "Identifies user recipes that you do not want the Icecream distributed compile support to consider."
 ICECC_USER_PACKAGE_WL[doc] = "Identifies user recipes that use an empty PARALLEL_MAKE variable that you want to force remote distributed compilation on using the Icecream distributed compile support."
 IMAGE_BASENAME[doc] = "The base name of image output files."
+IMAGE_BOOT_FILES[doc] = "Whitespace separated list of files from ${DEPLOY_DIR_IMAGE} to place in boot partition. Entries will be installed under a same name as the source file. To change the destination file name, pass a desired name after a semicolon (eg. u-boot.img;uboot)."
 IMAGE_CLASSES[doc] = "A list of classes that all images should inherit."
 IMAGE_FEATURES[doc] = "The primary list of features to include in an image. Configure this variable in an image recipe."
 IMAGE_FSTYPES[doc] = "Formats of root filesystem images that you want to have created."
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/9] wic: add new bootimg-partition plugin
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (5 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 6/9] documentation.conf: " Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 8/9] wic: add sdimage-bootpart kickstart file Maciej Borzecki
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

This patch implements 'bootimg-partition source plugin class for 'wic'. The
plugin creates an image of boot partition, copying over files listed in
IMAGE_BOOT_FILES bitbake variable.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 .../lib/wic/plugins/source/bootimg-partition.py    | 108 +++++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100644 scripts/lib/wic/plugins/source/bootimg-partition.py

diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
new file mode 100644
index 0000000..cc72b2f
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -0,0 +1,108 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# DESCRIPTION
+# This implements the 'bootimg-partition' source plugin class for
+# 'wic'. The plugin creates an image of boot partition, copying over
+# files listed in IMAGE_BOOT_FILES bitbake variable.
+#
+# AUTHORS
+# Maciej Borzecki <maciej.borzecki (at] open-rnd.pl>
+#
+
+import os
+import re
+
+from wic import msger
+from wic.pluginbase import SourcePlugin
+from wic.utils.oe.misc import *
+
+class BootimgPartitionPlugin(SourcePlugin):
+    name = 'bootimg-partition'
+
+    @classmethod
+    def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir,
+                        bootimg_dir, kernel_dir, native_sysroot):
+        """
+        Called after all partitions have been prepared and assembled into a
+        disk image. Do nothing.
+        """
+        pass
+
+    @classmethod
+    def do_configure_partition(self, part, source_params, cr, cr_workdir,
+                               oe_builddir, bootimg_dir, kernel_dir,
+                               native_sysroot):
+        """
+        Called before do_prepare_partition(). Possibly prepare
+        configuration files of some sort.
+
+        """
+        pass
+
+    @classmethod
+    def do_prepare_partition(self, part, source_params, cr, cr_workdir,
+                             oe_builddir, bootimg_dir, kernel_dir,
+                             rootfs_dir, native_sysroot):
+        """
+        Called to do the actual content population for a partition i.e. it
+        'prepares' the partition to be incorporated into the image.
+        In this case, does the following:
+        - sets up a vfat partition
+        - copies all files listed in IMAGE_BOOT_FILES variable
+        """
+        hdddir = "%s/boot" % cr_workdir
+        rm_cmd = "rm -rf %s" % cr_workdir
+        exec_cmd(rm_cmd)
+
+        install_cmd = "install -d %s" % hdddir
+        exec_cmd(install_cmd)
+
+        msger.debug('Bootimg dir: %s' % bootimg_dir)
+        img_deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+        boot_files = get_bitbake_var("IMAGE_BOOT_FILES")
+
+        if not boot_files:
+            msger.error('No boot files defined, IMAGE_BOOT_FILES unset')
+
+        msger.debug('Boot files: %s' % boot_files)
+
+        # 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(';'))
+            else:
+                dst_entry = (src_entry, src_entry)
+
+            msger.debug('Destination entry: %r' % (dst_entry,))
+            deploy_files.append(dst_entry)
+
+        for deploy_entry in deploy_files:
+            src, dst = deploy_entry
+            src_path = os.path.join(img_deploy_dir, src)
+            dst_path = os.path.join(hdddir, dst)
+
+            msger.debug('Install %s as %s' % (os.path.basename(src_path),
+                                              dst_path))
+            install_cmd = "install -m 0644 -D %s %s" \
+                          % (src_path, dst_path)
+            exec_cmd(install_cmd)
+
+        msger.debug('Prepare boot partition using rootfs in %s' % (hdddir))
+        part.prepare_rootfs(cr_workdir, oe_builddir, hdddir,
+                            native_sysroot)
+
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 8/9] wic: add sdimage-bootpart kickstart file
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (6 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 7/9] wic: add new bootimg-partition plugin Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-22 11:35 ` [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES Maciej Borzecki
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Add kickstart for generating a SD card image that should cover most use
case scenarios. The layout is as follows:
- 16MB vfat partition that IMAGE_BOOT_FILES will be copied to, 4k
  alignment
- ext4 rootfs, 4k alignment

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 scripts/lib/image/canned-wks/sdimage-bootpart.wks | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 scripts/lib/image/canned-wks/sdimage-bootpart.wks

diff --git a/scripts/lib/image/canned-wks/sdimage-bootpart.wks b/scripts/lib/image/canned-wks/sdimage-bootpart.wks
new file mode 100644
index 0000000..7ffd632
--- /dev/null
+++ b/scripts/lib/image/canned-wks/sdimage-bootpart.wks
@@ -0,0 +1,6 @@
+# short-description: Create SD card image with a boot partition
+# long-description: Creates a partitioned SD card image. Boot files
+# are located in the first vfat partition.
+
+part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4 --size 16
+part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (7 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 8/9] wic: add sdimage-bootpart kickstart file Maciej Borzecki
@ 2014-09-22 11:35 ` Maciej Borzecki
  2014-09-23 18:31   ` Denys Dmytriyenko
  2014-09-22 12:57 ` [Patch 0/9]: support for generating SD images from wic Alexandre Belloni
  2014-09-23 19:28 ` Tom Zanussi
  10 siblings, 1 reply; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-22 11:35 UTC (permalink / raw)
  To: openembedded-core
  Cc: Tom Zanussi, Maciek Borzecki, Otavio Salvador, Denys Dmytriyenko

Set IMAGE_BOOT_FILES to list of files that end up in boot
partition. This in turn is used by wic to generate a bootable SD card
image.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 meta-yocto-bsp/conf/machine/beaglebone.conf | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta-yocto-bsp/conf/machine/beaglebone.conf b/meta-yocto-bsp/conf/machine/beaglebone.conf
index 4263715..a316207 100644
--- a/meta-yocto-bsp/conf/machine/beaglebone.conf
+++ b/meta-yocto-bsp/conf/machine/beaglebone.conf
@@ -35,3 +35,5 @@ UBOOT_ENTRYPOINT = "0x80008000"
 UBOOT_LOADADDRESS = "0x80008000"
 
 MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
+
+IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO"
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/9] ref-manual: document IMAGE_BOOT_FILES
  2014-09-22 11:35 ` [PATCH 5/9] ref-manual: document IMAGE_BOOT_FILES Maciej Borzecki
@ 2014-09-22 12:36   ` Alexandre Belloni
  0 siblings, 0 replies; 17+ messages in thread
From: Alexandre Belloni @ 2014-09-22 12:36 UTC (permalink / raw)
  To: Maciej Borzecki
  Cc: Denys Dmytriyenko, Tom Zanussi, Maciek Borzecki, Otavio Salvador,
	openembedded-core

Hi,

On 22/09/2014 at 13:35:17 +0200, Maciej Borzecki wrote :
> Document IMAGE_BOOT_FILES variable.
> 
> Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> ---
>  documentation/ref-manual/ref-variables.xml | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml
> index 7ea753d..5282790 100644
> --- a/documentation/ref-manual/ref-variables.xml
> +++ b/documentation/ref-manual/ref-variables.xml
> @@ -3235,6 +3235,24 @@
>              </glossdef>
>          </glossentry>
>  
> +        <glossentry id='var-IMAGE_BOOT_FILES'><glossterm>IMAGE_BOOT_FILES</glossterm>
> +            <glossdef>
> +                <para>
> +                    Comma separated list of files that will be installed into
> +                    boot partition when preparing an image. Source files By default the file
> +                    is installed unser tha same name as source file. To change
"under the"

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Patch 0/9]: support for generating SD images from wic
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (8 preceding siblings ...)
  2014-09-22 11:35 ` [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES Maciej Borzecki
@ 2014-09-22 12:57 ` Alexandre Belloni
  2014-09-23 19:28 ` Tom Zanussi
  10 siblings, 0 replies; 17+ messages in thread
From: Alexandre Belloni @ 2014-09-22 12:57 UTC (permalink / raw)
  To: Maciej Borzecki
  Cc: Denys Dmytriyenko, Tom Zanussi, Otavio Salvador,
	openembedded-core

Hi,

On 22/09/2014 at 13:35:12 +0200, Maciej Borzecki wrote :
> This patch series is a proposal that adds support for generating SD
> card images for embedded boards using wic. I did not want to cross
> post to meta-ti and meta-freescale so Denys and Otavio are added in
> CC. I would be glad to receive some feedback from you.
> 
> So far, the 2 most common scenarios I've seen are that either the boot
> files need to be located in a specific partition, or the bootloader is
> located within the disk image, typically directly following MBR. The
> series implements support for the first case. The second case should
> be easily supportable on top of this code.
> 
> Within the context of boot partition, the proposal adds a new variable
> IMAGE_BOOT_FILES. The variable contains a list of files that need to
> be copied to the boot partition, possibly being renamed during the
> process (example BBB support lists u-boot.img and MLO, analogical
> config can be made up for RsPI). By default the files are picked up
> from DEPLOY_DIR_IMAGE.
> 
> Patches 1-4 solve some general problems in wic, so if these go through
> review I'd recommend merging them to master. If that's more convenient
> I can post them again as a separate series.
> 
> Patches 5-8 implement IMAGE_BOOT_FILES support, wic source plugin and
> a kickstart for SD card.
> 
> Patch 9 adds IMAGE_BOOT_FILES to yocto-bsp BBB config.
> 

For the whole series:
Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

I tested on a custom am335x based platform.

Thanks !

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES
  2014-09-22 11:35 ` [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES Maciej Borzecki
@ 2014-09-23 18:31   ` Denys Dmytriyenko
  2014-09-23 19:04     ` Maciej Borzecki
  0 siblings, 1 reply; 17+ messages in thread
From: Denys Dmytriyenko @ 2014-09-23 18:31 UTC (permalink / raw)
  To: Maciej Borzecki
  Cc: Denys Dmytriyenko, Tom Zanussi, Otavio Salvador, Maciek Borzecki,
	openembedded-core

On Mon, Sep 22, 2014 at 01:35:21PM +0200, Maciej Borzecki wrote:
> Set IMAGE_BOOT_FILES to list of files that end up in boot
> partition. This in turn is used by wic to generate a bootable SD card
> image.
> 
> Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>

Acked-by: Denys Dmytriyenko <denys@ti.com>

But meta-yocto-bsp is not part of openembedded-core...


> ---
>  meta-yocto-bsp/conf/machine/beaglebone.conf | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta-yocto-bsp/conf/machine/beaglebone.conf b/meta-yocto-bsp/conf/machine/beaglebone.conf
> index 4263715..a316207 100644
> --- a/meta-yocto-bsp/conf/machine/beaglebone.conf
> +++ b/meta-yocto-bsp/conf/machine/beaglebone.conf
> @@ -35,3 +35,5 @@ UBOOT_ENTRYPOINT = "0x80008000"
>  UBOOT_LOADADDRESS = "0x80008000"
>  
>  MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
> +
> +IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO"
> -- 
> 1.9.0
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES
  2014-09-23 18:31   ` Denys Dmytriyenko
@ 2014-09-23 19:04     ` Maciej Borzecki
  2014-09-23 19:09       ` Richard Purdie
  0 siblings, 1 reply; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-23 19:04 UTC (permalink / raw)
  To: Denys Dmytriyenko
  Cc: Denys Dmytriyenko, Tom Zanussi, Otavio Salvador,
	openembedded-core

On Tuesday 23 of September 2014 14:31:13 Denys Dmytriyenko wrote:
> On Mon, Sep 22, 2014 at 01:35:21PM +0200, Maciej Borzecki wrote:
> > Set IMAGE_BOOT_FILES to list of files that end up in boot
> > partition. This in turn is used by wic to generate a bootable SD card
> > image.
> > 
> > Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
> > Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> 
> Acked-by: Denys Dmytriyenko <denys@ti.com>
> 
> But meta-yocto-bsp is not part of openembedded-core...

Right, thanks for pointing that out. I did not want to cross post and some of 
the patches depend on one another. Is yocto-bsp more applicable for this one 
or just yocto ML?


> 
> > ---
> > 
> >  meta-yocto-bsp/conf/machine/beaglebone.conf | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/meta-yocto-bsp/conf/machine/beaglebone.conf
> > b/meta-yocto-bsp/conf/machine/beaglebone.conf index 4263715..a316207
> > 100644
> > --- a/meta-yocto-bsp/conf/machine/beaglebone.conf
> > +++ b/meta-yocto-bsp/conf/machine/beaglebone.conf
> > @@ -35,3 +35,5 @@ UBOOT_ENTRYPOINT = "0x80008000"
> > 
> >  UBOOT_LOADADDRESS = "0x80008000"
> >  
> >  MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
> > 
> > +
> > +IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO"

-- 

Maciej Borzęcki 
Senior Software Engineer Open-RnD Sp. z o.o. 
www.open-rnd.pl, Facebook, Twitter 
mobile: +48 telefon, fax: +48 42 657 9079 

Niniejsza wiadomość wraz z załącznikami może zawierać chronione prawem lub 
poufne informacje i została wysłana wyłącznie do wiadomości i użytku osób, do 
których została zaadresowana. Jeśli wiadomość została otrzymana przypadkowo 
zabrania się jej kopiowania lub rozsyłania do osób trzecich. W takim przypadku 
uprasza się o natychmiastowe zniszczenie wiadomości oraz poinformowanie 
nadawcy o zaistniałej sytuacji za pomocą wiadomości zwrotnej. Dziękujemy. 

This message, including any attachments hereto, may contain privileged or 
confidential information and is sent solely for the attention and use of the 
intended addressee(s). If you are not an intended addressee, you may neither 
use this message nor copy or deliver it to anyone. In such case, you should 
immediately destroy this message and kindly notify the sender by reply email. 
Thank you.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES
  2014-09-23 19:04     ` Maciej Borzecki
@ 2014-09-23 19:09       ` Richard Purdie
  2014-09-23 19:15         ` Maciej Borzecki
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Purdie @ 2014-09-23 19:09 UTC (permalink / raw)
  To: Maciej Borzecki
  Cc: openembedded-core, Tom Zanussi, Otavio Salvador,
	Denys Dmytriyenko

On Tue, 2014-09-23 at 21:04 +0200, Maciej Borzecki wrote:
> On Tuesday 23 of September 2014 14:31:13 Denys Dmytriyenko wrote:
> > On Mon, Sep 22, 2014 at 01:35:21PM +0200, Maciej Borzecki wrote:
> > > Set IMAGE_BOOT_FILES to list of files that end up in boot
> > > partition. This in turn is used by wic to generate a bootable SD card
> > > image.
> > > 
> > > Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
> > > Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> > 
> > Acked-by: Denys Dmytriyenko <denys@ti.com>
> > 
> > But meta-yocto-bsp is not part of openembedded-core...
> 
> Right, thanks for pointing that out. I did not want to cross post and some of 
> the patches depend on one another. Is yocto-bsp more applicable for this one 
> or just yocto ML?

It should be the poky list but in this case I'll take care of it (I just
put it into master-next of meta-yocto).

Cheers,

Richard



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES
  2014-09-23 19:09       ` Richard Purdie
@ 2014-09-23 19:15         ` Maciej Borzecki
  0 siblings, 0 replies; 17+ messages in thread
From: Maciej Borzecki @ 2014-09-23 19:15 UTC (permalink / raw)
  To: Richard Purdie
  Cc: openembedded-core, Tom Zanussi, Otavio Salvador,
	Denys Dmytriyenko

On Tuesday 23 of September 2014 20:09:19 Richard Purdie wrote:
> On Tue, 2014-09-23 at 21:04 +0200, Maciej Borzecki wrote:
> > On Tuesday 23 of September 2014 14:31:13 Denys Dmytriyenko wrote:
> > > On Mon, Sep 22, 2014 at 01:35:21PM +0200, Maciej Borzecki wrote:
> > > > Set IMAGE_BOOT_FILES to list of files that end up in boot
> > > > partition. This in turn is used by wic to generate a bootable SD card
> > > > image.
> > > > 
> > > > Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
> > > > Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> > > 
> > > Acked-by: Denys Dmytriyenko <denys@ti.com>
> > > 
> > > But meta-yocto-bsp is not part of openembedded-core...
> > 
> > Right, thanks for pointing that out. I did not want to cross post and some
> > of the patches depend on one another. Is yocto-bsp more applicable for
> > this one or just yocto ML?
> 
> It should be the poky list but in this case I'll take care of it (I just
> put it into master-next of meta-yocto).

Great, thanks.

-- 

Maciej Borzęcki 
Senior Software Engineer Open-RnD Sp. z o.o. 
www.open-rnd.pl, Facebook, Twitter 
mobile: +48 telefon, fax: +48 42 657 9079 

Niniejsza wiadomość wraz z załącznikami może zawierać chronione prawem lub 
poufne informacje i została wysłana wyłącznie do wiadomości i użytku osób, do 
których została zaadresowana. Jeśli wiadomość została otrzymana przypadkowo 
zabrania się jej kopiowania lub rozsyłania do osób trzecich. W takim przypadku 
uprasza się o natychmiastowe zniszczenie wiadomości oraz poinformowanie 
nadawcy o zaistniałej sytuacji za pomocą wiadomości zwrotnej. Dziękujemy. 

This message, including any attachments hereto, may contain privileged or 
confidential information and is sent solely for the attention and use of the 
intended addressee(s). If you are not an intended addressee, you may neither 
use this message nor copy or deliver it to anyone. In such case, you should 
immediately destroy this message and kindly notify the sender by reply email. 
Thank you.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Patch 0/9]: support for generating SD images from wic
  2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
                   ` (9 preceding siblings ...)
  2014-09-22 12:57 ` [Patch 0/9]: support for generating SD images from wic Alexandre Belloni
@ 2014-09-23 19:28 ` Tom Zanussi
  10 siblings, 0 replies; 17+ messages in thread
From: Tom Zanussi @ 2014-09-23 19:28 UTC (permalink / raw)
  To: Maciej Borzecki; +Cc: Denys Dmytriyenko, Otavio Salvador, openembedded-core

On Mon, 2014-09-22 at 13:35 +0200, Maciej Borzecki wrote:
> This patch series is a proposal that adds support for generating SD
> card images for embedded boards using wic. I did not want to cross
> post to meta-ti and meta-freescale so Denys and Otavio are added in
> CC. I would be glad to receive some feedback from you.
> 
> So far, the 2 most common scenarios I've seen are that either the boot
> files need to be located in a specific partition, or the bootloader is
> located within the disk image, typically directly following MBR. The
> series implements support for the first case. The second case should
> be easily supportable on top of this code.
> 
> Within the context of boot partition, the proposal adds a new variable
> IMAGE_BOOT_FILES. The variable contains a list of files that need to
> be copied to the boot partition, possibly being renamed during the
> process (example BBB support lists u-boot.img and MLO, analogical
> config can be made up for RsPI). By default the files are picked up
> from DEPLOY_DIR_IMAGE.
> 
> Patches 1-4 solve some general problems in wic, so if these go through
> review I'd recommend merging them to master. If that's more convenient
> I can post them again as a separate series.
> 
> Patches 5-8 implement IMAGE_BOOT_FILES support, wic source plugin and
> a kickstart for SD card.
> 
> Patch 9 adds IMAGE_BOOT_FILES to yocto-bsp BBB config.
> 

This is a nice addition and thanks for fixing the smaller problems you
found.

For the whole series:

Acked-by: Tom Zanussi <tom.zanussi@intel.com>




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-09-23 19:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-22 11:35 [Patch 0/9]: support for generating SD images from wic Maciej Borzecki
2014-09-22 11:35 ` [PATCH 1/9] wic: minor comment update Maciej Borzecki
2014-09-22 11:35 ` [PATCH 2/9] wic: use IMAGE_EXTRA_SPACE for vfat rootfs Maciej Borzecki
2014-09-22 11:35 ` [PATCH 3/9] wic: fix vfat partition sector count only if needed Maciej Borzecki
2014-09-22 11:35 ` [PATCH 4/9] wic: set bootimg_dir when using image-name artifacts Maciej Borzecki
2014-09-22 11:35 ` [PATCH 5/9] ref-manual: document IMAGE_BOOT_FILES Maciej Borzecki
2014-09-22 12:36   ` Alexandre Belloni
2014-09-22 11:35 ` [PATCH 6/9] documentation.conf: " Maciej Borzecki
2014-09-22 11:35 ` [PATCH 7/9] wic: add new bootimg-partition plugin Maciej Borzecki
2014-09-22 11:35 ` [PATCH 8/9] wic: add sdimage-bootpart kickstart file Maciej Borzecki
2014-09-22 11:35 ` [PATCH 9/9] beaglebone.conf: add IMAGE_BOOT_FILES Maciej Borzecki
2014-09-23 18:31   ` Denys Dmytriyenko
2014-09-23 19:04     ` Maciej Borzecki
2014-09-23 19:09       ` Richard Purdie
2014-09-23 19:15         ` Maciej Borzecki
2014-09-22 12:57 ` [Patch 0/9]: support for generating SD images from wic Alexandre Belloni
2014-09-23 19:28 ` Tom Zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox