From: Jon Ringle <jrin...@gridpoint.com>

Signed-off-by: Jon Ringle <jrin...@gridpoint.com>
---
 doc/ref_manual.rst                     |  3 +++
 platforms/image-root-tgz.in            | 17 +++++++++++++++++
 rules/image-root-tgz.make              |  1 +
 rules/post/ptxd_make_image_common.make |  3 ++-
 scripts/lib/ptxd_make_image_archive.sh |  8 ++++++--
 scripts/lib/ptxd_make_image_common.sh  |  6 ++++++
 6 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/doc/ref_manual.rst b/doc/ref_manual.rst
index 63b0a9c..a26e63c 100644
--- a/doc/ref_manual.rst
+++ b/doc/ref_manual.rst
@@ -399,6 +399,9 @@ different.
   conflicting files from multiple images. The created nfsroot directory is
   ``<platform-dir>/nfsroot/<image-name>``.
 
+``<PKG>_LABEL``
+  This is a tar label to put on an image. This is supported by image-root-tgz.
+
 .. _reference_macros:
 
 Rule File Macro Reference
diff --git a/platforms/image-root-tgz.in b/platforms/image-root-tgz.in
index fce1516..9d9916c 100644
--- a/platforms/image-root-tgz.in
+++ b/platforms/image-root-tgz.in
@@ -5,3 +5,20 @@ config IMAGE_ROOT_TGZ
        prompt "Generate images/root.tgz"
        help
          FIXME
+
+if IMAGE_ROOT_TGZ
+
+config IMAGE_ROOT_TGZ_LABEL
+       string
+       prompt "label"
+       default ""
+
+       help
+         This string gets expanded to form the label. An empty string produces 
no label.
+         For example, this could be set to:
+           
${PTXCONF_PROJECT_VENDOR}-${PTXCONF_PROJECT}${PTXCONF_PROJECT_VERSION}
+         
+         The label on the generate image can be checked with the command:
+           $ tar --test-label -f images/root.tgz
+endif
+
diff --git a/rules/image-root-tgz.make b/rules/image-root-tgz.make
index c93e8c9..07a8370 100644
--- a/rules/image-root-tgz.make
+++ b/rules/image-root-tgz.make
@@ -20,6 +20,7 @@ IMAGE_ROOT_TGZ                := image-root-tgz
 IMAGE_ROOT_TGZ_DIR     := $(BUILDDIR)/$(IMAGE_ROOT_TGZ)
 IMAGE_ROOT_TGZ_IMAGE   := $(IMAGEDIR)/root.tgz
 IMAGE_ROOT_TGZ_PKGS    = $(PTX_PACKAGES_INSTALL)
+IMAGE_ROOT_TGZ_LABEL   := $(call remove_quotes, 
$(PTXCONF_IMAGE_ROOT_TGZ_LABEL))
 
 # ----------------------------------------------------------------------------
 # Image
diff --git a/rules/post/ptxd_make_image_common.make 
b/rules/post/ptxd_make_image_common.make
index a1a5e78..8aa8c0a 100644
--- a/rules/post/ptxd_make_image_common.make
+++ b/rules/post/ptxd_make_image_common.make
@@ -21,7 +21,8 @@ world/image/env/impl = \
        image_env="$(call ptx/escape,$($(1)_ENV))"              \
        image_pkgs="$(call ptx/escape,$($(1)_PKGS))"            \
        image_files="$(call ptx/escape,$($(1)_FILES))"          \
-       image_image="$(call ptx/escape,$($(1)_IMAGE))"
+       image_image="$(call ptx/escape,$($(1)_IMAGE))"          \
+       image_label="$(call ptx/escape,$($(1)_LABEL))"
 
 world/image/env = \
        $(call world/image/env/impl,$(strip $(1)))
diff --git a/scripts/lib/ptxd_make_image_archive.sh 
b/scripts/lib/ptxd_make_image_archive.sh
index 650679a..e21da5c 100644
--- a/scripts/lib/ptxd_make_image_archive.sh
+++ b/scripts/lib/ptxd_make_image_archive.sh
@@ -16,8 +16,12 @@ ptxd_make_image_archive_impl() {
     ptxd_get_ipkg_files ${image_pkgs} &&
     ptxd_make_image_extract_xpkg_files "${pkg_dir}" &&
     cd "${pkg_dir}" &&
-    echo -e "\nCreating $(ptxd_print_path "${image_image}") ...\n" &&
-    tar -zcf "${image_image}" . &&
+    echo -ne "\nCreating $(ptxd_print_path "${image_image}") "
+    if [ -n "${image_label}" ]; then
+       echo -n "with label \"${image_label}\" "
+    fi
+    echo -ne "...\n" &&
+    tar ${image_label_args} -zcf "${image_image}" . &&
     rm -r "${pkg_dir}"
 }
 export -f ptxd_make_image_archive_impl
diff --git a/scripts/lib/ptxd_make_image_common.sh 
b/scripts/lib/ptxd_make_image_common.sh
index 402ff53..a925446 100644
--- a/scripts/lib/ptxd_make_image_common.sh
+++ b/scripts/lib/ptxd_make_image_common.sh
@@ -66,6 +66,12 @@ ptxd_make_image_init() {
        image_ipkg_repo_dirs=( "${image_repo_dist_dir}" )
     fi
 
+    if [ -n "${image_label}" ]; then
+       image_label_args="--label \"${image_label}\""
+    else
+       image_label_args=""
+    fi
+
     exec 2>&${PTXDIST_FD_LOGERR}
 }
 export -f ptxd_make_image_init
-- 
1.9.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to