2024-10-25 02:22 AM - edited 2024-10-25 02:46 AM
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:
#Opt | Id | Name | Type | IP | Offset | Binary |
- | 0x01 | fsbl-boot | Binary | none | 0x0 | arm-trusted-firmware/tf-a-stm32mp135f-dk-usb.stm32 |
- | 0x03 | fip-boot | FIP | none | 0x0 | fip/fip-stm32mp135f-dk-optee.bin |
P | 0x04 | fsbl1 | Binary | mmc0 | 0x00004400 | arm-trusted-firmware/tf-a-stm32mp135f-dk-sdcard.stm32 |
P | 0x05 | fsbl2 | Binary | mmc0 | 0x00044400 | arm-trusted-firmware/tf-a-stm32mp135f-dk-sdcard.stm32 |
P | 0x06 | metadata1 | Binary | mmc0 | 0x00084400 | arm-trusted-firmware/metadata.bin |
P | 0x07 | metadata2 | Binary | mmc0 | 0x000C4400 | arm-trusted-firmware/metadata.bin |
P | 0x08 | fip-a | FIP | mmc0 | 0x00104400 | fip/fip-stm32mp135f-dk-optee.bin |
PED | 0x09 | fip-b | FIP | mmc0 | 0x00504400 | none |
PED | 0x0A | u-boot-env | Binary | mmc0 | 0x00904400 | none |
P | 0x10 | bootfs-a | System | mmc0 | 0x00984400 | st-image-bootfs-poky-stm32mp1.ext4 |
PED | 0x11 | bootfs-b | System | mmc0 | 0x08984400 | none |
P | 0x12 | rootfs-a | FileSystem | mmc0 | 0x10984400 | custom-image-stm32mp1.ext4 |
PED | 0x13 | rootfs-b | FileSystem | mmc0 | 0x50984400 | none |
P | 0x14 | userfs | FileSystem | mmc0 | 0x90984400 | st-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 #/dev/mmcblk0p4 /boot 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?
2024-10-25 05:49 AM - edited 2024-10-25 06:49 AM
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?