... I finally figured it out!
This is how the wks file should be defined:
part /boot --source bootimg-partition --ondisk mmcblk1 --fstype=vfat --label boot_A --active --align 4096 --size 20 --fsoptions "vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro"
part / --source rootfs --ondisk mmcblk1 --fstype=ext4 --label root_A --align 4096 --exclude-path=media/
part --source rootfs --ondisk mmcblk1 --fstype=ext4 --label root_B --align 4096 --exclude-path=media/
part /media --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/media --size=128M --ondisk mmcblk1 --fstype=ext4 --label data --align 4096
part swap --ondisk mmcblk1 --size 44 --label swap --fstype=swap --size=2048M --overhead-factor 1
Notice the fact that:
- The mounted point should be excluded from both the root_A and root_B
- The media partition should be sourced on rootfs
- The media partition needs the --rootfs-dir=${IMAGE_ROOTFS}/media options (otherwise the whole rootfs is copied onto /media
Using this in the original method in the recipe above makes it works as expected (if you add the QA_EMPTY_DIRS:remove = "/media"
Thanks