Reputation: 108
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
.
The short version of my question is: can I get the /etc/fstab
generated by wic
in the rootfs
for exports other than .wic
?
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
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.
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.
Edit: what I ended up doing was define the list of expected partitions in an environment variable in the distro's base configuration, then I have python()
blocks in my wks and base-files recipe that turn the list into the proper WKS and FSTAB formats. This feels kind of hacky, and doesn't help readability much.
Upvotes: 3
Views: 568
Reputation: 2824
You can disable the modification of /etc/fstab by the wic tool. Additional arguments can be passed by WIC_CREATE_EXTRA_ARGS
. The switch for your case is --no-fstab-update
.
E.g. in your meta-myproject-bsp/conf/machine/mydevice.conf
# List of images to be built
IMAGE_FSTYPES = "tar.gz wic.xz"
# Do not extend the /etc/fstab by mountpoints from *.wks
WIC_CREATE_EXTRA_ARGS = "--no-fstab-update"
Drawback: You have to add your own /etc/fstab and must keep it in sync with your *.wks file
Note also https://bugzilla.yoctoproject.org/show_bug.cgi?id=15509
Upvotes: 0