CLASSES/MACHINES: update for v2.0.0
Several updates integrated: - removal of no more supported basic boot scheme - removal of no more supported boot device (nor-nand and nor-emmc) - rework of providers and machine features - introduction of new board versions (a, c, d, f) - update of extlinuxconf-stm32mp class to manage multiple board versions - configure 'extlinux.conf' file to manage PARTUUID to select rootfs partition - new partition images management (easy to add or remove partition through new PARTITIONS_CONFIG var - specific configuration on machine side for all storage device supported Change-Id: I7e4d3d16535a5654c7fd80f9b56296a61050def3
This commit is contained in:
1 parent
2fbe4ce39c
commit
af5ae28215
33 files changed
+1297
-1245
No files matched your search
@@ -29,52 +29,44 @@
|
||||
# --------------------------------------------------------------------
|
||||
# STM32MP specific implementation
|
||||
# --------------------------------------------------------------------
|
||||
# Append new mechanism to allow multi 'extlinux.conf' file generation.
|
||||
# Append new mechanism to allow multiple config file generation.
|
||||
# - multiple targets case:
|
||||
# each 'extlinux.conf' file generated is created under specific path:
|
||||
# each config file generated is created under specific path:
|
||||
# '${B}/<UBOOT_EXTLINUX_BOOTPREFIXES>extlinux/extlinux.conf'
|
||||
# - simple target case:
|
||||
# the 'extlinux.conf' file generated is created under default path:
|
||||
# '${B}/extlinux/extlinux.conf'
|
||||
#
|
||||
# New external variables added:
|
||||
# UBOOT_EXTLINUX_TARGETS - A list of targets for multi config file
|
||||
# generation
|
||||
# UBOOT_EXTLINUX_BOOTPREFIXES - Bootprefix used in uboot script to select
|
||||
# extlinux.conf file to use
|
||||
# UBOOT_EXTLINUX_TARGETS - List of targets for multi config file creation
|
||||
# UBOOT_EXTLINUX_BOOTPREFIXES - Prefix used in uboot script to select config file
|
||||
#
|
||||
# Add an extra configuration to allow to duplicate current config file into a new
|
||||
# one by appending some new labels to the current ones.
|
||||
# This mechanism is enabled through UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG var.
|
||||
# The format to specify it is:
|
||||
# UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG ??= "foo"
|
||||
# UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG[foo] = "label1 label2"
|
||||
# Along with current config file created 'extlinux.conf', a new config file is
|
||||
# created at same location with name 'foo_extlinux.conf'.
|
||||
# This config file contains the labels defined for current config file with also
|
||||
# the new configured lables (i.e. label1 and lable2).
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
# Output example:
|
||||
# Implementation:
|
||||
# --------------------------------------------------------------------
|
||||
# Following 'extlinux.conf' files are generated under ${UBOOT_EXTLINUX_INSTALL_DIR}:
|
||||
# ${UBOOT_EXTLINUX_BOOTPREFIXES_${UBOOT_EXTLINUX_TARGETS}[0]}extlinux/extlinux.conf
|
||||
# ${UBOOT_EXTLINUX_BOOTPREFIXES_${UBOOT_EXTLINUX_TARGETS}[1]}extlinux/extlinux.conf
|
||||
# We create all config file based on a loop for all targets set in
|
||||
# UBOOT_EXTLINUX_TARGETS var, then we use the mechanism defined in
|
||||
# 'uboot-extlinux-config.bbclass' class to generate the config file
|
||||
# Plus for each target we may use the UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG var
|
||||
# to create additional config file that will use the labels list from on going
|
||||
# target plus the labels defined for this extra target.
|
||||
#
|
||||
# File content (${UBOOT_EXTLINUX_BOOTPREFIXES_${UBOOT_EXTLINUX_TARGETS}[0]}extlinux/exlinux.conf):
|
||||
# menu title Select the boot mode
|
||||
# TIMEOUT ${UBOOT_EXTLINUX_TIMEOUT}
|
||||
# DEFAULT ${UBOOT_EXTLINUX_DEFAULT_LABEL_${UBOOT_EXTLINUX_TARGETS}[0]}
|
||||
# LABEL ${UBOOT_EXTLINUX_LABELS_${UBOOT_EXTLINUX_TARGETS}[0]}[0]
|
||||
# KERNEL ${UBOOT_EXTLINUX_KERNEL} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_KERNEL_${IMAGE_UBOOT_EXTLINUX_LABELS}[0]} >
|
||||
# FDT ${UBOOT_EXTLINUX_FDT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_FDT_${IMAGE_UBOOT_EXTLINUX_LABELS}[0]} >
|
||||
# APPEND ${UBOOT_EXTLINUX_ROOT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_ROOT_${IMAGE_UBOOT_EXTLINUX_LABELS}[0]} >
|
||||
# LABEL ${UBOOT_EXTLINUX_LABELS_${UBOOT_EXTLINUX_TARGETS}[0]}[1]
|
||||
# KERNEL ${UBOOT_EXTLINUX_KERNEL} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_KERNEL_${IMAGE_UBOOT_EXTLINUX_LABELS}[1]} >
|
||||
# FDT ${UBOOT_EXTLINUX_FDT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_FDT_${IMAGE_UBOOT_EXTLINUX_LABELS}[1]} >
|
||||
# APPEND ${UBOOT_EXTLINUX_ROOT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_ROOT_${IMAGE_UBOOT_EXTLINUX_LABELS}[1]} >
|
||||
#
|
||||
# File content (${UBOOT_EXTLINUX_BOOTPREFIXES_${UBOOT_EXTLINUX_TARGETS}[0]}extlinux/exlinux.conf):
|
||||
# menu title Select the boot mode
|
||||
# TIMEOUT ${UBOOT_EXTLINUX_TIMEOUT}
|
||||
# DEFAULT ${UBOOT_EXTLINUX_DEFAULT_LABEL_${UBOOT_EXTLINUX_TARGETS}[1]}
|
||||
# LABEL ${UBOOT_EXTLINUX_LABELS_${UBOOT_EXTLINUX_TARGETS}[1]}[0]
|
||||
# KERNEL ${UBOOT_EXTLINUX_KERNEL} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_KERNEL_${IMAGE_UBOOT_EXTLINUX_LABELS}[0]} >
|
||||
# FDT ${UBOOT_EXTLINUX_FDT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_FDT_${IMAGE_UBOOT_EXTLINUX_LABELS}[0]} >
|
||||
# APPEND ${UBOOT_EXTLINUX_ROOT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_ROOT_${IMAGE_UBOOT_EXTLINUX_LABELS}[0]} >
|
||||
# LABEL ${UBOOT_EXTLINUX_LABELS_${UBOOT_EXTLINUX_TARGETS}[1]}[1]
|
||||
# KERNEL ${UBOOT_EXTLINUX_KERNEL} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_KERNEL_${IMAGE_UBOOT_EXTLINUX_LABELS}[1]} >
|
||||
# FDT ${UBOOT_EXTLINUX_FDT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_FDT_${IMAGE_UBOOT_EXTLINUX_LABELS}[1]} >
|
||||
# APPEND ${UBOOT_EXTLINUX_ROOT} < OR OVERRIDE WITH : ${UBOOT_EXTLINUX_ROOT_${IMAGE_UBOOT_EXTLINUX_LABELS}[1]} >
|
||||
# We manage to allow var override using the current target defined from the
|
||||
# ongoing loop.
|
||||
# In the same way var averride is managed through the ongoing label loop while
|
||||
# writting the config file (refer to 'uboot-extlinux-config.bbclass' class for
|
||||
# details).
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
UBOOT_EXTLINUX_TARGETS ?= ""
|
||||
@@ -87,6 +79,85 @@ UBOOT_EXTLINUX_KERNEL_IMAGE ?= "/${KERNEL_IMAGETYPE}"
|
||||
UBOOT_EXTLINUX_KERNEL_ARGS ?= "rootwait rw"
|
||||
UBOOT_EXTLINUX_TIMEOUT ?= "20"
|
||||
|
||||
def create_extlinux_file(cfile, labels, data):
|
||||
"""
|
||||
Copy/Paste extract of 'do_create_extlinux_config()' function
|
||||
from openembedded-core 'uboot-extlinux-config.bbclass' class
|
||||
"""
|
||||
# Use copy of provided data environment to allow label override without side
|
||||
# effect when looping on 'create_extlinux_file' function.
|
||||
localdata = bb.data.createCopy(data)
|
||||
# Default function from OpenEmbedded class
|
||||
try:
|
||||
with open(cfile, 'w') as cfgfile:
|
||||
cfgfile.write('# Generic Distro Configuration file generated by OpenEmbedded\n')
|
||||
|
||||
if len(labels.split()) > 1:
|
||||
cfgfile.write('menu title Select the boot mode\n')
|
||||
|
||||
splashscreen_name = localdata.getVar('UBOOT_SPLASH_IMAGE')
|
||||
if not splashscreen_name:
|
||||
bb.warn('UBOOT_SPLASH_IMAGE not defined')
|
||||
else:
|
||||
cfgfile.write('MENU BACKGROUND /%s.bmp\n' % (splashscreen_name))
|
||||
|
||||
timeout = localdata.getVar('UBOOT_EXTLINUX_TIMEOUT')
|
||||
if timeout:
|
||||
cfgfile.write('TIMEOUT %s\n' % (timeout))
|
||||
|
||||
if len(labels.split()) > 1:
|
||||
default = localdata.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL')
|
||||
if default:
|
||||
cfgfile.write('DEFAULT %s\n' % (default))
|
||||
|
||||
# Need to deconflict the labels with existing overrides
|
||||
label_overrides = labels.split()
|
||||
default_overrides = localdata.getVar('OVERRIDES').split(':')
|
||||
# We're keeping all the existing overrides that aren't used as a label
|
||||
# an override for that label will be added back in while we're processing that label
|
||||
keep_overrides = list(filter(lambda x: x not in label_overrides, default_overrides))
|
||||
|
||||
for label in labels.split():
|
||||
|
||||
localdata.setVar('OVERRIDES', ':'.join(keep_overrides + [label]))
|
||||
|
||||
extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE')
|
||||
|
||||
menu_description = localdata.getVar('UBOOT_EXTLINUX_MENU_DESCRIPTION')
|
||||
if not menu_description:
|
||||
menu_description = label
|
||||
|
||||
root = localdata.getVar('UBOOT_EXTLINUX_ROOT')
|
||||
if not root:
|
||||
bb.fatal('UBOOT_EXTLINUX_ROOT not defined')
|
||||
|
||||
kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE')
|
||||
fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR')
|
||||
|
||||
fdt = localdata.getVar('UBOOT_EXTLINUX_FDT')
|
||||
|
||||
if fdt:
|
||||
cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' %
|
||||
(menu_description, kernel_image, fdt))
|
||||
elif fdtdir:
|
||||
cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDTDIR %s\n' %
|
||||
(menu_description, kernel_image, fdtdir))
|
||||
else:
|
||||
cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image))
|
||||
|
||||
kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS')
|
||||
|
||||
initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD')
|
||||
if initrd:
|
||||
cfgfile.write('\tINITRD %s\n'% initrd)
|
||||
|
||||
kernel_args = root + " " + kernel_args
|
||||
cfgfile.write('\tAPPEND %s %s\n' % (kernel_args, extlinux_console))
|
||||
|
||||
except OSError:
|
||||
bb.fatal('Unable to open %s' % (cfile))
|
||||
|
||||
|
||||
python do_create_multiextlinux_config() {
|
||||
targets = d.getVar('UBOOT_EXTLINUX_TARGETS')
|
||||
if not targets:
|
||||
@@ -94,24 +165,32 @@ python do_create_multiextlinux_config() {
|
||||
if not targets.strip():
|
||||
bb.fatal("No targets, nothing to do")
|
||||
|
||||
# Need to deconflict the targets with existing overrides
|
||||
target_overrides = targets.split()
|
||||
default_overrides = d.getVar('OVERRIDES').split(':')
|
||||
# We're keeping all the existing overrides that aren't used as a 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))
|
||||
|
||||
for target in targets.split():
|
||||
bb.note("Loop for '%s' target" % target)
|
||||
|
||||
localdata = bb.data.createCopy(d)
|
||||
overrides = localdata.getVar('OVERRIDES')
|
||||
if not overrides:
|
||||
bb.fatal('OVERRIDES not defined')
|
||||
localdata.setVar('OVERRIDES', target + ':' + overrides)
|
||||
# Append target as OVERRIDES
|
||||
d.setVar('OVERRIDES', ':'.join(keep_overrides + [target]))
|
||||
|
||||
# Initialize labels from localdata to allow target override
|
||||
labels = localdata.getVar('UBOOT_EXTLINUX_LABELS')
|
||||
# Initialize labels
|
||||
labels = d.getVar('UBOOT_EXTLINUX_LABELS')
|
||||
if not labels:
|
||||
bb.fatal("UBOOT_EXTLINUX_LABELS not defined, nothing to do")
|
||||
if not labels.strip():
|
||||
bb.fatal("No labels, nothing to do")
|
||||
|
||||
# Initialize subdir for extlinux.conf file location
|
||||
if len(targets.split()) > 1:
|
||||
bootprefix = localdata.getVar('UBOOT_EXTLINUX_BOOTPREFIXES') or ""
|
||||
# Initialize extra target configs
|
||||
extra_extlinuxtargetconfig = d.getVar('UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG') or ""
|
||||
|
||||
# Initialize subdir for config file location
|
||||
if len(targets.split()) > 1 or len(extra_extlinuxtargetconfig.split()) > 0:
|
||||
bootprefix = d.getVar('UBOOT_EXTLINUX_BOOTPREFIXES') or ""
|
||||
subdir = bootprefix + 'extlinux'
|
||||
else:
|
||||
subdir = 'extlinux'
|
||||
@@ -122,79 +201,35 @@ python do_create_multiextlinux_config() {
|
||||
# Create extlinux folder
|
||||
bb.utils.mkdirhier(os.path.dirname(cfile))
|
||||
|
||||
# ************************************************************
|
||||
# Copy/Paste extract of 'do_create_extlinux_config()' function
|
||||
# from openembedded-core 'uboot-extlinux-config.bbclass' class
|
||||
# ************************************************************
|
||||
try:
|
||||
with open(cfile, 'w') as cfgfile:
|
||||
cfgfile.write('# Generic Distro Configuration file generated by OpenEmbedded\n')
|
||||
# Go for config file creation
|
||||
bb.note("Create %s/extlinux.conf file for %s labels" % (subdir, labels))
|
||||
create_extlinux_file(cfile, labels, d)
|
||||
|
||||
if len(labels.split()) > 1:
|
||||
cfgfile.write('menu title Select the boot mode\n')
|
||||
|
||||
splashscreen_name = localdata.getVar('UBOOT_SPLASH_IMAGE')
|
||||
if not splashscreen_name:
|
||||
bb.warn('UBOOT_SPLASH_IMAGE not defined')
|
||||
else:
|
||||
cfgfile.write('MENU BACKGROUND /%s.bmp\n' % (splashscreen_name))
|
||||
|
||||
timeout = localdata.getVar('UBOOT_EXTLINUX_TIMEOUT')
|
||||
if timeout:
|
||||
cfgfile.write('TIMEOUT %s\n' % (timeout))
|
||||
|
||||
if len(labels.split()) > 1:
|
||||
default = localdata.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL')
|
||||
if default:
|
||||
cfgfile.write('DEFAULT %s\n' % (default))
|
||||
|
||||
for label in labels.split():
|
||||
# **********************************************
|
||||
# Add localdata reset to fix var expansion issue
|
||||
# **********************************************
|
||||
localdata = bb.data.createCopy(d)
|
||||
|
||||
overrides = localdata.getVar('OVERRIDES')
|
||||
if not overrides:
|
||||
bb.fatal('OVERRIDES not defined')
|
||||
|
||||
localdata.setVar('OVERRIDES', label + ':' + overrides)
|
||||
|
||||
extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE')
|
||||
|
||||
menu_description = localdata.getVar('UBOOT_EXTLINUX_MENU_DESCRIPTION')
|
||||
if not menu_description:
|
||||
menu_description = label
|
||||
|
||||
root = localdata.getVar('UBOOT_EXTLINUX_ROOT')
|
||||
if not root:
|
||||
bb.fatal('UBOOT_EXTLINUX_ROOT not defined')
|
||||
|
||||
kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE')
|
||||
fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR')
|
||||
|
||||
fdt = localdata.getVar('UBOOT_EXTLINUX_FDT')
|
||||
|
||||
if fdt:
|
||||
cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' %
|
||||
(menu_description, kernel_image, fdt))
|
||||
elif fdtdir:
|
||||
cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDTDIR %s\n' %
|
||||
(menu_description, kernel_image, fdtdir))
|
||||
else:
|
||||
cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image))
|
||||
|
||||
kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS')
|
||||
|
||||
initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD')
|
||||
if initrd:
|
||||
cfgfile.write('\tINITRD %s\n'% initrd)
|
||||
|
||||
kernel_args = root + " " + kernel_args
|
||||
cfgfile.write('\tAPPEND %s %s\n' % (kernel_args, extlinux_console))
|
||||
|
||||
except OSError:
|
||||
bb.fatal('Unable to open %s' % (cfile))
|
||||
# Manage UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG
|
||||
extra_extlinuxtargetconfigflag = d.getVarFlags('UBOOT_EXTLINUX_TARGETS_EXTRA_CONFIG')
|
||||
# The "doc" varflag is special, we don't want to see it here
|
||||
extra_extlinuxtargetconfigflag.pop('doc', None)
|
||||
# Handle new targets and labels append
|
||||
if len(extra_extlinuxtargetconfig.split()) > 0:
|
||||
bb.note("Manage EXTRA target configuration:")
|
||||
for config in extra_extlinuxtargetconfig.split():
|
||||
# Init extra config vars:
|
||||
extra_extlinuxlabels = ""
|
||||
extra_cfile = ""
|
||||
for f, v in extra_extlinuxtargetconfigflag.items():
|
||||
if config == f:
|
||||
bb.note(">>> Loop for '%s' extra target config." % config)
|
||||
if len(v.split()) > 0:
|
||||
bb.note(">>> Set '%s' to extra_extlinuxlabels." % v)
|
||||
extra_extlinuxlabels = labels + ' ' + v
|
||||
extra_cfile = os.path.join(d.getVar('B'), subdir , config + '_' + 'extlinux.conf')
|
||||
else:
|
||||
bb.note(">>> No extra labels defined, no new config file to create")
|
||||
break
|
||||
# Manage new config file creation
|
||||
if extra_extlinuxlabels != "":
|
||||
bb.note(">>> Create %s/%s_extlinux.conf file for %s labels" % (subdir, config, extra_extlinuxlabels))
|
||||
create_extlinux_file(extra_cfile, extra_extlinuxlabels, d)
|
||||
}
|
||||
addtask create_multiextlinux_config before do_compile
|
||||
|
||||
@@ -203,7 +238,7 @@ do_create_multiextlinux_config[cleandirs] += "${B}"
|
||||
# Manage specific var dependency:
|
||||
# Because of local overrides within create_multiextlinux_config() function, we
|
||||
# need to make sure to add each variables to the vardeps list.
|
||||
UBOOT_EXTLINUX_TARGET_VARS = "LABELS BOOTPREFIXES TIMEOUT DEFAULT_LABEL"
|
||||
UBOOT_EXTLINUX_TARGET_VARS = "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()])}"
|
||||
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()))}"
|
||||
|
||||
Reference in new issue
Block a user