Use fstab generated by wic in other FSTYPE used by SWUpdate

40 Views Asked by At

I am trying to implement an update for a system based on yocto using swupdate. The issue is that I actually don't have the same content in the .wic and .tar.gz versions of the image. The first one has the partition table generated from the .wks file, the other has the default one from poky.

Tl;dr

The short version of my question is: can I get the /etc/fstab generated by wic in the rootfs for exports other than .wic?

The configuration

So I have a projet which generates three files as an output

IMAGE_FSTYPES = "wic.bz2 wic.bmap tar.gz"

On top of that I have a my-project-swu recipe that uses the base image to generate a .swu file

IMAGE_DEPENDS = "my-project-full"
SWUPDATE_IMAGES = " \
    my-project-full \
"
SWUPDATE_IMAGES_FSTYPES[my-project-full] = ".tar.gz"

And the wic files are generated from the following wks configuration

part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 --size=1G
part --ondisk mmcblk0 --label alt_rootfs --align 4096  --size=1G
part /data       --size 1G --ondisk mmcblk0 --fstype=ext4 --label data --align 4096

The issue

When I first deploy my image using bmaptool the /etc/fstab file contains the following content

/dev/root            /                    auto       defaults              1  1
# Some default values here ...

/dev/mmcblk0p1  /boot   vfat    defaults        0       0
/dev/mmcblk0p4  /data   ext4    defaults        0       0

This includes the /boot partition that contains the u-boot environment used by SWUpdate as well as a data partition.

But then after a succesful update the file contains :

/dev/root            /                    auto       defaults              1  1
# Some default values here ...

So now /boot is missing, so trying to signal to u-boot that booting was successful doesn't work, and the /data partition isn't available either. Right now I could copy the file from one root to the next after the update, but that only works while I have a writeable root, which probably won't always be the case.

If I look in the build directory I do see the two files ./tmp-glibc/work/raspberrypi3_64-oe-linux/my-project-full/1.0-r0/build-wic/fstab has the complete version, and ./tmp-glibc/work/raspberrypi3_64-oe-linux/my-project-full/1.0-r0/rootfs/etc/fstab has the default one. To my understanding this is to be expected because wic is only executed automatically for the .wic output, so that adding or removing the .wic output doesn't affect unrelated outputs.

Possible solutions?

The simplest solution to that issue is to replace the default fstab file by an hardcoded one, but this means that the information has to stay consistent between the wks and fstab ones, I'd rather just use the file generated by wic as the basis for the .swu file.

One other solution would be to use directly the .wic file as an input for my update. While I guess this is possible this doesn't look like a standard thing to do, nor the proper way.

So ideally I'd rather have the fstab I get in the .wic directly in the rootfs, so that no matter which format is used for the export, the partitions are used consistently, but I don't understand how I'd be able to do that.

0

There are 0 best solutions below