From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6656667439718203392 Date: Mon, 11 Feb 2019 02:49:42 -0800 (PST) From: chombourger@gmail.com To: isar-users Message-Id: In-Reply-To: <20190211090921.9294-2-claudius.heine.ext@siemens.com> References: <20190211090921.9294-1-claudius.heine.ext@siemens.com> <20190211090921.9294-2-claudius.heine.ext@siemens.com> Subject: Re: [PATCH v5 1/5] meta/image.bbclass: add image_do_mounts for image specific mounts MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1201_83590868.1549882182744" X-Google-Token: EMamheMFgMAGYsA5gZU0 X-Google-IP: 192.94.31.2 X-TUID: PvwnODef4zTf ------=_Part_1201_83590868.1549882182744 Content-Type: multipart/alternative; boundary="----=_Part_1202_489243328.1549882182745" ------=_Part_1202_489243328.1549882182745 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Claudius, So the idea is that platform developers wanting to add their own mounts would use a bbappend to do something like? image_do_mounts_append() { sudo mount } is this something we would want to add to the documentation? Cedric On Monday, February 11, 2019 at 10:09:24 AM UTC+1, claudius....@siemens.com wrote: > > From: Claudius Heine > > > Signed-off-by: Claudius Heine > > --- > meta/classes/image.bbclass | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index d8fbfd5..bec62cd 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -14,6 +14,27 @@ IMAGE_FULLNAME = "${PN}-${DISTRO}-${MACHINE}" > KERNEL_IMAGE ?= "${@get_image_name(d, 'vmlinuz')[1]}" > INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')[1]}" > > +# Useful variables for imager implementations: > +PP = "/home/builder/${PN}" > +PP_DEPLOY = "${PP}/deploy" > +PP_ROOTFS = "${PP}/rootfs" > +PP_WORK = "${PP}/work" > + > +BUILDROOT = "${BUILDCHROOT_DIR}${PP}" > +BUILDROOT_DEPLOY = "${BUILDCHROOT_DIR}${PP_DEPLOY}" > +BUILDROOT_ROOTFS = "${BUILDCHROOT_DIR}${PP_ROOTFS}" > +BUILDROOT_WORK = "${BUILDCHROOT_DIR}${PP_WORK}" > + > +image_do_mounts() { > + sudo flock ${MOUNT_LOCKFILE} -c ' \ > + mkdir -p "${BUILDROOT_DEPLOY}" "${BUILDROOT_ROOTFS}" > "${BUILDROOT_WORK}" > + mount --bind "${DEPLOY_DIR_IMAGE}" "${BUILDROOT_DEPLOY}" > + mount --bind "${IMAGE_ROOTFS}" "${BUILDROOT_ROOTFS}" > + mount --bind "${WORKDIR}" "${BUILDROOT_WORK}" > + ' > + buildchroot_do_mounts > +} > + > inherit ${IMAGE_TYPE} > > # Extra space for rootfs in MB > -- > 2.20.1 > > ------=_Part_1202_489243328.1549882182745 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Claudius,

So the idea is that platfo= rm developers wanting to add their own mounts would use a bbappend to do so= mething like?

image_do_mounts_append() {
=C2=A0 =C2=A0 sudo mount <foo> <bar>
}
is this something we would want to add to the documentation?

Cedric

On Monday, February 11, 2019 at 10:09:= 24 AM UTC+1, claudius....@siemens.com wrote:
From: Claudius Heine <c...@denx.de>

Signed-off-by: Claudius Heine <c...@denx.de>
---
=C2=A0meta/classes/image.bbclass | 21 +++++++++++++++++++++
=C2=A01 file changed, 21 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d8fbfd5..bec62cd 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -14,6 +14,27 @@ IMAGE_FULLNAME =3D "${PN}-${DISTRO}-${MACHINE}&= quot;
=C2=A0KERNEL_IMAGE ?=3D "${@get_image_name(d, 'vmlinuz')[1= ]}"
=C2=A0INITRD_IMAGE ?=3D "${@get_image_name(d, 'initrd.img'= )[1]}"
=C2=A0
+# Useful variables for imager implementations:
+PP =3D "/home/builder/${PN}"
+PP_DEPLOY =3D "${PP}/deploy"
+PP_ROOTFS =3D "${PP}/rootfs"
+PP_WORK =3D "${PP}/work"
+
+BUILDROOT =3D "${BUILDCHROOT_DIR}${PP}"
+BUILDROOT_DEPLOY =3D "${BUILDCHROOT_DIR}${PP_DEPLOY}"
+BUILDROOT_ROOTFS =3D "${BUILDCHROOT_DIR}${PP_ROOTFS}"
+BUILDROOT_WORK =3D "${BUILDCHROOT_DIR}${PP_WORK}"
+
+image_do_mounts() {
+ =C2=A0 =C2=A0sudo flock ${MOUNT_LOCKFILE} -c ' \
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0mkdir -p "${BUILDROOT_DEPLOY}" &= quot;${BUILDROOT_ROOTFS}" "${BUILDROOT_WORK}"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0mount --bind "${DEPLOY_DIR_IMAGE}&quo= t; "${BUILDROOT_DEPLOY}"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0mount --bind "${IMAGE_ROOTFS}" &= quot;${BUILDROOT_ROOTFS}"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0mount --bind "${WORKDIR}" "= ${BUILDROOT_WORK}"
+ =C2=A0 =C2=A0'
+ =C2=A0 =C2=A0buildchroot_do_mounts
+}
+
=C2=A0inherit ${IMAGE_TYPE}
=C2=A0
=C2=A0# Extra space for rootfs in MB
--=20
2.20.1

------=_Part_1202_489243328.1549882182745-- ------=_Part_1201_83590868.1549882182744--