OpenSTLinux 6.2 st-split-partitions take too much time
Hello,
I am currently in the process of migrating from OpenSTLinux v6.0.0 to version v6.2.1and I use a new way of partitioning based on image_types-stsplitpartitions.bbclass. A first observation : Splitting partition takes a lot of time.
It seems that stsplitted_partition_create_fs function contains dead code that has a big impact.
As you can see bellow:
- partition_size is set by “du of ${splitted_directory}”
- partition_size is always overwritten in the swich case.
The problem is splitted_directory is never defined (I checked in all meta-st-stm32mp layer) so the “du” uses the current directory which in most cases corresponds to the BUILDDIR and it’s take time for nothing.
stsplitted_partition_create_fs() {
parttition=$1
partition_index=$2
src_splitted_part=$3
label=$(echo ${ST_PARTITIONS_LABELS} | cut -d',' -f${partition_index})
mount_point=$(echo ${ST_PARTITIONS_MOUNTS_POINTS} | cut -d',' -f${partition_index})
size=$(echo ${ST_PARTITIONS_SIZES} | cut -d',' -f${partition_index})
not_supported_fs=$(echo ${ST_PARTITIONS_NOT_SUPPORTED_FS} | cut -d',' -f${partition_index})
image_link_name="${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}.splitted-${label}"
image_name="${image_link_name}${IMAGE_VERSION_SUFFIX}"
bbnote "image_link_name -> \"${image_link_name}\""
bbnote "image_name -> \"${image_name}\""
# calculate size of partition
partition_size=$(du --apparent-size -Pks ${splitted_directory} | cut -f 1)
# add extra space
calculate_size $label $size ${src_splitted_part}
# hack for little partition like bootfs, vendorfs
case $partition in
boot*|vendor*)
diff_size=$(expr $size - $CALCULATED_SIZE)
if [ ${diff_size} -gt 32768 ]; then
if [ $CALCULATED_SIZE -gt 32768 ]; then
partition_size=$CALCULATED_SIZE
else
partition_size=$size
fi
else
partition_size=$size
fi
;;
*)
partition_size=$CALCULATED_SIZE
if [ $CALCULATED_SIZE -lt 16384 ]; then
if [ $size -gt 16384 ]; then
# for to 16MB, if size inferior to 8MB an ext4 fs is seen as ext2
# and if is lower than 16MB we can see some issue with resize2fs
partition_size=16384
fi
fi
;;
esac
A workaround is to define splitted_directory in image recipe like this
splitted_directory = "/dev/null"but this is not very clean.
In the recent OpenSTLinux v7.0.0 is code is still the same.
Could we have a feedback about this ?
Another point: the first parameter of this function is not use too: typo “parttition” instead of “partition” so I suppose the function works using the “partition” variable of the caller IMAGE_CMD:stsplitpartitions () (see https://github.com/STMicroelectronics/meta-st-stm32mp/blob/wrynose/classes/image_types-stsplitpartitions.bbclass#L645 )
Best regards
Thibaut
