From 3531a6521f8c85122f18b52a271c84dbd1aa76aa Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Mon, 13 May 2019 11:38:03 +0200 Subject: [PATCH] classes: update NXP bbclasses Update NXP's .bbclass files with the ones in meta-fsl-bsp-release branch sumo-4.14.98-2.0.0_ga. https://jira.digi.com/browse/DEL-6603 Signed-off-by: Gabriel Valcazar --- .../classes/fsl-eula-graphics.bbclass | 9 +++ meta-digi-arm/classes/fsl-eula-unpack.bbclass | 68 +++++++++++++++++++ .../classes/fsl-eula-unpack2.bbclass | 34 +--------- meta-digi-arm/classes/fsl-eula.bbclass | 30 +------- .../classes/fsl-eula2-package-arch.bbclass | 16 +++++ .../classes/fsl-eula2-unpack2.bbclass | 36 ++++++++++ meta-digi-arm/classes/fsl-eula2.bbclass | 16 +++++ 7 files changed, 147 insertions(+), 62 deletions(-) create mode 100644 meta-digi-arm/classes/fsl-eula-graphics.bbclass create mode 100644 meta-digi-arm/classes/fsl-eula-unpack.bbclass create mode 100644 meta-digi-arm/classes/fsl-eula2-package-arch.bbclass create mode 100644 meta-digi-arm/classes/fsl-eula2-unpack2.bbclass create mode 100644 meta-digi-arm/classes/fsl-eula2.bbclass diff --git a/meta-digi-arm/classes/fsl-eula-graphics.bbclass b/meta-digi-arm/classes/fsl-eula-graphics.bbclass new file mode 100644 index 000000000..1feb7bb56 --- /dev/null +++ b/meta-digi-arm/classes/fsl-eula-graphics.bbclass @@ -0,0 +1,9 @@ +# fsl-eula-graphics.bbclass extends the naming scheme in fsl-eula.bbclass +# to allow for graphics-backend-specific archives. +IMX_PACKAGE_NAME_APPEND = "" +IMX_PACKAGE_NAME_APPEND_class-target = \ + "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '-wayland', \ + bb.utils.contains('DISTRO_FEATURES', 'x11', '-x11', \ + '-fb', d), d)}" +IMX_PACKAGE_NAME_append_class-target = "${IMX_PACKAGE_NAME_APPEND}" +SRC_URI_NAME_append_class-target = "${IMX_PACKAGE_NAME_APPEND}" diff --git a/meta-digi-arm/classes/fsl-eula-unpack.bbclass b/meta-digi-arm/classes/fsl-eula-unpack.bbclass new file mode 100644 index 000000000..361aed509 --- /dev/null +++ b/meta-digi-arm/classes/fsl-eula-unpack.bbclass @@ -0,0 +1,68 @@ +# fsl-eula-unpack.bbclass provides the mechanism used for unpacking +# the .bin file downloaded by HTTP and handle the EULA acceptance. +# +# To use it, the 'fsl-eula' parameter needs to be added to the +# SRC_URI entry, e.g: +# +# SRC_URI = "${FSL_MIRROR}/firmware-imx-${PV};fsl-eula=true" + +LIC_FILES_CHKSUM_append = " file://${FSL_EULA_FILE};md5=80c0478f4339af024519b3723023fe28" + +LIC_FILES_CHKSUM[vardepsexclude] += "FSL_EULA_FILE" + +python fsl_bin_do_unpack() { + src_uri = (d.getVar('SRC_URI', True) 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) + + for url in fetcher.ud.values(): + save_cwd = os.getcwd() + # Check for supported fetchers + if url.type in ['http', 'https', 'ftp', 'file']: + if url.parm.get('fsl-eula', False): + # If download has failed, do nothing + if not os.path.exists(url.localpath): + bb.debug(1, "Exiting as '%s' cannot be found" % url.basename) + return + + # Change to the working directory + bb.note("Handling file '%s' as a Freescale's EULA binary." % url.basename) + save_cwd = os.getcwd() + os.chdir(rootdir) + + cmd = "sh %s --auto-accept --force" % (url.localpath) + bb.fetch2.runfetchcmd(cmd, d, quiet=True) + + # Return to the previous directory + os.chdir(save_cwd) +} + +python do_unpack() { + eula = d.getVar('ACCEPT_FSL_EULA', True) + eula_file = d.getVar('FSL_EULA_FILE', True) + pkg = d.getVar('PN', True) + 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" diff --git a/meta-digi-arm/classes/fsl-eula-unpack2.bbclass b/meta-digi-arm/classes/fsl-eula-unpack2.bbclass index a3c8e668f..b5f2f651c 100644 --- a/meta-digi-arm/classes/fsl-eula-unpack2.bbclass +++ b/meta-digi-arm/classes/fsl-eula-unpack2.bbclass @@ -1,33 +1 @@ -# fsl-eula-unpack2.bbclass provides a mechanism for a) unpacking certain -# EULA-licensed archives downloaded by HTTP and b) handling the EULA -# acceptance. - -inherit fsl-eula-unpack fsl-eula - -IMX_PACKAGE_VERSION = "${PV}" - -SRC_URI = "${FSL_MIRROR}${IMX_PACKAGE_NAME}.bin;name=${SRC_URI_NAME};fsl-eula=true" - -S = "${WORKDIR}/${IMX_PACKAGE_NAME}" - -# For native apps, insert the user-local sysroot path -# For nativesdk apps, insert the correct distro folder -D_SUBDIR = "" -D_SUBDIR_class-native = "${STAGING_DIR_NATIVE}" -D_SUBDIR_class-nativesdk = "/opt/${DISTRO}" - -# SCR is the location and name of the Software Content Register file -# relative to ${D}${D_SUBDIR}. -SCR = "SCR.txt" - -do_install () { - install -d ${D}${D_SUBDIR} - cp -r ${S}/* ${D}${D_SUBDIR} - rm ${D}${D_SUBDIR}/COPYING - if [ ! -f ${D}${D_SUBDIR}/${SCR} ]; then - bbfatal "Missing Software Content Register \"${D}${D_SUBDIR}/${SCR}\"" - fi - rm ${D}${D_SUBDIR}/${SCR} -} - -FILES_${PN} = "/" +inherit fsl-eula2-unpack2 fsl-eula2-package-arch diff --git a/meta-digi-arm/classes/fsl-eula.bbclass b/meta-digi-arm/classes/fsl-eula.bbclass index ec27fcde7..be31092b8 100644 --- a/meta-digi-arm/classes/fsl-eula.bbclass +++ b/meta-digi-arm/classes/fsl-eula.bbclass @@ -1,29 +1 @@ -# fsl-eula.bbclass defines a common naming scheme used by the -# packing and unpacking mechanisms defined in fsl-eula-pack.bbclass -# and fsl-eula-unpack2.bbclass. -# -# Note that it is not necessary to inherit this class directly. It is -# already inherited from fsl-eula-pack.bbclass and fsl-eula-unpack2.bbclass. -# -# The naming scheme takes into account the fact that a single software -# package can create many archives based on the combinations of a) target -# versus native/nativesdk components, and b) the target or native architecture. -# The naming scheme can be extended through regular bitbake means to allow -# configuration-specific archives, as can be seen in fsl-eula-graphics.bbclass. - -# The variable IMX_PACKAGE_NAME gives a unique name for every possible -# archive. The variable is built from a combination of the package name ${PN}, -# the version ${IMX_PACKAGE_VERSION} and the target or native architecture, -# ${TARGET_ARCH} or ${BUILD_ARCH}. -IMX_PACKAGE_NAME = "${PN}-${IMX_PACKAGE_VERSION}-${TARGET_ARCH}" -IMX_PACKAGE_NAME_class-native = "${PN}-${IMX_PACKAGE_VERSION}-${BUILD_ARCH}" -IMX_PACKAGE_NAME_class-nativesdk = "${PN}-${IMX_PACKAGE_VERSION}-${BUILD_ARCH}" - -# The variable SRC_URI_NAME gives a unique SRC_URI name option for use in -# unpacking recipes derived from fsl-eula-unpack2.bbclass. With this name, -# a single unpacking recipe can handle all possible archives. The name is -# built from with a combination of target or native architecture, -# ${TARGET_ARCH} or ${BUILD_ARCH}, and a native or nativesdk designation. -SRC_URI_NAME = "${TARGET_ARCH}" -SRC_URI_NAME_class-native = "${BUILD_ARCH}-native" -SRC_URI_NAME_class-nativesdk = "${BUILD_ARCH}-nativesdk" +inherit fsl-eula2 fsl-eula2-package-arch diff --git a/meta-digi-arm/classes/fsl-eula2-package-arch.bbclass b/meta-digi-arm/classes/fsl-eula2-package-arch.bbclass new file mode 100644 index 000000000..ff34c9b84 --- /dev/null +++ b/meta-digi-arm/classes/fsl-eula2-package-arch.bbclass @@ -0,0 +1,16 @@ +# fsl-eula-package_arch.bbclass extends the package naming scheme to allow +# a single software package to create multiple archives based on the +# combinations of a) target versus native/nativesdk components, and b) the +# target or native architecture. + +IMX_PACKAGE_NAME_append = "-${TARGET_ARCH}" +IMX_PACKAGE_NAME_class-native_append = "-${BUILD_ARCH}" +IMX_PACKAGE_NAME_class-nativesdk_append = "-${BUILD_ARCH}" + +SRC_URI_append = ";name=${SRC_URI_NAME}" +SRC_URI_NAME = "${TARGET_ARCH}" +SRC_URI_NAME_class-native = "${BUILD_ARCH}-native" +SRC_URI_NAME_class-nativesdk = "${BUILD_ARCH}-nativesdk" + +INSANE_SKIP_${PN}_remove = "arch" +INSANE_SKIP_${PN}-dbg_remove = "arch" diff --git a/meta-digi-arm/classes/fsl-eula2-unpack2.bbclass b/meta-digi-arm/classes/fsl-eula2-unpack2.bbclass new file mode 100644 index 000000000..29b05c4a6 --- /dev/null +++ b/meta-digi-arm/classes/fsl-eula2-unpack2.bbclass @@ -0,0 +1,36 @@ +# fsl-eula-unpack2.bbclass provides a mechanism for a) unpacking certain +# EULA-licensed archives downloaded by HTTP and b) handling the EULA +# acceptance. + +inherit fsl-eula-unpack fsl-eula2 + +IMX_PACKAGE_VERSION = "${PV}" + +SRC_URI = "${FSL_MIRROR}${IMX_PACKAGE_NAME}.bin;fsl-eula=true" + +S = "${WORKDIR}/${IMX_PACKAGE_NAME}" + +# For native apps, insert the user-local sysroot path +# For nativesdk apps, insert the correct distro folder +D_SUBDIR = "" +D_SUBDIR_class-native = "${STAGING_DIR_NATIVE}" +D_SUBDIR_class-nativesdk = "/opt/${DISTRO}" + +# SCR is the location and name of the Software Content Register file +# relative to ${D}${D_SUBDIR}. +SCR = "SCR.txt" + +do_install () { + install -d ${D}${D_SUBDIR} + cp -r ${S}/* ${D}${D_SUBDIR} + if [ -d "${D}/usr/lib" ] && [ "${D}/usr/lib" != "${D}${libdir}" ]; then + mv ${D}/usr/lib ${D}${libdir} + fi + rm ${D}${D_SUBDIR}/COPYING + if [ ! -f ${D}${D_SUBDIR}/${SCR} ]; then + bbfatal "Missing Software Content Register \"${D}${D_SUBDIR}/${SCR}\"" + fi + rm ${D}${D_SUBDIR}/${SCR} +} + +FILES_${PN} = "/" diff --git a/meta-digi-arm/classes/fsl-eula2.bbclass b/meta-digi-arm/classes/fsl-eula2.bbclass new file mode 100644 index 000000000..2d1afb256 --- /dev/null +++ b/meta-digi-arm/classes/fsl-eula2.bbclass @@ -0,0 +1,16 @@ +# fsl-eula2.bbclass defines a common naming scheme used by the +# packing and unpacking mechanisms defined in fsl-eula-pack.bbclass +# and fsl-eula2-unpack2.bbclass. +# +# Note that it is not necessary to inherit this class directly. It is +# already inherited from fsl-eula-pack.bbclass and fsl-eula2-unpack2.bbclass. +# +# The naming scheme can be extended through regular bitbake means to allow +# configuration-specific archives, as can be seen in fsl-eula-graphics.bbclass +# and fsl-eula2-package-arch.bbclass. +IMX_PACKAGE_NAME = "${BPN}-${IMX_PACKAGE_VERSION}" +IMX_PACKAGE_NAME_class-native = "${PN}-${IMX_PACKAGE_VERSION}" +IMX_PACKAGE_NAME_class-nativesdk = "${PN}-${IMX_PACKAGE_VERSION}" + +INSANE_SKIP_${PN} += "arch" +INSANE_SKIP_${PN}-dbg += "arch"