[oe-commits] [openembedded-core] 03/24: wic: Fix partition files UIDs on multi rootfs images

git at git.openembedded.org git at git.openembedded.org
Tue May 22 12:13:55 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 450335ba5e73a375eb9932b4c4cf37979640dbfc
Author: Ricardo Ribalda Delgado <ricardo.ribalda at gmail.com>
AuthorDate: Fri May 11 16:32:31 2018 +0200

    wic: Fix partition files UIDs on multi rootfs images
    
    When a wks makes reference to multiple rootfs, libspeudo data is not
    properly chossen. This results in filesystems with invalid UIDs for all
    the files.
    
    This can be tested with this .wks file:
    part / --source rootfs --fstype=ext4 --rootfs-dir=core-image-base
    part /mnt/data1/ --fstype=ext4 --source rootfs --rootfs-dir=core-image-minimal
    part /mnt/data2/ --fstype=ext4 --source rootfs --rootfs-dir=core-image-minimal
    
    And this script
    
    $bitbake core-image-minimal core-image-base syslinux
    $losetup --partscan --find --read-only --show test*direct
    $sudo mount /dev/loop0p1 /mnt
    $ls -lan /mnt
    otal 40
    drwxr-xr-x 18    0    0  1024 May 11 16:11 .
    drwxr-xr-x 25    0    0  4096 May  6 06:31 ..
    drwxr-xr-x  2 1000 1000  3072 May 11 15:51 bin
    drwxr-xr-x  2 1000 1000  1024 May 11 13:59 boot
    drwxr-xr-x  2 1000 1000  1024 May 11 13:59 dev
    drwxr-xr-x 25 1000 1000  3072 May 11 15:51 etc
    drwxr-xr-x  3 1000 1000  1024 May 11 13:59 home
    drwxr-xr-x  6 1000 1000  3072 May 11 15:51 lib
    drwx------  2    0    0 12288 May 11 16:11 lost+found
    drwxr-xr-x  2 1000 1000  1024 May 11 13:59 media
    drwxr-xr-x  3 1000 1000  1024 May 11 15:50 mnt
    drwxr-xr-x  2 1000 1000  1024 May 11 13:59 proc
    drwxr-xr-x  2 1000 1000  1024 May 11 15:51 run
    drwxr-xr-x  2 1000 1000  3072 May 11 15:51 sbin
    drwxr-xr-x  2 1000 1000  1024 May 11 13:59 sys
    drwxr-xr-t  2 1000 1000  1024 May 11 13:59 tmp
    drwxr-xr-x 10 1000 1000  1024 May 11 14:54 usr
    drwxr-xr-x  8 1000 1000  1024 May 11 14:55 var
    $sudo losetup -d /dev/loop0
    
    Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda at gmail.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 scripts/lib/wic/partition.py             | 2 +-
 scripts/lib/wic/plugins/imager/direct.py | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 3fe5c4e..c73af9d 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -211,7 +211,7 @@ class Partition():
         """
         p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
         p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR",
-                                         "%s/../pseudo" %  get_bitbake_var("IMAGE_ROOTFS"))
+                                         "%s/../pseudo" %  rootfs_dir)
         p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir)
         p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1")
         pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 1fa6b91..81583e9 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -122,6 +122,10 @@ class DirectPlugin(ImagerPlugin):
         if self._update_fstab(fstab_lines, self.parts):
             # copy rootfs dir to workdir to update fstab
             # as rootfs can be used by other tasks and can't be modified
+            new_pseudo = os.path.realpath(os.path.join(self.workdir, "pseudo"))
+            from_dir = os.path.join(os.path.join(image_rootfs, ".."), "pseudo")
+            from_dir = os.path.realpath(from_dir)
+            copyhardlinktree(from_dir, new_pseudo)
             new_rootfs = os.path.realpath(os.path.join(self.workdir, "rootfs_copy"))
             copyhardlinktree(image_rootfs, new_rootfs)
             fstab_path = os.path.join(new_rootfs, 'etc/fstab')

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list