summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>2020-04-19 08:35:30 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-03 14:13:53 +0000
commit30fff836b92086258d7172614b7d5a312d1fa62e (patch)
tree81d019f6c82e36e0de404ce30e1b21e080170bfc
parent3b06f25a804a8ac4b0a0219649088da22e7a2641 (diff)
downloadpoky-30fff836b92086258d7172614b7d5a312d1fa62e.tar.gz
wic: Fix multi images .wks with bitbake
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> (From OE-Core rev: 63bebeaf60757967b47cae1e24aa61ec5bcbd61b) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image_types_wic.bbclass8
-rw-r--r--scripts/lib/wic/partition.py9
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 () {
33 if [ -z "$wks" ]; then 33 if [ -z "$wks" ]; then
34 bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately." 34 bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
35 fi 35 fi
36 36 BUILDDIR="${TOPDIR}" PSEUDO_UNLOAD=1 wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
37 BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
38 mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic" 37 mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
39} 38}
40IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR" 39IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
@@ -89,6 +88,10 @@ python do_write_wks_template () {
89 bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file))) 88 bb.utils.copyfile(wks_file, "%s/%s" % (depdir, basename + '-' + os.path.basename(wks_file)))
90} 89}
91 90
91do_flush_pseudodb() {
92 ${FAKEROOTENV} ${FAKEROOTCMD} -S
93}
94
92python () { 95python () {
93 if d.getVar('USING_WIC'): 96 if d.getVar('USING_WIC'):
94 wks_file_u = d.getVar('WKS_FULL_PATH', False) 97 wks_file_u = d.getVar('WKS_FULL_PATH', False)
@@ -142,6 +145,7 @@ python do_rootfs_wicenv () {
142 depdir = d.getVar('IMGDEPLOYDIR') 145 depdir = d.getVar('IMGDEPLOYDIR')
143 bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env') 146 bb.utils.copyfile(os.path.join(outdir, basename) + '.env', os.path.join(depdir, basename) + '.env')
144} 147}
148addtask do_flush_pseudodb after do_image before do_image_wic
145addtask do_rootfs_wicenv after do_image before do_image_wic 149addtask do_rootfs_wicenv after do_image before do_image_wic
146do_rootfs_wicenv[vardeps] += "${WICVARS}" 150do_rootfs_wicenv[vardeps] += "${WICVARS}"
147do_rootfs_wicenv[prefuncs] = 'set_image_size' 151do_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():
201 p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) 201 p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
202 if (pseudo_dir == None): 202 if (pseudo_dir == None):
203 pseudo_dir = "%s/../pseudo" % rootfs_dir 203 pseudo_dir = "%s/../pseudo" % rootfs_dir
204 p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", pseudo_dir)
205 p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir)
206 p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1")
207 pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix 204 pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
208 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir 205 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % pseudo_dir
209 pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd 206 pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir
210 pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp 207 pseudo += "export PSEUDO_NOSYMLINKEXP=1;"
211 pseudo += "%s " % get_bitbake_var("FAKEROOTCMD") 208 pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
212 209
213 rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label, 210 rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,