MACHINE: rework configuration to introduce FIP feature

New class is introduce 'fip-utils-stm32mp.bbclass'
New flashlayout file configuration
New features enable on machine side

Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
Change-Id: Ifb5af81b5341ef924b8c22992df20a21bd729e3f
This commit is contained in:
Romuald JEANNE 2021-03-15 16:34:42 +01:00
parent 302d750d20
commit e854264f98
12 changed files with 976 additions and 298 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
key

View File

@ -0,0 +1,345 @@
DEPENDS += "tf-a-tools-native"
# Configure new package to provide fiptool wrapper for SDK usage
PACKAGES =+ "${FIPTOOL_WRAPPER}"
BBCLASSEXTEND_append = " nativesdk"
RRECOMMENDS_${FIPTOOL_WRAPPER}_append_class-nativesdk = " nativesdk-tf-a-tools"
# Define default TF-A FIP namings
FIP_BASENAME ?= "fip"
FIP_SUFFIX ?= "bin"
# Set default TF-A FIP config
FIP_CONFIG ?= ""
# Default FIP config:
# There are two options implemented to select two different firmware and each
# FIP_CONFIG should configure one: 'tfa' or 'optee'
FIP_CONFIG[tfa-fw] ?= "tfa"
FIP_CONFIG[tee-fw] ?= "optee"
# Init BL31 config
FIP_BL31_ENABLE ?= ""
# Set CERTTOOL binary name to use
CERTTOOL ?= "cert_create"
# Set FIPTOOL binary name to use
FIPTOOL ?= "fiptool"
# Set STM32MP fiptool wrapper
FIPTOOL_WRAPPER ?= "fiptool-stm32mp"
# Default FIP file names and suffixes
FIP_BL31 ?= "tf-a-bl31"
FIP_BL31_SUFFIX ?= "bin"
FIP_TFA ?= "tf-a-bl32"
FIP_TFA_SUFFIX ?= "bin"
FIP_TFA_DTB ?= "bl32"
FIP_TFA_DTB_SUFFIX ?= "dtb"
FIP_FW_CONFIG ?= "fw-config"
FIP_FW_CONFIG_SUFFIX ?= "dtb"
FIP_OPTEE_HEADER ?= "tee-header_v2"
FIP_OPTEE_PAGER ?= "tee-pager_v2"
FIP_OPTEE_PAGEABLE ?= "tee-pageable_v2"
FIP_OPTEE_SUFFIX ?= "bin"
FIP_UBOOT ?= "u-boot-nodtb"
FIP_UBOOT_SUFFIX ?= "bin"
FIP_UBOOT_DTB ?= "u-boot"
FIP_UBOOT_DTB_SUFFIX ?= "dtb"
FIP_UBOOT_CONFIG ?= "trusted"
# Configure default folder path for binaries to package
FIP_DEPLOYDIR_FIP ?= "${DEPLOYDIR}/fip"
FIP_DEPLOYDIR_BL31 ?= "${DEPLOYDIR}/arm-trusted-firmware/bl31"
FIP_DEPLOYDIR_TFA ?= "${DEPLOYDIR}/arm-trusted-firmware/bl32"
FIP_DEPLOYDIR_FWCONF ?= "${DEPLOYDIR}/arm-trusted-firmware/fwconfig"
FIP_DEPLOYDIR_OPTEE ?= "${DEPLOY_DIR}/images/${MACHINE}/optee"
FIP_DEPLOYDIR_UBOOT ?= "${DEPLOY_DIR}/images/${MACHINE}/u-boot"
# Set default configuration to allow FIP signing
FIP_SIGN_ENABLE ??= ''
FIP_SIGN_KEY ??= ''
FIP_SIGN_KEY_EXTERNAL ??= ''
FIP_SIGN_KEY_PASS ??= ''
FIP_SIGN_SUFFIX ??= ''
# Define FIP dependency build
FIP_DEPENDS += "virtual/bootloader"
FIP_DEPENDS += "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'virtual/optee-os', '', d)}"
FIP_DEPENDS_class-nativesdk = ""
# -----------------------------------------------
# Handle FIP config and set internal vars
# FIP_BL32_CONF
python () {
import re
# Make sure that deploy class is configured
if not bb.data.inherits_class('deploy', d):
bb.fatal("The st-fip-utils class needs the deploy class to be configured on recipe side.")
# Manage FIP binary dependencies
fip_depends = (d.getVar('FIP_DEPENDS') or "").split()
if len(fip_depends) > 0:
for depend in fip_depends:
d.appendVarFlag('do_deploy', 'depends', ' %s:do_deploy' % depend)
# Manage FIP config settings
fipconfigflags = d.getVarFlags('FIP_CONFIG')
# The "doc" varflag is special, we don't want to see it here
fipconfigflags.pop('doc', None)
fipconfig = (d.getVar('FIP_CONFIG') or "").split()
if not fipconfig:
raise bb.parse.SkipRecipe("FIP_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE"))
if (d.getVar('FIP_BL32_CONF') or "").split():
raise bb.parse.SkipRecipe("You cannot use FIP_BL32_CONF as it is internal to FIP_CONFIG var expansion.")
if len(fipconfig) > 0:
for config in fipconfig:
for f, v in fipconfigflags.items():
if config == f:
# Make sure to get var flag properly expanded
v = d.getVarFlag('FIP_CONFIG', config)
if not v.strip():
bb.fatal('[FIP_CONFIG] Missing configuration for %s config' % config)
items = v.split(',')
if items[0] and len(items) > 1:
raise bb.parse.SkipRecipe('Only <BL32_CONF> can be specified!')
# Set internal vars
bb.debug(1, "Appending '%s' to FIP_BL32_CONF" % items[0])
d.appendVar('FIP_BL32_CONF', items[0] + ',')
break
# Manage signing settings
if d.getVar('FIP_SIGN_ENABLE') == '1':
fip_signingkey = d.getVar('FIP_SIGN_KEY')
if not fip_signingkey:
bb.fatal('Please make sure to configure "FIP_SIGN_KEY" var to signing key file.')
bb.debug(1, "Manage to find signing key file location from BBPATH...")
if d.getVar('FIP_SIGN_KEY_EXTERNAL') == '1':
found_signingkey = False
for p in d.getVar("BBPATH").split(":"):
file_path = os.path.join(p, fip_signingkey)
if os.path.isfile(file_path):
bb.debug(1, "Set FIP_SIGN_KEY to '%s' path." % file_path)
d.setVar('FIP_SIGN_KEY', file_path)
found_signingkey = True
if not found_signingkey:
bbpaths = d.getVar('BBPATH').replace(':','\n\t')
bb.fatal('\nNot able to find "%s" path from current BBPATH var:\n\t%s.' % (fip_signingkey, bbpaths))
}
# Deploy the fip binary for current target
do_deploy_append_class-target() {
install -d ${DEPLOYDIR}
install -d ${FIP_DEPLOYDIR_FIP}
unset i
for config in ${FIP_CONFIG}; do
i=$(expr $i + 1)
bl32_conf=$(echo ${FIP_BL32_CONF} | cut -d',' -f${i})
for dt in ${FIP_DEVICETREE}; do
# Init soc suffix
soc_suffix=""
if [ -n "${STM32MP_SOC_NAME}" ]; then
for soc in ${STM32MP_SOC_NAME}; do
[ "$(echo ${dt} | grep -c ${soc})" -eq 1 ] && soc_suffix="-${soc}"
done
fi
# Init FIP fw-config settings
[ -f "${FIP_DEPLOYDIR_FWCONF}/${dt}-${FIP_FW_CONFIG}-${config}.${FIP_FW_CONFIG_SUFFIX}" ] || bbfatal "Missing ${dt}-${FIP_FW_CONFIG}-${config}.${FIP_FW_CONFIG_SUFFIX} file in folder: ${FIP_DEPLOYDIR_FWCONF}"
FIP_FWCONFIG="--fw-config ${FIP_DEPLOYDIR_FWCONF}/${dt}-${FIP_FW_CONFIG}-${config}.${FIP_FW_CONFIG_SUFFIX}"
# Init FIP hw-config settings
[ -f "${FIP_DEPLOYDIR_UBOOT}/${FIP_UBOOT_DTB}-${dt}-${FIP_UBOOT_CONFIG}.${FIP_UBOOT_DTB_SUFFIX}" ] || bbfatal "Missing ${FIP_UBOOT_DTB}-${dt}-${FIP_UBOOT_CONFIG}.${FIP_UBOOT_DTB_SUFFIX} file in folder: ${FIP_DEPLOYDIR_UBOOT}"
FIP_HWCONFIG="--hw-config ${FIP_DEPLOYDIR_UBOOT}/${FIP_UBOOT_DTB}-${dt}-${FIP_UBOOT_CONFIG}.${FIP_UBOOT_DTB_SUFFIX}"
# Init FIP nt-fw config
[ -f "${FIP_DEPLOYDIR_UBOOT}/${FIP_UBOOT}${soc_suffix}.${FIP_UBOOT_SUFFIX}" ] || bbfatal "Missing ${FIP_UBOOT}${soc_suffix}.${FIP_UBOOT_SUFFIX} file in folder: ${FIP_DEPLOYDIR_UBOOT}"
FIP_NTFW="--nt-fw ${FIP_DEPLOYDIR_UBOOT}/${FIP_UBOOT}${soc_suffix}.${FIP_UBOOT_SUFFIX}"
# Init FIP bl31 settings
if [ "${FIP_BL31_ENABLE}" = "1" ]; then
# Check for files
[ -f "${FIP_DEPLOYDIR_BL31}/${FIP_BL31}${soc_suffix}.${FIP_BL31_SUFFIX}" ] || bbfatal "No ${FIP_BL31}${soc_suffix}.${FIP_BL31_SUFFIX} file in folder: ${FIP_DEPLOYDIR_BL31}"
# Set FIP_BL31CONF
FIP_BL31CONF="--soc-fw ${FIP_DEPLOYDIR_BL31}/${FIP_BL31}${soc_suffix}.${FIP_BL31_SUFFIX}"
else
FIP_BL31CONF=""
fi
# Init FIP extra conf settings
if [ "${bl32_conf}" = "tfa" ]; then
# Check for files
[ -f "${FIP_DEPLOYDIR_TFA}/${FIP_TFA}${soc_suffix}.${FIP_TFA_SUFFIX}" ] || bbfatal "No ${FIP_TFA}${soc_suffix}.${FIP_TFA_SUFFIX} file in folder: ${FIP_DEPLOYDIR_TFA}"
[ -f "${FIP_DEPLOYDIR_TFA}/${dt}-${FIP_TFA_DTB}.${FIP_TFA_DTB_SUFFIX}" ] || bbfatal "No ${dt}-${FIP_TFA_DTB}.${FIP_TFA_DTB_SUFFIX} file in folder: ${FIP_DEPLOYDIR_TFA}"
# Set FIP_EXTRACONF
FIP_EXTRACONF="\
--tos-fw ${FIP_DEPLOYDIR_TFA}/${FIP_TFA}${soc_suffix}.${FIP_TFA_SUFFIX} \
--tos-fw-config ${FIP_DEPLOYDIR_TFA}/${dt}-${FIP_TFA_DTB}.${FIP_TFA_DTB_SUFFIX} \
"
elif [ "${bl32_conf}" = "optee" ]; then
# Check for files
[ -f "${FIP_DEPLOYDIR_OPTEE}/${FIP_OPTEE_HEADER}-${dt}.${FIP_OPTEE_SUFFIX}" ] || bbfatal "Missing ${FIP_OPTEE_HEADER}-${dt}.${FIP_OPTEE_SUFFIX} file in folder: ${FIP_DEPLOYDIR_OPTEE}"
[ -f "${FIP_DEPLOYDIR_OPTEE}/${FIP_OPTEE_PAGER}-${dt}.${FIP_OPTEE_SUFFIX}" ] || bbfatal "Missing ${FIP_OPTEE_PAGER}-${dt}.${FIP_OPTEE_SUFFIX} file in folder: ${FIP_DEPLOYDIR_OPTEE}"
[ -f "${FIP_DEPLOYDIR_OPTEE}/${FIP_OPTEE_PAGEABLE}-${dt}.${FIP_OPTEE_SUFFIX}" ] || bbfatal "Missing ${FIP_OPTEE_PAGEABLE}-${dt}.${FIP_OPTEE_SUFFIX} file in folder: ${FIP_DEPLOYDIR_OPTEE}"
# Set FIP_EXTRACONF
FIP_EXTRACONF="\
--tos-fw ${FIP_DEPLOYDIR_OPTEE}/${FIP_OPTEE_HEADER}-${dt}.${FIP_OPTEE_SUFFIX} \
--tos-fw-extra1 ${FIP_DEPLOYDIR_OPTEE}/${FIP_OPTEE_PAGER}-${dt}.${FIP_OPTEE_SUFFIX} \
--tos-fw-extra2 ${FIP_DEPLOYDIR_OPTEE}/${FIP_OPTEE_PAGEABLE}-${dt}.${FIP_OPTEE_SUFFIX} \
"
else
bbfatal "Wrong configuration '${bl32_conf}' found in FIP_CONFIG for ${config} config."
fi
# Init certificate settings
if [ "${FIP_SIGN_ENABLE}" = "1" ]; then
FIP_CERTCONF="\
--tb-fw-cert ${WORKDIR}/tb_fw.crt \
--trusted-key-cert ${WORKDIR}/trusted_key.crt \
--nt-fw-cert ${WORKDIR}/nt_fw_content.crt \
--nt-fw-key-cert ${WORKDIR}/nt_fw_key.crt \
--tos-fw-cert ${WORKDIR}/tos_fw_content.crt \
--tos-fw-key-cert ${WORKDIR}/tos_fw_key.crt \
"
# Need fake bl2 binary to generate certificates
touch ${WORKDIR}/bl2-fake.bin
# Generate certificates
${CERTTOOL} -n --tfw-nvctr 0 --ntfw-nvctr 0 --key-alg ecdsa --hash-alg sha256 \
--rot-key ${FIP_SIGN_KEY} \
--rot-key-pwd ${FIP_SIGN_KEY_PASS} \
${FIP_FWCONFIG} \
${FIP_HWCONFIG} \
${FIP_NTFW} \
${FIP_EXTRACONF} \
${FIP_CERTCONF} \
--tb-fw ${WORKDIR}/bl2-fake.bin
# Remove fake bl2 binary
rm -f ${WORKDIR}/bl2-fake.bin
else
FIP_CERTCONF=""
fi
# Generate FIP binary
bbnote "${FIPTOOL} create \
${FIP_FWCONFIG} \
${FIP_HWCONFIG} \
${FIP_NTFW} \
${FIP_BL31CONF} \
${FIP_EXTRACONF} \
${FIP_CERTCONF} \
${FIP_DEPLOYDIR_FIP}/${FIP_BASENAME}-${dt}-${config}${FIP_SIGN_SUFFIX}.${FIP_SUFFIX}"
${FIPTOOL} create \
${FIP_FWCONFIG} \
${FIP_HWCONFIG} \
${FIP_NTFW} \
${FIP_BL31CONF} \
${FIP_EXTRACONF} \
${FIP_CERTCONF} \
${FIP_DEPLOYDIR_FIP}/${FIP_BASENAME}-${dt}-${config}${FIP_SIGN_SUFFIX}.${FIP_SUFFIX}
done
done
}
# Stub do_compile for nativesdk use case as we only expect to provide FIPTOOL_WRAPPER
do_compile_class-nativesdk() {
return
}
do_install_class-nativesdk() {
# Create the FIPTOOL_WRAPPER script to use on sdk side
cat << EOF > ${WORKDIR}/${FIPTOOL_WRAPPER}
#!/bin/bash -
function bbfatal() { echo "\$*" ; exit 1 ; }
# Set default TF-A FIP config
FIP_CONFIG="\${FIP_CONFIG:-${FIP_CONFIG}}"
FIP_BL32_CONF="\${FIP_BL32_CONF:-${FIP_BL32_CONF}}"
FIP_DEVICETREE="\${FIP_DEVICETREE:-${FIP_DEVICETREE}}"
# Configure default folder path for binaries to package
FIP_DEPLOYDIR_ROOT="\${FIP_DEPLOYDIR_ROOT:-}"
FIP_DEPLOYDIR_FIP="\${FIP_DEPLOYDIR_FIP:-\$FIP_DEPLOYDIR_ROOT/fip}"
FIP_DEPLOYDIR_TFA="\${FIP_DEPLOYDIR_TFA:-\$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/bl32}"
FIP_DEPLOYDIR_FWCONF="\${FIP_DEPLOYDIR_FWCONF:-\$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig}"
FIP_DEPLOYDIR_OPTEE="\${FIP_DEPLOYDIR_OPTEE:-\$FIP_DEPLOYDIR_ROOT/optee}"
FIP_DEPLOYDIR_UBOOT="\${FIP_DEPLOYDIR_UBOOT:-\$FIP_DEPLOYDIR_ROOT/u-boot}"
echo ""
echo "${FIPTOOL_WRAPPER} config:"
for config in \$FIP_CONFIG; do
i=\$(expr \$i + 1)
bl32_conf=\$(echo \$FIP_BL32_CONF | cut -d',' -f\$i)
echo " \${config}:" ; \\
echo " bl32 config value: \${bl32_conf}"
done
echo " FIP_DEVICETREE: \$FIP_DEVICETREE"
echo ""
echo " FIP_DEPLOYDIR_FIP : \$FIP_DEPLOYDIR_FIP"
echo " FIP_DEPLOYDIR_TFA : \$FIP_DEPLOYDIR_TFA"
echo " FIP_DEPLOYDIR_FWCONF: \$FIP_DEPLOYDIR_FWCONF"
echo " FIP_DEPLOYDIR_OPTEE : \$FIP_DEPLOYDIR_OPTEE"
echo " FIP_DEPLOYDIR_UBOOT : \$FIP_DEPLOYDIR_UBOOT"
echo ""
unset i
for config in \$FIP_CONFIG; do
i=\$(expr \$i + 1)
bl32_conf=\$(echo \$FIP_BL32_CONF | cut -d',' -f\$i)
for dt in \$FIP_DEVICETREE; do
# Init soc suffix
soc_suffix=""
if [ -n "${STM32MP_SOC_NAME}" ]; then
for soc in ${STM32MP_SOC_NAME}; do
[ "\$(echo \${dt} | grep -c \${soc})" -eq 1 ] && soc_suffix="-\${soc}"
done
fi
# Init FIP fw-config settings
[ -f "\$FIP_DEPLOYDIR_FWCONF/\${dt}-${FIP_FW_CONFIG}-\${config}.${FIP_FW_CONFIG_SUFFIX}" ] || bbfatal "Missing \${dt}-${FIP_FW_CONFIG}-\${config}.${FIP_FW_CONFIG_SUFFIX} file in folder: \\\$FIP_DEPLOYDIR_FWCONF or '\\\$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/fwconfig'"
FIP_FWCONFIG="--fw-config \$FIP_DEPLOYDIR_FWCONF/\${dt}-${FIP_FW_CONFIG}-\${config}.${FIP_FW_CONFIG_SUFFIX}"
# Init FIP hw-config settings
[ -f "\$FIP_DEPLOYDIR_UBOOT/${FIP_UBOOT_DTB}-\${dt}-${FIP_UBOOT_CONFIG}.${FIP_UBOOT_DTB_SUFFIX}" ] || bbfatal "Missing ${FIP_UBOOT_DTB}-\${dt}-${FIP_UBOOT_CONFIG}.${FIP_UBOOT_DTB_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_UBOOT' or '\\\$FIP_DEPLOYDIR_ROOT/u-boot'"
FIP_HWCONFIG="--hw-config \$FIP_DEPLOYDIR_UBOOT/${FIP_UBOOT_DTB}-\${dt}-${FIP_UBOOT_CONFIG}.${FIP_UBOOT_DTB_SUFFIX}"
# Init FIP nt-fw config
[ -f "\$FIP_DEPLOYDIR_UBOOT/${FIP_UBOOT}\${soc_suffix}.${FIP_UBOOT_SUFFIX}" ] || bbfatal "Missing ${FIP_UBOOT}\${soc_suffix}.${FIP_UBOOT_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_UBOOT' or '\\\$FIP_DEPLOYDIR_ROOT/u-boot'"
FIP_NTFW="--nt-fw \$FIP_DEPLOYDIR_UBOOT/${FIP_UBOOT}\${soc_suffix}.${FIP_UBOOT_SUFFIX}"
# Init FIP extra conf settings
if [ "\${bl32_conf}" = "tfa" ]; then
# Check for files
[ -f "\$FIP_DEPLOYDIR_TFA/${FIP_TFA}\${soc_suffix}.${FIP_TFA_SUFFIX}" ] || bbfatal "No ${FIP_TFA}\${soc_suffix}.${FIP_TFA_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_TFA' or '\\\$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/bl32'"
[ -f "\$FIP_DEPLOYDIR_TFA/\${dt}-${FIP_TFA_DTB}.${FIP_TFA_DTB_SUFFIX}" ] || bbfatal "No \${dt}-${FIP_TFA_DTB}.${FIP_TFA_DTB_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_TFA' or '\\\$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware/bl32'"
# Set FIP_EXTRACONF
FIP_EXTRACONF="\\
--tos-fw \$FIP_DEPLOYDIR_TFA/${FIP_TFA}\${soc_suffix}.${FIP_TFA_SUFFIX} \\
--tos-fw-config \$FIP_DEPLOYDIR_TFA/\${dt}-${FIP_TFA_DTB}.${FIP_TFA_DTB_SUFFIX} \\
"
elif [ "\${bl32_conf}" = "optee" ]; then
# Check for files
[ -f "\$FIP_DEPLOYDIR_OPTEE/${FIP_OPTEE_HEADER}-\${dt}.${FIP_OPTEE_SUFFIX}" ] || bbfatal "Missing ${FIP_OPTEE_HEADER}-\${dt}.${FIP_OPTEE_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_OPTEE' or '\\\$FIP_DEPLOYDIR_ROOT/optee'"
[ -f "\$FIP_DEPLOYDIR_OPTEE/${FIP_OPTEE_PAGER}-\${dt}.${FIP_OPTEE_SUFFIX}" ] || bbfatal "Missing ${FIP_OPTEE_PAGER}-\${dt}.${FIP_OPTEE_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_OPTEE' or '\\\$FIP_DEPLOYDIR_ROOT/optee'"
[ -f "\$FIP_DEPLOYDIR_OPTEE/${FIP_OPTEE_PAGEABLE}-\${dt}.${FIP_OPTEE_SUFFIX}" ] || bbfatal "Missing ${FIP_OPTEE_PAGEABLE}-\${dt}.${FIP_OPTEE_SUFFIX} file in folder: '\\\$FIP_DEPLOYDIR_OPTEE' or '\\\$FIP_DEPLOYDIR_ROOT/optee'"
# Set FIP_EXTRACONF
FIP_EXTRACONF="\\
--tos-fw \$FIP_DEPLOYDIR_OPTEE/${FIP_OPTEE_HEADER}-\${dt}.${FIP_OPTEE_SUFFIX} \\
--tos-fw-extra1 \$FIP_DEPLOYDIR_OPTEE/${FIP_OPTEE_PAGER}-\${dt}.${FIP_OPTEE_SUFFIX} \\
--tos-fw-extra2 \$FIP_DEPLOYDIR_OPTEE/${FIP_OPTEE_PAGEABLE}-\${dt}.${FIP_OPTEE_SUFFIX} \\
"
else
bbfatal "Wrong configuration '\${bl32_conf}' found in FIP_CONFIG for \${config} config."
fi
# Generate FIP binary
echo "[${FIPTOOL}] Create ${FIP_BASENAME}-\${dt}-\${config}.${FIP_SUFFIX} fip binary into 'FIP_DEPLOYDIR_FIP' folder..."
[ -d "\$FIP_DEPLOYDIR_FIP" ] || mkdir -p "\$FIP_DEPLOYDIR_FIP"
${FIPTOOL} create \\
\$FIP_FWCONFIG \\
\$FIP_HWCONFIG \\
\$FIP_NTFW \\
\$FIP_EXTRACONF \\
\$FIP_DEPLOYDIR_FIP/${FIP_BASENAME}-\${dt}-\${config}.${FIP_SUFFIX}
echo "[${FIPTOOL}] Done"
done
done
EOF
# Install the FIPTOOL_WRAPPER
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/${FIPTOOL_WRAPPER} ${D}${bindir}/
}
# Feed package for sdk with our fiptool wrapper
FILES_${FIPTOOL_WRAPPER}_class-nativesdk = "${bindir}/${FIPTOOL_WRAPPER}"

View File

@ -131,6 +131,22 @@ FLASHLAYOUT_PARTITION_BIN2LOAD ??= ""
FLASHLAYOUT_PARTITION_SIZE ??= "" FLASHLAYOUT_PARTITION_SIZE ??= ""
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS ??= "" FLASHLAYOUT_PARTITION_REPLACE_PATTERNS ??= ""
# The STM32CubeProgrammer supported ID range is:
# 0x00 to 0xFF
# Some IDs are reserved for internal usage on STM32CubeProgrammer and special
# management is implemented for binary with STM32 header. This means that for
# flashlayout files, available ID range is only:
# 0x01 to 0x0F for Boot partitions with STM32 header
# 0x10 to 0xF0 for User partitions programmed without header
# Note also that for FSBL and SSBL binaries loaded in RAM to program the devices
# there are two reserved IDs
# 0x01 for FSBL
# 0x03 for SSBL
FLASHLAYOUT_PARTITION_ID_START_BINARY ??= "0x04"
FLASHLAYOUT_PARTITION_ID_LIMIT_BINARY ??= "0x0F"
FLASHLAYOUT_PARTITION_ID_START_OTHERS ??= "0x10"
FLASHLAYOUT_PARTITION_ID_LIMIT_OTHERS ??= "0xF0"
python __anonymous () { python __anonymous () {
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Make sure to add the flashlayout file creation after ROOTFS build # Make sure to add the flashlayout file creation after ROOTFS build
@ -178,6 +194,7 @@ python __anonymous () {
# We add the flashlayout file creation task just after the do_image_complete for ROOTFS build # 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) 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 from PARTITIONS_CONFIG
d.appendVarFlag('do_create_flashlayout_config', 'prefuncs', ' flashlayout_partition_config')
d.appendVarFlag('do_create_flashlayout_config', 'prefuncs', ' flashlayout_partition_image_config') d.appendVarFlag('do_create_flashlayout_config', 'prefuncs', ' flashlayout_partition_image_config')
} }
@ -230,13 +247,13 @@ def get_device(bootscheme, config, partition, d):
""" """
# Set device configuration # Set device configuration
device_configs = expand_var('FLASHLAYOUT_PARTITION_DEVICE', bootscheme, config, partition, d) device_configs = expand_var('FLASHLAYOUT_PARTITION_DEVICE', bootscheme, config, partition, d)
bb.note('>>> Selected FLASHLAYOUT_PARTITION_DEVICE: %s' % device_configs) bb.debug(1, '>>> Selected FLASHLAYOUT_PARTITION_DEVICE: %s' % device_configs)
if len(device_configs.split(',')) == 1: if len(device_configs.split(',')) == 1:
bb.note('>>> Only one device configuration set for %s partition for %s label for %s bootscheme' % (partition, config, bootscheme)) bb.debug(1, '>>> Only one device configuration set for %s partition for %s label for %s bootscheme' % (partition, config, bootscheme))
device = device_configs.split(':')[0] device = device_configs.split(':')[0]
else: else:
bb.note('>>> Multiple device configurations set for %s partition for %s label for %s bootscheme' % (partition, config, bootscheme)) bb.debug(1, '>>> Multiple device configurations set for %s partition for %s label for %s bootscheme' % (partition, config, bootscheme))
# Init default_device and device to empty string # Init default_device and device to empty string
default_device = '' default_device = ''
device = '' device = ''
@ -251,7 +268,7 @@ def get_device(bootscheme, config, partition, d):
if default_device != '': if default_device != '':
bb.fatal('Found two "default" device configuration for %s partition for %s label for %s bootscheme in FLASHLAYOUT_PARTITION_DEVICE var' % (partition, config, bootscheme)) bb.fatal('Found two "default" device configuration for %s partition for %s label for %s bootscheme in FLASHLAYOUT_PARTITION_DEVICE var' % (partition, config, bootscheme))
default_device = cfg_devc default_device = cfg_devc
bb.note('>>> Set default device configuration to %s' % default_device) bb.debug(1, '>>> Set default device configuration to %s' % default_device)
else: else:
# Find out if any device is configured for current partition # Find out if any device is configured for current partition
for p in cfg_part.split(): for p in cfg_part.split():
@ -263,13 +280,44 @@ def get_device(bootscheme, config, partition, d):
if default_device == '': if default_device == '':
bb.fatal('Not able to get device configuration for %s partition for %s label for %s bootscheme' % (partition, config, bootscheme)) bb.fatal('Not able to get device configuration for %s partition for %s label for %s bootscheme' % (partition, config, bootscheme))
else: else:
bb.note('>>> Configure device to default device setting') bb.debug(1, '>>> Configure device to default device setting')
device = default_device device = default_device
bb.note('>>> New device configured: %s' % device) bb.debug(1, '>>> New device configured: %s' % device)
# Return the value computed # Return the value computed
return device return device
def get_offset(new_offset, current_device, bootscheme, config, partition, d): def align_size(d, device, size, copy=1):
"""
This function returns the size in KiB for the selected device making sure to
align on erase block and taking into account the copy expected to fit for the
original size set
"""
# Make sure to use device name and not device type
device_types = (d.getVar('DEVICE_STORAGE_TYPES') or "").split()
if device in device_types:
device = d.getVar('DEVICE_%s' % device) or ""
# Get device alignment size
alignment_size = d.getVar('DEVICE_ALIGNMENT_SIZE_%s' % device) or "none"
if alignment_size == 'none':
bb.fatal('Missing DEVICE_ALIGNMENT_SIZE_%s value' % device)
# Check for default size alignment on erase block
if ( int(size) * 1024 ) % int(alignment_size, 16) == 0:
bb.debug(1, '>>> The partition size properly follows %s erase size' % alignment_size)
else:
bb.debug(1, '>>> The %s alignment size is: %s' % (device, alignment_size))
floor_coef = ( int(size) * 1024 ) // int(alignment_size, 16)
compute_size = ( floor_coef + 1 ) * int(alignment_size, 16) * int(copy)
# Set size in KiB
size = compute_size // 1024
# Compute size with requested copy
size = int(size) * int(copy)
# Convert to string
size = str(size)
bb.debug(1, '>>> New partition size configured to follow %s alignment size: %s' % (alignment_size, size))
# Return the computed size
return size
def get_offset(new_offset, copy, current_device, bootscheme, config, partition, d):
""" """
This function returns a couple of strings: offset, next_offset This function returns a couple of strings: offset, next_offset
The offset is the one to use in flashlayout file for the requested partition, The offset is the one to use in flashlayout file for the requested partition,
@ -284,106 +332,91 @@ def get_offset(new_offset, current_device, bootscheme, config, partition, d):
The next_offset is computed by first getting the FLASHLAYOUT_PARTITION_SIZE for The next_offset is computed by first getting the FLASHLAYOUT_PARTITION_SIZE for
the current partition, and we make sure to align properly the next_offset the current partition, and we make sure to align properly the next_offset
according to the DEVICE_ALIGNMENT_SIZE_<device> where <device> is feed from according to the DEVICE_ALIGNMENT_SIZE_<device> where <device> is feed from
'current_device' input. 'current_device' input and the number of copy expected to fit in partition.
""" """
import re import re
# Get current_device alias # Get current_device alias
device_alias = d.getVar('DEVICE_%s' % current_device) or "" device_alias = d.getVar('DEVICE_%s' % current_device) or ""
# Set offset # Set offset
offset = expand_var('FLASHLAYOUT_PARTITION_OFFSET', bootscheme, config, partition, d) offset = expand_var('FLASHLAYOUT_PARTITION_OFFSET', bootscheme, config, partition, d)
bb.note('>>> 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)
if offset == 'none': if offset == 'none':
if new_offset == 'none': if new_offset == 'none':
bb.note('>>> 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)) 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))
start_offset = d.getVar('DEVICE_START_OFFSET_%s' % device_alias) or "none" start_offset = d.getVar('DEVICE_START_OFFSET_%s' % device_alias) or "none"
if start_offset == 'none': if start_offset == 'none':
bb.fatal('Missing DEVICE_START_OFFSET_%s value' % device_alias) bb.fatal('Missing DEVICE_START_OFFSET_%s value' % device_alias)
offset = start_offset offset = start_offset
else: else:
offset = new_offset offset = new_offset
bb.note('>>> New offset configured: %s' % offset) bb.debug(1, '>>> New offset configured: %s' % offset)
# Set next offset # Set next offset
partition_size = expand_var('FLASHLAYOUT_PARTITION_SIZE', bootscheme, config, partition, d) partition_size = expand_var('FLASHLAYOUT_PARTITION_SIZE', bootscheme, config, partition, d)
bb.note('>>> Selected FLASHLAYOUT_PARTITION_SIZE: %s' % partition_size) bb.debug(1, '>>> Selected FLASHLAYOUT_PARTITION_SIZE: %s' % partition_size)
if not partition_size.isdigit(): if not partition_size.isdigit():
bb.note('No partition size provided for %s partition, %s label and %s bootscheme!' % (partition, config, bootscheme)) bb.debug(1, 'No partition size provided for %s partition, %s label and %s bootscheme!' % (partition, config, bootscheme))
next_offset = "none" next_offset = "none"
max_offset = "none"
else: else:
if re.match('^0x.*$', offset): if re.match('^0x.*$', offset):
bb.note('>>> Current device is %s (%s alias)' % (current_device, device_alias)) bb.debug(1, '>>> Current device is %s (%s alias), and %s copy is set' % (current_device, device_alias, copy))
alignment_size = d.getVar('DEVICE_ALIGNMENT_SIZE_%s' % device_alias) or "none" partition_size = align_size(d, device_alias, partition_size, copy)
if alignment_size == 'none':
bb.fatal('Missing DEVICE_ALIGNMENT_SIZE_%s value' % device_alias)
if ( int(partition_size) * 1024 ) % int(alignment_size, 16) == 0:
bb.note('>>> The partition size properly follows %s erase size' % alignment_size)
else:
bb.note('>>> The %s alignment size is: %s' % (current_device, alignment_size))
floor_coef = ( int(partition_size) * 1024 ) // int(alignment_size, 16)
compute_size = ( floor_coef + 1 ) * int(alignment_size, 16)
partition_size = str(compute_size // 1024)
bb.note('>>> New partition size configured to follow %s alignment size: %s' % (alignment_size, partition_size))
# Compute new offset value # Compute new offset value
overall_size = int(offset, 16) + int(partition_size) * 1024 overall_size = int(offset, 16) + int(partition_size) * 1024
next_offset = '0x{0:0{1}X}'.format(overall_size, 8) next_offset = '0x{0:0{1}X}'.format(overall_size, 8)
# Check if the next offset will exceed the size of the storage
if max_offset != "none":
if int(next_offset, 0) <= int(max_offset, 0):
# still some place, do not return max offset
max_offset = "none"
else: else:
next_offset = "none" next_offset = "none"
bb.note('>>> New next_offset configured: %s' % next_offset) max_offset = "none"
bb.debug(1, '>>> New next_offset configured: %s' % next_offset)
# Return both offset and next offset # Return offset, next offset and max offset
return str(offset), str(next_offset) return str(offset), str(next_offset), str(max_offset)
def get_binaryname(labeltype, bootscheme, config, partition, d): def get_binaryname(labeltype, device, bootscheme, config, partition, d):
""" """
Return proper binary name to use in flashlayout file by applying any specific Return proper binary name to use in flashlayout file by applying any specific
computation (replacement, etc) computation (replacement, etc)
Make sure also that binary is available on deploy folder Make sure also that binary is available on deploy folder
""" """
import re import re
# Init binary_name for current configuration # Init binary_name for current configuration
binary_name = expand_var('FLASHLAYOUT_PARTITION_BIN2LOAD', bootscheme, config, partition, d) binary_name = expand_var('FLASHLAYOUT_PARTITION_BIN2LOAD', bootscheme, config, partition, d)
bb.note('>>> Selected FLASHLAYOUT_PARTITION_BIN2LOAD: %s' % binary_name) bb.debug(1, '>>> Selected FLASHLAYOUT_PARTITION_BIN2LOAD: %s' % binary_name)
# Set 'device' to alias name in lower case
if device != 'none':
device = d.getVar('DEVICE_%s' % device).lower()
# Init pattern to look for with current config value
update_patterns = '<BOOTSCHEME>;' + bootscheme
update_patterns += ' ' + '<CONFIG>;' + config.replace("-","_")
update_patterns += ' ' + '<DEVICE>;' + device
update_patterns += ' ' + '<TYPE>;' + labeltype
bb.debug(1, '>>> Default substitution patterns: %s' % update_patterns)
# Get binary_name basename to then check for any rename case replace_patterns = expand_var('FLASHLAYOUT_PARTITION_REPLACE_PATTERNS', bootscheme, config, partition, d)
binary_name_base = os.path.basename(binary_name) if replace_patterns != 'none':
bb.note('>>> Basename selected for %s: %s' % (binary_name, binary_name_base)) bb.debug(1, '>>> Substitution pattern addons: %s' % replace_patterns)
# Append substitution patterns to update pattern list
# Treat TF-A, TEE, U-BOOT and U-BOOT-SPL binary rename case update_patterns += ' ' + replace_patterns
if re.match('^tf-a.*$', binary_name_base) or re.match('^u-boot.*$', binary_name_base) or re.match('^tee-.*$', binary_name_base) or re.match('^zImage-.*$', binary_name_base): # Apply pattern substitution to binary name
file_name, file_ext = os.path.splitext(binary_name) for pattern in update_patterns.split():
# Init binary_type to use from labeltype pattern2replace = pattern.split(';')[0]
binary_type = labeltype + '-' + bootscheme pattern2use = pattern.split(';')[1]
bb.note('>>> Binary type used: %s' % binary_type) if re.search(r'[-_]%s([-_.]|$)' % pattern2replace, binary_name):
# Check for any replace pattern if pattern2use == "":
replace_patterns = expand_var('FLASHLAYOUT_PARTITION_REPLACE_PATTERNS', bootscheme, config, partition, d) # Remove pattern
bb.note('>>> Substitution patterns: %s' % replace_patterns) binary_name = re.sub(r'[-_]%s([-_.]|$)' % pattern2replace, r'\1', binary_name)
# Apply replacement patterns on binary_type else:
if replace_patterns != 'none': # Replace pattern
for replace_pattern in replace_patterns.split(): binary_name = re.sub(r'([-_])%s([-_.]|$)' % pattern2replace, r'\1%s\2' % pattern2use, binary_name)
pattern2replace = replace_pattern.split(';')[0] bb.debug(1, '>>> New binary name: %s' % binary_name)
pattern2use = replace_pattern.split(';')[1]
# Replace with pattern middle of string
binary_type = re.sub(r'-%s-' % pattern2replace, '-' + pattern2use + '-', binary_type)
# Replace with pattern end of string
binary_type = re.sub(r'-%s$' % pattern2replace, '-' + pattern2use, binary_type)
bb.note('>>> New "binary_type" to use for binary name": %s' % binary_type)
# Append binary_type to binary name
if re.match('^u-boot-spl.*$', binary_name_base):
binary_name = file_name + file_ext + '-' + binary_type
elif re.match('^zImage.*$', binary_name_base):
binary_name = file_name + '-' + labeltype + file_ext
else:
binary_name = file_name + '-' + binary_type + file_ext
# Make sure binary is available in DEPLOY_DIR_IMAGE folder
if binary_name != 'none':
if not os.path.isfile(os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), binary_name)):
# Specific exception for rootfs binary (not yet deployed)
if not os.path.isfile(os.path.join(d.getVar('IMGDEPLOYDIR'), binary_name)):
bb.fatal('Missing %s binary file in deploy folder' % binary_name)
# Return binary_name value # Return binary_name value
return binary_name return binary_name
@ -402,7 +435,7 @@ python do_create_flashlayout_config() {
# We check first if it is requested to generate any flashlayout files # We check first if it is requested to generate any flashlayout files
if d.getVar("ENABLE_FLASHLAYOUT_CONFIG") != "1": if d.getVar("ENABLE_FLASHLAYOUT_CONFIG") != "1":
bb.note('ENABLE_FLASHLAYOUT_CONFIG not enabled') bb.debug(1, 'ENABLE_FLASHLAYOUT_CONFIG not enabled')
return return
# Create destination folder for flashlayout files # Create destination folder for flashlayout files
@ -411,7 +444,7 @@ python do_create_flashlayout_config() {
# We check if user as define a static flashlayout file to use instead of dynamic generation # We check if user as define a static flashlayout file to use instead of dynamic generation
if d.getVar("ENABLE_FLASHLAYOUT_DEFAULT") == "1": if d.getVar("ENABLE_FLASHLAYOUT_DEFAULT") == "1":
bb.note('ENABLE_FLASHLAYOUT_DEFAULT enabled') bb.debug(1, 'ENABLE_FLASHLAYOUT_DEFAULT enabled')
flashlayout_src = d.getVar("FLASHLAYOUT_DEFAULT_SRC") flashlayout_src = d.getVar("FLASHLAYOUT_DEFAULT_SRC")
if not flashlayout_src: if not flashlayout_src:
bb.fatal("FLASHLAYOUT_DEFAULT_SRC not defined, please set a proper value") bb.fatal("FLASHLAYOUT_DEFAULT_SRC not defined, please set a proper value")
@ -423,7 +456,7 @@ python do_create_flashlayout_config() {
flashlayout_staticname=os.path.basename(f) flashlayout_staticname=os.path.basename(f)
flashlayout_file = os.path.join(d.getVar('FLASHLAYOUT_DESTDIR'), flashlayout_staticname) flashlayout_file = os.path.join(d.getVar('FLASHLAYOUT_DESTDIR'), flashlayout_staticname)
shutil.copy2(f, flashlayout_file) shutil.copy2(f, flashlayout_file)
bb.note('Copy %s to output file %s' % (f, flashlayout_file)) bb.debug(1, 'Copy %s to output file %s' % (f, flashlayout_file))
else: else:
bb.fatal("Configure static file: %s not found" % fl_src) bb.fatal("Configure static file: %s not found" % fl_src)
return return
@ -438,35 +471,35 @@ python do_create_flashlayout_config() {
for bootscheme in bootschemes.split(): for bootscheme in bootschemes.split():
if re.match('.*_.*', bootscheme): if re.match('.*_.*', bootscheme):
bb.fatal("Please remove all '_' for bootschemes defined in FLASHLAYOUT_BOOTSCHEME_LABELS") bb.fatal("Please remove all '_' for bootschemes defined in FLASHLAYOUT_BOOTSCHEME_LABELS")
bb.note('FLASHLAYOUT_BOOTSCHEME_LABELS: %s' % bootschemes) bb.debug(1, 'FLASHLAYOUT_BOOTSCHEME_LABELS: %s' % bootschemes)
for bootscheme in bootschemes.split(): for bootscheme in bootschemes.split():
bb.note('*** Loop for bootscheme label: %s' % bootscheme) bb.debug(1, '*** Loop for bootscheme label: %s' % bootscheme)
# Get the different flashlayout config label # Get the different flashlayout config label
configs = expand_var('FLASHLAYOUT_CONFIG_LABELS', bootscheme, '', '', d) configs = expand_var('FLASHLAYOUT_CONFIG_LABELS', bootscheme, '', '', d)
# Make sure there is no '_' in FLASHLAYOUT_CONFIG_LABELS # Make sure there is no '_' in FLASHLAYOUT_CONFIG_LABELS
for config in configs.split(): for config in configs.split():
if re.match('.*_.*', config): if re.match('.*_.*', config):
bb.fatal("Please remove all '_' for configs defined in FLASHLAYOUT_CONFIG_LABELS") bb.fatal("Please remove all '_' for configs defined in FLASHLAYOUT_CONFIG_LABELS")
bb.note('FLASHLAYOUT_CONFIG_LABELS: %s' % configs) bb.debug(1, 'FLASHLAYOUT_CONFIG_LABELS: %s' % configs)
if configs.strip() == 'none': if configs.strip() == 'none':
bb.note("FLASHLAYOUT_CONFIG_LABELS is none, so no flashlayout file to generate.") bb.debug(1, "FLASHLAYOUT_CONFIG_LABELS is none, so no flashlayout file to generate.")
continue continue
# Create bootscheme subfolder for flashlayout files # Create bootscheme subfolder for flashlayout files
flashlayout_subfolder_path = os.path.join(d.getVar('FLASHLAYOUT_DESTDIR'), bootscheme) flashlayout_subfolder_path = os.path.join(d.getVar('FLASHLAYOUT_DESTDIR'), bootscheme)
bb.utils.mkdirhier(flashlayout_subfolder_path) bb.utils.mkdirhier(flashlayout_subfolder_path)
for config in configs.split(): for config in configs.split():
bb.note('*** Loop for config label: %s' % config) bb.debug(1, '*** Loop for config label: %s' % config)
# Set labeltypes list # Set labeltypes list
labeltypes = expand_var('FLASHLAYOUT_TYPE_LABELS', bootscheme, config, '', d) labeltypes = expand_var('FLASHLAYOUT_TYPE_LABELS', bootscheme, config, '', d)
bb.note('FLASHLAYOUT_TYPE_LABELS: %s' % labeltypes) bb.debug(1, 'FLASHLAYOUT_TYPE_LABELS: %s' % labeltypes)
if labeltypes.strip() == 'none': if labeltypes.strip() == 'none':
bb.note("FLASHLAYOUT_TYPE_LABELS is none, so no flashlayout file to generate.") bb.debug(1, "FLASHLAYOUT_TYPE_LABELS is none, so no flashlayout file to generate.")
continue continue
for labeltype in labeltypes.split(): for labeltype in labeltypes.split():
bb.note('*** Loop for label type: %s' % labeltype) bb.debug(1, '*** Loop for label type: %s' % labeltype)
# Init current label # Init current label
current_label = labeltype current_label = labeltype
# Init flashlayout file name # Init flashlayout file name
@ -481,26 +514,51 @@ python do_create_flashlayout_config() {
flashlayout_file = os.path.join(flashlayout_subfolder_path, d.expand("${FLASHLAYOUT_BASENAME}%s%s.${FLASHLAYOUT_SUFFIX}" % (config_append, labeltype_append))) flashlayout_file = os.path.join(flashlayout_subfolder_path, d.expand("${FLASHLAYOUT_BASENAME}%s%s.${FLASHLAYOUT_SUFFIX}" % (config_append, labeltype_append)))
# Get the partition list to write in flashlayout file # Get the partition list to write in flashlayout file
partitions = expand_var('FLASHLAYOUT_PARTITION_LABELS', bootscheme, config, '', d) partitions = expand_var('FLASHLAYOUT_PARTITION_LABELS', bootscheme, config, '', d)
bb.note('FLASHLAYOUT_PARTITION_LABELS: %s' % partitions) bb.debug(1, 'FLASHLAYOUT_PARTITION_LABELS: %s' % partitions)
if partitions == 'none': if partitions == 'none':
bb.note("FLASHLAYOUT_PARTITION_LABELS is none, so no flashlayout file to generate.") bb.debug(1, "FLASHLAYOUT_PARTITION_LABELS is none, so no flashlayout file to generate.")
continue continue
# Generate flashlayout file for labeltype # Generate flashlayout file for labeltype
try: try:
with open(flashlayout_file, 'w') as fl_file: with open(flashlayout_file, 'w') as fl_file:
# Write to flashlayout file the first line header # Write to flashlayout file the first line header
fl_file.write('#Opt\tId\tName\tType\tIP\tOffset\tBinary\n') fl_file.write('#Opt\tId\tName\tType\tIP\tOffset\tBinary\n')
# Init partition id for binary and other
partition_id_bin = int(d.getVar("FLASHLAYOUT_PARTITION_ID_START_BINARY"), 16)
partition_id_binmax = int(d.getVar("FLASHLAYOUT_PARTITION_ID_LIMIT_BINARY"), 16)
partition_id_oth = int(d.getVar("FLASHLAYOUT_PARTITION_ID_START_OTHERS"), 16)
partition_id_othmax = int(d.getVar("FLASHLAYOUT_PARTITION_ID_LIMIT_OTHERS"), 16)
# Init partition next offset to 'none' # Init partition next offset to 'none'
partition_nextoffset = "none" partition_nextoffset = "none"
# Init partition previous device to 'none' # Init partition previous device to 'none'
partition_prevdevice = "none" partition_prevdevice = "none"
for partition in partitions.split(): for partition in partitions.split():
bb.note('*** Loop for partition: %s' % partition) bb.debug(1, '*** Loop for partition: %s' % partition)
# Init partition settings # Init partition settings
partition_enable = expand_var('FLASHLAYOUT_PARTITION_ENABLE', bootscheme, config, partition, d) partition_enable = expand_var('FLASHLAYOUT_PARTITION_ENABLE', bootscheme, config, partition, d)
partition_id = expand_var('FLASHLAYOUT_PARTITION_ID', bootscheme, config, partition, d)
partition_name = partition partition_name = partition
partition_type = expand_var('FLASHLAYOUT_PARTITION_TYPE', bootscheme, config, partition, d) partition_type = expand_var('FLASHLAYOUT_PARTITION_TYPE', bootscheme, config, partition, d)
partition_id = expand_var('FLASHLAYOUT_PARTITION_ID', bootscheme, config, partition, d)
if partition_id == "none":
# Compute partition_id
if partition_type == 'Binary':
# Make sure we're not getting wrong partition_id
if partition_id_bin > partition_id_binmax:
bb.fatal('Partition ID exceed %s limit for %s type: FLASHLAYOUT_PARTITION_ID = %s (bootscheme: %s, config: %s, partition: %s)' % (d.getVar("FLASHLAYOUT_PARTITION_ID_LIMIT_BINARY"), partition_type, partition_id, bootscheme, config, partition))
partition_id = '0x{0:0{1}X}'.format(partition_id_bin, 2)
partition_id_bin = partition_id_bin + 1
else:
# Make sure we're not getting wrong partition_id
if partition_id_oth > partition_id_othmax:
bb.fatal('Partition ID exceed %s limit for %s type: FLASHLAYOUT_PARTITION_ID = %s (bootscheme: %s, config: %s, partition: %s)' % (d.getVar("FLASHLAYOUT_PARTITION_ID_LIMIT_OTHERS"), partition_type, partition_id, bootscheme, config, partition))
partition_id = '0x{0:0{1}X}'.format(partition_id_oth, 2)
partition_id_oth = partition_id_oth + 1
partition_copy = expand_var('FLASHLAYOUT_PARTITION_COPY', bootscheme, config, partition, d)
if not partition_copy.isdigit():
bb.fatal('Wrong configuration for FLASHLAYOUT_PARTITION_COPY: %s (bootscheme: %s, config: %s, partition: %s)' % (partition_copy, bootscheme, config, partition))
# Update partition type if needed
if partition_copy != "1":
partition_type += '(' + partition_copy + ')'
partition_device = get_device(bootscheme, config, partition, d) partition_device = get_device(bootscheme, config, partition, d)
# Reset partition_nextoffset to 'none' in case partition device has changed # Reset partition_nextoffset to 'none' in case partition device has changed
if partition_device != partition_prevdevice: if partition_device != partition_prevdevice:
@ -508,26 +566,43 @@ python do_create_flashlayout_config() {
# Save partition current device to previous one for next loop # Save partition current device to previous one for next loop
partition_prevdevice = partition_device partition_prevdevice = partition_device
# Get partition offset # Get partition offset
partition_offset, partition_nextoffset = get_offset(partition_nextoffset, partition_device, bootscheme, config, partition, d) 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 # Get binary name
partition_bin2load = get_binaryname(labeltype, bootscheme, config, partition, d) partition_bin2load = get_binaryname(labeltype, partition_device, bootscheme, config, partition, d)
# Be verbose in log file # Be verbose in log file
bb.note('>>> Layout inputs: %s' % fl_file.name) bb.debug(1, '>>> Layout inputs: %s' % fl_file.name)
bb.note('>>> FLASHLAYOUT_PARTITION_ENABLE: %s' % partition_enable) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_ENABLE: %s' % partition_enable)
bb.note('>>> FLASHLAYOUT_PARTITION_ID: %s' % partition_id) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_ID: %s' % partition_id)
bb.note('>>> FLASHLAYOUT_PARTITION_LABEL: %s' % partition_name) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_LABEL: %s' % partition_name)
bb.note('>>> FLASHLAYOUT_PARTITION_TYPE: %s' % partition_type) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_TYPE: %s' % partition_type)
bb.note('>>> FLASHLAYOUT_PARTITION_DEVICE: %s' % partition_device) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_DEVICE: %s' % partition_device)
bb.note('>>> FLASHLAYOUT_PARTITION_OFFSET: %s' % partition_offset) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_OFFSET: %s' % partition_offset)
bb.note('>>> FLASHLAYOUT_PARTITION_BIN2LOAD: %s' % partition_bin2load) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_BIN2LOAD: %s' % partition_bin2load)
bb.note('>>> done') bb.debug(1, '>>> done')
# Make sure binary is available in DEPLOY_DIR_IMAGE 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)
# Get the supported labels for current storage device # Get the supported labels for current storage device
partition_device_alias = d.getVar('DEVICE_%s' % partition_device) or "" 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" partition_type_supported_labels = d.getVar('DEVICE_BOARD_ENABLE_%s' % partition_device_alias) or "none"
# Check if partition type is supported for the current label # Check if partition type is supported for the current label
if partition_device != 'none' and current_label not in partition_type_supported_labels.split(): if partition_device != 'none' and current_label not in partition_type_supported_labels.split():
bb.note('>>> FLASHLAYOUT_PARTITION_DEVICE (%s, alias %s) is not supported for current label (%s): partition %s not appended in flashlayout file' % (partition_device, partition_device_alias, current_label, partition_name)) bb.debug(1, '>>> FLASHLAYOUT_PARTITION_DEVICE (%s, alias %s) is not supported for current label (%s): partition %s not appended in flashlayout file' % (partition_device, partition_device_alias, current_label, partition_name))
bb.note('>>> DEVICE_BOARD_ENABLE_%s: %s' % (partition_device_alias, partition_type_supported_labels)) bb.debug(1, '>>> DEVICE_BOARD_ENABLE_%s: %s' % (partition_device_alias, partition_type_supported_labels))
continue continue
# Write to flashlayout file the partition configuration # Write to flashlayout file the partition configuration
fl_file.write('%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % fl_file.write('%s\t%s\t%s\t%s\t%s\t%s\t%s\n' %
@ -535,8 +610,12 @@ python do_create_flashlayout_config() {
except OSError: except OSError:
bb.fatal('Unable to open %s' % (fl_file)) bb.fatal('Unable to open %s' % (fl_file))
if not os.path.exists(flashlayout_file):
# The tsv does not exist, so cannot generate the tsv for wrapper4dbg
break
if d.getVar("ENABLE_FLASHLAYOUT_CONFIG_WRAPPER4DBG") == "1": if d.getVar("ENABLE_FLASHLAYOUT_CONFIG_WRAPPER4DBG") == "1":
bb.note('*** Loop for flashlayout for the wrapper for debug %s' % labeltype) bb.debug(1, '*** Loop for flashlayout for the wrapper for debug %s' % labeltype)
tmp_flashlayout_file = os.path.join(flashlayout_subfolder_path, "flashlayout.tmp") tmp_flashlayout_file = os.path.join(flashlayout_subfolder_path, "flashlayout.tmp")
debug_flashlayout = False debug_flashlayout = False
@ -563,7 +642,7 @@ python do_create_flashlayout_config() {
bb.utils.mkdirhier(flashlayout_wrapper4dbg_subfolder_path) bb.utils.mkdirhier(flashlayout_wrapper4dbg_subfolder_path)
# Wrapper4dbg output filename # Wrapper4dbg output filename
debug_flashlayout_file = os.path.join(flashlayout_wrapper4dbg_subfolder_path,d.expand("debug-${FLASHLAYOUT_BASENAME}%s%s.${FLASHLAYOUT_SUFFIX}" % (config_append, labeltype_append))) debug_flashlayout_file = os.path.join(flashlayout_wrapper4dbg_subfolder_path,d.expand("debug-${FLASHLAYOUT_BASENAME}%s%s.${FLASHLAYOUT_SUFFIX}" % (config_append, labeltype_append)))
bb.note(">>> Update tf-a in %s" % (debug_flashlayout_file)) bb.debug(1, ">>> Update tf-a in %s" % (debug_flashlayout_file))
os.rename(tmp_flashlayout_file, debug_flashlayout_file) os.rename(tmp_flashlayout_file, debug_flashlayout_file)
else: else:
os.remove(tmp_flashlayout_file) os.remove(tmp_flashlayout_file)
@ -583,16 +662,95 @@ python do_create_flashlayout_config_setscene () {
} }
addtask do_create_flashlayout_config_setscene addtask do_create_flashlayout_config_setscene
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>_
"""
# Init partition and flashlayout configuration vars
partitionconfig_list = 'PARTITIONS_BOOTLOADER_CONFIG PARTITIONS_OPTEE_CONFIG'
for partconfvar in partitionconfig_list.split():
partitionsconfigflags = d.getVarFlags(partconfvar)
# The "doc" varflag is special, we don't want to see it here
partitionsconfigflags.pop('doc', None)
partitionsconfig = (d.getVar(partconfvar) or "").split()
if len(partitionsconfig) > 0:
for config in partitionsconfig:
for f, v in partitionsconfigflags.items():
if config == f:
# Make sure to get var flag properly expanded
v = d.getVarFlag(partconfvar, config)
if not v.strip():
bb.fatal('[%s] Missing configuration for %s config' % (partconfvar, config))
for subconfigs in v.split():
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:
bb.fatal('[%s] Only partdata,partlabel,size,type,copy can be specified!' % partconfvar)
# Init flashlayout label
if items[1] and 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))))
else:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_ENABLE_%s_%s to 'P'." % (config, fl_label))
d.setVar('FLASHLAYOUT_PARTITION_ENABLE_%s_%s' % (config, fl_label), 'P')
if items[0] != '':
if d.getVar('FLASHLAYOUT_PARTITION_BIN2LOAD_%s_%s' % (config, fl_label)):
bb.debug(1, "FLASHLAYOUT_PARTITION_BIN2LOAD_%s_%s is already set to: %s." % (config, fl_label, d.getVar('FLASHLAYOUT_PARTITION_BIN2LOAD_%s_%s' % (config, fl_label))))
else:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_BIN2LOAD_%s_%s to %s." % (config, fl_label, items[0]))
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 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] != '':
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:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_TYPE_%s_%s to %s." % (config, fl_label, items[3]))
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 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)
break
}
python flashlayout_partition_image_config() { python flashlayout_partition_image_config() {
""" """
Set the different flashlayout partition vars for the configure partition Set the different flashlayout partition vars for the configure partition
images. images.
Based on PARTITIONS_CONFIG, feed: Based on PARTITIONS_CONFIG, feed:
FLASHLAYOUT_PARTITION_IMAGES FLASHLAYOUT_PARTITION_IMAGES
FLASHLAYOUT_PARTITION_ID_ FLASHLAYOUT_PARTITION_ENABLE_
FLASHLAYOUT_PARTITION_TYPE_
FLASHLAYOUT_PARTITION_SIZE_ FLASHLAYOUT_PARTITION_SIZE_
FLASHLAYOUT_PARTITION_BIN2LOAD_ FLASHLAYOUT_PARTITION_BIN2LOAD_
FLASHLAYOUT_PARTITION_TYPE_
""" """
partitionsconfigflags = d.getVarFlags('PARTITIONS_CONFIG') partitionsconfigflags = d.getVarFlags('PARTITIONS_CONFIG')
@ -601,9 +759,6 @@ python flashlayout_partition_image_config() {
partitionsconfig = (d.getVar('PARTITIONS_CONFIG') or "").split() partitionsconfig = (d.getVar('PARTITIONS_CONFIG') or "").split()
if len(partitionsconfig) > 0: if len(partitionsconfig) > 0:
# Init default partition id for binary type and other
id_bin = 4
id_oth = 33
for config in partitionsconfig: for config in partitionsconfig:
for f, v in partitionsconfigflags.items(): for f, v in partitionsconfigflags.items():
if config == f: if config == f:
@ -611,6 +766,9 @@ python flashlayout_partition_image_config() {
# Make sure about PARTITIONS_CONFIG contents # Make sure about PARTITIONS_CONFIG contents
if items[0] and len(items) > 5: if items[0] and len(items) > 5:
bb.fatal('[PARTITIONS_CONFIG] Only image,label,mountpoint,size,type can be specified!') 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]: if items[1]:
bb.debug(1, "Appending %s to FLASHLAYOUT_PARTITION_IMAGES." % items[1]) bb.debug(1, "Appending %s to FLASHLAYOUT_PARTITION_IMAGES." % items[1])
d.appendVar('FLASHLAYOUT_PARTITION_IMAGES', ' ' + items[1]) d.appendVar('FLASHLAYOUT_PARTITION_IMAGES', ' ' + items[1])
@ -618,6 +776,8 @@ python flashlayout_partition_image_config() {
bb.fatal('[PARTITIONS_CONFIG] Missing image label setting') bb.fatal('[PARTITIONS_CONFIG] Missing image label setting')
# Init flashlayout label # Init flashlayout label
fl_label = d.expand(items[1]) 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] == '': if items[2] == '':
# There is no mountpoint specified, so we apply rootfs image format # 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}.ext4")) bb.debug(1, "Set FLASHLAYOUT_PARTITION_BIN2LOAD_%s to %s." % (fl_label, items[0] + "-${MACHINE}.ext4"))
@ -629,19 +789,10 @@ python flashlayout_partition_image_config() {
bb.debug(1, "Set FLASHLAYOUT_PARTITION_SIZE_%s to %s." % (fl_label, 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]) d.setVar('FLASHLAYOUT_PARTITION_SIZE_%s' % fl_label, items[3])
else: else:
bb.fatal('[PARTITIONS_CONFIG] Missing PARTITION_SIZE setting for % label' % fl_label) bb.fatal('[PARTITIONS_CONFIG] Missing PARTITION_SIZE setting for %s label' % fl_label)
if items[4]: if items[4]:
bb.debug(1, "Set FLASHLAYOUT_PARTITION_TYPE_%s to %s." % (fl_label, 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]) d.setVar('FLASHLAYOUT_PARTITION_TYPE_%s' % fl_label, items[4])
# Compute partition id according to type set
if items[4] == 'Binary':
part_id = '0x{0:0{1}X}'.format(id_bin, 2)
id_bin = id_bin + 1
else:
part_id = '0x{0:0{1}X}'.format(id_oth, 2)
id_oth = id_oth + 1
bb.debug(1, "Set FLASHLAYOUT_PARTITION_ID_%s to %s." % (fl_label, part_id))
d.setVar('FLASHLAYOUT_PARTITION_ID_%s' % fl_label, "%s" % part_id)
else: else:
bb.fatal('[PARTITIONS_CONFIG] Missing PARTITION_TYPE setting for % label' % fl_label) bb.fatal('[PARTITIONS_CONFIG] Missing PARTITION_TYPE setting for % label' % fl_label)
break break
@ -653,14 +804,15 @@ python flashlayout_partition_image_config() {
# need to make sure to add each variables to the vardeps list. # need to make sure to add each variables to the vardeps list.
FLASHLAYOUT_LABELS_VARS = "CONFIG_LABELS PARTITION_LABELS TYPE_LABELS" FLASHLAYOUT_LABELS_VARS = "CONFIG_LABELS PARTITION_LABELS TYPE_LABELS"
FLASHLAYOUT_LABELS_OVERRIDES = "${@' '.join('%s %s %s_%s' % (b, c, b, c) for b in d.getVar('FLASHLAYOUT_BOOTSCHEME_LABELS').split() for c in d.getVar('FLASHLAYOUT_CONFIG_LABELS').split())}" FLASHLAYOUT_LABELS_OVERRIDES = "${FLASHLAYOUT_BOOTSCHEME_LABELS} ${FLASHLAYOUT_CONFIG_LABELS}"
FLASHLAYOUT_LABELS_OVERRIDES += "${@' '.join('%s_%s' % (b, c) for b in d.getVar('FLASHLAYOUT_BOOTSCHEME_LABELS').split() for c in d.getVar('FLASHLAYOUT_CONFIG_LABELS').split())}"
do_create_flashlayout_config[vardeps] += "${@' '.join(['FLASHLAYOUT_%s_%s' % (v, o) for v in d.getVar('FLASHLAYOUT_LABELS_VARS').split() for o in d.getVar('FLASHLAYOUT_LABELS_OVERRIDES').split()])}" do_create_flashlayout_config[vardeps] += "${@' '.join(['FLASHLAYOUT_%s_%s' % (v, o) for v in d.getVar('FLASHLAYOUT_LABELS_VARS').split() for o in d.getVar('FLASHLAYOUT_LABELS_OVERRIDES').split()])}"
FLASHLAYOUT_PARTITION_VARS = "ENABLE ID TYPE DEVICE OFFSET BIN2LOAD SIZE REPLACE_PATTERNS" FLASHLAYOUT_PARTITION_VARS = "ENABLE ID TYPE DEVICE OFFSET BIN2LOAD SIZE REPLACE_PATTERNS"
FLASHLAYOUT_PARTITION_CONFIGURED = "${@" ".join(map(lambda o: "%s" % d.getVar("FLASHLAYOUT_PARTITION_LABELS_%s" % o), d.getVar('FLASHLAYOUT_LABELS_OVERRIDES').split()))}" FLASHLAYOUT_PARTITION_CONFIGURED = "${@' '.join(dict.fromkeys(' '.join('%s' % d.getVar('FLASHLAYOUT_PARTITION_LABELS_%s' % o) for o in d.getVar('FLASHLAYOUT_LABELS_OVERRIDES').split()).split()))}"
FLASHLAYOUT_PARTITION_OVERRIDES = "${@' '.join('%s %s %s_%s' % (o, p, o, p) for o in d.getVar('FLASHLAYOUT_LABELS_OVERRIDES').split() for p in d.getVar('FLASHLAYOUT_PARTITION_CONFIGURED').split())}" FLASHLAYOUT_PARTITION_OVERRIDES = "${FLASHLAYOUT_LABELS_OVERRIDES} ${FLASHLAYOUT_PARTITION_CONFIGURED}"
FLASHLAYOUT_PARTITION_OVERRIDES += "${@' '.join('%s_%s' % (o, p) for o in d.getVar('FLASHLAYOUT_LABELS_OVERRIDES').split() for p in d.getVar('FLASHLAYOUT_PARTITION_CONFIGURED').split())}"
do_create_flashlayout_config[vardeps] += "${@' '.join(['FLASHLAYOUT_PARTITION_%s_%s' % (v, o) for v in d.getVar('FLASHLAYOUT_PARTITION_VARS').split() for o in d.getVar('FLASHLAYOUT_PARTITION_OVERRIDES').split()])}" do_create_flashlayout_config[vardeps] += "${@' '.join(['FLASHLAYOUT_PARTITION_%s_%s' % (v, o) for v in d.getVar('FLASHLAYOUT_PARTITION_VARS').split() for o in d.getVar('FLASHLAYOUT_PARTITION_OVERRIDES').split()])}"
FLASHLAYOUT_DEVICE_VARS = "ALIGNMENT_SIZE BOARD_ENABLE START_OFFSET" FLASHLAYOUT_DEVICE_VARS = "ALIGNMENT_SIZE BOARD_ENABLE START_OFFSET MAX_OFFSET"
FLASHLAYOUT_PARTITION_DEVICE_CONFIGURED = "${@" ".join(map(lambda p: "%s" % d.getVar("DEVICE_%s" % p), d.getVar('DEVICE_STORAGE_NAMES').split()))}" do_create_flashlayout_config[vardeps] += "${@' '.join(['DEVICE_%s_%s' % (v, o) for v in d.getVar('FLASHLAYOUT_DEVICE_VARS').split() for o in d.getVar('DEVICE_STORAGE_NAMES').split()])}"
do_create_flashlayout_config[vardeps] += "${@' '.join(['DEVICE_%s_%s' % (v, o) for v in d.getVar('FLASHLAYOUT_DEVICE_VARS').split() for o in d.getVar('FLASHLAYOUT_PARTITION_DEVICE_CONFIGURED').split()])}"

View File

@ -33,7 +33,6 @@ MACHINE_FEATURES = "usbhost usbgadget alsa screen ext2"
MACHINE_FEATURES_append = " ${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'optee', '', d)} " MACHINE_FEATURES_append = " ${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'optee', '', d)} "
MACHINE_FEATURES_append = " tpm2 " MACHINE_FEATURES_append = " tpm2 "
MACHINE_FEATURES_append = " autoresize "
# Remove autoresize package from DISTRO_EXTRA_RRECOMMENDS to add it explicitly # Remove autoresize package from DISTRO_EXTRA_RRECOMMENDS to add it explicitly
# in our bootfs image instead of rootfs # in our bootfs image instead of rootfs
DISTRO_EXTRA_RRECOMMENDS_remove = "${@bb.utils.contains('COMBINED_FEATURES', 'autoresize', '${AUTORESIZE}', '', d)}" DISTRO_EXTRA_RRECOMMENDS_remove = "${@bb.utils.contains('COMBINED_FEATURES', 'autoresize', '${AUTORESIZE}', '', d)}"
@ -41,6 +40,9 @@ DISTRO_EXTRA_RRECOMMENDS_remove = "${@bb.utils.contains('COMBINED_FEATURES', 'au
# Use Little Kernel loader to program storage device # Use Little Kernel loader to program storage device
MACHINE_FEATURES += "kloader" MACHINE_FEATURES += "kloader"
# Use FIP image for boot loaders
MACHINE_FEATURES += "fip"
# Default serial consoles (TTYs) to enable using getty # Default serial consoles (TTYs) to enable using getty
# Before kernel 4.18, serial console are ttyS3 but after is ttySTM0 # Before kernel 4.18, serial console are ttyS3 but after is ttySTM0
SERIAL_CONSOLES = "115200;ttySTM0" SERIAL_CONSOLES = "115200;ttySTM0"
@ -67,6 +69,116 @@ STM32MP_DEVICETREE_append = " ${STM32MP_DT_FILES_EV} "
# Enable Software watchdog when sysvinit # Enable Software watchdog when sysvinit
MACHINE_EXTRA_RRECOMMENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','sysvinit',' watchdog ','',d)} " MACHINE_EXTRA_RRECOMMENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','sysvinit',' watchdog ','',d)} "
# =========================================================================
# Bootloader raw partition configuration : data, label, size (Kbytes)
# =========================================================================
# -----------------------------------------------------------------------------
# NOTE: There are few restrictions to follow:
# - The partition for the first boot loader should follow the naming
# rule: fsbl*
# - The partition for the secondary boot loader should follow the naming
# rule: ssbl or fip
# -----------------------------------------------------------------------------
STM32MP_FSBL1_DATA ?= "${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'arm-trusted-firmware/tf-a-<TYPE>-<DEVICE>.stm32', 'arm-trusted-firmware/tf-a-<TYPE>-<BOOTSCHEME>.stm32', d)}"
STM32MP_FSBL1_NAME ?= "fsbl1"
STM32MP_FSBL1_SIZE ?= "256"
STM32MP_FSBL2_DATA ?= "${STM32MP_FSBL1_DATA}"
STM32MP_FSBL2_NAME ?= "fsbl2"
STM32MP_FSBL2_SIZE ?= "${STM32MP_FSBL1_SIZE}"
STM32MP_SSBL1_DATA ?= "${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'fip/fip-<TYPE>-<BOOTSCHEME>${FIP_SIGN_SUFFIX}.bin', 'u-boot/u-boot-<TYPE>-trusted.stm32', d)}"
STM32MP_SSBL1_NAME ?= "${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'fip', 'ssbl', d)}"
STM32MP_SSBL1_SIZE ?= "${@bb.utils.contains('MACHINE_FEATURES', 'fip', '4096', '2048', d)}"
STM32MP_SSBL2_DATA ?= "${STM32MP_SSBL1_DATA}"
STM32MP_SSBL2_NAME ?= "${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'fip2', 'ssbl2', d)}"
STM32MP_SSBL2_SIZE ?= "${STM32MP_SSBL1_SIZE}"
STM32MP_UENV_DATA ?= ""
STM32MP_UENV_NAME ?= "env"
STM32MP_UENV_SIZE ?= "512"
STM32MP_TEEH_DATA ?= "optee/tee-header_v2-<TYPE>.stm32"
STM32MP_TEEH_NAME ?= "teeh"
STM32MP_TEEH_SIZE ?= "256"
STM32MP_TEED_DATA ?= "optee/tee-pageable_v2-<TYPE>.stm32"
STM32MP_TEED_NAME ?= "teed"
STM32MP_TEED_SIZE ?= "512"
STM32MP_TEEX_DATA ?= "optee/tee-pager_v2-<TYPE>.stm32"
STM32MP_TEEX_NAME ?= "teex"
STM32MP_TEEX_SIZE ?= "256"
# Specific override for NAND device type regarding partition sizes to follow
# the hard coded configuration on U-Boot source code
STM32MP_FSBL1_SIZE_UBOOT ?= "1024"
STM32MP_TEEH_SIZE_UBOOT ?= "512"
STM32MP_TEEX_SIZE_UBOOT ?= "512"
# Bootloader Partitions configuration
PARTITIONS_BOOTLOADER_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', 'emmc', '', d)}"
PARTITIONS_BOOTLOADER_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand-4-256', '', d)}"
PARTITIONS_BOOTLOADER_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'nor-sdcard', '', d)}"
PARTITIONS_BOOTLOADER_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', 'sdcard', '', d)}"
PARTITIONS_BOOTLOADER_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'spinand-2-128', '', d)}"
# <binary_name>,<partlabel>,<size>,<type>,<copy>
PARTITIONS_BOOTLOADER_CONFIG[emmc] ?= "\
${@ '${STM32MP_FSBL1_DATA},${STM32MP_FSBL1_NAME},${STM32MP_FSBL1_SIZE},Binary,1' if '${STM32MP_FSBL1_NAME}' else ''} \
${@ '${STM32MP_FSBL2_DATA},${STM32MP_FSBL2_NAME},${STM32MP_FSBL2_SIZE},Binary,1' if '${STM32MP_FSBL2_NAME}' else ''} \
${@ '${STM32MP_SSBL1_DATA},${STM32MP_SSBL1_NAME},${STM32MP_SSBL1_SIZE},Binary,1' if '${STM32MP_SSBL1_NAME}' else ''} \
"
PARTITIONS_BOOTLOADER_CONFIG[nand-4-256] ?= "\
${@ '${STM32MP_FSBL1_DATA},${STM32MP_FSBL1_NAME},${STM32MP_FSBL1_SIZE_UBOOT},Binary,2' if '${STM32MP_FSBL1_NAME}' else ''} \
${@ '${STM32MP_SSBL1_DATA},${STM32MP_SSBL1_NAME},${STM32MP_SSBL1_SIZE},Binary,1' if '${STM32MP_SSBL1_NAME}' else ''} \
${@ '${STM32MP_SSBL2_DATA},${STM32MP_SSBL2_NAME},${STM32MP_SSBL2_SIZE},Binary,1' if '${STM32MP_SSBL2_NAME}' else ''} \
"
PARTITIONS_BOOTLOADER_CONFIG[nor-sdcard] ?= "\
${@ '${STM32MP_FSBL1_DATA},${STM32MP_FSBL1_NAME},${STM32MP_FSBL1_SIZE},Binary,1' if '${STM32MP_FSBL1_NAME}' else ''} \
${@ '${STM32MP_FSBL2_DATA},${STM32MP_FSBL2_NAME},${STM32MP_FSBL2_SIZE},Binary,1' if '${STM32MP_FSBL2_NAME}' else ''} \
${@ '${STM32MP_SSBL1_DATA},${STM32MP_SSBL1_NAME},${STM32MP_SSBL1_SIZE},Binary,1' if '${STM32MP_SSBL1_NAME}' else ''} \
${@ '${STM32MP_UENV_DATA},${STM32MP_UENV_NAME},${STM32MP_UENV_SIZE},Binary,1' if '${STM32MP_UENV_NAME}' else ''} \
"
PARTITIONS_BOOTLOADER_CONFIG[sdcard] ?= "\
${@ '${STM32MP_FSBL1_DATA},${STM32MP_FSBL1_NAME},${STM32MP_FSBL1_SIZE},Binary,1' if '${STM32MP_FSBL1_NAME}' else ''} \
${@ '${STM32MP_FSBL2_DATA},${STM32MP_FSBL2_NAME},${STM32MP_FSBL2_SIZE},Binary,1' if '${STM32MP_FSBL2_NAME}' else ''} \
${@ '${STM32MP_SSBL1_DATA},${STM32MP_SSBL1_NAME},${STM32MP_SSBL1_SIZE},Binary,1' if '${STM32MP_SSBL1_NAME}' else ''} \
"
PARTITIONS_BOOTLOADER_CONFIG[spinand-2-128] ?= "\
${@ '${STM32MP_FSBL1_DATA},${STM32MP_FSBL1_NAME},${STM32MP_FSBL1_SIZE_UBOOT},Binary,2' if '${STM32MP_FSBL1_NAME}' else ''} \
${@ '${STM32MP_SSBL1_DATA},${STM32MP_SSBL1_NAME},${STM32MP_SSBL1_SIZE},Binary,1' if '${STM32MP_SSBL1_NAME}' else ''} \
${@ '${STM32MP_SSBL2_DATA},${STM32MP_SSBL2_NAME},${STM32MP_SSBL2_SIZE},Binary,1' if '${STM32MP_SSBL2_NAME}' else ''} \
"
# Optee Partitions configuration
PARTITIONS_OPTEE_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', 'emmc', '', d)}"
PARTITIONS_OPTEE_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand-4-256', '', d)}"
PARTITIONS_OPTEE_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'nor-sdcard', '', d)}"
PARTITIONS_OPTEE_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', 'sdcard', '', d)}"
PARTITIONS_OPTEE_CONFIG += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'spinand-2-128', '', d)}"
# <binary_name>,<partlabel>,<size>,<type>,<copy>
PARTITIONS_OPTEE_CONFIG[emmc] ?= "\
${@ '${STM32MP_TEEH_DATA},${STM32MP_TEEH_NAME},${STM32MP_TEEH_SIZE},Binary,1' if '${STM32MP_TEEH_NAME}' else ''} \
${@ '${STM32MP_TEED_DATA},${STM32MP_TEED_NAME},${STM32MP_TEED_SIZE},Binary,1' if '${STM32MP_TEED_NAME}' else ''} \
${@ '${STM32MP_TEEX_DATA},${STM32MP_TEEX_NAME},${STM32MP_TEEX_SIZE},Binary,1' if '${STM32MP_TEEX_NAME}' else ''} \
"
PARTITIONS_OPTEE_CONFIG[nand-4-256] ?= "\
${@ '${STM32MP_TEEH_DATA},${STM32MP_TEEH_NAME},${STM32MP_TEEH_SIZE_UBOOT},Binary,1' if '${STM32MP_TEEH_NAME}' else ''} \
${@ '${STM32MP_TEED_DATA},${STM32MP_TEED_NAME},${STM32MP_TEED_SIZE},Binary,1' if '${STM32MP_TEED_NAME}' else ''} \
${@ '${STM32MP_TEEX_DATA},${STM32MP_TEEX_NAME},${STM32MP_TEEX_SIZE_UBOOT},Binary,1' if '${STM32MP_TEEX_NAME}' else ''} \
"
PARTITIONS_OPTEE_CONFIG[nor-sdcard] ?= "\
${@ '${STM32MP_TEEH_DATA},${STM32MP_TEEH_NAME},${STM32MP_TEEH_SIZE},Binary,1' if '${STM32MP_TEEH_NAME}' else ''} \
${@ '${STM32MP_TEED_DATA},${STM32MP_TEED_NAME},${STM32MP_TEED_SIZE},Binary,1' if '${STM32MP_TEED_NAME}' else ''} \
${@ '${STM32MP_TEEX_DATA},${STM32MP_TEEX_NAME},${STM32MP_TEEX_SIZE},Binary,1' if '${STM32MP_TEEX_NAME}' else ''} \
"
PARTITIONS_OPTEE_CONFIG[sdcard] ?= "\
${@ '${STM32MP_TEEH_DATA},${STM32MP_TEEH_NAME},${STM32MP_TEEH_SIZE},Binary,1' if '${STM32MP_TEEH_NAME}' else ''} \
${@ '${STM32MP_TEED_DATA},${STM32MP_TEED_NAME},${STM32MP_TEED_SIZE},Binary,1' if '${STM32MP_TEED_NAME}' else ''} \
${@ '${STM32MP_TEEX_DATA},${STM32MP_TEEX_NAME},${STM32MP_TEEX_SIZE},Binary,1' if '${STM32MP_TEEX_NAME}' else ''} \
"
PARTITIONS_OPTEE_CONFIG[spinand-2-128] ?= "\
${@ '${STM32MP_TEEH_DATA},${STM32MP_TEEH_NAME},${STM32MP_TEEH_SIZE_UBOOT},Binary,1' if '${STM32MP_TEEH_NAME}' else ''} \
${@ '${STM32MP_TEED_DATA},${STM32MP_TEED_NAME},${STM32MP_TEED_SIZE},Binary,1' if '${STM32MP_TEED_NAME}' else ''} \
${@ '${STM32MP_TEEX_DATA},${STM32MP_TEEX_NAME},${STM32MP_TEEX_SIZE_UBOOT},Binary,1' if '${STM32MP_TEEX_NAME}' else ''} \
"
# ========================================================================= # =========================================================================
# Image # Image
# ========================================================================= # =========================================================================
@ -230,6 +342,11 @@ ST_TOOLS_FOR_SDK_append = " \
nativesdk-svd-tools \ nativesdk-svd-tools \
" "
# Fip tool
ST_TOOLS_FOR_SDK_append = " \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'nativesdk-${FIPTOOL_WRAPPER}', '', d)} \
"
# Make sure to append mkimage to SDK for kernel uImage build # Make sure to append mkimage to SDK for kernel uImage build
ST_DEPENDENCIES_BUILD_FOR_SDK = " \ ST_DEPENDENCIES_BUILD_FOR_SDK = " \
${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'nativesdk-u-boot-mkimage', '', d)} \ ${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'nativesdk-u-boot-mkimage', '', d)} \
@ -262,16 +379,12 @@ TOOLCHAIN_TARGET_TASK_remove_pn-buildtools-tarball = " bash-dev libgomp-dev"
# ========================================================================= # =========================================================================
# Kernel # Kernel
# ========================================================================= # =========================================================================
# Select kernel version
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
# Kernel image type # Kernel image type
KERNEL_IMAGETYPE = "${@bb.utils.contains('MACHINE_FEATURES', 'fit', 'fitImage', 'uImage', d)}" KERNEL_IMAGETYPE = "${@bb.utils.contains('MACHINE_FEATURES', 'fit', 'fitImage', 'uImage', d)}"
KERNEL_ALT_IMAGETYPE = " Image " KERNEL_ALT_IMAGETYPE = " Image "
KERNEL_ALT_IMAGETYPE =+ " vmlinux " KERNEL_ALT_IMAGETYPE =+ " vmlinux "
KERNEL_ALT_IMAGETYPE =+ " ${@bb.utils.contains('MACHINE_FEATURES', 'fit', 'uImage', 'zImage', d)} " KERNEL_ALT_IMAGETYPE =+ " ${@bb.utils.contains('MACHINE_FEATURES', 'fit', 'uImage', 'zImage', d)} "
# Maxsize authorized for uncompressed kernel binary # Maxsize authorized for uncompressed kernel binary
# Define to null to skip kernel image size check # Define to null to skip kernel image size check
KERNEL_IMAGE_MAXSIZE ?= "" KERNEL_IMAGE_MAXSIZE ?= ""
@ -300,22 +413,47 @@ LINUX_A7_EXAMPLES_DT ?= ""
EXTRA_IMAGEDEPENDS += "virtual/bootloader" EXTRA_IMAGEDEPENDS += "virtual/bootloader"
# Define default U-Boot config # Define default U-Boot config
UBOOT_CONFIG += "${@bb.utils.contains('BOOTSCHEME_LABELS', 'trusted', 'trusted', '', d)}" UBOOT_CONFIG += "${@bb.utils.contains_any('BOOTSCHEME_LABELS', 'optee trusted', 'trusted', '', d)}"
UBOOT_CONFIG += "${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'optee', '', d)}"
# The 'basic' config is only available for stm32mp1 machines # The 'basic' config is only available for stm32mp1 machines
UBOOT_CONFIG_append_stm32mp1common = " basic " UBOOT_CONFIG_append_stm32mp1common = " basic "
# Select u-boot binary that needs specific devicetree suffix (from UBOOT_DEVICETREE)
# For legacy mode keep the 'u-boot.stm32' but for FIP feature we need both
# 'u-boot-nodtb.bin' and 'u-boot.dtb' : prefer 'u-boot.dtb' binary as 'u-boot-nodtb.bin'
# doesn't need any devicetree suffix (specific case for 'u-boot-nodtb' binary
# implemented on u-boot-stm32mp recipe)
BINARY_NAME = "${@bb.utils.contains('MACHINE_FEATURES', 'fip', 'u-boot.dtb', 'u-boot.stm32', d)}"
# Define u-boot defconfig and binary to use for each UBOOT_CONFIG # Define u-boot defconfig and binary to use for each UBOOT_CONFIG
UBOOT_CONFIG[basic] = "stm32mp15_basic_defconfig,,u-boot.img" UBOOT_CONFIG[basic] = "stm32mp15_basic_defconfig,,u-boot.img"
UBOOT_CONFIG[trusted] = "stm32mp15_trusted_defconfig,,u-boot.stm32" UBOOT_CONFIG[trusted] = "stm32mp15_trusted_defconfig,,${BINARY_NAME}"
UBOOT_CONFIG[optee] = "stm32mp15_trusted_defconfig,,u-boot.stm32"
# List of U-Boot device tree to use # List of U-Boot device tree to use
UBOOT_DEVICETREE = "${STM32MP_DEVICETREE}" UBOOT_DEVICETREE = "${STM32MP_DEVICETREE}"
# Define u-boot splashscreen file naming # Define U-boot splashscreen file naming
UBOOT_SPLASH_IMAGE = "splash" UBOOT_SPLASH_IMAGE = "splash"
# Enable MTDPART check for UBOOT_CONFIG
UBOOT_MTDPART_CHECK_ENABLE ?= "${@bb.utils.contains_any('BOOTSCHEME_LABELS', 'optee trusted', d.getVarFlag('UBOOT_CONFIG', 'trusted').split(',')[0], '', d)}"
# Set U-Boot MTD partition configurations
UBOOT_MTDPART_NAND_BOOT ?= "${@','.join(['%sk(%s)' % (align_size(d, 'NAND', l.split(',')[2], l.split(',')[4]), l.split(',')[1]) for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nand-4-256').split()])}"
UBOOT_MTDPART_NAND_TEE ?= "${@','.join(['%sk(%s)' % (align_size(d, 'NAND', l.split(',')[2], l.split(',')[4]), l.split(',')[1]) for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'nand-4-256').split()])}"
UBOOT_MTDPART_NOR_BOOT ?= "${@','.join(['%sk(%s)' % (align_size(d, 'NOR', l.split(',')[2], l.split(',')[4]), l.split(',')[1]) for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'nor-sdcard').split()])}"
UBOOT_MTDPART_NOR_TEE ?= "${@','.join(['%sk(%s)' % (align_size(d, 'NOR', l.split(',')[2], l.split(',')[4]), l.split(',')[1]) for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'nor-sdcard').split()])}"
UBOOT_MTDPART_SPINAND_BOOT ?= "${@','.join(['%sk(%s)' % (align_size(d, 'SPINAND', l.split(',')[2], l.split(',')[4]), l.split(',')[1]) for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'spinand-2-128').split()])}"
UBOOT_MTDPART_SPINAND_TEE ?= "${@','.join(['%sk(%s)' % (align_size(d, 'SPINAND', l.split(',')[2], l.split(',')[4]), l.split(',')[1]) for l in d.getVarFlag('PARTITIONS_OPTEE_CONFIG', 'spinand-2-128').split()])}"
UBOOT_MTDPART_4LEGACY += "${@'CONFIG_MTDPARTS_NAND0_TEE=${UBOOT_MTDPART_NAND_TEE}' if bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', True, False, d) and bb.utils.contains('BOOTSCHEME_LABELS', 'optee', True, False, d) else ''}"
UBOOT_MTDPART_4LEGACY += "${@'CONFIG_MTDPARTS_NOR0_TEE=${UBOOT_MTDPART_NOR_TEE}' if bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', True, False, d) and bb.utils.contains('BOOTSCHEME_LABELS', 'optee', True, False, d) else ''}"
UBOOT_MTDPART_4LEGACY += "${@'CONFIG_MTDPARTS_SPINAND0_TEE=${UBOOT_MTDPART_SPINAND_TEE}' if bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', True, False, d) and bb.utils.contains('BOOTSCHEME_LABELS', 'optee', True, False, d) else ''}"
UBOOT_MTDPART_CHECK ?= "\
${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'CONFIG_MTDPARTS_NAND0_BOOT=${UBOOT_MTDPART_NAND_BOOT}', '', d)} \
${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'CONFIG_MTDPARTS_NOR0_BOOT=${UBOOT_MTDPART_NOR_BOOT}', '', d)} \
${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'CONFIG_MTDPARTS_SPINAND0_BOOT=${UBOOT_MTDPART_SPINAND_BOOT}', '', d)} \
${@bb.utils.contains('MACHINE_FEATURES', 'fip', '', '${UBOOT_MTDPART_4LEGACY}', d)} \
"
PREFERRED_PROVIDER_u-boot-fw-utils_stm32mp1common = "libubootenv" PREFERRED_PROVIDER_u-boot-fw-utils_stm32mp1common = "libubootenv"
MACHINE_EXTRA_RRECOMMENDS_append_stm32mp1common = " \ MACHINE_EXTRA_RRECOMMENDS_append_stm32mp1common = " \
@ -325,23 +463,34 @@ MACHINE_EXTRA_RRECOMMENDS_append_stm32mp1common = " \
# ========================================================================= # =========================================================================
# trusted-firmware-a # trusted-firmware-a
# ========================================================================= # =========================================================================
# Add trusted-firmware-a serialboot to allow images programming
EXTRA_IMAGEDEPENDS += "virtual/trusted-firmware-a-serialboot"
# Add optionnaly trusted-firmware-a # Add optionnaly trusted-firmware-a
EXTRA_IMAGEDEPENDS += "${@bb.utils.contains_any('BOOTSCHEME_LABELS', 'optee trusted', 'virtual/trusted-firmware-a', '', d)}" EXTRA_IMAGEDEPENDS += "${@bb.utils.contains_any('BOOTSCHEME_LABELS', 'optee trusted', 'virtual/trusted-firmware-a', '', d)}"
# Define SECURE_PAYLOAD config to set for each TF_A_CONFIG # Configure trusted-firmware-a build
TF_A_CONFIG_serialboot = "AARCH32_SP=sp_min" TF_A_CONFIG += "${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'optee', '', d)}"
TF_A_CONFIG_optee = "AARCH32_SP=optee" TF_A_CONFIG += "${@bb.utils.contains('BOOTSCHEME_LABELS', 'trusted', 'trusted', '', d)}"
TF_A_CONFIG_trusted = "AARCH32_SP=sp_min" # Manage specific config settings
TF_A_CONFIG_4LEGACY += "serialboot"
TF_A_CONFIG_4FIP += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', 'emmc', '', d)}"
TF_A_CONFIG_4FIP += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand', '', d)}"
TF_A_CONFIG_4FIP += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'nor', '', d)}"
TF_A_CONFIG_4FIP += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', 'sdcard', '', d)}"
TF_A_CONFIG_4FIP += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'spinand', '', d)}"
TF_A_CONFIG_4FIP += "uart"
TF_A_CONFIG_4FIP += "usb"
TF_A_CONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'fip', '${TF_A_CONFIG_4FIP}', '${TF_A_CONFIG_4LEGACY}', d)}"
# Manage proper update for TF_A_CONFIG_* var # Append SSP config to TF_A_CONFIG
tfaconfig_env[vardeps] += "${@bb.utils.contains('TF_A_CONFIG', 'serialboot', 'TF_A_CONFIG_serialboot', '', d)}" TF_A_SSP_ENABLE ?= "0"
tfaconfig_env[vardeps] += "${@bb.utils.contains('TF_A_CONFIG', 'optee', 'TF_A_CONFIG_optee', '', d)}" TF_A_CONFIG += "${@bb.utils.contains('TF_A_SSP_ENABLE', '1', 'uart-ssp usb-ssp', '', d)}"
tfaconfig_env[vardeps] += "${@bb.utils.contains('TF_A_CONFIG', 'trusted', 'TF_A_CONFIG_trusted', '', d)}"
# List of TF-A device tree to use # Default configuration for signing trusted-firmware-a binary
TF_A_DEVICETREE = "${STM32MP_DEVICETREE}" TF_A_SIGN_ENABLE ?= "0"
# Configure the default MTD_START_OFFSET
TF_A_MTD_START_OFFSET_NAND ?= "0x00200000"
TF_A_MTD_START_OFFSET_NOR ?= "0x00080000"
TF_A_MTD_START_OFFSET_SPINAND ?= "0x00200000"
# ========================================================================= # =========================================================================
# optee # optee
@ -349,6 +498,27 @@ TF_A_DEVICETREE = "${STM32MP_DEVICETREE}"
# Map OPTEE configuration to device tree list # Map OPTEE configuration to device tree list
OPTEE_CONF = "${STM32MP_DEVICETREE}" OPTEE_CONF = "${STM32MP_DEVICETREE}"
# =========================================================================
# fip
# =========================================================================
# Configure fip build
FIP_CONFIG += "${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'optee', '', d)}"
FIP_CONFIG += "${@bb.utils.contains('BOOTSCHEME_LABELS', 'trusted', 'trusted', '', d)}"
# Define config for each FIP_CONFIG
FIP_CONFIG[optee] ?= "optee"
FIP_CONFIG[trusted] ?= "tfa"
# List of device tree to use for fip binary creation
FIP_DEVICETREE ?= "${STM32MP_DEVICETREE}"
# Define fiptool wrapper name
FIPTOOL_WRAPPER ?= "fiptool-stm32mp"
# Manage specific config to sign FIP
FIP_SIGN_ENABLE ?= "${@bb.utils.contains('TF_A_SIGN_ENABLE', '1', '1', '', d)}"
FIP_SIGN_SUFFIX ?= "${@bb.utils.contains('FIP_SIGN_ENABLE', '1', '_Signed', '', d)}"
# ========================================================================= # =========================================================================
# Xserver # Xserver
# ========================================================================= # =========================================================================

View File

@ -20,36 +20,29 @@ FLASHLAYOUT_TYPE_LABELS_deleteall_eval = "${STM32MP_DT_FILES_ED} ${STM32MP_DT_F
# NB: We re-use as much as possible partitions already defined in file # NB: We re-use as much as possible partitions already defined in file
# 'st-machine-flashlayout-stm32mp.inc' # 'st-machine-flashlayout-stm32mp.inc'
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
FLASHLAYOUT_PARTITION_LABELS_deleteall = "fsbl1-boot ssbl-boot fsbl1 fsbl2 emmcall nandall norall sdcardall" FLASHLAYOUT_PARTITION_LABELS_deleteall = "${FLASHLAYOUT_PROGRAMMER_SECTIONS} emmcboot0 emmcboot1 emmcall nandall norall sdcardall spinandall"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Partition configuration for each partition label # Partition configuration for each partition label
FLASHLAYOUT_PARTITION_ENABLE_deleteall = "PED" FLASHLAYOUT_PARTITION_ENABLE_deleteall = "PED"
FLASHLAYOUT_PARTITION_ENABLE_deleteall_fsbl1-boot = "-" FLASHLAYOUT_PARTITION_ENABLE_deleteall_${STM32MP_FSBL1_NAME}-boot = "-"
FLASHLAYOUT_PARTITION_ENABLE_deleteall_ssbl-boot = "-" FLASHLAYOUT_PARTITION_ENABLE_deleteall_${STM32MP_SSBL1_NAME}-boot = "-"
FLASHLAYOUT_PARTITION_ID_emmcall = "0x30"
FLASHLAYOUT_PARTITION_ID_nandall = "0x40"
FLASHLAYOUT_PARTITION_ID_norall = "0x50"
FLASHLAYOUT_PARTITION_ID_sdcardall = "0x60"
FLASHLAYOUT_PARTITION_TYPE_emmcall = "RawImage" FLASHLAYOUT_PARTITION_TYPE_emmcall = "RawImage"
FLASHLAYOUT_PARTITION_TYPE_nandall = "RawImage" FLASHLAYOUT_PARTITION_TYPE_nandall = "RawImage"
FLASHLAYOUT_PARTITION_TYPE_norall = "RawImage" FLASHLAYOUT_PARTITION_TYPE_norall = "RawImage"
FLASHLAYOUT_PARTITION_TYPE_sdcardall = "RawImage" FLASHLAYOUT_PARTITION_TYPE_sdcardall = "RawImage"
FLASHLAYOUT_PARTITION_TYPE_spinandall = "RawImage"
FLASHLAYOUT_PARTITION_DEVICE_deleteall = "none:fsbl1-boot ssbl-boot,${DEVICE_EMMC}:fsbl1 fsbl2 emmcall,${DEVICE_NAND}:nandall,${DEVICE_NOR}:norall,${DEVICE_SDCARD}:sdcardall" FLASHLAYOUT_PARTITION_DEVICE_deleteall = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_EMMC}:emmcboot0 emmcboot1 emmcall,${DEVICE_NAND}:nandall,${DEVICE_NOR}:norall,${DEVICE_SDCARD}:sdcardall,${DEVICE_SPINAND}:spinandall"
FLASHLAYOUT_PARTITION_OFFSET_deleteall = "0x0" FLASHLAYOUT_PARTITION_OFFSET_deleteall = "0x0"
FLASHLAYOUT_PARTITION_OFFSET_deleteall_fsbl1 = "${DEVICE_START_OFFSET_BOOT0_EMMC}" FLASHLAYOUT_PARTITION_OFFSET_deleteall_emmcboot0 = "${DEVICE_START_OFFSET_BOOT0_EMMC}"
FLASHLAYOUT_PARTITION_OFFSET_deleteall_fsbl2 = "${DEVICE_START_OFFSET_BOOT1_EMMC}" FLASHLAYOUT_PARTITION_OFFSET_deleteall_emmcboot1 = "${DEVICE_START_OFFSET_BOOT1_EMMC}"
FLASHLAYOUT_PARTITION_BIN2LOAD_deleteall_fsbl1 = "none"
FLASHLAYOUT_PARTITION_BIN2LOAD_deleteall_fsbl2 = "none"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# The 'deleteall' bootscheme is a trick to generate flashlayout files to clean # The 'deleteall' bootscheme is a trick to generate flashlayout files to clean
# all memory devices on board. There are no specific 'deleteall' bootloader # all memory devices on board. There are no specific 'deleteall' bootloaders
# binaries so use the proper one ('serialboot', 'optee' or 'trusted'). # so we need to manage specific override for FLASHLAYOUT_PROGRAMMER_SECTIONS binaries
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_fsbl1-boot_append = " deleteall;serialboot" BOOTSCHEME_REPLACE = "${@'optee' if bb.utils.contains('BOOTSCHEME_LABELS', 'optee', True, False, d) and not bb.utils.contains('BOOTSCHEME_LABELS', 'trusted', True, False, d) else 'trusted'}"
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_ssbl-boot_append = " deleteall;trusted" FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_${STM32MP_SSBL1_NAME}-boot_append = " deleteall;${BOOTSCHEME_REPLACE}"

View File

@ -13,16 +13,18 @@ FLASHLAYOUT_CONFIG_LABELS_extensible = "${@bb.utils.contains('BOOTDEVICE_LABELS'
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define label types # Define label types
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
FLASHLAYOUT_TYPE_LABELS_extensible = "${STM32MP_DT_FILES_DK}" FLASHLAYOUT_TYPE_LABELS_extensible = "${@d.getVar('STM32MP_DT_FILES_DK') or 'none'}"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define partitions to use # Define partitions to use
# # NOTE: extensible scheme is ONLY compatible with sdcard and trusted bootscheme
# NB: To manage bootloader partitions, simplification is done by directly # So we only set partition labels for this particular configuration
# re-using 'fsbl1-boot' and 'ssbl-boot' partitions already defined in file
# 'st-machine-flashlayout-stm32mp.inc'
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
FLASHLAYOUT_PARTITION_LABELS_extensible = "fsbl1-boot ssbl-boot fsbl1 fsbl2 ssbl ${FLASHLAYOUT_PARTITION_IMAGES}" 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} \
"
FLASHLAYOUT_PARTITION_LABELS_extensible_remove = "userfs" FLASHLAYOUT_PARTITION_LABELS_extensible_remove = "userfs"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -33,6 +35,3 @@ FLASHLAYOUT_PARTITION_LABELS_extensible_remove = "userfs"
# Make sure to use 'trusted' bootscheme for binary naming instead of 'extensible' # Make sure to use 'trusted' bootscheme for binary naming instead of 'extensible'
# each time it is required # each time it is required
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_extensible_prepend = "extensible;trusted " FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_extensible_prepend = "extensible;trusted "
# Additionnal replacement is expected for specific fsbl1 bootloader binary, as
# we should use the 'serialboot' one instead of the 'trusted' one
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_extensible_fsbl1-boot_append = " trusted;serialboot"

View File

@ -4,7 +4,6 @@ inherit flashlayout-stm32mp
# Add specific dependencies to get all binaries generated before flashlayout files # Add specific dependencies to get all binaries generated before flashlayout files
FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/trusted-firmware-a', 'virtual/trusted-firmware-a:do_deploy', '', d)}" FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/trusted-firmware-a', 'virtual/trusted-firmware-a:do_deploy', '', d)}"
FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/trusted-firmware-a-serialboot', 'virtual/trusted-firmware-a-serialboot:do_deploy', '', d)}"
FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/bootloader', 'virtual/bootloader:do_deploy', '', d)}" FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/bootloader', 'virtual/bootloader:do_deploy', '', d)}"
FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/optee-os', 'virtual/optee-os:do_deploy', '', d)}" FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual/optee-os', 'virtual/optee-os:do_deploy', '', d)}"
@ -34,7 +33,7 @@ FLASHLAYOUT_DEPEND_TASKS += "${@bb.utils.contains('EXTRA_IMAGEDEPENDS', 'virtual
# - <Opt> FLASHLAYOUT_PARTITION_ENABLE # - <Opt> FLASHLAYOUT_PARTITION_ENABLE
# - <Id> FLASHLAYOUT_PARTITION_ID # - <Id> FLASHLAYOUT_PARTITION_ID
# - <Name> Item from FLASHLAYOUT_PARTITION_LABELS list # - <Name> Item from FLASHLAYOUT_PARTITION_LABELS list
# - <Type> FLASHLAYOUT_PARTITION_TYPE # - <Type> FLASHLAYOUT_PARTITION_TYPE with optional FLASHLAYOUT_PARTITION_COPY (in case greater than 1)
# - <IP> FLASHLAYOUT_PARTITION_DEVICE # - <IP> FLASHLAYOUT_PARTITION_DEVICE
# - <Offset> FLASHLAYOUT_PARTITION_OFFSET # - <Offset> FLASHLAYOUT_PARTITION_OFFSET
# - <Binary> FLASHLAYOUT_PARTITION_BIN2LOAD # - <Binary> FLASHLAYOUT_PARTITION_BIN2LOAD
@ -71,6 +70,7 @@ FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc',
FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand-4-256', '', d)}" FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', 'nand-4-256', '', d)}"
FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'nor-sdcard', '', d)}" FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard', 'nor-sdcard', '', d)}"
FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', 'sdcard', '', d)}" FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', 'sdcard', '', d)}"
FLASHLAYOUT_CONFIG_LABELS += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', 'spinand-2-128', '', d)}"
# Set by default this variable to 0, and set to 1 only when we are using st-example-image-* # Set by default this variable to 0, and set to 1 only when we are using st-example-image-*
ST_EXAMPLE_IMAGE ??= "0" ST_EXAMPLE_IMAGE ??= "0"
@ -78,10 +78,8 @@ ST_EXAMPLE_IMAGE ??= "0"
#FIXME need to manage overall device size to abort flashlayout creation in case of oversizing the storage devices #FIXME need to manage overall device size to abort flashlayout creation in case of oversizing the storage devices
# Remove NAND flashlayout when we are using st-example-image-* as rootfs too big for a NAND device size of 1 GBytes # Remove NAND flashlayout when we are using st-example-image-* as rootfs too big for a NAND device size of 1 GBytes
#FLASHLAYOUT_CONFIG_LABELS_remove = "${@bb.utils.contains('ST_EXAMPLE_IMAGE', '1', 'emmc', '', d)}"
FLASHLAYOUT_CONFIG_LABELS_remove = "${@bb.utils.contains('ST_EXAMPLE_IMAGE', '1', 'nand-4-256', '', d)}" FLASHLAYOUT_CONFIG_LABELS_remove = "${@bb.utils.contains('ST_EXAMPLE_IMAGE', '1', 'nand-4-256', '', d)}"
#FLASHLAYOUT_CONFIG_LABELS_remove = "${@bb.utils.contains('ST_EXAMPLE_IMAGE', '1', 'nor-sdcard', '', d)}" FLASHLAYOUT_CONFIG_LABELS_remove = "${@bb.utils.contains('ST_EXAMPLE_IMAGE', '1', 'spinand-2-128', '', d)}"
#FLASHLAYOUT_CONFIG_LABELS_remove = "${@bb.utils.contains('ST_EXAMPLE_IMAGE', '1', 'sdcard', '', d)}"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define label types for each config # Define label types for each config
@ -114,12 +112,6 @@ FLASHLAYOUT_TYPE_LABELS_sdcard = "${STM32MP_DT_FILES_DK} ${STM32MP_DT_FILES_ED}
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define partitions to consider for flashlayout file generation # Define partitions to consider for flashlayout file generation
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# NOTE: There are few restrictions to follow:
# - The partition for the first boot loader should follow the naming
# rule: fsbl*
# - The partition for the secondary boot loader should follow the naming
# rule: ssbl
# -----------------------------------------------------------------------------
# Priority var assignment (where <OVERRIDES> are the usual override mechanism): # Priority var assignment (where <OVERRIDES> are the usual override mechanism):
# 1) FLASHLAYOUT_PARTITION_LABELS_<BOOTSCHEME>_<CONFIG>_<OVERRIDES> # 1) FLASHLAYOUT_PARTITION_LABELS_<BOOTSCHEME>_<CONFIG>_<OVERRIDES>
# 2) FLASHLAYOUT_PARTITION_LABELS_<BOOTSCHEME>_<CONFIG> # 2) FLASHLAYOUT_PARTITION_LABELS_<BOOTSCHEME>_<CONFIG>
@ -130,24 +122,69 @@ FLASHLAYOUT_TYPE_LABELS_sdcard = "${STM32MP_DT_FILES_DK} ${STM32MP_DT_FILES_ED}
# 7) FLASHLAYOUT_PARTITION_LABELS_<OVERRIDES> # 7) FLASHLAYOUT_PARTITION_LABELS_<OVERRIDES>
# 8) FLASHLAYOUT_PARTITION_LABELS # 8) FLASHLAYOUT_PARTITION_LABELS
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
FLASHLAYOUT_PROGRAMMER_SECTIONS ?= "${STM32MP_FSBL1_NAME}-boot ${STM32MP_SSBL1_NAME}-boot"
# FLASHLAYOUT_PARTITION_IMAGES is initalized through PARTITIONS_CONFIG within 'flashlayout-stm32mp' class # FLASHLAYOUT_PARTITION_IMAGES is initalized through PARTITIONS_CONFIG within 'flashlayout-stm32mp' class
FLASHLAYOUT_PARTITION_IMAGES ?= "" FLASHLAYOUT_PARTITION_IMAGES ?= ""
# FLASHLAYOUT_BOOT_SEQUENCE is used to define the partition used at boot stage
FLASHLAYOUT_BOOT_SEQUENCE_TRUSTED ?= "fsbl1-boot ssbl-boot fsbl1 fsbl2 ssbl"
FLASHLAYOUT_BOOT_SEQUENCE_OPTEE ?= "fsbl1-boot ssbl-boot fsbl1 fsbl2 ssbl"
FLASHLAYOUT_BOOT_SEQUENCE_NAND_TRUSTED ?= "fsbl1-boot ssbl-boot fsbl1 ssbl ssbl2"
FLASHLAYOUT_BOOT_SEQUENCE_NAND_OPTEE ?= "fsbl1-boot ssbl-boot fsbl1 ssbl ssbl2"
FLASHLAYOUT_PARTITION_LABELS_optee_emmc = "${FLASHLAYOUT_BOOT_SEQUENCE_OPTEE} teeh teed teex ${FLASHLAYOUT_PARTITION_IMAGES}" FLASHLAYOUT_PARTITION_LABELS_optee_emmc = "\
FLASHLAYOUT_PARTITION_LABELS_optee_nand-4-256 = "${FLASHLAYOUT_BOOT_SEQUENCE_NAND_OPTEE} teeh teed teex ubifs" ${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
FLASHLAYOUT_PARTITION_LABELS_optee_nor-sdcard = "${FLASHLAYOUT_BOOT_SEQUENCE_OPTEE} env teeh teed teex empty ${FLASHLAYOUT_PARTITION_IMAGES}" ${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'emmc').split()])} \
FLASHLAYOUT_PARTITION_LABELS_optee_sdcard = "${FLASHLAYOUT_BOOT_SEQUENCE_OPTEE} teeh teed teex ${FLASHLAYOUT_PARTITION_IMAGES}" ${@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} \
"
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 \
"
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}\
"
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} \
"
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\
"
FLASHLAYOUT_PARTITION_LABELS_trusted_emmc = "${FLASHLAYOUT_BOOT_SEQUENCE_TRUSTED} ${FLASHLAYOUT_PARTITION_IMAGES}" FLASHLAYOUT_PARTITION_LABELS_trusted_emmc = "\
FLASHLAYOUT_PARTITION_LABELS_trusted_nand-4-256 = "${FLASHLAYOUT_BOOT_SEQUENCE_NAND_TRUSTED} ubifs" ${FLASHLAYOUT_PROGRAMMER_SECTIONS} \
FLASHLAYOUT_PARTITION_LABELS_trusted_nor-sdcard = "${FLASHLAYOUT_BOOT_SEQUENCE_TRUSTED} env empty ${FLASHLAYOUT_PARTITION_IMAGES}" ${@' '.join(['%s' % l.split(',')[1] for l in d.getVarFlag('PARTITIONS_BOOTLOADER_CONFIG', 'emmc').split()])} \
FLASHLAYOUT_PARTITION_LABELS_trusted_sdcard = "${FLASHLAYOUT_BOOT_SEQUENCE_TRUSTED} ${FLASHLAYOUT_PARTITION_IMAGES}" ${FLASHLAYOUT_PARTITION_IMAGES} \
"
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 \
"
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} \
"
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} \
"
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 \
"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Partition properties configuration # Partition properties configuration
@ -164,112 +201,68 @@ FLASHLAYOUT_PARTITION_LABELS_trusted_sdcard = "${FLASHLAYOUT_BOOT_SEQUENCE_T
# 8) FLASHLAYOUT_PARTITION_xxx # 8) FLASHLAYOUT_PARTITION_xxx
# 9) Default 'FLASHLAYOUT_PARTITION_xxx' to 'none' when not defined # 9) Default 'FLASHLAYOUT_PARTITION_xxx' to 'none' when not defined
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
FLASHLAYOUT_PARTITION_ENABLE = "P" FLASHLAYOUT_PARTITION_ENABLE = "P"
FLASHLAYOUT_PARTITION_ENABLE_fsbl1-boot = "-" FLASHLAYOUT_PARTITION_ENABLE_${STM32MP_FSBL1_NAME}-boot = "-"
FLASHLAYOUT_PARTITION_ENABLE_ssbl-boot = "-" FLASHLAYOUT_PARTITION_ENABLE_${STM32MP_SSBL1_NAME}-boot = "-"
FLASHLAYOUT_PARTITION_ENABLE_empty = "PE" FLASHLAYOUT_PARTITION_ENABLE_empty = "PE"
FLASHLAYOUT_PARTITION_ENABLE_env = "PED" FLASHLAYOUT_PARTITION_ENABLE_nor-sdcard_${STM32MP_UENV_NAME} = "PDE"
# Due to association of u-boot and env, the ssbl partition need to be deleted # Need to make sure to delete partition that contains U-Boot env before update (gpt partitions only)
FLASHLAYOUT_PARTITION_ENABLE_sdcard_ssbl = "PD" FLASHLAYOUT_PARTITION_ENABLE_sdcard_${STM32MP_SSBL1_NAME} = "PD"
FLASHLAYOUT_PARTITION_ENABLE_emmc_ssbl = "PD" FLASHLAYOUT_PARTITION_ENABLE_emmc_${STM32MP_SSBL1_NAME} = "PD"
# Due to potential swith between trused and optee, need to be delete teeh partitions
FLASHLAYOUT_PARTITION_ENABLE_sdcard_teeh = "PD"
FLASHLAYOUT_PARTITION_ENABLE_emmc_teeh = "PD"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Partition ID # Partition ID
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# The STM32CubeProgrammer supported ID range is: # For FSBL and SSBL binaries loaded in RAM to program the devices there are two
# 0x00 to 0xFF # reserved IDs on STM32CubeProgrammer side:
# Some IDs are reserved for internal usage on STM32CubeProgrammer and special
# management is implemented for binary with STM32 header. This means that for
# flashlayout files, available ID range is only:
# 0x01 to 0x0F for Boot partitions with STM32 header
# 0x10 to 0xF0 for User partitions programmed without header
# Note also that for FSBL and SSBL binaries loaded in RAM to program the devices
# there are two reserved IDs
# 0x01 for FSBL # 0x01 for FSBL
# 0x03 for SSBL # 0x03 for SSBL
FLASHLAYOUT_PARTITION_ID_fsbl1-boot = "0x01" FLASHLAYOUT_PARTITION_ID_${STM32MP_FSBL1_NAME}-boot = "0x01"
FLASHLAYOUT_PARTITION_ID_ssbl-boot = "0x03" FLASHLAYOUT_PARTITION_ID_${STM32MP_SSBL1_NAME}-boot = "0x03"
FLASHLAYOUT_PARTITION_ID_fsbl1 = "0x04"
FLASHLAYOUT_PARTITION_ID_fsbl2 = "0x05"
FLASHLAYOUT_PARTITION_ID_ssbl = "0x06"
FLASHLAYOUT_PARTITION_ID_ssbl2 = "0x07"
FLASHLAYOUT_PARTITION_ID_teeh = "0x0A"
FLASHLAYOUT_PARTITION_ID_teed = "0x0B"
FLASHLAYOUT_PARTITION_ID_teex = "0x0C"
FLASHLAYOUT_PARTITION_ID_empty = "0x10"
FLASHLAYOUT_PARTITION_ID_env = "0x20"
FLASHLAYOUT_PARTITION_ID_ubifs = "0x21"
FLASHLAYOUT_PARTITION_TYPE = "Binary" FLASHLAYOUT_PARTITION_TYPE = "Binary"
FLASHLAYOUT_PARTITION_TYPE_nand-4-256_fsbl1 = "Binary(2)" FLASHLAYOUT_PARTITION_TYPE_ubifs = "System"
FLASHLAYOUT_PARTITION_TYPE_ubifs = "System"
FLASHLAYOUT_PARTITION_DEVICE_emmc = "none:fsbl1-boot ssbl-boot,${DEVICE_EMMC}:default" FLASHLAYOUT_PARTITION_COPY = "1"
FLASHLAYOUT_PARTITION_DEVICE_nand-4-256 = "none:fsbl1-boot ssbl-boot,${DEVICE_NAND}:default"
FLASHLAYOUT_PARTITION_DEVICE_nor-sdcard = "none:fsbl1-boot ssbl-boot,${DEVICE_NOR}:default,${DEVICE_SDCARD}:${FLASHLAYOUT_PARTITION_IMAGES}"
FLASHLAYOUT_PARTITION_DEVICE_sdcard = "none:fsbl1-boot ssbl-boot,${DEVICE_SDCARD}:default"
FLASHLAYOUT_PARTITION_OFFSET_fsbl1-boot = "0x0" FLASHLAYOUT_PARTITION_DEVICE_emmc = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_EMMC}:default"
FLASHLAYOUT_PARTITION_OFFSET_ssbl-boot = "0x0" FLASHLAYOUT_PARTITION_DEVICE_nand-4-256 = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_NAND}:default"
FLASHLAYOUT_PARTITION_OFFSET_emmc_fsbl1 = "${DEVICE_START_OFFSET_BOOT0_EMMC}" FLASHLAYOUT_PARTITION_DEVICE_nor-sdcard = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_NOR}:default,${DEVICE_SDCARD}:${FLASHLAYOUT_PARTITION_IMAGES}"
FLASHLAYOUT_PARTITION_OFFSET_emmc_fsbl2 = "${DEVICE_START_OFFSET_BOOT1_EMMC}" FLASHLAYOUT_PARTITION_DEVICE_sdcard = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_SDCARD}:default"
FLASHLAYOUT_PARTITION_OFFSET_emmc_ssbl = "${DEVICE_START_OFFSET_EMMC}" FLASHLAYOUT_PARTITION_DEVICE_spinand-2-128 = "none:${FLASHLAYOUT_PROGRAMMER_SECTIONS},${DEVICE_SPINAND}:default"
FLASHLAYOUT_PARTITION_OFFSET_${STM32MP_FSBL1_NAME}-boot = "0x0"
FLASHLAYOUT_PARTITION_OFFSET_${STM32MP_SSBL1_NAME}-boot = "0x0"
FLASHLAYOUT_PARTITION_OFFSET_emmc_${STM32MP_FSBL1_NAME} = "${DEVICE_START_OFFSET_BOOT0_EMMC}"
FLASHLAYOUT_PARTITION_OFFSET_emmc_${STM32MP_FSBL2_NAME} = "${DEVICE_START_OFFSET_BOOT1_EMMC}"
FLASHLAYOUT_PARTITION_OFFSET_emmc_${STM32MP_SSBL1_NAME} = "${DEVICE_START_OFFSET_EMMC}"
# Size defined in Kbytes # Size defined in Kbytes
FLASHLAYOUT_PARTITION_SIZE_fsbl1 = "256" FLASHLAYOUT_PARTITION_SIZE_empty = "0"
FLASHLAYOUT_PARTITION_SIZE_fsbl2 = "256"
FLASHLAYOUT_PARTITION_SIZE_ssbl = "2048"
FLASHLAYOUT_PARTITION_SIZE_ssbl2 = "2048"
FLASHLAYOUT_PARTITION_SIZE_env = "512"
FLASHLAYOUT_PARTITION_SIZE_teeh = "256"
FLASHLAYOUT_PARTITION_SIZE_teed = "512"
FLASHLAYOUT_PARTITION_SIZE_teex = "256"
FLASHLAYOUT_PARTITION_SIZE_empty = "0"
# Specific override for MTD partitions hard coded on U-Boot side
FLASHLAYOUT_PARTITION_SIZE_nand-4-256_fsbl1 = "2048"
FLASHLAYOUT_PARTITION_SIZE_nand-4-256_ssbl = "2048"
FLASHLAYOUT_PARTITION_SIZE_nand-4-256_ssbl2 = "2048"
FLASHLAYOUT_PARTITION_SIZE_nand-4-256_teeh = "512"
FLASHLAYOUT_PARTITION_SIZE_nand-4-256_teed = "512"
FLASHLAYOUT_PARTITION_SIZE_nand-4-256_teex = "512"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_fsbl1 = "256"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_fsbl2 = "256"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_ssbl = "2048"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_env = "512"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_teeh = "256"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_teed = "512"
FLASHLAYOUT_PARTITION_SIZE_nor-sdcard_teex = "256"
# Set binaries to use for each partition # Set binaries to use for each partition
FLASHLAYOUT_PARTITION_BIN2LOAD_fsbl1-boot = "arm-trusted-firmware/tf-a.stm32" # -----------------------------------------------------------------------------
FLASHLAYOUT_PARTITION_BIN2LOAD_ssbl-boot = "bootloader/u-boot.stm32" # Use following pattern in binary name to expand to specific label config:
FLASHLAYOUT_PARTITION_BIN2LOAD_fsbl1 = "arm-trusted-firmware/tf-a.stm32" # '<CONFIG>' (to insert label from FLASHLAYOUT_CONFIG_LABELS - NB: substitution for all '-' in label by '_')
FLASHLAYOUT_PARTITION_BIN2LOAD_fsbl2 = "arm-trusted-firmware/tf-a.stm32" # '<BOOTSCHEME>' (to insert label from FLASHLAYOUT_BOOTSCHEME_LABELS)
FLASHLAYOUT_PARTITION_BIN2LOAD_ssbl = "bootloader/u-boot.stm32" # '<DEVICE>' (to insert label from FLASHLAYOUT_PARTITION_DEVICE)
FLASHLAYOUT_PARTITION_BIN2LOAD_ssbl2 = "bootloader/u-boot.stm32" # '<TYPE>' (to insert label from FLASHLAYOUT_TYPE_LABELS)
FLASHLAYOUT_PARTITION_BIN2LOAD_teeh = "optee/tee-header_v2.stm32" # These patterns are processed to expand binary name for each config.
FLASHLAYOUT_PARTITION_BIN2LOAD_teed = "optee/tee-pageable_v2.stm32" # -----------------------------------------------------------------------------
FLASHLAYOUT_PARTITION_BIN2LOAD_teex = "optee/tee-pager_v2.stm32" 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_ubifs = "${IMAGE_LINK_NAME}_nand_4_256_multivolume.ubi" 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 # Use the 'FLASHLAYOUT_PARTITION_REPLACE_PATTERNS' var to allow dynamic binary
# renaming for the bootloader binaries. This is only required for fsbl1-boot and # renaming for the bootloader binaries. This is only required for all FLASHLAYOUT_PROGRAMMER_SECTIONS
# ssbl-boot partitions that provides the binary to flash the device. # partitions that provides the binary to flash the device.
# The format to follow is: # The format to follow is:
# '<PATTERN2REPLACE_1>;<PATTERN2SET_1> <PATTERN2REPLACE_2>;<PATTERN2SET_2>' # '<PATTERN2REPLACE_1>;<PATTERN2SET_1> <PATTERN2REPLACE_2>;<PATTERN2SET_2>'
# And the pattern to replace in binary name is only searched as: # And the pattern to replace in binary name is searched as:
# '-<PATTERN>$' # '[-_]<PATTERN>([-_.]|$)'
# or
# '-<PATTERN>-'
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# We use specific tf-a serialboot mode for any bootscheme for fsbl1-boot
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_fsbl1-boot_append = " optee;serialboot trusted;serialboot"
# The daughter board does not support Programmer mode, so use eval one # The daughter board does not support Programmer mode, so use eval one
# (valid for both fsbl1-boot and ssbl-boot) # (valid for FLASHLAYOUT_PROGRAMMER_SECTIONS partitions)
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_fsbl1-boot_append = " ed1;ev1" FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_${STM32MP_FSBL1_NAME}-boot_append = " ed1;ev1"
FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_ssbl-boot_append = " ed1;ev1" FLASHLAYOUT_PARTITION_REPLACE_PATTERNS_${STM32MP_SSBL1_NAME}-boot_append = " ed1;ev1"

View File

@ -13,11 +13,6 @@ PREFERRED_PROVIDER_u-boot = "u-boot-stm32mp"
# trusted-firmware-a # trusted-firmware-a
# ========================================================================= # =========================================================================
PREFERRED_PROVIDER_virtual/trusted-firmware-a = "tf-a-stm32mp" PREFERRED_PROVIDER_virtual/trusted-firmware-a = "tf-a-stm32mp"
PREFERRED_PROVIDER_virtual/trusted-firmware-a-serialboot = "tf-a-stm32mp-serialboot"
# Define default TF-A config
TF_A_CONFIG_append_pn-tf-a-stm32mp-serialboot = " serialboot "
TF_A_CONFIG_append_pn-tf-a-stm32mp = " ${@bb.utils.contains('BOOTSCHEME_LABELS', 'trusted', 'trusted', '', d)} "
TF_A_CONFIG_append_pn-tf-a-stm32mp = " ${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'optee', '', d)} "
# ========================================================================= # =========================================================================
# optee-os # optee-os

View File

@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define device storage name and type mapping # Define device storage name and type mapping
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
DEVICE_STORAGE ?= "EMMC:mmc1, NAND:nand0, NOR:nor0, SDCARD:mmc0" DEVICE_STORAGE ?= "EMMC:mmc1, NAND:nand0, NOR:nor0, SDCARD:mmc0, SPINAND:spi-nand0"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define device storage name alias # Define device storage name alias
@ -12,6 +12,7 @@ DEVICE_STORAGE_NAMES += "EMMC"
DEVICE_STORAGE_NAMES += "NAND" DEVICE_STORAGE_NAMES += "NAND"
DEVICE_STORAGE_NAMES += "NOR" DEVICE_STORAGE_NAMES += "NOR"
DEVICE_STORAGE_NAMES += "SDCARD" DEVICE_STORAGE_NAMES += "SDCARD"
DEVICE_STORAGE_NAMES += "SPINAND"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define device storage type # Define device storage type
@ -21,6 +22,7 @@ DEVICE_STORAGE_TYPES += "mmc1"
DEVICE_STORAGE_TYPES += "mmc2" DEVICE_STORAGE_TYPES += "mmc2"
DEVICE_STORAGE_TYPES += "nand0" DEVICE_STORAGE_TYPES += "nand0"
DEVICE_STORAGE_TYPES += "nor0" DEVICE_STORAGE_TYPES += "nor0"
DEVICE_STORAGE_TYPES += "spi-nand0"
python () { python () {
""" """
@ -60,9 +62,11 @@ python () {
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# EMMC # EMMC
# Extra space is required to store 'Protective MBR' and 'Primary GPT Header' # Extra space is required to store 'Protective MBR' and 'Primary GPT Header'
# Currently the required size is 17kBytes (i.e. 0x4400) # Currently the required size is 17 KiB (i.e. 0x4400)
# We need to align this size to get the first offset to use # We need to align this size to get the first offset to use
DEVICE_START_OFFSET_EMMC ?= "0x00080000" DEVICE_START_OFFSET_EMMC ?= "0x00080000"
# 32 Gbit
DEVICE_MAX_OFFSET_EMMC ?= "0x100000000"
DEVICE_ALIGNMENT_SIZE_EMMC ?= "0x00080000" DEVICE_ALIGNMENT_SIZE_EMMC ?= "0x00080000"
# Specific to EMMC, there are two boot partitions using specific offset to access # Specific to EMMC, there are two boot partitions using specific offset to access
@ -79,35 +83,51 @@ DEVICE_BOARD_ENABLE_EMMC += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', '
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# NAND # NAND
DEVICE_START_OFFSET_NAND ?= "0x00000000" DEVICE_START_OFFSET_NAND ?= "0x00000000"
# 8 Gbit
DEVICE_MAX_OFFSET_NAND ?= "0x40000000"
DEVICE_ALIGNMENT_SIZE_NAND ?= "0x00040000" DEVICE_ALIGNMENT_SIZE_NAND ?= "0x00040000"
# Configure the list of boards that enable EMMC # Configure the list of boards that enable NAND
DEVICE_BOARD_ENABLE_NAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${STM32MP_DT_FILES_ED}', '', d)}" DEVICE_BOARD_ENABLE_NAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${STM32MP_DT_FILES_ED}', '', d)}"
DEVICE_BOARD_ENABLE_NAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${STM32MP_DT_FILES_EV}', '', d)}" DEVICE_BOARD_ENABLE_NAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${STM32MP_DT_FILES_EV}', '', d)}"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# NOR # NOR
DEVICE_START_OFFSET_NOR ?= "0x00000000" DEVICE_START_OFFSET_NOR ?= "0x00000000"
# 512 Mbit, only 1 NOR is used
DEVICE_MAX_OFFSET_NOR ?= "0x04000000"
DEVICE_ALIGNMENT_SIZE_NOR ?= "0x00010000" DEVICE_ALIGNMENT_SIZE_NOR ?= "0x00010000"
# Configure the list of boards that enable EMMC # Configure the list of boards that enable NOR
DEVICE_BOARD_ENABLE_NOR += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard' , '${STM32MP_DT_FILES_EV}', '', d)}" DEVICE_BOARD_ENABLE_NOR += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard' , '${STM32MP_DT_FILES_EV}', '', d)}"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# SDCARD # SDCARD
# Extra space is required to store 'Protective MBR' and 'Primary GPT Header' # Extra space is required to store 'Protective MBR' and 'Primary GPT Header'
# Currently the required size is 17kBytes (i.e. 0x4400) # Currently the required size is 17 KiB (i.e. 0x4400)
# We need to align this size to get the first offset to use # We need to align this size to get the first offset to use
DEVICE_START_OFFSET_SDCARD ?= "0x00004400" DEVICE_START_OFFSET_SDCARD ?= "0x00004400"
# No limit for SDCARD
DEVICE_MAX_OFFSET_SDCARD ?= "none"
DEVICE_ALIGNMENT_SIZE_SDCARD ?= "0x00000200" DEVICE_ALIGNMENT_SIZE_SDCARD ?= "0x00000200"
# Configure the rootfs partition uid used in gpt partition table for SDCARD # Configure the rootfs partition uid used in gpt partition table for SDCARD
DEVICE_PARTUUID_ROOTFS_SDCARD ?= "${@d.getVar(d.expand('DEVICE_PARTUUID_ROOTFS_${DEVICE_SDCARD}')) or ''}" DEVICE_PARTUUID_ROOTFS_SDCARD ?= "${@d.getVar(d.expand('DEVICE_PARTUUID_ROOTFS_${DEVICE_SDCARD}')) or ''}"
# Configure the list of boards that enable SDCARD # Configure the list of boards that enable SDCARD
DEVICE_BOARD_ENABLE_SDCARD += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', '${STM32MP_DT_FILES_DK}', '', d)}" DEVICE_BOARD_ENABLE_SDCARD += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', '${STM32MP_DT_FILES_DK}', '', d)}"
DEVICE_BOARD_ENABLE_SDCARD += "${@bb.utils.contains_any('BOOTDEVICE_LABELS', [ 'sdcard', 'nor-sdcard' ], '${STM32MP_DT_FILES_ED}', '', d)}" DEVICE_BOARD_ENABLE_SDCARD += "${@bb.utils.contains_any('BOOTDEVICE_LABELS', [ 'sdcard', 'nor-sdcard' ], '${STM32MP_DT_FILES_ED}', '', d)}"
DEVICE_BOARD_ENABLE_SDCARD += "${@bb.utils.contains_any('BOOTDEVICE_LABELS', [ 'sdcard', 'nor-sdcard' ], '${STM32MP_DT_FILES_EV}', '', d)}" DEVICE_BOARD_ENABLE_SDCARD += "${@bb.utils.contains_any('BOOTDEVICE_LABELS', [ 'sdcard', 'nor-sdcard' ], '${STM32MP_DT_FILES_EV}', '', d)}"
# -----------------------------------------------------------------------------
# SPI NAND
DEVICE_START_OFFSET_SPINAND ?= "0x00000000"
# 2 Gbit
DEVICE_MAX_OFFSET_SPINAND ?= "0x10000000"
DEVICE_ALIGNMENT_SIZE_SPINAND ?= "0x00020000"
# Configure the list of boards that enable SPINAND
DEVICE_BOARD_ENABLE_SPINAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand-2-128', '', '', d)}"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Fixed configuration from U-Boot source code # Fixed configuration from U-Boot source code

View File

@ -55,6 +55,7 @@ BLUETOOTH_LIST += "linux-firmware-bluetooth-bcm4343"
# Wifi # Wifi
WIFI_LIST += "linux-firmware-bcm43430" WIFI_LIST += "linux-firmware-bcm43430"
MACHINE_FEATURES += " ${@bb.utils.contains_any('BOOTDEVICE_LABELS', ['emmc', 'sdcard'], 'autoresize', '', d)} "
# ========================================================================= # =========================================================================
# Kernel # Kernel
# ========================================================================= # =========================================================================
@ -92,7 +93,6 @@ WIC_CREATE_EXTRA_ARGS = "--no-fstab-update"
WKS_FILE_DEPENDS ?= " \ WKS_FILE_DEPENDS ?= " \
virtual/bootloader \ virtual/bootloader \
virtual/trusted-firmware-a \ virtual/trusted-firmware-a \
virtual/trusted-firmware-a-serialboot \
${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'virtual/optee-os', '', d)} \ ${@bb.utils.contains('BOOTSCHEME_LABELS', 'optee', 'virtual/optee-os', '', d)} \
st-image-bootfs \ st-image-bootfs \
${@bb.utils.contains('ST_VENDORFS','1','st-image-vendorfs', '', d)} \ ${@bb.utils.contains('ST_VENDORFS','1','st-image-vendorfs', '', d)} \

View File

@ -51,11 +51,14 @@ MACHINE_FEATURES += "${@'gpu' if d.getVar('ACCEPT_EULA_'+d.getVar('MACHINE')) ==
MACHINE_FEATURES += "m4copro" MACHINE_FEATURES += "m4copro"
MACHINE_FEATURES += "fit" MACHINE_FEATURES += "fit"
MACHINE_FEATURES_remove = "fip"
# Bluetooth # Bluetooth
#BLUETOOTH_LIST += "linux-firmware-bluetooth-bcm4343" #BLUETOOTH_LIST += "linux-firmware-bluetooth-bcm4343"
# Wifi # Wifi
#WIFI_LIST += "linux-firmware-bcm43430" #WIFI_LIST += "linux-firmware-bcm43430"
MACHINE_FEATURES += " ${@bb.utils.contains_any('BOOTDEVICE_LABELS', ['emmc', 'sdcard'], 'autoresize', '', d)} "
# ========================================================================= # =========================================================================
# Kernel # Kernel
# ========================================================================= # =========================================================================

View File

@ -9,6 +9,11 @@ include conf/machine/include/st-machine-providers-stm32mp.inc
# Define specific familly common machine name # Define specific familly common machine name
MACHINEOVERRIDES .= ":stm32mp1common" MACHINEOVERRIDES .= ":stm32mp1common"
# =========================================================================
# SOC
# =========================================================================
STM32MP_SOC_NAME = "stm32mp15"
# ========================================================================= # =========================================================================
# Chip architecture # Chip architecture
# ========================================================================= # =========================================================================
@ -54,6 +59,8 @@ BLUETOOTH_LIST += "linux-firmware-bluetooth-bcm4343"
# Wifi # Wifi
WIFI_LIST += "linux-firmware-bcm43430" WIFI_LIST += "linux-firmware-bcm43430"
MACHINE_FEATURES += " ${@bb.utils.contains_any('BOOTDEVICE_LABELS', ['emmc', 'sdcard'], 'autoresize', '', d)} "
# ========================================================================= # =========================================================================
# Kernel # Kernel
# ========================================================================= # =========================================================================