* [PATCH] wic: refactor to use buildchroot_do_mounts
@ 2018-10-15 6:48 Cedric Hombourger
2018-10-17 12:13 ` Maxim Yu. Osipov
0 siblings, 1 reply; 2+ messages in thread
From: Cedric Hombourger @ 2018-10-15 6:48 UTC (permalink / raw)
To: isar-users; +Cc: Cedric Hombourger
The wic code needs to bind mount buildchroot directories. Leverage the newly
added buildchroot_do_mounts function instead of binding required directories
ourselves.
For additional mounts (such as layer directories), use mountpoint to check if
they were already mounted before bind mounting them.
Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
meta/classes/wic-img.bbclass | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 5ff8b45..d0747e2 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -9,6 +9,7 @@ python () {
bb.fatal("WKS_FILE must be set")
}
+inherit buildchroot
inherit wks-file
WKS_FULL_PATH = "${@get_wks_full_path(d)}"
@@ -67,13 +68,11 @@ WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.wic.img"
do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_wic_image() {
- if ! grep -q ${BUILDCHROOT_DIR}/dev /proc/mounts; then
- sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
- sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
- fi
+ buildchroot_do_mounts
for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do
sudo mkdir -p ${BUILDCHROOT_DIR}/$dir
- sudo mount --bind $dir ${BUILDCHROOT_DIR}/$dir
+ mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1 \
+ || sudo mount --bind $dir ${BUILDCHROOT_DIR}/$dir
done
export FAKEROOTCMD=${FAKEROOTCMD}
export BUILDDIR=${BUILDDIR}
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] wic: refactor to use buildchroot_do_mounts
2018-10-15 6:48 [PATCH] wic: refactor to use buildchroot_do_mounts Cedric Hombourger
@ 2018-10-17 12:13 ` Maxim Yu. Osipov
0 siblings, 0 replies; 2+ messages in thread
From: Maxim Yu. Osipov @ 2018-10-17 12:13 UTC (permalink / raw)
To: Cedric Hombourger, isar-users
On 10/15/18 9:48 AM, Cedric Hombourger wrote:
> The wic code needs to bind mount buildchroot directories. Leverage the newly
> added buildchroot_do_mounts function instead of binding required directories
> ourselves.
>
> For additional mounts (such as layer directories), use mountpoint to check if
> they were already mounted before bind mounting them.
Applied to the 'next'.
Thanks,
Maxim.
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> ---
> meta/classes/wic-img.bbclass | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
> index 5ff8b45..d0747e2 100644
> --- a/meta/classes/wic-img.bbclass
> +++ b/meta/classes/wic-img.bbclass
> @@ -9,6 +9,7 @@ python () {
> bb.fatal("WKS_FILE must be set")
> }
>
> +inherit buildchroot
> inherit wks-file
>
> WKS_FULL_PATH = "${@get_wks_full_path(d)}"
> @@ -67,13 +68,11 @@ WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.wic.img"
> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
>
> do_wic_image() {
> - if ! grep -q ${BUILDCHROOT_DIR}/dev /proc/mounts; then
> - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev
> - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc
> - fi
> + buildchroot_do_mounts
> for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do
> sudo mkdir -p ${BUILDCHROOT_DIR}/$dir
> - sudo mount --bind $dir ${BUILDCHROOT_DIR}/$dir
> + mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1 \
> + || sudo mount --bind $dir ${BUILDCHROOT_DIR}/$dir
> done
> export FAKEROOTCMD=${FAKEROOTCMD}
> export BUILDDIR=${BUILDDIR}
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-17 12:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 6:48 [PATCH] wic: refactor to use buildchroot_do_mounts Cedric Hombourger
2018-10-17 12:13 ` Maxim Yu. Osipov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox