MACHINE: set partition configuration specific to fstype

- Allow specific partition image configuration between 'ext4' and 'ubifs'.
 - In case ubifs created is larger than max-leb-cnt allocated, mkfs.ubi raise
an error that make bitbake exit on error: add test to avoid this unexpected exit.

Change-Id: Ib386e703cfb1d0434ea17c279abb31f705514019
Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
This commit is contained in:
Lionel VITTE 2021-11-16 11:38:03 +01:00
parent 5245abf2c7
commit 5df595134e
7 changed files with 404 additions and 326 deletions

View File

@ -169,36 +169,34 @@ python __anonymous () {
initramfs = d.getVar('INITRAMFS_IMAGE') or ""
# Init INITRD image if any
initrd = d.getVar('INITRD_IMAGE_ALL') or d.getVar('INITRD_IMAGE') or ""
# Init partition list from PARTITIONS_CONFIG
# Init partition list from PARTITIONS_IMAGES
image_partitions = []
# Append image_partitions list with all configured partition images:
partitionsconfigflags = d.getVarFlags('PARTITIONS_CONFIG')
partitionsconfigflags = d.getVarFlags('PARTITIONS_IMAGES')
# The "doc" varflag is special, we don't want to see it here
partitionsconfigflags.pop('doc', None)
partitionsconfig = (d.getVar('PARTITIONS_CONFIG') or "").split()
partitionsconfig = (d.getVar('PARTITIONS_IMAGES') or "").split()
if len(partitionsconfig) > 0:
for config in partitionsconfig:
for f, v in partitionsconfigflags.items():
if config == f:
items = v.split(',')
# Make sure about PARTITIONS_CONFIG contents
if items[0] and len(items) > 5:
bb.fatal('[PARTITIONS_CONFIG] Only image,label,mountpoint,size,type can be specified!')
# Make sure about PARTITIONS_IMAGES contents
if len(items) > 0 and len(items) != 5:
bb.fatal('[PARTITIONS_IMAGES] Only image,label,mountpoint,size,type can be specified!')
# Make sure that we're dealing with partition image and not rootfs image
if len(items) > 2 and items[2]:
if items[2] != '':
# Mount point is available, so we're dealing with partition image
# Append image to image_partitions list
image_partitions.append(d.expand(items[0]))
break
# We need to clearly identify ROOTFS build, not InitRAMFS/initRD one (if any), not partition one either
if current_image_name not in image_partitions and current_image_name != initramfs and current_image_name not in initrd:
# We add the flashlayout file creation task just after the do_image_complete for ROOTFS build
bb.build.addtask('do_create_flashlayout_config', 'do_build', 'do_image_complete', d)
# We add also the function that feeds the FLASHLAYOUT_PARTITION_* vars from PARTITIONS_CONFIG
# We add also the function that feeds the FLASHLAYOUT_PARTITION_* vars
d.appendVarFlag('do_create_flashlayout_config', 'prefuncs', ' flashlayout_partition_config')
d.appendVarFlag('do_create_flashlayout_config', 'prefuncs', ' flashlayout_partition_image_config')
}
def expand_var(var, bootscheme, config, partition, d):
@ -342,9 +340,10 @@ def get_offset(new_offset, copy, current_device, bootscheme, config, partition,
device_alias = d.getVar('DEVICE_%s' % current_device) or ""
# Set offset
offset = expand_var('FLASHLAYOUT_PARTITION_OFFSET', bootscheme, config, partition, d)
bb.debug(1, '>>> Selected FLASHLAYOUT_PARTITION_OFFSET: %s' % offset)
# Set max offset
max_offset = d.getVar('DEVICE_MAX_OFFSET_%s' % device_alias) or "none"
bb.debug(1, '>>> Selected FLASHLAYOUT_PARTITION_OFFSET: %s' % offset)
bb.debug(1, '>>> Selected DEVICE_MAX_OFFSET: %s' % max_offset)
if offset == 'none':
if new_offset == 'none':
bb.debug(1, '>>> No %s partition offset configured (%s device) for %s label for %s bootscheme, so default to default origin device one.' % (partition, current_device, config, bootscheme))
@ -570,17 +569,6 @@ python do_create_flashlayout_config() {
partition_prevdevice = partition_device
# Get partition offset
partition_offset, partition_nextoffset, partition_maxoffset = get_offset(partition_nextoffset, partition_copy, partition_device, bootscheme, config, partition, d)
# Check if the size will exceed the mass storage
if partition_maxoffset != "none" :
bb.warn('>>> Cannot generate tsv for %s %s %s %s. The partition end offset %s is higher than max offset %s.' % (partition_device, bootscheme, config, partition, partition_nextoffset, partition_maxoffset))
# No need to create/keep the tsv because flashlayout indicates the
# computed size exceeds the size of the device. So delete the tsv
fl_file.close()
if os.path.exists(flashlayout_file):
os.remove(flashlayout_file)
break
# Get binary name
partition_bin2load = get_binaryname(labeltype, partition_device, bootscheme, config, partition, d)
# Be verbose in log file
@ -593,12 +581,38 @@ python do_create_flashlayout_config() {
bb.debug(1, '>>> FLASHLAYOUT_PARTITION_OFFSET: %s' % partition_offset)
bb.debug(1, '>>> FLASHLAYOUT_PARTITION_BIN2LOAD: %s' % partition_bin2load)
bb.debug(1, '>>> done')
# Make sure binary is available in DEPLOY_DIR_IMAGE folder
# Check if the size will exceed the mass storage
if partition_maxoffset != "none" :
bb.warn('>>> Cannot generate %s file: the end offset (%s) for %s partition exceeds the max offset (%s) for %s device.' % (os.path.basename(flashlayout_file), partition_nextoffset, partition, partition_maxoffset, partition_device))
# Cleanup on-going tsv file
fl_file.close()
if os.path.exists(flashlayout_file):
os.remove(flashlayout_file)
break
# Check if binary is available in deploy folder
if partition_bin2load != 'none':
if not os.path.isfile(os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), partition_bin2load)):
# Specific exception for rootfs binary (not yet deployed)
if not os.path.isfile(os.path.join(d.getVar('IMGDEPLOYDIR'), partition_bin2load)):
bb.fatal('Missing %s binary file in deploy folder' % partition_bin2load)
bin2load_fullpath = os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), partition_bin2load)
if not os.path.isfile(bin2load_fullpath):
# Specific case for rootfs binary (not yet deployed)
bin2load_fullpath = os.path.join(d.getVar('IMGDEPLOYDIR'), partition_bin2load)
if not os.path.isfile(bin2load_fullpath):
bb.warn('>>> Cannot generate %s file: the %s binary for %s partition is missing in deploy folder' % (os.path.basename(flashlayout_file), partition_bin2load, partition))
# Cleanup on-going tsv file
fl_file.close()
if os.path.exists(flashlayout_file):
os.remove(flashlayout_file)
break
# Check if the bin2load size will exceed the partition size
if partition_nextoffset != 'none':
bin2load_size = os.path.getsize(bin2load_fullpath)
partition_size = int(partition_nextoffset, 16) - int(partition_offset, 16)
if bin2load_size > partition_size:
bb.warn('>>> Cannot generate %s file: the %s binary size (%s) for %s partition exceeds the partition size (%s).' % (os.path.basename(flashlayout_file), partition_bin2load, bin2load_size, partition, partition_size))
# Cleanup on-going tsv file
fl_file.close()
if os.path.exists(flashlayout_file):
os.remove(flashlayout_file)
break
# Get the supported labels for current storage device
partition_device_alias = d.getVar('DEVICE_%s' % partition_device) or ""
partition_type_supported_labels = d.getVar('DEVICE_BOARD_ENABLE_%s' % partition_device_alias) or "none"
@ -665,18 +679,40 @@ python do_create_flashlayout_config_setscene () {
}
addtask do_create_flashlayout_config_setscene
def partImage2partConfig(config, fstype, d):
"""
Convert PARTTIONS_IMAGES['config'] setting format to format expected to feed
PARTITIONS_CONFIG[xxx].
Manage <image_name> update respect to 'fstype' provided and apply the rootfs
namming or standard partition image one.
FROM: <image_name>,<partition_label>,<mountpoint>,<size>,<type>
TO : <binary_name>,<partition_label>,<size>,<type>
"""
items = d.getVarFlag('PARTITIONS_IMAGES', config).split(',') or ""
if len(items) != 5:
bb.fatal('Wrong settings for PARTTIONS_IMAGES[%s] : %s' % (config, items))
if items[2] != '':
bin_name = items[0] + '-${DISTRO}-${MACHINE}' + '.' + fstype
else:
bin_name = items[0] + '-${MACHINE}' + '.' + fstype
# Set string for PARTITIONS_CONFIG item: <binary_name>,<partlabel>,<size>,<type>
part_format = bin_name + ',' + items[1] + ',' + items[3] + ',' + items[4]
return part_format
python flashlayout_partition_config() {
"""
Set the different flashlayout partition vars for the configure partition
images.
Based on both PARTITIONS_BOOTLOADER_CONFIG and PARTITIONS_OPTEE_CONFIG feed:
FLASHLAYOUT_PARTITION_ENABLE_<config>_
FLASHLAYOUT_PARTITION_SIZE_<config>_
FLASHLAYOUT_PARTITION_COPY_<config>_
FLASHLAYOUT_PARTITION_TYPE_<config>_
Based on PARTITIONS_CONFIG, PARTITIONS_BOOTLOADER_CONFIG and PARTITIONS_OPTEE_CONFIG
feed FLASHLAYOUT_PARTITION_ vars for each 'config' and 'label':
FLASHLAYOUT_PARTITION_ENABLE_<config>_<label>
FLASHLAYOUT_PARTITION_BIN2LOAD_<config>_<label>
FLASHLAYOUT_PARTITION_SIZE_<config>_<label>
FLASHLAYOUT_PARTITION_TYPE_<config>_<label>
FLASHLAYOUT_PARTITION_COPY_<config>_<label>
"""
# Init partition and flashlayout configuration vars
partitionconfig_list = 'PARTITIONS_BOOTLOADER_CONFIG PARTITIONS_OPTEE_CONFIG'
partitionconfig_list = 'PARTITIONS_CONFIG PARTITIONS_BOOTLOADER_CONFIG PARTITIONS_OPTEE_CONFIG'
for partconfvar in partitionconfig_list.split():
partitionsconfigflags = d.getVarFlags(partconfvar)
@ -696,14 +732,16 @@ python flashlayout_partition_config() {
bb.debug(1, '[%s] *** Loop for %s config with setting: %s' % (partconfvar, config, subconfigs))
items = subconfigs.split(',')
# Check for proper content
if items[0] and len(items) > 5:
if len(items) < 4 or len(items) > 5:
bb.fatal('[%s] Only partdata,partlabel,size,type,copy can be specified!' % partconfvar)
# Init flashlayout label
if items[1] and items[1] != '':
if items[1] != '':
fl_label = d.expand(items[1])
bb.debug(1, "Init for flashlayout label to: %s" % fl_label)
else:
bb.fatal('[%s] Missing partlabel setting' % partconfvar)
# Feed FLASHLAYOUT_PARTITION_* vars
if d.getVar('FLASHLAYOUT_PARTITION_ENABLE_%s_%s' % (config, fl_label)):
bb.debug(1, "FLASHLAYOUT_PARTITION_ENABLE_%s_%s is already set to: %s." % (config, fl_label, d.getVar('FLASHLAYOUT_PARTITION_ENABLE_%s_%s' % (config, fl_label))))
@ -718,15 +756,15 @@ python flashlayout_partition_config() {
d.setVar('FLASHLAYOUT_PARTITION_BIN2LOAD_%s_%s' % (config, fl_label), items[0])
else:
bb.debug(1, "No partdata setting for %s label : default setting would applied..." % fl_label)
if items[2] and items[2] != '':
if items[2] != '':
if d.getVar('FLASHLAYOUT_PARTITION_SIZE_%s_%s' % (config, fl_label)):
bb.debug(1, "FLASHLAYOUT_PARTITION_SIZE_%s_%s is already set to: %s." % (config, fl_label, d.getVar('FLASHLAYOUT_PARTITION_SIZE_%s_%s' % (config, fl_label))))
else:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_SIZE_%s_%s to %s." % (config, fl_label, items[2]))
d.setVar('FLASHLAYOUT_PARTITION_SIZE_%s_%s' % (config, fl_label), items[2])
else:
bb.fatal('[%s] Missing size setting for % label' % (partconfvar, fl_label))
if items[3] and items[3] != '':
bb.debug(1, "No size setting for %s label : default setting would applied..." % fl_label)
if items[3] != '':
if d.getVar('FLASHLAYOUT_PARTITION_TYPE_%s_%s' % (config, fl_label)):
bb.debug(1, "FLASHLAYOUT_PARTITION_TYPE_%s_%s is already set to: %s." % (config, fl_label, d.getVar('FLASHLAYOUT_PARTITION_TYPE_%s_%s' % (config, fl_label))))
else:
@ -734,73 +772,18 @@ python flashlayout_partition_config() {
d.setVar('FLASHLAYOUT_PARTITION_TYPE_%s_%s' % (config, fl_label), items[3])
else:
bb.debug(1, "No PARTITION_TYPE setting for %s label: default setting would applied..." % fl_label)
if items[4] and items[4] != '':
if len(items) == 4:
bb.debug(1, "No PARTITION_COPY setting for %s label : default setting would applied..." % fl_label)
elif items[4] != '':
if d.getVar('FLASHLAYOUT_PARTITION_COPY_%s_%s' % (config, fl_label)):
bb.debug(1, "FLASHLAYOUT_PARTITION_COPY_%s_%s is already set to: %s." % (config, fl_label, d.getVar('FLASHLAYOUT_PARTITION_COPY_%s_%s' % (config, fl_label))))
else:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_COPY_%s_%s to %s." % (config, fl_label, items[4]))
d.setVar('FLASHLAYOUT_PARTITION_COPY_%s_%s' % (config, fl_label), items[4])
else:
bb.debug(1, "No PARTITION_COPY setting for % label : default setting would applied..." % fl_label)
bb.debug(1, "No PARTITION_COPY setting for %s label : default setting would applied..." % fl_label)
break
}
python flashlayout_partition_image_config() {
"""
Set the different flashlayout partition vars for the configure partition
images.
Based on PARTITIONS_CONFIG, feed:
FLASHLAYOUT_PARTITION_IMAGES
FLASHLAYOUT_PARTITION_ENABLE_
FLASHLAYOUT_PARTITION_SIZE_
FLASHLAYOUT_PARTITION_BIN2LOAD_
FLASHLAYOUT_PARTITION_TYPE_
"""
partitionsconfigflags = d.getVarFlags('PARTITIONS_CONFIG')
# The "doc" varflag is special, we don't want to see it here
partitionsconfigflags.pop('doc', None)
partitionsconfig = (d.getVar('PARTITIONS_CONFIG') or "").split()
partitionssuffix = (d.getVar('PARTITION_SUFFIX') or ".ext4")
if len(partitionsconfig) > 0:
for config in partitionsconfig:
for f, v in partitionsconfigflags.items():
if config == f:
items = v.split(',')
# Make sure about PARTITIONS_CONFIG contents
if items[0] and len(items) > 5:
bb.fatal('[PARTITIONS_CONFIG] Only image,label,mountpoint,size,type can be specified!')
# Check for proper configuration
if items[0] == '':
bb.fatal('[PARTITIONS_CONFIG] Missing image setting')
if items[1]:
bb.debug(1, "Appending %s to FLASHLAYOUT_PARTITION_IMAGES." % items[1])
d.appendVar('FLASHLAYOUT_PARTITION_IMAGES', ' ' + items[1])
else:
bb.fatal('[PARTITIONS_CONFIG] Missing image label setting')
# Init flashlayout label
fl_label = d.expand(items[1])
bb.debug(1, "Set FLASHLAYOUT_PARTITION_ENABLE_%s to 'P'." % fl_label)
d.setVar('FLASHLAYOUT_PARTITION_ENABLE_%s' % fl_label, 'P')
if items[2] == '':
# There is no mountpoint specified, so we apply rootfs image format
bb.debug(1, "Set FLASHLAYOUT_PARTITION_BIN2LOAD_%s to %s." % (fl_label, items[0] + "-${MACHINE}"+partitionssuffix))
d.setVar('FLASHLAYOUT_PARTITION_BIN2LOAD_%s' % fl_label, items[0] + "-${MACHINE}"+partitionssuffix)
else:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_BIN2LOAD_%s to %s." % (fl_label, items[0] + "-${DISTRO}-${MACHINE}"+partitionssuffix))
d.setVar('FLASHLAYOUT_PARTITION_BIN2LOAD_%s' % fl_label, items[0] + "-${DISTRO}-${MACHINE}"+partitionssuffix)
if items[3]:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_SIZE_%s to %s." % (fl_label, items[3]))
d.setVar('FLASHLAYOUT_PARTITION_SIZE_%s' % fl_label, items[3])
else:
bb.fatal('[PARTITIONS_CONFIG] Missing PARTITION_SIZE setting for %s label' % fl_label)
if items[4]:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_TYPE_%s to %s." % (fl_label, items[4]))
d.setVar('FLASHLAYOUT_PARTITION_TYPE_%s' % fl_label, items[4])
else:
bb.fatal('[PARTITIONS_CONFIG] Missing PARTITION_TYPE setting for % label' % fl_label)
break
}
# -----------------------------------------------------------------------------
# Manage specific var dependency:

View File

@ -6,13 +6,23 @@ do_image_stmultiubi[depends] += " \
"
python stmultiub_environment () {
if d.getVar('MULTIUBI_BUILD'):
# Get the MULTIUBI_BUILD list without any duplicates
ubiconfigs = list(dict.fromkeys((d.getVar('MULTIUBI_BUILD') or "").split()))
if ubiconfigs:
try:
f =open( ("%s/stmultiubi_environment" % d.getVar('T')), 'w')
for build in d.getVar('MULTIUBI_BUILD').split():
f.write( "export MKUBIFS_ARGS_%s=\"%s\"\n" % (build, d.getVar(('MKUBIFS_ARGS_' + build))) )
f.write( "export UBINIZE_ARGS_%s=\"%s\"\n" % (build, d.getVar(('UBINIZE_ARGS_' + build))) )
f.write( "export EXTRA_UBIFS_SIZE_%s=\"%s\"\n" % (build, d.getVar(('EXTRA_UBIFS_SIZE_' + build))) )
for build in ubiconfigs:
# Append 'build' to OVERRIDES
localdata = bb.data.createCopy(d)
overrides = localdata.getVar('OVERRIDES')
if not overrides:
bb.fatal('OVERRIDES not defined')
localdata.setVar('OVERRIDES', build + ':' + overrides)
# Compute export vars
f.write( "export MKUBIFS_ARGS_%s=\"%s\"\n" % (build, localdata.getVar('MKUBIFS_ARGS')) )
f.write( "export UBINIZE_ARGS_%s=\"%s\"\n" % (build, localdata.getVar('UBINIZE_ARGS')) )
f.write( "export EXTRA_UBIFS_SIZE_%s=\"%s\"\n" % (build, localdata.getVar('EXTRA_UBIFS_SIZE')) )
f.write( "export STM32MP_UBI_VOLUME_%s=\"%s\"\n" % (build, localdata.getVar('STM32MP_UBI_VOLUME')) )
f.close()
except:
pass
@ -25,18 +35,18 @@ IMAGE_CMD_stmultiubi () {
# Split MKUBIFS_ARGS_<name> and UBINIZE_ARGS_<name>
for name in ${MULTIUBI_BUILD}; do
bbnote "Process multiubi for ${name}"
eval local mkubifs_args=\"\$MKUBIFS_ARGS_${name}\"
eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\"
multiubi_mkfs "${mkubifs_args}" "${ubinize_args}" "${name}"
cd ${IMGDEPLOYDIR}
if [ -e ubinize_${name}-${IMAGE_NAME}.cfg ]; then
# Set correct name for cfg file to allow automatic cleanup
mv ubinize_${name}-${IMAGE_NAME}.cfg ${IMAGE_NAME}_${name}.ubinize.cfg.ubi
# Create symlinks
ln -sf ${IMAGE_NAME}_${name}.ubinize.cfg.ubi ${IMAGE_LINK_NAME}_${name}.ubinize.cfg.ubi
if multiubi_mkfs "${mkubifs_args}" "${ubinize_args}" "${name}"; then
if [ -e ${IMGDEPLOYDIR}/ubinize_${name}-${IMAGE_NAME}.cfg ]; then
# Set correct name for cfg file to allow automatic cleanup
mv ${IMGDEPLOYDIR}/ubinize_${name}-${IMAGE_NAME}.cfg ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}.ubinize.cfg.ubi
# Create symlinks
(cd ${IMGDEPLOYDIR} && ln -sf ${IMAGE_NAME}_${name}.ubinize.cfg.ubi ${IMAGE_LINK_NAME}_${name}.ubinize.cfg.ubi)
fi
fi
cd -
done
}
@ -58,101 +68,125 @@ st_multivolume_ubifs() {
if [ "${ENABLE_MULTIVOLUME_UBI}" != "1" ]; then
return
fi
if [ -n "${STM32MP_UBI_VOLUME}" ]; then
. ${T}/stmultiubi_environment
# Get total volume number to handle
volume_nbr="$(echo ${STM32MP_UBI_VOLUME} | wc -w)"
. ${T}/stmultiubi_environment
for name in ${MULTIUBI_BUILD}; do
# Init extra_size for UBIFS volume size
eval local extra_size=\"\$EXTRA_UBIFS_SIZE_${name}\"
# Init var to populate 'vol_id' incrementally
volume_id=0
for ubivolume in ${STM32MP_UBI_VOLUME}; do
# Init UBI volume information
if [ -z "$(echo ${ubivolume} | grep ':')" ]; then
bbfatal "Missing ':' separator between UBI volume name and UBI volume size '${ubivolume}'"
fi
volume_name=$(echo ${ubivolume} | cut -d':' -f1)
volume_size=$(echo ${ubivolume} | cut -d':' -f2)
volume_type=$(echo ${ubivolume} | cut -d':' -f3)
bbnote "Original UBI volume size: ${volume_size}"
# Manage specific UBI volume type
if [ "${volume_type}" = "empty" ]; then
bbnote "The UBI volume type is set to 'empty' for ${volume_name}. Generate ubinize cfg file for empty UBI volume."
cfg_filename=${IMGDEPLOYDIR}/${volume_name}_${name}.ubinize.cfg.ubi
echo \[${volume_name}\] > ${cfg_filename}
echo mode=ubi >> ${cfg_filename}
echo vol_id=0 >> ${cfg_filename}
echo vol_type=dynamic >> ${cfg_filename}
echo vol_name=${volume_name} >> ${cfg_filename}
echo vol_flags=autoresize >> ${cfg_filename}
for name in ${MULTIUBI_BUILD}; do
bbnote "Process multivolume UBI for configuration: ${name}"
# Init stm32mp_ubi_volume for UBIFS multivolume build
eval local stm32mp_ubi_volume=\"\$STM32MP_UBI_VOLUME_${name}\"
bbnote "Volume list to parse: ${stm32mp_ubi_volume}"
# Init extra_size for UBIFS volume size
eval local extra_size=\"\$EXTRA_UBIFS_SIZE_${name}\"
# Init var to populate 'vol_id' incrementally
volume_id=0
# Init total volume number to handle
volume_nbr="$(echo ${stm32mp_ubi_volume} | wc -w)"
for ubivolume in ${stm32mp_ubi_volume}; do
# Init UBI volume information
volume_name=$(echo ${ubivolume} | cut -d':' -f1)
volume_size=$(echo ${ubivolume} | cut -d':' -f2)
volume_type=$(echo ${ubivolume} | cut -d':' -f3)
bbnote "Process UBI volume: ${ubivolume}"
bbnote "Original name: ${volume_name}"
bbnote "Original size: ${volume_size}"
bbnote "Original type: ${volume_type}"
# Manage no UBI volume type
if [ -z "${volume_type}" ]; then
bbnote "The UBI volume type is not set:"
bbnote ">>> Apply image link name scheme to UBIFS volume name"
if [ "${volume_name}" = "${IMAGE_BASENAME}" ]; then
volume_name=${IMAGE_LINK_NAME}
else
# Update volume_name to fit image link name scheme
if [ "${volume_name}" = "${IMAGE_BASENAME}" ]; then
volume_name=${IMAGE_LINK_NAME}
else
# Partiton images use case, so make sure to append DISTRO and MACHINE
volume_name=${volume_name}-${DISTRO}-${MACHINE}
fi
if [ -z "${volume_type}" ]; then
bbnote "The UBI volume type is not set. Use default configuration for ${volume_name}"
bbnote "Append ${extra_size}KiB extra space to UBIFS volume size"
volume_size=$(echo "${volume_size} + ${extra_size}" | bc)
else
bbwarn "The UBI volume type '${volume_type}' is not recognized. No specific action done for ${volume_name}"
fi
# Partiton images use case: append DISTRO and MACHINE
volume_name=${volume_name}-${DISTRO}-${MACHINE}
fi
bbnote "Computed UBI volume size: ${volume_size}"
# Set ubinize config file for current volume
if [ -e ${IMGDEPLOYDIR}/${volume_name}_${name}.ubinize.cfg.ubi ]; then
ubinize_cfg=${IMGDEPLOYDIR}/${volume_name}_${name}.ubinize.cfg.ubi
elif [ -e ${DEPLOY_DIR_IMAGE}/${volume_name}_${name}.ubinize.cfg.ubi ]; then
ubinize_cfg=${DEPLOY_DIR_IMAGE}/${volume_name}_${name}.ubinize.cfg.ubi
else
bbfatal "Can't find any '${volume_name}_${name}.ubinize.cfg.ubi' config file from ${IMGDEPLOYDIR} or ${DEPLOY_DIR_IMAGE} folders"
fi
# Create temporary copy of ubinize config file for update
cp ${ubinize_cfg} ${WORKDIR}/
# Update ubifs path in cfg file with DEPLOY_DIR_IMAGE to avoid issue with RM_WORK feature
if [ -e ${DEPLOY_DIR_IMAGE}/${volume_name}_${name}.ubinize.cfg.ubi ]; then
sed 's|^image=.*/\('"${volume_name}"'.*\.ubifs\)$|image='"${DEPLOY_DIR_IMAGE}"'/\1|' -i ${WORKDIR}/$(basename ${ubinize_cfg})
fi
# Update generic name in cfg file
sed 's|\[ubifs\]|\['"${volume_name}"'\]|' -i ${WORKDIR}/$(basename ${ubinize_cfg})
# Update volume id in cfg file
sed 's|vol_id=0|vol_id='"${volume_id}"'|' -i ${WORKDIR}/$(basename ${ubinize_cfg})
volume_id=$(expr ${volume_id} + 1)
# Replace 'vol_flags' entry with 'vol_size' one in cfg file except for last volume to allow proper autoresize
if [ "${volume_id}" -lt "${volume_nbr}" ]; then
sed 's|vol_flags=.*|vol_size='"${volume_size}KiB"'|' -i ${WORKDIR}/$(basename ${ubinize_cfg})
fi
# Increment volume id for next loop
# Append ubinize config file to multivolume one
cat ${WORKDIR}/$(basename ${ubinize_cfg}) >> ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi
# Clean temporary file
rm -f ${WORKDIR}/$(basename ${ubinize_cfg})
# Clean also temporary ubinize cfg file for empty UBI volume
[ "${volume_type}" = "empty" ] && rm -f ${cfg_filename}
done
# Generate multivolume UBI
eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\"
ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi
# Create own symlinks for 'named' volumes
cd ${IMGDEPLOYDIR}
if [ -e ${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ]; then
ln -sf ${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ${IMAGE_LINK_NAME}_${name}_multivolume.ubi
ln -sf ${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi ${IMAGE_LINK_NAME}_${name}_multivolume.ubinize.cfg.ubi
bbnote ">>> Updated UBI volume name: ${volume_name}"
bbnote ">>> Append ${extra_size}KiB extra space to UBIFS volume size"
volume_size=$(echo "${volume_size} + ${extra_size}" | bc)
bbnote ">>> Updated UBI volume size: ${volume_size}"
fi
cd -
# Cleanup also DEPLOY_DIR_IMAGE from any other ubi artifacts
# This avoid duplicating data in DEPLOY_DIR_IMAGE
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}-*_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}-*_${name}_multivolume.ubinize.cfg.ubi
# Init ubinize config file name
ubinize_cfg="${volume_name}_${name}.ubinize.cfg.ubi"
# Create temporary copy of ubinize config file to manage multivolume update
if [ "${volume_type}" = "empty" ]; then
bbnote "The UBI volume type is set to 'empty': generate temporary ubinize cfg file for empty UBI volume."
echo \[${volume_name}\] > ${WORKDIR}/${ubinize_cfg}
echo mode=ubi >> ${WORKDIR}/${ubinize_cfg}
echo vol_id=0 >> ${WORKDIR}/${ubinize_cfg}
echo vol_type=dynamic >> ${WORKDIR}/${ubinize_cfg}
echo vol_name=${volume_name} >> ${WORKDIR}/${ubinize_cfg}
echo vol_flags=autoresize >> ${WORKDIR}/${ubinize_cfg}
elif [ -e ${IMGDEPLOYDIR}/${ubinize_cfg} ]; then
cp ${IMGDEPLOYDIR}/${ubinize_cfg} ${WORKDIR}/${ubinize_cfg}
elif [ -e ${DEPLOY_DIR_IMAGE}/${ubinize_cfg} ]; then
cp ${DEPLOY_DIR_IMAGE}/${ubinize_cfg} ${WORKDIR}/${ubinize_cfg}
else
bbnote "Can't find any '${ubinize_cfg}' config file from ${IMGDEPLOYDIR} or ${DEPLOY_DIR_IMAGE} folders"
exit
fi
# Update generic name in cfg file
sed 's|\[ubifs\]|\['"${volume_name}"'\]|' -i ${WORKDIR}/${ubinize_cfg}
# Update volume id in cfg file
sed 's|vol_id=0|vol_id='"${volume_id}"'|' -i ${WORKDIR}/${ubinize_cfg}
# Increment volume id for next loop
volume_id=$(expr ${volume_id} + 1)
# Replace 'vol_flags' entry with 'vol_size' one in cfg file except for last volume to allow proper autoresize
if [ "${volume_id}" -lt "${volume_nbr}" ]; then
sed 's|vol_flags=.*|vol_size='"${volume_size}KiB"'|' -i ${WORKDIR}/${ubinize_cfg}
fi
# Update ubifs path in cfg file with DEPLOY_DIR_IMAGE to avoid issue with RM_WORK feature
if [ -e ${DEPLOY_DIR_IMAGE}/${ubinize_cfg} ]; then
sed 's|^image=.*/\('"${volume_name}"'.*\.ubifs\)$|image='"${DEPLOY_DIR_IMAGE}"'/\1|' -i ${WORKDIR}/${ubinize_cfg}
fi
# Check for image size
if grep -q '^image=' ${WORKDIR}/${ubinize_cfg}; then
image_path=$(grep '^image=' ${WORKDIR}/${ubinize_cfg} | sed 's/^image=//')
image_size=$(du -ks ${image_path} | awk -F' ' '{print $1}')
if [ "${image_size}" -gt "${volume_size}" ]; then
bbnote "The UBI image size exeeds the volume size: ${image_size} versus ${volume_size}"
# Set specific input log when image size exceeds volume_size set
sed 's|\(\['"${volume_name}"'\]\)$|\1img_oversize_vol\['"${image_size}"'KiB\]\['"${volume_size}"'KiB\]|' -i ${WORKDIR}/${ubinize_cfg}
fi
fi
# Append ubinize config file to multivolume one
cat ${WORKDIR}/${ubinize_cfg} >> ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi
# Clean temporary file
rm -f ${WORKDIR}/${ubinize_cfg}
done
fi
# Check if multivolume UBI can be generated
if grep -q '\]img_oversize_vol\[' "${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi"; then
display_log=$(grep '\]img_oversize_vol\[' "${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi" | sed 's/img_oversize_vol//g')
bbnote "Skip multivolume UBI creation for ${IMAGE_LINK_NAME}_${name} ([volume name][image_size][volume_size set]):\n${display_log}"
continue
fi
# Generate multivolume UBI
eval local ubinize_args=\"\$UBINIZE_ARGS_${name}\"
bbnote "ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi"
ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ${ubinize_args} ${IMGDEPLOYDIR}/${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi
# Create own symlinks for 'named' volumes
cd ${IMGDEPLOYDIR}
if [ -e ${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ]; then
ln -sf ${IMAGE_NAME}_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi ${IMAGE_LINK_NAME}_${name}_multivolume.ubi
ln -sf ${IMAGE_NAME}_${name}_multivolume.ubinize.cfg.ubi ${IMAGE_LINK_NAME}_${name}_multivolume.ubinize.cfg.ubi
fi
cd -
# Cleanup also DEPLOY_DIR_IMAGE from any other ubi artifacts
# This avoid duplicating data in DEPLOY_DIR_IMAGE
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}-*_${name}_multivolume${IMAGE_NAME_SUFFIX}.ubi
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}-*_${name}_multivolume.ubinize.cfg.ubi
done
}
# -----------------------------------------------------------------------------
# Manage specific var dependency:
# Because of local overrides within st_multivolume_ubifs() function, we
# need to make sure to add each variables to the vardeps list.
MULTIUBI_LABELS_VARS = "MKUBIFS_ARGS UBINIZE_ARGS EXTRA_UBIFS_SIZE STM32MP_UBI_VOLUME"
MULTIUBI_LABELS_OVERRIDES = "${MULTIUBI_BUILD}"
stmultiub_environment[vardeps] += "${@' '.join(['%s_%s' % (v, o) for v in d.getVar('MULTIUBI_LABELS_VARS').split() for o in d.getVar('MULTIUBI_LABELS_OVERRIDES').split()])}"

View File

@ -8,11 +8,12 @@
# in an image recipe (for example)
#
ENABLE_PARTITIONS_IMAGE ?= "1"
ENABLE_PARTITIONS_IMAGE ??= "1"
ENABLE_IMAGE_LICENSE_SUMMARY ??= "0"
ENABLE_MULTIVOLUME_UBI ??= "0"
PARTITIONS_CONFIG ??= ""
PARTITIONS_IMAGE ??= ""
PARTITIONS_MOUNTPOINT ??= ""
python __anonymous () {
# We check first if it is requested to generate any partition images
@ -23,68 +24,66 @@ python __anonymous () {
# -----------------------------------------------------------------------------
# Update the partition configuration set by user
# -----------------------------------------------------------------------------
partitionsconfigflags = d.getVarFlags('PARTITIONS_CONFIG')
# The "doc" varflag is special, we don't want to see it here
partitionsconfigflags.pop('doc', None)
partitionsconfig = (d.getVar('PARTITIONS_CONFIG') or "").split()
# Init partition list from PARTITIONS_IMAGES
image_partitions = []
# Init image_summary_list
image_summary_list = ''
partitionsconfigflags = d.getVarFlags('PARTITIONS_IMAGES')
# The "doc" varflag is special, we don't want to see it here
partitionsconfigflags.pop('doc', None)
partitionsconfig = (d.getVar('PARTITIONS_IMAGES') or "").split()
if len(partitionsconfig) > 0:
for config in partitionsconfig:
for f, v in partitionsconfigflags.items():
if config == f:
items = v.split(',')
if items[0]:
if len(items) > 5:
raise bb.parse.SkipRecipe('Only image,label,mountpoint,size,type can be specified!')
# Make sure that we're dealing with partition image and not rootfs image
if len(items) > 2 and items[2]:
# Mount point available, so we're dealing with partition image
# PARTITIONS_IMAGE appending
bb.debug(1, "Appending '%s' to PARTITIONS_IMAGE." % items[0])
d.appendVar('PARTITIONS_IMAGE', ' ' + items[0])
# PARTITIONS_MOUNTPOINT appending
bb.debug(1, "Appending '%s' to PARTITIONS_MOUNTPOINT." % items[2])
d.appendVar('PARTITIONS_MOUNTPOINT', ' ' + items[2])
# Update IMAGE vars for each partition image
if items[1]:
bb.debug(1, "Set UBI_VOLNAME to %s for %s partition image." % (items[1], items[0]))
d.setVar('UBI_VOLNAME_pn-%s' % d.expand(items[0]), items[1])
if d.expand(items[1])[-2:] != 'fs':
bb.debug(1, "Set IMAGE_NAME_SUFFIX to '.%sfs' for %s partition image." % (items[1], items[0]))
d.setVar('IMAGE_NAME_SUFFIX_pn-%s' % d.expand(items[0]), '.' + items[1] + 'fs')
else:
bb.debug(1, "Set IMAGE_NAME_SUFFIX to '.%s' for %s partition image." % (items[1], items[0]))
d.setVar('IMAGE_NAME_SUFFIX_pn-%s' % d.expand(items[0]), '.' + items[1])
# Make sure about PARTITIONS_IMAGES contents
if len(items) != 5:
bb.fatal('[PARTITIONS_IMAGES] Only image,label,mountpoint,size,type can be specified!')
if items[0] == '':
bb.fatal('[PARTITIONS_IMAGES] Missing image setting')
# Update IMAGE vars for each partition image
if items[1] != '':
bb.debug(1, "Set UBI_VOLNAME to %s for %s partition image." % (items[1], items[0]))
d.setVar('UBI_VOLNAME_pn-%s' % d.expand(items[0]), items[1])
if d.expand(items[1])[-2:] != 'fs':
bb.debug(1, "Set IMAGE_NAME_SUFFIX to '.%sfs' for %s partition image." % (items[1], items[0]))
d.setVar('IMAGE_NAME_SUFFIX_pn-%s' % d.expand(items[0]), '.' + items[1] + 'fs')
else:
bb.fatal('[PARTITIONS_CONFIG] Missing label setting for %s image' % items[0])
if items[2]:
bb.debug(1, "Set IMAGE_PARTITION_MOUNTPOINT to %s for %s partition image." % (items[2], items[0]))
d.setVar('IMAGE_PARTITION_MOUNTPOINT_pn-%s' % d.expand(items[0]), items[2])
if items[3]:
if items[2]:
# Mount point available, so we're dealing with partition image
bb.debug(1, "Set IMAGE_ROOTFS_SIZE to %s for %s partition image." % (items[3], items[0]))
d.setVar('IMAGE_ROOTFS_SIZE_pn-%s' % d.expand(items[0]), items[3])
else:
bb.fatal('[PARTITIONS_CONFIG] Missing size setting for %s image' % items[0])
# Manage IMAGE_SUMMARY_LIST configuration according to PARTITIONS_CONFIG set
if d.getVar('ENABLE_IMAGE_LICENSE_SUMMARY') == "1":
if not items[2]:
# Set '/' as default mountpoint for rootfs in IMAGE_SUMMARY_LIST
items[2] = '/'
image_summary_list += items[0] + ':' + items[2] + ';'
# Manage multiubi volume list STM32MP_UBI_VOLUME
if bb.utils.contains('IMAGE_FSTYPES', 'stmultiubi', True, False, d) and d.getVar('ENABLE_MULTIVOLUME_UBI') == "1":
bb.debug(1, "Appending '%s' image with %s size to STM32MP_UBI_VOLUME." % (items[0], items[3]))
d.appendVar('STM32MP_UBI_VOLUME', ' ' + items[0] + ':' + items[3])
bb.debug(1, "Set IMAGE_NAME_SUFFIX to '.%s' for %s partition image." % (items[1], items[0]))
d.setVar('IMAGE_NAME_SUFFIX_pn-%s' % d.expand(items[0]), '.' + items[1])
else:
bb.fatal('[PARTITIONS_CONFIG] Missing image setting')
bb.fatal('[PARTITIONS_IMAGES] Missing label setting for %s image' % items[0])
# Make sure that we're dealing with partition image and not rootfs image
if items[2] != '':
# Mount point is available, so we're dealing with partition image
bb.debug(1, "Set IMAGE_PARTITION_MOUNTPOINT to %s for %s partition image." % (items[2], items[0]))
d.setVar('IMAGE_PARTITION_MOUNTPOINT_pn-%s' % d.expand(items[0]), items[2])
# Append image to image_partitions list
image_partitions.append(d.expand(items[0]))
if items[3] != '':
bb.debug(1, "Set IMAGE_ROOTFS_SIZE to %s for %s partition image." % (items[3], items[0]))
d.setVar('IMAGE_ROOTFS_SIZE_pn-%s' % d.expand(items[0]), items[3])
else:
bb.fatal('[PARTITIONS_IMAGES] Missing size setting for %s image' % items[0])
# Manage IMAGE_SUMMARY_LIST configuration according to PARTITIONS_IMAGE set
if d.getVar('ENABLE_IMAGE_LICENSE_SUMMARY') == "1":
if items[2] != '':
image_summary_list += items[0] + ':' + items[2] + ';'
else:
# Set '/' as default mountpoint for rootfs in IMAGE_SUMMARY_LIST
image_summary_list += items[0] + ':' + '/' + ';'
# Manage multiubi volume list STM32MP_UBI_VOLUME
if bb.utils.contains('IMAGE_FSTYPES', 'stmultiubi', True, False, d) and d.getVar('ENABLE_MULTIVOLUME_UBI') == "1":
# Get the MULTIUBI_BUILD list without any duplicates
ubiconfigs = list(dict.fromkeys((d.getVar('MULTIUBI_BUILD') or "").split()))
if len(ubiconfigs) > 0:
for ubi_config in ubiconfigs:
bb.debug(1, "Appending '%s' image with %s size to STM32MP_UBI_VOLUME." % (items[0], items[3]))
d.appendVar('STM32MP_UBI_VOLUME_%s' % ubi_config, ' ' + items[0] + ':' + items[3])
break
# Reset IMAGE_LIST_SUMMARY with computed partition configuration
@ -92,8 +91,6 @@ python __anonymous () {
bb.debug(1, "Set IMAGE_SUMMARY_LIST with configuration: %s." % image_summary_list)
d.setVar('IMAGE_SUMMARY_LIST', image_summary_list)
# Init partition list from PARTITIONS_IMAGE
image_partitions = (d.getVar('PARTITIONS_IMAGE') or "").split()
# -----------------------------------------------------------------------------
# Make sure to append the partition build to current image target
# -----------------------------------------------------------------------------
@ -136,8 +133,8 @@ python image_rootfs_image_clean_task(){
machine = d.expand("${MACHINE}")
distro = d.expand("${DISTRO}")
img_rootfs = d.getVar('IMAGE_ROOTFS')
partitionsconfigflags = d.getVarFlags('PARTITIONS_CONFIG')
partitionsconfig = (d.getVar('PARTITIONS_CONFIG') or "").split()
partitionsconfigflags = d.getVarFlags('PARTITIONS_IMAGE')
partitionsconfig = (d.getVar('PARTITIONS_IMAGE') or "").split()
if len(partitionsconfig) == 0:
bb.note('No partition image: nothing more to do...')

View File

@ -211,69 +211,110 @@ IMAGE_ROOTFS_ALIGNMENT ?= "4"
# Enable licence summary and configure License content generation
ENABLE_IMAGE_LICENSE_SUMMARY ?= "1"
# Partitions configuration
IMAGE_CLASSES += "st-partitions-image"
# Define image to use for extra partitions
STM32MP_BOOTFS_IMAGE ?= "st-image-bootfs"
STM32MP_BOOTFS_LABEL ?= "boot"
STM32MP_BOOTFS_MOUNTPOINT ?= "/boot"
STM32MP_USERFS_IMAGE ?= "st-image-userfs"
STM32MP_USERFS_LABEL ?= "userfs"
STM32MP_USERFS_MOUNTPOINT ?= "/usr/local"
STM32MP_VENDORFS_IMAGE ?= "st-image-vendorfs"
STM32MP_VENDORFS_LABEL ?= "vendorfs"
STM32MP_VENDORFS_MOUNTPOINT ?= "/vendor"
# Define image partition size (supposed to be set as max size in image recipe)
# Proposed value for bootfs is 64MB
BOOTFS_PARTITION_SIZE ?= "65536"
# Proposed value for rootfs should fit our highest constraint: NAND size (1GiB)
# For optee bootscheme we have the maximum partitions:
# FSBL1 + SSBL + SSBL2 + TEEH + TEED + TEEX + Multivolume UBI = NAND size
# Multivolume UBI = 1GiB - (2MiB + 2MiB + 2MiB + 512KiB + 512KiB + 512KiB) = 1016.5MiB
# With FIP with have the maximum partitions:
# FSBL1 + FIP + FIP2 + Multivolume UBI = NAND size
# Multivolume UBI = 1GiB - (2MiB + 4MiB + 4MiB) = 1014MiB
# With FIP with have the maximum partitions:
# FSBL1 + FIP + FIP + Multivolume UBI = SPI NAND size
# Multivolume UBI = 1GiB - (2MiB + 4MiB + 4MiB) = 1014MiB
# With multivolume UBI split:
# Multivolume UBI > uboot_config + uboot_config_r + bootfs + vendorfs + rootfs + userfs + UBI Overhead
# From http://www.linux-mtd.infradead.org/doc/ubi.html#L_overhead, we compute
# the UBI overhead for our NAND:
# (20*4096/1024 + 4) * 256KiB + (256KiB - 248KiB) * (1016.5MiB/256KiB - 20*4096/1024 - 4) = 53360KiB
# (20*4096/1024 + 4) * 256KiB + (256KiB - 248KiB) * (1014MiB/256KiB - 20*4096/1024 - 4) = 53280KiB
# In addition, for each UBIFS, our NAND consummed 9 extra eraseblocks
# So:
# rootfs < Multivolume UBI - (uboot_config + uboot_config_r + bootfs + vendorfs + userfs + UBI Overhead + 4 * 9*eraseblocks)
# rootfs < 1016.5MiB - (256KiB + 256KiB + 64MiB + 16MiB + 128MiB + 53360KiB + 4 * 9 * 256KiB)
# rootfs < 746.8MiB
# Proposed value for rootfs is 746MiB
# Define max size for ROOTFS image being built to this value
IMAGE_ROOTFS_MAXSIZE ?= "763904"
# And configure the ROOTFS_PARTITION_SIZE variable accordingly
ROOTFS_PARTITION_SIZE ?= "${IMAGE_ROOTFS_MAXSIZE}"
# Proposed value for userfs is 128MB (4*32MB)
USERFS_PARTITION_SIZE ?= "131072"
# Proposed value for vendorfs is 16MB
VENDORFS_PARTITION_SIZE ?= "16384"
# rootfs < 1014MiB - (256KiB + 256KiB + 64MiB + 16MiB + 128MiB + 53280KiB + 4 * 9 * 256KiB)
# rootfs < 744.5MiB
# Proposed value for rootfs is 744MiB
STM32MP_ROOTFS_MAXSIZE_NAND ?= "762336"
# Default ROOTFS max size for image being built to this value
IMAGE_ROOTFS_MAXSIZE ?= "${STM32MP_ROOTFS_MAXSIZE_NAND}"
# Partitions configuration
IMAGE_CLASSES += "st-partitions-image"
# Enable use of extra partition(s)
ST_BOOTFS ?= "1"
ST_VENDORFS ?= "1"
ST_USERFS ?= "1"
# Partitions configuration
PARTITIONS_CONFIG += "${@bb.utils.contains('ST_BOOTFS', '1', 'bootfs', '', d)}"
PARTITIONS_CONFIG += "${@bb.utils.contains('ST_VENDORFS', '1', 'vendorfs', '', d)}"
PARTITIONS_CONFIG += "rootfs"
PARTITIONS_CONFIG += "${@bb.utils.contains('ST_USERFS', '1', 'userfs', '', d)}"
PARTITIONS_IMAGES += "${@bb.utils.contains('ST_BOOTFS', '1', 'bootfs', '', d)}"
PARTITIONS_IMAGES += "${@bb.utils.contains('ST_VENDORFS', '1', 'vendorfs', '', d)}"
PARTITIONS_IMAGES += "rootfs"
PARTITIONS_IMAGES += "${@bb.utils.contains('ST_USERFS', '1', 'userfs', '', d)}"
PARTITIONS_CONFIG[bootfs] ?= "${STM32MP_BOOTFS_IMAGE},${STM32MP_BOOTFS_LABEL},${STM32MP_BOOTFS_MOUNTPOINT},${BOOTFS_PARTITION_SIZE},System"
PARTITIONS_CONFIG[vendorfs] ?= "${STM32MP_VENDORFS_IMAGE},${STM32MP_VENDORFS_LABEL},${STM32MP_VENDORFS_MOUNTPOINT},${VENDORFS_PARTITION_SIZE},FileSystem"
PARTITIONS_CONFIG[rootfs] ?= "${IMAGE_BASENAME},rootfs,,${ROOTFS_PARTITION_SIZE},FileSystem"
PARTITIONS_CONFIG[userfs] ?= "${STM32MP_USERFS_IMAGE},${STM32MP_USERFS_LABEL},${STM32MP_USERFS_MOUNTPOINT},${USERFS_PARTITION_SIZE},FileSystem"
# Define image to use for extra partitions
STM32MP_BOOTFS_IMAGE ?= "st-image-bootfs"
STM32MP_BOOTFS_LABEL ?= "boot"
STM32MP_BOOTFS_MOUNTPOINT ?= "/boot"
# Proposed value for bootfs is 64MB
STM32MP_BOOTFS_SIZE ?= "65536"
STM32MP_ROOTFS_IMAGE ?= "${IMAGE_BASENAME}"
STM32MP_ROOTFS_LABEL ?= "rootfs"
# Configure the rootfs size with IMAGE_ROOTFS_MAXSIZE variable
STM32MP_ROOTFS_SIZE ?= "${IMAGE_ROOTFS_MAXSIZE}"
STM32MP_USERFS_IMAGE ?= "st-image-userfs"
STM32MP_USERFS_LABEL ?= "userfs"
STM32MP_USERFS_MOUNTPOINT ?= "/usr/local"
# Proposed value for userfs is 128MB
STM32MP_USERFS_SIZE ?= "131072"
STM32MP_VENDORFS_IMAGE ?= "st-image-vendorfs"
STM32MP_VENDORFS_LABEL ?= "vendorfs"
STM32MP_VENDORFS_MOUNTPOINT ?= "/vendor"
# Proposed value for vendorfs is 16MB
STM32MP_VENDORFS_SIZE ?= "16384"
# <image_name>,<partition_label>,<mountpoint>,<size>,<type>
PARTITIONS_IMAGES[bootfs] ?= "${STM32MP_BOOTFS_IMAGE},${STM32MP_BOOTFS_LABEL},${STM32MP_BOOTFS_MOUNTPOINT},${STM32MP_BOOTFS_SIZE},System"
PARTITIONS_IMAGES[vendorfs] ?= "${STM32MP_VENDORFS_IMAGE},${STM32MP_VENDORFS_LABEL},${STM32MP_VENDORFS_MOUNTPOINT},${STM32MP_VENDORFS_SIZE},FileSystem"
PARTITIONS_IMAGES[rootfs] ?= "${STM32MP_ROOTFS_IMAGE},${STM32MP_ROOTFS_LABEL},,${STM32MP_ROOTFS_SIZE},FileSystem"
PARTITIONS_IMAGES[userfs] ?= "${STM32MP_USERFS_IMAGE},${STM32MP_USERFS_LABEL},${STM32MP_USERFS_MOUNTPOINT},${STM32MP_USERFS_SIZE},FileSystem"
# =========================================================================
# Image partition configuration : data, label, size (Kbytes)
# =========================================================================
STM32MP_UBIFS_DATA ?= "${IMAGE_LINK_NAME}_<CONFIG>_multivolume.ubi"
STM32MP_UBIFS_NAME ?= "ubifs"
STM32MP_UBIFS_SIZE ?= ""
# Partitions configuration
PARTITIONS_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', 'emmc', '', d)}"
PARTITIONS_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand-4-256', '', d)}"
PARTITIONS_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor', 'nor', '', d)}"
PARTITIONS_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'nor-sdcard', '', d)}"
PARTITIONS_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', 'sdcard', '', d)}"
PARTITIONS_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'spinand-2-128', '', d)}"
PARTITIONS_SUFFIX ?= "ext4"
# <binary_name>,<partlabel>,<size>,<type>,<copy>
PARTITIONS_CONFIG[emmc] ?= "\
${@' '.join(['%s' % partImage2partConfig(config, '${PARTITIONS_SUFFIX}', d) for config in d.getVar('PARTITIONS_IMAGES').split()])} \
"
PARTITIONS_CONFIG[nand-4-256] ?= "\
${STM32MP_UBIFS_DATA},${STM32MP_UBIFS_NAME},${STM32MP_UBIFS_SIZE},System,1 \
"
PARTITIONS_CONFIG[nor] ?= "\
${@' '.join(['%s' % partImage2partConfig(config, '${PARTITIONS_SUFFIX}', d) for config in d.getVar('PARTITIONS_IMAGES').split()])} \
"
PARTITIONS_CONFIG[nor-sdcard] ?= "\
${@' '.join(['%s' % partImage2partConfig(config, '${PARTITIONS_SUFFIX}', d) for config in d.getVar('PARTITIONS_IMAGES').split()])} \
"
PARTITIONS_CONFIG[sdcard] ?= "\
${@' '.join(['%s' % partImage2partConfig(config, '${PARTITIONS_SUFFIX}', d) for config in d.getVar('PARTITIONS_IMAGES').split()])} \
"
PARTITIONS_CONFIG[spinand-2-128] ?= "\
${STM32MP_UBIFS_DATA},${STM32MP_UBIFS_NAME},${STM32MP_UBIFS_SIZE},System,1 \
"
# UBI Configuration
IMAGE_CLASSES += "image_types-stubi"
# Define two empty volumes to manage U-Boot config beginning of multivolume UBIFS
STM32MP_UBI_VOLUME_prepend = "uboot_config:256:empty uboot_config_r:256:empty "
# Define UBI volume label to use in kernel command line to mount UBI file system
UBI_VOLNAME ?= "rootfs"
@ -283,6 +324,7 @@ UBI_VOLNAME ?= "rootfs"
# nor_<BlockSize>
# Like that a same UBI partition can be used for severals NAND/NOR providers
MULTIUBI_BUILD += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand_4_256', '', d)}"
MULTIUBI_BUILD += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'spinand_2_128', '', d)}"
# UBI Args for NAND by default on MB1262 (Micron MT29F8G16ABACAH4)
# LEB = BLOCK_SIZE - (2 * page size): 256*1024 - (2*4096)
@ -290,12 +332,35 @@ MKUBIFS_ARGS_nand_4_256 = "--min-io-size 4096 --leb-size 253952 --max-leb-cnt 40
UBINIZE_ARGS_nand_4_256 = "--min-io-size 4096 --peb-size 256KiB"
# Set extra size required for UBIFS volume size (KiB)
EXTRA_UBIFS_SIZE_nand_4_256 = "2304"
# UBI Args for SPI NAND by default on MB1262 (Micron MT29F2G01ABA)
# LEB = BLOCK_SIZE - (2 * page size): 128*1024 - (2*2048)
MKUBIFS_ARGS_spinand_2_128 = "--min-io-size 2048 --leb-size 126976 --max-leb-cnt 2048 --space-fixup"
UBINIZE_ARGS_spinand_2_128 = "--min-io-size 2048 --peb-size 128KiB"
# Set extra size required for UBIFS volume size (KiB)
EXTRA_UBIFS_SIZE_spinand_2_128 = "1408"
# Define two empty volumes to manage U-Boot config beginning of multivolume UBIFS
STM32MP_MULTIUBI_UENV1_LABEL = "uboot_config"
STM32MP_MULTIUBI_UENV1_SIZE ?= "256"
STM32MP_MULTIUBI_UENV2_LABEL = "uboot_config_r"
STM32MP_MULTIUBI_UENV2_SIZE ?= "${STM32MP_MULTIUBI_UENV1_SIZE}"
STM32MP_UBI_VOLUME_nand_4_256_prepend = "\
${STM32MP_MULTIUBI_UENV1_LABEL}:${STM32MP_MULTIUBI_UENV1_SIZE}:empty \
${STM32MP_MULTIUBI_UENV2_LABEL}:${STM32MP_MULTIUBI_UENV2_SIZE}:empty \
"
STM32MP_UBI_VOLUME_spinand_2_128_prepend = "\
${STM32MP_MULTIUBI_UENV1_LABEL}:${STM32MP_MULTIUBI_UENV1_SIZE}:empty \
${STM32MP_MULTIUBI_UENV2_LABEL}:${STM32MP_MULTIUBI_UENV2_SIZE}:empty \
"
# Default FSTYPES requested
WKS_IMAGE_FSTYPES ?= ""
IMAGE_FSTYPES ?= "${WKS_IMAGE_FSTYPES} tar.xz ext4"
IMAGE_FSTYPES ?= "${WKS_IMAGE_FSTYPES} tar.xz"
# Append ext4 FSTYPES to default ones for emmc and sdcard volumes
IMAGE_FSTYPES += "${@bb.utils.contains_any('BOOTDEVICE_LABELS', 'emmc nor-sdcard sdcard', 'ext4', '', d)}"
# Append ubi FSTYPES to default ones for nand volumes
IMAGE_FSTYPES += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'stmultiubi', '', d)}"
IMAGE_FSTYPES += "${@bb.utils.contains_any('BOOTDEVICE_LABELS', 'nand-4-256 spinand-2-128', 'stmultiubi', '', d)}"
# Define specific EXT4 command line:
# - Create minimal inode number (as it is done by default in image_types.bbclass)

View File

@ -23,7 +23,7 @@ FLASHLAYOUT_TYPE_LABELS_extensible = "${@d.getVar('STM32MP_DT_FILES_DK') or 'non
FLASHLAYOUT_PARTITION_LABELS_extensible = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'sdcard').split()])} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'sdcard').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_extensible_remove = "userfs"

View File

@ -134,70 +134,70 @@ FLASHLAYOUT_PARTITION_LABELS_optee_emmc = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'emmc').split()])} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', ' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'emmc').split()]), d)} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'emmc').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_optee_nand-4-256 = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nand-4-256').split()])} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', ' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'nand-4-256').split()]), d)} \
ubifs \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nand-4-256').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_optee_nor = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nor').split()])} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', ' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'nor').split()]), d)} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nor').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_optee_nor-sdcard = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nor-sdcard').split()])} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', ' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'nor-sdcard').split()]), d)} \
empty \
${FLASHLAYOUT_PARTITION_IMAGES}\
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nor-sdcard').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_optee_sdcard = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'sdcard').split()])} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', ' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'sdcard').split()]), d)} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'sdcard').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_optee_spinand-2-128 = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'spinand-2-128').split()])} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', ' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'spinand-2-128').split()]), d)} \
ubifs\
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'spinand-2-128').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_trusted_emmc = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'emmc').split()])} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'emmc').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_trusted_nand-4-256 = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nand-4-256').split()])} \
ubifs \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nand-4-256').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_trusted_nor = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nor').split()])} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nor').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_trusted_nor-sdcard = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nor-sdcard').split()])} \
empty \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nor-sdcard').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_trusted_sdcard = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'sdcard').split()])} \
${FLASHLAYOUT_PARTITION_IMAGES} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'sdcard').split()])} \
"
FLASHLAYOUT_PARTITION_LABELS_trusted_spinand-2-128 = "\
${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'spinand-2-128').split()])} \
ubifs \
${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'spinand-2-128').split()])} \
"
# -----------------------------------------------------------------------------
@ -242,7 +242,7 @@ FLASHLAYOUT_PARTITION_COPY = "1"
FLASHLAYOUT_PARTITION_DEVICE_emmc = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_EMMC}:default"
FLASHLAYOUT_PARTITION_DEVICE_nand-4-256 = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_NAND}:default"
FLASHLAYOUT_PARTITION_DEVICE_nor = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_NOR}:default"
FLASHLAYOUT_PARTITION_DEVICE_nor-sdcard = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_NOR}:default,${DEVICE_SDCARD}:${FLASHLAYOUT_PARTITION_IMAGES}"
FLASHLAYOUT_PARTITION_DEVICE_nor-sdcard = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_NOR}:default,${DEVICE_SDCARD}:${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_CONFIG', 'nor-sdcard').split()])}"
FLASHLAYOUT_PARTITION_DEVICE_sdcard = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_SDCARD}:default"
FLASHLAYOUT_PARTITION_DEVICE_spinand-2-128 = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_SPINAND}:default"
@ -266,7 +266,6 @@ FLASHLAYOUT_PARTITION_SIZE_empty = "0"
# -----------------------------------------------------------------------------
FLASHLAYOUT_PARTITION_BIN2LOAD_${STM32MP_FSBL1_NAME}-boot = "${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'arm-trusted-firmware/tf-a-<TYPE>-usb.stm32', 'arm-trusted-firmware/tf-a-<TYPE>-serialboot.stm32', d)}"
FLASHLAYOUT_PARTITION_BIN2LOAD_${STM32MP_SSBL1_NAME}-boot = "${STM32MP_SSBL1_DATA}"
FLASHLAYOUT_PARTITION_BIN2LOAD_ubifs = "${IMAGE_LINK_NAME}_<CONFIG>_multivolume.ubi"
# -----------------------------------------------------------------------------
# Use the 'FLASHLAYOUT_PARTITION_REPLACE_PATTERNS' var to allow dynamic binary

View File

@ -11,7 +11,7 @@ BBCLASSEXTEND = "native nativesdk"
RDEPENDS_${PN}_append = " bash "
RRECOMMENDS_${PN}_append_class-nativesdk = "nativesdk-gptfdisk"
RRECOMMENDS_${PN}_append_class-nativesdk = " nativesdk-gptfdisk "
inherit deploy
@ -19,11 +19,11 @@ SCRIPT_DEPLOYDIR ?= "scripts"
do_configure() {
if [ -e ${WORKDIR}/create_sdcard_from_flashlayout.sh ]; then
bbnote "Update DEFAULT_ROOTFS_PARTITION_SIZE to ${ROOTFS_PARTITION_SIZE}"
sed 's/^DEFAULT_ROOTFS_PARTITION_SIZE=.*$/DEFAULT_ROOTFS_PARTITION_SIZE='"${ROOTFS_PARTITION_SIZE}"'/' -i ${WORKDIR}/create_sdcard_from_flashlayout.sh
if [ ${ROOTFS_PARTITION_SIZE} -gt 1572864 ]; then
# rootfs > 1.5GB then put sdcard raw size = ROOTFS_PARTITION_SIZE + 1.5GB
raw_size=$(expr ${ROOTFS_PARTITION_SIZE} / 1024 )
bbnote "Update DEFAULT_ROOTFS_PARTITION_SIZE to ${STM32MP_ROOTFS_SIZE}"
sed 's/^DEFAULT_ROOTFS_PARTITION_SIZE=.*$/DEFAULT_ROOTFS_PARTITION_SIZE='"${STM32MP_ROOTFS_SIZE}"'/' -i ${WORKDIR}/create_sdcard_from_flashlayout.sh
if [ ${STM32MP_ROOTFS_SIZE} -gt 1572864 ]; then
# rootfs > 1.5GB then put sdcard raw size = STM32MP_ROOTFS_SIZE + 1.5GB
raw_size=$(expr ${STM32MP_ROOTFS_SIZE} / 1024 )
raw_size=$(expr $raw_size + 1536)
sed 's/^DEFAULT_RAW_SIZE=.*$/DEFAULT_RAW_SIZE='"$raw_size"'/' -i ${WORKDIR}/create_sdcard_from_flashlayout.sh
fi