title: How do I generate a multi-boot Grub EFI WIC image from Yocto
body: <p>I am trying to implement a software update process for a generic x86_64 system using Yocto and SWUpdate. I would like to have two root partitions, with SWUpdate overwriting the inactive one (dual copy strategy). I am trying to create a WIC image to test this in virtualbox (.wic.vdi image)</p>
  
  <p>My problem is in creating the dual rootfs image. So far I have a .wks file:</p>
  
  <pre><code>bootloader --ptable gpt
  part /boot --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/boot --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 --use-uuid
  part / --source rootfs --fstype=ext4 --label image1 --align 1024 --exclude-path boot/
  part / --source rootfs --fstype=ext4 --label image2 --align 1024 --exclude-path boot/
  part swap --ondisk sda --size 1024 --label swap --fstype=swap
  </code></pre>
  
  <p>This creates a wic image with the right partitions, but the bootloader in the first fat partition seems invalid - it does not boot in virtualbox.</p>
  
  <p>If I change the boot partition to</p>
  
  <pre><code>part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024
  </code></pre>
  
  <p>It will now boot, but I don't have control over the data in the boot partition via bbappends files. I need to be able to edit the grub.cfg and add a grub environment file. As far as I can tell the bootimg-efi is created by the WIC system, so I can't override that easily.</p>