[OE-core] [PATCH 2/2] image_types.bbclass: add tar --numeric-owner support

Peter A. Bigot pab at pabigot.com
Sun Nov 2 10:48:38 UTC 2014


tar format normally stores user and group as names, which is the right
thing to use when target passwd and group files are available.  When
unpacking a rootfs archive onto a mounted SD card partition on a build
host outside the pseudo environment the host passwd/group files will be
used for name-to-id mapping, which results in mis-assigned identifiers
(often for important ids like messagebus).

Using IMAGE_FSTYPES += "nug.tar" creates rootfs.nug.tar files where the
owner and group are specified numerically, using the target IDs obtained
when the archive is built under pseudo.

Signed-off-by: Peter A. Bigot <pab at pabigot.com>
---
 meta/classes/image_types.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 42d7231..50657ab 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -65,6 +65,7 @@ IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAM
 IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-xz ${EXTRA_IMAGECMD} -noappend -comp xz"
 IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo"
 IMAGE_CMD_tar = "tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar -C ${IMAGE_ROOTFS} ."
+IMAGE_CMD_nug.tar = "tar --numeric-owner -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.nug.tar -C ${IMAGE_ROOTFS} ."
 
 IMAGE_CMD_cpio () {
 	(cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
@@ -139,6 +140,7 @@ IMAGE_TYPES = " \
     squashfs squashfs-xz squashfs-lzo \
     ubi ubifs \
     tar tar.gz tar.bz2 tar.xz tar.lz4 \
+    nug.tar nug.tar.gz nug.tar.bz2 nug.tar.xz nug.tar.lz4 \
     cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
     vmdk \
     elf \
-- 
1.8.5.5




More information about the Openembedded-core mailing list