diff mbox series

[isar-cip-core,1/4] make deploy-ovmf compatible with schroot imaging

Message ID 20231008031529.1338834-2-felix.moessbauer@siemens.com (mailing list archive)
State Superseded
Headers show
Series make compatible with latest ISAR revision | expand

Commit Message

Felix Moessbauer Oct. 8, 2023, 3:15 a.m. UTC
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 recipes-core/images/deploy-ovmf.inc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Felix Moessbauer Oct. 8, 2023, 10:19 a.m. UTC | #1
On Sun, 2023-10-08 at 12:18 +0200, Jan Kiszka wrote:
> On 08.10.23 05:15, Felix Moessbauer wrote:
> > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > ---
> >  recipes-core/images/deploy-ovmf.inc | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/recipes-core/images/deploy-ovmf.inc b/recipes-
> > core/images/deploy-ovmf.inc
> > index 0ec8762..cdab118 100644
> > --- a/recipes-core/images/deploy-ovmf.inc
> > +++ b/recipes-core/images/deploy-ovmf.inc
> > @@ -11,11 +11,15 @@
> >  # This recipe deploys the OVMF binaries to run the image in QEMU
> >  # Note: x86 only
> >  
> > -IMAGER_INSTALL += "ovmf"
> > +INSTALL_deploy_ovmf_binaries += "ovmf"
> >  
> > +do_deploy_ovmf_binaries[network] += "${TASK_USE_SUDO}"
> >  do_deploy_ovmf_binaries[cleandirs] += "${DEPLOY_DIR_IMAGE}/OVMF"
> > +do_deploy_ovmf_binaries[depends] += "${SCHROOT_DEP}"
> >  do_deploy_ovmf_binaries() {
> > -    cp -v ${BUILDCHROOT_DIR}/usr/share/OVMF/*.fd
> > ${DEPLOY_DIR_IMAGE}/OVMF
> > +    imager_run -p -d ${PP_WORK} -- <<'EOIMAGER'
> > +        cp -v /usr/share/OVMF/*.fd ${PP_DEPLOY}/OVMF/
> > +EOIMAGER
> 
> Single command, no need for the EOIMAGER trick here.

Looks like, but it uses shell globbing. By that we either do it like
this, or we surround it with /bin/bash -c ''.

Felix

> 
> >  }
> > +addtask deploy_ovmf_binaries before do_image
> >  
> > -addtask deploy_ovmf_binaries after do_install_imager_deps before
> > do_image
> 
> Jan
>
Jan Kiszka Oct. 9, 2023, 5:55 a.m. UTC | #2
On 08.10.23 12:19, MOESSBAUER, Felix (T CED INW-CN) wrote:
> On Sun, 2023-10-08 at 12:18 +0200, Jan Kiszka wrote:
>> On 08.10.23 05:15, Felix Moessbauer wrote:
>>> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
>>> ---
>>>  recipes-core/images/deploy-ovmf.inc | 10 +++++++---
>>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/recipes-core/images/deploy-ovmf.inc b/recipes-
>>> core/images/deploy-ovmf.inc
>>> index 0ec8762..cdab118 100644
>>> --- a/recipes-core/images/deploy-ovmf.inc
>>> +++ b/recipes-core/images/deploy-ovmf.inc
>>> @@ -11,11 +11,15 @@
>>>  # This recipe deploys the OVMF binaries to run the image in QEMU
>>>  # Note: x86 only
>>>
>>> -IMAGER_INSTALL += "ovmf"
>>> +INSTALL_deploy_ovmf_binaries += "ovmf"
>>>
>>> +do_deploy_ovmf_binaries[network] += "${TASK_USE_SUDO}"
>>>  do_deploy_ovmf_binaries[cleandirs] += "${DEPLOY_DIR_IMAGE}/OVMF"
>>> +do_deploy_ovmf_binaries[depends] += "${SCHROOT_DEP}"
>>>  do_deploy_ovmf_binaries() {
>>> -    cp -v ${BUILDCHROOT_DIR}/usr/share/OVMF/*.fd
>>> ${DEPLOY_DIR_IMAGE}/OVMF
>>> +    imager_run -p -d ${PP_WORK} -- <<'EOIMAGER'
>>> +        cp -v /usr/share/OVMF/*.fd ${PP_DEPLOY}/OVMF/
>>> +EOIMAGER
>>
>> Single command, no need for the EOIMAGER trick here.
> 
> Looks like, but it uses shell globbing. By that we either do it like
> this, or we surround it with /bin/bash -c ''.
> 

Yep, still nicer to read IMHO.

> Felix
> 
>>
>>>  }
>>> +addtask deploy_ovmf_binaries before do_image
>>>
>>> -addtask deploy_ovmf_binaries after do_install_imager_deps before
>>> do_image

This is incorrect:

Log data follows:
| DEBUG: Executing shell function do_deploy_ovmf_binaries
| E: 10mount: mount: /run/schroot/mount/isar-builder-0af4fb00-967f-4225-bb40-24080d20a499-118-a5246ca0-55cc-4a6b-8768-5c03a82eb3d8/home/builder/cip-core-image-qemu-amd64/rootfs: special device /build/tmp/work/cip-core-bookworm-amd64/cip-core-image-qemu-amd64/1.0-r0/rootfs does not exist.
| E: 10mount:        dmesg(1) may have more information after failed mount system call.
| WARNING: exit code 1 from a shell command.
ERROR: Task (/build/../repo/recipes-core/images/cip-core-image.bb:do_deploy_ovmf_binaries) failed with exit code '1'

Must be something like

addtask deploy_ovmf_binaries after do_rootfs_install before do_build

because schroot mounting expects a target rootfs.

Did you test this?

Jan
Felix Moessbauer Oct. 9, 2023, 6:34 a.m. UTC | #3
On Mon, 2023-10-09 at 07:55 +0200, Jan Kiszka wrote:
> On 08.10.23 12:19, MOESSBAUER, Felix (T CED INW-CN) wrote:
> > On Sun, 2023-10-08 at 12:18 +0200, Jan Kiszka wrote:
> > > On 08.10.23 05:15, Felix Moessbauer wrote:
> > > > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> > > > ---
> > > >  recipes-core/images/deploy-ovmf.inc | 10 +++++++---
> > > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/recipes-core/images/deploy-ovmf.inc b/recipes-
> > > > core/images/deploy-ovmf.inc
> > > > index 0ec8762..cdab118 100644
> > > > --- a/recipes-core/images/deploy-ovmf.inc
> > > > +++ b/recipes-core/images/deploy-ovmf.inc
> > > > @@ -11,11 +11,15 @@
> > > >  # This recipe deploys the OVMF binaries to run the image in
> > > > QEMU
> > > >  # Note: x86 only
> > > > 
> > > > -IMAGER_INSTALL += "ovmf"
> > > > +INSTALL_deploy_ovmf_binaries += "ovmf"
> > > > 
> > > > +do_deploy_ovmf_binaries[network] += "${TASK_USE_SUDO}"
> > > >  do_deploy_ovmf_binaries[cleandirs] +=
> > > > "${DEPLOY_DIR_IMAGE}/OVMF"
> > > > +do_deploy_ovmf_binaries[depends] += "${SCHROOT_DEP}"
> > > >  do_deploy_ovmf_binaries() {
> > > > -    cp -v ${BUILDCHROOT_DIR}/usr/share/OVMF/*.fd
> > > > ${DEPLOY_DIR_IMAGE}/OVMF
> > > > +    imager_run -p -d ${PP_WORK} -- <<'EOIMAGER'
> > > > +        cp -v /usr/share/OVMF/*.fd ${PP_DEPLOY}/OVMF/
> > > > +EOIMAGER
> > > 
> > > Single command, no need for the EOIMAGER trick here.
> > 
> > Looks like, but it uses shell globbing. By that we either do it
> > like
> > this, or we surround it with /bin/bash -c ''.
> > 
> 
> Yep, still nicer to read IMHO.

Ok, I'll change this and also squash into one commit.

> 
> > Felix
> > 
> > > 
> > > >  }
> > > > +addtask deploy_ovmf_binaries before do_image
> > > > 
> > > > -addtask deploy_ovmf_binaries after do_install_imager_deps
> > > > before
> > > > do_image
> 
> This is incorrect:
> 
> Log data follows:
> > DEBUG: Executing shell function do_deploy_ovmf_binaries
> > E: 10mount: mount: /run/schroot/mount/isar-builder-0af4fb00-967f-
> > 4225-bb40-24080d20a499-118-a5246ca0-55cc-4a6b-8768-
> > 5c03a82eb3d8/home/builder/cip-core-image-qemu-amd64/rootfs: special
> > device /build/tmp/work/cip-core-bookworm-amd64/cip-core-image-qemu-
> > amd64/1.0-r0/rootfs does not exist.
> > E: 10mount:        dmesg(1) may have more information after failed
> > mount system call.
> > WARNING: exit code 1 from a shell command.
> ERROR: Task (/build/../repo/recipes-core/images/cip-core-
> image.bb:do_deploy_ovmf_binaries) failed with exit code '1'
> 
> Must be something like
> 
> addtask deploy_ovmf_binaries after do_rootfs_install before do_build
> 
> because schroot mounting expects a target rootfs.

Ok, good catch. I did not run into this issue when testing, but
probably my rootfs was just setup already.

Felix

> 
> Did you test this?
> 
> Jan
>
diff mbox series

Patch

diff --git a/recipes-core/images/deploy-ovmf.inc b/recipes-core/images/deploy-ovmf.inc
index 0ec8762..cdab118 100644
--- a/recipes-core/images/deploy-ovmf.inc
+++ b/recipes-core/images/deploy-ovmf.inc
@@ -11,11 +11,15 @@ 
 # This recipe deploys the OVMF binaries to run the image in QEMU
 # Note: x86 only
 
-IMAGER_INSTALL += "ovmf"
+INSTALL_deploy_ovmf_binaries += "ovmf"
 
+do_deploy_ovmf_binaries[network] += "${TASK_USE_SUDO}"
 do_deploy_ovmf_binaries[cleandirs] += "${DEPLOY_DIR_IMAGE}/OVMF"
+do_deploy_ovmf_binaries[depends] += "${SCHROOT_DEP}"
 do_deploy_ovmf_binaries() {
-    cp -v ${BUILDCHROOT_DIR}/usr/share/OVMF/*.fd ${DEPLOY_DIR_IMAGE}/OVMF
+    imager_run -p -d ${PP_WORK} -- <<'EOIMAGER'
+        cp -v /usr/share/OVMF/*.fd ${PP_DEPLOY}/OVMF/
+EOIMAGER
 }
+addtask deploy_ovmf_binaries before do_image
 
-addtask deploy_ovmf_binaries after do_install_imager_deps before do_image