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:
1 parent
5245abf2c7
commit
5df595134e
7 files changed
+404
-326
No files matched your search
@@ -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:
|
||||
|
||||
+138
-104
@@ -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()])}"
|
||||
@@ -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...')
|
||||
|
||||
Reference in new issue
Block a user