cancel
Showing results for 
Search instead for 
Did you mean: 

How to clear the default st-image-userfs (remove examples) and populate it with my own files?

mmichala
Associate II

Hello everyone,

I'm developing embedded firmware for stm32mp135f-dk board using Yocto/Bitbake (Kirkstone) with meta-st-stm32mp layer. My question is related to SD card partitions, so please find my flash layout .tsv file below:

#OptIdNameTypeIPOffsetBinary
-0x01fsbl-bootBinarynone0x0arm-trusted-firmware/tf-a-stm32mp135f-dk-usb.stm32
-0x03fip-bootFIPnone0x0fip/fip-stm32mp135f-dk-optee.bin
P0x04fsbl1Binarymmc00x00004400arm-trusted-firmware/tf-a-stm32mp135f-dk-sdcard.stm32
P0x05fsbl2Binarymmc00x00044400arm-trusted-firmware/tf-a-stm32mp135f-dk-sdcard.stm32
P0x06metadata1Binarymmc00x00084400arm-trusted-firmware/metadata.bin
P0x07metadata2Binarymmc00x000C4400arm-trusted-firmware/metadata.bin
P0x08fip-aFIPmmc00x00104400fip/fip-stm32mp135f-dk-optee.bin
PED0x09fip-bFIPmmc00x00504400none
PED0x0Au-boot-envBinarymmc00x00904400none
P0x10bootfs-aSystemmmc00x00984400st-image-bootfs-poky-stm32mp1.ext4
PED0x11bootfs-bSystemmmc00x08984400none
P0x12rootfs-aFileSystemmmc00x10984400custom-image-stm32mp1.ext4
PED0x13rootfs-bFileSystemmmc00x50984400none
P0x14userfsFileSystemmmc00x90984400st-image-userfs-poky-stm32mp1.ext4

I've implemented OTA firmware update mechanism using RAUC, with the help from ST examples on that. My plan was to make rootfs read-only and keep device specific data on userfs, which is not included in firmware update process. I've following questions:

1. How to clear the userfs (remove examples) and populate it with my own files? I read about how bootfs, vendorfs, userfs are included in image here , I get the main concept for walkaround of dependencies there. I've tried making st-image-userfs_%.bbappend and clear PACKAGE_INSTALL variable from there, but Bitbake returns error "no recipes in default available for st-image-userfs_%.bbappend". I stoped on that, because I don't even know if that's the correct approach.

2. Right now, the default st-image-userfs-poky-stm32mp13.ext4 is included in my .tsv but I doesn't get mounted when system starts (I can mount it manually and see the content). I looked through meta-st-stm32mp and found that there is a base-files_%.bbappend in recipes-core, which installs fstab:

# <file system> <mount pt> <type> <options> <dump> <pass>

/dev/root / auto defaults 1 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0

#/dev/mmcblk0p4 /boot ext4 defaults,sync 0 1
#/dev/mmcblk0p5 /vendor ext4 defaults,sync 0 1
#/dev/mmcblk0p7 /usr/local ext4 defaults,sync 0 1

So bootfs, vendorfs, userfs are commented out. Should I write another base-files_%.bbappend to modify that or there is a better way?

BTW my plan was to make rootfs read-only and put there symbolic links to configuration files stored in userfs, so that actual user-defined configuration is stored there. That way it won't change during firmware upgrade. Is that a common approach in embedded devices world?

1 REPLY 1
mmichala
Associate II

I've moved further and decided to post it here, to help others on their way.

The st-image-userfs_%.bbappend filename was invalid, and that's why Bitbake was throwing an error. After changing it to st-image-userfs.bbappend I was able to reset PACKAGE_INSTALL variable. By doing this now I have userfs with only three folders: etc, lost+found, var. So examples are gone.

For /etc/fstab: I added my base-files_%.bbappend to my custom-layer, which has higher priority than meta-st-stm32mp. That's why my base-files_%.bbappend is being taken into consideration (instead of that from meta-st-stm32mp) and my modified fstab is being installed. Userfs gets auto-mounted.

If the way I have done that is invalid, please correct me.

The problem I have faced now, it that I can't add any files there, to userfs. Tried using do_install:append, but it seems to me, that the do_install task is not executed for st-image-userfs. Any ideas how to achive adding files?