diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2025-03-31 18:08:39 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-31 18:08:39 -0300 |
commit | 0b025dece640b6946b2973a70430190f2dcc2a12 (patch) | |
tree | c3152ab6671b7da0d3399ad6c2d07790c6441b33 | |
parent | 50242ec7eb510edfb33bbc42f01308bea64bd5dd (diff) | |
parent | d36333dce83f1848f44eaa9507ab170f2c360cd9 (diff) | |
download | meta-freescale-0b025dece640b6946b2973a70430190f2dcc2a12.tar.gz |
Merge pull request #2167 from mdrodrigo/topic/styhead
Update styhead branch
57 files changed, 650 insertions, 2571 deletions
@@ -85,7 +85,6 @@ This file lists all licenses used by recipes in the meta-freescale layer. | |||
85 | ./recipes-extended/testfloat/testfloat_2a.bb: LICENSE = "TestFloat" | 85 | ./recipes-extended/testfloat/testfloat_2a.bb: LICENSE = "TestFloat" |
86 | ./recipes-extended/tsntool/tsntool_git.bb: LICENSE = "GPL-2.0-only" | 86 | ./recipes-extended/tsntool/tsntool_git.bb: LICENSE = "GPL-2.0-only" |
87 | ./recipes-fsl/images/fsl-image-mfgtool-initramfs.bb: LICENSE = "MIT" | 87 | ./recipes-fsl/images/fsl-image-mfgtool-initramfs.bb: LICENSE = "MIT" |
88 | ./recipes-fsl/mcore-demos/imx-m4-demos_1.0.1.bb: LICENSE = "Proprietary" | ||
89 | ./recipes-fsl/mcore-demos/imx-mcore-demos.inc: LICENSE = "Proprietary" | 88 | ./recipes-fsl/mcore-demos/imx-mcore-demos.inc: LICENSE = "Proprietary" |
90 | ./recipes-fsl/packagegroups/packagegroup-fsl-mfgtool.bb: LICENSE = "MIT" | 89 | ./recipes-fsl/packagegroups/packagegroup-fsl-mfgtool.bb: LICENSE = "MIT" |
91 | ./recipes-graphics/drm/libdrm_2.4.116.imx.bb: LICENSE = "MIT" | 90 | ./recipes-graphics/drm/libdrm_2.4.116.imx.bb: LICENSE = "MIT" |
@@ -143,10 +142,10 @@ LICENSE_FLAGS = "commercial" | |||
143 | ./recipes-multimedia/gstreamer/imx-gst1.0-plugin_git.bb: LICENSE = "GPL-2.0-only & LGPL-2.0-only & LGPL-2.1-only" | 142 | ./recipes-multimedia/gstreamer/imx-gst1.0-plugin_git.bb: LICENSE = "GPL-2.0-only & LGPL-2.0-only & LGPL-2.1-only" |
144 | ./recipes-multimedia/imx-codec/imx-codec_4.9.0.bb: LICENSE = "Proprietary" | 143 | ./recipes-multimedia/imx-codec/imx-codec_4.9.0.bb: LICENSE = "Proprietary" |
145 | ./recipes-multimedia/imx-dsp/imx-dsp-codec-ext_2.1.8.bb: LICENSE = "Proprietary" | 144 | ./recipes-multimedia/imx-dsp/imx-dsp-codec-ext_2.1.8.bb: LICENSE = "Proprietary" |
146 | ./recipes-multimedia/imx-dsp/imx-dsp_2.1.8.bb: LICENSE = "Proprietary" | 145 | ./recipes-multimedia/imx-dsp/imx-dsp_2.1.9.bb: LICENSE = "Proprietary" |
147 | ./recipes-multimedia/imx-dspc-asrc/imx-dspc-asrc_1.0.1.bb: LICENSE = "Proprietary" | 146 | ./recipes-multimedia/imx-dspc-asrc/imx-dspc-asrc_1.0.1.bb: LICENSE = "Proprietary" |
148 | ./recipes-multimedia/imx-opencl-converter/imx-opencl-converter_0.5.0.bb: LICENSE = "Proprietary" | 147 | ./recipes-multimedia/imx-opencl-converter/imx-opencl-converter_0.6.0.bb: LICENSE = "Proprietary" |
149 | ./recipes-multimedia/imx-parser/imx-parser_4.9.1.bb: LICENSE = "Proprietary" | 148 | ./recipes-multimedia/imx-parser/imx-parser_4.9.2.bb: LICENSE = "Proprietary" |
150 | ./recipes-multimedia/imx-sw-pdm/imx-sw-pdm_1.0.3.bb: LICENSE = "Proprietary" | 149 | ./recipes-multimedia/imx-sw-pdm/imx-sw-pdm_1.0.3.bb: LICENSE = "Proprietary" |
151 | ./recipes-multimedia/imx-vpuwrap/imx-vpuwrap_git.bb: LICENSE = "Proprietary" | 150 | ./recipes-multimedia/imx-vpuwrap/imx-vpuwrap_git.bb: LICENSE = "Proprietary" |
152 | ./recipes-multimedia/libimxvpuapi/libimxvpuapi2_2.3.1.bb: LICENSE = "LGPL-2.1-only" | 151 | ./recipes-multimedia/libimxvpuapi/libimxvpuapi2_2.3.1.bb: LICENSE = "LGPL-2.1-only" |
diff --git a/conf/machine/imx6sllevk.conf b/conf/machine/imx6sllevk.conf index 5a1dc666..858699c9 100644 --- a/conf/machine/imx6sllevk.conf +++ b/conf/machine/imx6sllevk.conf | |||
@@ -33,6 +33,3 @@ MACHINE_FEATURES += "wifi bluetooth bcm4339 bcm43455 nxp8987-sdio" | |||
33 | 33 | ||
34 | # MESA DRI library | 34 | # MESA DRI library |
35 | XSERVER += "mesa-driver-swrast" | 35 | XSERVER += "mesa-driver-swrast" |
36 | |||
37 | PREFERRED_PROVIDER_u-boot = "u-boot-fslc" | ||
38 | PREFERRED_PROVIDER_virtual/bootloader = "u-boot-fslc" | ||
diff --git a/conf/machine/imx8qm-mek.conf b/conf/machine/imx8qm-mek.conf index 47cfde19..648320d8 100644 --- a/conf/machine/imx8qm-mek.conf +++ b/conf/machine/imx8qm-mek.conf | |||
@@ -20,7 +20,7 @@ RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = "" | |||
20 | LOADADDR = "" | 20 | LOADADDR = "" |
21 | 21 | ||
22 | # We have to disable SERIAL_CONSOLE due to auto-serial-console | 22 | # We have to disable SERIAL_CONSOLE due to auto-serial-console |
23 | SERIAL_CONSOLES = "115200;ttyAMA0" | 23 | SERIAL_CONSOLES = "115200;ttyLP0" |
24 | 24 | ||
25 | # we do not want to have getty running on tty1 as we run | 25 | # we do not want to have getty running on tty1 as we run |
26 | # auto-serial-console there | 26 | # auto-serial-console there |
diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc index 8ccdeb64..7a3518cd 100644 --- a/conf/machine/include/imx-base.inc +++ b/conf/machine/include/imx-base.inc | |||
@@ -184,7 +184,6 @@ IMX_SOC_REV:mx8dx-generic-bsp ??= "C0" | |||
184 | IMX_SOC_REV:mx8ulp-generic-bsp ??= \ | 184 | IMX_SOC_REV:mx8ulp-generic-bsp ??= \ |
185 | "${@bb.utils.contains('MACHINE_FEATURES', 'soc-reva0', 'A0', \ | 185 | "${@bb.utils.contains('MACHINE_FEATURES', 'soc-reva0', 'A0', \ |
186 | 'A2', d)}" | 186 | 'A2', d)}" |
187 | IMX_SOC_REV:mx91-generic-bsp ??= "A0" | ||
188 | IMX_SOC_REV:mx93-generic-bsp ??= "A1" | 187 | IMX_SOC_REV:mx93-generic-bsp ??= "A1" |
189 | 188 | ||
190 | IMX_SOC_REV_LOWER = "${@d.getVar('IMX_SOC_REV').lower()}" | 189 | IMX_SOC_REV_LOWER = "${@d.getVar('IMX_SOC_REV').lower()}" |
@@ -606,12 +605,12 @@ PREFERRED_VERSION_vulkan-tools:imxvulkan ??= "1.3.275.0.imx" | |||
606 | PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.3.275.0.imx" | 605 | PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.3.275.0.imx" |
607 | 606 | ||
608 | # Use i.MX optee Version | 607 | # Use i.MX optee Version |
609 | PREFERRED_VERSION_optee-os:mx8-nxp-bsp ??= "4.2.0.imx" | 608 | PREFERRED_VERSION_optee-os:mx8-nxp-bsp ??= "4.4.0.imx" |
610 | PREFERRED_VERSION_optee-os:mx9-nxp-bsp ??= "4.2.0.imx" | 609 | PREFERRED_VERSION_optee-os:mx9-nxp-bsp ??= "4.4.0.imx" |
611 | PREFERRED_VERSION_optee-client:mx8-nxp-bsp ??= "4.2.0.imx" | 610 | PREFERRED_VERSION_optee-client:mx8-nxp-bsp ??= "4.4.0.imx" |
612 | PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "4.2.0.imx" | 611 | PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "4.4.0.imx" |
613 | PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "4.2.0.imx" | 612 | PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "4.4.0.imx" |
614 | PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "4.2.0.imx" | 613 | PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "4.4.0.imx" |
615 | 614 | ||
616 | # Use i.MX opencv Version | 615 | # Use i.MX opencv Version |
617 | PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx" | 616 | PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx" |
diff --git a/conf/machine/include/imx8x-mek.inc b/conf/machine/include/imx8x-mek.inc index 9eaa77c5..adfcab47 100644 --- a/conf/machine/include/imx8x-mek.inc +++ b/conf/machine/include/imx8x-mek.inc | |||
@@ -12,7 +12,7 @@ RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = "" | |||
12 | LOADADDR = "" | 12 | LOADADDR = "" |
13 | 13 | ||
14 | # We have to disable SERIAL_CONSOLE due to auto-serial-console | 14 | # We have to disable SERIAL_CONSOLE due to auto-serial-console |
15 | SERIAL_CONSOLES = "115200;ttyAMA0" | 15 | SERIAL_CONSOLES = "115200;ttyLP0" |
16 | 16 | ||
17 | # we do not want to have getty running on tty1 as we run | 17 | # we do not want to have getty running on tty1 as we run |
18 | # auto-serial-console there | 18 | # auto-serial-console there |
diff --git a/recipes-bsp/imx-atf/imx-atf_2.10.bb b/recipes-bsp/imx-atf/imx-atf_2.10.bb index 04826b4c..ec4088dc 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.10.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.10.bb | |||
@@ -9,7 +9,7 @@ PV .= "+git${SRCPV}" | |||
9 | 9 | ||
10 | SRC_URI = "git://github.com/nxp-imx/imx-atf.git;protocol=https;branch=${SRCBRANCH}" | 10 | SRC_URI = "git://github.com/nxp-imx/imx-atf.git;protocol=https;branch=${SRCBRANCH}" |
11 | SRCBRANCH = "lf_v2.10" | 11 | SRCBRANCH = "lf_v2.10" |
12 | SRCREV = "28affcae957cb8194917b5246276630f9e6343e1" | 12 | SRCREV = "1b27ee3edbb40ef9432c69ccaa744d1ac5d54c5d" |
13 | 13 | ||
14 | S = "${WORKDIR}/git" | 14 | S = "${WORKDIR}/git" |
15 | 15 | ||
diff --git a/recipes-bsp/imx-mkimage/imx-mkimage_git.inc b/recipes-bsp/imx-mkimage/imx-mkimage_git.inc index 8617ca36..abc60c9e 100644 --- a/recipes-bsp/imx-mkimage/imx-mkimage_git.inc +++ b/recipes-bsp/imx-mkimage/imx-mkimage_git.inc | |||
@@ -5,8 +5,8 @@ DEPENDS = "zlib-native openssl-native" | |||
5 | SRC_URI = "git://github.com/nxp-imx/imx-mkimage.git;protocol=https;branch=${SRCBRANCH} \ | 5 | SRC_URI = "git://github.com/nxp-imx/imx-mkimage.git;protocol=https;branch=${SRCBRANCH} \ |
6 | file://0001-iMX8M-soc.mak-use-native-mkimage-from-sysroot.patch \ | 6 | file://0001-iMX8M-soc.mak-use-native-mkimage-from-sysroot.patch \ |
7 | " | 7 | " |
8 | SRCBRANCH = "lf-6.6.36_2.1.0" | 8 | SRCBRANCH = "lf-6.6.52_2.2.0" |
9 | SRCREV = "4622115cbc037f79039c4522faeced4aabea986b" | 9 | SRCREV = "71b8c18af93a5eb972d80fbec290006066cff24f" |
10 | 10 | ||
11 | S = "${WORKDIR}/git" | 11 | S = "${WORKDIR}/git" |
12 | 12 | ||
diff --git a/recipes-bsp/imx-uuc/imx-uuc_git.bb b/recipes-bsp/imx-uuc/imx-uuc_git.bb index 49fc1558..e245f28b 100644 --- a/recipes-bsp/imx-uuc/imx-uuc_git.bb +++ b/recipes-bsp/imx-uuc/imx-uuc_git.bb | |||
@@ -6,8 +6,6 @@ DEPENDS = "virtual/kernel dosfstools-native" | |||
6 | LICENSE = "GPL-2.0-only" | 6 | LICENSE = "GPL-2.0-only" |
7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" | 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
8 | 8 | ||
9 | inherit autotools-brokensep | ||
10 | |||
11 | PR = "r1" | 9 | PR = "r1" |
12 | PV = "0.5.1+git${SRCPV}" | 10 | PV = "0.5.1+git${SRCPV}" |
13 | 11 | ||
@@ -16,6 +14,10 @@ SRCREV = "9b4adc0cde346fbae743dc21fcf5115488307b83" | |||
16 | 14 | ||
17 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
18 | 16 | ||
17 | do_install() { | ||
18 | oe_runmake 'DESTDIR=${D}' install | ||
19 | } | ||
20 | |||
19 | FILES:${PN} += "/linuxrc /fat" | 21 | FILES:${PN} += "/linuxrc /fat" |
20 | 22 | ||
21 | COMPATIBLE_MACHINE = "(imx-generic-bsp)" | 23 | COMPATIBLE_MACHINE = "(imx-generic-bsp)" |
diff --git a/recipes-bsp/isp-imx/isp-imx/0001-cpp-netlib-parsers.ipp-add-missing-include.patch b/recipes-bsp/isp-imx/isp-imx/0001-cpp-netlib-parsers.ipp-add-missing-include.patch deleted file mode 100644 index 3f04000c..00000000 --- a/recipes-bsp/isp-imx/isp-imx/0001-cpp-netlib-parsers.ipp-add-missing-include.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | From 15aae364fb52df30e4a49e73e2048fdc633e6868 Mon Sep 17 00:00:00 2001 | ||
2 | From: Max Krummenacher <max.krummenacher@toradex.com> | ||
3 | Date: Sun, 8 Oct 2023 09:15:54 -0300 | ||
4 | Subject: [PATCH] cpp-netlib: parsers.ipp: add missing include | ||
5 | |||
6 | With the update to boost from 1.82.0 -> 1.83.0 we now get compiler errors: | ||
7 | |||
8 | | .../isp-imx/4.2.2.22.0/isp-imx-4.2.2.22.0/utils3rd/3rd/cpp-netlib/boost/network/protocol/http/server/impl/parsers.ipp:58:3: error: 'u8_to_u32_iterator' was not declared in this scope | ||
9 | |||
10 | Add the missing explicit include. Before the file was indirectly included from qi.hpp: | ||
11 | |||
12 | | In file included from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/regex/pending/unicode_iterator.hpp:27, | ||
13 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/support/utf8.hpp:15, | ||
14 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/support/info.hpp:17, | ||
15 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/qi/domain.hpp:16, | ||
16 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/qi/meta_compiler.hpp:15, | ||
17 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/qi/action/action.hpp:14, | ||
18 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/qi/action.hpp:14, | ||
19 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/home/qi.hpp:14, | ||
20 | | from .../isp-imx/4.2.2.22.0/recipe-sysroot/usr/include/boost/spirit/include/qi.hpp:16, | ||
21 | | from .../isp-imx/4.2.2.22.0/isp-imx-4.2.2.22.0/utils3rd/3rd/cpp-netlib/boost/network/protocol/http/server/impl/parsers.ipp:5, | ||
22 | |||
23 | Upstream-Status: Pending | ||
24 | |||
25 | Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> | ||
26 | --- | ||
27 | .../boost/network/protocol/http/server/impl/parsers.ipp | 1 + | ||
28 | 1 file changed, 1 insertion(+) | ||
29 | |||
30 | diff --git a/utils3rd/3rd/cpp-netlib/boost/network/protocol/http/server/impl/parsers.ipp b/utils3rd/3rd/cpp-netlib/boost/network/protocol/http/server/impl/parsers.ipp | ||
31 | index c31e60e..2b83fbe 100755 | ||
32 | --- a/utils3rd/3rd/cpp-netlib/boost/network/protocol/http/server/impl/parsers.ipp | ||
33 | +++ b/utils3rd/3rd/cpp-netlib/boost/network/protocol/http/server/impl/parsers.ipp | ||
34 | @@ -13,6 +13,7 @@ | ||
35 | #include <tuple> | ||
36 | #include <boost/fusion/include/std_tuple.hpp> | ||
37 | #include <boost/network/protocol/http/message/header.hpp> | ||
38 | +#include <boost/regex/pending/unicode_iterator.hpp> | ||
39 | |||
40 | #ifdef BOOST_NETWORK_NO_LIB | ||
41 | #ifndef BOOST_NETWORK_INLINE | ||
42 | -- | ||
43 | 2.35.3 | ||
44 | |||
diff --git a/recipes-bsp/isp-imx/isp-imx_4.2.2.24.0.bb b/recipes-bsp/isp-imx/isp-imx_4.2.2.24.0.bb deleted file mode 100644 index 9e0f0265..00000000 --- a/recipes-bsp/isp-imx/isp-imx_4.2.2.24.0.bb +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | # Copyright 2020-2023 NXP | ||
2 | |||
3 | DESCRIPTION = "i.MX Verisilicon Software ISP" | ||
4 | LICENSE = "Proprietary" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=2827219e81f28aba7c6a569f7c437fa7" | ||
6 | DEPENDS = "boost libdrm virtual/libg2d libtinyxml2 patchelf-native" | ||
7 | |||
8 | SRC_URI = " \ | ||
9 | ${FSL_MIRROR}/${BP}.bin;fsl-eula=true \ | ||
10 | file://0001-cpp-netlib-parsers.ipp-add-missing-include.patch \ | ||
11 | " | ||
12 | |||
13 | SRC_URI[sha256sum] = "34b23f5b9f0856a8f5722e339a7ad4ccf4d99614788598306ff8b20093c1e846" | ||
14 | |||
15 | inherit fsl-eula-unpack cmake systemd use-imx-headers | ||
16 | |||
17 | # Build the sub-folder appshell | ||
18 | OECMAKE_SOURCEPATH = "${S}/appshell" | ||
19 | |||
20 | # Use make instead of ninja | ||
21 | OECMAKE_GENERATOR = "Unix Makefiles" | ||
22 | |||
23 | # Workaround for linking issues seen with gold linker | ||
24 | LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" | ||
25 | |||
26 | SYSTEMD_SERVICE:${PN} = "imx8-isp.service" | ||
27 | |||
28 | EXTRA_OECMAKE += " \ | ||
29 | -DSDKTARGETSYSROOT=${STAGING_DIR_HOST} \ | ||
30 | -DCMAKE_BUILD_TYPE=release \ | ||
31 | -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ | ||
32 | -DCMAKE_INSTALL_LIBDIR=${libdir} \ | ||
33 | -DISP_VERSION=ISP8000NANO_V1802 \ | ||
34 | -DPLATFORM=ARM64 \ | ||
35 | -DAPPMODE=V4L2 \ | ||
36 | -DTUNINGEXT=1 \ | ||
37 | -DQTLESS=1 \ | ||
38 | -DFULL_SRC_COMPILE=1 \ | ||
39 | -DWITH_DRM=1 \ | ||
40 | -DWITH_DWE=1 \ | ||
41 | -DSERVER_LESS=1 \ | ||
42 | -DSUBDEV_V4L2=1 \ | ||
43 | -DENABLE_IRQ=1 \ | ||
44 | -DPARTITION_BUILD=0 \ | ||
45 | -D3A_SRC_BUILD=0 \ | ||
46 | -DIMX_G2D=ON \ | ||
47 | -Wno-dev \ | ||
48 | " | ||
49 | |||
50 | do_configure:prepend () { | ||
51 | # FIXME: Should be rebuild. | ||
52 | patchelf --replace-needed libtinyxml2.so.9 libtinyxml2.so.10 ${S}/units/cam_device/proprietories/lib/libcam_device.so | ||
53 | patchelf --replace-needed libtinyxml2.so.9 libtinyxml2.so.10 ${S}/mediacontrol/lib/arm-64/fpga/libcam_device.so | ||
54 | } | ||
55 | |||
56 | do_install() { | ||
57 | # FIXME: provided by the basler-camera package, do not install them here additionally | ||
58 | rm -f ${S}/dewarp/dewarp_config//daA3840_30mc*.json | ||
59 | |||
60 | install -d ${D}/${libdir} | ||
61 | install -d ${D}/${includedir} | ||
62 | install -d ${D}/opt/imx8-isp/bin | ||
63 | install -d ${D}/opt/imx8-isp/bin/dewarp_config | ||
64 | |||
65 | cp -r ${B}/generated/release/bin/*_test ${D}/opt/imx8-isp/bin | ||
66 | cp -r ${B}/generated/release/bin/*.xml ${D}/opt/imx8-isp/bin | ||
67 | cp -r ${B}/generated/release/bin/*.drv ${D}/opt/imx8-isp/bin | ||
68 | cp -r ${B}/generated/release/bin/tuningext ${D}/opt/imx8-isp/bin | ||
69 | cp -r ${B}/generated/release/bin/isp_media_server ${D}/opt/imx8-isp/bin | ||
70 | cp -r ${B}/generated/release/bin/vvext ${D}/opt/imx8-isp/bin | ||
71 | |||
72 | cp -r ${B}/generated/release/lib/*.so* ${D}/${libdir} | ||
73 | cp -r ${B}/generated/release/include/* ${D}/${includedir} | ||
74 | |||
75 | cp -r ${S}/dewarp/dewarp_config/ ${D}/opt/imx8-isp/bin | ||
76 | cp ${S}/imx/run.sh ${D}/opt/imx8-isp/bin | ||
77 | cp ${S}/imx/start_isp.sh ${D}/opt/imx8-isp/bin | ||
78 | |||
79 | chmod +x ${D}/opt/imx8-isp/bin/run.sh | ||
80 | chmod +x ${D}/opt/imx8-isp/bin/start_isp.sh | ||
81 | |||
82 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
83 | install -d ${D}${systemd_system_unitdir} | ||
84 | install -m 0644 ${S}/imx/imx8-isp.service ${D}${systemd_system_unitdir} | ||
85 | fi | ||
86 | } | ||
87 | |||
88 | # The build contains a mix of versioned and unversioned libraries, so | ||
89 | # the default packaging configuration needs some modification so that | ||
90 | # unversioned .so libraries go to the main package and versioned .so | ||
91 | # symlinks go to -dev. | ||
92 | FILES_SOLIBSDEV = "" | ||
93 | FILES:${PN} += "/opt ${libdir}/lib*${SOLIBSDEV}" | ||
94 | FILES:${PN}-dev += "${FILES_SOLIBS_VERSIONED}" | ||
95 | FILES_SOLIBS_VERSIONED = " \ | ||
96 | ${libdir}/libcppnetlib-client-connections.so \ | ||
97 | ${libdir}/libcppnetlib-server-parsers.so \ | ||
98 | ${libdir}/libcppnetlib-uri.so \ | ||
99 | ${libdir}/libjsoncpp.so \ | ||
100 | ${libdir}/libos08a20.so \ | ||
101 | " | ||
102 | |||
103 | RDEPENDS:${PN} = "libdrm" | ||
104 | |||
105 | COMPATIBLE_MACHINE = "(mx8mp-nxp-bsp)" | ||
diff --git a/recipes-bsp/isp-imx/isp-imx_4.2.2.24.4.bb b/recipes-bsp/isp-imx/isp-imx_4.2.2.24.4.bb new file mode 100644 index 00000000..8694489b --- /dev/null +++ b/recipes-bsp/isp-imx/isp-imx_4.2.2.24.4.bb | |||
@@ -0,0 +1,95 @@ | |||
1 | # Copyright 2020-2023 NXP | ||
2 | |||
3 | DESCRIPTION = "i.MX Verisilicon Software ISP" | ||
4 | LICENSE = "Proprietary" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837" | ||
6 | DEPENDS = "boost libdrm virtual/libg2d libtinyxml2 jsoncpp patchelf-native" | ||
7 | |||
8 | SRC_URI = " \ | ||
9 | ${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true \ | ||
10 | " | ||
11 | IMX_SRCREV_ABBREV = "8527c7b" | ||
12 | S = "${WORKDIR}/${BP}-${IMX_SRCREV_ABBREV}" | ||
13 | |||
14 | SRC_URI[sha256sum] = "481e49e9da6d7783d6c28385bb68463eac7b9e9fef6ea958950260a8ad6b1e4c" | ||
15 | |||
16 | inherit fsl-eula-unpack cmake systemd use-imx-headers | ||
17 | |||
18 | PACKAGECONFIG = "" | ||
19 | # Note: building with tuningext fails with boost 1.87. | ||
20 | # (update to 1.87 with walnascar) | ||
21 | PACKAGECONFIG[tuningext] = "-DTUNINGEXT=1,-DTUNINGEXT=0" | ||
22 | |||
23 | # Build the sub-folder appshell | ||
24 | OECMAKE_SOURCEPATH = "${S}/appshell" | ||
25 | |||
26 | # Use make instead of ninja | ||
27 | OECMAKE_GENERATOR = "Unix Makefiles" | ||
28 | |||
29 | # Workaround for linking issues seen with gold linker | ||
30 | LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" | ||
31 | |||
32 | SYSTEMD_SERVICE:${PN} = "imx8-isp.service" | ||
33 | |||
34 | EXTRA_OECMAKE += " \ | ||
35 | -DSDKTARGETSYSROOT=${STAGING_DIR_HOST} \ | ||
36 | -DCMAKE_BUILD_TYPE=release \ | ||
37 | -DISP_VERSION=ISP8000NANO_V1802 \ | ||
38 | -DPLATFORM=ARM64 \ | ||
39 | -DQTLESS=1 \ | ||
40 | -DFULL_SRC_COMPILE=1 \ | ||
41 | -DWITH_DRM=1 \ | ||
42 | -DWITH_DWE=1 \ | ||
43 | -DSUBDEV_V4L2=1 \ | ||
44 | -DPARTITION_BUILD=0 \ | ||
45 | -D3A_SRC_BUILD=0 \ | ||
46 | -DIMX_G2D=ON \ | ||
47 | -Wno-dev \ | ||
48 | " | ||
49 | |||
50 | do_configure:prepend () { | ||
51 | # FIXME: should be rebuild. | ||
52 | patchelf --replace-needed libjsoncpp.so.25 libjsoncpp.so.26 ${S}/mediacontrol/install/bin/isp_media_server | ||
53 | patchelf --replace-needed libjsoncpp.so.25 libjsoncpp.so.26 ${S}/mediacontrol/install/lib/libmedia_server.so | ||
54 | patchelf --replace-needed libjsoncpp.so.25 libjsoncpp.so.26 ${S}/tuningext/install/tuningext | ||
55 | } | ||
56 | |||
57 | do_install() { | ||
58 | # FIXME: provided by the basler-camera package, do not install them here additionally | ||
59 | rm -f ${S}/dewarp/dewarp_config//daA3840_30mc*.json | ||
60 | |||
61 | # The Makefile unconditionally installs tuningext even if it is not built | ||
62 | if ${@bb.utils.contains('PACKAGECONFIG','tuningext','false','true',d)}; then | ||
63 | touch ${B}/generated/release/bin/tuningext | ||
64 | fi | ||
65 | |||
66 | oe_runmake -f ${S}/Makefile install INSTALL_DIR=${D} SOURCE_DIR=${S} | ||
67 | |||
68 | if ${@bb.utils.contains('PACKAGECONFIG','tuningext','false','true',d)}; then | ||
69 | rm ${D}/opt/imx8-isp/bin/tuningext | ||
70 | fi | ||
71 | |||
72 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
73 | install -d ${D}${systemd_system_unitdir} | ||
74 | install -m 0644 ${S}/imx/imx8-isp.service ${D}${systemd_system_unitdir} | ||
75 | fi | ||
76 | |||
77 | } | ||
78 | |||
79 | # The build contains a mix of versioned and unversioned libraries, so | ||
80 | # the default packaging configuration needs some modification so that | ||
81 | # unversioned .so libraries go to the main package and versioned .so | ||
82 | # symlinks go to -dev. | ||
83 | FILES_SOLIBSDEV = "" | ||
84 | FILES:${PN} += "/opt ${libdir}/lib*${SOLIBSDEV}" | ||
85 | FILES:${PN}-dev += "${FILES_SOLIBS_VERSIONED}" | ||
86 | FILES_SOLIBS_VERSIONED = " \ | ||
87 | ${libdir}/libcppnetlib-client-connections.so \ | ||
88 | ${libdir}/libcppnetlib-server-parsers.so \ | ||
89 | ${libdir}/libcppnetlib-uri.so \ | ||
90 | ${libdir}/libos08a20.so \ | ||
91 | " | ||
92 | |||
93 | RDEPENDS:${PN} = "libdrm" | ||
94 | |||
95 | COMPATIBLE_MACHINE = "(mx8mp-nxp-bsp)" | ||
diff --git a/recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc b/recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc index f6262324..13402850 100644 --- a/recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc +++ b/recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc | |||
@@ -14,6 +14,7 @@ SRCREV = "aa4bc52d08c342df83e3c576e2c108d7c8816e0e" | |||
14 | SRCBRANCH = "2025.01+fslc" | 14 | SRCBRANCH = "2025.01+fslc" |
15 | 15 | ||
16 | PV = "2025.01+fslc+git${SRCPV}" | 16 | PV = "2025.01+fslc+git${SRCPV}" |
17 | CVE_PRODUCT = "denx:u-boot" | ||
17 | 18 | ||
18 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
19 | B = "${WORKDIR}/build" | 20 | B = "${WORKDIR}/build" |
diff --git a/recipes-bsp/u-boot/u-boot-imx-common_2024.04.inc b/recipes-bsp/u-boot/u-boot-imx-common_2024.04.inc index f4e78c6c..39ac4135 100644 --- a/recipes-bsp/u-boot/u-boot-imx-common_2024.04.inc +++ b/recipes-bsp/u-boot/u-boot-imx-common_2024.04.inc | |||
@@ -7,6 +7,7 @@ SRC_URI = "git://github.com/nxp-imx/uboot-imx.git;protocol=https;branch=${SRCBRA | |||
7 | SRCBRANCH = "lf_v2024.04" | 7 | SRCBRANCH = "lf_v2024.04" |
8 | LOCALVERSION ?= "-imx_v2024.04_6.6.52-2.2.0" | 8 | LOCALVERSION ?= "-imx_v2024.04_6.6.52-2.2.0" |
9 | SRCREV = "6c4545203d123c246c5d7995f2893959506d28e0" | 9 | SRCREV = "6c4545203d123c246c5d7995f2893959506d28e0" |
10 | CVE_PRODUCT = "nxp:uboot_secondary_program_loader denx:u-boot" | ||
10 | 11 | ||
11 | DEPENDS += " \ | 12 | DEPENDS += " \ |
12 | bc-native \ | 13 | bc-native \ |
diff --git a/recipes-fsl/mcore-demos/README b/recipes-fsl/mcore-demos/README index 0023bb26..addd1c37 100644 --- a/recipes-fsl/mcore-demos/README +++ b/recipes-fsl/mcore-demos/README | |||
@@ -5,7 +5,7 @@ The M4 demo app version of each SoCs are followed: | |||
5 | 5 | ||
6 | The M7 demo app version of each SoCs are followed: | 6 | The M7 demo app version of each SoCs are followed: |
7 | * 2.16.000 -- i.MX 8MP , 8MNULite, 8MN | 7 | * 2.16.000 -- i.MX 8MP , 8MNULite, 8MN |
8 | * 2.16.001 -- i.MX95 | 8 | * 24.12.00 -- i.MX95 |
9 | 9 | ||
10 | The M33 demo app version of each SoCs are followed: | 10 | The M33 demo app version of each SoCs are followed: |
11 | * 2.16.000 -- i.MX 8ULP, i.MX 93 | 11 | * 2.16.000 -- i.MX 8ULP, i.MX 93 |
diff --git a/recipes-fsl/mcore-demos/imx-m4-demos_1.0.1.bb b/recipes-fsl/mcore-demos/imx-m4-demos_1.0.1.bb index 78a837af..6791553b 100644 --- a/recipes-fsl/mcore-demos/imx-m4-demos_1.0.1.bb +++ b/recipes-fsl/mcore-demos/imx-m4-demos_1.0.1.bb | |||
@@ -1,27 +1,13 @@ | |||
1 | SUMMARY = "i.MX M4 core Demo images" | 1 | # Copyright 2017-2021 NXP |
2 | SECTION = "app" | 2 | # Released under the MIT license (see COPYING.MIT for the terms) |
3 | LICENSE = "Proprietary" | ||
4 | LIC_FILES_CHKSUM:mx7d-nxp-bsp = "file://COPYING;md5=8cf95184c220e247b9917e7244124c5a" | ||
5 | 3 | ||
6 | inherit deploy fsl-eula-unpack | 4 | require imx-mcore-demos.inc |
7 | 5 | ||
8 | M4_SOC ?= "INVALID" | 6 | LIC_FILES_CHKSUM:mx7d-nxp-bsp = "file://COPYING;md5=8cf95184c220e247b9917e7244124c5a" |
9 | M4_SOC:mx7d-nxp-bsp = "imx7d-sabresd" | ||
10 | 7 | ||
11 | SRC_URI = "${FSL_MIRROR}/${M4_SOC}-m4-freertos-${PV}.bin;fsl-eula=true" | 8 | SRC_URI = "${FSL_MIRROR}/${SOC}-m4-freertos-${PV}.bin;fsl-eula=true" |
12 | S = "${WORKDIR}/${M4_SOC}-m4-freertos-${PV}" | 9 | S = "${WORKDIR}/${SOC}-m4-freertos-${PV}" |
13 | 10 | ||
14 | SRC_URI[sha256sum] = "cc00d3b936d49b2794a2a99e10129437e70caba3fd26b8379b8c50dd22f73254" | 11 | SRC_URI[sha256sum] = "cc00d3b936d49b2794a2a99e10129437e70caba3fd26b8379b8c50dd22f73254" |
15 | 12 | ||
16 | do_deploy () { | ||
17 | # Install the demo binaries | ||
18 | install -d ${DEPLOYDIR} | ||
19 | cp ${S}/*.bin ${DEPLOYDIR}/ | ||
20 | ls ${DEPLOYDIR}/ | ||
21 | } | ||
22 | |||
23 | addtask deploy before do_build after do_compile | ||
24 | |||
25 | PACKAGE_ARCH = "${MACHINE_SOCARCH}" | ||
26 | COMPATIBLE_MACHINE = "(mx7d-nxp-bsp)" | 13 | COMPATIBLE_MACHINE = "(mx7d-nxp-bsp)" |
27 | |||
diff --git a/recipes-fsl/mcore-demos/imx-m7-demos_2.16.001.bb b/recipes-fsl/mcore-demos/imx-m7-demos_24.12.00.bb index 56ddbf80..17d90903 100644 --- a/recipes-fsl/mcore-demos/imx-m7-demos_2.16.001.bb +++ b/recipes-fsl/mcore-demos/imx-m7-demos_24.12.00.bb | |||
@@ -5,6 +5,6 @@ require imx-mcore-demos.inc | |||
5 | 5 | ||
6 | LIC_FILES_CHKSUM:mx95-nxp-bsp = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837" | 6 | LIC_FILES_CHKSUM:mx95-nxp-bsp = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837" |
7 | 7 | ||
8 | SRC_URI[imx95.sha256sum] = "0569f128e2068c509dcd4afe6689a62cdb5a4ac9f8eb1b522b2bfaac0e7d09fd" | 8 | SRC_URI[imx95.sha256sum] = "01603b53fd01181631b71f5139a4a3e215f7e03cc531638ef4fa805a678ede3d" |
9 | 9 | ||
10 | COMPATIBLE_MACHINE = "(mx95-nxp-bsp)" | 10 | COMPATIBLE_MACHINE = "(mx95-nxp-bsp)" |
diff --git a/recipes-fsl/mcore-demos/imx-mcore-demos.inc b/recipes-fsl/mcore-demos/imx-mcore-demos.inc index 11621752..b8e74710 100644 --- a/recipes-fsl/mcore-demos/imx-mcore-demos.inc +++ b/recipes-fsl/mcore-demos/imx-mcore-demos.inc | |||
@@ -9,6 +9,7 @@ inherit deploy fsl-eula-unpack | |||
9 | 9 | ||
10 | SOC ?= "INVALID" | 10 | SOC ?= "INVALID" |
11 | SOC:mx7ulp-nxp-bsp = "imx7ulp" | 11 | SOC:mx7ulp-nxp-bsp = "imx7ulp" |
12 | SOC:mx7d-nxp-bsp = "imx7d-sabresd" | ||
12 | SOC:mx8dxl-nxp-bsp = "imx8dxl" | 13 | SOC:mx8dxl-nxp-bsp = "imx8dxl" |
13 | SOC:mx8mm-nxp-bsp = "imx8mm" | 14 | SOC:mx8mm-nxp-bsp = "imx8mm" |
14 | SOC:mx8mn-nxp-bsp = "imx8mn" | 15 | SOC:mx8mn-nxp-bsp = "imx8mn" |
@@ -32,26 +33,27 @@ MCORE_TYPE:mx8ulp-nxp-bsp = "m33" | |||
32 | MCORE_TYPE:mx93-nxp-bsp = "m33" | 33 | MCORE_TYPE:mx93-nxp-bsp = "m33" |
33 | MCORE_TYPE:mx95-nxp-bsp = "m7" | 34 | MCORE_TYPE:mx95-nxp-bsp = "m7" |
34 | 35 | ||
35 | SRC_URI = "${FSL_MIRROR}${SOC}-${MCORE_TYPE}-demo-${PV}.bin;name=${SOC};fsl-eula=true" | 36 | SRC_URI = "${FSL_MIRROR}/${SOC}-${MCORE_TYPE}-demo-${PV}.bin;name=${SOC};fsl-eula=true" |
36 | 37 | ||
37 | S = "${WORKDIR}/${SOC}-${MCORE_TYPE}-demo-${PV}" | 38 | S = "${WORKDIR}/${SOC}-${MCORE_TYPE}-demo-${PV}" |
38 | 39 | ||
39 | #SRC_URI="https://www.nxp.com/lgfiles/NMG/MAD/YOCTO//imx93-m33-demo-2.14.0.bin;fsl-eula=true;name=imx93" | ||
40 | |||
41 | |||
42 | SCR = "SCR-${SOC}-${MCORE_TYPE}-demo.txt" | 40 | SCR = "SCR-${SOC}-${MCORE_TYPE}-demo.txt" |
43 | 41 | ||
42 | MCORE_DEMO_FILE_EXTENSION ?= "bin" | ||
43 | MCORE_DEMO_FILE_EXTENSION:mx7ulp-nxp-bsp = "img" | ||
44 | |||
44 | do_install () { | 45 | do_install () { |
45 | install -d ${D}${nonarch_base_libdir}/firmware | 46 | install -d ${D}${nonarch_base_libdir}/firmware |
46 | install -m 0644 ${S}/*.elf ${D}${nonarch_base_libdir}/firmware | 47 | if ls ${S}/*.elf > /dev/null 2>&1; then |
48 | install -m 0644 ${S}/*.elf ${D}${nonarch_base_libdir}/firmware | ||
49 | fi | ||
50 | install -m 0644 ${S}/*.${MCORE_DEMO_FILE_EXTENSION} ${D}${nonarch_base_libdir}/firmware | ||
47 | } | 51 | } |
48 | 52 | ||
49 | DEPLOY_FILE_EXT ?= "bin" | ||
50 | DEPLOY_FILE_EXT:mx7ulp-nxp-bsp = "img" | ||
51 | |||
52 | do_deploy () { | 53 | do_deploy () { |
53 | # Install the demo binaries | 54 | # Install the demo binaries |
54 | install -m 0644 ${S}/*.${DEPLOY_FILE_EXT} ${DEPLOYDIR}/ | 55 | install -d ${DEPLOYDIR}/mcore-demos |
56 | install -m 0644 ${S}/*.${MCORE_DEMO_FILE_EXTENSION} ${DEPLOYDIR}/mcore-demos/ | ||
55 | } | 57 | } |
56 | 58 | ||
57 | addtask deploy after do_install | 59 | addtask deploy after do_install |
diff --git a/recipes-fsl/packagegroups/packagegroup-fsl-isp.bb b/recipes-fsl/packagegroups/packagegroup-fsl-isp.bb index 415587a8..09eac053 100644 --- a/recipes-fsl/packagegroups/packagegroup-fsl-isp.bb +++ b/recipes-fsl/packagegroups/packagegroup-fsl-isp.bb | |||
@@ -8,7 +8,6 @@ ISP_PKGS ?= "" | |||
8 | ISP_PKGS:mx8mp-nxp-bsp = " \ | 8 | ISP_PKGS:mx8mp-nxp-bsp = " \ |
9 | isp-imx \ | 9 | isp-imx \ |
10 | basler-camera \ | 10 | basler-camera \ |
11 | basler-camera-dev \ | ||
12 | kernel-module-isp-vvcam \ | 11 | kernel-module-isp-vvcam \ |
13 | " | 12 | " |
14 | RDEPENDS:${PN} = " \ | 13 | RDEPENDS:${PN} = " \ |
diff --git a/recipes-multimedia/alsa/imx-alsa-plugins_git.bb b/recipes-multimedia/alsa/imx-alsa-plugins_git.bb index d1eec405..7b17ccb0 100644 --- a/recipes-multimedia/alsa/imx-alsa-plugins_git.bb +++ b/recipes-multimedia/alsa/imx-alsa-plugins_git.bb | |||
@@ -20,7 +20,7 @@ inherit autotools pkgconfig use-imx-headers | |||
20 | PV = "1.0.26+${SRCPV}" | 20 | PV = "1.0.26+${SRCPV}" |
21 | 21 | ||
22 | SRC_URI = "git://github.com/nxp-imx/imx-alsa-plugins.git;protocol=https;branch=${SRCBRANCH}" | 22 | SRC_URI = "git://github.com/nxp-imx/imx-alsa-plugins.git;protocol=https;branch=${SRCBRANCH}" |
23 | SRCBRANCH = "MM_04.09.01_2408_L6.6.y" | 23 | SRCBRANCH = "MM_04.09.02_2410_L6.6.y" |
24 | SRCREV = "b2ba082e70333f187972ee4e85f63f9d2f608331" | 24 | SRCREV = "b2ba082e70333f187972ee4e85f63f9d2f608331" |
25 | 25 | ||
26 | S = "${WORKDIR}/git" | 26 | S = "${WORKDIR}/git" |
diff --git a/recipes-multimedia/imx-dsp/imx-dsp_2.1.8.bb b/recipes-multimedia/imx-dsp/imx-dsp_2.1.9.bb index e1cf0877..73321ddc 100644 --- a/recipes-multimedia/imx-dsp/imx-dsp_2.1.8.bb +++ b/recipes-multimedia/imx-dsp/imx-dsp_2.1.9.bb | |||
@@ -1,15 +1,17 @@ | |||
1 | # Copyright 2017-2023 NXP | 1 | # Copyright 2017-2022,2024 NXP |
2 | 2 | ||
3 | DESCRIPTION = "i.MX DSP Wrapper, Firmware Binary, Codec Libraries" | 3 | DESCRIPTION = "i.MX DSP Wrapper, Firmware Binary, Codec Libraries" |
4 | LICENSE = "Proprietary" | 4 | LICENSE = "Proprietary" |
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=10c0fda810c63b052409b15a5445671a" | 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837" |
6 | |||
7 | 6 | ||
8 | inherit fsl-eula-unpack autotools pkgconfig | 7 | inherit fsl-eula-unpack autotools pkgconfig |
9 | 8 | ||
10 | SRC_URI = "${FSL_MIRROR}/${BP}.bin;fsl-eula=true" | 9 | IMX_SRCREV_ABBREV = "a3074e2" |
10 | SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" | ||
11 | |||
12 | S = "${WORKDIR}/${BP}-${IMX_SRCREV_ABBREV}" | ||
11 | 13 | ||
12 | SRC_URI[sha256sum] = "5d42c8f39fb36bcc48e9f0c4caffd125b89c257fa8eccb3b61608bc690a16462" | 14 | SRC_URI[sha256sum] = "1f763c21f20abfbb013a0d1acb5846fec55241e9fa8c8aae47fd95b007d800fe" |
13 | 15 | ||
14 | EXTRA_OECONF = " \ | 16 | EXTRA_OECONF = " \ |
15 | -datadir=${base_libdir}/firmware \ | 17 | -datadir=${base_libdir}/firmware \ |
diff --git a/recipes-multimedia/imx-opencl-converter/imx-opencl-converter_0.5.0.bb b/recipes-multimedia/imx-opencl-converter/imx-opencl-converter_0.6.0.bb index 6b9ad815..7f0c2256 100644 --- a/recipes-multimedia/imx-opencl-converter/imx-opencl-converter_0.5.0.bb +++ b/recipes-multimedia/imx-opencl-converter/imx-opencl-converter_0.6.0.bb | |||
@@ -6,9 +6,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837" | |||
6 | DEPENDS = "virtual/opencl-icd" | 6 | DEPENDS = "virtual/opencl-icd" |
7 | 7 | ||
8 | SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" | 8 | SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" |
9 | IMX_SRCREV_ABBREV = "f2c3930" | 9 | IMX_SRCREV_ABBREV = "605ef75" |
10 | 10 | ||
11 | SRC_URI[sha256sum] = "eb3df72a7e1d16ec1660978cf36b7818b8ac7c7defe3222ae4bb7dabd4a5f4cc" | 11 | SRC_URI[sha256sum] = "777f49805d5455ebc27e63d19552e2924174011d2ae7d9b392febfa8794d4dc6" |
12 | 12 | ||
13 | S = "${WORKDIR}/${BP}-${IMX_SRCREV_ABBREV}" | 13 | S = "${WORKDIR}/${BP}-${IMX_SRCREV_ABBREV}" |
14 | inherit fsl-eula-unpack autotools pkgconfig meson | 14 | inherit fsl-eula-unpack autotools pkgconfig meson |
diff --git a/recipes-multimedia/imx-parser/imx-parser_4.9.1.bb b/recipes-multimedia/imx-parser/imx-parser_4.9.2.bb index a4bb2333..78b48da0 100644 --- a/recipes-multimedia/imx-parser/imx-parser_4.9.1.bb +++ b/recipes-multimedia/imx-parser/imx-parser_4.9.2.bb | |||
@@ -14,10 +14,10 @@ RPROVIDES:${PN} = "libfslparser" | |||
14 | RCONFLICTS:${PN} = "libfslparser" | 14 | RCONFLICTS:${PN} = "libfslparser" |
15 | 15 | ||
16 | SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" | 16 | SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" |
17 | IMX_SRCREV_ABBREV = "5d91190" | 17 | IMX_SRCREV_ABBREV = "828fcb7" |
18 | S = "${WORKDIR}/${BP}-${IMX_SRCREV_ABBREV}" | 18 | S = "${WORKDIR}/${BP}-${IMX_SRCREV_ABBREV}" |
19 | 19 | ||
20 | SRC_URI[sha256sum] = "087badea414540d1b9403be1a0c7fc91ac42a61f0374857972cd06d8c392ddec" | 20 | SRC_URI[sha256sum] = "7414db9e2cce2cb2d6fe63ac7d193a0ea65ad8a184e6a2e2ce2785e43acbb339" |
21 | 21 | ||
22 | inherit fsl-eula-unpack autotools pkgconfig | 22 | inherit fsl-eula-unpack autotools pkgconfig |
23 | 23 | ||
diff --git a/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_VCencoder-add-sys-time.h-for-gett.patch b/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_VCencoder-add-sys-time.h-for-gett.patch deleted file mode 100644 index ab8b50de..00000000 --- a/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_VCencoder-add-sys-time.h-for-gett.patch +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | From a57daf8f58cf69be06de8ebc9eab3a3077143760 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hiago De Franco <hiago.franco@toradex.com> | ||
3 | Date: Fri, 26 Jul 2024 14:43:55 -0300 | ||
4 | Subject: [PATCH] vpu_wrapper_hantro_VCencoder: add sys/time.h for gettimeofday | ||
5 | |||
6 | Fixes: | ||
7 | | ../git/vpu_wrapper_hantro_VCencoder.c:1965:5: error: implicit declaration of function 'gettimeofday' [-Wimplicit-function-declaration] | ||
8 | | 1965 | gettimeofday (&pObj->tvBegin, NULL); | ||
9 | | | ^~~~~~~~~~~~ | ||
10 | |||
11 | Upstream-Status: Submitted [https://github.com/nxp-imx/imx-vpuwrap/pull/2] | ||
12 | Signed-off-by: Hiago De Franco <hiago.franco@toradex.com> | ||
13 | --- | ||
14 | vpu_wrapper_hantro_VCencoder.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/vpu_wrapper_hantro_VCencoder.c b/vpu_wrapper_hantro_VCencoder.c | ||
18 | index efae31a77ca4..6185cfc067d1 100755 | ||
19 | --- a/vpu_wrapper_hantro_VCencoder.c | ||
20 | +++ b/vpu_wrapper_hantro_VCencoder.c | ||
21 | @@ -17,6 +17,7 @@ | ||
22 | #include <stdio.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <string.h> | ||
25 | +#include <sys/time.h> | ||
26 | #include <time.h> | ||
27 | #include <math.h> | ||
28 | #include <fcntl.h> | ||
29 | -- | ||
30 | 2.39.2 | ||
31 | |||
diff --git a/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_encoder-add-sys-time.h-for-gettim.patch b/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_encoder-fix-missing-include.patch index cbf37417..74ea5206 100644 --- a/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_encoder-add-sys-time.h-for-gettim.patch +++ b/recipes-multimedia/imx-vpuwrap/imx-vpuwrap/0001-vpu_wrapper_hantro_encoder-fix-missing-include.patch | |||
@@ -1,10 +1,13 @@ | |||
1 | From 482c639a0da4b093cfc029009604e9653ced33c4 Mon Sep 17 00:00:00 2001 | 1 | From a3c2f61649afd05e4bab457370f0b32d7644505c Mon Sep 17 00:00:00 2001 |
2 | From: Max Krummenacher <max.krummenacher@toradex.com> | 2 | From: Max Krummenacher <max.krummenacher@toradex.com> |
3 | Date: Thu, 13 Jun 2024 07:15:12 +0000 | 3 | Date: Mon, 3 Mar 2025 08:24:51 +0000 |
4 | Subject: [PATCH] vpu_wrapper_hantro_encoder: add sys/time.h for gettimeofday | 4 | Subject: [PATCH] vpu_wrapper_hantro_encoder: fix missing include |
5 | 5 | ||
6 | Fixes: | 6 | gettimeofday is declared in sys/time.h. Add the include. |
7 | |||
8 | Fixes the build error: | ||
7 | | ../git/vpu_wrapper_hantro_encoder.c:953:3: error: implicit declaration of function 'gettimeofday' [-Wimplicit-function-declaration] | 9 | | ../git/vpu_wrapper_hantro_encoder.c:953:3: error: implicit declaration of function 'gettimeofday' [-Wimplicit-function-declaration] |
10 | | 953 | gettimeofday (&pObj->tvEnd, NULL); | ||
8 | 11 | ||
9 | Upstream-Status: Pending | 12 | Upstream-Status: Pending |
10 | Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> | 13 | Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> |
@@ -13,17 +16,17 @@ Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> | |||
13 | 1 file changed, 1 insertion(+) | 16 | 1 file changed, 1 insertion(+) |
14 | 17 | ||
15 | diff --git a/vpu_wrapper_hantro_encoder.c b/vpu_wrapper_hantro_encoder.c | 18 | diff --git a/vpu_wrapper_hantro_encoder.c b/vpu_wrapper_hantro_encoder.c |
16 | index 3819c389320c..635c98bf1f19 100755 | 19 | index 3819c389320c..a0bdb2f4f6c0 100755 |
17 | --- a/vpu_wrapper_hantro_encoder.c | 20 | --- a/vpu_wrapper_hantro_encoder.c |
18 | +++ b/vpu_wrapper_hantro_encoder.c | 21 | +++ b/vpu_wrapper_hantro_encoder.c |
19 | @@ -24,6 +24,7 @@ | 22 | @@ -25,6 +25,7 @@ |
20 | #include <stdlib.h> | ||
21 | #include <string.h> | 23 | #include <string.h> |
22 | #include <time.h> | 24 | #include <time.h> |
23 | +#include <sys/time.h> | ||
24 | #include <semaphore.h> | 25 | #include <semaphore.h> |
26 | +#include <sys/time.h> | ||
25 | 27 | ||
26 | #include "headers/OMX_Video.h" | 28 | #include "headers/OMX_Video.h" |
29 | #include "headers/OMX_VideoExt.h" | ||
27 | -- | 30 | -- |
28 | 2.42.0 | 31 | 2.42.0 |
29 | 32 | ||
diff --git a/recipes-multimedia/imx-vpuwrap/imx-vpuwrap_git.bb b/recipes-multimedia/imx-vpuwrap/imx-vpuwrap_git.bb index 2b737999..de9b0daf 100644 --- a/recipes-multimedia/imx-vpuwrap/imx-vpuwrap_git.bb +++ b/recipes-multimedia/imx-vpuwrap/imx-vpuwrap_git.bb | |||
@@ -12,11 +12,10 @@ DEPENDS:append:mx8mp-nxp-bsp = " imx-vpu-hantro-vc" | |||
12 | 12 | ||
13 | SRC_URI = " \ | 13 | SRC_URI = " \ |
14 | git://github.com/NXP/imx-vpuwrap.git;protocol=https;branch=${SRCBRANCH} \ | 14 | git://github.com/NXP/imx-vpuwrap.git;protocol=https;branch=${SRCBRANCH} \ |
15 | file://0001-vpu_wrapper_hantro_encoder-add-sys-time.h-for-gettim.patch \ | 15 | file://0001-vpu_wrapper_hantro_encoder-fix-missing-include.patch \ |
16 | file://0001-vpu_wrapper_hantro_VCencoder-add-sys-time.h-for-gett.patch \ | ||
17 | " | 16 | " |
18 | SRCBRANCH = "MM_04.09.01_2408_L6.6.y" | 17 | SRCBRANCH = "MM_04.09.02_2410_L6.6.y" |
19 | SRCREV = "c13069d239cae314adc3651df25b96afa46cb434" | 18 | SRCREV = "378e33989cf72d6c2eb57a585072ba9abe87c6ff" |
20 | 19 | ||
21 | S = "${WORKDIR}/git" | 20 | S = "${WORKDIR}/git" |
22 | 21 | ||
diff --git a/recipes-multimedia/tinycompress/tinycompress/0001-tinycompress-Add-id3-decoding.patch b/recipes-multimedia/tinycompress/tinycompress/0001-tinycompress-Add-id3-decoding.patch deleted file mode 100755 index 78ff6989..00000000 --- a/recipes-multimedia/tinycompress/tinycompress/0001-tinycompress-Add-id3-decoding.patch +++ /dev/null | |||
@@ -1,1002 +0,0 @@ | |||
1 | From 16f6b7a5baec41f18fde75fd311fb988e3c31810 Mon Sep 17 00:00:00 2001 | ||
2 | From: Shengjiu Wang <shengjiu.wang@nxp.com> | ||
3 | Date: Fri, 13 Jul 2018 18:13:24 +0800 | ||
4 | Subject: [PATCH] tinycompress: Add id3 decoding | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> | ||
8 | --- | ||
9 | include/tinycompress/id3_tag_decode.h | 198 +++++++++++ | ||
10 | src/utils/Makefile.am | 2 +- | ||
11 | src/utils/cplay.c | 88 +++++ | ||
12 | src/utils/id3_tag_decode.c | 642 ++++++++++++++++++++++++++++++++++ | ||
13 | 4 files changed, 929 insertions(+), 1 deletion(-) | ||
14 | create mode 100644 include/tinycompress/id3_tag_decode.h | ||
15 | create mode 100644 src/utils/id3_tag_decode.c | ||
16 | |||
17 | diff --git a/include/tinycompress/id3_tag_decode.h b/include/tinycompress/id3_tag_decode.h | ||
18 | new file mode 100644 | ||
19 | index 0000000..1a911d7 | ||
20 | --- /dev/null | ||
21 | +++ b/include/tinycompress/id3_tag_decode.h | ||
22 | @@ -0,0 +1,198 @@ | ||
23 | +/* | ||
24 | + * Copyright (c) 2006-2017 Cadence Design Systems, Inc. | ||
25 | + * Copyright 2018 NXP | ||
26 | + * | ||
27 | + * Permission is hereby granted, free of charge, to any person obtaining | ||
28 | + * a copy of this software and associated documentation files (the | ||
29 | + * "Software"), to deal in the Software without restriction, including | ||
30 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
31 | + * distribute, sublicense, and/or sell copies of the Software, and to | ||
32 | + * permit persons to whom the Software is furnished to do so, subject to | ||
33 | + * the following conditions: | ||
34 | + * | ||
35 | + * The above copyright notice and this permission notice shall be included | ||
36 | + * in all copies or substantial portions of the Software. | ||
37 | + * | ||
38 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
39 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
40 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
41 | + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
42 | + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
43 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
44 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
45 | + */ | ||
46 | + | ||
47 | +/****************************************************************** | ||
48 | + * file name : id3_tag_decode.h | ||
49 | + * | ||
50 | + * description : stores typedefs of structures specific to MP3 tag | ||
51 | + * | ||
52 | + * revision history: | ||
53 | + * 29 04 2004 DK creation | ||
54 | + *****************************************************************/ | ||
55 | + | ||
56 | +#ifndef ID3_TAG_DECODE_H | ||
57 | +#define ID3_TAG_DECODE_H | ||
58 | + | ||
59 | +typedef signed char WORD8; | ||
60 | +typedef signed char * pWORD8; | ||
61 | +typedef unsigned char UWORD8; | ||
62 | +typedef unsigned char * pUWORD8; | ||
63 | + | ||
64 | +typedef signed short WORD16; | ||
65 | +typedef signed short * pWORD16; | ||
66 | +typedef unsigned short UWORD16; | ||
67 | +typedef unsigned short * pUWORD16; | ||
68 | + | ||
69 | +typedef signed int WORD24; | ||
70 | +typedef signed int * pWORD24; | ||
71 | +typedef unsigned int UWORD24; | ||
72 | +typedef unsigned int * pUWORD24; | ||
73 | + | ||
74 | +typedef signed int WORD32; | ||
75 | +typedef signed int * pWORD32; | ||
76 | +typedef unsigned int UWORD32; | ||
77 | +typedef unsigned int * pUWORD32; | ||
78 | + | ||
79 | +typedef void VOID; | ||
80 | +typedef void * pVOID; | ||
81 | + | ||
82 | +typedef signed int BOOL; | ||
83 | +typedef unsigned int UBOOL; | ||
84 | +typedef signed int FLAG; | ||
85 | +typedef unsigned int UFLAG; | ||
86 | +typedef signed int LOOPIDX; | ||
87 | +typedef unsigned int ULOOPIDX; | ||
88 | +typedef signed int WORD; | ||
89 | +typedef unsigned int UWORD; | ||
90 | + | ||
91 | +#define MAX_TAG_FRAME_SIZE 100 | ||
92 | + | ||
93 | +#define ID3V1 (0x544147) /* 0x544147 is TAG in WORD8 */ | ||
94 | + | ||
95 | +#define ID3V2 (0x494433) /* 0x494433 is ID3 in WORD8 */ | ||
96 | + | ||
97 | +/* | ||
98 | + * structure corresponding to ID3 tag v1 header. | ||
99 | + * this structure has all the field corresponding to ID3 tag v1 header. | ||
100 | + */ | ||
101 | + | ||
102 | +typedef struct { | ||
103 | + WORD32 tag; // 3 bytes | ||
104 | + | ||
105 | + WORD16 version; // 2 bytes | ||
106 | + | ||
107 | + WORD8 flag; //1 byte | ||
108 | + | ||
109 | + WORD32 size; //4 bytes | ||
110 | + | ||
111 | +} id3_v2_header_struct; | ||
112 | + | ||
113 | +/* structure which will store the frame data and | ||
114 | + * also put a limit max data to be stored | ||
115 | + */ | ||
116 | +typedef struct { | ||
117 | + WORD8 frame_data[MAX_TAG_FRAME_SIZE]; | ||
118 | + | ||
119 | + WORD32 max_size; //4 bytes | ||
120 | + | ||
121 | + WORD16 tag_present; | ||
122 | + | ||
123 | + WORD16 exceeds_buffer_size; | ||
124 | + | ||
125 | +} id3_v2_frame_struct; | ||
126 | + | ||
127 | +/* | ||
128 | + * structure corresponding to ID3 tag v2. | ||
129 | + * this structure has some of the field corresponding to ID3 tag v2. | ||
130 | + * if user wants to read some more tag information from | ||
131 | + * the MP3 file, he can add that field in this structure and pass address | ||
132 | + * of that element to get_inf function in id3_tag_decode.c under the | ||
133 | + * corresponding field frame header. few fields which are needed are already | ||
134 | + * populated by reading from the TAG header. | ||
135 | + */ | ||
136 | +typedef struct { | ||
137 | + id3_v2_frame_struct album_movie_show_title; | ||
138 | + | ||
139 | + id3_v2_frame_struct composer_name; | ||
140 | + | ||
141 | + id3_v2_frame_struct content_type; | ||
142 | + | ||
143 | + id3_v2_frame_struct encoded_by; | ||
144 | + | ||
145 | + id3_v2_frame_struct lyricist_text_writer; | ||
146 | + | ||
147 | + id3_v2_frame_struct content_group_description; | ||
148 | + | ||
149 | + id3_v2_frame_struct title_songname_content_description; | ||
150 | + | ||
151 | + id3_v2_frame_struct medxa_type; | ||
152 | + | ||
153 | + id3_v2_frame_struct original_album_movie_show_title; | ||
154 | + | ||
155 | + id3_v2_frame_struct original_filename; | ||
156 | + | ||
157 | + id3_v2_frame_struct original_lyricist_text_writer; | ||
158 | + | ||
159 | + id3_v2_frame_struct original_artist_performer; | ||
160 | + | ||
161 | + id3_v2_frame_struct file_owner_licensee; | ||
162 | + | ||
163 | + id3_v2_frame_struct lead_performer_soloist; | ||
164 | + | ||
165 | + id3_v2_frame_struct publisher; | ||
166 | + | ||
167 | + id3_v2_frame_struct private_frame; | ||
168 | + | ||
169 | + id3_v2_frame_struct other_info; | ||
170 | + | ||
171 | + id3_v2_header_struct id3_v2_header; | ||
172 | + | ||
173 | + WORD32 header_end; | ||
174 | + | ||
175 | + WORD32 bytes_consumed; | ||
176 | + | ||
177 | +} id3v2_struct; | ||
178 | + | ||
179 | +/* | ||
180 | + * structure corresponding to ID3 tag v1. | ||
181 | + * this structure has all the field corresponding to ID3 tag v1. | ||
182 | + */ | ||
183 | +typedef struct { | ||
184 | + WORD8 song_title[30]; //30 word8acters | ||
185 | + | ||
186 | + WORD8 artist[30]; //30 word8acters | ||
187 | + | ||
188 | + WORD8 album[30]; //30 word8acters | ||
189 | + | ||
190 | + WORD8 year[4]; //4 word8acters | ||
191 | + | ||
192 | + WORD8 comment[30]; //30 word8acters | ||
193 | + | ||
194 | + WORD8 genre[1]; //1 byte | ||
195 | + | ||
196 | +} id3v1_struct; | ||
197 | + | ||
198 | +WORD32 get_info(const char *inp_buffer, | ||
199 | + unsigned int avail_inp, | ||
200 | + WORD32 tag_size, | ||
201 | + id3_v2_frame_struct *dest); | ||
202 | + | ||
203 | +WORD32 search_id3_v2(UWORD8 *buffer); | ||
204 | + | ||
205 | +WORD32 decode_id3_v2(const char *const buffer, | ||
206 | + id3v2_struct *id3v2, | ||
207 | + WORD32 continue_flag, | ||
208 | + WORD32 insize); | ||
209 | + | ||
210 | +WORD32 get_id3_v2_bytes(UWORD8 *buffer); | ||
211 | + | ||
212 | +WORD32 get_v1_info(UWORD8 *buffer, id3v1_struct *id3v1); | ||
213 | + | ||
214 | +WORD32 search_id3_v1(UWORD8 *buffer); | ||
215 | + | ||
216 | +WORD32 decode_id3_v1(UWORD8 *buffer, id3v1_struct *id3v1); | ||
217 | + | ||
218 | +void init_id3v2_field(id3v2_struct *id3v2); | ||
219 | + | ||
220 | +#endif | ||
221 | diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am | ||
222 | index 1b996d4..e813689 100644 | ||
223 | --- a/src/utils/Makefile.am | ||
224 | +++ b/src/utils/Makefile.am | ||
225 | @@ -1,6 +1,6 @@ | ||
226 | bin_PROGRAMS = cplay crecord | ||
227 | |||
228 | -cplay_SOURCES = cplay.c | ||
229 | +cplay_SOURCES = cplay.c id3_tag_decode.c | ||
230 | crecord_SOURCES = crecord.c | ||
231 | |||
232 | cplay_CFLAGS = -I$(top_srcdir)/include | ||
233 | diff --git a/src/utils/cplay.c b/src/utils/cplay.c | ||
234 | index 87863a3..2a52b52 100644 | ||
235 | --- a/src/utils/cplay.c | ||
236 | +++ b/src/utils/cplay.c | ||
237 | @@ -72,6 +72,7 @@ | ||
238 | #include "sound/compress_params.h" | ||
239 | #include "tinycompress/tinycompress.h" | ||
240 | #include "tinycompress/tinymp3.h" | ||
241 | +#include "tinycompress/id3_tag_decode.h" | ||
242 | |||
243 | static int verbose; | ||
244 | static const unsigned int DEFAULT_CODEC_ID = SND_AUDIOCODEC_PCM; | ||
245 | @@ -245,12 +246,97 @@ int main(int argc, char **argv) | ||
246 | exit(EXIT_SUCCESS); | ||
247 | } | ||
248 | |||
249 | +void shift_buffer(char *buf, int buf_size, int bytes_consumed) | ||
250 | +{ | ||
251 | + int i; | ||
252 | + | ||
253 | + if (bytes_consumed <= 0) | ||
254 | + return; | ||
255 | + | ||
256 | + for (i = 0; i < buf_size - bytes_consumed; i++) | ||
257 | + buf[i] = buf[i + bytes_consumed]; | ||
258 | +} | ||
259 | + | ||
260 | +void parse_id3(FILE *file, int *offset) { | ||
261 | + /* ID3 tag specific declarations */ | ||
262 | + unsigned char id3_buf[128]; | ||
263 | + unsigned char id3v2_buf[4096]; | ||
264 | + signed int id3_v1_found = 0, id3_v1_decoded = 0; | ||
265 | + signed int id3_v2_found = 0, id3_v2_complete = 0; | ||
266 | + signed int i_bytes_consumed = 0; | ||
267 | + signed int i_fread_bytes; | ||
268 | + id3v1_struct id3v1; | ||
269 | + id3v2_struct id3v2; | ||
270 | + | ||
271 | + { | ||
272 | + fseek(file, -128, SEEK_END); | ||
273 | + fread(id3_buf, 1, 128, file); | ||
274 | + | ||
275 | + /* search for ID3V1 */ | ||
276 | + id3_v1_found = search_id3_v1(id3_buf + 0); | ||
277 | + if (id3_v1_found) { | ||
278 | + /* if ID3V1 is found, decode ID3V1 */ | ||
279 | + decode_id3_v1(id3_buf + 3, &id3v1); | ||
280 | + id3_v1_decoded = 1; | ||
281 | + } | ||
282 | + fseek(file, 0, SEEK_SET); | ||
283 | + } | ||
284 | + | ||
285 | + { | ||
286 | + signed int flag = 0; | ||
287 | + signed int continue_flag = 0; | ||
288 | + | ||
289 | + i_fread_bytes = fread(id3v2_buf, | ||
290 | + sizeof(char), 0x1000, file); | ||
291 | + | ||
292 | + /* search for ID3V2 */ | ||
293 | + id3_v2_found = | ||
294 | + search_id3_v2(id3v2_buf); | ||
295 | + | ||
296 | + if (id3_v2_found) { | ||
297 | + /* initialise the max fields */ | ||
298 | + init_id3v2_field(&id3v2); | ||
299 | + | ||
300 | + while (!id3_v2_complete && id3_v2_found) { | ||
301 | + /* if ID3V2 is found, decode ID3V2 */ | ||
302 | + id3_v2_complete = decode_id3_v2((const char *const)id3v2_buf, | ||
303 | + &id3v2, continue_flag, i_fread_bytes); | ||
304 | + | ||
305 | + if (!id3_v2_complete) { | ||
306 | + continue_flag = 1; | ||
307 | + i_bytes_consumed = id3v2.bytes_consumed; | ||
308 | + | ||
309 | + fseek(file, i_bytes_consumed, SEEK_SET); | ||
310 | + | ||
311 | + i_fread_bytes = fread(id3v2_buf, | ||
312 | + sizeof(unsigned char), 0x1000, file); | ||
313 | + if (i_fread_bytes <= 0) { | ||
314 | + return; | ||
315 | + } | ||
316 | + } | ||
317 | + } | ||
318 | + | ||
319 | + if (id3_v2_complete) { | ||
320 | + i_bytes_consumed = id3v2.bytes_consumed; | ||
321 | + fseek(file, i_bytes_consumed, SEEK_SET); | ||
322 | + } | ||
323 | + } | ||
324 | + } | ||
325 | + | ||
326 | + *offset = i_bytes_consumed; | ||
327 | +} | ||
328 | + | ||
329 | void get_codec_mp3(FILE *file, struct compr_config *config, | ||
330 | struct snd_codec *codec) | ||
331 | { | ||
332 | size_t read; | ||
333 | struct mp3_header header; | ||
334 | unsigned int channels, rate, bits; | ||
335 | + int offset = 0; | ||
336 | + | ||
337 | + parse_id3(file, &offset); | ||
338 | + | ||
339 | + fseek(file, offset, SEEK_SET); | ||
340 | |||
341 | read = fread(&header, 1, sizeof(header), file); | ||
342 | if (read != sizeof(header)) { | ||
343 | @@ -279,6 +365,8 @@ void get_codec_mp3(FILE *file, struct compr_config *config, | ||
344 | codec->level = 0; | ||
345 | codec->ch_mode = 0; | ||
346 | codec->format = 0; | ||
347 | + | ||
348 | + fseek(file, offset, SEEK_SET); | ||
349 | } | ||
350 | |||
351 | void get_codec_iec(FILE *file, struct compr_config *config, | ||
352 | diff --git a/src/utils/id3_tag_decode.c b/src/utils/id3_tag_decode.c | ||
353 | new file mode 100644 | ||
354 | index 0000000..393967a | ||
355 | --- /dev/null | ||
356 | +++ b/src/utils/id3_tag_decode.c | ||
357 | @@ -0,0 +1,642 @@ | ||
358 | +/* | ||
359 | + * Copyright (c) 2006-2017 Cadence Design Systems, Inc. | ||
360 | + * Copyright 2018 NXP | ||
361 | + * | ||
362 | + * Permission is hereby granted, free of charge, to any person obtaining | ||
363 | + * a copy of this software and associated documentation files (the | ||
364 | + * "Software"), to deal in the Software without restriction, including | ||
365 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
366 | + * distribute, sublicense, and/or sell copies of the Software, and to | ||
367 | + * permit persons to whom the Software is furnished to do so, subject to | ||
368 | + * the following conditions: | ||
369 | + * | ||
370 | + * The above copyright notice and this permission notice shall be included | ||
371 | + * in all copies or substantial portions of the Software. | ||
372 | + * | ||
373 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
374 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
375 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
376 | + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
377 | + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
378 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
379 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
380 | + */ | ||
381 | +#include <ctype.h> | ||
382 | +#include "tinycompress/id3_tag_decode.h" | ||
383 | + | ||
384 | +#define CHAR4(c1, c2, c3, c4) \ | ||
385 | + (int)(((unsigned char)(c1) << 24) | \ | ||
386 | + ((unsigned char)(c2) << 16) | \ | ||
387 | + ((unsigned char)(c3) << 8) | \ | ||
388 | + ((unsigned char)c4)) | ||
389 | + | ||
390 | +#ifndef MSVC_BUILD | ||
391 | +unsigned int umin(unsigned int a, unsigned int b) | ||
392 | +{ | ||
393 | + return (a < b ? a : b); | ||
394 | +} | ||
395 | + | ||
396 | +#else | ||
397 | +unsigned int umin(unsigned int a, unsigned int b) | ||
398 | +{ | ||
399 | + return (a < b ? a : b); | ||
400 | +} | ||
401 | +#endif | ||
402 | + | ||
403 | +/*********************************************************** | ||
404 | + * function name : display | ||
405 | + * | ||
406 | + * description : display ID3 tag contents. | ||
407 | + * | ||
408 | + * arguments : input parameters | ||
409 | + * | ||
410 | + * values returned : 0 | ||
411 | + ***********************************************************/ | ||
412 | + | ||
413 | +static void display2(const id3_v2_frame_struct * const src, | ||
414 | + int size, | ||
415 | + const char * const disp) | ||
416 | +{ | ||
417 | + int j; | ||
418 | + | ||
419 | + | ||
420 | + for (j = 0; j < size; j++) { | ||
421 | + int c = src->frame_data[j]; | ||
422 | + | ||
423 | + if (c) { | ||
424 | + if (!isprint(c)) | ||
425 | + break; | ||
426 | + } | ||
427 | + } | ||
428 | +} | ||
429 | + | ||
430 | +static VOID display1(WORD8 src[], WORD32 size, WORD8 disp[]) | ||
431 | +{ | ||
432 | + WORD32 j; | ||
433 | + | ||
434 | + for (j = 0; j < size ; j++) { | ||
435 | + int c = src[j]; | ||
436 | + | ||
437 | + if (c) { | ||
438 | + if (!isprint(c)) | ||
439 | + break; | ||
440 | + } | ||
441 | + } | ||
442 | +} | ||
443 | + | ||
444 | +/***************************************************************** | ||
445 | + * function name : init_id3_header | ||
446 | + * | ||
447 | + * description : initialise the max filed size of teh farem. | ||
448 | + * | ||
449 | + * arguments : input parameters | ||
450 | + * | ||
451 | + * values returned : 0 | ||
452 | + ****************************************************************/ | ||
453 | + | ||
454 | +VOID init_id3v2_field(id3v2_struct *id3v2) | ||
455 | +{ | ||
456 | + id3v2->album_movie_show_title.max_size = MAX_TAG_FRAME_SIZE; | ||
457 | + id3v2->composer_name.max_size = MAX_TAG_FRAME_SIZE; | ||
458 | + id3v2->content_type.max_size = MAX_TAG_FRAME_SIZE; | ||
459 | + id3v2->encoded_by.max_size = MAX_TAG_FRAME_SIZE; | ||
460 | + id3v2->lyricist_text_writer.max_size = MAX_TAG_FRAME_SIZE; | ||
461 | + id3v2->content_group_description.max_size = MAX_TAG_FRAME_SIZE; | ||
462 | + id3v2->title_songname_content_description.max_size = MAX_TAG_FRAME_SIZE; | ||
463 | + id3v2->medxa_type.max_size = MAX_TAG_FRAME_SIZE; | ||
464 | + id3v2->original_album_movie_show_title.max_size = MAX_TAG_FRAME_SIZE; | ||
465 | + id3v2->original_filename.max_size = MAX_TAG_FRAME_SIZE; | ||
466 | + id3v2->original_lyricist_text_writer.max_size = MAX_TAG_FRAME_SIZE; | ||
467 | + id3v2->original_artist_performer.max_size = MAX_TAG_FRAME_SIZE; | ||
468 | + id3v2->file_owner_licensee.max_size = MAX_TAG_FRAME_SIZE; | ||
469 | + id3v2->lead_performer_soloist.max_size = MAX_TAG_FRAME_SIZE; | ||
470 | + id3v2->publisher.max_size = MAX_TAG_FRAME_SIZE; | ||
471 | + id3v2->private_frame.max_size = MAX_TAG_FRAME_SIZE; | ||
472 | + id3v2->other_info.max_size = MAX_TAG_FRAME_SIZE; | ||
473 | + | ||
474 | + /* resetting the flag to indicate presese of frame */ | ||
475 | + id3v2->album_movie_show_title.tag_present = 0; | ||
476 | + id3v2->composer_name.tag_present = 0; | ||
477 | + id3v2->content_type.tag_present = 0; | ||
478 | + id3v2->encoded_by.tag_present = 0; | ||
479 | + id3v2->lyricist_text_writer.tag_present = 0; | ||
480 | + id3v2->content_group_description.tag_present = 0; | ||
481 | + id3v2->title_songname_content_description.tag_present = 0; | ||
482 | + id3v2->medxa_type.tag_present = 0; | ||
483 | + id3v2->original_album_movie_show_title.tag_present = 0; | ||
484 | + id3v2->original_filename.tag_present = 0; | ||
485 | + id3v2->original_lyricist_text_writer.tag_present = 0; | ||
486 | + id3v2->original_artist_performer.tag_present = 0; | ||
487 | + id3v2->file_owner_licensee.tag_present = 0; | ||
488 | + id3v2->lead_performer_soloist.tag_present = 0; | ||
489 | + id3v2->publisher.tag_present = 0; | ||
490 | + id3v2->private_frame.tag_present = 0; | ||
491 | + id3v2->other_info.tag_present = 0; | ||
492 | + | ||
493 | + /* resetting the flag which indicates that size of the frame has | ||
494 | + * exceeded the max buffer size | ||
495 | + */ | ||
496 | + id3v2->album_movie_show_title.exceeds_buffer_size = 0; | ||
497 | + id3v2->composer_name.exceeds_buffer_size = 0; | ||
498 | + id3v2->content_type.exceeds_buffer_size = 0; | ||
499 | + id3v2->encoded_by.exceeds_buffer_size = 0; | ||
500 | + id3v2->lyricist_text_writer.exceeds_buffer_size = 0; | ||
501 | + id3v2->content_group_description.exceeds_buffer_size = 0; | ||
502 | + id3v2->title_songname_content_description.exceeds_buffer_size = 0; | ||
503 | + id3v2->medxa_type.exceeds_buffer_size = 0; | ||
504 | + id3v2->original_album_movie_show_title.exceeds_buffer_size = 0; | ||
505 | + id3v2->original_filename.exceeds_buffer_size = 0; | ||
506 | + id3v2->original_lyricist_text_writer.exceeds_buffer_size = 0; | ||
507 | + id3v2->original_artist_performer.exceeds_buffer_size = 0; | ||
508 | + id3v2->file_owner_licensee.exceeds_buffer_size = 0; | ||
509 | + id3v2->lead_performer_soloist.exceeds_buffer_size = 0; | ||
510 | + id3v2->publisher.exceeds_buffer_size = 0; | ||
511 | + id3v2->private_frame.exceeds_buffer_size = 0; | ||
512 | + id3v2->other_info.exceeds_buffer_size = 0; | ||
513 | + | ||
514 | + id3v2->bytes_consumed = 0; | ||
515 | + id3v2->header_end = 0; | ||
516 | +} | ||
517 | + | ||
518 | +/*************************************************************** | ||
519 | + * function name : search_id3_v2 | ||
520 | + * | ||
521 | + * description : finds if ID3V2 starts at the start of given buffer. | ||
522 | + * | ||
523 | + * arguments : input parameters | ||
524 | + * buffer input buffer | ||
525 | + * | ||
526 | + * values returned : FLAG 1: ID3 found 0: ID3 not found | ||
527 | + ***************************************************************/ | ||
528 | +WORD32 search_id3_v2(UWORD8 *buffer) | ||
529 | +{ | ||
530 | + UWORD32 temp; | ||
531 | + | ||
532 | + temp = buffer[0] << 16; | ||
533 | + temp |= buffer[1] << 8; | ||
534 | + temp |= buffer[2]; | ||
535 | + | ||
536 | + if (temp == ID3V2) | ||
537 | + return 1; /* ID3 found */ | ||
538 | + | ||
539 | + return 0; /* ID3 not found */ | ||
540 | +} | ||
541 | + | ||
542 | +/************************************************************** | ||
543 | + * function name : search_id3_v1 | ||
544 | + * | ||
545 | + * description : finds if ID3V1 starts at the start of given buffer. | ||
546 | + * | ||
547 | + * arguments : input parameters | ||
548 | + * buffer input buffer | ||
549 | + * | ||
550 | + * values returned : FLAG 1: ID3 found 0: ID3 not found | ||
551 | + **************************************************************/ | ||
552 | +WORD32 search_id3_v1(UWORD8 *buffer) | ||
553 | +{ | ||
554 | + UWORD32 temp; | ||
555 | + | ||
556 | + temp = buffer[0] << 16; | ||
557 | + temp |= buffer[1] << 8; | ||
558 | + temp |= buffer[2]; | ||
559 | + | ||
560 | + if (temp == ID3V1) | ||
561 | + return 1; /* ID3 found */ | ||
562 | + | ||
563 | + return 0; /* ID3 not found */ | ||
564 | +} | ||
565 | + | ||
566 | +/*************************************************************** | ||
567 | + * function name : decode_id3_v1 | ||
568 | + * | ||
569 | + * description : decodes ID3V1 tag. | ||
570 | + * | ||
571 | + * arguments : input parameters | ||
572 | + * buffer input buffer | ||
573 | + * id3v1 structure | ||
574 | + * | ||
575 | + * values returned : bytes consumed | ||
576 | + **************************************************************/ | ||
577 | +WORD32 decode_id3_v1(UWORD8 *buffer, id3v1_struct *id3v1) | ||
578 | +{ | ||
579 | + WORD32 bytes_consumed = 0; | ||
580 | + short tag_type; | ||
581 | + | ||
582 | + /* setting the tag type */ | ||
583 | + tag_type = 1; | ||
584 | + | ||
585 | + bytes_consumed = get_v1_info(buffer, id3v1); | ||
586 | + | ||
587 | + return bytes_consumed; | ||
588 | +} | ||
589 | + | ||
590 | +/*********************************************************** | ||
591 | + * function name : get_v1_info | ||
592 | + * | ||
593 | + * description : gets ID3V1 information fields. | ||
594 | + * | ||
595 | + * arguments : input parameters | ||
596 | + * buffer input buffer | ||
597 | + * id3v1 structure | ||
598 | + * | ||
599 | + * values returned : bytes consumed | ||
600 | + ***********************************************************/ | ||
601 | +WORD32 get_v1_info(UWORD8 *buffer, id3v1_struct *id3v1) | ||
602 | +{ | ||
603 | + WORD32 i; | ||
604 | + WORD32 bytes_consumed = 0; | ||
605 | + | ||
606 | + /* get song_title */ | ||
607 | + for (i = 0; i < 30; i++) | ||
608 | + id3v1->song_title[i] = buffer[i]; | ||
609 | + | ||
610 | + buffer += 30; | ||
611 | + bytes_consumed += 30; | ||
612 | + display1(id3v1->song_title, 30, (WORD8 *)"song_title : "); | ||
613 | + | ||
614 | + /* get artist */ | ||
615 | + for (i = 0; i < 30; i++) | ||
616 | + id3v1->artist[i] = buffer[i]; | ||
617 | + | ||
618 | + buffer += 30; | ||
619 | + bytes_consumed += 30; | ||
620 | + display1(id3v1->artist, 30, (WORD8 *)"artist : "); | ||
621 | + | ||
622 | + /* get album */ | ||
623 | + for (i = 0; i < 30; i++) | ||
624 | + id3v1->album[i] = buffer[i]; | ||
625 | + | ||
626 | + buffer += 30; | ||
627 | + bytes_consumed += 30; | ||
628 | + display1(id3v1->album, 30, (WORD8 *)"album : "); | ||
629 | + | ||
630 | + /* get year */ | ||
631 | + for (i = 0; i < 4; i++) | ||
632 | + id3v1->year[i] = buffer[i]; | ||
633 | + | ||
634 | + buffer += 4; | ||
635 | + bytes_consumed += 4; | ||
636 | + display1(id3v1->year, 4, (WORD8 *)"year : "); | ||
637 | + | ||
638 | + /* get comment */ | ||
639 | + for (i = 0; i < 30; i++) | ||
640 | + id3v1->comment[i] = buffer[i]; | ||
641 | + | ||
642 | + buffer += 30; | ||
643 | + bytes_consumed += 30; | ||
644 | + display1(id3v1->comment, 30, (WORD8 *)"comment : "); | ||
645 | + | ||
646 | + /* get genre */ | ||
647 | + for (i = 0; i < 1; i++) | ||
648 | + id3v1->genre[i] = buffer[i]; | ||
649 | + | ||
650 | + buffer += 1; | ||
651 | + bytes_consumed += 1; | ||
652 | + | ||
653 | + return bytes_consumed; | ||
654 | +} | ||
655 | + | ||
656 | +/***************************************************** | ||
657 | + * function name : decode_id3_v2 | ||
658 | + * | ||
659 | + * description : decodes ID3V2 tag. | ||
660 | + * | ||
661 | + * arguments : input parameters | ||
662 | + * buffer input buffer | ||
663 | + * id3v2 structure | ||
664 | + * continue_flag FLAG to indicate whether | ||
665 | + * it is first call or not | ||
666 | + * insize input buffer size | ||
667 | + * | ||
668 | + * values returned : bytes consumed | ||
669 | + ******************************************************/ | ||
670 | +WORD32 decode_id3_v2(const char *const buffer, | ||
671 | + id3v2_struct *const id3v2, | ||
672 | + WORD32 continue_flag, | ||
673 | + WORD32 insize) | ||
674 | +{ | ||
675 | + UWORD32 size = 0, flag; | ||
676 | + WORD32 i, buf_update_val; | ||
677 | + UWORD8 buf[4], frame_header[10], id3_buffer[10]; | ||
678 | + WORD8 *bitstream_ptr; | ||
679 | + short tag_type; | ||
680 | + | ||
681 | + WORD32 bytes_consumed = 0; | ||
682 | + | ||
683 | + if (id3v2->header_end == 1) { | ||
684 | + id3v2->bytes_consumed += insize; | ||
685 | + if (id3v2->bytes_consumed < id3v2->id3_v2_header.size) | ||
686 | + return 0; | ||
687 | + | ||
688 | + id3v2->bytes_consumed = (id3v2->id3_v2_header.size + 10); | ||
689 | + return 1; | ||
690 | + } | ||
691 | + | ||
692 | + bitstream_ptr = (WORD8 *)id3_buffer; | ||
693 | + | ||
694 | + if (!continue_flag) { | ||
695 | + bytes_consumed += 3; | ||
696 | + /* setting the tag type */ | ||
697 | + tag_type = 2; | ||
698 | + id3v2->id3_v2_header.version = buffer[bytes_consumed + 0] << 8; | ||
699 | + id3v2->id3_v2_header.version |= buffer[bytes_consumed + 1]; | ||
700 | + id3v2->id3_v2_header.flag = buffer[bytes_consumed + 2]; | ||
701 | + | ||
702 | + /* making the msb of each byte zero */ | ||
703 | + buf[0] = buffer[bytes_consumed + 6] & 0x7f; | ||
704 | + buf[1] = buffer[bytes_consumed + 5] & 0x7f; | ||
705 | + buf[2] = buffer[bytes_consumed + 4] & 0x7f; | ||
706 | + buf[3] = buffer[bytes_consumed + 3] & 0x7f; | ||
707 | + | ||
708 | + bytes_consumed += 7; | ||
709 | + | ||
710 | + /* concatenation the bytes after making | ||
711 | + * 7th bit zero to get 28 bits size | ||
712 | + */ | ||
713 | + size = buf[0]; | ||
714 | + size |= (buf[1] << 7); | ||
715 | + size |= (buf[2] << 14); | ||
716 | + size |= (buf[3] << 21); | ||
717 | + /* storing the size */ | ||
718 | + id3v2->id3_v2_header.size = size; | ||
719 | + | ||
720 | + /* check for extended header */ | ||
721 | + if (id3v2->id3_v2_header.flag & 0x20) { | ||
722 | + for (i = 0; i < 10; i++) | ||
723 | + bitstream_ptr[i] = buffer[bytes_consumed + i]; | ||
724 | + | ||
725 | + i = 0; | ||
726 | + bytes_consumed += 10; | ||
727 | + | ||
728 | + size = bitstream_ptr[i++] << 24; | ||
729 | + size |= bitstream_ptr[i++] << 16; | ||
730 | + size |= bitstream_ptr[i++] << 8; | ||
731 | + size |= bitstream_ptr[i++]; | ||
732 | + | ||
733 | + /* two bytes for flag */ | ||
734 | + i += 2; | ||
735 | + { | ||
736 | + UWORD32 padding_size; | ||
737 | + | ||
738 | + padding_size = bitstream_ptr[i++] << 24; | ||
739 | + padding_size |= bitstream_ptr[i++] << 16; | ||
740 | + padding_size |= bitstream_ptr[i++] << 8; | ||
741 | + padding_size |= bitstream_ptr[i++]; | ||
742 | + | ||
743 | + /* skipping the padding and frame size | ||
744 | + * number of bytes | ||
745 | + */ | ||
746 | + bytes_consumed += (padding_size + size); | ||
747 | + } | ||
748 | + } | ||
749 | + } | ||
750 | + | ||
751 | + while (id3v2->header_end != 1) { | ||
752 | + char *key; | ||
753 | + id3_v2_frame_struct *value; | ||
754 | + unsigned int avail_inp; | ||
755 | + | ||
756 | + /* reading the 10 bytes to get the frame header */ | ||
757 | + | ||
758 | + for (i = 0; i < 10; i++) | ||
759 | + frame_header[i] = buffer[bytes_consumed + i]; | ||
760 | + bytes_consumed += 10; | ||
761 | + | ||
762 | + /* getting the size from the header */ | ||
763 | + size = frame_header[4] << 24; | ||
764 | + size |= frame_header[5] << 16; | ||
765 | + size |= frame_header[6] << 8; | ||
766 | + size |= frame_header[7]; | ||
767 | + | ||
768 | + /* decoding the flag, currently not used */ | ||
769 | + flag = frame_header[8] << 8; | ||
770 | + flag |= frame_header[9]; | ||
771 | + | ||
772 | + avail_inp = insize - bytes_consumed; | ||
773 | + | ||
774 | + /* switching to the frame type */ | ||
775 | + switch (CHAR4(frame_header[0], | ||
776 | + frame_header[1], | ||
777 | + frame_header[2], | ||
778 | + frame_header[3])) { | ||
779 | + case CHAR4('A', 'E', 'N', 'C'): | ||
780 | + case CHAR4('A', 'P', 'I', 'C'): | ||
781 | + case CHAR4('C', 'O', 'M', 'M'): | ||
782 | + case CHAR4('C', 'O', 'M', 'R'): | ||
783 | + case CHAR4('E', 'N', 'C', 'R'): | ||
784 | + case CHAR4('E', 'Q', 'U', 'A'): | ||
785 | + case CHAR4('E', 'T', 'C', 'O'): | ||
786 | + case CHAR4('G', 'E', 'O', 'B'): | ||
787 | + case CHAR4('G', 'R', 'I', 'D'): | ||
788 | + case CHAR4('I', 'P', 'L', 'S'): | ||
789 | + case CHAR4('L', 'I', 'N', 'K'): | ||
790 | + case CHAR4('M', 'C', 'D', 'I'): | ||
791 | + case CHAR4('M', 'L', 'L', 'T'): | ||
792 | + case CHAR4('O', 'W', 'N', 'E'): | ||
793 | + case CHAR4('P', 'C', 'N', 'T'): | ||
794 | + case CHAR4('P', 'O', 'P', 'M'): | ||
795 | + case CHAR4('P', 'O', 'S', 'S'): | ||
796 | + case CHAR4('R', 'B', 'U', 'F'): | ||
797 | + case CHAR4('R', 'V', 'A', 'D'): | ||
798 | + case CHAR4('R', 'V', 'R', 'B'): | ||
799 | + case CHAR4('S', 'Y', 'L', 'T'): | ||
800 | + case CHAR4('S', 'Y', 'T', 'C'): | ||
801 | + case CHAR4('T', 'B', 'P', 'M'): | ||
802 | + case CHAR4('T', 'C', 'O', 'P'): | ||
803 | + case CHAR4('T', 'D', 'A', 'T'): | ||
804 | + case CHAR4('T', 'D', 'L', 'Y'): | ||
805 | + case CHAR4('T', 'F', 'L', 'T'): | ||
806 | + case CHAR4('T', 'I', 'M', 'E'): | ||
807 | + case CHAR4('T', 'K', 'E', 'Y'): | ||
808 | + case CHAR4('T', 'L', 'A', 'N'): | ||
809 | + case CHAR4('T', 'L', 'E', 'N'): | ||
810 | + case CHAR4('T', 'M', 'E', 'D'): | ||
811 | + case CHAR4('T', 'O', 'F', 'N'): | ||
812 | + case CHAR4('T', 'O', 'L', 'Y'): | ||
813 | + case CHAR4('T', 'O', 'R', 'Y'): | ||
814 | + case CHAR4('T', 'P', 'E', '2'): | ||
815 | + case CHAR4('T', 'P', 'E', '3'): | ||
816 | + case CHAR4('T', 'P', 'E', '4'): | ||
817 | + case CHAR4('T', 'P', 'O', 'S'): | ||
818 | + case CHAR4('T', 'R', 'C', 'K'): | ||
819 | + case CHAR4('T', 'R', 'D', 'A'): | ||
820 | + case CHAR4('T', 'R', 'S', 'N'): | ||
821 | + case CHAR4('T', 'R', 'S', 'O'): | ||
822 | + case CHAR4('T', 'S', 'I', 'Z'): | ||
823 | + case CHAR4('T', 'S', 'R', 'C'): | ||
824 | + case CHAR4('T', 'S', 'S', 'E'): | ||
825 | + case CHAR4('T', 'Y', 'E', 'R'): | ||
826 | + case CHAR4('T', 'X', 'X', 'X'): | ||
827 | + case CHAR4('U', 'F', 'I', 'D'): | ||
828 | + case CHAR4('U', 'S', 'E', 'R'): | ||
829 | + case CHAR4('U', 'S', 'L', 'T'): | ||
830 | + case CHAR4('W', 'C', 'O', 'M'): | ||
831 | + case CHAR4('W', 'C', 'O', 'P'): | ||
832 | + case CHAR4('W', 'O', 'A', 'F'): | ||
833 | + case CHAR4('W', 'O', 'A', 'R'): | ||
834 | + case CHAR4('W', 'O', 'A', 'S'): | ||
835 | + case CHAR4('W', 'O', 'R', 'S'): | ||
836 | + case CHAR4('W', 'P', 'A', 'Y'): | ||
837 | + case CHAR4('W', 'P', 'U', 'B'): | ||
838 | + case CHAR4('W', 'X', 'X', 'X'): | ||
839 | + case CHAR4('T', 'I', 'T', '3'): | ||
840 | + key = "other_info : "; | ||
841 | + value = &id3v2->other_info; | ||
842 | + break; | ||
843 | + case CHAR4('P', 'R', 'I', 'V'): | ||
844 | + key = "private_frame : "; | ||
845 | + value = &id3v2->private_frame; | ||
846 | + break; | ||
847 | + case CHAR4('T', 'A', 'L', 'B'): | ||
848 | + key = "album_movie_show_title : "; | ||
849 | + value = &id3v2->album_movie_show_title; | ||
850 | + break; | ||
851 | + case CHAR4('T', 'C', 'O', 'M'): | ||
852 | + key = "composer_name : "; | ||
853 | + value = &id3v2->composer_name; | ||
854 | + break; | ||
855 | + case CHAR4('T', 'C', 'O', 'N'): | ||
856 | + key = "content_type : "; | ||
857 | + value = &id3v2->content_type; | ||
858 | + break; | ||
859 | + case CHAR4('T', 'E', 'N', 'C'): | ||
860 | + key = "encoded_by : "; | ||
861 | + value = &id3v2->encoded_by; | ||
862 | + break; | ||
863 | + case CHAR4('T', 'E', 'X', 'T'): | ||
864 | + key = "lyricist_text_writer : "; | ||
865 | + value = &id3v2->lyricist_text_writer; | ||
866 | + break; | ||
867 | + case CHAR4('T', 'I', 'T', '1'): | ||
868 | + key = "content_group_description : "; | ||
869 | + value = &id3v2->content_group_description; | ||
870 | + break; | ||
871 | + case CHAR4('T', 'I', 'T', '2'): | ||
872 | + key = "title_songname_content_description : "; | ||
873 | + value = &id3v2->title_songname_content_description; | ||
874 | + break; | ||
875 | + case CHAR4('T', 'O', 'A', 'L'): | ||
876 | + key = "original_album_movie_show_title : "; | ||
877 | + value = &id3v2->original_album_movie_show_title; | ||
878 | + break; | ||
879 | + case CHAR4('T', 'O', 'P', 'E'): | ||
880 | + key = "original_artist_performer : "; | ||
881 | + value = &id3v2->original_artist_performer; | ||
882 | + break; | ||
883 | + case CHAR4('T', 'O', 'W', 'N'): | ||
884 | + key = "file_owner_licensee : "; | ||
885 | + value = &id3v2->file_owner_licensee; | ||
886 | + break; | ||
887 | + case CHAR4('T', 'P', 'E', '1'): | ||
888 | + key = "lead_performer_soloist : "; | ||
889 | + value = &id3v2->lead_performer_soloist; | ||
890 | + break; | ||
891 | + case CHAR4('T', 'P', 'U', 'B'): | ||
892 | + key = "publisher : "; | ||
893 | + value = &id3v2->publisher; | ||
894 | + break; | ||
895 | + default: | ||
896 | + /* skipping the read 10 bytes */ | ||
897 | + buf_update_val = -10; | ||
898 | + id3v2->header_end = 1; | ||
899 | + value = 0; | ||
900 | + key = 0; | ||
901 | + break; | ||
902 | + } | ||
903 | + | ||
904 | + if (value != 0) | ||
905 | + buf_update_val = get_info(&buffer[bytes_consumed], | ||
906 | + avail_inp, size, value); | ||
907 | + | ||
908 | + /* Negative value for buf_update_val means one of two things: | ||
909 | + * 1. The default case happened and we're done with ID3V2 tag | ||
910 | + * frames, or | ||
911 | + * 2. get_info() returned -1 to indicate that more input is | ||
912 | + * required to decode this frame of the tag. | ||
913 | + */ | ||
914 | + if (buf_update_val >= 0) | ||
915 | + display2(value, | ||
916 | + umin(value->max_size, buf_update_val), key); | ||
917 | + | ||
918 | + if (buf_update_val == -1) { | ||
919 | + id3v2->bytes_consumed += bytes_consumed; | ||
920 | + return 1; | ||
921 | + } | ||
922 | + | ||
923 | + bytes_consumed += buf_update_val; | ||
924 | + | ||
925 | + /* Is there enough input left (10 bytes) to begin | ||
926 | + * decoding another frame? If not, bag out temporarily | ||
927 | + * now. The caller will refill our input buffer and | ||
928 | + * call us again with continue_flag == 1. | ||
929 | + */ | ||
930 | + if (insize - bytes_consumed < 10) { | ||
931 | + id3v2->bytes_consumed += bytes_consumed; | ||
932 | + return 0; /* not completely decoded */ | ||
933 | + } | ||
934 | + } | ||
935 | + | ||
936 | + id3v2->bytes_consumed += bytes_consumed; | ||
937 | + if ((id3v2->bytes_consumed + 10) < id3v2->id3_v2_header.size) | ||
938 | + return 0; /* not completely decoded */ | ||
939 | + | ||
940 | + return 1; /* completely decoded */ | ||
941 | +} | ||
942 | + | ||
943 | +/******************************************************* | ||
944 | + * function name : get_id3_v2_bytes | ||
945 | + * | ||
946 | + * description : tells the size of ID3V2 tag. | ||
947 | + * | ||
948 | + * arguments : input parameters | ||
949 | + * buffer input buffer | ||
950 | + * | ||
951 | + * values returned : bytes consumed | ||
952 | + ********************************************************/ | ||
953 | +WORD32 get_id3_v2_bytes(UWORD8 *buffer) | ||
954 | +{ | ||
955 | + WORD32 size; | ||
956 | + | ||
957 | + /* making the msb of each byte zero */ | ||
958 | + size = (buffer[9] & 0x7f); | ||
959 | + size |= ((buffer[8] & 0x7f) << 7); | ||
960 | + size |= ((buffer[7] & 0x7f) << 14); | ||
961 | + size |= ((buffer[6] & 0x7f) << 21); | ||
962 | + | ||
963 | + return (size + 10); | ||
964 | +} | ||
965 | + | ||
966 | +/**************************************************** | ||
967 | + * function name : get_info | ||
968 | + * | ||
969 | + * description : read the frame information from the input buffer. | ||
970 | + * | ||
971 | + * arguments : input parameters | ||
972 | + * | ||
973 | + * values returned : update value for buffer | ||
974 | + ****************************************************/ | ||
975 | +WORD32 get_info(const char *inp_buffer, | ||
976 | + unsigned int avail_inp, | ||
977 | + WORD32 tag_size, | ||
978 | + id3_v2_frame_struct *dest) | ||
979 | +{ | ||
980 | + WORD32 j; | ||
981 | + | ||
982 | + /* setting the tag to indicate the presence of frame */ | ||
983 | + dest->tag_present = 1; | ||
984 | + /* If there isn't enough input available, we punt back to the top | ||
985 | + * level and ask for more. | ||
986 | + */ | ||
987 | + if (avail_inp < umin(tag_size, dest->max_size)) | ||
988 | + return -1; | ||
989 | + | ||
990 | + if (dest->max_size >= tag_size) { | ||
991 | + for (j = 0; j < tag_size ; j++) | ||
992 | + dest->frame_data[j] = inp_buffer[j]; | ||
993 | + } else { | ||
994 | + dest->exceeds_buffer_size = 1; | ||
995 | + for (j = 0; j < dest->max_size ; j++) | ||
996 | + dest->frame_data[j] = inp_buffer[j]; | ||
997 | + } | ||
998 | + return tag_size; | ||
999 | +} | ||
1000 | -- | ||
1001 | 2.7.4 | ||
1002 | |||
diff --git a/recipes-multimedia/tinycompress/tinycompress/0002-cplay-Support-wave-file.patch b/recipes-multimedia/tinycompress/tinycompress/0002-cplay-Support-wave-file.patch deleted file mode 100755 index 79544711..00000000 --- a/recipes-multimedia/tinycompress/tinycompress/0002-cplay-Support-wave-file.patch +++ /dev/null | |||
@@ -1,215 +0,0 @@ | |||
1 | From 4d4bc0a958fe254531920095fbabc241aad88113 Mon Sep 17 00:00:00 2001 | ||
2 | From: Shengjiu Wang <shengjiu.wang@nxp.com> | ||
3 | Date: Tue, 28 Jul 2020 13:00:36 +0800 | ||
4 | Subject: [PATCH] cplay: Support wave file | ||
5 | |||
6 | The supported format is mono/stereo, S16_LE/S32_LE, 8kHz-192kHz. | ||
7 | Command is: | ||
8 | cplay -c x -I PCM test.wav | ||
9 | |||
10 | Upstream-Status: Inappropriate [i.MX specific] | ||
11 | Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> | ||
12 | --- | ||
13 | include/tinycompress/wave_formats.h | 51 +++++++++++++ | ||
14 | src/utils/cplay.c | 107 ++++++++++++++++++++++++++++ | ||
15 | 2 files changed, 158 insertions(+) | ||
16 | create mode 100644 include/tinycompress/wave_formats.h | ||
17 | |||
18 | --- /dev/null | ||
19 | +++ b/include/tinycompress/wave_formats.h | ||
20 | @@ -0,0 +1,53 @@ | ||
21 | +#ifndef WAVE_FORMATS_H | ||
22 | +#define WAVE_FORMATS_H 1 | ||
23 | + | ||
24 | +#include <sys/types.h> | ||
25 | + | ||
26 | +#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) | ||
27 | + | ||
28 | +#define WAV_RIFF COMPOSE_ID('R','I','F','F') | ||
29 | +#define WAV_RIFX COMPOSE_ID('R','I','F','X') | ||
30 | +#define WAV_WAVE COMPOSE_ID('W','A','V','E') | ||
31 | +#define WAV_FMT COMPOSE_ID('f','m','t',' ') | ||
32 | +#define WAV_DATA COMPOSE_ID('d','a','t','a') | ||
33 | + | ||
34 | +/* WAVE fmt block constants from Microsoft mmreg.h header */ | ||
35 | +#define WAV_FMT_PCM 0x0001 | ||
36 | +#define WAV_FMT_IEEE_FLOAT 0x0003 | ||
37 | +#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092 | ||
38 | +#define WAV_FMT_EXTENSIBLE 0xfffe | ||
39 | + | ||
40 | +/* Used with WAV_FMT_EXTENSIBLE format */ | ||
41 | +#define WAV_GUID_TAG "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71" | ||
42 | + | ||
43 | +typedef struct { | ||
44 | + u_int magic; /* 'RIFF' */ | ||
45 | + u_int length; /* filelen */ | ||
46 | + u_int type; /* 'WAVE' */ | ||
47 | +} WaveHeader; | ||
48 | + | ||
49 | +typedef struct { | ||
50 | + u_short format; /* see WAV_FMT_* */ | ||
51 | + u_short channels; | ||
52 | + u_int sample_fq; /* frequence of sample */ | ||
53 | + u_int byte_p_sec; | ||
54 | + u_short byte_p_spl; /* samplesize; 1 or 2 bytes */ | ||
55 | + u_short bit_p_spl; /* 8, 12 or 16 bit */ | ||
56 | +} WaveFmtBody; | ||
57 | + | ||
58 | +typedef struct { | ||
59 | + WaveFmtBody format; | ||
60 | + u_short ext_size; | ||
61 | + u_short bit_p_spl; | ||
62 | + u_int channel_mask; | ||
63 | + u_short guid_format; /* WAV_FMT_* */ | ||
64 | + u_char guid_tag[14]; /* WAV_GUID_TAG */ | ||
65 | +} WaveFmtExtensibleBody; | ||
66 | + | ||
67 | +typedef struct { | ||
68 | + u_int type; /* 'data' */ | ||
69 | + u_int length; /* samplecount */ | ||
70 | +} WaveChunkHeader; | ||
71 | + | ||
72 | + | ||
73 | +#endif /* FORMATS */ | ||
74 | --- a/src/utils/cplay.c | ||
75 | +++ b/src/utils/cplay.c | ||
76 | @@ -1,4 +1,6 @@ | ||
77 | /* | ||
78 | + * Copyright 2020 NXP | ||
79 | + * | ||
80 | * This file is provided under a dual BSD/LGPLv2.1 license. When using or | ||
81 | * redistributing this file, you may do so under either license. | ||
82 | * | ||
83 | @@ -73,6 +75,8 @@ | ||
84 | #include "tinycompress/tinycompress.h" | ||
85 | #include "tinycompress/tinymp3.h" | ||
86 | #include "tinycompress/id3_tag_decode.h" | ||
87 | +#include "tinycompress/wave_formats.h" | ||
88 | +#include <alsa/asoundlib.h> | ||
89 | |||
90 | static int verbose; | ||
91 | static const unsigned int DEFAULT_CODEC_ID = SND_AUDIOCODEC_PCM; | ||
92 | @@ -166,6 +170,77 @@ static int parse_mp3_header(struct mp3_h | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | +static int parse_wav_header(FILE *file, unsigned int *num_channels, unsigned int *sample_rate, | ||
97 | + unsigned int *format) { | ||
98 | + WaveHeader wave_header; | ||
99 | + WaveChunkHeader chunk_header; | ||
100 | + WaveFmtBody fmt_body; | ||
101 | + int more_chunks = 1; | ||
102 | + | ||
103 | + fread(&wave_header, sizeof(WaveHeader), 1, file); | ||
104 | + if ((wave_header.magic != WAV_RIFF) || | ||
105 | + (wave_header.type != WAV_WAVE)) { | ||
106 | + fprintf(stderr, "Error: it is not a riff/wave file\n"); | ||
107 | + return -1; | ||
108 | + } | ||
109 | + | ||
110 | + do { | ||
111 | + fread(&chunk_header, sizeof(WaveChunkHeader), 1, file); | ||
112 | + switch (chunk_header.type) { | ||
113 | + case WAV_FMT: | ||
114 | + fread(&fmt_body, sizeof(WaveFmtBody), 1, file); | ||
115 | + /* If the format header is larger, skip the rest */ | ||
116 | + if (chunk_header.length > sizeof(WaveFmtBody)) | ||
117 | + fseek(file, chunk_header.length - sizeof(WaveFmtBody), SEEK_CUR); | ||
118 | + | ||
119 | + *num_channels = fmt_body.channels; | ||
120 | + *sample_rate = fmt_body.sample_fq; | ||
121 | + | ||
122 | + switch (fmt_body.bit_p_spl) { | ||
123 | + case 8: | ||
124 | + *format = SND_PCM_FORMAT_U8; | ||
125 | + break; | ||
126 | + case 16: | ||
127 | + *format = SND_PCM_FORMAT_S16_LE; | ||
128 | + break; | ||
129 | + case 24: | ||
130 | + switch (fmt_body.byte_p_spl / fmt_body.channels) { | ||
131 | + case 3: | ||
132 | + *format = SND_PCM_FORMAT_S24_3LE; | ||
133 | + break; | ||
134 | + case 4: | ||
135 | + *format = SND_PCM_FORMAT_S24_LE; | ||
136 | + break; | ||
137 | + default: | ||
138 | + fprintf(stderr, "format error\n"); | ||
139 | + return -1; | ||
140 | + } | ||
141 | + break; | ||
142 | + case 32: | ||
143 | + if (fmt_body.format == WAV_FMT_PCM) { | ||
144 | + *format = SND_PCM_FORMAT_S32_LE; | ||
145 | + } else if (fmt_body.format == WAV_FMT_IEEE_FLOAT) { | ||
146 | + *format = SND_PCM_FORMAT_FLOAT_LE; | ||
147 | + } | ||
148 | + break; | ||
149 | + default: | ||
150 | + fprintf(stderr, "format error\n"); | ||
151 | + return -1; | ||
152 | + } | ||
153 | + break; | ||
154 | + case WAV_DATA: | ||
155 | + /* Stop looking for chunks */ | ||
156 | + more_chunks = 0; | ||
157 | + break; | ||
158 | + default: | ||
159 | + /* Unknown chunk, skip bytes */ | ||
160 | + fseek(file, chunk_header.length, SEEK_CUR); | ||
161 | + } | ||
162 | + } while (more_chunks); | ||
163 | + | ||
164 | + return 0; | ||
165 | +} | ||
166 | + | ||
167 | static int print_time(struct compress *compress) | ||
168 | { | ||
169 | unsigned int avail; | ||
170 | @@ -385,6 +460,35 @@ void get_codec_iec(FILE *file, struct co | ||
171 | codec->format = 0; | ||
172 | } | ||
173 | |||
174 | +void get_codec_pcm(FILE *file, struct compr_config *config, | ||
175 | + struct snd_codec *codec) | ||
176 | +{ | ||
177 | + unsigned int channels, rate, format; | ||
178 | + | ||
179 | + if (parse_wav_header(file, &channels, &rate, &format) == -1) { | ||
180 | + fclose(file); | ||
181 | + exit(EXIT_FAILURE); | ||
182 | + } | ||
183 | + | ||
184 | + if (channels > 2 || (format != SND_PCM_FORMAT_S16_LE && format != SND_PCM_FORMAT_S32_LE) || | ||
185 | + rate > 192000) { | ||
186 | + fprintf(stderr, "unsupported wave file\n"); | ||
187 | + fclose(file); | ||
188 | + exit(EXIT_FAILURE); | ||
189 | + } | ||
190 | + | ||
191 | + codec->id = SND_AUDIOCODEC_PCM; | ||
192 | + codec->ch_in = channels; | ||
193 | + codec->ch_out = channels; | ||
194 | + codec->sample_rate = rate; | ||
195 | + codec->bit_rate = 0; | ||
196 | + codec->rate_control = 0; | ||
197 | + codec->profile = SND_AUDIOPROFILE_PCM; | ||
198 | + codec->level = 0; | ||
199 | + codec->ch_mode = 0; | ||
200 | + codec->format = format; | ||
201 | +} | ||
202 | + | ||
203 | void play_samples(char *name, unsigned int card, unsigned int device, | ||
204 | unsigned long buffer_size, unsigned int frag, | ||
205 | unsigned long codec_id) | ||
206 | @@ -411,6 +515,9 @@ void play_samples(char *name, unsigned i | ||
207 | case SND_AUDIOCODEC_IEC61937: | ||
208 | get_codec_iec(file, &config, &codec); | ||
209 | break; | ||
210 | + case SND_AUDIOCODEC_PCM: | ||
211 | + get_codec_pcm(file, &config, &codec); | ||
212 | + break; | ||
213 | default: | ||
214 | fprintf(stderr, "codec ID %ld is not supported\n", codec_id); | ||
215 | exit(EXIT_FAILURE); | ||
diff --git a/recipes-multimedia/tinycompress/tinycompress/0003-cplay-Add-pause-feature.patch b/recipes-multimedia/tinycompress/tinycompress/0003-cplay-Add-pause-feature.patch deleted file mode 100755 index 7d8492b7..00000000 --- a/recipes-multimedia/tinycompress/tinycompress/0003-cplay-Add-pause-feature.patch +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | From 6f778c21ee357a662cdd758cff578a3e4b85eedf Mon Sep 17 00:00:00 2001 | ||
2 | From: Zhang Peng <peng.zhang_8@nxp.com> | ||
3 | Date: Tue, 4 Aug 2020 15:29:29 +0800 | ||
4 | Subject: [PATCH] cplay: Add pause feature | ||
5 | |||
6 | Add option: -p pause | ||
7 | |||
8 | Upstream-Status: Inappropriate [i.MX specific] | ||
9 | Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com> | ||
10 | --- | ||
11 | src/utils/cplay.c | 56 +++++++++++++++++++++++++++++++++++++++++++---- | ||
12 | 1 file changed, 52 insertions(+), 4 deletions(-) | ||
13 | |||
14 | diff --git a/src/utils/cplay.c b/src/utils/cplay.c | ||
15 | index 8882f4d..8e3dcbb 100644 | ||
16 | --- a/src/utils/cplay.c | ||
17 | +++ b/src/utils/cplay.c | ||
18 | @@ -117,6 +117,9 @@ static void usage(void) | ||
19 | "-f\tfragments\n\n" | ||
20 | "-v\tverbose mode\n" | ||
21 | "-h\tPrints this help list\n\n" | ||
22 | + "-p\tpause\n" | ||
23 | + "-m\tpause blocks\n" | ||
24 | + "-n\tpause time duration\n" | ||
25 | "Example:\n" | ||
26 | "\tcplay -c 1 -d 2 test.mp3\n" | ||
27 | "\tcplay -f 5 test.mp3\n\n" | ||
28 | @@ -133,7 +136,8 @@ static void usage(void) | ||
29 | |||
30 | void play_samples(char *name, unsigned int card, unsigned int device, | ||
31 | unsigned long buffer_size, unsigned int frag, | ||
32 | - unsigned long codec_id); | ||
33 | + unsigned long codec_id, int pause_count, int pause_block, | ||
34 | + int pause_duration); | ||
35 | |||
36 | struct mp3_header { | ||
37 | uint16_t sync; | ||
38 | @@ -262,12 +266,15 @@ int main(int argc, char **argv) | ||
39 | int c, i; | ||
40 | unsigned int card = 0, device = 0, frag = 0; | ||
41 | unsigned int codec_id = SND_AUDIOCODEC_MP3; | ||
42 | + int pause_count = 0; | ||
43 | + int pause_block = 6; | ||
44 | + int pause_duration = 10; | ||
45 | |||
46 | if (argc < 2) | ||
47 | usage(); | ||
48 | |||
49 | verbose = 0; | ||
50 | - while ((c = getopt(argc, argv, "hvb:f:c:d:I:")) != -1) { | ||
51 | + while ((c = getopt(argc, argv, "hvb:f:c:d:I:p:m:n:")) != -1) { | ||
52 | switch (c) { | ||
53 | case 'h': | ||
54 | usage(); | ||
55 | @@ -306,6 +313,23 @@ int main(int argc, char **argv) | ||
56 | case 'v': | ||
57 | verbose = 1; | ||
58 | break; | ||
59 | + case 'p': | ||
60 | + pause_count = strtol(optarg, NULL, 10); | ||
61 | + break; | ||
62 | + case 'm': | ||
63 | + pause_block = strtol(optarg, NULL, 10); | ||
64 | + if (pause_duration < 0) { | ||
65 | + printf("Set wrong paramter! Set duration default 6.\n"); | ||
66 | + pause_duration = 6; | ||
67 | + } | ||
68 | + break; | ||
69 | + case 'n': | ||
70 | + pause_duration = strtol(optarg, NULL, 10); | ||
71 | + if (pause_duration < 0) { | ||
72 | + printf("Set wrong paramter! Set duration default 10.\n"); | ||
73 | + pause_duration = 10; | ||
74 | + } | ||
75 | + break; | ||
76 | default: | ||
77 | exit(EXIT_FAILURE); | ||
78 | } | ||
79 | @@ -315,7 +339,7 @@ int main(int argc, char **argv) | ||
80 | |||
81 | file = argv[optind]; | ||
82 | |||
83 | - play_samples(file, card, device, buffer_size, frag, codec_id); | ||
84 | + play_samples(file, card, device, buffer_size, frag, codec_id, pause_count, pause_block, pause_duration); | ||
85 | |||
86 | fprintf(stderr, "Finish Playing.... Close Normally\n"); | ||
87 | exit(EXIT_SUCCESS); | ||
88 | @@ -491,7 +515,8 @@ void get_codec_pcm(FILE *file, struct compr_config *config, | ||
89 | |||
90 | void play_samples(char *name, unsigned int card, unsigned int device, | ||
91 | unsigned long buffer_size, unsigned int frag, | ||
92 | - unsigned long codec_id) | ||
93 | + unsigned long codec_id, int pause_count, int pause_block, | ||
94 | + int pause_duration) | ||
95 | { | ||
96 | struct compr_config config; | ||
97 | struct snd_codec codec; | ||
98 | @@ -499,6 +524,7 @@ void play_samples(char *name, unsigned int card, unsigned int device, | ||
99 | FILE *file; | ||
100 | char *buffer; | ||
101 | int size, num_read, wrote; | ||
102 | + int write_count = 0; | ||
103 | |||
104 | if (verbose) | ||
105 | printf("%s: entry\n", __func__); | ||
106 | @@ -574,6 +600,13 @@ void play_samples(char *name, unsigned int card, unsigned int device, | ||
107 | if (verbose) | ||
108 | printf("%s: You should hear audio NOW!!!\n", __func__); | ||
109 | |||
110 | + if (pause_count > 0) { | ||
111 | + printf("sleep...\n"); | ||
112 | + compress_pause(compress); | ||
113 | + sleep(pause_duration); | ||
114 | + compress_resume(compress); | ||
115 | + } | ||
116 | + | ||
117 | do { | ||
118 | num_read = fread(buffer, 1, size, file); | ||
119 | if (num_read > 0) { | ||
120 | @@ -592,8 +625,23 @@ void play_samples(char *name, unsigned int card, unsigned int device, | ||
121 | printf("%s: wrote %d\n", __func__, wrote); | ||
122 | } | ||
123 | } | ||
124 | + write_count++; | ||
125 | + if ((pause_count > 0) && (write_count % pause_block == 0)) { | ||
126 | + printf("pause...\n"); | ||
127 | + compress_pause(compress); | ||
128 | + sleep(pause_duration); | ||
129 | + printf("pause release...\n"); | ||
130 | + compress_resume(compress); | ||
131 | + pause_count--; | ||
132 | + } | ||
133 | } while (num_read > 0); | ||
134 | |||
135 | + if (pause_count > 0) { | ||
136 | + compress_pause(compress); | ||
137 | + sleep(5); | ||
138 | + compress_resume(compress); | ||
139 | + } | ||
140 | + | ||
141 | if (verbose) | ||
142 | printf("%s: exit success\n", __func__); | ||
143 | /* issue drain if it supports */ | ||
144 | -- | ||
145 | 2.17.1 | ||
146 | |||
diff --git a/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch b/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch deleted file mode 100755 index dfedd186..00000000 --- a/recipes-multimedia/tinycompress/tinycompress/0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | From a2892bf5db7520689fa9cb1d1589fa804bd9dc1a Mon Sep 17 00:00:00 2001 | ||
2 | From: Bing Song <bing.song@nxp.com> | ||
3 | Date: Tue, 18 Aug 2020 15:26:51 +0800 | ||
4 | Subject: [PATCH] tinycompress: pass NULL buffer with 0 size to driver. | ||
5 | |||
6 | The NULL buffer with 0 size to indecate driver drain input data with | ||
7 | non-block mode. The defaul drain is block mode. | ||
8 | |||
9 | Upstream-Status: Inappropriate [i.MX specific] | ||
10 | Signed-off-by: Bing Song <bing.song@nxp.com> | ||
11 | --- | ||
12 | src/lib/compress.c | 5 +++-- | ||
13 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/src/lib/compress.c b/src/lib/compress.c | ||
16 | index bba4fcf..d66df0b 100644 | ||
17 | --- a/src/lib/compress.c | ||
18 | +++ b/src/lib/compress.c | ||
19 | @@ -315,7 +315,8 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size | ||
20 | fds.events = POLLOUT; | ||
21 | |||
22 | /*TODO: treat auto start here first */ | ||
23 | - while (size) { | ||
24 | + /* NULL buffer with 0 size for non-block drain */ | ||
25 | + do { | ||
26 | if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &avail)) | ||
27 | return oops(compress, errno, "cannot get avail"); | ||
28 | |||
29 | @@ -357,7 +358,7 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size | ||
30 | size -= written; | ||
31 | cbuf += written; | ||
32 | total += written; | ||
33 | - } | ||
34 | + } while (size); | ||
35 | return total; | ||
36 | } | ||
37 | |||
38 | -- | ||
39 | 2.17.1 | ||
40 | |||
diff --git a/recipes-multimedia/tinycompress/tinycompress/0005-cplay-Support-aac-streams.patch b/recipes-multimedia/tinycompress/tinycompress/0005-cplay-Support-aac-streams.patch deleted file mode 100755 index 2f36551a..00000000 --- a/recipes-multimedia/tinycompress/tinycompress/0005-cplay-Support-aac-streams.patch +++ /dev/null | |||
@@ -1,251 +0,0 @@ | |||
1 | From 2912f8573cea25fbd38ac7a8b68af2ea6a05e599 Mon Sep 17 00:00:00 2001 | ||
2 | From: Zhang Peng <peng.zhang_8@nxp.com> | ||
3 | Date: Wed, 28 Oct 2020 19:08:53 +0800 | ||
4 | Subject: [PATCH] cplay: Support aac streams | ||
5 | |||
6 | Support run aac format streams for cplay. | ||
7 | |||
8 | Upstream-Status: Inappropriate [i.MX specific] | ||
9 | Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com> | ||
10 | --- | ||
11 | src/utils/cplay.c | 210 ++++++++++++++++++++++++++++++++++++++++++++++ | ||
12 | 1 file changed, 210 insertions(+) | ||
13 | |||
14 | diff --git a/src/utils/cplay.c b/src/utils/cplay.c | ||
15 | index 8e3dcbb..2a1464a 100644 | ||
16 | --- a/src/utils/cplay.c | ||
17 | +++ b/src/utils/cplay.c | ||
18 | @@ -245,6 +245,190 @@ static int parse_wav_header(FILE *file, unsigned int *num_channels, unsigned int | ||
19 | return 0; | ||
20 | } | ||
21 | |||
22 | +int find_adts_header(FILE *file, unsigned int *num_channels, unsigned int *sample_rate, unsigned int *format) | ||
23 | +{ | ||
24 | + int ret; | ||
25 | + unsigned char buf[5]; | ||
26 | + | ||
27 | + ret = fread(buf, sizeof(buf), 1, file); | ||
28 | + if (ret < 0) { | ||
29 | + fprintf(stderr, "open file error: %d\n", ret); | ||
30 | + return 0; | ||
31 | + } | ||
32 | + fseek(file, 0, SEEK_SET); | ||
33 | + | ||
34 | + if ((buf[0] != 0xff) || (buf[1] & 0xf0 != 0xf0)) | ||
35 | + return 0; | ||
36 | + /* mpeg id */ | ||
37 | + switch (buf[1]>>3 & 0x1) { | ||
38 | + case 0x0: | ||
39 | + *format = SND_AUDIOSTREAMFORMAT_MP4ADTS; | ||
40 | + break; | ||
41 | + case 0x1: | ||
42 | + *format = SND_AUDIOSTREAMFORMAT_MP2ADTS; | ||
43 | + break; | ||
44 | + default: | ||
45 | + fprintf(stderr, "can't find stream format\n"); | ||
46 | + break; | ||
47 | + } | ||
48 | + /* sample_rate */ | ||
49 | + switch (buf[2]>>2 & 0xf) { | ||
50 | + case 0x0: | ||
51 | + *sample_rate = 96000; | ||
52 | + break; | ||
53 | + case 0x1: | ||
54 | + *sample_rate = 88200; | ||
55 | + break; | ||
56 | + case 0x2: | ||
57 | + *sample_rate = 64000; | ||
58 | + break; | ||
59 | + case 0x3: | ||
60 | + *sample_rate = 48000; | ||
61 | + break; | ||
62 | + case 0x4: | ||
63 | + *sample_rate = 44100; | ||
64 | + break; | ||
65 | + case 0x5: | ||
66 | + *sample_rate = 32000; | ||
67 | + break; | ||
68 | + case 0x6: | ||
69 | + *sample_rate = 24000; | ||
70 | + break; | ||
71 | + case 0x7: | ||
72 | + *sample_rate = 22050; | ||
73 | + break; | ||
74 | + case 0x8: | ||
75 | + *sample_rate = 16000; | ||
76 | + break; | ||
77 | + case 0x9: | ||
78 | + *sample_rate = 12000; | ||
79 | + break; | ||
80 | + case 0xa: | ||
81 | + *sample_rate = 11025; | ||
82 | + break; | ||
83 | + case 0xb: | ||
84 | + *sample_rate = 8000; | ||
85 | + break; | ||
86 | + case 0xc: | ||
87 | + *sample_rate = 7350; | ||
88 | + break; | ||
89 | + default: | ||
90 | + break; | ||
91 | + } | ||
92 | + /* channel */ | ||
93 | + switch (((buf[2]&0x1) << 2) | (buf[3]>>6)) { | ||
94 | + case 1: | ||
95 | + *num_channels = 1; | ||
96 | + break; | ||
97 | + case 2: | ||
98 | + *num_channels = 2; | ||
99 | + break; | ||
100 | + case 3: | ||
101 | + *num_channels = 3; | ||
102 | + break; | ||
103 | + case 4: | ||
104 | + *num_channels = 4; | ||
105 | + break; | ||
106 | + case 5: | ||
107 | + *num_channels = 5; | ||
108 | + break; | ||
109 | + case 6: | ||
110 | + *num_channels = 6; | ||
111 | + break; | ||
112 | + case 7: | ||
113 | + *num_channels = 7; | ||
114 | + break; | ||
115 | + default: | ||
116 | + break; | ||
117 | + } | ||
118 | + return 1; | ||
119 | +} | ||
120 | + | ||
121 | +static const int aac_sample_rates[] = { 96000, 88200, 64000, 48000, 44100, | ||
122 | + 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 | ||
123 | +}; | ||
124 | + | ||
125 | +#define MAX_SR_NUM sizeof(aac_sample_rates)/sizeof(aac_sample_rates[0]) | ||
126 | + | ||
127 | +static int get_sample_rate_from_index(int sr_index) | ||
128 | +{ | ||
129 | + if (sr_index >= 0 && sr_index < MAX_SR_NUM) | ||
130 | + return aac_sample_rates[sr_index]; | ||
131 | + | ||
132 | + return 0; | ||
133 | +} | ||
134 | + | ||
135 | +int find_adif_header(FILE *file, unsigned int *num_channels, unsigned int *sample_rate, unsigned int *format) | ||
136 | +{ | ||
137 | + int ret; | ||
138 | + unsigned char adif_id[4]; | ||
139 | + unsigned char adif_header[20]; | ||
140 | + int bitstream_type; | ||
141 | + int bitrate; | ||
142 | + int object_type; | ||
143 | + int sr_index; | ||
144 | + int skip_size = 0; | ||
145 | + | ||
146 | + ret = fread(adif_id, sizeof(unsigned char), 4, file); | ||
147 | + if (ret < 0) { | ||
148 | + fprintf(stderr, "read data from file err: %d\n", ret); | ||
149 | + return 0; | ||
150 | + } | ||
151 | + /* adif id */ | ||
152 | + if ((adif_id[0] != 0x41) || (adif_id[1] != 0x44) || | ||
153 | + (adif_id[2] != 0x49) || (adif_id[3] != 0x46)) | ||
154 | + return 0; | ||
155 | + | ||
156 | + fread(adif_header, sizeof(unsigned char), 20, file); | ||
157 | + | ||
158 | + /* copyright string */ | ||
159 | + if (adif_header[0] & 0x80) | ||
160 | + skip_size = 9; | ||
161 | + | ||
162 | + bitstream_type = adif_header[0 + skip_size] & 0x10; | ||
163 | + bitrate = | ||
164 | + ((unsigned int) (adif_header[0 + skip_size] & 0x0f) << 19) | | ||
165 | + ((unsigned int) adif_header[1 + skip_size] << 11) | | ||
166 | + ((unsigned int) adif_header[2 + skip_size] << 3) | | ||
167 | + ((unsigned int) adif_header[3 + skip_size] & 0xe0); | ||
168 | + | ||
169 | + if (bitstream_type == 0) { | ||
170 | + object_type = ((adif_header[6 + skip_size] & 0x01) << 1) | | ||
171 | + ((adif_header[7 + skip_size] & 0x80) >> 7); | ||
172 | + sr_index = (adif_header[7 + skip_size] & 0x78) >> 3; | ||
173 | + } | ||
174 | + /* VBR */ | ||
175 | + else { | ||
176 | + object_type = (adif_header[4 + skip_size] & 0x18) >> 3; | ||
177 | + sr_index = ((adif_header[4 + skip_size] & 0x07) << 1) | | ||
178 | + ((adif_header[5 + skip_size] & 0x80) >> 7); | ||
179 | + } | ||
180 | + | ||
181 | + /* sample rate */ | ||
182 | + *sample_rate = get_sample_rate_from_index(sr_index); | ||
183 | + | ||
184 | + /* FIXME: assume channels is 2 */ | ||
185 | + *num_channels = 2; | ||
186 | + | ||
187 | + *format = SND_AUDIOSTREAMFORMAT_ADIF; | ||
188 | + fseek(file, 0, SEEK_SET); | ||
189 | + return 1; | ||
190 | +} | ||
191 | + | ||
192 | +static int parse_aac_header(FILE *file, unsigned int *num_channels, unsigned int *sample_rate, unsigned int *format) | ||
193 | +{ | ||
194 | + if (find_adts_header(file, num_channels, sample_rate, format)) | ||
195 | + return 1; | ||
196 | + else if (find_adif_header(file, num_channels, sample_rate, format)) | ||
197 | + return 1; | ||
198 | + else { | ||
199 | + fprintf(stderr, "can't find streams format\n"); | ||
200 | + return 0; | ||
201 | + } | ||
202 | + | ||
203 | + return 1; | ||
204 | +} | ||
205 | + | ||
206 | static int print_time(struct compress *compress) | ||
207 | { | ||
208 | unsigned int avail; | ||
209 | @@ -513,6 +697,29 @@ void get_codec_pcm(FILE *file, struct compr_config *config, | ||
210 | codec->format = format; | ||
211 | } | ||
212 | |||
213 | +void get_codec_aac(FILE *file, struct compr_config *config, | ||
214 | + struct snd_codec *codec) | ||
215 | +{ | ||
216 | + unsigned int channels, rate, format; | ||
217 | + | ||
218 | + if (parse_aac_header(file, &channels, &rate, &format) == 0) { | ||
219 | + fclose(file); | ||
220 | + exit(EXIT_FAILURE); | ||
221 | + }; | ||
222 | + fseek(file, 0, SEEK_SET); | ||
223 | + | ||
224 | + codec->id = SND_AUDIOCODEC_AAC; | ||
225 | + codec->ch_in = channels; | ||
226 | + codec->ch_out = channels; | ||
227 | + codec->sample_rate = rate; | ||
228 | + codec->bit_rate = 0; | ||
229 | + codec->rate_control = 0; | ||
230 | + codec->profile = SND_AUDIOPROFILE_AAC; | ||
231 | + codec->level = 0; | ||
232 | + codec->ch_mode = 0; | ||
233 | + codec->format = format; | ||
234 | + | ||
235 | +} | ||
236 | void play_samples(char *name, unsigned int card, unsigned int device, | ||
237 | unsigned long buffer_size, unsigned int frag, | ||
238 | unsigned long codec_id, int pause_count, int pause_block, | ||
239 | @@ -544,6 +751,9 @@ void play_samples(char *name, unsigned int card, unsigned int device, | ||
240 | case SND_AUDIOCODEC_PCM: | ||
241 | get_codec_pcm(file, &config, &codec); | ||
242 | break; | ||
243 | + case SND_AUDIOCODEC_AAC: | ||
244 | + get_codec_aac(file, &config, &codec); | ||
245 | + break; | ||
246 | default: | ||
247 | fprintf(stderr, "codec ID %ld is not supported\n", codec_id); | ||
248 | exit(EXIT_FAILURE); | ||
249 | -- | ||
250 | 2.17.1 | ||
251 | |||
diff --git a/recipes-multimedia/tinycompress/tinycompress_1.1.6.bb b/recipes-multimedia/tinycompress/tinycompress_1.1.6.bb deleted file mode 100644 index 5cad5ba6..00000000 --- a/recipes-multimedia/tinycompress/tinycompress_1.1.6.bb +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | DESCRIPTION = "A library to handle compressed formats like MP3 etc." | ||
2 | LICENSE = "LGPL-2.1-only | BSD-3-Clause" | ||
3 | LIC_FILES_CHKSUM = "file://COPYING;md5=cf9105c1a2d4405cbe04bbe3367373a0" | ||
4 | DEPENDS = "alsa-lib" | ||
5 | |||
6 | SRC_URI = "git://git.alsa-project.org/http/tinycompress.git;protocol=https;branch=master \ | ||
7 | file://0001-tinycompress-Add-id3-decoding.patch \ | ||
8 | file://0002-cplay-Support-wave-file.patch \ | ||
9 | file://0003-cplay-Add-pause-feature.patch \ | ||
10 | file://0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch \ | ||
11 | file://0005-cplay-Support-aac-streams.patch \ | ||
12 | " | ||
13 | SRCREV = "995f2ed91045dad8c20485ab1a64727d22cd92e5" | ||
14 | S = "${WORKDIR}/git" | ||
15 | |||
16 | inherit autotools pkgconfig | ||
diff --git a/recipes-multimedia/tinycompress/tinycompress_1.2.5.bb b/recipes-multimedia/tinycompress/tinycompress_1.2.5.bb new file mode 100644 index 00000000..f37e786b --- /dev/null +++ b/recipes-multimedia/tinycompress/tinycompress_1.2.5.bb | |||
@@ -0,0 +1,18 @@ | |||
1 | DESCRIPTION = "A library to handle compressed formats like MP3 etc." | ||
2 | LICENSE = "LGPL-2.1-only | BSD-3-Clause" | ||
3 | LIC_FILES_CHKSUM = "file://COPYING;md5=cf9105c1a2d4405cbe04bbe3367373a0" | ||
4 | DEPENDS = "alsa-lib" | ||
5 | |||
6 | inherit autotools pkgconfig | ||
7 | |||
8 | PV .= "+git" | ||
9 | |||
10 | SRC_URI = "git://github.com/alsa-project/tinycompress.git;protocol=https;branch=master \ | ||
11 | " | ||
12 | SRCREV = "f3ba6e5c2126f2fb07e3d890f990d50c3e204e67" | ||
13 | |||
14 | EXTRA_OECONF:append = " --enable-pcm" | ||
15 | |||
16 | S = "${WORKDIR}/git" | ||
17 | |||
18 | inherit autotools pkgconfig | ||
diff --git a/recipes-security/optee-imx/optee-client-fslc-imx.inc b/recipes-security/optee-imx/optee-client-fslc-imx.inc index 60e9e1fa..7aeff9fd 100644 --- a/recipes-security/optee-imx/optee-client-fslc-imx.inc +++ b/recipes-security/optee-imx/optee-client-fslc-imx.inc | |||
@@ -1,7 +1,36 @@ | |||
1 | # Copyright 2017-2024 NXP | 1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-client-imx.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
2 | 3 | ||
3 | require optee-client-fslc.inc | 4 | require optee-client-fslc.inc |
4 | 5 | ||
5 | SRC_URI += "git://github.com/nxp-imx/imx-optee-client.git;protocol=https;branch=${SRCBRANCH}" | 6 | DEPENDS += "util-linux-libuuid" |
6 | 7 | ||
7 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | 8 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-client:" |
9 | SRC_URI:remove = "git://github.com/OP-TEE/optee_client.git;branch=master;protocol=https" | ||
10 | SRC_URI:prepend = "${OPTEE_CLIENT_SRC};branch=${SRCBRANCH} " | ||
11 | OPTEE_CLIENT_SRC ?= "git://github.com/nxp-imx/imx-optee-client.git;protocol=https" | ||
12 | |||
13 | inherit pkgconfig | ||
14 | |||
15 | EXTRA_OECMAKE += "-DCFG_TEE_CLIENT_LOAD_PATH=${nonarch_base_libdir}" | ||
16 | |||
17 | # Copy the udev rule from the libts recipe for starting tee-supplicant@.service | ||
18 | SRC_URI += "file://tee-udev.rules" | ||
19 | # Unix group name for dev/tee* ownership. | ||
20 | TEE_GROUP_NAME ?= "teeclnt" | ||
21 | do_install:append () { | ||
22 | if ${@oe.utils.conditional('VIRTUAL-RUNTIME_dev_manager', 'busybox-mdev', 'false', 'true', d)}; then | ||
23 | install -d ${D}${nonarch_base_libdir}/udev/rules.d/ | ||
24 | install -m 755 ${UNPACKDIR}/tee-udev.rules ${D}${nonarch_base_libdir}/udev/rules.d/ | ||
25 | sed -i -e "s/teeclnt/${TEE_GROUP_NAME}/" ${D}${nonarch_base_libdir}/udev/rules.d/tee-udev.rules | ||
26 | fi | ||
27 | |||
28 | if [ "${libdir}" != "${nonarch_base_libdir}" ]; then | ||
29 | rm -rf ${D}${libdir}/systemd | ||
30 | fi | ||
31 | } | ||
32 | inherit ${@oe.utils.conditional('VIRTUAL-RUNTIME_dev_manager', 'busybox-mdev', '', 'useradd', d)} | ||
33 | USERADD_PACKAGES = "${PN}" | ||
34 | GROUPADD_PARAM:${PN} = "--system ${TEE_GROUP_NAME}" | ||
35 | |||
36 | FILES:${PN} += "${libdir}/* ${includedir}/*" | ||
diff --git a/recipes-security/optee-imx/optee-client-fslc.inc b/recipes-security/optee-imx/optee-client-fslc.inc index f55f0ab2..455bdd78 100644 --- a/recipes-security/optee-imx/optee-client-fslc.inc +++ b/recipes-security/optee-imx/optee-client-fslc.inc | |||
@@ -1,42 +1,43 @@ | |||
1 | # Copyright 2017-2024 NXP | 1 | # Copied from meta-arm/recipes-security/optee/optee-client.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
3 | |||
4 | SUMMARY = "OP-TEE Client API" | ||
5 | DESCRIPTION = "Open Portable Trusted Execution Environment - Normal World Client side of the TEE" | ||
6 | HOMEPAGE = "https://www.op-tee.org/" | ||
2 | 7 | ||
3 | SUMMARY = "OPTEE Client libs" | ||
4 | HOMEPAGE = "http://www.optee.org/" | ||
5 | LICENSE = "BSD-2-Clause" | 8 | LICENSE = "BSD-2-Clause" |
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" | 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" |
7 | 10 | ||
8 | SRC_URI = "file://tee-supplicant.service" | 11 | inherit systemd update-rc.d cmake |
9 | |||
10 | S = "${WORKDIR}/git" | ||
11 | B = "${WORKDIR}/build" | ||
12 | 12 | ||
13 | inherit python3native systemd features_check pkgconfig | 13 | SRC_URI = " \ |
14 | 14 | git://github.com/OP-TEE/optee_client.git;branch=master;protocol=https \ | |
15 | DEPENDS = "util-linux-libuuid" | 15 | file://tee-supplicant@.service \ |
16 | file://tee-supplicant.sh \ | ||
17 | " | ||
16 | 18 | ||
17 | REQUIRED_MACHINE_FEATURES = "optee" | 19 | UPSTREAM_CHECK_GITTAGREGEX = "^(?P<pver>\d+(\.\d+)+)$" |
18 | 20 | ||
19 | SYSTEMD_SERVICE:${PN} = "tee-supplicant.service" | 21 | S = "${WORKDIR}/git" |
20 | 22 | ||
21 | EXTRA_OEMAKE = " \ | 23 | EXTRA_OECMAKE = " \ |
22 | -C ${S} O=${B} \ | 24 | -DBUILD_SHARED_LIBS=ON \ |
25 | -DCFG_TEE_FS_PARENT_PATH='${localstatedir}/lib/tee' \ | ||
23 | " | 26 | " |
27 | EXTRA_OECMAKE:append:toolchain-clang = " -DCFG_WERROR=0" | ||
24 | 28 | ||
25 | do_install () { | 29 | do_install:append() { |
26 | oe_runmake -C ${S} install | 30 | install -D -p -m0644 ${UNPACKDIR}/tee-supplicant@.service ${D}${systemd_system_unitdir}/tee-supplicant@.service |
27 | 31 | install -D -p -m0755 ${UNPACKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant | |
28 | install -D -p -m0644 ${B}/export/usr/lib/libteec.so.2.0.0 ${D}${libdir}/libteec.so.2.0.0 | ||
29 | ln -sf libteec.so.2.0.0 ${D}${libdir}/libteec.so.2 | ||
30 | ln -sf libteec.so.2.0.0 ${D}${libdir}/libteec.so | ||
31 | |||
32 | install -D -p -m0644 ${B}/export/usr/lib/libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0.1.0 | ||
33 | ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0 | ||
34 | ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so | ||
35 | 32 | ||
36 | install -D -p -m0755 ${B}/export/usr/sbin/tee-supplicant ${D}${bindir}/tee-supplicant | 33 | sed -i -e s:@sysconfdir@:${sysconfdir}:g \ |
34 | -e s:@sbindir@:${sbindir}:g \ | ||
35 | ${D}${systemd_system_unitdir}/tee-supplicant@.service \ | ||
36 | ${D}${sysconfdir}/init.d/tee-supplicant | ||
37 | } | ||
37 | 38 | ||
38 | cp -a ${B}/export/usr/include ${D}${includedir} | 39 | SYSTEMD_SERVICE:${PN} = "tee-supplicant@.service" |
39 | 40 | ||
40 | sed -i -e s:/etc:${sysconfdir}:g -e s:/usr/bin:${bindir}:g ${UNPACKDIR}/tee-supplicant.service | 41 | INITSCRIPT_PACKAGES = "${PN}" |
41 | install -D -p -m0644 ${UNPACKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service | 42 | INITSCRIPT_NAME:${PN} = "tee-supplicant" |
42 | } | 43 | INITSCRIPT_PARAMS:${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ." |
diff --git a/recipes-security/optee-imx/optee-client/tee-supplicant.service b/recipes-security/optee-imx/optee-client/tee-supplicant.service deleted file mode 100644 index 0e2b4f6b..00000000 --- a/recipes-security/optee-imx/optee-client/tee-supplicant.service +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | [Unit] | ||
2 | Description=TEE Supplicant | ||
3 | |||
4 | [Service] | ||
5 | User=root | ||
6 | EnvironmentFile=-/etc/default/tee-supplicant | ||
7 | ExecStart=/usr/bin/tee-supplicant $OPTARGS | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=basic.target | ||
11 | |||
diff --git a/recipes-security/optee-imx/optee-client/tee-supplicant.sh b/recipes-security/optee-imx/optee-client/tee-supplicant.sh new file mode 100644 index 00000000..b4d21950 --- /dev/null +++ b/recipes-security/optee-imx/optee-client/tee-supplicant.sh | |||
@@ -0,0 +1,46 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Source function library | ||
4 | . /etc/init.d/functions | ||
5 | |||
6 | NAME=tee-supplicant | ||
7 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
8 | DESC="OP-TEE Supplicant" | ||
9 | |||
10 | DAEMON=@sbindir@/$NAME | ||
11 | |||
12 | test -f $DAEMON || exit 0 | ||
13 | |||
14 | test -f @sysconfdir@/default/$NAME && . @sysconfdir@/default/$NAME | ||
15 | test -f @sysconfdir@/default/rcS && . @sysconfdir@/default/rcS | ||
16 | |||
17 | SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- -d $OPTARGS" | ||
18 | |||
19 | set -e | ||
20 | |||
21 | case $1 in | ||
22 | start) | ||
23 | echo -n "Starting $DESC: " | ||
24 | start-stop-daemon --start $SSD_OPTIONS | ||
25 | echo "${DAEMON##*/}." | ||
26 | ;; | ||
27 | stop) | ||
28 | echo -n "Stopping $DESC: " | ||
29 | start-stop-daemon --stop $SSD_OPTIONS | ||
30 | echo "${DAEMON##*/}." | ||
31 | ;; | ||
32 | restart|force-reload) | ||
33 | $0 stop | ||
34 | sleep 1 | ||
35 | $0 start | ||
36 | ;; | ||
37 | status) | ||
38 | status ${DAEMON} || exit $? | ||
39 | ;; | ||
40 | *) | ||
41 | echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 | ||
42 | exit 1 | ||
43 | ;; | ||
44 | esac | ||
45 | |||
46 | exit 0 | ||
diff --git a/recipes-security/optee-imx/optee-client/tee-supplicant@.service b/recipes-security/optee-imx/optee-client/tee-supplicant@.service new file mode 100644 index 00000000..72c0b9aa --- /dev/null +++ b/recipes-security/optee-imx/optee-client/tee-supplicant@.service | |||
@@ -0,0 +1,10 @@ | |||
1 | [Unit] | ||
2 | Description=TEE Supplicant on %i | ||
3 | |||
4 | [Service] | ||
5 | User=root | ||
6 | EnvironmentFile=-@sysconfdir@/default/tee-supplicant | ||
7 | ExecStart=@sbindir@/tee-supplicant $OPTARGS | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=basic.target | ||
diff --git a/recipes-security/optee-imx/optee-client/tee-udev.rules b/recipes-security/optee-imx/optee-client/tee-udev.rules new file mode 100644 index 00000000..43fafd8c --- /dev/null +++ b/recipes-security/optee-imx/optee-client/tee-udev.rules | |||
@@ -0,0 +1,7 @@ | |||
1 | # tee devices can only be accessed by the teeclnt group members | ||
2 | KERNEL=="tee[0-9]*", TAG+="systemd", MODE="0660", GROUP="teeclnt" | ||
3 | |||
4 | # If a /dev/teepriv[0-9]* device is detected, start an instance of | ||
5 | # tee-supplicant.service with the device name as parameter | ||
6 | KERNEL=="teepriv[0-9]*", MODE="0660", OWNER="root", GROUP="tee", \ | ||
7 | TAG+="systemd", ENV{SYSTEMD_WANTS}+="tee-supplicant@%k.service" | ||
diff --git a/recipes-security/optee-imx/optee-client_4.2.0.imx.bb b/recipes-security/optee-imx/optee-client_4.2.0.imx.bb deleted file mode 100644 index 59f8c84d..00000000 --- a/recipes-security/optee-imx/optee-client_4.2.0.imx.bb +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | require optee-client-fslc-imx.inc | ||
2 | |||
3 | SRCBRANCH = "lf-6.6.36_2.1.0" | ||
4 | SRCREV = "3eac340a781c00ccd61b151b0e9c22a8c6e9f9f0" | ||
5 | |||
6 | DEPENDS += "util-linux" | ||
7 | EXTRA_OEMAKE += "PKG_CONFIG=pkg-config" | ||
diff --git a/recipes-security/optee-imx/optee-client_4.4.0.imx.bb b/recipes-security/optee-imx/optee-client_4.4.0.imx.bb new file mode 100644 index 00000000..322f998f --- /dev/null +++ b/recipes-security/optee-imx/optee-client_4.4.0.imx.bb | |||
@@ -0,0 +1,4 @@ | |||
1 | require optee-client-fslc-imx.inc | ||
2 | |||
3 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
4 | SRCREV = "d221676a58b305bddbf97db00395205b3038de8e" | ||
diff --git a/recipes-security/optee-imx/optee-fslc.inc b/recipes-security/optee-imx/optee-fslc.inc index 6c96dc2b..6e380e05 100644 --- a/recipes-security/optee-imx/optee-fslc.inc +++ b/recipes-security/optee-imx/optee-fslc.inc | |||
@@ -1,26 +1,40 @@ | |||
1 | HOMEPAGE = "http://www.optee.org/" | 1 | # Copied from meta-arm/recipes-security/optee/optee.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
2 | 3 | ||
3 | inherit python3native features_check | 4 | UPSTREAM_CHECK_GITTAGREGEX = "^(?P<pver>\d+(\.\d+)+)$" |
4 | 5 | ||
5 | REQUIRED_MACHINE_FEATURES = "optee" | 6 | COMPATIBLE_MACHINE ?= "invalid" |
7 | COMPATIBLE_MACHINE:qemuarm64 ?= "qemuarm64" | ||
8 | COMPATIBLE_MACHINE:qemuarm ?= "qemuarm" | ||
9 | # Please add supported machines below or set it in .bbappend or .conf | ||
6 | 10 | ||
7 | DEPENDS = "python3-cryptography-native" | 11 | OPTEEMACHINE ?= "${MACHINE}" |
12 | OPTEEMACHINE:aarch64:qemuall ?= "vexpress-qemu_armv8a" | ||
13 | OPTEEMACHINE:arm:qemuall ?= "vexpress-qemu_virt" | ||
8 | 14 | ||
9 | S = "${WORKDIR}/git" | 15 | OPTEE_ARCH = "null" |
10 | B = "${WORKDIR}/build" | 16 | OPTEE_ARCH:arm = "arm32" |
11 | |||
12 | OPTEE_ARCH:arm = "arm32" | ||
13 | OPTEE_ARCH:aarch64 = "arm64" | 17 | OPTEE_ARCH:aarch64 = "arm64" |
18 | OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}" | ||
19 | |||
20 | OPTEE_TOOLCHAIN = "${@d.getVar('TOOLCHAIN') or 'gcc'}" | ||
21 | OPTEE_COMPILER = "${@bb.utils.contains("BBFILE_COLLECTIONS", "clang-layer", "${OPTEE_TOOLCHAIN}", "gcc", d)}" | ||
14 | 22 | ||
15 | COMPILER ?= "gcc" | 23 | # Set here but not passed to EXTRA_OEMAKE by default as that breaks |
16 | COMPILER:toolchain-clang = "clang" | 24 | # the optee-os build |
25 | TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta" | ||
26 | |||
27 | EXTRA_OEMAKE += "V=1 \ | ||
28 | LIBGCC_LOCATE_CFLAGS='${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \ | ||
29 | COMPILER=${OPTEE_COMPILER} \ | ||
30 | OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${prefix} \ | ||
31 | TEEC_EXPORT=${STAGING_DIR_HOST}${prefix} \ | ||
32 | " | ||
33 | # python3-cryptography needs the legacy provider, so set OPENSSL_MODULES to the | ||
34 | # right path until this is relocated automatically. | ||
35 | export OPENSSL_MODULES="${STAGING_LIBDIR_NATIVE}/ossl-modules" | ||
17 | 36 | ||
18 | CFLAGS += "--sysroot=${STAGING_DIR_HOST}" | 37 | CFLAGS += "--sysroot=${STAGING_DIR_HOST}" |
19 | CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}" | 38 | |
20 | 39 | # See the rationale in https://github.com/f-secure-foundry/advisories/blob/master/Security_Advisory-Ref_FSC-HWSEC-VR2021-0001-OP-TEE_TrustZone_bypass.txt. | |
21 | EXTRA_OEMAKE = " \ | 40 | CVE_STATUS[CVE-2021-36133] = "disputed: devices shipped open for development purposes" |
22 | COMPILER=${COMPILER} \ | ||
23 | OPENSSL_MODULES=${STAGING_LIBDIR_NATIVE}/ossl-modules \ | ||
24 | OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${exec_prefix} \ | ||
25 | -C ${S} O=${B} \ | ||
26 | " | ||
diff --git a/recipes-security/optee-imx/optee-os-common-fslc-imx.inc b/recipes-security/optee-imx/optee-os-common-fslc-imx.inc new file mode 100644 index 00000000..941182fe --- /dev/null +++ b/recipes-security/optee-imx/optee-os-common-fslc-imx.inc | |||
@@ -0,0 +1,62 @@ | |||
1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-os-common-imx.inc. | ||
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
3 | |||
4 | require optee-os-fslc.inc | ||
5 | |||
6 | DEPENDS:append:arm = "u-boot-mkimage-native" | ||
7 | |||
8 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os:" | ||
9 | |||
10 | SRC_URI:remove = "git://github.com/OP-TEE/optee_os.git;branch=master;protocol=https" | ||
11 | SRC_URI:prepend = "${OPTEE_OS_SRC};branch=${SRCBRANCH} " | ||
12 | SRC_URI:append = " file://0007-allow-setting-sysroot-for-clang.patch" | ||
13 | SRC_URI:remove = "file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \ | ||
14 | file://0002-optee-enable-clang-support.patch \ | ||
15 | file://0003-core-link-add-no-warn-rwx-segments.patch" | ||
16 | |||
17 | OPTEE_OS_SRC ?= "git://github.com/nxp-imx/imx-optee-os.git;protocol=https" | ||
18 | |||
19 | inherit features_check | ||
20 | |||
21 | REQUIRED_MACHINE_FEATURES = "optee" | ||
22 | |||
23 | OPTEEMACHINE = "imx-${@d.getVar('MACHINE')[1:]}" | ||
24 | OPTEEMACHINE:imx6qpdlsolox = "imx-mx6qsabresd" | ||
25 | OPTEEMACHINE:mx6ul-nxp-bsp = "imx-mx6ulevk" | ||
26 | OPTEEMACHINE:mx6ull-nxp-bsp = "imx-mx6ullevk" | ||
27 | OPTEEMACHINE:mx6ulz-nxp-bsp = "imx-mx6ulzevk" | ||
28 | OPTEEMACHINE:mx8mq-nxp-bsp = "imx-mx8mqevk" | ||
29 | OPTEEMACHINE:mx8mm-nxp-bsp = "imx-mx8mmevk" | ||
30 | OPTEEMACHINE:mx8mn-nxp-bsp = "imx-mx8mnevk" | ||
31 | OPTEEMACHINE:mx8mp-nxp-bsp = "imx-mx8mpevk" | ||
32 | OPTEEMACHINE:mx8mpul-nxp-bsp = "imx-mx8mpevk" | ||
33 | OPTEEMACHINE:mx8qm-nxp-bsp = "imx-mx8qmmek" | ||
34 | OPTEEMACHINE:mx8qxp-nxp-bsp = "imx-mx8qxpmek" | ||
35 | OPTEEMACHINE:mx8dx-nxp-bsp = "imx-mx8dxmek" | ||
36 | OPTEEMACHINE:mx8dxl-nxp-bsp = "imx-mx8dxlevk" | ||
37 | OPTEEMACHINE:mx8mnul-nxp-bsp = "imx-mx8mnevk" | ||
38 | OPTEEMACHINE:mx8ulp-nxp-bsp = "imx-mx8ulpevk" | ||
39 | OPTEEMACHINE:mx91-nxp-bsp = "imx-mx91evk" | ||
40 | OPTEEMACHINE:mx93-nxp-bsp = "imx-mx93evk" | ||
41 | OPTEEMACHINE:mx95-nxp-bsp = "imx-mx95evk" | ||
42 | |||
43 | # Strip the leading imx- | ||
44 | PLATFORM_FLAVOR = "${@d.getVar('OPTEEMACHINE')[4:]}" | ||
45 | |||
46 | EXTRA_OEMAKE:append = " \ | ||
47 | CFG_TEE_TA_LOG_LEVEL=0 \ | ||
48 | CFG_TEE_CORE_LOG_LEVEL=0 \ | ||
49 | " | ||
50 | |||
51 | EXTRA_OEMAKE:append:imx8mq-lpddr4-wevk = " \ | ||
52 | CFG_CORE_LARGE_PHYS_ADDR=y \ | ||
53 | CFG_CORE_ARM64_PA_BITS=36 \ | ||
54 | CFG_DDR_SIZE=0x100000000 \ | ||
55 | CFG_TZDRAM_START=0xfe000000 \ | ||
56 | " | ||
57 | |||
58 | EXTRA_OEMAKE:append:imx8dxlb0-fips-lpddr4-evk = " \ | ||
59 | CFG_NXP_CAAM=n \ | ||
60 | " | ||
61 | |||
62 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | ||
diff --git a/recipes-security/optee-imx/optee-os-fslc-imx.inc b/recipes-security/optee-imx/optee-os-fslc-imx.inc index f4a532b7..5fe6a75a 100644 --- a/recipes-security/optee-imx/optee-os-fslc-imx.inc +++ b/recipes-security/optee-imx/optee-os-fslc-imx.inc | |||
@@ -1,27 +1,26 @@ | |||
1 | require optee-os-fslc.inc | 1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-os-imx.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
2 | 3 | ||
3 | SRC_URI = "git://github.com/nxp-imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH}" | 4 | require optee-os-common-fslc-imx.inc |
4 | 5 | ||
5 | # The platform flavor corresponds to the Yocto machine without the leading 'i'. | 6 | do_compile:arm() { |
6 | PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}" | 7 | oe_runmake -C ${S} all uTee |
7 | PLATFORM_FLAVOR:imx6qdlsabresd = "mx6qsabresd" | 8 | } |
8 | PLATFORM_FLAVOR:imx6qdlsabreauto = "mx6qsabreauto" | ||
9 | PLATFORM_FLAVOR:imx6qpdlsolox = "mx6qsabresd" | ||
10 | PLATFORM_FLAVOR:mx6ul-nxp-bsp = "mx6ulevk" | ||
11 | PLATFORM_FLAVOR:mx6ull-nxp-bsp = "mx6ullevk" | ||
12 | PLATFORM_FLAVOR:mx6ulz-nxp-bsp = "mx6ulzevk" | ||
13 | PLATFORM_FLAVOR:mx8mq-nxp-bsp = "mx8mqevk" | ||
14 | PLATFORM_FLAVOR:mx8mm-nxp-bsp = "mx8mmevk" | ||
15 | PLATFORM_FLAVOR:mx8mn-nxp-bsp = "mx8mnevk" | ||
16 | PLATFORM_FLAVOR:mx8mnul-nxp-bsp = "mx8mnevk" | ||
17 | PLATFORM_FLAVOR:mx8mp-nxp-bsp = "mx8mpevk" | ||
18 | PLATFORM_FLAVOR:mx8mpul-nxp-bsp = "mx8mpevk" | ||
19 | PLATFORM_FLAVOR:mx8qm-nxp-bsp = "mx8qmmek" | ||
20 | PLATFORM_FLAVOR:mx8qxp-nxp-bsp = "mx8qxpmek" | ||
21 | PLATFORM_FLAVOR:mx8dx-nxp-bsp = "mx8dxmek" | ||
22 | PLATFORM_FLAVOR:mx8dxl-nxp-bsp = "mx8dxlevk" | ||
23 | PLATFORM_FLAVOR:mx8ulp-nxp-bsp = "mx8ulpevk" | ||
24 | PLATFORM_FLAVOR:mx93-nxp-bsp = "mx93evk" | ||
25 | PLATFORM_FLAVOR:mx95-nxp-bsp = "mx95evk" | ||
26 | 9 | ||
27 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | 10 | do_install:append () { |
11 | # Install embedded TAs | ||
12 | install -d ${D}${nonarch_base_libdir}/optee_armtz/ | ||
13 | install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ | ||
14 | } | ||
15 | |||
16 | do_deploy:append() { | ||
17 | cp ${B}/core/tee-raw.bin ${DEPLOYDIR}/${MLPREFIX}optee/tee.${PLATFORM_FLAVOR}.bin | ||
18 | ln -sf ${MLPREFIX}optee/tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/tee.bin | ||
19 | } | ||
20 | |||
21 | do_deploy:append:arm() { | ||
22 | cp ${B}/core/uTee ${DEPLOYDIR}/${MLPREFIX}optee/uTee-${OPTEE_BIN_EXT} | ||
23 | ln -sf ${MLPREFIX}optee/uTee-${OPTEE_BIN_EXT} ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT} | ||
24 | } | ||
25 | |||
26 | FILES:${PN} += "${nonarch_base_libdir}/optee_armtz" | ||
diff --git a/recipes-security/optee-imx/optee-os-fslc.inc b/recipes-security/optee-imx/optee-os-fslc.inc index 61906344..c1f1f48f 100644 --- a/recipes-security/optee-imx/optee-os-fslc.inc +++ b/recipes-security/optee-imx/optee-os-fslc.inc | |||
@@ -1,90 +1,86 @@ | |||
1 | # Copyright (C) 2017-2021,2024 NXP | 1 | # Copied from meta-arm/recipes-security/optee/optee-os.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
3 | |||
4 | SUMMARY = "OP-TEE Trusted OS" | ||
5 | DESCRIPTION = "Open Portable Trusted Execution Environment - Trusted side of the TEE" | ||
6 | HOMEPAGE = "https://www.op-tee.org/" | ||
2 | 7 | ||
3 | SUMMARY = "OPTEE OS" | ||
4 | DESCRIPTION = "OPTEE OS" | ||
5 | LICENSE = "BSD-2-Clause" | 8 | LICENSE = "BSD-2-Clause" |
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" | 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" |
7 | 10 | ||
11 | inherit deploy python3native | ||
8 | require optee-fslc.inc | 12 | require optee-fslc.inc |
9 | 13 | ||
10 | DEPENDS += "python3-pyelftools-native u-boot-mkimage-native" | 14 | CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os" |
15 | |||
16 | DEPENDS = "python3-pyelftools-native python3-cryptography-native" | ||
17 | |||
11 | DEPENDS:append:toolchain-clang = " compiler-rt" | 18 | DEPENDS:append:toolchain-clang = " compiler-rt" |
12 | 19 | ||
13 | inherit deploy autotools | 20 | SRC_URI = "git://github.com/OP-TEE/optee_os.git;branch=master;protocol=https" |
14 | 21 | ||
15 | # Optee-os can be built for 32 bits and 64 bits at the same time | 22 | S = "${WORKDIR}/git" |
16 | # as long as the compilers are correctly defined. | 23 | B = "${WORKDIR}/build" |
17 | # For 64bits, CROSS_COMPILE64 must be set | ||
18 | # When defining CROSS_COMPILE and CROSS_COMPILE64, we assure that | ||
19 | # any 32 or 64 bits builds will pass | ||
20 | EXTRA_OEMAKE += " \ | ||
21 | PLATFORM=imx-${PLATFORM_FLAVOR} \ | ||
22 | CROSS_COMPILE=${HOST_PREFIX} \ | ||
23 | CROSS_COMPILE64=${HOST_PREFIX} \ | ||
24 | CFLAGS32=--sysroot=${STAGING_DIR_HOST} \ | ||
25 | CFLAGS64=--sysroot=${STAGING_DIR_HOST} \ | ||
26 | CFG_TEE_TA_LOG_LEVEL=0 \ | ||
27 | CFG_TEE_CORE_LOG_LEVEL=0 \ | ||
28 | " | ||
29 | 24 | ||
30 | EXTRA_OEMAKE:append:imx8mq-lpddr4-wevk = " \ | 25 | EXTRA_OEMAKE += " \ |
31 | CFG_CORE_LARGE_PHYS_ADDR=y \ | 26 | PLATFORM=${OPTEEMACHINE} \ |
32 | CFG_CORE_ARM64_PA_BITS=36 \ | 27 | CFG_${OPTEE_CORE}_core=y \ |
33 | CFG_DDR_SIZE=0x100000000 \ | 28 | CROSS_COMPILE_core=${HOST_PREFIX} \ |
34 | CFG_TZDRAM_START=0xfe000000 \ | 29 | CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \ |
30 | NOWERROR=1 \ | ||
31 | ta-targets=ta_${OPTEE_ARCH} \ | ||
32 | O=${B} \ | ||
35 | " | 33 | " |
34 | EXTRA_OEMAKE += " HOST_PREFIX=${HOST_PREFIX}" | ||
35 | EXTRA_OEMAKE += " CROSS_COMPILE64=${HOST_PREFIX}" | ||
36 | 36 | ||
37 | LDFLAGS[unexport] = "1" | 37 | LDFLAGS[unexport] = "1" |
38 | CPPFLAGS[unexport] = "1" | 38 | CPPFLAGS[unexport] = "1" |
39 | AS[unexport] = "1" | 39 | AS[unexport] = "1" |
40 | LD[unexport] = "1" | 40 | LD[unexport] = "1" |
41 | 41 | ||
42 | do_configure[noexec] = "1" | ||
43 | |||
44 | do_compile:prepend() { | 42 | do_compile:prepend() { |
45 | PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name) | 43 | PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name) |
46 | } | ||
47 | |||
48 | do_compile:arm () { | ||
49 | oe_runmake all uTee | ||
50 | } | 44 | } |
51 | 45 | ||
52 | do_compile:aarch64 () { | 46 | do_compile() { |
53 | oe_runmake all | 47 | oe_runmake -C ${S} all |
54 | } | 48 | } |
55 | do_compile[cleandirs] = "${B}" | 49 | do_compile[cleandirs] = "${B}" |
56 | 50 | ||
57 | do_deploy () { | 51 | do_install() { |
58 | install -d ${DEPLOYDIR} | 52 | #install core in firmware |
59 | cp ${B}/core/tee-raw.bin ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin | 53 | install -d ${D}${nonarch_base_libdir}/firmware/ |
60 | ln -sf tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/tee.bin | 54 | install -m 644 ${B}/core/*.bin ${B}/core/tee.elf ${D}${nonarch_base_libdir}/firmware/ |
61 | } | ||
62 | 55 | ||
63 | do_deploy:append:arm () { | 56 | #install tas in optee_armtz |
64 | cp ${B}/core/uTee ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT} | 57 | install -d ${D}${nonarch_base_libdir}/optee_armtz/ |
58 | install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz | ||
65 | } | 59 | } |
66 | 60 | ||
67 | do_install () { | 61 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
68 | install -d ${D}${nonarch_base_libdir}/firmware/ | ||
69 | install -m 644 ${B}/core/*.bin ${D}${nonarch_base_libdir}/firmware/ | ||
70 | 62 | ||
71 | # Install embedded TAs | 63 | do_deploy() { |
72 | install -d ${D}${nonarch_base_libdir}/optee_armtz/ | 64 | install -d ${DEPLOYDIR}/${MLPREFIX}optee |
73 | install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ | 65 | install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/${MLPREFIX}optee |
74 | 66 | ||
75 | # Install the TA devkit | 67 | install -d ${DEPLOYDIR}/${MLPREFIX}optee/ta |
76 | install -d ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/ | 68 | install -m 644 ${B}/ta/*/*.elf ${DEPLOYDIR}/${MLPREFIX}optee/ta |
77 | cp -aR ${B}/export-ta_${OPTEE_ARCH}/* \ | ||
78 | ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/ | ||
79 | } | 69 | } |
80 | 70 | ||
81 | addtask deploy after do_compile before do_install | 71 | addtask deploy before do_build after do_install |
82 | 72 | ||
83 | FILES:${PN} = "${nonarch_base_libdir}/firmware/ ${nonarch_base_libdir}/optee_armtz/" | 73 | SYSROOT_DIRS += "${nonarch_base_libdir}/firmware" |
84 | FILES:${PN}-staticdev = "${includedir}/optee/" | ||
85 | RDEPENDS:${PN}-dev += "${PN}-staticdev" | ||
86 | 74 | ||
87 | # FIXME: Build paths are currently embedded | 75 | PACKAGES += "${PN}-ta" |
88 | INSANE_SKIP:${PN}-staticdev += "buildpaths" | 76 | FILES:${PN} = "${nonarch_base_libdir}/firmware/" |
77 | FILES:${PN}-ta = "${nonarch_base_libdir}/optee_armtz/*" | ||
78 | |||
79 | |||
80 | # note: "textrel" is not triggered on all archs | ||
81 | INSANE_SKIP:${PN} = "textrel" | ||
82 | # Build paths are currently embedded | ||
83 | INSANE_SKIP:${PN} += "buildpaths" | ||
84 | INSANE_SKIP:${PN}-dev = "staticdev" | ||
85 | INHIBIT_PACKAGE_STRIP = "1" | ||
89 | 86 | ||
90 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/recipes-security/optee-imx/optee-os-tadevkit-fslc-imx.inc b/recipes-security/optee-imx/optee-os-tadevkit-fslc-imx.inc new file mode 100644 index 00000000..18cf9a37 --- /dev/null +++ b/recipes-security/optee-imx/optee-os-tadevkit-fslc-imx.inc | |||
@@ -0,0 +1,27 @@ | |||
1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-os-tadevkit-imx.inc. | ||
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
3 | |||
4 | require optee-os-common-fslc-imx.inc | ||
5 | |||
6 | SUMMARY = "OP-TEE Trusted OS TA devkit" | ||
7 | DESCRIPTION = "OP-TEE TA devkit for build TAs" | ||
8 | HOMEPAGE = "https://www.op-tee.org/" | ||
9 | |||
10 | DEPENDS += "python3-pycryptodome-native" | ||
11 | |||
12 | do_install() { | ||
13 | #install TA devkit | ||
14 | install -d ${D}${includedir}/optee/export-user_ta/ | ||
15 | for f in ${B}/export-ta_${OPTEE_ARCH}/* ; do | ||
16 | cp -aR $f ${D}${includedir}/optee/export-user_ta/ | ||
17 | done | ||
18 | } | ||
19 | |||
20 | do_deploy() { | ||
21 | echo "Do not inherit do_deploy from optee-os." | ||
22 | } | ||
23 | |||
24 | FILES:${PN} = "${includedir}/optee/" | ||
25 | |||
26 | # Build paths are currently embedded | ||
27 | INSANE_SKIP:${PN}-dev += "buildpaths" | ||
diff --git a/recipes-security/optee-imx/optee-os-tadevkit_4.4.0.imx.bb b/recipes-security/optee-imx/optee-os-tadevkit_4.4.0.imx.bb new file mode 100644 index 00000000..bb2e2cf6 --- /dev/null +++ b/recipes-security/optee-imx/optee-os-tadevkit_4.4.0.imx.bb | |||
@@ -0,0 +1,4 @@ | |||
1 | require optee-os-tadevkit-fslc-imx.inc | ||
2 | |||
3 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
4 | SRCREV = "60beb308810f9561a67fdb435388a64c85eb6dcb" | ||
diff --git a/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch b/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch deleted file mode 100644 index 54fbe541..00000000 --- a/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch +++ /dev/null | |||
@@ -1,245 +0,0 @@ | |||
1 | From ef83625c9a5f50610e25aa860c4b9c5e64723a66 Mon Sep 17 00:00:00 2001 | ||
2 | From: Emekcan Aras <emekcan.aras@arm.com> | ||
3 | Date: Wed, 21 Dec 2022 10:55:58 +0000 | ||
4 | Subject: [PATCH 1/4] core: Define section attributes for clang | ||
5 | |||
6 | Clang's attribute section is not same as gcc, here we need to add flags | ||
7 | to sections so they can be eventually collected by linker into final | ||
8 | output segments. Only way to do so with clang is to use | ||
9 | |||
10 | pragma clang section ... | ||
11 | |||
12 | The behavious is described here [1], this allows us to define names bss | ||
13 | sections. This was not an issue until clang-15 where LLD linker starts | ||
14 | to detect the section flags before merging them and throws the following | ||
15 | errors | ||
16 | |||
17 | | ld.lld: error: section type mismatch for .nozi.kdata_page | ||
18 | | >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS | ||
19 | | >>> output section .nozi: SHT_NOBITS | ||
20 | | | ||
21 | | ld.lld: error: section type mismatch for .nozi.mmu.l2 | ||
22 | | >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS | ||
23 | | >>> output section .nozi: SHT_NOBITS | ||
24 | |||
25 | These sections should be carrying SHT_NOBITS but so far it was not | ||
26 | possible to do so, this patch tries to use clangs pragma to get this | ||
27 | going and match the functionality with gcc. | ||
28 | |||
29 | [1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section | ||
30 | |||
31 | Upstream-Status: Pending | ||
32 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
33 | Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> | ||
34 | --- | ||
35 | |||
36 | core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- | ||
37 | core/arch/arm/mm/core_mmu_lpae.c | 35 +++++++++++++++++++++++++++---- | ||
38 | core/arch/arm/mm/core_mmu_v7.c | 36 +++++++++++++++++++++++++++++--- | ||
39 | core/kernel/thread.c | 13 +++++++++++- | ||
40 | core/mm/pgt_cache.c | 12 ++++++++++- | ||
41 | 5 files changed, 104 insertions(+), 11 deletions(-) | ||
42 | |||
43 | diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c | ||
44 | index 66833b3a0..b3eb9cf9a 100644 | ||
45 | --- a/core/arch/arm/kernel/thread.c | ||
46 | +++ b/core/arch/arm/kernel/thread.c | ||
47 | @@ -45,15 +45,30 @@ static size_t thread_user_kcode_size __nex_bss; | ||
48 | #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ | ||
49 | defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) | ||
50 | long thread_user_kdata_sp_offset __nex_bss; | ||
51 | +#ifdef __clang__ | ||
52 | +#ifndef CFG_VIRTUALIZATION | ||
53 | +#pragma clang section bss=".nozi.kdata_page" | ||
54 | +#else | ||
55 | +#pragma clang section bss=".nex_nozi.kdata_page" | ||
56 | +#endif | ||
57 | +#endif | ||
58 | static uint8_t thread_user_kdata_page[ | ||
59 | ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE, | ||
60 | SMALL_PAGE_SIZE)] | ||
61 | __aligned(SMALL_PAGE_SIZE) | ||
62 | +#ifndef __clang__ | ||
63 | #ifndef CFG_NS_VIRTUALIZATION | ||
64 | - __section(".nozi.kdata_page"); | ||
65 | + __section(".nozi.kdata_page") | ||
66 | #else | ||
67 | - __section(".nex_nozi.kdata_page"); | ||
68 | + __section(".nex_nozi.kdata_page") | ||
69 | #endif | ||
70 | +#endif | ||
71 | + ; | ||
72 | +#endif | ||
73 | + | ||
74 | +/* reset BSS section to default ( .bss ) */ | ||
75 | +#ifdef __clang__ | ||
76 | +#pragma clang section bss="" | ||
77 | #endif | ||
78 | |||
79 | #ifdef ARM32 | ||
80 | diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c | ||
81 | index 4c8b85e39..1885e1d3f 100644 | ||
82 | --- a/core/arch/arm/mm/core_mmu_lpae.c | ||
83 | +++ b/core/arch/arm/mm/core_mmu_lpae.c | ||
84 | @@ -234,19 +234,46 @@ typedef uint16_t l1_idx_t; | ||
85 | typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; | ||
86 | typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; | ||
87 | |||
88 | +#ifdef __clang__ | ||
89 | +#pragma clang section bss=".nozi.mmu.base_table" | ||
90 | +#endif | ||
91 | static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES] | ||
92 | __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE) | ||
93 | - __section(".nozi.mmu.base_table"); | ||
94 | +#ifndef __clang__ | ||
95 | + __section(".nozi.mmu.base_table") | ||
96 | +#endif | ||
97 | +; | ||
98 | +#ifdef __clang__ | ||
99 | +#pragma clang section bss="" | ||
100 | +#endif | ||
101 | |||
102 | +#ifdef __clang__ | ||
103 | +#pragma clang section bss=".nozi.mmu.l2" | ||
104 | +#endif | ||
105 | static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES] | ||
106 | - __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); | ||
107 | + __aligned(XLAT_TABLE_SIZE) | ||
108 | +#ifndef __clang__ | ||
109 | + __section(".nozi.mmu.l2") | ||
110 | +#endif | ||
111 | +; | ||
112 | +#ifdef __clang__ | ||
113 | +#pragma clang section bss="" | ||
114 | +#endif | ||
115 | |||
116 | #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES) | ||
117 | |||
118 | +#ifdef __clang__ | ||
119 | +#pragma clang section bss=".nozi.mmu.l2" | ||
120 | +#endif | ||
121 | /* MMU L2 table for TAs, one for each thread */ | ||
122 | static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS] | ||
123 | - __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); | ||
124 | - | ||
125 | +#ifndef __clang__ | ||
126 | + __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2") | ||
127 | +#endif | ||
128 | +; | ||
129 | +#ifdef __clang__ | ||
130 | +#pragma clang section bss="" | ||
131 | +#endif | ||
132 | /* | ||
133 | * TAs page table entry inside a level 1 page table. | ||
134 | * | ||
135 | diff --git a/core/arch/arm/mm/core_mmu_v7.c b/core/arch/arm/mm/core_mmu_v7.c | ||
136 | index 61e703da8..1960c08ca 100644 | ||
137 | --- a/core/arch/arm/mm/core_mmu_v7.c | ||
138 | +++ b/core/arch/arm/mm/core_mmu_v7.c | ||
139 | @@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_ENTRIES]; | ||
140 | typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; | ||
141 | typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; | ||
142 | |||
143 | +#ifdef __clang__ | ||
144 | +#pragma clang section bss=".nozi.mmu.l1" | ||
145 | +#endif | ||
146 | static l1_xlat_tbl_t main_mmu_l1_ttb | ||
147 | - __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1"); | ||
148 | + __aligned(L1_ALIGNMENT) | ||
149 | +#ifndef __clang__ | ||
150 | + __section(".nozi.mmu.l1") | ||
151 | +#endif | ||
152 | +; | ||
153 | +#ifdef __clang__ | ||
154 | +#pragma clang section bss="" | ||
155 | +#endif | ||
156 | |||
157 | /* L2 MMU tables */ | ||
158 | +#ifdef __clang__ | ||
159 | +#pragma clang section bss=".nozi.mmu.l2" | ||
160 | +#endif | ||
161 | static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES] | ||
162 | - __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2"); | ||
163 | + __aligned(L2_ALIGNMENT) | ||
164 | +#ifndef __clang__ | ||
165 | + __section(".nozi.mmu.l2") | ||
166 | +#endif | ||
167 | +; | ||
168 | +#ifdef __clang__ | ||
169 | +#pragma clang section bss="" | ||
170 | +#endif | ||
171 | |||
172 | /* MMU L1 table for TAs, one for each thread */ | ||
173 | +#ifdef __clang__ | ||
174 | +#pragma clang section bss=".nozi.mmu.ul1" | ||
175 | +#endif | ||
176 | static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS] | ||
177 | - __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1"); | ||
178 | + __aligned(UL1_ALIGNMENT) | ||
179 | +#ifndef __clang__ | ||
180 | + __section(".nozi.mmu.ul1") | ||
181 | +#endif | ||
182 | +; | ||
183 | +#ifdef __clang__ | ||
184 | +#pragma clang section bss="" | ||
185 | +#endif | ||
186 | |||
187 | struct mmu_partition { | ||
188 | l1_xlat_tbl_t *l1_table; | ||
189 | diff --git a/core/kernel/thread.c b/core/kernel/thread.c | ||
190 | index 2a1f22dce..5516b6771 100644 | ||
191 | --- a/core/kernel/thread.c | ||
192 | +++ b/core/kernel/thread.c | ||
193 | @@ -39,13 +39,24 @@ static uint32_t end_canary_value = 0xababab00; | ||
194 | name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1] | ||
195 | #endif | ||
196 | |||
197 | +#define DO_PRAGMA(x) _Pragma (#x) | ||
198 | + | ||
199 | +#ifdef __clang__ | ||
200 | +#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ | ||
201 | +DO_PRAGMA (clang section bss=".nozi_stack." #name) \ | ||
202 | +linkage uint32_t name[num_stacks] \ | ||
203 | + [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ | ||
204 | + STACK_ALIGNMENT) / sizeof(uint32_t)] \ | ||
205 | + __attribute__((aligned(STACK_ALIGNMENT))); \ | ||
206 | +DO_PRAGMA(clang section bss="") | ||
207 | +#else | ||
208 | #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ | ||
209 | linkage uint32_t name[num_stacks] \ | ||
210 | [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ | ||
211 | STACK_ALIGNMENT) / sizeof(uint32_t)] \ | ||
212 | __attribute__((section(".nozi_stack." # name), \ | ||
213 | aligned(STACK_ALIGNMENT))) | ||
214 | - | ||
215 | +#endif | ||
216 | #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack)) | ||
217 | |||
218 | DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE, | ||
219 | diff --git a/core/mm/pgt_cache.c b/core/mm/pgt_cache.c | ||
220 | index 79553c6d2..b9efdf427 100644 | ||
221 | --- a/core/mm/pgt_cache.c | ||
222 | +++ b/core/mm/pgt_cache.c | ||
223 | @@ -410,8 +410,18 @@ void pgt_init(void) | ||
224 | * has a large alignment, while .bss has a small alignment. The current | ||
225 | * link script is optimized for small alignment in .bss | ||
226 | */ | ||
227 | +#ifdef __clang__ | ||
228 | +#pragma clang section bss=".nozi.mmu.l2" | ||
229 | +#endif | ||
230 | static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE] | ||
231 | - __aligned(PGT_SIZE) __section(".nozi.pgt_cache"); | ||
232 | + __aligned(PGT_SIZE) | ||
233 | +#ifndef __clang__ | ||
234 | + __section(".nozi.pgt_cache") | ||
235 | +#endif | ||
236 | + ; | ||
237 | +#ifdef __clang__ | ||
238 | +#pragma clang section bss="" | ||
239 | +#endif | ||
240 | size_t n; | ||
241 | |||
242 | for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) { | ||
243 | -- | ||
244 | 2.43.2 | ||
245 | |||
diff --git a/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch b/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch deleted file mode 100644 index 1c5753c7..00000000 --- a/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch +++ /dev/null | |||
@@ -1,133 +0,0 @@ | |||
1 | From 6f738803a59613ec4a683ddbc1747ebffd75a4e6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jerome Forissier <jerome.forissier@linaro.org> | ||
3 | Date: Tue, 23 Aug 2022 12:31:46 +0000 | ||
4 | Subject: [PATCH 3/4] arm32: libutils, libutee, ta: add .note.GNU-stack section | ||
5 | to | ||
6 | |||
7 | .S files | ||
8 | |||
9 | When building for arm32 with GNU binutils 2.39, the linker outputs | ||
10 | warnings when linking Trusted Applications: | ||
11 | |||
12 | arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack | ||
13 | arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker | ||
14 | |||
15 | We could silence the warning by adding the '-z execstack' option to the | ||
16 | TA link flags, like we did in the parent commit for the TEE core and | ||
17 | ldelf. Indeed, ldelf always allocates a non-executable piece of memory | ||
18 | for the TA to use as a stack. | ||
19 | |||
20 | However it seems preferable to comply with the common ELF practices in | ||
21 | this case. A better fix is therefore to add the missing .note.GNU-stack | ||
22 | sections in the assembler files. | ||
23 | |||
24 | Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
25 | |||
26 | Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> | ||
27 | Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] | ||
28 | Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> | ||
29 | --- | ||
30 | |||
31 | lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ | ||
32 | lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ | ||
33 | lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ | ||
34 | lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ | ||
35 | lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ | ||
36 | lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ | ||
37 | ta/arch/arm/ta_entry_a32.S | 2 ++ | ||
38 | 7 files changed, 14 insertions(+) | ||
39 | |||
40 | diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
41 | index 2dea83ab8..668b65a86 100644 | ||
42 | --- a/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
43 | +++ b/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
44 | @@ -9,6 +9,8 @@ | ||
45 | |||
46 | .section .note.GNU-stack,"",%progbits | ||
47 | |||
48 | + .section .note.GNU-stack,"",%progbits | ||
49 | + | ||
50 | .section .text | ||
51 | .balign 4 | ||
52 | .code 32 | ||
53 | diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S | ||
54 | index 2be73ffad..87ddf1065 100644 | ||
55 | --- a/lib/libutils/ext/arch/arm/atomic_a32.S | ||
56 | +++ b/lib/libutils/ext/arch/arm/atomic_a32.S | ||
57 | @@ -7,6 +7,8 @@ | ||
58 | |||
59 | .section .note.GNU-stack,"",%progbits | ||
60 | |||
61 | + .section .note.GNU-stack,"",%progbits | ||
62 | + | ||
63 | /* uint32_t atomic_inc32(uint32_t *v); */ | ||
64 | FUNC atomic_inc32 , : | ||
65 | ldrex r1, [r0] | ||
66 | diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S | ||
67 | index 54dc3c02d..2f24632b8 100644 | ||
68 | --- a/lib/libutils/ext/arch/arm/mcount_a32.S | ||
69 | +++ b/lib/libutils/ext/arch/arm/mcount_a32.S | ||
70 | @@ -9,6 +9,8 @@ | ||
71 | |||
72 | .section .note.GNU-stack,"",%progbits | ||
73 | |||
74 | + .section .note.GNU-stack,"",%progbits | ||
75 | + | ||
76 | /* | ||
77 | * Convert return address to call site address by subtracting the size of the | ||
78 | * mcount call instruction (blx __gnu_mcount_nc). | ||
79 | diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
80 | index 37ae9ec6f..bc6c48b1a 100644 | ||
81 | --- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
82 | +++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
83 | @@ -7,6 +7,8 @@ | ||
84 | |||
85 | .section .note.GNU-stack,"",%progbits | ||
86 | |||
87 | + .section .note.GNU-stack,"",%progbits | ||
88 | + | ||
89 | /* | ||
90 | * signed ret_idivmod_values(signed quot, signed rem); | ||
91 | * return quotient and remaining the EABI way (regs r0,r1) | ||
92 | diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
93 | index 5c3353e2c..9fb5e0283 100644 | ||
94 | --- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
95 | +++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
96 | @@ -7,6 +7,8 @@ | ||
97 | |||
98 | .section .note.GNU-stack,"",%progbits | ||
99 | |||
100 | + .section .note.GNU-stack,"",%progbits | ||
101 | + | ||
102 | /* | ||
103 | * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) | ||
104 | */ | ||
105 | diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
106 | index f8a0b70df..37d7cb88e 100644 | ||
107 | --- a/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
108 | +++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
109 | @@ -53,6 +53,8 @@ | ||
110 | |||
111 | .section .note.GNU-stack,"",%progbits | ||
112 | |||
113 | + .section .note.GNU-stack,"",%progbits | ||
114 | + | ||
115 | /* Arm/Thumb interworking support: | ||
116 | |||
117 | The interworking scheme expects functions to use a BX instruction | ||
118 | diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S | ||
119 | index cd9a12f9d..ccdc19928 100644 | ||
120 | --- a/ta/arch/arm/ta_entry_a32.S | ||
121 | +++ b/ta/arch/arm/ta_entry_a32.S | ||
122 | @@ -7,6 +7,8 @@ | ||
123 | |||
124 | .section .note.GNU-stack,"",%progbits | ||
125 | |||
126 | + .section .note.GNU-stack,"",%progbits | ||
127 | + | ||
128 | /* | ||
129 | * This function is the bottom of the user call stack. Mark it as such so that | ||
130 | * the unwinding code won't try to go further down. | ||
131 | -- | ||
132 | 2.43.2 | ||
133 | |||
diff --git a/recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch b/recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch deleted file mode 100644 index f32b2284..00000000 --- a/recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | From a63f82f74e015eb662242cdb51ef814e3f576829 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jerome Forissier <jerome.forissier@linaro.org> | ||
3 | Date: Fri, 5 Aug 2022 09:48:03 +0200 | ||
4 | Subject: [PATCH 4/4] core: link: add --no-warn-rwx-segments | ||
5 | |||
6 | Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> | ||
7 | Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5474] | ||
8 | |||
9 | binutils ld.bfd generates one RWX LOAD segment by merging several sections | ||
10 | with mixed R/W/X attributes (.text, .rodata, .data). After version 2.38 it | ||
11 | also warns by default when that happens [1], which breaks the build due to | ||
12 | --fatal-warnings. The RWX segment is not a problem for the TEE core, since | ||
13 | that information is not used to set memory permissions. Therefore, silence | ||
14 | the warning. | ||
15 | |||
16 | Link: [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 | ||
17 | Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29448 | ||
18 | Reported-by: Dominique Martinet <dominique.martinet@atmark-techno.com> | ||
19 | Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
20 | Acked-by: Jens Wiklander <jens.wiklander@linaro.org> | ||
21 | Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> | ||
22 | --- | ||
23 | |||
24 | core/arch/arm/kernel/link.mk | 6 ++++-- | ||
25 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
26 | |||
27 | diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk | ||
28 | index 49e9f4fa1..9e1cc172f 100644 | ||
29 | --- a/core/arch/arm/kernel/link.mk | ||
30 | +++ b/core/arch/arm/kernel/link.mk | ||
31 | @@ -37,6 +37,7 @@ link-ldflags += --sort-section=alignment | ||
32 | link-ldflags += --fatal-warnings | ||
33 | link-ldflags += --gc-sections | ||
34 | link-ldflags += $(link-ldflags-common) | ||
35 | +link-ldflags += $(call ld-option,--no-warn-rwx-segments) | ||
36 | |||
37 | link-ldadd = $(LDADD) | ||
38 | link-ldadd += $(ldflags-external) | ||
39 | @@ -61,6 +62,7 @@ link-script-cppflags := \ | ||
40 | $(cppflagscore)) | ||
41 | |||
42 | ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ | ||
43 | + $(call ld-option,--no-warn-rwx-segments) \ | ||
44 | $(link-ldflags-common) \ | ||
45 | $(link-objs) $(link-ldadd) $(libgcccore) | ||
46 | cleanfiles += $(link-out-dir)/all_objs.o | ||
47 | @@ -75,7 +77,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o | ||
48 | $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ | ||
49 | |||
50 | unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ | ||
51 | - $(link-ldflags-common) | ||
52 | + $(link-ldflags-common) $(call ld-option,--no-warn-rwx-segments) | ||
53 | unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) | ||
54 | cleanfiles += $(link-out-dir)/unpaged.o | ||
55 | $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt | ||
56 | @@ -104,7 +106,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o | ||
57 | $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ | ||
58 | |||
59 | init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ | ||
60 | - $(link-ldflags-common) | ||
61 | + $(link-ldflags-common) $(call ld-option,--no-warn-rwx-segments) | ||
62 | init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ | ||
63 | $(libgcccore) | ||
64 | cleanfiles += $(link-out-dir)/init.o | ||
65 | -- | ||
66 | 2.43.2 | ||
67 | |||
diff --git a/recipes-security/optee-imx/optee-os/0002-optee-enable-clang-support.patch b/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch index dbc53542..067ba6eb 100644 --- a/recipes-security/optee-imx/optee-os/0002-optee-enable-clang-support.patch +++ b/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 2ba573c9763329fbfdfacc8393d565ab747cac4d Mon Sep 17 00:00:00 2001 | 1 | From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 |
2 | From: Brett Warren <brett.warren@arm.com> | 2 | From: Brett Warren <brett.warren@arm.com> |
3 | Date: Wed, 23 Sep 2020 09:27:34 +0100 | 3 | Date: Wed, 23 Sep 2020 09:27:34 +0100 |
4 | Subject: [PATCH 2/4] optee: enable clang support | 4 | Subject: [PATCH] optee: enable clang support |
5 | 5 | ||
6 | When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used | 6 | When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used |
7 | to provide a sysroot wasn't included, which results in not locating | 7 | to provide a sysroot wasn't included, which results in not locating |
@@ -10,17 +10,16 @@ compiler-rt. This is mitigated by including the variable as ammended. | |||
10 | Upstream-Status: Pending | 10 | Upstream-Status: Pending |
11 | ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 | 11 | ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 |
12 | Signed-off-by: Brett Warren <brett.warren@arm.com> | 12 | Signed-off-by: Brett Warren <brett.warren@arm.com> |
13 | Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> | ||
14 | --- | ||
15 | 13 | ||
14 | --- | ||
16 | mk/clang.mk | 2 +- | 15 | mk/clang.mk | 2 +- |
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
18 | 17 | ||
19 | diff --git a/mk/clang.mk b/mk/clang.mk | 18 | diff --git a/mk/clang.mk b/mk/clang.mk |
20 | index a045beee8..1ebe2f702 100644 | 19 | index c141a3f2..7d067cc0 100644 |
21 | --- a/mk/clang.mk | 20 | --- a/mk/clang.mk |
22 | +++ b/mk/clang.mk | 21 | +++ b/mk/clang.mk |
23 | @@ -30,7 +30,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ | 22 | @@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ |
24 | 23 | ||
25 | # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of | 24 | # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of |
26 | # libgcc for clang | 25 | # libgcc for clang |
@@ -29,6 +28,3 @@ index a045beee8..1ebe2f702 100644 | |||
29 | -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) | 28 | -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) |
30 | 29 | ||
31 | # Core ASLR relies on the executable being ready to run from its preferred load | 30 | # Core ASLR relies on the executable being ready to run from its preferred load |
32 | -- | ||
33 | 2.43.2 | ||
34 | |||
diff --git a/recipes-security/optee-imx/optee-os_4.2.0.imx.bb b/recipes-security/optee-imx/optee-os_4.2.0.imx.bb deleted file mode 100644 index ada545a6..00000000 --- a/recipes-security/optee-imx/optee-os_4.2.0.imx.bb +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | # Copyright 2017-2024 NXP | ||
2 | |||
3 | require optee-os-fslc-imx.inc | ||
4 | |||
5 | SRC_URI += " \ | ||
6 | file://0001-core-Define-section-attributes-for-clang.patch \ | ||
7 | file://0002-optee-enable-clang-support.patch \ | ||
8 | file://0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch \ | ||
9 | file://0004-core-link-add-no-warn-rwx-segments.patch \ | ||
10 | " | ||
11 | SRCBRANCH = "lf-6.6.36_2.1.0" | ||
12 | SRCREV = "612bc5a642a4608d282abeee2349d86de996d7ee" | ||
diff --git a/recipes-security/optee-imx/optee-os_4.4.0.imx.bb b/recipes-security/optee-imx/optee-os_4.4.0.imx.bb new file mode 100644 index 00000000..dc6d3901 --- /dev/null +++ b/recipes-security/optee-imx/optee-os_4.4.0.imx.bb | |||
@@ -0,0 +1,6 @@ | |||
1 | # Copyright 2017-2024 NXP | ||
2 | |||
3 | require optee-os-fslc-imx.inc | ||
4 | |||
5 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
6 | SRCREV = "60beb308810f9561a67fdb435388a64c85eb6dcb" | ||
diff --git a/recipes-security/optee-imx/optee-test-fslc-imx.inc b/recipes-security/optee-imx/optee-test-fslc-imx.inc new file mode 100644 index 00000000..ab16fd22 --- /dev/null +++ b/recipes-security/optee-imx/optee-test-fslc-imx.inc | |||
@@ -0,0 +1,18 @@ | |||
1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-test-imx.inc. | ||
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
3 | |||
4 | require optee-test-fslc.inc | ||
5 | |||
6 | DEPENDS += "openssl" | ||
7 | |||
8 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-test:" | ||
9 | |||
10 | SRC_URI:remove = "git://github.com/OP-TEE/optee_test.git;branch=master;protocol=https" | ||
11 | SRC_URI:prepend = "${OPTEE_TEST_SRC};branch=${SRCBRANCH} " | ||
12 | |||
13 | OPTEE_TEST_SRC ?= "git://github.com/nxp-imx/imx-optee-test.git;protocol=https" | ||
14 | |||
15 | EXTRA_OEMAKE:append:libc-musl = " OPTEE_OPENSSL_EXPORT=${STAGING_INCDIR}" | ||
16 | CFLAGS:append:libc-musl = " -Wno-error=deprecated-declarations" | ||
17 | |||
18 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | ||
diff --git a/recipes-security/optee-imx/optee-test-fslc.inc b/recipes-security/optee-imx/optee-test-fslc.inc index e0c133a7..0fb5f878 100644 --- a/recipes-security/optee-imx/optee-test-fslc.inc +++ b/recipes-security/optee-imx/optee-test-fslc.inc | |||
@@ -1,38 +1,65 @@ | |||
1 | # Copyright (C) 2017-2021 NXP | 1 | # Copied from meta-arm/recipes-security/optee/optee-test.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
3 | |||
4 | SUMMARY = "OP-TEE sanity testsuite" | ||
5 | DESCRIPTION = "Open Portable Trusted Execution Environment - Test suite" | ||
6 | HOMEPAGE = "https://www.op-tee.org/" | ||
2 | 7 | ||
3 | SUMMARY = "OPTEE test" | ||
4 | LICENSE = "BSD-2-Clause & GPL-2.0-only" | 8 | LICENSE = "BSD-2-Clause & GPL-2.0-only" |
5 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" | 9 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" |
6 | 10 | ||
11 | inherit python3native ptest | ||
12 | inherit deploy | ||
7 | require optee-fslc.inc | 13 | require optee-fslc.inc |
8 | 14 | ||
9 | DEPENDS += "optee-os optee-client openssl" | 15 | DEPENDS = "optee-client optee-os-tadevkit python3-cryptography-native openssl" |
16 | |||
17 | SRC_URI = "git://github.com/OP-TEE/optee_test.git;branch=master;protocol=https \ | ||
18 | file://run-ptest \ | ||
19 | " | ||
20 | |||
21 | S = "${WORKDIR}/git" | ||
22 | B = "${WORKDIR}/build" | ||
10 | 23 | ||
11 | EXTRA_OEMAKE += " \ | 24 | EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \ |
12 | TA_DEV_KIT_DIR=${STAGING_INCDIR}/optee/export-user_ta_${OPTEE_ARCH}/ \ | 25 | OPTEE_OPENSSL_EXPORT=${STAGING_INCDIR} \ |
13 | CROSS_COMPILE_HOST=${HOST_PREFIX} \ | 26 | CROSS_COMPILE_HOST=${HOST_PREFIX} \ |
14 | CROSS_COMPILE_TA=${HOST_PREFIX} \ | 27 | CROSS_COMPILE_TA=${HOST_PREFIX} \ |
15 | CROSS_COMPILE=${HOST_PREFIX} \ | 28 | O=${B} \ |
16 | " | 29 | " |
30 | |||
31 | CFLAGS += "-Wno-error=deprecated-declarations" | ||
17 | 32 | ||
18 | do_compile() { | 33 | do_compile() { |
19 | oe_runmake all | 34 | cd ${S} |
35 | # Top level makefile doesn't seem to handle parallel make gracefully | ||
36 | oe_runmake xtest | ||
37 | oe_runmake ta | ||
38 | oe_runmake test_plugin | ||
20 | } | 39 | } |
21 | do_compile[cleandirs] = "${B}" | 40 | do_compile[cleandirs] = "${B}" |
22 | 41 | ||
23 | do_install () { | 42 | do_install () { |
24 | install -d ${D}${bindir} | 43 | install -D -p -m0755 ${B}/xtest/xtest ${D}${bindir}/xtest |
25 | install ${B}/xtest/xtest ${D}${bindir} | ||
26 | 44 | ||
27 | install -d ${D}${nonarch_base_libdir}/optee_armtz | 45 | # install path should match the value set in optee-client/tee-supplicant |
28 | find ${B}/ta -name '*.ta' | while read name; do | 46 | # default TEEC_LOAD_PATH is /lib |
29 | install -m 444 $name ${D}${nonarch_base_libdir}/optee_armtz/ | 47 | mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ |
30 | done | 48 | install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ |
49 | mkdir -p ${D}${libdir}/tee-supplicant/plugins | ||
50 | install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ | ||
51 | } | ||
31 | 52 | ||
32 | install -d ${D}${libdir}/tee-supplicant/plugins/ | 53 | do_deploy () { |
33 | install ${B}/supp_plugin/*plugin ${D}${libdir}/tee-supplicant/plugins/ | 54 | install -d ${DEPLOYDIR}/${MLPREFIX}optee/ta |
55 | install -m 644 ${B}/ta/*/*.elf ${DEPLOYDIR}/${MLPREFIX}optee/ta | ||
34 | } | 56 | } |
35 | 57 | ||
36 | FILES:${PN} += "${nonarch_base_libdir}/optee_armtz/ ${libdir}/tee-supplicant/plugins/" | 58 | addtask deploy before do_build after do_install |
59 | |||
60 | FILES:${PN} += "${nonarch_base_libdir}/optee_armtz/ \ | ||
61 | ${libdir}/tee-supplicant/plugins/ \ | ||
62 | " | ||
37 | 63 | ||
38 | RDEPENDS:${PN} = "optee-os" | 64 | # Imports machine specific configs from staging to build |
65 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/recipes-security/optee-imx/optee-test/run-ptest b/recipes-security/optee-imx/optee-test/run-ptest new file mode 100644 index 00000000..ba88c14d --- /dev/null +++ b/recipes-security/optee-imx/optee-test/run-ptest | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/bin/sh | ||
2 | xtest | awk ' | ||
3 | |||
4 | # Escapes the special characters in a string so that, when | ||
5 | # included in a regex, it represents a literal match | ||
6 | function regx_escape_literal(str, ret) { | ||
7 | ret = str | ||
8 | gsub(/[\[\]\^\$\.\*\?\+\{\}\\\(\)\|]/ , "\\\\&", str) | ||
9 | return str | ||
10 | } | ||
11 | |||
12 | # Returns the simple test formatted name | ||
13 | function name(n, ret) { | ||
14 | ret = n | ||
15 | gsub(/\./, " ", ret) | ||
16 | return ret | ||
17 | } | ||
18 | |||
19 | # Returns the simple test formatted result | ||
20 | function result(res) { | ||
21 | if(res ~ /OK/) { | ||
22 | return "PASS" | ||
23 | } else if(res ~ /FAILED/) { | ||
24 | return "FAIL" | ||
25 | } | ||
26 | } | ||
27 | |||
28 | function parse(name, description, has_subtests, result_line) { | ||
29 | has_subtests = 0 | ||
30 | |||
31 | # Consume every line up to the result line | ||
32 | result_line = " " regx_escape_literal(name) " (OK|FAILED)" | ||
33 | do { | ||
34 | getline | ||
35 | |||
36 | # If this is a subtest (denoted by an "o" bullet) then subparse | ||
37 | if($0 ~ /^o /) { | ||
38 | parse($2, description " : " substr($0, index($0, $3))) | ||
39 | has_subtests = 1 | ||
40 | } | ||
41 | } while ($0 !~ result_line) | ||
42 | |||
43 | # Only print the results for the deepest nested subtests | ||
44 | if(!has_subtests) { | ||
45 | print result($2) ": " name(name) " - " description | ||
46 | } | ||
47 | } | ||
48 | |||
49 | # Start parsing at the beginning of every test (denoted by a "*" bullet) | ||
50 | /^\* / { parse($2, substr($0, index($0, $3))) } | ||
51 | |||
52 | ' | ||
diff --git a/recipes-security/optee-imx/optee-test_4.2.0.imx.bb b/recipes-security/optee-imx/optee-test_4.2.0.imx.bb deleted file mode 100644 index e2cf40e9..00000000 --- a/recipes-security/optee-imx/optee-test_4.2.0.imx.bb +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # Copyright 2017-2024 NXP | ||
2 | |||
3 | require optee-test-fslc.inc | ||
4 | |||
5 | SRC_URI = "git://github.com/nxp-imx/imx-optee-test.git;protocol=https;branch=${SRCBRANCH}" | ||
6 | |||
7 | SRCBRANCH = "lf-6.6.36_2.1.0" | ||
8 | SRCREV = "5b52b48a73b4cc3f228ec66ae6cf9920897bb2e6" | ||
9 | |||
10 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | ||
diff --git a/recipes-security/optee-imx/optee-test_4.4.0.imx.bb b/recipes-security/optee-imx/optee-test_4.4.0.imx.bb new file mode 100644 index 00000000..b4ac1271 --- /dev/null +++ b/recipes-security/optee-imx/optee-test_4.4.0.imx.bb | |||
@@ -0,0 +1,13 @@ | |||
1 | # Copyright 2017-2024 NXP | ||
2 | |||
3 | require optee-test-fslc-imx.inc | ||
4 | |||
5 | # The BSD and GPL license files are now included in the source | ||
6 | # https://github.com/OP-TEE/optee_test/commit/a748f5fcd9ec8a574dc86a5aa56d05bc6ac174e7 | ||
7 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=a8fa504109e4cd7ea575bc49ea4be560 \ | ||
8 | file://LICENSE-BSD;md5=dca16d6efa93b55d0fd662ae5cd6feeb \ | ||
9 | file://LICENSE-GPL;md5=10e86b5d2a6cb0e2b9dcfdd26a9ac58d" | ||
10 | |||
11 | |||
12 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
13 | SRCREV = "dafc98ed8364d7281a9a7f0788dd0a2067844a59" | ||