diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/fsl-dynamic-packagearch.bbclass | 11 | ||||
-rw-r--r-- | classes/fsl-eula-unpack.bbclass | 118 | ||||
-rw-r--r-- | classes/fsl-kernel-localversion.bbclass | 42 | ||||
-rw-r--r-- | classes/fsl-u-boot-localversion.bbclass | 19 | ||||
-rw-r--r-- | classes/fsl-vivante-kernel-driver-handler.bbclass | 6 | ||||
-rw-r--r-- | classes/image_populate_mfgtool.bbclass | 139 | ||||
-rw-r--r-- | classes/image_types_fsl.bbclass | 16 | ||||
-rw-r--r-- | classes/imx-boot-container.bbclass | 50 | ||||
-rw-r--r-- | classes/kernel-itbimage.bbclass | 493 | ||||
-rw-r--r-- | classes/machine-overrides-extender.bbclass | 30 | ||||
-rw-r--r-- | classes/mfgtool-initramfs-image.bbclass | 8 | ||||
-rw-r--r-- | classes/use-imx-headers.bbclass | 4 | ||||
-rw-r--r-- | classes/use-imx-security-controller-firmware.bbclass | 16 | ||||
-rw-r--r-- | classes/uuu_bootloader_tag.bbclass | 12 |
14 files changed, 358 insertions, 606 deletions
diff --git a/classes/fsl-dynamic-packagearch.bbclass b/classes/fsl-dynamic-packagearch.bbclass index 9fcf37be..6cb0c0a9 100644 --- a/classes/fsl-dynamic-packagearch.bbclass +++ b/classes/fsl-dynamic-packagearch.bbclass @@ -54,6 +54,17 @@ python __anonymous () { if not machine_socarch in cur_package_archs: d.appendVar("PACKAGE_EXTRA_ARCHS", " %s" % machine_socarch) + multilib_variants = (d.getVar("MULTILIB_VARIANTS") or "").split() + for variant in multilib_variants: + defaulttune = d.getVar("DEFAULTTUNE:virtclass-multilib-" + variant) + if defaulttune: + package_extra_archs_tune_archs = (d.getVar("PACKAGE_EXTRA_ARCHS:tune-" + defaulttune) or "").split() + arch_suffix = d.getVar("MACHINE_SOCARCH_SUFFIX") + for arch in package_extra_archs_tune_archs: + socarch = arch + arch_suffix + if not socarch in cur_package_archs: + d.appendVar("PACKAGE_EXTRA_ARCHS", " %s" % socarch ) + if d.getVar("TUNE_ARCH") == "arm": # For ARM we have two possible machine_socarch values, one for the arm and one for the thumb instruction set # add the other value to extra archs also, so that a image recipe searches both for packages. diff --git a/classes/fsl-eula-unpack.bbclass b/classes/fsl-eula-unpack.bbclass index 5e66a1fc..46b0f9c4 100644 --- a/classes/fsl-eula-unpack.bbclass +++ b/classes/fsl-eula-unpack.bbclass @@ -39,6 +39,27 @@ FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V24 = "417b82f17fc02b88125331ed FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V24.1 = "b3b0bab6ff55420d043cf1652c52d788" FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V25 = "f35df765ff17e69043ea21f350e3229c" FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V27 = "e565271ec9a80ce47abbddc4bffe56fa" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V29 = "28241cb895217d7946e40e7227136d02" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V30 = "03bcadc8dc0a788f66ca9e2b89f56c6f" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V31 = "dedee5689786754f61ea3a76035c8a81" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V32 = "17d2319de7baa686e8a755ba58a9ebf5" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V33 = "e4098ac4459cb81b07d3f0c22b3e8370" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V34 = "be5ff43682ed6c57dfcbeb97651c2829" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V35 = "d3c315c6eaa43e07d8c130dc3a04a011" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V36 = "b54da624b8d2ffe8a3b47757da48e60f" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V37 = "37cb2d8c2bcf8bf2fbe0366d5d928c29" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V38 = "65c483bb431ccd9a1820e6872c604771" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V39 = "5a0bf11f745e68024f37b4724a5364fe" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V40 = "add2d392714d3096ed7e0f7e2190724b" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V42 = "ea25d099982d035af85d193c88a1b479" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V44 = "d7853b7bf2936b2c25c893eac7033374" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V45 = "63a38e9f392d8813d6f1f4d0d6fbe657" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V46 = "673fa34349fa40f59e0713cb0ac22b1f" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V47 = "9135422c7a38dac21bf1f858b6ef3bac" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V48 = "db4762b09b6bda63da103963e6e081de" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V49 = "2827219e81f28aba7c6a569f7c437fa7" +FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V53 = "44a8052c384584ba09077e85a3d1654f" + FSL_EULA_FILE_MD5SUMS = " \ ${FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V8} \ ${FSL_EULA_FILE_MD5SUM_LA_OPT_BASE_LICENSE_V10} \ @@ -73,11 +94,31 @@ FSL_EULA_FILE_MD5SUMS = " \ ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V24.1} \ ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V25} \ ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V27} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V29} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V30} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V31} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V32} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V33} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V34} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V35} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V36} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V37} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V38} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V39} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V40} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V42} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V44} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V45} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V46} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V47} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V48} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V49} \ + ${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V53} \ " # The checksum for the EULA in the layer FSL_EULA_FILE_MD5SUM ?= \ - "${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V27}" + "${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V53}" LIC_FILES_CHKSUM_LAYER ?= "file://${FSL_EULA_FILE};md5=${FSL_EULA_FILE_MD5SUM}" LIC_FILES_CHKSUM_LAYER[vardepsexclude] += "FSL_EULA_FILE" @@ -90,13 +131,34 @@ do_fetch:prepend() { bb.fatal("The recipe LICENSE should include Proprietary but is " + d.getVar("LICENSE") + ".") } +do_unpack[vardepsexclude] += "FSL_EULA_FILE" +python do_unpack() { + eula = d.getVar('ACCEPT_FSL_EULA') + eula_file = d.getVar('FSL_EULA_FILE') + pkg = d.getVar('PN') + if eula == None: + bb.fatal("To use '%s' you need to accept the Freescale EULA at '%s'. " + "Please read it and in case you accept it, write: " + "ACCEPT_FSL_EULA = \"1\" in your local.conf." % (pkg, eula_file)) + elif eula == '0': + bb.fatal("To use '%s' you need to accept the Freescale EULA." % pkg) + else: + bb.note("Freescale EULA has been accepted for '%s'" % pkg) + + try: + bb.build.exec_func('base_do_unpack', d) + except: + raise + + bb.build.exec_func('fsl_bin_do_unpack', d) +} + python fsl_bin_do_unpack() { src_uri = (d.getVar('SRC_URI') or "").split() if len(src_uri) == 0: return localdata = bb.data.createCopy(d) - bb.data.update_data(localdata) rootdir = localdata.getVar('WORKDIR', True) fetcher = bb.fetch2.Fetch(src_uri, localdata) @@ -114,16 +176,28 @@ python fsl_bin_do_unpack() { bb.note("Handling file '%s' as a Freescale EULA-licensed archive." % url.basename) cmd = "sh %s --auto-accept --force" % (url.localpath) bb.fetch2.runfetchcmd(cmd, d, quiet=True, workdir=rootdir) + if not found: + bb.fatal("The recipe inherits 'fsl-eula-unpack.bbclass' but does not mark any URL in SRC_URI with the option 'fsl-eula=true'") # Check for two EULAs, one from the layer and one from the package bb.note("Checking LIC_FILES_CHKSUM for Freescale EULA consistency...") if found > 1: bb.warn("The package contains multiple Freescale EULA-licensed archives. The consistency logic may not be able to detect a EULA problem.") + (layer_license, licenses, md5sums, found_layer_licenses, found_package_licenses) = find_nxp_eula_licenses(d) + if not found_layer_licenses: + bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'." + % (layer_license, licenses)) + if not found_package_licenses: + bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'." + % (md5sums.split(), licenses)) +} + +def find_nxp_eula_licenses(d): layer_license = d.getVar('LIC_FILES_CHKSUM_LAYER') licenses = d.getVar('LIC_FILES_CHKSUM') or "" md5sums = d.getVar('FSL_EULA_FILE_MD5SUMS') or "" - found_layer_license = False - found_package_license = False + found_layer_licenses = "" + found_package_licenses = "" for license in licenses.split(): try: (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(license) @@ -133,38 +207,8 @@ python fsl_bin_do_unpack() { bb.fatal("%s: LIC_FILES_CHKSUM contains an invalid URL: %s" % (d.getVar('PF'), license)) if license == layer_license: bb.note("Found Freescale EULA for the layer %s." % license) - found_layer_license = True + found_layer_licenses += license elif parm.get('md5') in md5sums: bb.note("Found Freescale EULA for the package %s." % license) - found_package_license = True - if not found_layer_license: - bb.fatal("The Freescale layer EULA '%s' is not listed in LIC_FILES_CHKSUM '%s'." - % (layer_license, licenses)) - if not found_package_license: - bb.fatal("A valid package EULA with md5sum in %s was not found in LIC_FILES_CHKSUM '%s'." - % (md5sums.split(), licenses)) -} - -python do_unpack() { - eula = d.getVar('ACCEPT_FSL_EULA') - eula_file = d.getVar('FSL_EULA_FILE') - pkg = d.getVar('PN') - if eula == None: - bb.fatal("To use '%s' you need to accept the Freescale EULA at '%s'. " - "Please read it and in case you accept it, write: " - "ACCEPT_FSL_EULA = \"1\" in your local.conf." % (pkg, eula_file)) - elif eula == '0': - bb.fatal("To use '%s' you need to accept the Freescale EULA." % pkg) - else: - bb.note("Freescale EULA has been accepted for '%s'" % pkg) - - # The binary unpack needs to be done first so 'S' is valid - bb.build.exec_func('fsl_bin_do_unpack', d) - - try: - bb.build.exec_func('base_do_unpack', d) - except: - raise -} - -do_unpack[vardepsexclude] += "FSL_EULA_FILE" + found_package_licenses += license + return (layer_license, licenses, md5sums, found_layer_licenses, found_package_licenses) diff --git a/classes/fsl-kernel-localversion.bbclass b/classes/fsl-kernel-localversion.bbclass index c782a3d3..9ef0a62f 100644 --- a/classes/fsl-kernel-localversion.bbclass +++ b/classes/fsl-kernel-localversion.bbclass @@ -12,34 +12,36 @@ SCMVERSION ??= "y" LOCALVERSION ??= "+fslc" -kernel_conf_variable() { - CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" - if test "$2" = "n" - then - echo "# CONFIG_$1 is not set" >> ${B}/.config - else - echo "CONFIG_$1=$2" >> ${B}/.config - fi -} +# LINUX_VERSION_EXTENSION is used as CONFIG_LOCALVERSION by kernel-yocto class +LINUX_VERSION_EXTENSION ?= "${LOCALVERSION}" do_kernel_localversion[dirs] += "${S} ${B}" do_kernel_localversion() { - mkdir -p ${B} - echo "" > ${B}/.config - CONF_SED_SCRIPT="" - kernel_conf_variable LOCALVERSION "\"${LOCALVERSION}\"" - if [ "${SCMVERSION}" = "y" ]; then - kernel_conf_variable LOCALVERSION_AUTO y + # Fallback for recipes not able to use LINUX_VERSION_EXTENSION + if [ "${@bb.data.inherits_class('kernel-yocto', d)}" = "False" ]; then + echo 'CONFIG_LOCALVERSION="${LOCALVERSION}"' >> ${B}/.config fi - sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config' - if [ "${SCMVERSION}" = "y" ]; then # Add GIT revision to the local version - head=`git --git-dir=${S}/.git rev-parse --verify --short HEAD 2> /dev/null` - printf "%s%s" +g $head > ${S}/.scmversion + if [ "${SRCREV}" = "INVALID" ]; then + hash=${SRCREV_machine} + else + hash=${SRCREV} + fi + if [ "$hash" = "AUTOINC" ]; then + branch=`git --git-dir=${S}/.git symbolic-ref --short -q HEAD` + head=`git --git-dir=${S}/.git rev-parse --verify --short origin/${branch} 2> /dev/null` + else + head=`git --git-dir=${S}/.git rev-parse --verify --short $hash 2> /dev/null` + fi + patches=`git --git-dir=${S}/.git rev-list --count $head..HEAD 2> /dev/null` + printf "%s%s%s%s" +g $head +p $patches > ${S}/.scmversion + + sed -i -e "/CONFIG_LOCALVERSION_AUTO[ =]/d" ${B}/.config + echo "CONFIG_LOCALVERSION_AUTO=y" >> ${B}/.config fi } -addtask kernel_localversion before do_configure after do_patch do_kernel_metadata +addtask kernel_localversion before do_configure after do_patch do_kernel_configme diff --git a/classes/fsl-u-boot-localversion.bbclass b/classes/fsl-u-boot-localversion.bbclass index ebde8ea7..94b30c04 100644 --- a/classes/fsl-u-boot-localversion.bbclass +++ b/classes/fsl-u-boot-localversion.bbclass @@ -17,10 +17,21 @@ UBOOT_LOCALVERSION = "${LOCALVERSION}" do_compile:prepend() { if [ "${SCMVERSION}" = "y" ]; then # Add GIT revision to the local version - head=`cd ${S} ; git rev-parse --verify --short HEAD 2> /dev/null` - printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${S}/.scmversion - printf "%s%s%s" "${UBOOT_LOCALVERSION}" +g $head > ${B}/.scmversion - else + if [ "${SRCREV}" = "INVALID" ]; then + hash=${SRCREV_machine} + else + hash=${SRCREV} + fi + if [ "$hash" = "AUTOINC" ]; then + branch=`git --git-dir=${S}/.git symbolic-ref --short -q HEAD` + head=`git --git-dir=${S}/.git rev-parse --verify --short origin/${branch} 2> /dev/null` + else + head=`git --git-dir=${S}/.git rev-parse --verify --short $hash 2> /dev/null` + fi + patches=`git --git-dir=${S}/.git rev-list --count $head..HEAD 2> /dev/null` + printf "%s%s%s%s" +g $head +p $patches > ${S}/.scmversion + printf "%s%s%s%s" +g $head +p $patches > ${B}/.scmversion + else printf "%s" "${UBOOT_LOCALVERSION}" > ${S}/.scmversion printf "%s" "${UBOOT_LOCALVERSION}" > ${B}/.scmversion fi diff --git a/classes/fsl-vivante-kernel-driver-handler.bbclass b/classes/fsl-vivante-kernel-driver-handler.bbclass index 54954aab..c226b0ab 100644 --- a/classes/fsl-vivante-kernel-driver-handler.bbclass +++ b/classes/fsl-vivante-kernel-driver-handler.bbclass @@ -41,9 +41,9 @@ python fsl_vivante_kernel_driver_handler () { return if use_vivante_kernel_driver_module != "1": - e.data.appendVar('RPROVIDES:${KERNEL_PACKAGE_NAME}-base', ' kernel-module-imx-gpu-viv') - e.data.appendVar('RREPLACES:${KERNEL_PACKAGE_NAME}-base', ' kernel-module-imx-gpu-viv') - e.data.appendVar('RCONFLICTS:${KERNEL_PACKAGE_NAME}-base', ' kernel-module-imx-gpu-viv') + e.data.appendVar('RPROVIDES:${KERNEL_PACKAGE_NAME}-base', ' ${MLPREFIX}kernel-module-imx-gpu-viv') + e.data.appendVar('RREPLACES:${KERNEL_PACKAGE_NAME}-base', ' ${MLPREFIX}kernel-module-imx-gpu-viv') + e.data.appendVar('RCONFLICTS:${KERNEL_PACKAGE_NAME}-base', ' ${MLPREFIX}kernel-module-imx-gpu-viv') } addhandler fsl_vivante_kernel_driver_handler diff --git a/classes/image_populate_mfgtool.bbclass b/classes/image_populate_mfgtool.bbclass new file mode 100644 index 00000000..d30b47a3 --- /dev/null +++ b/classes/image_populate_mfgtool.bbclass @@ -0,0 +1,139 @@ +# Allow generation of mfgtool bundle +# +# The class provides the infrastructure for MFGTOOL generation and is tied to images. To generate +# the bundle, the task populate_mfgtool must be called. For example: +# +# ,----[ Running populate_mfgtool for core-image-minimal image ] +# | $: bitbake core-image-minimal -c populate_mfgtool +# `---- +# +# The class behavior is controlled through the MFGTOOLCONFIG (analogous to PACKAGECONFIG) +# variable. The MFGTOOLCONFIG variable itself specifies a space-separated list of the script to +# enable. Following the script, you can determine the behavior of each script by providing up to two +# order-dependent arguments, which are separated by commas. You can omit any argument you like but +# must retain the separating commas. The order is important and specifies the following: +# +# 1. Extra dependencies that should be added to the do_populate_mfgtool task, if the script is +# enabled. +# 2. Extra binaries that should be added to the bundle, if the script is enabled. +# +# For example: +# +# ,----[ Defining foo.uuu.in and bar.uuu script ] +# | MFGTOOLCONFIG = "foo.uuu.in bar.uuu" +# | MFGTOOLCONFIG[foo.uuu.in] = "dep-foo1:do_deploy dep-foo2:do_deploy,file-foo1" +# | MFGTOOLCONFIG[bar.uuu] = "dep-bar1:do_deploy,file-bar1 file-bar2" +# `---- +# +# The dep-foo1:do_deploy, dep-foo2:do_deploy, and dep-bar1:do_deploy are added to +# do_populate_mfgtool dependencies. In addition, file-foo1, file-bar1, and file-bar2 are copied to +# the bundle, only if the script is enabled. +# +# During the mfgtool bundle generation, the uuu.in files are processed and some variables +# replaced. The variables are: +# +# - MACHINE +# - UBOOT_BINARY +# - SPL_BINARY +# - IMAGE_BASENAME +# +# Copyright 2022-2023 (C) O.S. Systems Software LTDA. +# +# SPDX-License-Identifier: MIT + +MFGTOOL_FILESPATH ??= " \ + ${@base_set_filespath(["%s/mfgtool" % p for p in "${BBPATH}".split(":")] \ + + ["${FILE_DIRNAME}/${BP}/mfgtool", \ + "${FILE_DIRNAME}/${BPN}/mfgtool", \ + "${FILE_DIRNAME}/files/mfgtool"] \ + , d)} \ +" + +MFGTOOLDIR = "${WORKDIR}/mfgtool-${PN}" +do_populate_mfgtool[dirs] += "${MFGTOOLDIR}" +do_populate_mfgtool[cleandirs] = "${MFGTOOLDIR}" + +addtask populate_mfgtool after do_image_complete do_unpack before do_deploy +do_populate_mfgtool[nostamp] = "1" +do_populate_mfgtool[dirs] += "${DEPLOY_DIR_IMAGE} ${WORKDIR}" +do_populate_mfgtool[recrdeptask] += "do_deploy" +do_populate_mfgtool[depends] += "uuu-bin:do_populate_sysroot" + +python () { + depends = [] + deploy_files = "" + scripts = (d.getVar('MFGTOOLCONFIG') or "").split() + scripts_and_flags = d.getVarFlags('MFGTOOLCONFIG') or {} + for flag, flagval in sorted(scripts_and_flags.items()): + items = flagval.split(",") + num = len(items) + if num > 2: + bb.error("%s: MFGTOOLCONFIG[%s] Only \"depends,deploy files\" can be specified!" % (d.getVar("PN"), flag)) + + if flag in scripts: + if num >= 2 and items[1]: + deploy_files += ' ' + items[1] + if num >= 1 and items[0]: + depends.append(items[0]) + + d.appendVarFlag('do_populate_mfgtool', 'depends', ' ' + ' '.join(depends)) + d.setVar('_SCRIPT_DEPLOY_FILES', ' '.join(sorted(list(set(deploy_files.split()))))) +} + +python do_populate_mfgtool() { + # For MFGTOOLCONFIG items we use BitBake's fetcher module allowing a consistent behavior. + scripts = (d.getVar('MFGTOOLCONFIG') or "").split() + src_uri = ["file://%s" % f for f in scripts] + if not src_uri: + bb.fatal("MFGTOOLCONFIG is empty so populate_mfgtool cannot be run.") + return + bb.debug(1, "following scripts are used: %s" % ', '.join(scripts)) + + localdata = bb.data.createCopy(d) + filespath = (d.getVar('MFGTOOL_FILESPATH') or "") + localdata.setVar('FILESPATH', filespath) + + try: + fetcher = bb.fetch2.Fetch(src_uri, localdata) + fetcher.unpack(localdata.getVar('WORKDIR')) + except bb.fetch2.BBFetchException as e: + bb.fatal("BitBake Fetcher Error: " + repr(e)) + + # Generate MFGTOOL bundle. + bb.build.exec_func('generate_mfgtool_bundle', d) +} + +generate_mfgtool_bundle() { + bbnote "Processing uuu files ..." + for src in $(ls -1 ${WORKDIR}/*.uuu.in); do + dest=$(echo $src | sed 's,.in$,,g') + bbnote " - $src -> $dest" + sed -e 's/@@MACHINE@@/${MACHINE}/g' \ + -e "s,@@UBOOT_BINARY@@,${UBOOT_BINARY},g" \ + -e "s,@@SPL_BINARY@@,${SPL_BINARY},g" \ + -e "s,@@IMAGE_BASENAME@@,${IMAGE_BASENAME},g" \ + $src > $dest + done + + bbnote "Deploying uuu files ..." + for src in $(ls -1 ${WORKDIR}/*.uuu); do + dest=$(basename $src) + bbnote " - $src -> ${MFGTOOLDIR}/${PN}-${MACHINE}/$dest" + install -D -m 0644 $src ${MFGTOOLDIR}/${PN}-${MACHINE}/$dest + done + + bbnote "Copying uuu binaries..." + cp -v -s ${STAGING_LIBDIR}/uuu/* ${MFGTOOLDIR}/${PN}-${MACHINE}/ + + bbnote "Copying MFGTOOL extra deploy files..." + for f in ${_SCRIPT_DEPLOY_FILES}; do + mkdir -p ${MFGTOOLDIR}/${PN}-${MACHINE}/binaries + cp -v -s ${DEPLOY_DIR_IMAGE}/$f ${MFGTOOLDIR}/${PN}-${MACHINE}/binaries/ + done + + tar -czf ${DEPLOY_DIR_IMAGE}/mfgtool-bundle-${PN}-${MACHINE}.tar.gz \ + --dereference -C ${MFGTOOLDIR} ${PN}-${MACHINE} + + ln -fs mfgtool-bundle-${PN}-${MACHINE}.tar.gz \ + ${DEPLOY_DIR_IMAGE}/mfgtool-bundle-${PN}.tar.gz +} diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass index cdd16a66..63a10f30 100644 --- a/classes/image_types_fsl.bbclass +++ b/classes/image_types_fsl.bbclass @@ -13,9 +13,9 @@ do_image_uboot_mxsboot_sdcard[depends] += "u-boot-mxsboot-native:do_populate_sys u-boot:do_deploy" IMAGE_CMD:uboot-mxsboot-sdcard() { mxsboot sd ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} \ - ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.uboot-mxsboot-sdcard - ln -sf ${IMAGE_NAME}.rootfs.uboot-mxsboot-sdcard \ - ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.uboot-mxsboot-sdcard + ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.uboot-mxsboot-sdcard + ln -sf ${IMAGE_NAME}.uboot-mxsboot-sdcard \ + ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.uboot-mxsboot-sdcard } # U-Boot mxsboot generation for NAND @@ -24,9 +24,9 @@ do_image_uboot_mxsboot_nand[depends] += "u-boot-mxsboot-native:do_populate_sysro IMAGE_CMD:uboot-mxsboot-nand() { mxsboot ${MXSBOOT_NAND_ARGS} nand \ ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} \ - ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.uboot-mxsboot-nand - ln -sf ${IMAGE_NAME}.rootfs.uboot-mxsboot-nand \ - ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.uboot-mxsboot-nand + ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.uboot-mxsboot-nand + ln -sf ${IMAGE_NAME}.uboot-mxsboot-nand \ + ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.uboot-mxsboot-nand } # In case we are building for i.MX23 or i.MX28 we need to have the @@ -37,8 +37,8 @@ do_image_wic[depends] += " \ " # We need to apply a fixup inside of the partition table -IMAGE_CMD:wic:append:mxs() { +IMAGE_CMD:wic:append:mxs-generic-bsp() { # Change partition type for mxs processor family bbnote "Setting partition type to 0x53 as required for mxs' SoC family." - echo -n S | dd of=$out${IMAGE_NAME_SUFFIX}.wic bs=1 count=1 seek=450 conv=notrunc + echo -n S | dd of=$out.wic bs=1 count=1 seek=450 conv=notrunc } diff --git a/classes/imx-boot-container.bbclass b/classes/imx-boot-container.bbclass index 3ffa7cbd..53c70a0b 100644 --- a/classes/imx-boot-container.bbclass +++ b/classes/imx-boot-container.bbclass @@ -18,43 +18,48 @@ # # Class inheritance is performed in u-boot-fslc recipe, and is controlled # by variable UBOOT_PROVIDES_BOOT_CONTAINER, which is defined in the -# base machine include file (imx-base.inc), and is set to "1" when the -# 'imx-boot-container' is present in MACHINEOVERRIDES. +# base machine include file (imx-base.inc). +# +# NOTE: A backwards-compatible symlink is added for 'flash.bin', named +# 'imx-boot', during the deployment task. # Define ATF binary file to be deployed to the U-Boot build folder ATF_MACHINE_NAME = "bl31-${ATF_PLATFORM}.bin" ATF_MACHINE_NAME:append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', '-optee', '', d)}" +IMX_BOOT_CONTAINER_FIRMWARE_SOC = "" +IMX_BOOT_CONTAINER_FIRMWARE_SOC:mx8mq-generic-bsp = " \ + signed_dp_imx8m.bin \ + signed_hdmi_imx8m.bin \ +" +IMX_BOOT_CONTAINER_FIRMWARE ?= " \ + ${IMX_BOOT_CONTAINER_FIRMWARE_SOC} \ + ${DDR_FIRMWARE_NAME} \ +" + # This package aggregates output deployed by other packages, so set the # appropriate dependencies for populate binaries task do_resolve_and_populate_binaries[depends] += " \ ${@' '.join('%s:do_deploy' % r for r in '${IMX_EXTRA_FIRMWARE}'.split() )} \ - imx-atf:do_deploy \ + ${IMX_DEFAULT_ATF_PROVIDER}:do_deploy \ ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'optee-os:do_deploy', '', d)} \ " -# Append make flags to include ATF load address -EXTRA_OEMAKE += "ATF_LOAD_ADDR=${ATF_LOAD_ADDR}" - # Define an additional task that collects binary output from dependent packages # and deploys them into the U-Boot build folder do_resolve_and_populate_binaries() { - if [ ! -n "${ATF_LOAD_ADDR}" ]; then - bberror "ATF_LOAD_ADDR is undefined, result binary would be unusable!" - fi - if [ -n "${UBOOT_CONFIG}" ]; then for config in ${UBOOT_MACHINE}; do i=$(expr $i + 1); for type in ${UBOOT_CONFIG}; do j=$(expr $j + 1); if [ $j -eq $i ]; then - for ddr_firmware in ${DDR_FIRMWARE_NAME}; do - bbnote "Copy ddr_firmware: ${ddr_firmware} from ${DEPLOY_DIR_IMAGE} -> ${B}/${config}/${ddr_firmware_name}" - cp ${DEPLOY_DIR_IMAGE}/${ddr_firmware} ${B}/${config}/ + for firmware in ${IMX_BOOT_CONTAINER_FIRMWARE}; do + bbnote "Copy firmware: ${firmware} from ${DEPLOY_DIR_IMAGE} -> ${B}/${config}/" + cp ${DEPLOY_DIR_IMAGE}/${firmware} ${B}/${config}/ done if [ -n "${ATF_MACHINE_NAME}" ]; then - cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/${ATF_MACHINE_NAME} ${B}/${config}/bl31.bin + cp ${DEPLOY_DIR_IMAGE}/${ATF_MACHINE_NAME} ${B}/${config}/bl31.bin else bberror "ATF binary is undefined, result binary would be unusable!" fi @@ -85,17 +90,16 @@ do_deploy:append() { j=$(expr $j + 1); if [ $j -eq $i ] then - install -m 0644 ${B}/${config}/u-boot.itb ${DEPLOYDIR}/u-boot.itb-${MACHINE}-${type} install -m 0644 ${B}/${config}/flash.bin ${DEPLOYDIR}/flash.bin-${MACHINE}-${type} # When there's more than one word in UBOOT_CONFIG, - # this will overwrite the links created in - # previous loop iterations, effectively making - # u-boot.itb and flash.bin correspond to the _last_ - # word in UBOOT_CONFIG. This is also how all other - # artifacts handled by oe-core's u-boot.inc are - # treated. - ln -sf u-boot.itb-${MACHINE}-${type} u-boot.itb - ln -sf flash.bin-${MACHINE}-${type} flash.bin + # the first UBOOT_CONFIG listed will be the imx-boot binary + if [ ! -f "${DEPLOYDIR}/imx-boot" ]; then + ln -sf flash.bin-${MACHINE}-${type} flash.bin + ln -sf flash.bin-${MACHINE}-${type} imx-boot + + else + bbwarn "Use custom wks.in for $UBOOT_CONFIG = $type" + fi fi done unset j diff --git a/classes/kernel-itbimage.bbclass b/classes/kernel-itbimage.bbclass deleted file mode 100644 index 51a87319..00000000 --- a/classes/kernel-itbimage.bbclass +++ /dev/null @@ -1,493 +0,0 @@ -inherit kernel-uboot uboot-sign - -python __anonymous () { - kerneltypes = d.getVar('KERNEL_IMAGETYPES') or "" - if 'itbImage' in kerneltypes.split(): - depends = d.getVar("DEPENDS") - depends = "%s u-boot-mkimage-native dtc-native" % depends - d.setVar("DEPENDS", depends) - - if d.getVar("UBOOT_ARCH") == "x86": - replacementtype = "bzImage" - else: - replacementtype = "vmlinux" - - # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal - # to kernel.bbclass . We have to override it, since we pack zImage - # (at least for now) into the fitImage . - typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or "" - if 'itbImage' in typeformake.split(): - d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('itbImage', replacementtype)) - - image = d.getVar('INITRAMFS_IMAGE') - if image: - d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete') - def extraimage_getdepends(task): - deps = "" - for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split(): - deps += " %s:%s" % (dep, task) - return deps - - d.appendVarFlag('do_image', 'depends', extraimage_getdepends('do_populate_lic')) - d.appendVarFlag('do_image_complete', 'depends', extraimage_getdepends('do_populate_sysroot')) - - # Verified boot will sign the fitImage and append the public key to - # U-Boot dtb. We ensure the U-Boot dtb is deployed before assembling - # the fitImage: - if d.getVar('UBOOT_SIGN_ENABLE') == "1": - uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot' - d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_deploy' % uboot_pn) -} - -# Options for the device tree compiler passed to mkimage '-D' feature: -UBOOT_MKIMAGE_DTCOPTS ??= "" - -# -# Emit the fitImage ITS header -# -# $1 ... .its filename -fitimage_emit_fit_header() { - cat << EOF >> ${1} -/dts-v1/; - -/ { - description = "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"; - #address-cells = <1>; -EOF -} - -# -# Emit the fitImage section bits -# -# $1 ... .its filename -# $2 ... Section bit type: imagestart - image section start -# confstart - configuration section start -# sectend - section end -# fitend - fitimage end -# -fitimage_emit_section_maint() { - case $2 in - imagestart) - cat << EOF >> ${1} - - images { -EOF - ;; - confstart) - cat << EOF >> ${1} - - configurations { -EOF - ;; - sectend) - cat << EOF >> ${1} - }; -EOF - ;; - fitend) - cat << EOF >> ${1} -}; -EOF - ;; - esac -} - -# -# Emit the fitImage ITS kernel section -# -# $1 ... .its filename -# $2 ... Image counter -# $3 ... Path to kernel image -# $4 ... Compression type -fitimage_emit_section_kernel() { - - kernel_csum="sha1" - - ENTRYPOINT=${UBOOT_ENTRYPOINT} - if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then - ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ - awk '$4=="${UBOOT_ENTRYSYMBOL}" {print $2}'` - fi - - cat << EOF >> ${1} - kernel@${2} { - description = "Linux kernel"; - data = /incbin/("${3}"); - type = "kernel"; - arch = "${UBOOT_ARCH}"; - os = "linux"; - compression = "${4}"; - load = <${UBOOT_LOADADDRESS}>; - entry = <${ENTRYPOINT}>; - hash@1 { - algo = "${kernel_csum}"; - }; - }; -EOF -} - -# -# Emit the fitImage ITS DTB section -# -# $1 ... .its filename -# $2 ... Image counter -# $3 ... Path to DTB image -fitimage_emit_section_dtb() { - - dtb_csum="sha1" - - if [ -n "${DTB_LOAD}" ]; then - dtb_loadline="load = <${DTB_LOAD}>;" - fi - - cat << EOF >> ${1} - fdt@${2} { - description = "Flattened Device Tree blob"; - data = /incbin/("${3}"); - type = "flat_dt"; - arch = "${UBOOT_ARCH}"; - compression = "none"; - ${dtb_loadline} - hash@1 { - algo = "${dtb_csum}"; - }; - }; -EOF -} - -# -# Emit the fitImage ITS setup section -# -# $1 ... .its filename -# $2 ... Image counter -# $3 ... Path to setup image -fitimage_emit_section_setup() { - - setup_csum="sha1" - - cat << EOF >> ${1} - setup@${2} { - description = "Linux setup.bin"; - data = /incbin/("${3}"); - type = "x86_setup"; - arch = "${UBOOT_ARCH}"; - os = "linux"; - compression = "none"; - load = <0x00090000>; - entry = <0x00090000>; - hash@1 { - algo = "${setup_csum}"; - }; - }; -EOF -} - -# -# Emit the fitImage ITS ramdisk section -# -# $1 ... .its filename -# $2 ... Image counter -# $3 ... Path to ramdisk image -fitimage_emit_section_ramdisk() { - - ramdisk_csum="sha1" - ramdisk_ctype="none" - ramdisk_loadline="" - ramdisk_entryline="" - - if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then - ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;" - fi - if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then - ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;" - fi - - case $3 in - *.gz) - ramdisk_ctype="gzip" - ;; - *.bz2) - ramdisk_ctype="bzip2" - ;; - *.lzma) - ramdisk_ctype="lzma" - ;; - *.lzo) - ramdisk_ctype="lzo" - ;; - *.lz4) - ramdisk_ctype="lz4" - ;; - esac - - cat << EOF >> ${1} - ramdisk@${2} { - description = "${INITRAMFS_IMAGE}"; - data = /incbin/("${3}"); - type = "ramdisk"; - arch = "${UBOOT_ARCH}"; - os = "linux"; - compression = "${ramdisk_ctype}"; - ${ramdisk_loadline} - ${ramdisk_entryline} - hash@1 { - algo = "${ramdisk_csum}"; - }; - }; -EOF -} - -# -# Emit the fitImage ITS configuration section -# -# $1 ... .its filename -# $2 ... Linux kernel ID -# $3 ... DTB image name -# $4 ... ramdisk ID -# $5 ... config ID -# $6 ... default flag -fitimage_emit_section_config() { - - conf_csum="sha1" - if [ -n "${UBOOT_SIGN_ENABLE}" ] ; then - conf_sign_keyname="${UBOOT_SIGN_KEYNAME}" - fi - - # Test if we have any DTBs at all - conf_desc="Linux kernel" - kernel_line="kernel = \"kernel@${2}\";" - fdt_line="" - ramdisk_line="" - setup_line="" - default_line="" - - if [ -n "${3}" ]; then - conf_desc="${conf_desc}, FDT blob" - fdt_line="fdt = \"fdt@${3}\";" - fi - - if [ -n "${4}" ]; then - conf_desc="${conf_desc}, ramdisk" - ramdisk_line="ramdisk = \"ramdisk@${4}\";" - fi - - if [ -n "${5}" ]; then - conf_desc="${conf_desc}, setup" - setup_line="setup = \"setup@${5}\";" - fi - - if [ "${6}" = "1" ]; then - default_line="default = \"conf@${3}\";" - fi - - cat << EOF >> ${1} - ${default_line} - conf@${3} { - description = "${6} ${conf_desc}"; - ${kernel_line} - ${fdt_line} - ${ramdisk_line} - ${setup_line} - hash@1 { - algo = "${conf_csum}"; - }; -EOF - - if [ ! -z "${conf_sign_keyname}" ] ; then - - sign_line="sign-images = \"kernel\"" - - if [ -n "${3}" ]; then - sign_line="${sign_line}, \"fdt\"" - fi - - if [ -n "${4}" ]; then - sign_line="${sign_line}, \"ramdisk\"" - fi - - if [ -n "${5}" ]; then - sign_line="${sign_line}, \"setup\"" - fi - - sign_line="${sign_line};" - - cat << EOF >> ${1} - signature@1 { - algo = "${conf_csum},rsa2048"; - key-name-hint = "${conf_sign_keyname}"; - ${sign_line} - }; -EOF - fi - - cat << EOF >> ${1} - }; -EOF -} - -# -# Assemble fitImage -# -# $1 ... .its filename -# $2 ... fitImage name -# $3 ... include ramdisk -fitimage_assemble() { - kernelcount=1 - dtbcount="" - DTBS="" - ramdiskcount=${3} - setupcount="" - rm -f ${1} arch/${ARCH}/boot/${2} - - fitimage_emit_fit_header ${1} - - # - # Step 1: Prepare a kernel image section. - # - fitimage_emit_section_maint ${1} imagestart - - uboot_prep_kimage - fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}" - - # - # Step 2: Prepare a DTB image section - # - if [ -n "${KERNEL_DEVICETREE}" ]; then - dtbcount=1 - for DTB in ${KERNEL_DEVICETREE}; do - if echo ${DTB} | grep -q '/dts/'; then - bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used." - DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'` - fi - DTB_PATH="arch/${ARCH}/boot/dts/${DTB}" - DTB=`basename ${DTB}` - if [ ! -e "${DTB_PATH}" ]; then - DTB_PATH="arch/${ARCH}/boot/${DTB}" - fi - - DTBS="${DTBS} ${DTB}" - fitimage_emit_section_dtb ${1} ${DTB} ${DTB_PATH} - done - fi - - # - # Step 3: Prepare a setup section. (For x86) - # - if [ -e arch/${ARCH}/boot/setup.bin ]; then - setupcount=1 - fitimage_emit_section_setup ${1} "${setupcount}" arch/${ARCH}/boot/setup.bin - fi - - # - # Step 4: Prepare a ramdisk section. - # - if [ "x${ramdiskcount}" = "x1" ] ; then - # Find and use the first initramfs image archive type we find - for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz ext2.gz cpio; do - initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}" - echo "Using $initramfs_path" - if [ -e "${initramfs_path}" ]; then - fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}" - break - fi - done - fi - - fitimage_emit_section_maint ${1} sectend - - # Force the first Kernel and DTB in the default config - kernelcount=1 - if [ -n "${dtbcount}" ]; then - dtbcount=1 - fi - - # - # Step 5: Prepare a configurations section - # - fitimage_emit_section_maint ${1} confstart - - if [ -n "${DTBS}" ]; then - i=1 - for DTB in ${DTBS}; do - fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${setupcount}" "`expr ${i} = ${dtbcount}`" - i=`expr ${i} + 1` - done - fi - - fitimage_emit_section_maint ${1} sectend - - fitimage_emit_section_maint ${1} fitend - - # - # Step 6: Assemble the image - # - uboot-mkimage \ - ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \ - -f ${1} \ - arch/${ARCH}/boot/${2} - - # - # Step 7: Sign the image and add public key to U-Boot dtb - # - if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then - uboot-mkimage \ - ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \ - -F -k "${UBOOT_SIGN_KEYDIR}" \ - -K "${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_BINARY}" \ - -r arch/${ARCH}/boot/${2} - fi -} - -do_assemble_fitimage() { - if echo ${KERNEL_IMAGETYPES} | grep -wq "itbImage"; then - cd ${B} - fitimage_assemble itb-image.its itbImage - fi -} - -addtask assemble_fitimage before do_install after do_compile - -do_assemble_fitimage_initramfs() { - if echo ${KERNEL_IMAGETYPES} | grep -wq "itbImage" && \ - test -n "${INITRAMFS_IMAGE}" ; then - cd ${B} - fitimage_assemble itb-image-${INITRAMFS_IMAGE}.its itbImage-${INITRAMFS_IMAGE} 1 - fi -} - -addtask assemble_fitimage_initramfs before do_deploy after do_install - - -kernel_do_deploy[vardepsexclude] = "DATETIME" -kernel_do_deploy:append() { - # Update deploy directory - if echo ${KERNEL_IMAGETYPES} | grep -wq "itbImage"; then - cd ${B} - echo "Copying fit-image.its source file..." - its_base_name="itbImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}" - its_symlink_name=itbImage-its-${MACHINE} - install -m 0644 itb-image.its ${DEPLOYDIR}/${its_base_name}.its - linux_bin_base_name="itbImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}" - linux_bin_symlink_name=itbImage-linux.bin-${MACHINE} - install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin - - if [ -n "${INITRAMFS_IMAGE}" ]; then - echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..." - its_initramfs_base_name="itbImage-its-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}" - its_initramfs_symlink_name=itbImage-its-${INITRAMFS_IMAGE_NAME} - install -m 0644 itb-image-${INITRAMFS_IMAGE}.its ${DEPLOYDIR}/${its_initramfs_base_name}.its - fit_initramfs_base_name="itbImage-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}" - fit_initramfs_symlink_name=itbImage-${INITRAMFS_IMAGE_NAME} - install -m 0644 arch/${ARCH}/boot/itbImage-${INITRAMFS_IMAGE} ${DEPLOYDIR}/${fit_initramfs_base_name}.bin - fi - - cd ${DEPLOYDIR} - ln -sf ${its_base_name}.its ${its_symlink_name}.its - ln -sf ${linux_bin_base_name}.bin ${linux_bin_symlink_name}.bin - - if [ -n "${INITRAMFS_IMAGE}" ]; then - ln -sf ${its_initramfs_base_name}.its ${its_initramfs_symlink_name}.its - ln -sf ${fit_initramfs_base_name}.bin ${fit_initramfs_symlink_name}.bin - fi - fi -} diff --git a/classes/machine-overrides-extender.bbclass b/classes/machine-overrides-extender.bbclass index 876ddd10..58cb45b1 100644 --- a/classes/machine-overrides-extender.bbclass +++ b/classes/machine-overrides-extender.bbclass @@ -12,19 +12,17 @@ # # MACHINEOVERRIDES_EXTENDER_FILTER_OUT:override = "group1 group2" # -# Copyright 2016-2018 (C) O.S. Systems Software LTDA. +# Copyright 2016-2018, 2022 (C) O.S. Systems Software LTDA. def machine_overrides_extender(d): machine_overrides = (d.getVar('PRISTINE_MACHINEOVERRIDES') or '').split(':') # Gather the list of overrides to filter out - machine_overrides_filter_out = [] + machine_overrides_filter_out = (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT') or '').split() for override in machine_overrides: machine_overrides_filter_out += (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT:%s' % override) or '').split() - # Drop any overrides of filter_out prior extending - machine_overrides = [o for o in machine_overrides if o not in machine_overrides_filter_out] - + # Extend the overrides for override in machine_overrides: extender = d.getVar('MACHINEOVERRIDES_EXTENDER:%s' % override) @@ -40,6 +38,9 @@ def machine_overrides_extender(d): for e in extender: machine_overrides.insert(index, e) + # Drop any overrides of filter_out after extending + machine_overrides = [o for o in machine_overrides if o not in machine_overrides_filter_out] + return ':'.join(machine_overrides) python machine_overrides_extender_handler() { @@ -54,3 +55,22 @@ python machine_overrides_extender_handler() { machine_overrides_extender_handler[eventmask] = "bb.event.ConfigParsed" addhandler machine_overrides_extender_handler + +python machineoverrides_filtered_out_qa_handler() { + filtered_out = (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT') or "").split() + qa_error = d.getVar('MACHINEOVERRIDES_FILTERED_OUT_QA_ERROR') + + for var in d.overridedata: + # We need to allow the overrides being used in the extender + # so avoid processing it. + if 'MACHINEOVERRIDES_EXTENDER' in var: + continue + + for (r, o) in d.overridedata[var]: + common = list(set(o.split(":")).intersection(filtered_out)) + if len(common) > 0: + raise bb.parse.SkipRecipe(qa_error % common) +} + +machineoverrides_filtered_out_qa_handler[eventmask] = "bb.event.RecipeParsed" +addhandler machineoverrides_filtered_out_qa_handler diff --git a/classes/mfgtool-initramfs-image.bbclass b/classes/mfgtool-initramfs-image.bbclass index 1d4c5513..f338bf82 100644 --- a/classes/mfgtool-initramfs-image.bbclass +++ b/classes/mfgtool-initramfs-image.bbclass @@ -6,15 +6,17 @@ # # Copyright 2014-2017 (C) O.S. Systems Software LTDA. -DEPENDS += "u-boot-mfgtool linux-mfgtool" +DEPENDS += "linux-mfgtool" FEATURE_PACKAGES_mtd = "packagegroup-fsl-mfgtool-mtd" FEATURE_PACKAGES_extfs = "packagegroup-fsl-mfgtool-extfs" FEATURE_PACKAGES_f2fs = "packagegroup-fsl-mfgtool-f2fs" -IMAGE_FSTYPES = "cpio.gz.u-boot" -IMAGE_FSTYPES:mxs = "cpio.gz.u-boot" +ZSTD_COMPRESSION_LEVEL ?= "-10" +SOC_DEFAULT_IMAGE_FSTYPES = "cpio.zst.u-boot" +SOC_DEFAULT_IMAGE_FSTYPES:mxs-generic-bsp = "cpio.gz.u-boot" IMAGE_ROOTFS_SIZE ?= "8192" +IMAGE_NAME_SUFFIX = "" # Filesystems enabled by default DEFAULT_FS_SUPPORT = " \ diff --git a/classes/use-imx-headers.bbclass b/classes/use-imx-headers.bbclass index c6c7f043..4baf4574 100644 --- a/classes/use-imx-headers.bbclass +++ b/classes/use-imx-headers.bbclass @@ -13,14 +13,14 @@ # # Copyright 2018 (C) O.S. Systems Software LTDA. -DEPENDS:append:imx = " linux-imx-headers" +DEPENDS:append:imx-nxp-bsp = " linux-imx-headers" # Set runtime dependency of -dev for package inheriting this class to # linux-imx-headers-dev package. This is required in order to propagate # headers into the SDK RDEPENDS:${PN}-dev += "linux-imx-headers-dev" -PACKAGE_ARCH:imx ?= "${MACHINE_SOCARCH}" +PACKAGE_ARCH:imx-nxp-bsp ?= "${MACHINE_SOCARCH}" STAGING_INCDIR_IMX = "${STAGING_INCDIR}/imx" diff --git a/classes/use-imx-security-controller-firmware.bbclass b/classes/use-imx-security-controller-firmware.bbclass index 9650059b..f07580dd 100644 --- a/classes/use-imx-security-controller-firmware.bbclass +++ b/classes/use-imx-security-controller-firmware.bbclass @@ -16,16 +16,16 @@ # This behavior ensures that derivatives which requires SECO Firmware to be # present in the image file have it properly defined. -SECO_FIRMWARE_NAME ?= "" - -SECO_FIRMWARE_NAME:mx8qm = "mx8qmb0-ahab-container.img" -SECO_FIRMWARE_NAME:mx8qxp = \ - "${@bb.utils.contains('MACHINE_FEATURES', 'soc-revb0', 'mx8qxb0-ahab-container.img', \ - 'mx8qxc0-ahab-container.img', d)}" -SECO_FIRMWARE_NAME:mx8dxl = "mx8dxla1-ahab-container.img" +SECO_FIRMWARE_NAME ?= "" +SECO_FIRMWARE_NAME:mx8qm-generic-bsp ?= "mx8qm${IMX_SOC_REV_LOWER}-ahab-container.img" +SECO_FIRMWARE_NAME:mx8qxp-generic-bsp ?= "mx8qx${IMX_SOC_REV_LOWER}-ahab-container.img" +SECO_FIRMWARE_NAME:mx8dx-generic-bsp ?= "mx8qx${IMX_SOC_REV_LOWER}-ahab-container.img" +SECO_FIRMWARE_NAME:mx8dxl-generic-bsp ?= "mx8dxl${IMX_SOC_REV_LOWER}-ahab-container.img" +SECO_FIRMWARE_NAME:mx8ulp-generic-bsp ?= "mx8ulp${IMX_SOC_REV_LOWER}-ahab-container.img" +SECO_FIRMWARE_NAME:mx93-generic-bsp ?= "mx93${IMX_SOC_REV_LOWER}-ahab-container.img" python () { - if "mx8m" in d.getVar('MACHINEOVERRIDES').split(":"): + if "mx8m-generic-bsp" in d.getVar('MACHINEOVERRIDES').split(":"): return # We need to allow the recipes to be parsed for this case seco_firmware = d.getVar('SECO_FIRMWARE_NAME') diff --git a/classes/uuu_bootloader_tag.bbclass b/classes/uuu_bootloader_tag.bbclass new file mode 100644 index 00000000..87745660 --- /dev/null +++ b/classes/uuu_bootloader_tag.bbclass @@ -0,0 +1,12 @@ +# Append a tag to the bootloader image used in the SD card image. The tag +# contains the size of the bootloader image so UUU can easily find the end of +# the bootloader in the SD card image. +do_deploy:append() { + if [ "${UUU_BOOTLOADER}" != "" ]; then + cp ${DEPLOYDIR}/${UUU_BOOTLOADER} ${DEPLOYDIR}/${UUU_BOOTLOADER_TAGGED} + cp ${DEPLOYDIR}/${UUU_BOOTLOADER} ${DEPLOYDIR}/${UUU_BOOTLOADER_UNTAGGED} + ln -sf ${UUU_BOOTLOADER_TAGGED} ${DEPLOYDIR}/${UUU_BOOTLOADER} + stat -L -cUUUBURNXXOEUZX7+A-XY5601QQWWZ%sEND ${DEPLOYDIR}/${UUU_BOOTLOADER_TAGGED} \ + >> ${DEPLOYDIR}/${UUU_BOOTLOADER_TAGGED} + fi +} |