U-BOOT-STM32MP: mutliple defconfig for same UBOOT_CONFIG label
In order to manage multiple defconfig definition for same UBOOT_CONFIG label, to address subset of devicetree files form UBOOT_DEVICETREE list, we implement new functionality to provide UBOOT_CONFIG labels with format: UBOOT_CONFIG += "<uboot_config_label>_<uboot_devicetree_filter_pattern>" As soon as UBOOT_CONFIG label contains '_' chars, we split it into two separate parts: - first one for UBOOT_CONFIG label (used as suffix on binary name) - second one for pattern (used as filter on devicetree name) Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
This commit is contained in:
parent
f754ec4495
commit
7223779d5c
|
|
@ -9,7 +9,20 @@ ARCHIVER_MODE[src] = "original"
|
||||||
inherit archiver_stm32mp_clean
|
inherit archiver_stm32mp_clean
|
||||||
|
|
||||||
archiver_create_makefile_for_sdk() {
|
archiver_create_makefile_for_sdk() {
|
||||||
# Init internal var for uboot_configs: should be 'defconfig,type,binary'
|
mkdir -p ${ARCHIVER_OUTDIR}
|
||||||
|
cat << EOF > ${ARCHIVER_OUTDIR}/Makefile.sdk
|
||||||
|
# Set default path
|
||||||
|
SRC_PATH ?= \$(PWD)
|
||||||
|
BLD_PATH ?= \$(SRC_PATH)/../build
|
||||||
|
DEPLOYDIR ?= \$(SRC_PATH)/../deploy
|
||||||
|
|
||||||
|
# Default U-Boot overall settings to null
|
||||||
|
UBOOT_CONFIG ?=
|
||||||
|
UBOOT_DEFCONFIG ?=
|
||||||
|
UBOOT_BINARY ?=
|
||||||
|
UBOOT_DEVICETREE ?=
|
||||||
|
|
||||||
|
EOF
|
||||||
if [ -n "${UBOOT_CONFIG}" ]; then
|
if [ -n "${UBOOT_CONFIG}" ]; then
|
||||||
unset i j k
|
unset i j k
|
||||||
for config in ${UBOOT_MACHINE}; do
|
for config in ${UBOOT_MACHINE}; do
|
||||||
|
|
@ -20,7 +33,24 @@ archiver_create_makefile_for_sdk() {
|
||||||
for binary in ${UBOOT_BINARIES}; do
|
for binary in ${UBOOT_BINARIES}; do
|
||||||
k=$(expr $k + 1);
|
k=$(expr $k + 1);
|
||||||
if [ $k -eq $i ]; then
|
if [ $k -eq $i ]; then
|
||||||
uboot_configs="${uboot_configs} ${config},${type},${binary}"
|
type_suffix=$(echo ${type} | cut -d'_' -f1)
|
||||||
|
type_filter=$(echo ${type} | cut -d'_' -f2)
|
||||||
|
[ "${type_suffix}" = "${type_filter}" ] && type_filter=""
|
||||||
|
if [ -z "${type_filter}" ]; then
|
||||||
|
devicetree="${UBOOT_DEVICETREE}"
|
||||||
|
else
|
||||||
|
devicetree=""
|
||||||
|
for dt in ${UBOOT_DEVICETREE}; do
|
||||||
|
[ -z "$(echo ${dt} | grep ${type_filter})" ] || devicetree="${devicetree} ${dt}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
cat << EOF >> ${ARCHIVER_OUTDIR}/Makefile.sdk
|
||||||
|
# Init default config settings
|
||||||
|
UBOOT_CONFIGS += ${type_suffix}
|
||||||
|
UBOOT_DEFCONFIG_$type_suffix += ${config}
|
||||||
|
UBOOT_BINARY_$config ?= ${binary}
|
||||||
|
UBOOT_DEVICETREE_$config ?= ${devicetree}
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset k
|
unset k
|
||||||
|
|
@ -29,17 +59,8 @@ archiver_create_makefile_for_sdk() {
|
||||||
unset j
|
unset j
|
||||||
done
|
done
|
||||||
unset i
|
unset i
|
||||||
else
|
|
||||||
uboot_configs="${UBOOT_MACHINE},,${UBOOT_BINARY}"
|
|
||||||
fi
|
fi
|
||||||
|
cat << EOF >> ${ARCHIVER_OUTDIR}/Makefile.sdk
|
||||||
mkdir -p ${ARCHIVER_OUTDIR}
|
|
||||||
|
|
||||||
cat << EOF > ${ARCHIVER_OUTDIR}/Makefile.sdk
|
|
||||||
# Set default path
|
|
||||||
SRC_PATH ?= \$(PWD)
|
|
||||||
BLD_PATH ?= \$(SRC_PATH)/../build
|
|
||||||
DEPLOYDIR ?= \$(SRC_PATH)/../deploy
|
|
||||||
|
|
||||||
# Remove default variables
|
# Remove default variables
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
@ -48,25 +69,81 @@ CPPFLAGS =
|
||||||
|
|
||||||
UBOOT_LOCALVERSION = ${UBOOT_LOCALVERSION}
|
UBOOT_LOCALVERSION = ${UBOOT_LOCALVERSION}
|
||||||
|
|
||||||
# Configure default U-Boot configs
|
|
||||||
UBOOT_CONFIGS ?= ${uboot_configs}
|
|
||||||
DEVICE_TREE ?= ${UBOOT_DEVICETREE}
|
|
||||||
|
|
||||||
# Configure default fip feature
|
# Configure default fip feature
|
||||||
ENABLE_FIP ?= "${@bb.utils.contains('MACHINE_FEATURES','fip','1','',d)}"
|
ENABLE_FIP ?= "${@bb.utils.contains('MACHINE_FEATURES','fip','1','',d)}"
|
||||||
|
|
||||||
|
# Display U-Boot config details
|
||||||
|
define uboot-configs
|
||||||
|
echo " \$(1)" ; \\
|
||||||
|
\$(foreach defconfig, \$(if \$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG_\$(1))), \\
|
||||||
|
echo " defconfig : \$(defconfig)" ; \
|
||||||
|
echo " for binary : \$(if \$(UBOOT_BINARY),\$(UBOOT_BINARY),\$(UBOOT_BINARY_\$(defconfig)))" ; \
|
||||||
|
echo " with devicetree: \$(if \$(DEVICETREE),\$(DEVICETREE),\$(UBOOT_DEVICETREE_\$(defconfig)))" ; \
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Configure U-Boot configure rules (configure-DEFCONFIG-CONFIG)
|
||||||
|
define configure-rules
|
||||||
|
configure-\$(1)-\$(2): version
|
||||||
|
ifeq (\$(ENABLE_FIP),)
|
||||||
|
@if ! grep -q 'CONFIG_STM32MP15x_STM32IMAGE=y' \$(SRC_PATH)/configs/\$(1); then \\
|
||||||
|
echo "CONFIG_STM32MP15x_STM32IMAGE=y" >> \$(SRC_PATH)/configs/\$(1) ; \\
|
||||||
|
fi
|
||||||
|
endif
|
||||||
|
@mkdir -p \$(BLD_PATH)/\$(1)
|
||||||
|
@echo \$(UBOOT_LOCALVERSION) > \$(BLD_PATH)/\$(1)/.scmversion
|
||||||
|
\$(MAKE) -C \$(SRC_PATH) O=\$(BLD_PATH)/\$(1) \$(1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Configure U-Boot make rules (uboot-DEFCONFIG-CONFIG)
|
||||||
|
define uboot-rules
|
||||||
|
uboot-\$(1)-\$(2): configure-\$(1)-\$(2)
|
||||||
|
@\$(foreach dt, \$(if \$(DEVICETREE),\$(DEVICETREE),\$(UBOOT_DEVICETREE_\$(1))), \\
|
||||||
|
\$(MAKE) -C \$(SRC_PATH) ${UBOOT_MAKE_TARGET} \\
|
||||||
|
O=\$(BLD_PATH)/\$(1) \\
|
||||||
|
DEVICE_TREE=\$(dt) \\
|
||||||
|
DEVICE_TREE_EXT=\$(dt).dtb ; \\
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Configure U-Boot deploy rules (deploy-DEFCONFIG-CONFIG)
|
||||||
|
define deploy-rules
|
||||||
|
deploy-\$(1)-\$(2): uboot-\$(1)-\$(2)
|
||||||
|
@mkdir -p \$(DEPLOYDIR)
|
||||||
|
@mkdir -p \$(DEPLOYDIR)/debug
|
||||||
|
@\$(foreach dt, \$(if \$(DEVICETREE),\$(DEVICETREE),\$(UBOOT_DEVICETREE_\$(1))), \\
|
||||||
|
cp -f \$(BLD_PATH)/\$(1)/\$(3) \$(DEPLOYDIR)/u-boot-\$(dt)-\$(2).\$(shell echo \$(3) | cut -d'.' -f2) ; \\
|
||||||
|
if [ -f \$(BLD_PATH)/\$(1)/${SPL_BINARY_STM32} ]; then \\
|
||||||
|
cp -f \$(BLD_PATH)/\$(1)/${SPL_BINARY_STM32} \$(DEPLOYDIR)/${SPL_BINARYNAME}-\$(dt)-\$(2) ; \\
|
||||||
|
fi ; \\
|
||||||
|
if [ "\$(shell echo \$(3) | cut -d'.' -f2)" = "dtb" ]; then \\
|
||||||
|
cp -f \$(BLD_PATH)/\$(1)/u-boot-nodtb.bin \$(DEPLOYDIR)/u-boot-nodtb\$(foreach soc,${STM32MP_SOC_NAME},\$(if \$(shell echo \$(dt) | grep -c \$(soc)),-\$(soc),)).bin ; \\
|
||||||
|
fi ; \\
|
||||||
|
if [ -f \$(BLD_PATH)/\$(1)/${UBOOT_ELF} ]; then \\
|
||||||
|
cp -f \$(BLD_PATH)/\$(1)/${UBOOT_ELF} \$(DEPLOYDIR)/debug/u-boot\$(foreach soc,${STM32MP_SOC_NAME},\$(if \$(shell echo \$(dt) | grep -c \$(soc)),-\$(soc),))-\$(2).${UBOOT_ELF_SUFFIX} ; \\
|
||||||
|
fi ; \\
|
||||||
|
if [ -f \$(BLD_PATH)/\$(1)/${SPL_ELF} ]; then \\
|
||||||
|
cp -f \$(BLD_PATH)/\$(1)/${SPL_ELF} \$(DEPLOYDIR)/debug/${SPL_ELF_NAME}\$(foreach soc,${STM32MP_SOC_NAME},\$(if \$(shell echo \$(dt) | grep -c \$(soc)),-\$(soc),))-\$(2) ; \\
|
||||||
|
fi ; \\
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Configure overall deploy rules list
|
||||||
|
deploy-targets := \$(foreach config, \$(if \$(UBOOT_CONFIG),\$(UBOOT_CONFIG),\$(UBOOT_CONFIGS)), \\
|
||||||
|
\$(foreach defconfig, \$(if \$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG_\$(config))), deploy-\$(defconfig)-\$(config)) \\
|
||||||
|
)
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo
|
@echo
|
||||||
@echo "Configured U-Boot config(s):"
|
@echo "U-Boot configuration:"
|
||||||
@for config in \$(UBOOT_CONFIGS); do \\
|
@echo " UBOOT_CONFIG = \$(if \$(UBOOT_CONFIG),\$(UBOOT_CONFIG),\$(UBOOT_CONFIGS))"
|
||||||
defconfig=\$\$(echo \$\$config | cut -d',' -f1) ; \\
|
@echo "Config details:"
|
||||||
type=\$\$(echo \$\$config | cut -d',' -f2) ; \\
|
@\$(foreach config, \$(if \$(UBOOT_CONFIG),\$(UBOOT_CONFIG),\$(UBOOT_CONFIGS)), \$(call uboot-configs,\$(config)))
|
||||||
binary=\$\$(echo \$\$config | cut -d',' -f3) ; \\
|
@echo
|
||||||
echo " \$\$defconfig config (\$\$type type) for \$\$binary binary" ; \\
|
@echo "Note that each U-Boot configuration settings can be updated through overall or specific config var:"
|
||||||
for devicetree in \$(DEVICE_TREE); do \\
|
@echo " UBOOT_DEFCONFIG"
|
||||||
echo " with device tree: \$\$devicetree" ; \\
|
@echo " UBOOT_BINARY"
|
||||||
done ; \\
|
@echo " DEVICETREE"
|
||||||
done
|
|
||||||
@echo
|
@echo
|
||||||
@echo "U-Boot folder configuration:"
|
@echo "U-Boot folder configuration:"
|
||||||
@echo " SRC_PATH = \$(SRC_PATH)"
|
@echo " SRC_PATH = \$(SRC_PATH)"
|
||||||
|
|
@ -81,97 +158,10 @@ endif
|
||||||
@echo
|
@echo
|
||||||
@echo "Available targets:"
|
@echo "Available targets:"
|
||||||
@echo " all : build U-Boot binaries for defined config(s)"
|
@echo " all : build U-Boot binaries for defined config(s)"
|
||||||
|
@echo " fip : build FIP binaries"
|
||||||
@echo " clean : clean build directories from generated files"
|
@echo " clean : clean build directories from generated files"
|
||||||
|
|
||||||
version:
|
all: \$(deploy-targets) \$(if \$(ENABLE_FIP),fip)
|
||||||
@if test ! -e .scmversion ; then echo \$(UBOOT_LOCALVERSION) > \$(SRC_PATH)/.scmversion; fi
|
|
||||||
|
|
||||||
all: uboot \$(if \$(ENABLE_FIP),fip)
|
|
||||||
|
|
||||||
uboot: version
|
|
||||||
@for config in \$(UBOOT_CONFIGS); do \\
|
|
||||||
uboot_config=\$\$(echo \$\$config | cut -d',' -f1) ; \\
|
|
||||||
uboot_type=\$\$(echo \$\$config | cut -d',' -f2) ; \\
|
|
||||||
uboot_binary=\$\$(echo \$\$config | cut -d',' -f3) ; \\
|
|
||||||
uboot_suffix=\$\$(echo \$\$uboot_binary | cut -d'.' -f2) ; \\
|
|
||||||
# Configure destination folder \\
|
|
||||||
if [ "\$\$uboot_suffix" = "img" ]; then \\
|
|
||||||
subfolder=/\$\$uboot_type ; \\
|
|
||||||
else \\
|
|
||||||
subfolder= ; \\
|
|
||||||
fi ; \\
|
|
||||||
mkdir -p \$(DEPLOYDIR)\$\$subfolder ; \\
|
|
||||||
mkdir -p \$(DEPLOYDIR)\$\$subfolder/debug ; \\
|
|
||||||
# Make sure about configuration set \\
|
|
||||||
if test -z "\$\$uboot_config" -o -z "\$\$uboot_type" -o -z "\$\$uboot_binary"; then \\
|
|
||||||
echo ; \\
|
|
||||||
echo "[ERROR] UBOOT_CONFIGS wrongly configured. It should be space separated list of element <defconfig>,<type>,<binary>" ; \\
|
|
||||||
echo ; \\
|
|
||||||
exit 1 ; \\
|
|
||||||
fi ; \\
|
|
||||||
# Dynamic update for defconfig file \\
|
|
||||||
if [ "\$\$uboot_suffix" = "stm32" ]; then \\
|
|
||||||
if ! grep -q 'CONFIG_STM32MP15x_STM32IMAGE=y' "\$(SRC_PATH)/configs/\$\$uboot_config"; then \\
|
|
||||||
echo "CONFIG_STM32MP15x_STM32IMAGE=y" >> "\$(SRC_PATH)/configs/\$\$uboot_config" ; \\
|
|
||||||
fi ; \\
|
|
||||||
fi ; \\
|
|
||||||
# Init folder and defconfig selected \\
|
|
||||||
if [ ! -d \$(BLD_PATH)/\$\$uboot_type ]; then \\
|
|
||||||
mkdir -p \$(BLD_PATH)/\$\$uboot_type ; \\
|
|
||||||
echo \$(UBOOT_LOCALVERSION) > \$(BLD_PATH)/\$\$uboot_type/.scmversion ; \\
|
|
||||||
\$(MAKE) -C \$(SRC_PATH) O=\$(BLD_PATH)/\$\$uboot_type \$\$uboot_config ; \\
|
|
||||||
fi ; \\
|
|
||||||
# Build binaries \\
|
|
||||||
if [ -z "\$(DEVICE_TREE)" ]; then \\
|
|
||||||
\$(MAKE) -C \$(SRC_PATH) O=\$(BLD_PATH)/\$\$uboot_type ${UBOOT_MAKE_TARGET} ; \\
|
|
||||||
# Copy binary files with explicit name \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/\$\$uboot_binary \$(DEPLOYDIR)\$\$subfolder/u-boot-\$\$uboot_type.\$\$uboot_suffix ; \\
|
|
||||||
if [ -f \$(BLD_PATH)/\$\$uboot_type/${SPL_BINARY_STM32} ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/${SPL_BINARY_STM32} \$(DEPLOYDIR)\$\$subfolder/${SPL_BINARYNAME}-\$\$uboot_type ; \\
|
|
||||||
fi ; \\
|
|
||||||
if [ -f \$(BLD_PATH)/\$\$uboot_type/${UBOOT_ELF} ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/${UBOOT_ELF} \$(DEPLOYDIR)\$\$subfolder/debug/u-boot-\$\$uboot_type.${UBOOT_ELF_SUFFIX} ; \\
|
|
||||||
fi ; \\
|
|
||||||
if [ -f \$(BLD_PATH)/\$\$uboot_type/${SPL_ELF} ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/${SPL_ELF} \$(DEPLOYDIR)\$\$subfolder/debug/${SPL_ELF_NAME}-\$\$uboot_type ; \\
|
|
||||||
fi ; \\
|
|
||||||
# Install 'u-boot-nodtb.bin' binary in case '*.dtb' binary installation configured \\
|
|
||||||
if [ "\$\$uboot_suffix" = "dtb" ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/u-boot-nodtb.bin \$(DEPLOYDIR)\$\$subfolder/u-boot-nodtb.bin ; \\
|
|
||||||
fi ; \\
|
|
||||||
else \\
|
|
||||||
for devicetree in \$(DEVICE_TREE); do \\
|
|
||||||
\$(MAKE) -C \$(SRC_PATH) O=\$(BLD_PATH)/\$\$uboot_type ${UBOOT_MAKE_TARGET} DEVICE_TREE=\$\$devicetree DEVICE_TREE_EXT=\$\$devicetree.dtb; \\
|
|
||||||
# Copy binary files with explicit name \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/\$\$uboot_binary \$(DEPLOYDIR)\$\$subfolder/u-boot-\$\$devicetree-\$\$uboot_type.\$\$uboot_suffix ; \\
|
|
||||||
if [ -f \$(BLD_PATH)/\$\$uboot_type/${SPL_BINARY_STM32} ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/${SPL_BINARY_STM32} \$(DEPLOYDIR)\$\$subfolder/${SPL_BINARYNAME}-\$\$devicetree-\$\$uboot_type ; \\
|
|
||||||
fi ; \\
|
|
||||||
if [ -f \$(BLD_PATH)/\$\$uboot_type/${UBOOT_ELF} ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/${UBOOT_ELF} \$(DEPLOYDIR)\$\$subfolder/debug/u-boot-\$\$devicetree-\$\$uboot_type.${UBOOT_ELF_SUFFIX} ; \\
|
|
||||||
fi ; \\
|
|
||||||
if [ -f \$(BLD_PATH)/\$\$uboot_type/${SPL_ELF} ]; then \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/${SPL_ELF} \$(DEPLOYDIR)\$\$subfolder/debug/${SPL_ELF_NAME}-\$\$devicetree-\$\$uboot_type ; \\
|
|
||||||
fi ; \\
|
|
||||||
# Install ''u-boot-nodtb.bin' binary in case '*.dtb' binary installation configured \\
|
|
||||||
if [ "\$\$uboot_suffix" = "dtb" ]; then \\
|
|
||||||
# Init soc suffix \\
|
|
||||||
soc_suffix="" ; \\
|
|
||||||
if [ -n "${STM32MP_SOC_NAME}" ]; then \\
|
|
||||||
for soc in ${STM32MP_SOC_NAME}; do \\
|
|
||||||
if [ "\$\$(echo \$\$devicetree | grep -c \$\$soc)" -eq 1 ]; then \\
|
|
||||||
soc_suffix="-\$\$soc" ; \\
|
|
||||||
fi ; \\
|
|
||||||
done ; \\
|
|
||||||
fi ; \\
|
|
||||||
cp -f \$(BLD_PATH)/\$\$uboot_type/u-boot-nodtb.bin \$(DEPLOYDIR)\$\$subfolder/u-boot-nodtb\$\$soc_suffix.bin ; \\
|
|
||||||
fi ; \\
|
|
||||||
done ; \\
|
|
||||||
fi ; \\
|
|
||||||
done
|
|
||||||
|
|
||||||
fip: uboot
|
|
||||||
FIP_DEPLOYDIR_UBOOT=\$(DEPLOYDIR) FIP_DEVICETREE="\$(DEVICE_TREE)" fiptool-stm32mp
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@for config in \$(UBOOT_CONFIGS); do \\
|
@for config in \$(UBOOT_CONFIGS); do \\
|
||||||
|
|
@ -182,6 +172,24 @@ clean:
|
||||||
@echo "Removing \$(DEPLOYDIR) ..."
|
@echo "Removing \$(DEPLOYDIR) ..."
|
||||||
@rm -rf \$(DEPLOYDIR)
|
@rm -rf \$(DEPLOYDIR)
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
fip: \$(deploy-targets)
|
||||||
|
FIP_DEPLOYDIR_UBOOT=\$(DEPLOYDIR) FIP_DEVICETREE="\$(DEVICE_TREE)" fiptool-stm32mp
|
||||||
|
|
||||||
|
version:
|
||||||
|
@if test ! -e \$(SRC_PATH)/.scmversion ; then echo \$(UBOOT_LOCALVERSION) > \$(SRC_PATH)/.scmversion; fi
|
||||||
|
|
||||||
|
# Set U-Boot configure rules
|
||||||
|
\$(foreach config, \$(if \$(UBOOT_CONFIG),\$(UBOOT_CONFIG),\$(UBOOT_CONFIGS)), \\
|
||||||
|
\$(foreach defconfig, \$(if \$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG_\$(config))), \$(eval \$(call configure-rules,\$(defconfig),\$(config)))))
|
||||||
|
# Set U-Boot make rules
|
||||||
|
\$(foreach config, \$(if \$(UBOOT_CONFIG),\$(UBOOT_CONFIG),\$(UBOOT_CONFIGS)), \\
|
||||||
|
\$(foreach defconfig, \$(if \$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG_\$(config))), \$(eval \$(call uboot-rules,\$(defconfig),\$(config)))))
|
||||||
|
# Set U-Boot deploy rules
|
||||||
|
\$(foreach config, \$(if \$(UBOOT_CONFIG),\$(UBOOT_CONFIG),\$(UBOOT_CONFIGS)), \\
|
||||||
|
\$(foreach defconfig, \$(if \$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG),\$(UBOOT_DEFCONFIG_\$(config))), \\
|
||||||
|
\$(eval \$(call deploy-rules,\$(defconfig),\$(config),\$(if \$(UBOOT_BINARY),\$(UBOOT_BINARY),\$(UBOOT_BINARY_\$(defconfig)))))))
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
do_ar_original[prefuncs] += "archiver_create_makefile_for_sdk"
|
do_ar_original[prefuncs] += "archiver_create_makefile_for_sdk"
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,9 @@ do_configure_prepend() {
|
||||||
if [ -f "${S}/configs/${config}" ]; then
|
if [ -f "${S}/configs/${config}" ]; then
|
||||||
# Create copy of original defconfig
|
# Create copy of original defconfig
|
||||||
cp -f "${S}/configs/${config}" "${WORKDIR}/"
|
cp -f "${S}/configs/${config}" "${WORKDIR}/"
|
||||||
i=$(expr $i + 1);
|
i=$(expr $i + 1)
|
||||||
for binary in ${UBOOT_BINARIES}; do
|
for binary in ${UBOOT_BINARIES}; do
|
||||||
j=$(expr $j + 1);
|
j=$(expr $j + 1)
|
||||||
if [ $j -eq $i ]; then
|
if [ $j -eq $i ]; then
|
||||||
binarysuffix=$(echo ${binary} | cut -d'.' -f2)
|
binarysuffix=$(echo ${binary} | cut -d'.' -f2)
|
||||||
# Make sure to select STM32IMAGE if requested
|
# Make sure to select STM32IMAGE if requested
|
||||||
|
|
@ -85,7 +85,6 @@ do_configure_prepend() {
|
||||||
unset j
|
unset j
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset i
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +141,6 @@ do_configure_append() {
|
||||||
#
|
#
|
||||||
do_compile_append() {
|
do_compile_append() {
|
||||||
if [ -n "${UBOOT_DEVICETREE}" ]; then
|
if [ -n "${UBOOT_DEVICETREE}" ]; then
|
||||||
for devicetree in ${UBOOT_DEVICETREE}; do
|
|
||||||
if [ -n "${UBOOT_CONFIG}" ]; then
|
if [ -n "${UBOOT_CONFIG}" ]; then
|
||||||
unset i j k
|
unset i j k
|
||||||
for config in ${UBOOT_MACHINE}; do
|
for config in ${UBOOT_MACHINE}; do
|
||||||
|
|
@ -150,40 +148,45 @@ do_compile_append() {
|
||||||
for type in ${UBOOT_CONFIG}; do
|
for type in ${UBOOT_CONFIG}; do
|
||||||
j=$(expr $j + 1);
|
j=$(expr $j + 1);
|
||||||
if [ $j -eq $i ]; then
|
if [ $j -eq $i ]; then
|
||||||
if [ -f ${B}/${config}/dts/dt.dtb ];
|
# Get short suffix for current type
|
||||||
then
|
type_suffix=$(echo ${type} | cut -d'_' -f1)
|
||||||
rm ${B}/${config}/dts/dt.dtb
|
type_filter=$(echo ${type} | cut -d'_' -f2)
|
||||||
|
[ "${type_suffix}" = "${type_filter}" ] && type_filter=""
|
||||||
|
for devicetree in ${UBOOT_DEVICETREE}; do
|
||||||
|
if [ -n "${type_filter}" ]; then
|
||||||
|
if [ "$(echo ${devicetree} | grep -c ${type_filter})" -eq 1 ]; then
|
||||||
|
bbnote "The ${type_filter} filter for ${type_suffix} config matches ${devicetree} device tree. Go for build..."
|
||||||
|
else
|
||||||
|
bbnote "The ${type_filter} filter for ${type_suffix} config doesn't match ${devicetree} device tree. Skip build!"
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
# Cleanup previous build artifact
|
||||||
|
[ -f "${B}/${config}/dts/dt.dtb" ] && rm "${B}/${config}/dts/dt.dtb"
|
||||||
|
# Build target
|
||||||
oe_runmake -C ${S} O=${B}/${config} DEVICE_TREE=${devicetree} DEVICE_TREE_EXT=${devicetree}.dtb
|
oe_runmake -C ${S} O=${B}/${config} DEVICE_TREE=${devicetree} DEVICE_TREE_EXT=${devicetree}.dtb
|
||||||
|
# Install specific binary
|
||||||
for binary in ${UBOOT_BINARIES}; do
|
for binary in ${UBOOT_BINARIES}; do
|
||||||
binarysuffix=$(echo ${binary} | cut -d'.' -f2)
|
|
||||||
binaryprefix=$(echo ${binary} | cut -d'.' -f1)
|
|
||||||
k=$(expr $k + 1);
|
k=$(expr $k + 1);
|
||||||
if [ $k -eq $i ]; then
|
if [ $k -eq $i ]; then
|
||||||
install -m 644 ${B}/${config}/${binary} ${B}/${config}/u-boot-${devicetree}-${type}.${binarysuffix}
|
binarysuffix=$(echo ${binary} | cut -d'.' -f2)
|
||||||
if [ -n "${UBOOT_ELF}" ]; then
|
install -m 644 ${B}/${config}/${binary} ${B}/${config}/u-boot-${devicetree}-${type_suffix}.${binarysuffix}
|
||||||
install -m 644 ${B}/${config}/${UBOOT_ELF} ${B}/${config}/u-boot-${devicetree}-${type}.${UBOOT_ELF_SUFFIX}
|
|
||||||
fi
|
|
||||||
# As soon as SPL binary exists, copy it with specific binary_type name
|
|
||||||
# This allow to mix u-boot configuration, with and without SPL
|
|
||||||
if [ -f ${B}/${config}/${SPL_BINARY_STM32} ]; then
|
|
||||||
install -m 644 ${B}/${config}/${SPL_BINARY_STM32} ${B}/${config}/${SPL_BINARYNAME}-${devicetree}-${type}
|
|
||||||
fi
|
|
||||||
if [ -n "${SPL_ELF}" ] && [ -f ${B}/${config}/${SPL_ELF} ]; then
|
|
||||||
install -m 644 ${B}/${config}/${SPL_ELF} ${B}/${config}/${SPL_ELF_NAME}-${devicetree}-${type}
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset k
|
unset k
|
||||||
|
# As soon as SPL binary exists, copy it with specific binary_type name
|
||||||
|
# This allow to mix u-boot configuration, with and without SPL
|
||||||
|
if [ -f "${B}/${config}/${SPL_BINARY_STM32}" ]; then
|
||||||
|
install -m 644 ${B}/${config}/${SPL_BINARY_STM32} ${B}/${config}/${SPL_BINARYNAME}-${devicetree}-${type_suffix}
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset j
|
unset j
|
||||||
done
|
done
|
||||||
unset i
|
|
||||||
else
|
else
|
||||||
bbfatal "Wrong u-boot-stm32mp configuration: please make sure to use UBOOT_CONFIG through BOOTSCHEME_LABELS config"
|
bbfatal "Wrong u-boot-stm32mp configuration: please make sure to use UBOOT_CONFIG through BOOTSCHEME_LABELS config"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,60 +196,69 @@ do_compile_append() {
|
||||||
do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}/u-boot"
|
do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}/u-boot"
|
||||||
do_deploy_append() {
|
do_deploy_append() {
|
||||||
if [ -n "${UBOOT_DEVICETREE}" ]; then
|
if [ -n "${UBOOT_DEVICETREE}" ]; then
|
||||||
|
if [ -n "${UBOOT_CONFIG}" ]; then
|
||||||
# Clean deploydir from any available binary first
|
# Clean deploydir from any available binary first
|
||||||
# This allows to only install the devicetree binary ones
|
# This allows to only install the devicetree binary ones
|
||||||
rm -rf ${DEPLOYDIR}
|
rm -rf ${DEPLOYDIR}
|
||||||
|
install -d ${DEPLOYDIR}
|
||||||
|
|
||||||
for devicetree in ${UBOOT_DEVICETREE}; do
|
|
||||||
if [ -n "${UBOOT_CONFIG}" ]; then
|
|
||||||
unset i j k
|
unset i j k
|
||||||
for config in ${UBOOT_MACHINE}; do
|
for config in ${UBOOT_MACHINE}; do
|
||||||
i=$(expr $i + 1);
|
i=$(expr $i + 1)
|
||||||
for type in ${UBOOT_CONFIG}; do
|
for type in ${UBOOT_CONFIG}; do
|
||||||
j=$(expr $j + 1);
|
j=$(expr $j + 1)
|
||||||
if [ $j -eq $i ]; then
|
if [ $j -eq $i ]; then
|
||||||
for binary in ${UBOOT_BINARIES}; do
|
for binary in ${UBOOT_BINARIES}; do
|
||||||
binarysuffix=$(echo ${binary} | cut -d'.' -f2)
|
k=$(expr $k + 1)
|
||||||
k=$(expr $k + 1);
|
|
||||||
if [ $k -eq $i ]; then
|
if [ $k -eq $i ]; then
|
||||||
|
binarysuffix=$(echo ${binary} | cut -d'.' -f2)
|
||||||
# Manage subfolder in case of u-boot.img
|
# Manage subfolder in case of u-boot.img
|
||||||
if [ "${binarysuffix}" = "img" ]; then
|
if [ "${binarysuffix}" = "img" ]; then
|
||||||
SUBFOLDER=/${type}
|
SUBFOLDER="/${type}"
|
||||||
else
|
else
|
||||||
SUBFOLDER=""
|
SUBFOLDER=""
|
||||||
fi
|
fi
|
||||||
# Install destination folder
|
# Install destination folder
|
||||||
install -d ${DEPLOYDIR}${SUBFOLDER}
|
install -d ${DEPLOYDIR}${SUBFOLDER}
|
||||||
if [ -n "${ELF_DEBUG_ENABLE}" ]; then
|
[ -n "${ELF_DEBUG_ENABLE}" ] && install -d ${DEPLOYDIR}${SUBFOLDER}/debug
|
||||||
install -d ${DEPLOYDIR}${SUBFOLDER}/debug
|
# Get short suffix for current type
|
||||||
|
type_suffix=$(echo ${type} | cut -d'_' -f1)
|
||||||
|
type_filter=$(echo ${type} | cut -d'_' -f2)
|
||||||
|
[ "${type_suffix}" = "${type_filter}" ] && type_filter=""
|
||||||
|
for devicetree in ${UBOOT_DEVICETREE}; do
|
||||||
|
if [ -n "${type_filter}" ]; then
|
||||||
|
if [ "$(echo ${devicetree} | grep -c ${type_filter})" -eq 1 ]; then
|
||||||
|
bbnote "The ${type_filter} filter for ${type_suffix} config matches ${devicetree} device tree. Go for binary deploy..."
|
||||||
|
else
|
||||||
|
bbnote "The ${type_filter} filter for ${type_suffix} config doesn't match ${devicetree} device tree. Skip binary deploy!"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# Install u-boot binary
|
# Install u-boot binary
|
||||||
install -m 644 ${B}/${config}/u-boot-${devicetree}-${type}.${binarysuffix} ${DEPLOYDIR}${SUBFOLDER}
|
install -m 644 ${B}/${config}/u-boot-${devicetree}-${type_suffix}.${binarysuffix} ${DEPLOYDIR}${SUBFOLDER}/
|
||||||
if [ -n "${UBOOT_ELF}" ]; then
|
# As soon as SPL binary exists, install it
|
||||||
install -d ${DEPLOYDIR}${SUBFOLDER}/debug
|
# This allow to mix u-boot configuration, with and without SPL
|
||||||
install -m 644 ${B}/${config}/u-boot-${devicetree}-${type}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}${SUBFOLDER}/debug/
|
if [ -f "${B}/${config}/${SPL_BINARYNAME}-${devicetree}-${type_suffix}" ]; then
|
||||||
|
install -m 644 ${B}/${config}/${SPL_BINARYNAME}-${devicetree}-${type_suffix} ${DEPLOYDIR}${SUBFOLDER}/
|
||||||
fi
|
fi
|
||||||
# Install 'u-boot-nodtb.bin' binary in case '*.dtb' binary installation configured
|
|
||||||
if [ "${binarysuffix}" = "dtb" ]; then
|
|
||||||
# Init soc suffix
|
# Init soc suffix
|
||||||
soc_suffix=""
|
soc_suffix=""
|
||||||
if [ -n "${STM32MP_SOC_NAME}" ]; then
|
if [ -n "${STM32MP_SOC_NAME}" ]; then
|
||||||
for soc in ${STM32MP_SOC_NAME}; do
|
for soc in ${STM32MP_SOC_NAME}; do
|
||||||
if [ "$(echo ${devicetree} | grep -c ${soc})" -eq 1 ]; then
|
[ "$(echo ${devicetree} | grep -c ${soc})" -eq 1 ] && soc_suffix="-${soc}"
|
||||||
soc_suffix="-${soc}"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
# Install 'u-boot-nodtb.bin' binary in case '*.dtb' binary installation configured
|
||||||
|
if [ "${binarysuffix}" = "dtb" ]; then
|
||||||
install -m 644 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}${SUBFOLDER}/u-boot-nodtb${soc_suffix}.bin
|
install -m 644 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}${SUBFOLDER}/u-boot-nodtb${soc_suffix}.bin
|
||||||
fi
|
fi
|
||||||
# As soon as SPL binary exists, install it
|
if [ -n "${UBOOT_ELF}" ]; then
|
||||||
# This allow to mix u-boot configuration, with and without SPL
|
install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}${SUBFOLDER}/debug/u-boot${soc_suffix}-${type_suffix}.${UBOOT_ELF_SUFFIX}
|
||||||
if [ -f ${B}/${config}/${SPL_BINARYNAME}-${devicetree}-${type} ]; then
|
|
||||||
install -m 644 ${B}/${config}/${SPL_BINARYNAME}-${devicetree}-${type} ${DEPLOYDIR}${SUBFOLDER}/
|
|
||||||
fi
|
fi
|
||||||
if [ -n "${SPL_ELF}" ] && [ -f ${B}/${config}/${SPL_ELF_NAME}-${devicetree}-${type} ]; then
|
if [ -n "${SPL_ELF}" ] && [ -f "${B}/${config}/${SPL_ELF}" ]; then
|
||||||
install -m 644 ${B}/${config}/${SPL_ELF_NAME}-${devicetree}-${type} ${DEPLOYDIR}${SUBFOLDER}/debug
|
install -m 644 ${B}/${config}/${SPL_ELF} ${DEPLOYDIR}${SUBFOLDER}/debug/${SPL_ELF_NAME}${soc_suffix}-${type_suffix}
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset k
|
unset k
|
||||||
|
|
@ -254,11 +266,9 @@ do_deploy_append() {
|
||||||
done
|
done
|
||||||
unset j
|
unset j
|
||||||
done
|
done
|
||||||
unset i
|
|
||||||
else
|
else
|
||||||
bbfatal "Wrong u-boot-stm32mp configuration: please make sure to use UBOOT_CONFIG through BOOTSCHEME_LABELS config"
|
bbfatal "Wrong u-boot-stm32mp configuration: please make sure to use UBOOT_CONFIG through BOOTSCHEME_LABELS config"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,25 +126,24 @@ As mentionned in help, OpenSTLinux has activated FIP by default, so the FIP_arti
|
||||||
- Compile default U-Boot configuration:
|
- Compile default U-Boot configuration:
|
||||||
$> make -f $PWD/../Makefile.sdk all
|
$> make -f $PWD/../Makefile.sdk all
|
||||||
|
|
||||||
Default U-Boot configuration is done in 'Makefile.sdk' file through two specific
|
Default U-Boot configuration is done in 'Makefile.sdk' file through specific variables
|
||||||
variables 'DEVICE_TREE' and 'UBOOT_CONFIGS':
|
'BOOT_CONFIG', 'UBOOT_DEFCONFIG', 'UBOOT_BINARY' and 'UBOOT_DEVICETREE':
|
||||||
- 'DEVICE_TREE' is a list of device tree to build, using 'space' as separator.
|
- 'UBOOT_CONFIG' is the name to append to U-boot binaries (ex: 'trusted', etc).
|
||||||
ex: DEVICE_TREE="<devicetree1> <devicetree2>"
|
ex: UBOOT_CONFIG=trusted
|
||||||
- 'UBOOT_CONFIGS' is a list of '<defconfig>,<type>,<binary>' configurations,
|
- 'UBOOT_DEFCONFIG' is the name of U-Boot defconfig to build
|
||||||
<defconfig> is the u-boot defconfig to use to build
|
ex: UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig
|
||||||
<type> is the name append to u-boot binaries (ex: 'trusted', 'basic', etc)
|
- 'UBOOT_BINARY' is the U-Boot binary to export (ex: 'u-boot.dtb', 'u-boot.img', etc)
|
||||||
<binary> is the u-boot binary to export (ex: 'u-boot.bin', 'u-boot.stm32', etc)
|
ex: UBOOT_BINARY=u-boot.dtb
|
||||||
ex: UBOOT_CONFIGS="<defconfig1>,basic,u-boot.bin <defconfig1>,trusted,u-boot.stm32"
|
- 'UBOOT_DEVICETREE' is a list of device tree to build, using 'space' as separator.
|
||||||
|
ex: UBOOT_DEVICETREE="<devicetree1> <devicetree2>"
|
||||||
|
|
||||||
The generated FIP images are available in $FIP_DEPLOYDIR_ROOT/fip
|
The generated FIP images are available in $FIP_DEPLOYDIR_ROOT/fip
|
||||||
|
|
||||||
You can override the default U-Boot configuration if you specify these variables:
|
You can override the default U-Boot configuration if you specify these variables:
|
||||||
- Compile default U-Boot configuration but applying specific devicetree(s):
|
- Compile default U-Boot configuration but applying specific devicetree(s):
|
||||||
$ make -f $PWD/../Makefile.sdk all DEVICE_TREE="<devicetree1> <devicetree2>"
|
$ make -f $PWD/../Makefile.sdk all UBOOT_DEVICETREE="<devicetree1> <devicetree2>"
|
||||||
- Compile for a specific U-Boot configuration:
|
- Compile for a specific U-Boot configuration:
|
||||||
$ make -f $PWD/../Makefile.sdk all UBOOT_CONFIGS=<u-boot defconfig>,<u-boot type>,<u-boot binary>
|
$ make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE=stm32mp157f-dk2
|
||||||
- Compile for a specific U-Boot configuration and applying specific devicetree(s):
|
|
||||||
$ make -f $PWD/../Makefile.sdk all UBOOT_CONFIGS=<u-boot defconfig>,<u-boot type>,<u-boot binary> DEVICE_TREE="<devicetree1> <devicetree2>"
|
|
||||||
|
|
||||||
6. Update software on board:
|
6. Update software on board:
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue