All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steve Sakoman" <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][dunfell 15/28] wic: Fix multi images .wks with bitbake
Date: Thu,  3 Dec 2020 05:08:05 -1000	[thread overview]
Message-ID: <bfd602099f08b60ab6e561a561d47f7406ae22bf.1607007208.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1607007208.git.steve@sakoman.com>

From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>

In order to support .wks files with multiple images inside bitbake we
need to explicitly set the pseudo database in use.

Eg: If we try this .mks:
part / --source rootfs --ondisk sda --fstype=ext4
part /export --source rootfs --rootfs=core-image-minimal-mtdutils --fstype=ext4

The username for all the files under /export will be set to the runner
of bitbake (usually UID 1000).

Before we run wic, we need to make sure that the pseudo database will be
flushed, and contains all the data needed.

Cc: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit dde90a5dd2b22a539095d1bac82acc15c6380ac8)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes/image_types_wic.bbclass | 8 ++++++--
 scripts/lib/wic/partition.py         | 9 +++------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 70ea46ef5b..82f0985eeb 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -33,8 +33,7 @@ IMAGE_CMD_wic () {
 	if [ -z "$wks" ]; then
 		bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
 	fi
-
-	BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
+	BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
 	mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
 }
 IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
@@ -89,6 +88,10 @@ python do_write_wks_template () {
     bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file)))
 }
 
+do_flush_pseudodb() {
+	${FAKEROOTENV} ${FAKEROOTCMD} -S
+}
+
 python () {
     if d.getVar('USING_WIC'):
         wks_file_u = d.getVar('WKS_FULL_PATH', False)
@@ -142,6 +145,7 @@ python do_rootfs_wicenv () {
     depdir = d.getVar('IMGDEPLOYDIR')
     bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
 }
+addtask do_flush_pseudodb after do_image before do_image_wic
 addtask do_rootfs_wicenv after do_image before do_image_wic
 do_rootfs_wicenv[vardeps] += "${WICVARS}"
 do_rootfs_wicenv[prefuncs] = 'set_image_size'
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 6e87770f3a..18ecec2de9 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -201,13 +201,10 @@ class Partition():
         p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
         if (pseudo_dir == None):
             pseudo_dir = "%s/../pseudo" %  rootfs_dir
-        p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", pseudo_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
-        pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir
-        pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd
-        pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp
+        pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir
+        pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir
+        pseudo += "export PSEUDO_NOSYMLINKEXP=1;"
         pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
 
         rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,
-- 
2.17.1


  parent reply	other threads:[~2020-12-03 15:09 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 15:07 [OE-core][dunfell 00/28] Patch review - pseudo file mode corruption fix series Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 01/28] pseudo: Switch to oe-core branch in git repo Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 02/28] pseudo: merge in fixes for setfacl issue Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 03/28] pseudo: Update to add OFC fcntl lock updates Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 04/28] pseudo: fix renaming to self Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 05/28] pseudo: Ignore mismatched inodes from the db Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 06/28] pseudo: Add support for ignoring paths from the pseudo DB Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 07/28] pseudo: Abort on mismatch patch Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 08/28] psuedo: Add tracking of linked files for fds Steve Sakoman
2020-12-03 15:07 ` [OE-core][dunfell 09/28] pseudo: Fix xattr segfault Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 10/28] pseudo: Add may unlink patch Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 11/28] pseudo: Add pathfix patch Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 12/28] bitbake.conf: Remove TERM from default BB_HASHBASE_WHITELIST Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 13/28] base/bitbake.conf: Enable pseudo path filtering Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 14/28] wic: Fix permissions when using exclude or include path Steve Sakoman
2020-12-03 15:08 ` Steve Sakoman [this message]
2020-12-03 15:08 ` [OE-core][dunfell 16/28] wic: Avoid creating invalid pseudo directory Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 17/28] wic: Handle new PSEUDO_IGNORE_PATHS variable Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 18/28] pseudo: Fix statx function usage Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 19/28] devtool: remove unused variable Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 20/28] bitbake.conf: Extend PSEUDO_IGNORE_PATHS to ${COREBASE}/meta Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 21/28] abi_version,sanity: Tell users TMPDIR must be clean after pseudo changes Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 22/28] pseudo: Update to account for patches merged on branch Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 23/28] pseudo: Upgrade to include mkostemp64 wrapper Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 24/28] base.bbclass: use os.path.normpath instead of just comparing WORKDIR and S as strings Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 25/28] oeqa/selftest/runtime_test: Exclude gpg directory from pseudo database Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 26/28] tcl: adapt to potential pseudo changes Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 27/28] bitbake.conf: Exclude ${CCACHE_DIR} from pseudo database Steve Sakoman
2020-12-03 15:08 ` [OE-core][dunfell 28/28] uninative: Don't use single sstate for pseudo-native Steve Sakoman
2020-12-21 14:33 ` [OE-core][dunfell 00/28] Patch review - pseudo file mode corruption fix series Martin Jansa
2020-12-21 15:06   ` Steve Sakoman
2020-12-22  9:08     ` Erik Boto
2020-12-22 10:03       ` Richard Purdie
2020-12-22 13:50         ` Paul Barker
2020-12-22 14:57           ` Erik Boto
2020-12-22 15:09             ` Paul Barker
2020-12-22 17:53               ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfd602099f08b60ab6e561a561d47f7406ae22bf.1607007208.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.