Configure extlinux.conf file generation for kernel fit image

Change-Id: I579efe79781803f383369c887b128a33cca9155b
This commit is contained in:
Christophe Priouzeau 2020-10-27 12:14:48 +01:00 committed by Bernard PUEL
parent 3af4293be8
commit e0deb8b0bd
5 changed files with 85 additions and 39 deletions

View File

@ -71,6 +71,9 @@
UBOOT_EXTLINUX_TARGETS ?= "" UBOOT_EXTLINUX_TARGETS ?= ""
# Configure FIT kernel image for extlinux file creation
UBOOT_EXTLINUX_FIT ??= "0"
UBOOT_EXTLINUX_CONSOLE ??= "console=${console}" UBOOT_EXTLINUX_CONSOLE ??= "console=${console}"
UBOOT_EXTLINUX_LABELS ??= "linux" UBOOT_EXTLINUX_LABELS ??= "linux"
UBOOT_EXTLINUX_FDT ??= "" UBOOT_EXTLINUX_FDT ??= ""
@ -136,7 +139,13 @@ def create_extlinux_file(cfile, labels, data):
fdt = localdata.getVar('UBOOT_EXTLINUX_FDT') fdt = localdata.getVar('UBOOT_EXTLINUX_FDT')
if fdt: fit = localdata.getVar('UBOOT_EXTLINUX_FIT')
if fit == '1':
# Set specific kernel configuration if 'fit' feature is enabled
kernel_image = kernel_image + '#conf@' + label + '.dtb'
cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image))
elif fdt:
cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' % cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' %
(menu_description, kernel_image, fdt)) (menu_description, kernel_image, fdt))
elif fdtdir: elif fdtdir:
@ -172,6 +181,9 @@ python do_create_multiextlinux_config() {
# an override for that target will be added back in while we're processing that target # an override for that target will be added back in while we're processing that target
keep_overrides = list(filter(lambda x: x not in target_overrides, default_overrides)) keep_overrides = list(filter(lambda x: x not in target_overrides, default_overrides))
# Init FIT parameter
fit_config = d.getVar('UBOOT_EXTLINUX_FIT')
for target in targets.split(): for target in targets.split():
bb.note("Loop for '%s' target" % target) bb.note("Loop for '%s' target" % target)
@ -201,7 +213,10 @@ python do_create_multiextlinux_config() {
# Create extlinux folder # Create extlinux folder
bb.utils.mkdirhier(os.path.dirname(cfile)) bb.utils.mkdirhier(os.path.dirname(cfile))
# Go for config file creation # Standard extlinux file creation
if fit_config == '1':
bb.note("UBOOT_EXTLINUX_FIT set to '1'. Skip standard extlinux file creation")
else:
bb.note("Create %s/extlinux.conf file for %s labels" % (subdir, labels)) bb.note("Create %s/extlinux.conf file for %s labels" % (subdir, labels))
create_extlinux_file(cfile, labels, d) create_extlinux_file(cfile, labels, d)
@ -216,6 +231,25 @@ python do_create_multiextlinux_config() {
# Init extra config vars: # Init extra config vars:
extra_extlinuxlabels = "" extra_extlinuxlabels = ""
extra_cfile = "" extra_cfile = ""
# Specific case for 'fit' to automate configuration with device tree name
if fit_config == '1':
# Override current 'labels' with 'config' from UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG
# Under such configuration, UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG should contain the
# list of supported device tree file (without '.dtb' suffix) to allow proper extlinux
# file creation for each device tree file.
bb.note(">>> Override default init to allow default extlinux file creation with %s config as extra label." % config)
labels = config
# Update extra config vars for this specific case:
extra_extlinuxlabels = labels
extra_cfile = os.path.join(d.getVar('B'), subdir , config + '_' + 'extlinux.conf')
# Configure dynamically the default menu configuration if there is no specific one configured
if d.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL_%s' % config):
bb.note(">>> Specific configuration for UBOOT_EXTLINUX_DEFAULT_LABEL var detected for %s label: %s" % (config, d.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL_%s' % config)))
else:
bb.note(">>> Set UBOOT_EXTLINUX_DEFAULT_LABEL to %s" % config)
d.setVar('UBOOT_EXTLINUX_DEFAULT_LABEL', config)
# Append extra configuration if any
for f, v in extra_extlinuxtargetconfigflag.items(): for f, v in extra_extlinuxtargetconfigflag.items():
if config == f: if config == f:
bb.note(">>> Loop for '%s' extra target config." % config) bb.note(">>> Loop for '%s' extra target config." % config)
@ -238,7 +272,7 @@ do_create_multiextlinux_config[cleandirs] += "${B}"
# Manage specific var dependency: # Manage specific var dependency:
# Because of local overrides within create_multiextlinux_config() function, we # Because of local overrides within create_multiextlinux_config() function, we
# need to make sure to add each variables to the vardeps list. # need to make sure to add each variables to the vardeps list.
UBOOT_EXTLINUX_TARGET_VARS = "LABELS BOOTPREFIXES TIMEOUT DEFAULT_LABEL TARGETS_EXTRA_CONFIG" UBOOT_EXTLINUX_TARGET_VARS = "FIT LABELS BOOTPREFIXES TIMEOUT DEFAULT_LABEL TARGETS_EXTRA_CONFIG"
do_create_multiextlinux_config[vardeps] += "${@' '.join(['UBOOT_EXTLINUX_%s_%s' % (v, l) for v in d.getVar('UBOOT_EXTLINUX_TARGET_VARS').split() for l in d.getVar('UBOOT_EXTLINUX_TARGETS').split()])}" do_create_multiextlinux_config[vardeps] += "${@' '.join(['UBOOT_EXTLINUX_%s_%s' % (v, l) for v in d.getVar('UBOOT_EXTLINUX_TARGET_VARS').split() for l in d.getVar('UBOOT_EXTLINUX_TARGETS').split()])}"
UBOOT_EXTLINUX_LABELS_VARS = "CONSOLE MENU_DESCRIPTION ROOT KERNEL_IMAGE FDTDIR FDT KERNEL_ARGS INITRD" UBOOT_EXTLINUX_LABELS_VARS = "CONSOLE MENU_DESCRIPTION ROOT KERNEL_IMAGE FDTDIR FDT KERNEL_ARGS INITRD"
UBOOT_EXTLINUX_LABELS_CONFIGURED = "${@" ".join(map(lambda t: "%s" % d.getVar("UBOOT_EXTLINUX_LABELS_%s" % t), d.getVar('UBOOT_EXTLINUX_TARGETS').split()))}" UBOOT_EXTLINUX_LABELS_CONFIGURED = "${@" ".join(map(lambda t: "%s" % d.getVar("UBOOT_EXTLINUX_LABELS_%s" % t), d.getVar('UBOOT_EXTLINUX_TARGETS').split()))}"

View File

@ -352,7 +352,7 @@ def get_binaryname(labeltype, bootscheme, config, partition, d):
bb.note('>>> Basename selected for %s: %s' % (binary_name, binary_name_base)) bb.note('>>> Basename selected for %s: %s' % (binary_name, binary_name_base))
# Treat TF-A, TEE, U-BOOT and U-BOOT-SPL binary rename case # Treat TF-A, TEE, U-BOOT and U-BOOT-SPL binary rename case
if re.match('^tf-a.*$', binary_name_base) or re.match('^u-boot.*$', binary_name_base) or re.match('^tee-.*$', binary_name_base): 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):
file_name, file_ext = os.path.splitext(binary_name) file_name, file_ext = os.path.splitext(binary_name)
# Init binary_type to use from labeltype # Init binary_type to use from labeltype
binary_type = labeltype + '-' + bootscheme binary_type = labeltype + '-' + bootscheme
@ -373,6 +373,8 @@ def get_binaryname(labeltype, bootscheme, config, partition, d):
# Append binary_type to binary name # Append binary_type to binary name
if re.match('^u-boot-spl.*$', binary_name_base): if re.match('^u-boot-spl.*$', binary_name_base):
binary_name = file_name + file_ext + '-' + binary_type binary_name = file_name + file_ext + '-' + binary_type
elif re.match('^zImage.*$', binary_name_base):
binary_name = file_name + '-' + labeltype + file_ext
else: else:
binary_name = file_name + '-' + binary_type + file_ext binary_name = file_name + '-' + binary_type + file_ext

View File

@ -38,6 +38,9 @@ MACHINE_FEATURES_append = " autoresize "
# 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)}"
# Use Little Kernel loader to program storage device
MACHINE_FEATURES += "kloader"
# 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"
@ -169,7 +172,7 @@ EXTRA_IMAGECMD_ext4 = "-i 4096 -L ${@d.getVar('IMAGE_NAME_SUFFIX').replace('.',
# Allow debug on the platform with gdb and openocd tools # Allow debug on the platform with gdb and openocd tools
EXTRA_IMAGEDEPENDS_append = " \ EXTRA_IMAGEDEPENDS_append = " \
gdb-cross-arm \ gdb-cross-${TARGET_ARCH} \
openocd-stm32mp-native \ openocd-stm32mp-native \
stm32wrapper4dbg-native \ stm32wrapper4dbg-native \
sdcard-raw-tools-native \ sdcard-raw-tools-native \
@ -192,6 +195,11 @@ ST_TOOLS_FOR_SDK_PERL = " \
nativesdk-perl-module-encode-mime-header \ nativesdk-perl-module-encode-mime-header \
" "
# For some scripts in kernel source code
ST_TOOLS_FOR_SDK_PERL = " \
nativesdk-perl-module-file-spec-functions \
"
ST_TOOLS_FOR_SDK_append = " ${ST_TOOLS_FOR_SDK_PERL} " ST_TOOLS_FOR_SDK_append = " ${ST_TOOLS_FOR_SDK_PERL} "
# For support of python module for optee-os # For support of python module for optee-os
@ -248,8 +256,8 @@ TOOLCHAIN_HOST_TASK_remove_task-populate-sdk-ext = " ${ST_DEPENDENCIES_BUILD_FOR
# uninative: basic tools for devtool # uninative: basic tools for devtool
TOOLCHAIN_HOST_TASK_remove_pn-buildtools-tarball = " ${ST_TOOLS_FOR_SDK_PERL} " TOOLCHAIN_HOST_TASK_remove_pn-buildtools-tarball = " ${ST_TOOLS_FOR_SDK_PERL} "
TOOLCHAIN_TARGET_TASK += " bash-dev " TOOLCHAIN_TARGET_TASK += " bash-dev libgomp-dev"
TOOLCHAIN_TARGET_TASK_remove_pn-buildtools-tarball = " bash-dev " TOOLCHAIN_TARGET_TASK_remove_pn-buildtools-tarball = " bash-dev libgomp-dev"
# ========================================================================= # =========================================================================
# Kernel # Kernel
@ -258,15 +266,19 @@ TOOLCHAIN_TARGET_TASK_remove_pn-buildtools-tarball = " bash-dev "
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp" PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
# Kernel image type # Kernel image type
KERNEL_IMAGETYPE = "uImage" 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 =+ " zImage " 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 ?= ""
# For fit usage
UBOOT_ENTRYPOINT = "0xC0800000"
# List of device tree to install # List of device tree to install
KERNEL_DEVICETREE ?= "${STM32MP_KERNEL_DEVICETREE}" KERNEL_DEVICETREE ?= "${STM32MP_KERNEL_DEVICETREE}"
STM32MP_KERNEL_DEVICETREE += "${@' '.join('%s.dtb' % d for d in '${STM32MP_DEVICETREE}'.split())}" STM32MP_KERNEL_DEVICETREE += "${@' '.join('%s.dtb' % d for d in '${STM32MP_DEVICETREE}'.split())}"

View File

@ -2,10 +2,10 @@
# Define extlinux console for stm32mp machine # Define extlinux console for stm32mp machine
UBOOT_EXTLINUX_CONSOLE = "console=${@d.getVar('SERIAL_CONSOLE').split()[1]},${@d.getVar('SERIAL_CONSOLE').split()[0]}" UBOOT_EXTLINUX_CONSOLE = "console=${@d.getVar('SERIAL_CONSOLE').split()[1]},${@d.getVar('SERIAL_CONSOLE').split()[0]}"
# Define FIT option for extlinux file generation
UBOOT_EXTLINUX_FIT = "${@bb.utils.contains('MACHINE_FEATURES', 'fit', '1', '0', d)}"
# Define default FDTDIR for all configs # Define default FDTDIR for all configs
UBOOT_EXTLINUX_FDTDIR = "/" UBOOT_EXTLINUX_FDTDIR = "/"
# Define default MENU DESCRIPTION for all configs
UBOOT_EXTLINUX_MENU_DESCRIPTION = "OpenSTLinux"
# Define default boot config for all config # Define default boot config for all config
UBOOT_EXTLINUX_DEFAULT_LABEL ?= "OpenSTLinux" UBOOT_EXTLINUX_DEFAULT_LABEL ?= "OpenSTLinux"
# Define default INITRD for all configs # Define default INITRD for all configs
@ -34,6 +34,13 @@ UBOOT_EXTLINUX_ROOT_target-sdcard = "root=PARTUUID=${DEVICE_PARTUUID_ROOTFS_SDCA
UBOOT_EXTLINUX_ROOT_target-emmc = "root=PARTUUID=${DEVICE_PARTUUID_ROOTFS_EMMC}" UBOOT_EXTLINUX_ROOT_target-emmc = "root=PARTUUID=${DEVICE_PARTUUID_ROOTFS_EMMC}"
# Define INITRD overrides for nand target # Define INITRD overrides for nand target
UBOOT_EXTLINUX_INITRD_target-nand = "" UBOOT_EXTLINUX_INITRD_target-nand = ""
# -----------------------------------------------------------------------------
# Configure default labels
# -----------------------------------------------------------------------------
# Define MENU_DESCRIPTION for rootfs label to default one to force selection
UBOOT_EXTLINUX_MENU_DESCRIPTION_rootfs = "OpenSTLinux"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Append specific examples configs # Append specific examples configs
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -55,40 +62,30 @@ UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG_target-emmc += "${STM32MP_DT_FILES_EV}"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG_target-nand += "${STM32MP_DT_FILES_ED}" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG_target-nand += "${STM32MP_DT_FILES_ED}"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG_target-nand += "${STM32MP_DT_FILES_EV}" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG_target-nand += "${STM32MP_DT_FILES_EV}"
# Define extra label configuration # Define extra label configuration
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-dk2] += "stm32mp157c-dk2-a7" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-dk2] += "stm32mp157c-dk2-a7-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-dk2] += "stm32mp157c-dk2-m4" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-dk2] += "stm32mp157f-dk2-a7-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-ev1] += "stm32mp157c-ev1-a7" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-ev1] += "stm32mp157c-ev1-a7-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-ev1] += "stm32mp157c-ev1-m4" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-ev1] += "stm32mp157f-ev1-a7-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-dk2] += "stm32mp157f-dk2-a7" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-dk2] += "stm32mp157c-dk2-m4-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-dk2] += "stm32mp157f-dk2-m4" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157c-ev1] += "stm32mp157c-ev1-m4-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-ev1] += "stm32mp157f-ev1-a7" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-dk2] += "stm32mp157f-dk2-m4-examples"
UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-ev1] += "stm32mp157f-ev1-m4" UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[stm32mp157f-ev1] += "stm32mp157f-ev1-m4-examples"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Configure A7 examples labels # Configure A7 examples labels
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define MENU DESCRIPTION overrides for new A7 labels
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157c-dk2-a7 = "stm32mp157c-dk2-a7-examples"
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157c-ev1-a7 = "stm32mp157c-ev1-a7-examples"
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157f-dk2-a7 = "stm32mp157f-dk2-a7-examples"
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157f-ev1-a7 = "stm32mp157f-ev1-a7-examples"
# Define FDT overrides for new A7 labels # Define FDT overrides for new A7 labels
UBOOT_EXTLINUX_FDT_stm32mp157c-dk2-a7 = "/stm32mp157c-dk2-a7-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157c-dk2-a7-examples = "/stm32mp157c-dk2-a7-examples.dtb"
UBOOT_EXTLINUX_FDT_stm32mp157c-ev1-a7 = "/stm32mp157c-ev1-a7-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157c-ev1-a7-examples = "/stm32mp157c-ev1-a7-examples.dtb"
UBOOT_EXTLINUX_FDT_stm32mp157f-dk2-a7 = "/stm32mp157f-dk2-a7-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157f-dk2-a7-examples = "/stm32mp157f-dk2-a7-examples.dtb"
UBOOT_EXTLINUX_FDT_stm32mp157f-ev1-a7 = "/stm32mp157f-ev1-a7-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157f-ev1-a7-examples = "/stm32mp157f-ev1-a7-examples.dtb"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Configure M4 examples labels # Configure M4 examples labels
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Define MENU DESCRIPTION overrides for new A7 labels
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157c-dk2-m4 = "stm32mp157c-dk2-m4-examples"
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157c-ev1-m4 = "stm32mp157c-ev1-m4-examples"
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157f-dk2-m4 = "stm32mp157f-dk2-m4-examples"
UBOOT_EXTLINUX_MENU_DESCRIPTION_stm32mp157f-ev1-m4 = "stm32mp157f-ev1-m4-examples"
# Define FDT overrides for new M4 labels # Define FDT overrides for new M4 labels
UBOOT_EXTLINUX_FDT_stm32mp157c-dk2-m4 = "/stm32mp157c-dk2-m4-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157c-dk2-m4-examples = "/stm32mp157c-dk2-m4-examples.dtb"
UBOOT_EXTLINUX_FDT_stm32mp157c-ev1-m4 = "/stm32mp157c-ev1-m4-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157c-ev1-m4-examples = "/stm32mp157c-ev1-m4-examples.dtb"
UBOOT_EXTLINUX_FDT_stm32mp157f-dk2-m4 = "/stm32mp157f-dk2-m4-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157f-dk2-m4-examples = "/stm32mp157f-dk2-m4-examples.dtb"
UBOOT_EXTLINUX_FDT_stm32mp157f-ev1-m4 = "/stm32mp157f-ev1-m4-examples.dtb" UBOOT_EXTLINUX_FDT_stm32mp157f-ev1-m4-examples = "/stm32mp157f-ev1-m4-examples.dtb"

View File

@ -49,6 +49,7 @@ MACHINE_FEATURES += "watchdog"
#MACHINE_FEATURES += "wifi" #MACHINE_FEATURES += "wifi"
MACHINE_FEATURES += "${@'gpu' if d.getVar('ACCEPT_EULA_'+d.getVar('MACHINE')) == '1' else ''}" MACHINE_FEATURES += "${@'gpu' if d.getVar('ACCEPT_EULA_'+d.getVar('MACHINE')) == '1' else ''}"
MACHINE_FEATURES += "m4copro" MACHINE_FEATURES += "m4copro"
MACHINE_FEATURES += "fit"
# Bluetooth # Bluetooth
#BLUETOOTH_LIST += "linux-firmware-bluetooth-bcm4343" #BLUETOOTH_LIST += "linux-firmware-bluetooth-bcm4343"