Merge branch 'dey-3.0/master' into hpalacio/dey-3.0-merge

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2020-09-15 08:53:28 +02:00
commit 8e23fbfd13
93 changed files with 786 additions and 4247 deletions

View File

@ -1,5 +1,5 @@
# Digi Embedded Yocto (DEY) 3.0
## Release 3.0-r1
## Release 3.0-r2
This document provides information about Digi Embedded Yocto,
Digi International's professional embedded Yocto development environment.
@ -43,6 +43,10 @@ Software for the following hardware platforms is in production support:
* [CC-WMX-JN58-NE](https://www.digi.com/products/models/cc-wmx-jn58-ne)
* [CC-MX-JN58-Z1](https://www.digi.com/products/models/cc-mx-jn58-z1)
* CC-WMX-JN7A-NE
* [CC-WMX-JN7A-CBX](https://www.digi.com/products/models/cc-wmx-jn7a-cbx)
* [CC-WMX-JN68-NN](https://www.digi.com/products/models/cc-wmx-jn68-nn)
* [CC-WMX-JN69-NN](https://www.digi.com/products/models/cc-wmx-jn69-nn)
* [CC-MX-JN69-ZN](hhtps://www.digi.com/products/models/cc-mx-jn69-zn)
* ConnectCore 6UL SBC Express
* [CC-WMX6UL-START](https://www.digi.com/products/models/cc-wmx6ul-start) ([Get Started](https://www.digi.com/resources/documentation/digidocs/embedded/dey/3.0/cc6ul/yocto-gs_index))
* [CC-SBE-WMX-JN58](https://www.digi.com/products/models/cc-sbe-wmx-jn58)

View File

@ -7,8 +7,9 @@ include conf/machine/include/ccimx6ul.inc
# U-Boot configurations
# Last one is the default (the one the symlinks point at)
UBOOT_CONFIG ??= "ccimx6ulsbc1GB ccimx6ulsbc"
UBOOT_CONFIG ??= "ccimx6ulsbc1GB ccimx6ulsbc512MB ccimx6ulsbc"
UBOOT_CONFIG[ccimx6ulsbc1GB] = "ccimx6ulsbc1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulsbc512MB] = "ccimx6ulsbc512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulsbc] = "ccimx6ulsbc_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
# U-Boot environment offset (within partition)

View File

@ -7,8 +7,9 @@ include conf/machine/include/ccimx6ul.inc
# U-Boot configurations
# Last one is the default (the one the symlinks point at)
UBOOT_CONFIG ??= "ccimx6ulstarter1GB ccimx6ulstarter"
UBOOT_CONFIG ??= "ccimx6ulstarter1GB ccimx6ulstarter512MB ccimx6ulstarter"
UBOOT_CONFIG[ccimx6ulstarter1GB] = "ccimx6ulstarter1GB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulstarter512MB] = "ccimx6ulstarter512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
# U-Boot environment offset (within partition)

View File

@ -16,6 +16,7 @@ UBOOT_DTB_NAME = "ccimx8mn-dvk.dtb"
KERNEL_DEVICETREE ?= " \
digi/ccimx8mn_ov_bt.dtbo \
digi/ccimx8mn_ov_quad.dtbo \
digi/ccimx8mn_ov_v1.dtbo \
digi/ccimx8mn_ov_wifi.dtbo \
digi/ccimx8mn-dvk.dtb \

View File

@ -23,6 +23,7 @@ KERNEL_DEVICETREE ?= " \
digi/ccimx8x-sbc-pro_ov_lvds1.dtbo \
digi/ccimx8x-sbc-pro_ov_parallel-camera.dtbo \
digi/ccimx8x-sbc-pro_ov_pcie-card.dtbo \
digi/ccimx8x-sbc-pro_ov_hsd101pfw2_lvds.dtbo \
"
SERIAL_CONSOLES ?= "115200;ttyLP2"

View File

@ -62,7 +62,6 @@ VIRTUAL-RUNTIME_initscripts ?= "initscripts"
TRUSTFENCE_SIGN_MODE = "HAB"
# TODO: Encryption not yet supported
TRUSTFENCE_DEK_PATH = "0"
TRUSTFENCE_INITRAMFS_IMAGE = ""
TRUSTFENCE_ENCRYPT_ENVIRONMENT = "0"
# Adding 'wayland' along with 'x11' enables the xwayland backend

View File

@ -70,10 +70,6 @@ VIRTUAL-RUNTIME_initscripts ?= "initscripts"
# TrustFence
TRUSTFENCE_SIGN_MODE = "AHAB"
# TODO: Encryption not yet supported
TRUSTFENCE_DEK_PATH = "0"
TRUSTFENCE_INITRAMFS_IMAGE = ""
TRUSTFENCE_ENCRYPT_ENVIRONMENT = "0"
# Adding 'wayland' along with 'x11' enables the xwayland backend
# Vulkan is necessary for wayland to build

View File

@ -4,15 +4,15 @@
DESCRIPTION = "i.MX System Controller Firmware, customized for Digi platforms"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
LIC_FILES_CHKSUM = "file://COPYING;md5=1b4db4b25c3a1e422c0c0ed64feb65d2"
SECTION = "BSP"
inherit pkgconfig deploy
SRC_URI = "${DIGI_PKG_SRC}/${BPN}-${PV}.tar.gz"
SRC_URI[md5sum] = "24a8d857d5ecc81f08457f2f4512e779"
SRC_URI[sha256sum] = "769282b099f97af6132e75f505056f3e7914dd8557778af8169db28fcf28727a"
SRC_URI[md5sum] = "e9bb8ca081eeec038315de9e6110a3d7"
SRC_URI[sha256sum] = "2d107e56368447c26e73338e90e0c691fceed22682e1907f7f512d1a5a452b91"
S = "${WORKDIR}/${PN}-${PV}"

View File

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Freescale Semiconductor
# Copyright 2017-2019 NXP
# Copyright 2017-2020 NXP
# Copyright (C) 2018 O.S. Systems Software LTDA.
SECTION = "base"
LICENSE = "Proprietary"
@ -9,8 +9,8 @@ SRC_URI = " \
${FSL_MIRROR}/firmware-imx-${PV}.bin;fsl-eula=true \
"
SRC_URI[md5sum] = "ee442e4d975578736f3f72593906f41c"
SRC_URI[sha256sum] = "92c1713f61a99b1ff5046a795789e6021db1e8bb5534c02e4b719f1436e15615"
SRC_URI[md5sum] = "eabb27d28bba375a9f14d6306c07af5f"
SRC_URI[sha256sum] = "5ca1f8b6e6b191594d17ac7b51c38cdbc2ff808d15568ab4b0bbeb5dc6c621f6"
S = "${WORKDIR}/firmware-imx-${PV}"

View File

@ -1,4 +1,4 @@
# Copyright 2018 NXP
# Copyright 2018-2020 NXP
SUMMARY = "Freescale i.MX firmware for 8 family"
DESCRIPTION = "Freescale i.MX firmware for 8 family"

View File

@ -1,4 +1,4 @@
# Copyright 2018 NXP
# Copyright 2018-2020 NXP
SUMMARY = "Freescale i.MX firmware for 8M and 8M Mini family"
DESCRIPTION = "Freescale i.MX firmware for 8M and 8M Mini family"

View File

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Freescale Semiconductor
# Copyright 2017-2019 NXP
# Copyright 2017-2020 NXP
# Copyright (C) 2018 O.S. Systems Software LTDA.
SUMMARY = "Freescale i.MX firmware"
DESCRIPTION = "Freescale i.MX firmware such as for the VPU"
@ -69,6 +69,8 @@ do_install() {
mv ${D}${base_libdir}/firmware/xcvr/ ${D}${base_libdir}/firmware/imx/xcvr/
mv ${D}${base_libdir}/firmware/xuvi/ ${D}${base_libdir}/firmware/imx/xuvi/
# Install HDMI Firmware: hdmitxfw.bin, hdmirxfw.bin & dpfw.bin into lib/firmware/imx/hdmi
install -d ${D}${base_libdir}/firmware/imx/hdmi
mv ${D}${base_libdir}/firmware/hdmi/cadence/hdmitxfw.bin ${D}${base_libdir}/firmware/imx/hdmi
@ -103,7 +105,7 @@ ALLOW_EMPTY_${PN} = "1"
PACKAGES_DYNAMIC = "${PN}-vpu-* ${PN}-sdma-*"
PACKAGES =+ "${PN}-epdc ${PN}-scfw ${PN}-sdma ${PN}-easrc ${PN}-regulatory ${PN}-hdmi ${PN}-xcvr"
PACKAGES =+ "${PN}-epdc ${PN}-sdma ${PN}-easrc ${PN}-regulatory ${PN}-hdmi ${PN}-xcvr ${PN}-xuvi"
RDEPENDS_${PN}-epdc = "bash"
RDEPENDS_${PN}-sdma = "bash"
@ -117,6 +119,6 @@ FILES_${PN}-easrc = "${base_libdir}/firmware/imx/easrc/"
FILES_${PN}-regulatory = "${sysconfdir}/regulatory ${systemd_system_unitdir}/regulatory-firmware.service"
FILES_${PN}-hdmi = "${base_libdir}/firmware/imx/hdmi/ ${sysconfdir}/hdmi ${systemd_system_unitdir}/hdmi-firmware.service"
FILES_${PN}-xcvr = "${base_libdir}/firmware/imx/xcvr/"
FILES_${PN}-xuvi = "${base_libdir}/firmware/imx/xuvi/"
COMPATIBLE_MACHINE = "(imx)"

View File

@ -1,32 +1,50 @@
From: Arturo Buzarra <arturo.buzarra@digi.com>
Date: Fri, 27 Dec 2019 09:42:48 +0100
From: Mike Engel <Mike.Engel@digi.com>
Date: Thu, 16 Jul 2020 12:57:59 +0200
Subject: [PATCH] imx8mn: Disable M7 debug console
The Cortex-M7 uses the UART4 as debug console, and it is
shared with the Cortex-A53.
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
---
plat/imx/imx8mn/imx8mn_bl31_setup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/plat/imx/imx8mn/imx8mn_bl31_setup.c b/plat/imx/imx8mn/imx8mn_bl31_setup.c
index 57db28a..a36c2d5 100644
--- a/plat/imx/imx8mn/imx8mn_bl31_setup.c
+++ b/plat/imx/imx8mn/imx8mn_bl31_setup.c
@@ -242,11 +242,12 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
#endif
bl31_tzc380_setup();
diff --git a/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c b/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
index 841ec5a..ae9aeb9 100644
--- a/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
+++ b/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
@@ -57,7 +57,7 @@ static const struct imx_rdc_cfg rdc[] = {
RDC_MDAn(RDC_MDA_M7, DID1),
/* Assign M7 to domain 1 */
mmio_write_32(IMX_RDC_BASE + 0x204, 0x1);
- mmio_write_32(IMX_RDC_BASE + 0x518, 0xfc);
+ /* Uncomment to use the M7 debug console (shared with A53 UART4) */
+ /*mmio_write_32(IMX_RDC_BASE + 0x518, 0xfc);*/
mmio_write_32(IMX_RDC_BASE + 0x5A4, 0xf3);
}
/* peripherals domain permission */
- RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),
+ /*RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),*/
RDC_PDAPn(RDC_PDAP_UART2, D0R | D0W),
void bl31_plat_arch_setup(void)
/* memory region */
@@ -131,7 +131,7 @@ static void bl31_tzc380_setup(void)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
- static console_uart_t console;
+ /*static console_uart_t console;*/
int i;
/* Enable CSU NS access permission */
@@ -150,10 +150,11 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
imx8m_caam_init();
- console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
+ /* Uncomment to use the M7 debug console (shared with A53 UART4) */
+ /*console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
IMX_CONSOLE_BAUDRATE, &console);
- /* This console is only used for boot stage */
- console_set_scope(&console.console, CONSOLE_FLAG_BOOT);
+ This console is only used for boot stage
+ console_set_scope(&console.console, CONSOLE_FLAG_BOOT);*/
/*
* tell BL3-1 where the non-secure software image is located
--

View File

@ -1,34 +0,0 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRCBRANCH = "imx_5.4.3_2.0.0"
ATF_SRC ?= "git://source.codeaurora.org/external/imx/imx-atf.git;protocol=https"
SRC_URI = "${ATF_SRC};branch=${SRCBRANCH} \
file://0001-Allow-BUILD_STRING-to-be-set-in-.revision-file.patch \
"
SRCREV = "f1a195b5cce64365a7227557a9009a4f545aa02d"
SRC_URI_append_ccimx8mn = " file://0001-imx8mn-Disable-M7-debug-console.patch"
PLATFORM_mx8x = "imx8qx"
# Override PLATFORM_mx8qxp from the included recipe
PLATFORM_mx8qxp = "imx8qx"
PLATFORM_mx8mn = "imx8mn"
PLATFORM_mx8mp = "imx8mp"
PLATFORM_imx8dxlevk = "imx8dxl"
PLATFORM_mx8dxlevk-phantom = "imx8qx"
PLATFORM_mx8dx = "imx8dx"
BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}"
do_compile_append() {
if [ "${BUILD_OPTEE}" = "true" ]; then
oe_runmake clean BUILD_BASE=build-optee
oe_runmake BUILD_BASE=build-optee SPD=opteed bl31
fi
}
do_deploy_append () {
if [ "${BUILD_OPTEE}" = "true" ]; then
install -m 0644 ${S}/build-optee/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/${BOOT_TOOLS}/bl31-${PLATFORM}.bin-optee
fi
}

View File

@ -0,0 +1,64 @@
# Copyright (C) 2017-2020 NXP
DESCRIPTION = "i.MX ARM Trusted Firmware"
SECTION = "BSP"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9"
PV .= "+git${SRCPV}"
SRCBRANCH = "imx_5.4.24_2.1.0"
ATF_SRC ?= "git://source.codeaurora.org/external/imx/imx-atf.git;protocol=https"
SRC_URI = "${ATF_SRC};branch=${SRCBRANCH} \
"
SRCREV = "b0a00f22b09c13572d3e87902a1069dee34763bd"
SRC_URI_append_ccimx8mn = " file://0001-imx8mn-Disable-M7-debug-console.patch"
S = "${WORKDIR}/git"
inherit deploy
BOOT_TOOLS = "imx-boot-tools"
PLATFORM ?= "INVALID"
PLATFORM_imx8dxlevk = "imx8dxl"
PLATFORM_mx8dx = "imx8dx"
PLATFORM_mx8dxlevk-phantom = "imx8qx"
PLATFORM_mx8mm = "imx8mm"
PLATFORM_mx8mn = "imx8mn"
PLATFORM_mx8mp = "imx8mp"
PLATFORM_mx8mq = "imx8mq"
PLATFORM_mx8qm = "imx8qm"
PLATFORM_mx8x = "imx8qx"
EXTRA_OEMAKE += " \
CROSS_COMPILE="${TARGET_PREFIX}" \
PLAT=${PLATFORM} \
"
BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}"
do_compile() {
# Clear LDFLAGS to avoid the option -Wl recognize issue
unset LDFLAGS
oe_runmake bl31
if ${BUILD_OPTEE}; then
oe_runmake clean BUILD_BASE=build-optee
oe_runmake BUILD_BASE=build-optee SPD=opteed bl31
fi
}
do_install[noexec] = "1"
do_deploy() {
install -Dm 0644 ${S}/build/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/${BOOT_TOOLS}/bl31-${PLATFORM}.bin
if ${BUILD_OPTEE}; then
install -m 0644 ${S}/build-optee/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/${BOOT_TOOLS}/bl31-${PLATFORM}.bin-optee
fi
}
addtask deploy after do_compile
PACKAGE_ARCH = "${MACHINE_SOCARCH}"
COMPATIBLE_MACHINE = "(mx8)"

View File

@ -1,4 +1,4 @@
# Copyright 2017-2019 NXP
# Copyright 2017-2020 NXP
require imx-mkimage_git.inc
require recipes-bsp/imx-seco/imx-seco.inc
@ -32,10 +32,10 @@ IMX_M4_DEMOS_mx8x = "imx-m4-demos:do_deploy"
IMX_M4_DEMOS_mx8dxl = "imx-m4-demos:do_deploy"
M4_DEFAULT_IMAGE ?= "m4_image.bin"
M4_DEFAULT_IMAGE_mx8qxp = "imx8qx_m4_TCM_srtm_demo.bin"
M4_DEFAULT_IMAGE_mx8qxp = "imx8qx_m4_TCM_power_mode_switch.bin"
M4_DEFAULT_IMAGE_mx8phantomdxl = "imx8dxl-phantom_m4_TCM_srtm_demo.bin"
M4_DEFAULT_IMAGE_mx8dxl = "imx8dxl-phantom_m4_TCM_srtm_demo.bin"
M4_DEFAULT_IMAGE_mx8dx = "imx8qx_m4_TCM_srtm_demo.bin"
M4_DEFAULT_IMAGE_mx8dxl = "imx8dxl_m4_TCM_power_mode_switch.bin"
M4_DEFAULT_IMAGE_mx8dx = "imx8qx_m4_TCM_power_mode_switch.bin"
# This package aggregates output deployed by other packages,
# so set the appropriate dependencies
@ -126,7 +126,7 @@ compile_mx8() {
cp ${DEPLOY_DIR_IMAGE}/u-boot-spl.bin-${MACHINE}-${UBOOT_CONFIG} \
${BOOT_STAGING}/u-boot-spl.bin
fi
cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_0_TCM_rpmsg_lite_pingpong_rtos_linux_remote_m40.bin \
cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_0_TCM_power_mode_switch_m40.bin \
${BOOT_STAGING}/m4_image.bin
cp ${DEPLOY_DIR_IMAGE}/imx8qm_m4_1_TCM_power_mode_switch_m41.bin \
${BOOT_STAGING}/m4_1_image.bin
@ -153,8 +153,14 @@ do_compile() {
fi
# mkimage for i.MX8
for target in ${IMXBOOT_TARGETS}; do
bbnote "building ${SOC_TARGET} - ${REV_OPTION} ${target}"
make SOC=${SOC_TARGET} ${REV_OPTION} ${target}
if [ "$target" = "flash_linux_m4_no_v2x" ]; then
# Special target build for i.MX 8DXL with V2X off
bbnote "building ${SOC_TARGET} - ${REV_OPTION} V2X=NO ${target}"
make SOC=${SOC_TARGET} ${REV_OPTION} V2X=NO flash_linux_m4
else
bbnote "building ${SOC_TARGET} - ${REV_OPTION} ${target}"
make SOC=${SOC_TARGET} ${REV_OPTION} ${target}
fi
if [ -e "${BOOT_STAGING}/flash.bin" ]; then
cp ${BOOT_STAGING}/flash.bin ${S}/${BOOT_CONFIG_MACHINE}-${target}
fi

View File

@ -89,7 +89,7 @@ do_compile () {
for target in ${IMXBOOT_TARGETS}; do
for rev in ${SOC_REVISIONS}; do
bbnote "building ${SOC_TARGET} - ${ramc} - REV=${rev} ${target}"
make SOC=${SOC_TARGET} dtbs=${UBOOT_DTB_NAME} REV=${rev} ${target}
make SOC=${SOC_TARGET} dtbs=${UBOOT_DTB_NAME} REV=${rev} ${target} > mkimage-${target}.log 2>&1
if [ -e "${BOOT_STAGING}/flash.bin" ]; then
cp ${BOOT_STAGING}/flash.bin ${S}/${UBOOT_PREFIX}-${MACHINE}-${rev}-${ramc}.bin-${target}
fi
@ -177,8 +177,6 @@ do_deploy () {
# Link to default bootable U-Boot filename.
ln -sf ${UBOOT_PREFIX}-${MACHINE}.bin-${IMAGE_IMXBOOT_TARGET} ${BOOTABLE_FILENAME}
cd -
# Link to first "target" mkimage log
ln -sf mkimage-${IMAGE_IMXBOOT_TARGET}.log mkimage.log
else
for ramc in ${UBOOT_RAM_COMBINATIONS}; do
for rev in ${SOC_REVISIONS}; do
@ -213,15 +211,22 @@ do_deploy_append () {
# Sign U-boot image
if [ "${UBOOT_RAM_COMBINATIONS}" = "" ]; then
for target in ${IMXBOOT_TARGETS}; do
# Link to current "target" mkimage log
ln -sf mkimage-${target}.log mkimage.log
trustfence-sign-uboot.sh ${DEPLOYDIR}/${UBOOT_PREFIX}-${MACHINE}.bin-${target} ${DEPLOYDIR}/${UBOOT_PREFIX}-signed-${MACHINE}.bin-${target}
done
else
for ramc in ${UBOOT_RAM_COMBINATIONS}; do
for rev in ${SOC_REVISIONS}; do
for target in ${IMXBOOT_TARGETS}; do
# Do not sign "flash_regression_linux_m4" target files
if [ "${target}" != "flash_regression_linux_m4" ]; then
trustfence-sign-uboot.sh ${DEPLOYDIR}/${UBOOT_PREFIX}-${MACHINE}-${rev}-${ramc}.bin-${target} ${DEPLOYDIR}/${UBOOT_PREFIX}-signed-${MACHINE}-${rev}-${ramc}.bin-${target}
# Link to current "target" mkimage log
ln -sf mkimage-${target}.log mkimage.log
trustfence-sign-uboot.sh ${DEPLOYDIR}/${UBOOT_PREFIX}-${MACHINE}-${rev}-${ramc}.bin-${target} ${DEPLOYDIR}/${UBOOT_PREFIX}-signed-${MACHINE}-${rev}-${ramc}.bin-${target}
if [ "${TRUSTFENCE_DEK_PATH}" != "0" ]; then
export ENABLE_ENCRYPTION=y
trustfence-sign-uboot.sh ${DEPLOYDIR}/${UBOOT_PREFIX}-${MACHINE}-${rev}-${ramc}.bin-${target} ${DEPLOYDIR}/${UBOOT_PREFIX}-encrypted-${MACHINE}-${rev}-${ramc}.bin-${target}
unset ENABLE_ENCRYPTION
fi
done
done

View File

@ -2,10 +2,10 @@
DEPENDS = "zlib openssl"
SRCBRANCH = "imx_5.4.3_2.0.0"
SRCBRANCH = "imx_5.4.24_2.1.0"
IMX_MKIMAGE_SRC ?= "git://source.codeaurora.org/external/imx/imx-mkimage.git;protocol=https"
SRC_URI = "${IMX_MKIMAGE_SRC};branch=${SRCBRANCH}"
SRCREV = "0fcc82965c695f4754b87ae09b1ec79c0ce6c3b2"
SRCREV = "6745ccdcf15384891639b7ced3aa6ce938682365"
S = "${WORKDIR}/git"
BOOT_TOOLS = "imx-boot-tools"

View File

@ -4,14 +4,14 @@ SUMMARY = "NXP i.MX SECO library"
DESCRIPTION = "NXP IMX SECO library"
SECTION = "base"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://LA_OPT_NXP_Software_License.htm;md5=6a8fcab25f3d3f5c2898456114b91f44"
LIC_FILES_CHKSUM = "file://EULA.txt;md5=228c72f2a91452b8a03c4cab30f30ef9"
DEPENDS = "zlib"
SRCBRANCH = "imx_5.4.3_2.0.0"
SRCBRANCH = "imx_5.4.24_2.1.0"
SECO_LIB_SRC ?= "git://github.com/NXP/imx-seco-libs.git;protocol=https"
SRC_URI = "${SECO_LIB_SRC};branch=${SRCBRANCH}"
SRCREV = "0fe2ad0d0f0ef88387aaf72e7a23c9b598340c3b"
SRCREV = "a4faaa474e49fa0d3668db466739834fe45a6767"
S = "${WORKDIR}/git"

View File

@ -11,8 +11,8 @@ inherit fsl-eula-unpack deploy
SRC_URI = "${FSL_MIRROR}/${BP}.bin;fsl-eula=true"
SRC_URI[md5sum] = "bd0aecaa6d6e031003de648387db029d"
SRC_URI[sha256sum] = "7eb4e4695a00ed259177b7ccc4c3b8643c6479502e9365e9d83df906c52fb8d6"
SRC_URI[md5sum] = "22a47e14e3f2e713b4b1b2b7ff768b11"
SRC_URI[sha256sum] = "52ba07633e0f8707d8c26724b5cd03ef96444c8de1e0e134acac50acacf3e7dd"
do_compile[noexec] = "1"

View File

@ -1,19 +1,19 @@
# Copyright (C) 2013-2018 O.S. Systems Software LTDA.
# Copyright (C) 2013-2016 Freescale Semiconductor
# Copyright 2017-2018 NXP
# Copyright 2017-2020 NXP
DESCRIPTION = "Freescale VPU library"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://COPYING;md5=72c0f70181bb6e83eee6aab8de12a9f3"
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
PROVIDES = "virtual/imxvpu"
RPROVIDES_${PN} = "virtual/imxvpu"
PE = "1"
SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true"
SRC_URI[md5sum] = "12d42949b342b50365d24d148e67cf28"
SRC_URI[sha256sum] = "8b9fd257a2dd79dae1e208f08e56a4a47550b892a6f4e3b8fee0d6cbeb09ec12"
SRC_URI = "${FSL_MIRROR}/${BP}.bin;fsl-eula=true"
SRC_URI[md5sum] = "6d6302189a6704874375afe62a65def0"
SRC_URI[sha256sum] = "87cb799a57df654db29403cb74a75ca5185a1517022d3a4a16b8d69056c36127"
inherit fsl-eula-unpack use-imx-headers

View File

@ -5,7 +5,7 @@ i.MX processors that integrate the HAB library in the internal boot ROM."
HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL"
LICENSE = "CLOSED"
DEPENDS = "openssl"
DEPENDS = "openssl byacc flex"
SRC_URI = " \
${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tgz', '', d)} \
@ -15,7 +15,6 @@ SRC_URI = " \
file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \
file://0005-ahab_pki_tree.sh-automate-script.patch \
file://0006-ahab_pki_tree.sh-use-a-random-password-for-the-defau.patch \
file://Makefile \
"
# Usually local files (with file:// protocol) are not checked for
@ -29,20 +28,18 @@ python() {
d.setVar('PREMIRRORS', "file://cst.* %s \\n %s" % (source_mirror_url, premirrors))
}
S = "${WORKDIR}/release"
do_configure() {
cp -f ${WORKDIR}/Makefile .
}
S = "${WORKDIR}/cst-${PV}/"
do_compile() {
oe_runmake clean && oe_runmake
cd ${S}/code/cst
oe_runmake OSTYPE=linux64 clean
oe_runmake OSTYPE=linux64 rel_bin
}
do_install() {
install -d ${D}${bindir}
install -m 0755 linux64/cst ${D}${bindir}/cst
install -m 0755 $(find linux64 -type f -name srktool) ${D}${bindir}/srktool
install -m 0755 $(find ${S}/code/cst/release/linux64 -type f -name cst) ${D}${bindir}/cst
install -m 0755 $(find ${S}/code/cst/release/linux64 -type f -name srktool) ${D}${bindir}/srktool
if [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then
install -m 0755 keys/ahab_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh
elif [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then

View File

@ -12,18 +12,18 @@ https://jira.digi.com/browse/DUB-608
Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
---
code/back_end/src/adapt_layer_openssl.c | 1 +
code/cst/code/back_end/src/adapt_layer_openssl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/code/back_end/src/adapt_layer_openssl.c b/code/back_end/src/adapt_layer_openssl.c
index 8513046269ea..ce6e370f2c6a 100644
--- a/code/back_end/src/adapt_layer_openssl.c
+++ b/code/back_end/src/adapt_layer_openssl.c
@@ -945,6 +945,7 @@ int32_t gen_auth_encrypted_data(const char* in_file,
}
diff --git a/code/cst/code/back_end/src/adapt_layer_openssl.c b/code/cst/code/back_end/src/adapt_layer_openssl.c
index 38b8bf5..f389e23 100755
--- a/code/cst/code/back_end/src/adapt_layer_openssl.c
+++ b/code/cst/code/back_end/src/adapt_layer_openssl.c
@@ -1146,6 +1146,7 @@ int32_t gen_auth_encrypted_data(const char* in_file,
printf("\n");
#endif
+ reuse_dek = 1;
if (reuse_dek) {
fh = fopen(key_file, "rb");
if (fh == NULL) {
if (0 == key_init_done) {
+ reuse_dek = 1;
if (reuse_dek) {
fh = fopen(key_file, "rb");
if (fh == NULL) {

View File

@ -1,521 +1,223 @@
From: "Diaz de Grenu, Jose" <Jose.DiazdeGrenu@digi.com>
Date: Mon, 18 Jul 2016 13:21:11 +0200
From: Arturo Buzarra <arturo.buzarra@digi.com>
Date: Wed, 22 Jul 2020 14:37:03 +0200
Subject: [PATCH] hab4_pki_tree.sh: automate script
Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
This commit introduce a new command line argument to specify the
CSF path folder and prepare it to automate the build process.
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
---
keys/hab4_pki_tree.sh | 347 ++++++++++++++++----------------------------------
1 file changed, 107 insertions(+), 240 deletions(-)
keys/hab4_pki_tree.sh | 78 ++++++++++++++++++++++++++++---------------
1 file changed, 51 insertions(+), 27 deletions(-)
diff --git a/keys/hab4_pki_tree.sh b/keys/hab4_pki_tree.sh
index 7dd67f68c8df..b2c6b71b604e 100755
index 944cc66..39ed3bf 100755
--- a/keys/hab4_pki_tree.sh
+++ b/keys/hab4_pki_tree.sh
@@ -42,84 +42,40 @@
#
#-----------------------------------------------------------------------------
-printf "\n"
-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-printf " This script is a part of the Code signing tools for Freescale's\n"
-printf " High Assurance Boot. It generates a basic PKI tree. The PKI\n"
-printf " tree consists of one or more Super Root Keys (SRK), with each\n"
-printf " SRK having two subordinate keys: \n"
-printf " + a Command Sequence File (CSF) key \n"
-printf " + Image key. \n"
-printf " Additional keys can be added to the PKI tree but a separate \n"
-printf " script is available for this. This this script assumes openssl\n"
-printf " is installed on your system and is included in your search \n"
-printf " path. Finally, the private keys generated are password \n"
-printf " protectedwith the password provided by the file key_pass.txt.\n"
-printf " The format of the file is the password repeated twice:\n"
-printf " my_password\n"
-printf " my_password\n"
-printf " All private keys in the PKI tree are in PKCS #8 format will be\n"
-printf " protected by the same password.\n\n"
-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-
-stty erase 
-
-printf "Do you want to use an existing CA key (y/n)?: \b"
-read existing_ca
-if [ $existing_ca = "y" ]
-then
- printf "Enter CA key name: \b"
- read ca_key
- printf "Enter CA certificate name: \b"
- read ca_cert
@@ -66,6 +66,8 @@ printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
stty erase 
+SCRIPT_BASEDIR="$(cd $(dirname ${0}) && pwd)"
+CSF_PATH="${1}"
+if [ ! -d "${CSF_PATH}" ]; then
+ echo "Invalid CSF_PATH: ${CSF_PATH}"
+ exit 1
fi
-printf "Do you want to use Elliptic Curve Cryptography (y/n)?: \b"
-read use_ecc
-if [ $use_ecc = "y" ]
-then
- printf "Enter length for elliptic curve to be used for PKI tree:\n"
- printf "Possible values p256, p384, p521: \b"
- read kl
-
- # Confirm that a valid key length has been entered
- case $kl in
- p256)
- cn="prime256v1" ;;
- p384)
- cn="secp384r1" ;;
- p521)
- cn="secp521r1" ;;
- *)
- echo Invalid key length. Supported key lengths: 256, 384, 521
- exit 1 ;;
- esac
-else
- printf "Enter key length in bits for PKI tree: \b"
- read kl
-
- # Confirm that a valid key length has been entered
- case $kl in
- 1024) ;;
- 2048) ;;
- 3072) ;;
- 4096) ;;
- *)
- echo Invalid key length. Supported key lengths: 1024, 2048, 3072, 4096
- exit 1 ;;
- esac
-fi
+cd "${CSF_PATH}"
+
if [ $# -gt 0 ]; then
interactive="n"
else
@@ -80,7 +82,7 @@ usage()
echo "$0"
echo
echo "Command Line Mode:"
- echo "$0 -existing-ca <y/n> [-ca-key <CA key name> -ca-cert <CA cert name>] -use-ecc <y/n> -kl <ECC/RSA Key Length> -duration <years> -num-srk <1-4> -srk-ca <y/n>"
+ echo "$0 [-csf-path] <CSF Path> -existing-ca <y/n> [-ca-key <CA key name> -ca-cert <CA cert name>] -use-ecc <y/n> -kl <ECC/RSA Key Length> -duration <years> -num-srk <1-4> -srk-ca <y/n>"
echo "Options:"
echo " -kl: -use-ecc = y then Supported key lengths: p256, p384, p521"
echo " : -use-ecc = n then Supported key lengths: 1024, 2048, 3072, 4096"
@@ -89,10 +91,18 @@ usage()
echo
}
-max_param=16
-min_param=12
+max_param=18
+min_param=1
num_param=1
+# Default values
+existing_ca="n"
+use_ecc="n"
+kl=4096
+duration=10
+num_srk=4
+srk_ca="y"
+
if [ $interactive = "n" ]
then
# Validate command line parameters
@@ -111,6 +121,11 @@ then
while [ $num_param -le $max_param ] && [ "$1" != "" ]
do
case $1 in
+ -csf-path)
+ shift
+ CSF_PATH=$1
+ shift
+ ;;
-existing-ca)
shift
existing_ca=$1
@@ -164,9 +179,8 @@ then
shift
;;
*)
- echo "ERROR: Invalid parameter: $1"
- usage
- exit 1
+ CSF_PATH=$1
+ shift
;;
esac
num_param=$(( num_param + 2 ))
@@ -242,6 +256,16 @@ then
read duration
fi
+# CSF folder structure
+if [ ! -d "${CSF_PATH}" ]; then
+ echo "Invalid CSF_PATH: ${CSF_PATH}"
+ usage
+ exit 1
+fi
+cd "${CSF_PATH}"
+[ -d crts ] || mkdir crts
+[ -d keys ] || mkdir keys
+cd keys
+existing_ca="n"
+kl="4096"
-printf "Enter PKI tree duration (years): \b"
-read duration
+# Confirm that a valid key length has been entered
+case $kl in
+ 1024) ;;
+ 2048) ;;
+ 3072) ;;
+ 4096) ;;
+ *)
+ echo Invalid key length. Supported key lengths: 1024, 2048, 3072, 4096
+ exit 1 ;;
+esac
+
+duration="10"
# Compute validity period
val_period=$((duration*365))
-printf "How many Super Root Keys should be generated? \b"
-read num_srk
+num_srk="4"
# Check that 0 < num_srk <= 4 (Max. number of SRKs)
if [ $num_srk -lt 1 ] || [ $num_srk -gt 4 ]
@@ -128,10 +84,7 @@ then
exit 1
@@ -275,9 +299,9 @@ then
script_name=$0
fi
-# Check if SRKs should be generated as CA certs or user certs
-printf "Do you want the SRK certificates to have the CA flag set? (y/n)?: \b"
-read srk_ca
-
+srk_ca="y"
# Check that the file "serial" is present, if not create it:
if [ ! -f serial ]
script_path=$(cd $(dirname "${script_name}") && pwd -P)
-keys_dir=${script_path}/../keys/
-crts_dir=${script_path}/../crts/
-ca_dir=${script_path}/../ca/
+keys_dir=${CSF_PATH}/keys/
+crts_dir=${CSF_PATH}/crts/
+ca_dir=${CSF_PATH}/ca/
if [ ! -d "${keys_dir}" ]
then
@@ -154,6 +107,9 @@ echo "unique_subject = no" > index.txt.attr
if [ $existing_ca = "n" ]
then
+ ca_key=./CA1_sha256_${kl}_65537_v3_ca_key
+ ca_cert=../crts/CA1_sha256_${kl}_65537_v3_ca_crt
+
# Generate CA key and certificate
# -------------------------------
echo
@@ -161,31 +117,12 @@ then
echo + Generating CA key and certificate +
echo +++++++++++++++++++++++++++++++++++++
echo
-
- if [ $use_ecc = 'n' ]
- then
- ca_key=./CA1_sha256_${kl}_65537_v3_ca_key
- ca_cert=../crts/CA1_sha256_${kl}_65537_v3_ca_crt
- ca_subj_req=/CN=CA1_sha256_${kl}_65537_v3_ca/
- ca_key_type=rsa:${kl}
- else
-
- # Generate Elliptic Curve parameters:
- eck='ec-'$cn'.pem'
- openssl ecparam -out $eck -name $cn
-
- ca_key=./CA1_sha256_${cn}_v3_ca_key
- ca_cert=../crts/CA1_sha256_${cn}_v3_ca_crt
- ca_subj_req=/CN=CA1_sha256_${cn}_v3_ca/
- ca_key_type=ec:${eck}
- fi
-
- openssl req -newkey ${ca_key_type} -passout file:./key_pass.txt \
- -subj ${ca_subj_req} \
- -x509 -extensions v3_ca \
- -keyout temp_ca.pem \
- -out ${ca_cert}.pem \
@@ -291,11 +315,11 @@ then
exit 1
fi
-if [ ! -d "${ca_dir}" ]
-then
- echo ERROR: "Openssl configuration directory ${ca_dir} is missing. Expecting <cst>/ca directory to hold openssl configuration files."
- exit 1
-fi
+# if [ ! -d "${ca_dir}" ]
+# then
+# echo ERROR: "Openssl configuration directory ${ca_dir} is missing. Expecting <cst>/ca directory to hold openssl configuration files."
+# exit 1
+# fi
# Switch current working directory to keys directory, if needed.
if [ "${crt_dir}" != "${keys_dir}" ]
@@ -365,7 +389,7 @@ then
-x509 -extensions v3_ca \
-keyout temp_ca.pem \
-out ${ca_cert}.pem \
- -days ${val_period} -config ../ca/openssl.cnf
+ openssl req -newkey rsa:${kl} -passout file:./key_pass.txt \
+ -subj /CN=CA1_sha256_${kl}_65537_v3_ca/ \
+ -x509 -extensions v3_ca \
+ -keyout temp_ca.pem \
+ -out ${ca_cert}.pem \
+ -days ${val_period} -config "${SCRIPT_BASEDIR}/openssl.cnf"
+ -days ${val_period} -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Generate CA key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
@@ -202,7 +139,7 @@ then
@@ -382,7 +406,7 @@ then
openssl x509 -inform PEM -outform DER -in ${ca_cert}.pem -out ${ca_cert}.der
# Cleanup
- \rm temp_ca.pem
+ rm temp_ca.pem
fi
@@ -219,64 +156,48 @@ then
echo + Generating SRK key and certificate $i +
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- # Generate SRK key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_srk.pem ${kl}
-
- srk_subj_req=/CN=SRK${i}_sha256_${kl}_65537_v3_usr/
- srk_crt=../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt
- srk_key=./SRK${i}_sha256_${kl}_65537_v3_usr_key
- else
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_srk.pem -name ${cn} -genkey
- # Generate SRK key
- openssl ec -in ./temp_srk.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_srk.pem
-
- srk_subj_req=/CN=SRK${i}_sha256_${cn}_v3_usr/
- srk_crt=../crts/SRK${i}_sha256_${cn}_v3_usr_crt
- srk_key=./SRK${i}_sha256_${cn}_v3_usr_key
- fi
+
+ # Generate SRK key
+ openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
+ -out ./temp_srk.pem ${kl}
# Generate SRK certificate signing request
openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${srk_subj_req} \
+ -subj /CN=SRK${i}_sha256_${kl}_65537_v3_usr/ \
-key ./temp_srk.pem \
-out ./temp_srk_req.pem
# Generate SRK certificate (this is a CA cert)
- openssl ca -batch -passin file:./key_pass.txt \
- -md sha256 -outdir ./ \
- -in ./temp_srk_req.pem \
- -cert ${ca_cert}.pem \
+ openssl ca -batch -passin file:./key_pass.txt \
+ -md sha256 -outdir ./ \
+ -in ./temp_srk_req.pem \
+ -cert ${ca_cert}.pem \
@@ -432,10 +456,10 @@ then
-in ./temp_srk_req.pem \
-cert ${ca_cert}.pem \
-keyfile ${ca_key}.pem \
- -extfile ../ca/v3_usr.cnf \
- -out ${srk_crt}.pem \
- -days ${val_period} \
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
-out ${srk_crt}.pem \
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.pem \
+ -days ${val_period} \
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert SRK Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${srk_crt}.pem \
- -out ${srk_crt}.der
+ -in ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.pem \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.der
# Generate SRK key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt \
-passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.der
+ -out ./SRK${i}_sha256_${kl}_65537_v3_usr_key.der
openssl pkcs8 -passin file:./key_pass.txt \
-passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.pem
+ -out ./SRK${i}_sha256_${kl}_65537_v3_usr_key.pem
@@ -456,7 +480,7 @@ then
-out ${srk_key}.pem
# Cleanup
- \rm ./temp_srk.pem ./temp_srk_req.pem
+ rm ./temp_srk.pem ./temp_srk_req.pem
i=$((i+1))
done
else
@@ -293,98 +214,60 @@ do
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- # Generate SRK key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_srk.pem ${kl}
-
- srk_subj_req=/CN=SRK${i}_sha256_${kl}_65537_v3_ca/
- srk_crt=../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt
- srk_key=./SRK${i}_sha256_${kl}_65537_v3_ca_key
- else
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_srk.pem -name ${cn} -genkey
- # Generate SRK key
- openssl ec -in ./temp_srk.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_srk.pem
-
- srk_subj_req=/CN=SRK${i}_sha256_${cn}_v3_ca/
- srk_crt=../crts/SRK${i}_sha256_${cn}_v3_ca_crt
- srk_key=./SRK${i}_sha256_${cn}_v3_ca_key
- fi
+ # Generate SRK key
+ openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
+ -out ./temp_srk.pem ${kl}
+
# Generate SRK certificate signing request
- openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${srk_subj_req} \
- -key ./temp_srk.pem \
- -out ./temp_srk_req.pem
+ openssl req -new -batch -passin file:./key_pass.txt \
+ -subj /CN=SRK${i}_sha256_${kl}_65537_v3_ca/ \
+ -key ./temp_srk.pem \
+ -out ./temp_srk_req.pem
# Generate SRK certificate (this is a CA cert)
- openssl ca -batch -passin file:./key_pass.txt \
- -md sha256 -outdir ./ \
- -in ./temp_srk_req.pem \
- -cert ${ca_cert}.pem \
- -keyfile ${ca_key}.pem \
@@ -505,10 +529,10 @@ do
-in ./temp_srk_req.pem \
-cert ${ca_cert}.pem \
-keyfile ${ca_key}.pem \
- -extfile ../ca/v3_ca.cnf \
- -out ${srk_crt}.pem \
- -days ${val_period} \
+ -extfile "${SCRIPT_BASEDIR}/v3_ca.cnf" \
-out ${srk_crt}.pem \
-days ${val_period} \
- -config ../ca/openssl.cnf
+ openssl ca -batch -passin file:./key_pass.txt \
+ -md sha256 -outdir ./ \
+ -in ./temp_srk_req.pem \
+ -cert ${ca_cert}.pem \
+ -keyfile ${ca_key}.pem \
+ -extfile "${SCRIPT_BASEDIR}/v3_ca.cnf" \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -days ${val_period} \
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert SRK Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${srk_crt}.pem \
- -out ${srk_crt}.der
+ -in ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.der
# Generate SRK key in PKCS #8 format - both PEM and DER
- openssl pkcs8 -passin file:./key_pass.txt \
- -passout file:./key_pass.txt \
+ openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.der
+ -out ./SRK${i}_sha256_${kl}_65537_v3_ca_key.der
- openssl pkcs8 -passin file:./key_pass.txt \
- -passout file:./key_pass.txt \
+ openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_srk.pem \
- -out ${srk_key}.pem
+ -out ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem
# Cleanup
\rm ./temp_srk.pem ./temp_srk_req.pem
+
echo
echo ++++++++++++++++++++++++++++++++++++++++
echo + Generating CSF key and certificate $i +
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- srk_crt_i=../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem
- srk_key_i=./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem
- # Generate key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_csf.pem ${kl}
-
- csf_subj_req=/CN=CSF${i}_1_sha256_${kl}_65537_v3_usr/
- csf_crt=../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt
- csf_key=./CSF${i}_1_sha256_${kl}_65537_v3_usr_key
- else
- srk_crt_i=../crts/SRK${i}_sha256_${cn}_v3_ca_crt.pem
- srk_key_i=./SRK${i}_sha256_${cn}_v3_ca_key.pem
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_csf.pem -name ${cn} -genkey
- # Generate key
- openssl ec -in ./temp_csf.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_csf.pem
-
- csf_subj_req=/CN=CSF${i}_1_sha256_${cn}_v3_usr/
- csf_crt=../crts/CSF${i}_1_sha256_${cn}_v3_usr_crt
- csf_key=./CSF${i}_1_sha256_${cn}_v3_usr_key
- fi
+ # Generate key
+ openssl genrsa -des3 -passout file:./key_pass.txt \
+ -f4 -out ./temp_csf.pem ${kl}
# Generate CSF certificate signing request
openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${csf_subj_req} \
+ -subj /CN=CSF${i}_1_sha256_${kl}_65537_v3_usr/ \
-key ./temp_csf.pem \
-out ./temp_csf_req.pem
@@ -392,31 +275,31 @@ do
openssl ca -batch -md sha256 -outdir ./ \
-passin file:./key_pass.txt \
@@ -574,10 +598,10 @@ do
-in ./temp_csf_req.pem \
- -cert ${srk_crt_i} \
- -keyfile ${srk_key_i} \
-cert ${srk_crt_i} \
-keyfile ${srk_key_i} \
- -extfile ../ca/v3_usr.cnf \
- -out ${csf_crt}.pem \
+ -cert ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -keyfile ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem \
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
+ -out ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
-out ${csf_crt}.pem \
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert CSF Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${csf_crt}.pem \
- -out ${csf_crt}.der
+ -in ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
+ -out ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.der
# Generate CSF key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_csf.pem \
- -out ${csf_key}.der
+ -out ./CSF${i}_1_sha256_${kl}_65537_v3_usr_key.der
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_csf.pem \
- -out ${csf_key}.pem
+ -out ./CSF${i}_1_sha256_${kl}_65537_v3_usr_key.pem
@@ -596,7 +620,7 @@ do
-out ${csf_key}.pem
# Cleanup
- \rm ./temp_csf.pem ./temp_csf_req.pem
+ rm ./temp_csf.pem ./temp_csf_req.pem
echo
echo ++++++++++++++++++++++++++++++++++++++++
@@ -424,61 +307,45 @@ do
echo ++++++++++++++++++++++++++++++++++++++++
echo
- if [ $use_ecc = 'n' ]
- then
- # Generate key
- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \
- -out ./temp_img.pem ${kl}
-
- img_subj_req=/CN=IMG${i}_1_sha256_${kl}_65537_v3_usr/
- img_crt=../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt
- img_key=./IMG${i}_1_sha256_${kl}_65537_v3_usr_key
- else
- # Generate Elliptic Curve parameters:
- openssl ecparam -out ./temp_img.pem -name ${cn} -genkey
- # Generate key
- openssl ec -in ./temp_img.pem -des3 -passout file:./key_pass.txt \
- -out ./temp_img.pem
-
- img_subj_req=/CN=IMG${i}_1_sha256_${cn}_v3_usr/
- img_crt=../crts/IMG${i}_1_sha256_${cn}_v3_usr_crt
- img_key=./IMG${i}_1_sha256_${cn}_v3_usr_key
- fi
+ # Generate key
+ openssl genrsa -des3 -passout file:./key_pass.txt \
+ -f4 -out ./temp_img.pem ${kl}
# Generate IMG certificate signing request
openssl req -new -batch -passin file:./key_pass.txt \
- -subj ${img_subj_req} \
+ -subj /CN=IMG${i}_1_sha256_${kl}_65537_v3_usr/ \
-key ./temp_img.pem \
-out ./temp_img_req.pem
openssl ca -batch -md sha256 -outdir ./ \
-passin file:./key_pass.txt \
@@ -636,10 +660,10 @@ do
-in ./temp_img_req.pem \
- -cert ${srk_crt_i} \
- -keyfile ${srk_key_i} \
-cert ${srk_crt_i} \
-keyfile ${srk_key_i} \
- -extfile ../ca/v3_usr.cnf \
- -out ${img_crt}.pem \
+ -cert ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \
+ -keyfile ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem \
+ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \
+ -out ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
-out ${img_crt}.pem \
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert IMG Certificate to DER format
openssl x509 -inform PEM -outform DER \
- -in ${img_crt}.pem \
- -out ${img_crt}.der
+ -in ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \
+ -out ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.der
# Generate IMG key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform DER -v2 des3 \
-in temp_img.pem \
- -out ${img_key}.der
+ -out ./IMG${i}_1_sha256_${kl}_65537_v3_usr_key.der
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
-topk8 -inform PEM -outform PEM -v2 des3 \
-in temp_img.pem \
- -out ${img_key}.pem
+ -out ./IMG${i}_1_sha256_${kl}_65537_v3_usr_key.pem
@@ -658,7 +682,7 @@ do
-out ${img_key}.pem
# Cleanup
- \rm ./temp_img.pem ./temp_img_req.pem
+ rm ./temp_img.pem ./temp_img_req.pem
+
i=$((i+1))
done

View File

@ -6,14 +6,14 @@ This is needed in order to avoid indefinitely blocking.
Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
---
code/back_end/src/openssl_helper.c | 2 +-
code/cst/code/common/src/openssl_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/back_end/src/openssl_helper.c b/code/back_end/src/openssl_helper.c
index 3c9c779092c5..f0cd4e06f0dd 100644
--- a/code/back_end/src/openssl_helper.c
+++ b/code/back_end/src/openssl_helper.c
@@ -486,7 +486,7 @@ void print_version(void)
diff --git a/code/cst/code/common/src/openssl_helper.c b/code/cst/code/common/src/openssl_helper.c
index 871cf55..b62c8a8 100755
--- a/code/cst/code/common/src/openssl_helper.c
+++ b/code/cst/code/common/src/openssl_helper.c
@@ -414,7 +414,7 @@ void print_version(void)
---------------------------*/
uint32_t seed_prng(uint32_t bytes)
{

View File

@ -9,10 +9,10 @@ Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/keys/hab4_pki_tree.sh b/keys/hab4_pki_tree.sh
index b2c6b71b604e..93347521cea1 100755
index 39ed3bf..ac6fb29 100755
--- a/keys/hab4_pki_tree.sh
+++ b/keys/hab4_pki_tree.sh
@@ -95,9 +95,10 @@ fi
@@ -342,9 +342,10 @@ fi
# Check that the file "key_pass.txt" is present, if not create it with default user/pwd:
if [ ! -f key_pass.txt ]
then

View File

@ -1,166 +1,157 @@
From: Mike Engel <Mike.Engel@digi.com>
Date: Fri, 24 Jan 2020 17:31:50 +0100
From: Arturo Buzarra <arturo.buzarra@digi.com>
Date: Wed, 22 Jul 2020 15:10:21 +0200
Subject: [PATCH] ahab_pki_tree.sh: automate script
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
This commit introduce a new command line argument to specify the
CSF path folder and prepare it to automate the build process.
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
---
keys/ahab_pki_tree.sh | 116 ++++++++++++++++++-------------------------------------
1 file changed, 38 insertions(+), 78 deletions(-)
keys/ahab_pki_tree.sh | 70 +++++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 23 deletions(-)
diff --git a/keys/ahab_pki_tree.sh b/keys/ahab_pki_tree.sh
index 988c27e..00dd143 100755
index f5ab36c..2c16533 100755
--- a/keys/ahab_pki_tree.sh
+++ b/keys/ahab_pki_tree.sh
@@ -47,74 +47,36 @@
#
#-----------------------------------------------------------------------------
-printf "\n"
-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-printf " This script is a part of the Code signing tools for NXP's\n"
-printf " Advanced High Assurance Boot. It generates a basic PKI tree. The\n"
-printf " PKI tree consists of one or more Super Root Keys (SRK), with each\n"
-printf " SRK having one subordinate keys: \n"
-printf " + a Signing key (SGK) \n"
-printf " Additional keys can be added to the PKI tree but a separate \n"
-printf " script is available for this. This this script assumes openssl\n"
-printf " is installed on your system and is included in your search \n"
-printf " path. Finally, the private keys generated are password \n"
-printf " protectedwith the password provided by the file key_pass.txt.\n"
-printf " The format of the file is the password repeated twice:\n"
-printf " my_password\n"
-printf " my_password\n"
-printf " All private keys in the PKI tree are in PKCS #8 format will be\n"
-printf " protected by the same password.\n\n"
-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
-
-stty erase 
-
-printf "Do you want to use an existing CA key (y/n)?: \b"
-read existing_ca
-if [ $existing_ca = "y" ]
-then
- printf "Enter CA key name: \b"
- read ca_key
- printf "Enter CA certificate name: \b"
- read ca_cert
@@ -64,6 +64,8 @@ printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
stty erase 
+SCRIPT_BASEDIR="$(cd $(dirname ${0}) && pwd)"
+CSF_PATH="${1}"
+if [ ! -d "${CSF_PATH}" ]; then
+ echo "Invalid CSF_PATH: ${CSF_PATH}"
+ exit 1
fi
-printf "Do you want to use Elliptic Curve Cryptography (y/n)?: \b"
-read use_ecc
-if [ $use_ecc = "y" ]
-then
- printf "Enter length for elliptic curve to be used for PKI tree:\n"
- printf "Possible values p256, p384, p521: \b"
- read kl
-
- # Confirm that a valid key length has been entered
- case $kl in
- p256)
- cn="prime256v1" ;;
- p384)
- cn="secp384r1" ;;
- p521)
- cn="secp521r1" ;;
- *)
- echo Invalid key length. Supported key lengths: 256, 384, 521
- exit 1 ;;
- esac
-else
- printf "Enter key length in bits for PKI tree: \b"
- read kl
-
- # Confirm that a valid key length has been entered
- case $kl in
- 2048) ;;
- 3072) ;;
- 4096) ;;
- *)
- echo Invalid key length. Supported key lengths: 2048, 3072, 4096
- exit 1 ;;
- esac
-fi
+cd "${CSF_PATH}"
+
if [ $# -gt 0 ]; then
interactive="n"
else
@@ -78,7 +80,7 @@ usage()
echo "$0"
echo
echo "Command Line Mode:"
- echo "$0 -existing-ca <y/n> [-ca-key <CA key name> -ca-cert <CA cert name>] -use-ecc <y/n> -kl <ECC/RSA Key Length> -da <digest algorithm> -duration <years> -srk-ca <y/n>"
+ echo "$0 [-csf-path] <CSF Path> -existing-ca <y/n> [-ca-key <CA key name> -ca-cert <CA cert name>] -use-ecc <y/n> -kl <ECC/RSA Key Length> -da <digest algorithm> -duration <years> -srk-ca <y/n>"
echo "Options:"
echo " -kl: -use-ecc = y then Supported key lengths: p256, p384, p521"
echo " : -use-ecc = n then Supported key lengths: 2048, 3072, 4096"
@@ -88,10 +90,18 @@ usage()
echo
}
-max_param=16
-min_param=12
+max_param=18
+min_param=1
num_param=1
+# Default values
+existing_ca="n"
+use_ecc="y"
+kl=p521
+da=sha512
+duration=10
+srk_ca="y"
+
if [ $interactive = "n" ]
then
# Validate command line parameters
@@ -110,6 +120,11 @@ then
while [ $num_param -le $max_param ] && [ "$1" != "" ]
do
case $1 in
+ -csf-path)
+ shift
+ CSF_PATH=$1
+ shift
+ ;;
-existing-ca)
shift
existing_ca=$1
@@ -163,9 +178,8 @@ then
shift
;;
*)
- echo "ERROR: Invalid parameter: $1"
- usage
- exit 1
+ CSF_PATH=$1
+ shift
;;
esac
num_param=$(( num_param + 2 ))
@@ -255,6 +269,16 @@ then
read duration
fi
+# CSF folder structure
+if [ ! -d "${CSF_PATH}" ]; then
+ echo "Invalid CSF_PATH: ${CSF_PATH}"
+ usage
+ exit 1
+fi
+cd "${CSF_PATH}"
+[ -d crts ] || mkdir crts
+[ -d keys ] || mkdir keys
+
+cd keys
+
+use_ecc="y"
+existing_ca="n"
+kl="p521"
+cn="secp521r1"
+
+# Confirm that a valid key length has been entered
+case $kl in
+ p256);;
+ p384);;
+ p521);;
+ *)
+ echo Invalid key length. Supported key lengths: 256, 384, 521
+ exit 1 ;;
+esac
-printf "Enter the digest algorithm to use: \b"
-read da
+da="sha512"
# Confirm that a valid digest algorithm has been entered
case $da in
@@ -126,8 +88,7 @@ case $da in
exit 1 ;;
esac
-printf "Enter PKI tree duration (years): \b"
-read duration
+duration="10"
# Compute validity period
val_period=$((duration*365))
@@ -144,8 +105,7 @@ then
@@ -286,9 +310,9 @@ then
script_name=$0
fi
# Check if SRKs should be generated as CA certs or user certs
-printf "Do you want the SRK certificates to have the CA flag set? (y/n)?: \b"
-read srk_ca
+srk_ca="y"
# Check that the file "serial" is present, if not create it:
if [ ! -f serial ]
@@ -201,7 +161,7 @@ then
script_path=$(cd $(dirname "${script_name}") && pwd -P)
-keys_dir=${script_path}/../keys/
-crts_dir=${script_path}/../crts/
-ca_dir=${script_path}/../ca/
+keys_dir=${CSF_PATH}/keys/
+crts_dir=${CSF_PATH}/crts/
+ca_dir=${CSF_PATH}/ca/
if [ ! -d "${keys_dir}" ]
then
@@ -302,11 +326,11 @@ then
exit 1
fi
-if [ ! -d "${ca_dir}" ]
-then
- echo ERROR: "Openssl configuration directory ${ca_dir} is missing. Expecting <cst>/ca directory to hold openssl configuration files."
- exit 1
-fi
+# if [ ! -d "${ca_dir}" ]
+# then
+# echo ERROR: "Openssl configuration directory ${ca_dir} is missing. Expecting <cst>/ca directory to hold openssl configuration files."
+# exit 1
+# fi
# Switch current working directory to keys directory, if needed.
if [ "${crt_dir}" != "${keys_dir}" ]
@@ -377,7 +401,7 @@ then
-x509 -extensions v3_ca \
-keyout temp_ca.pem \
-out ${ca_cert}.pem \
- -days ${val_period} -config ../ca/openssl.cnf
+ -days ${val_period} -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Generate CA key in PKCS #8 format - both PEM and DER
openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \
@@ -218,7 +178,7 @@ then
@@ -394,7 +418,7 @@ then
openssl x509 -inform PEM -outform DER -in ${ca_cert}.pem -out ${ca_cert}.der
# Cleanup
- \rm temp_ca.pem
+ rm temp_ca.pem
fi
@@ -292,7 +252,7 @@ then
@@ -468,7 +492,7 @@ then
-out ${srk_key}.pem
# Cleanup
- \rm ./temp_srk.pem ./temp_srk_req.pem
+ rm ./temp_srk.pem ./temp_srk_req.pem
i=$((i+1))
done
else
@@ -341,10 +301,10 @@ do
@@ -517,10 +541,10 @@ do
-in ./temp_srk_req.pem \
-cert ${ca_cert}.pem \
-keyfile ${ca_key}.pem \
@ -170,19 +161,19 @@ index 988c27e..00dd143 100755
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert SRK Certificate to DER format
openssl x509 -inform PEM -outform DER \
@@ -365,7 +325,7 @@ do
@@ -541,7 +565,7 @@ do
-out ${srk_key}.pem
# Cleanup
- \rm ./temp_srk.pem ./temp_srk_req.pem
+ rm ./temp_srk.pem ./temp_srk_req.pem
echo
echo ++++++++++++++++++++++++++++++++++++++++
@@ -410,10 +370,10 @@ do
@@ -586,10 +610,10 @@ do
-in ./temp_sgk_req.pem \
-cert ${srk_crt_i} \
-keyfile ${srk_key_i} \
@ -192,15 +183,15 @@ index 988c27e..00dd143 100755
-days ${val_period} \
- -config ../ca/openssl.cnf
+ -config "${SCRIPT_BASEDIR}/openssl.cnf"
# Convert SGK Certificate to DER format
openssl x509 -inform PEM -outform DER \
@@ -432,7 +392,7 @@ do
@@ -608,7 +632,7 @@ do
-out ${sgk_key}.pem
# Cleanup
- \rm ./temp_sgk.pem ./temp_sgk_req.pem
+ rm ./temp_sgk.pem ./temp_sgk_req.pem
i=$((i+1))
done

View File

@ -9,10 +9,10 @@ Signed-off-by: Mike Engel <Mike.Engel@digi.com>
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/keys/ahab_pki_tree.sh b/keys/ahab_pki_tree.sh
index 00dd143..8b81143 100755
index 2c16533..b85b00d 100755
--- a/keys/ahab_pki_tree.sh
+++ b/keys/ahab_pki_tree.sh
@@ -117,9 +117,10 @@ fi
@@ -353,9 +353,10 @@ fi
# Check that the file "key_pass.txt" is present, if not create it with default user/pwd:
if [ ! -f key_pass.txt ]
then

View File

@ -1,23 +0,0 @@
TARGET = linux64/cst
LIBS = -lfrontend -lcrypto
CFLAGS += -g -Wall
.PHONY: default all clean
default: $(TARGET)
all: default
OBJECTS = code/back_end/src/*.c
HEADERS = code/back_end/hdr
LIBS_PATH = linux64/lib
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(CFLAGS) $(LDFLAGS) -L $(LIBS_PATH) $(LIBS) -I $(HEADERS) -o $@
clean:
-rm -f *.o $(TARGET)

View File

@ -21,10 +21,12 @@ fi
# Determine U-Boot file to program basing on module variant
if test -n "${module_variant}"; then
if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06"; then
if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06" || test "${module_variant}" = "0x0a"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc.imx;
elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05"; then
elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x07"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc1GB.imx;
elif test "${module_variant}" = "0x08" || test "${module_variant}" = "0x09"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc512MB.imx
fi
fi
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
@ -38,6 +40,8 @@ else
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6UL variant:";
echo " - For a SOM with 1GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc1GB.imx";
echo " - For a SOM with 512MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc512MB.imx";
echo " - For a SOM with 256MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc.imx";
echo "";

View File

@ -21,10 +21,12 @@ fi
# Determine U-Boot file to program basing on module variant
if test -n "${module_variant}"; then
if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06"; then
if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06" || test "${module_variant}" = "0x0a; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter.imx;
elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05"; then
elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x07"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter1GB.imx;
elif test "${module_variant}" = "0x08" || test "${module_variant}" = "0x09"; then
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter512MB.imx
fi
fi
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
@ -38,6 +40,8 @@ else
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6UL variant:";
echo " - For a SOM with 1GB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter1GB.imx";
echo " - For a SOM with 512MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter512MB.imx";
echo " - For a SOM with 256MB DDR3, run:";
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter.imx";
echo "";

View File

@ -21,18 +21,23 @@ if test -n "${module_ram}"; then
setexpr module_has_bt ${module_has_bt} / 20000
if test "${module_has_bt}" = "1"; then
setenv overlays cc${soc_type}_ov_bt.dtbo,${overlays}
setenv overlays ccimx8mn_ov_bt.dtbo,${overlays}
fi
if test "${module_has_wifi}" = "1"; then
setenv overlays cc${soc_type}_ov_wifi.dtbo,${overlays}
setenv overlays ccimx8mn_ov_wifi.dtbo,${overlays}
fi
if test "${som_hv}" = "1"; then
setenv overlays cc${soc_type}_ov_v1.dtbo,${overlays}
setenv overlays ccimx8mn_ov_v1.dtbo,${overlays}
fi
fi
# Apply quad overlay if the SOC type is "imx8mn"
if test "${soc_type}" = "imx8mn"; then
setenv overlays ccimx8mn_ov_quad.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.

View File

@ -53,6 +53,9 @@ uuu fb: ucmd setenv forced_update 1
# Update U-Boot
uuu fb: flash bootloader ${INSTALL_UBOOT_FILENAME}
# Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1
# Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults
# - Save the environment

View File

@ -115,6 +115,9 @@ uuu fb: ucmd setenv forced_update 1
# Update U-Boot
uuu fb: flash bootloader ${INSTALL_UBOOT_FILENAME}
# Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1
# Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults
# - Save the environment

View File

@ -2,7 +2,7 @@
require digi-u-boot.inc
SRCBRANCH = "v2017.03/maint"
SRCBRANCH = "v2017.03/master"
SRCREV = "${AUTOREV}"
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x)"

View File

@ -2,7 +2,7 @@
require digi-u-boot.inc
SRCBRANCH = "v2018.03/maint"
SRCBRANCH = "v2018.03/master"
SRCREV = "${AUTOREV}"
COMPATIBLE_MACHINE = "(ccimx8x|ccimx8m)"

View File

@ -5,7 +5,7 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"
DEPENDS += "flex-native bison-native"
SRCBRANCH = "v2019.04/maint"
SRCBRANCH = "v2019.04/master"
SRCREV = "${AUTOREV}"
COMPATIBLE_MACHINE = "(ccimx8x)"

View File

@ -0,0 +1,11 @@
# Copyright (C) 2020 Digi International
require digi-u-boot.inc
LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"
DEPENDS += "flex-native bison-native"
SRCBRANCH = "v2020.04/master"
SRCREV = "${AUTOREV}"
COMPATIBLE_MACHINE = "(ccimx8x)"

View File

@ -13,16 +13,25 @@ SOC_mx8mm = "imx8mm"
SOC_mx8mq = "imx8mq"
SOC_mx8qm = "imx8qm"
SOC_mx8qxp = "imx8qx"
SOC_mx8dxl = "imx8dxl"
IMX_PACKAGE_NAME = "${SOC}-m4-demo-${PV}"
SRC_URI_append = ";name=${SOC}"
SCR = "SCR-${SOC}-m4-demo.txt"
do_install () {
# install elf format binary to /lib/firmware
install -d ${D}${base_libdir}/firmware
install -m 0644 ${S}/*.elf ${D}${base_libdir}/firmware
}
DEPLOY_FILE_EXT ?= "bin"
DEPLOY_FILE_EXT_mx7ulp = "img"
do_deploy () {
# Install the demo binaries
cp ${D}/* ${DEPLOYDIR}/
chmod 0644 ${DEPLOYDIR}/*
install -m 0644 ${S}/*.${DEPLOY_FILE_EXT} ${DEPLOYDIR}/
}
addtask deploy after do_install

View File

@ -1,11 +0,0 @@
# Copyright 2017-2019 NXP
# Released under the MIT license (see COPYING.MIT for the terms)
require imx-m4-demos-2.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=fd4b227530cd88a82af6a5982cfb724d"
SRC_URI[imx8qx.md5sum] = "659c0ccf3a215fae7345d30e85774143"
SRC_URI[imx8qx.sha256sum] = "74e97eea086b3cabe6d4430570e46586625fba822af97c0c2b5d025e69b3b3cb"
COMPATIBLE_MACHINE = "(mx8qxp)"

View File

@ -0,0 +1,11 @@
# Copyright 2017-2019 NXP
# Released under the MIT license (see COPYING.MIT for the terms)
require imx-m4-demos-2.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[imx8qx.md5sum] = "d9cbcb6a5bf4a9e73399dfa82191670e"
SRC_URI[imx8qx.sha256sum] = "7800cdbebe07f426cdac50b0e295d64215164a767e79ca58bd917445c50e345f"
COMPATIBLE_MACHINE = "(mx8qxp)"

View File

@ -1,37 +0,0 @@
# Copyright 2019-2020 NXP
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "i.MX M7 core Demo images"
SECTION = "app"
LICENSE = "Proprietary"
inherit deploy fsl-eula2-unpack2
SOC ?= "INVALID"
SOC_mx8mn = "imx8mn"
SOC_mx8mp = "imx8mp"
IMX_PACKAGE_NAME = "${SOC}-m7-demo-${PV}"
SRC_URI_append = ";name=${SOC}"
SCR = "SCR-${SOC}-m7-demo.txt"
do_deploy () {
# Install the demo binaries
cp ${D}/* ${DEPLOYDIR}/
#Set 0644 permission for Demo binaries
chmod 0644 ${DEPLOYDIR}/*
}
addtask deploy after do_install
PACKAGE_ARCH = "${MACHINE_SOCARCH}"
LIC_FILES_CHKSUM = "file://COPYING;md5=fd4b227530cd88a82af6a5982cfb724d"
SRC_URI[imx8mn.md5sum] = "4dd5b924a6486efba82474da9e0dbe1d"
SRC_URI[imx8mn.sha256sum] = "9785721f2863ad6fa14cfcb63a813789bbcd206ff2f38c27e35235c9ae154e9f"
SRC_URI[imx8mp.md5sum] = "106361256fa92a894147e8050054b2fc"
SRC_URI[imx8mp.sha256sum] = "789c5c402d6d564df4ff8f01e3d7ce1bc091c45567b3832ab91d14fae98b2a3e"
COMPATIBLE_MACHINE = "(mx8mn|mx8mp)"

View File

@ -0,0 +1,44 @@
# Copyright 2019-2020 NXP
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "i.MX M7 core Demo images"
SECTION = "app"
LICENSE = "Proprietary"
inherit deploy fsl-eula2-unpack2
SOC ?= "INVALID"
SOC_mx8mn = "imx8mn"
SOC_mx8mp = "imx8mp"
IMX_PACKAGE_NAME = "${SOC}-m7-demo-${PV}"
SRC_URI_append = ";name=${SOC}"
SCR = "SCR-${SOC}-m7-demo.txt"
do_install () {
# install elf format binary to /lib/firmware
install -d ${D}${base_libdir}/firmware
install -m 0644 ${S}/*.elf ${D}${base_libdir}/firmware
}
DEPLOY_FILE_EXT ?= "bin"
DEPLOY_FILE_EXT_mx7ulp = "img"
do_deploy () {
# Install the demo binaries
install -m 0644 ${S}/*.${DEPLOY_FILE_EXT} ${DEPLOYDIR}/
}
addtask deploy after do_install
PACKAGE_ARCH = "${MACHINE_SOCARCH}"
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[imx8mn.md5sum] = "21b718fab2c4e77c8a848667698d74d1"
SRC_URI[imx8mn.sha256sum] = "e877c7462b6ea87c498563842f42352d204eb28a65f35f7dc1fec643f84abb66"
SRC_URI[imx8mp.md5sum] = "3dd44131b41dd902a8ce1b53eb9a0cd6"
SRC_URI[imx8mp.sha256sum] = "c7ed19d1d164c910af114d58fc53628b6e237262e657e082ac7beb685f0398ec"
COMPATIBLE_MACHINE = "(mx8mn|mx8mp)"

View File

@ -1,5 +1,5 @@
# The syntax for this file is documented in the HAB Code Signing Tool
# User's Guid which is included in the CST package distributed by NXP
# User's Guide which is included in the CST package distributed by NXP
[Header]
Target = AHAB
Version = 1.0
@ -20,4 +20,4 @@
# Binary to be signed generated by mkimage
File = "%kernel-img%"
# Offsets = Container header Signature block (printed out by mkimage)
Offsets = %container_offset% %block_offset%
Offsets = %container_offset% %block_offset%

View File

@ -1,5 +1,5 @@
# The syntax for this file is documented in the HAB Code Signing Tool
# User's Guid which is included in the CST package distributed by NXP
# User's Guide which is included in the CST package distributed by NXP
[Header]
Version = 4.0
Hash Algorithm = sha256

View File

@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425
DEPENDS = "trustfence-cst coreutils util-linux"
DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'imx-mkimage', '', d)}"
SRCBRANCH = "v2019.04/maint"
SRCBRANCH = "v2019.04/master"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}"

View File

@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca
# Reference Qualcomm tag/version
PV = "v4.0.11.213X"
SRCBRANCH = "qca65X4/dey-3.0/maint"
SRCBRANCH = "qca65X4/master"
SRCREV = "${AUTOREV}"
QCOM_GIT_URI = "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_MTK_GIT}linux/qcacld-2.0.git;protocol=ssh', '${DIGI_GITHUB_GIT}/qcacld-2.0.git;protocol=https', d)}"

View File

@ -4,7 +4,7 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
LOCALVERSION = "-dey"
SRCBRANCH = "v5.4/dey-3.0/maint"
SRCBRANCH = "v5.4.24/master"
SRCBRANCH_ccimx6 = "v4.9/dey-2.6/maint"
SRCREV = "${AUTOREV}"

View File

@ -1,6 +1,6 @@
DISTRO = "dey"
DISTRO_NAME = "Digi Embedded Yocto"
DISTRO_VERSION = "3.0-r1"
DISTRO_VERSION = "3.0-r2"
DISTRO_CODENAME = "zeus"
SDK_VENDOR = "-deysdk"
SDK_VERSION := "${@d.getVar('DISTRO_VERSION')}"

View File

@ -26,6 +26,9 @@ PUBLIC_KEY="/etc/ssl/certs/key.pub"
USB_MOUNT_DIR="/run/media"
UPDATE_MOUNT_DIR="/mnt/update"
ROOTFS_NEEDS_FORMAT="no"
SWUPDATE_OUTPUT="swupdate_output.txt"
REBOOT_TIME=10
# Functions.
@ -297,14 +300,19 @@ check_swu_package() {
# Check software update package.
if [ -f "${PUBLIC_KEY}" ]; then
swupdate -c -i "${update_package}" -k "${PUBLIC_KEY}"
swupdate -c -v -i "${update_package}" -k "${PUBLIC_KEY}" > "${SWUPDATE_OUTPUT}"
else
swupdate -c -i "${update_package}"
swupdate -c -v -i "${update_package}" > "${SWUPDATE_OUTPUT}"
fi
if [ "$?" != "0" ]; then
quit_with_error "Invalid update package '$(basename ${1})'"
fi
# Format the rootfs partition if and only if the package contains a rootfs image.
if [ "$(is_nand)" = "yes" ]; then
grep "Found Image" "${SWUPDATE_OUTPUT}" | grep -qs "rootfs" && ROOTFS_NEEDS_FORMAT="yes"
fi
}
#------------------------------------------------------------------------------
@ -475,11 +483,13 @@ if [ -n "${update_package_bool}" ]; then
psplash_message "Updating firmware..."
psplash_progress "0"
# Format the UBI volume before updating.
# Format the UBI volume before updating if needed.
if [ "$(is_nand)" = "yes" ]; then
psplash_message "Formatting rootfs partition..."
format_ubi_volume rootfs
psplash_progress "0"
if [ "$ROOTFS_NEEDS_FORMAT" = "yes" ]; then
psplash_message "Formatting rootfs partition..."
format_ubi_volume rootfs
psplash_progress "0"
fi
fi
log "Update package location: ${update_package}"

View File

@ -1,6 +1,6 @@
# Copyright (C) 2019, Digi International Inc.
SRCBRANCH = "dey-3.0/maint"
SRCBRANCH = "master"
SRCREV = "${AUTOREV}"
DEY_EXAMPLES_STASH = "${DIGI_MTK_GIT}dey/dey-examples.git;protocol=ssh"

View File

@ -1,27 +0,0 @@
# Copyright (C) 2013-2020 Digi International.
SUMMARY = "DEY examples: V4L2 test application"
SECTION = "examples"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
inherit use-imx-headers
SRC_URI = "file://v4l2_test"
INCLUDE_PATH = "-I${STAGING_INCDIR_IMX}"
S = "${WORKDIR}/v4l2_test"
do_compile() {
${CC} -O2 -Wall ${INCLUDE_PATH} ${LDFLAGS} v4l2_still.c -o v4l2_still -lpthread
${CC} -O2 -Wall ${INCLUDE_PATH} ${LDFLAGS} v4l2_common.c v4l2_preview_test.c -o v4l2_preview_test -lpthread
}
do_install() {
install -d ${D}${bindir}
install -m 0755 v4l2_still v4l2_preview_test ${D}${bindir}
}
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccimx6$|ccimx8x|ccimx8m)"

View File

@ -1,19 +0,0 @@
# Copyright (C) 2013,2017 Digi International.
SUMMARY = "DEY examples: OSS (open sound system) test application"
SECTION = "examples"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
SRC_URI = "file://vplay_test"
S = "${WORKDIR}/vplay_test"
do_compile() {
${CC} -O2 -Wall ${LDFLAGS} vplay.c -o vplay
}
do_install() {
install -d ${D}${bindir}
install -m 0755 vplay ${D}${bindir}
}

View File

@ -1,183 +0,0 @@
/*
* v4l2_defs.h
*
* Copyright (C) 2012 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: V4L2 definitions header file.
*
* From linux/ipu.h
*
*/
#ifndef V4L2_DEFS_H_
#define V4L2_DEFS_H_
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/fb.h>
#include <linux/mxcfb.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)
#include <linux/videodev2.h>
#else
#include <linux/videodev.h>
#endif
#define fourcc(a,b,c,d)\
(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
/*!
* @name IPU Pixel Formats
*
* Pixel formats are defined with ASCII FOURCC code. The pixel format codes are
* the same used by V4L2 API.
*/
/*! @{ */
/*! @name Generic or Raw Data Formats */
/*! @{ */
#define IPU_PIX_FMT_GENERIC fourcc('I', 'P', 'U', '0') /*!< IPU Generic Data */
#define IPU_PIX_FMT_GENERIC_32 fourcc('I', 'P', 'U', '1') /*!< IPU Generic Data */
#define IPU_PIX_FMT_LVDS666 fourcc('L', 'V', 'D', '6') /*!< IPU Generic Data */
#define IPU_PIX_FMT_LVDS888 fourcc('L', 'V', 'D', '8') /*!< IPU Generic Data */
/*! @} */
/*! @name RGB Formats */
/*! @{ */
#define IPU_PIX_FMT_RGB332 fourcc('R', 'G', 'B', '1') /*!< 8 RGB-3-3-2 */
#define IPU_PIX_FMT_RGB555 fourcc('R', 'G', 'B', 'O') /*!< 16 RGB-5-5-5 */
#define IPU_PIX_FMT_RGB565 fourcc('R', 'G', 'B', 'P') /*!< 1 6 RGB-5-6-5 */
#define IPU_PIX_FMT_RGB666 fourcc('R', 'G', 'B', '6') /*!< 18 RGB-6-6-6 */
#define IPU_PIX_FMT_BGR666 fourcc('B', 'G', 'R', '6') /*!< 18 BGR-6-6-6 */
#define IPU_PIX_FMT_BGR24 fourcc('B', 'G', 'R', '3') /*!< 24 BGR-8-8-8 */
#define IPU_PIX_FMT_RGB24 fourcc('R', 'G', 'B', '3') /*!< 24 RGB-8-8-8 */
#define IPU_PIX_FMT_GBR24 fourcc('G', 'B', 'R', '3') /*!< 24 GBR-8-8-8 */
#define IPU_PIX_FMT_BGR32 fourcc('B', 'G', 'R', '4') /*!< 32 BGR-8-8-8-8 */
#define IPU_PIX_FMT_BGRA32 fourcc('B', 'G', 'R', 'A') /*!< 32 BGR-8-8-8-8 */
#define IPU_PIX_FMT_RGB32 fourcc('R', 'G', 'B', '4') /*!< 32 RGB-8-8-8-8 */
#define IPU_PIX_FMT_RGBA32 fourcc('R', 'G', 'B', 'A') /*!< 32 RGB-8-8-8-8 */
#define IPU_PIX_FMT_ABGR32 fourcc('A', 'B', 'G', 'R') /*!< 32 ABGR-8-8-8-8 */
/*! @} */
/*! @name YUV Interleaved Formats */
/*! @{ */
#define IPU_PIX_FMT_YUYV fourcc('Y', 'U', 'Y', 'V') /*!< 16 YUV 4:2:2 */
#define IPU_PIX_FMT_UYVY fourcc('U', 'Y', 'V', 'Y') /*!< 16 YUV 4:2:2 */
#define IPU_PIX_FMT_YVYU fourcc('Y', 'V', 'Y', 'U') /*!< 16 YVYU 4:2:2 */
#define IPU_PIX_FMT_VYUY fourcc('V', 'Y', 'U', 'Y') /*!< 16 VYYU 4:2:2 */
#define IPU_PIX_FMT_Y41P fourcc('Y', '4', '1', 'P') /*!< 12 YUV 4:1:1 */
#define IPU_PIX_FMT_YUV444 fourcc('Y', '4', '4', '4') /*!< 24 YUV 4:4:4 */
#define IPU_PIX_FMT_VYU444 fourcc('V', '4', '4', '4') /*!< 24 VYU 4:4:4 */
/* two planes -- one Y, one Cb + Cr interleaved */
#define IPU_PIX_FMT_NV12 fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
/*! @} */
/*! @name YUV Planar Formats */
/*! @{ */
#define IPU_PIX_FMT_GREY fourcc('G', 'R', 'E', 'Y') /*!< 8 Greyscale */
#define IPU_PIX_FMT_YVU410P fourcc('Y', 'V', 'U', '9') /*!< 9 YVU 4:1:0 */
#define IPU_PIX_FMT_YUV410P fourcc('Y', 'U', 'V', '9') /*!< 9 YUV 4:1:0 */
#define IPU_PIX_FMT_YVU420P fourcc('Y', 'V', '1', '2') /*!< 12 YVU 4:2:0 */
#define IPU_PIX_FMT_YUV420P fourcc('I', '4', '2', '0') /*!< 12 YUV 4:2:0 */
#define IPU_PIX_FMT_YUV420P2 fourcc('Y', 'U', '1', '2') /*!< 12 YUV 4:2:0 */
#define IPU_PIX_FMT_YVU422P fourcc('Y', 'V', '1', '6') /*!< 16 YVU 4:2:2 */
#define IPU_PIX_FMT_YUV422P fourcc('4', '2', '2', 'P') /*!< 16 YUV 4:2:2 */
/*! @} */
#define V4L2_CID_MXC_FLASH (V4L2_CID_PRIVATE_BASE + 1)
#define V4L2_CID_MXC_VF_ROT (V4L2_CID_PRIVATE_BASE + 2)
extern int verbose;
#define TRUE 1
#define FALSE 0
#define SYSFS_FSL_DISP_PROPERTY_FB0 "/sys/class/graphics/fb0/fsl_disp_property"
#define SYSFS_FSL_DISP_PROPERTY_FB1 "/sys/class/graphics/fb1/fsl_disp_property"
#define log( fmt, arg...) \
do { \
char msg[256]; \
if(verbose){ \
snprintf(msg,sizeof(msg),"[%s:%d]"fmt , __FUNCTION__, \
__LINE__, ## arg); \
printf("%s",msg);} \
} while (0)
typedef struct {
int format;
int top;
int left;
int height;
int width;
int capturemode;
int non_destructive;
int camera_framerate;
} OPTIONS;
typedef struct {
int fd_in;
int fd_out;
char v4l2_device[13]; /* /dev/videoNN + '\0' */
char fb_device[9]; /* /dev/fbN + '\0' */
OPTIONS options;
} ARGUMENTS;
int v4l2_get_overlay_bg(char *fb_device);
int v4l2_overlay_control(int fd_overlay, int start);
char *v4l2_fmt_str(int pixelformat);
int v4l2_is_capability_supported(int fd, int capability);
int v4l2_is_video_std_supported(int fd, int standard);
int v4l2_is_format_supported(int fd, int format);
int v4l2_check_frame_rate(int fd, int framerate);
int v4l2_set_stream_parms(int fd, int framerate);
int v4l2_check_output(int fd, char *name);
int v4l2_set_output(int fd, struct fb_fix_screeninfo *fb_fix);
int v4l2_set_frame_rate(int fd, int framerate);
int v4l2_check_frame_rate(int fd, int framerate);
int v4l2_set_format_overlay(int fd, int top, int left, int height, int width);
int v4l2_set_format_capture(int fd, int pixelformat, int height, int width);
int v4l2_fb_get_info(char *fb_device, struct fb_fix_screeninfo *fb_fix,
struct fb_var_screeninfo *fb_var);
void v4l2_ident_outputs(int fd);
int v4l2_mxc_find_overlay(struct fb_fix_screeninfo *fb_fix, int *fb_fg_fd);
int v4l2_overlay_set_framebuffer(int fd, struct fb_fix_screeninfo *fb_fix,
struct fb_var_screeninfo *fb_var, int non_destructive);
int v4l2_reset_cropping_rectangle(int fd);
int v4l2_fb_blank(int fd);
int v4l2_fb_unblank(int fd);
int v4l2_zoom(int fd, int zoom);
int v4l2_set_rotate(int fd, int rotate);
int v4l2_rotate(int fd, int rotate);
int v4l2_crop_input(int fd, struct v4l2_rect *crop_rectangle);
int v4l2_get_cropping_limits(int fd, struct v4l2_rect *limits);
int v4l2_area_zoom(int fd, struct v4l2_rect *crop_rectangle);
int v4l2_set_brightness(int fd, int brightness);
int v4l2_get_brightness(int fd, int *brightness);
int v4l2_set_saturation(int fd, int saturation);
int v4l2_get_saturation(int fd, int *saturation);
int v4l2_set_red_balance(int fd, int red);
int v4l2_set_blue_balance(int fd, int blue);
int v4l2_set_black_level(int fd, int black);
int v4l2_get_red_balance(int fd, int *red);
int v4l2_get_blue_balance(int fd, int *blue);
int v4l2_get_black_level(int fd, int *black);
int v4l2_global_alpha_set(int fd, int enable, int value);
int v4l2_sysfs_set_overlay_bg(char *fb_device);
int v4l2_local_alpha_set(ARGUMENTS * args, int fd_fb_fg, struct v4l2_rect *alpha_rectangle,
int alpha_percentage);
#endif /* V4L2_DEFS_H_ */

View File

@ -1,505 +0,0 @@
/*
* v4l2_preview_test.c
*
* Copyright (C) 2012 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: V4L2 preview test application.
*
* Video overlay, framebuffer overlay or previewing stores images directly into
* the video memory of the graphics card. Video overlays are accessible through
* /dev/video after a VIDIOC_S_FMT to overlay (the default for /dev/video is
* video capture).
*
* V4L2 API @ http://v4l2spec.bytesex.org/
*
*/
#include <pthread.h>
#include <sched.h>
#include "v4l2_defs.h"
int verbose = 0;
int fb_fg_fd = -1;
static int should_stop = 0;
static void signal_handler(int signum, siginfo_t * info, void *myact)
{
switch (signum) {
case SIGHUP:
case SIGTERM:
case SIGINT:
should_stop = TRUE;
/* FALLTHROUGH */
default:
log("signal %d caught\n", signum);
break;
}
}
/**
* Prints online help
*
* @fd file to print on
*/
static void printUsage(FILE * fd)
{
fprintf(fd, "V4L2 preview test application.\n\n"
"Usage: v4l_preview_test -d </dev/video0> -o </dev/fb0> -h <height> "
"-w <width> -t <top> -l <left> [-r] [-v] [-?]\n\n"
" -d V4L2 capture device, by default /dev/video0\n"
" -o V4L2 output (framebuffer) device, by default /dev/fb0\n"
" -h Video height in pixels\n"
" -w Video width in pixels\n"
" -t Video top offset in pixels\n"
" -l Video left offset in pixels\n"
" -x Non destructive overlay (do not overwrite framebuffer)\n"
" Setting '-x' discards the output device option '-o' and\n"
" uses the overlay background framebuffer.\n"
" -r RGB565 (default is UYVY)\n"
" -u YUYV (default is UYVY)\n"
" -c capture mode (default is 0)\n"
" -v Verbose mode\n"
" -? This help\n\n");
}
static void *v4l2_camera_thread(void *pargs)
{
struct fb_fix_screeninfo fb_fix;
struct fb_var_screeninfo fb_var;
ARGUMENTS *args = pargs;
/* Check overlay is supported */
if (!v4l2_is_capability_supported(args->fd_in, V4L2_CAP_VIDEO_OVERLAY)) {
printf("Overlay not supported\n");
return ((void *)-EINVAL);
}
/* Check requested image format is supported by capture device */
if (!v4l2_is_format_supported(args->fd_in, args->options.format)) {
printf("Requested format not supported.\n");
return ((void *)-EINVAL);
}
/* Obtain framebuffer parameters */
if ((args->fd_out = v4l2_fb_get_info(args->fb_device, &fb_fix, &fb_var)) < 0) {
printf("Unable to open %s: %s\n", args->fb_device, strerror(errno));
exit(-1);
}
/* Set video output */
if (v4l2_set_output(args->fd_in, &fb_fix) < 0) {
printf("\nUnable to set current video output.\n");
exit(-1);
}
/* Restore default cropping - no zoom */
v4l2_reset_cropping_rectangle(args->fd_in);
/* Reset rotation to ROTATE_NONE */
v4l2_set_rotate(args->fd_in, 0);
/* Set capture mode */
v4l2_set_capture_mode(args->fd_in, args->options.capturemode);
/* Set size in overlay */
v4l2_set_format_overlay(args->fd_in,
args->options.top, args->options.left,
args->options.height, args->options.width);
/* Now the overlay functionality is available */
/* Obtain overlay framebuffer's fd */
v4l2_mxc_find_overlay(&fb_fix, &fb_fg_fd);
/* Draws over the fb (destructive) and sets image format */
v4l2_overlay_set_framebuffer(args->fd_in, &fb_fix, &fb_var,
args->options.non_destructive);
v4l2_overlay_control(args->fd_in, 1);
while (should_stop != TRUE)
sleep(1);
v4l2_overlay_control(args->fd_in, 0);
close(args->fd_in);
close(args->fd_out);
if (fb_fg_fd > 0)
close(fb_fg_fd);
return NULL;
}
static void v4l2_display_menu(int non_destructive)
{
printf("\t[h]display the operation Help\n");
printf("\t[x]eXit\n");
printf("\t[r]Rotate input\n");
printf("\t[b]adjust Brightness\n");
printf("\t[s]adjust Saturation\n");
printf("\t[c]adjust Color balance\n");
printf("\t[z]automatic Zoom\n");
printf("\t[a]zoom Area\n");
if (non_destructive) {
/* These options are only available in non_destructive overlay */
printf("\t[g]set Global transparency\n");
printf("\t[l]set Local transparency\n");
}
printf("\nChoose option: ");
}
static int cmd_rotate(int fd)
{
unsigned int rotate = 0;
printf("Rotation options:\n");
printf("\t0 - No rotation\n");
printf("\t1 - Vertical flip\n");
printf("\t2 - Horizontal flip\n");
printf("\t3 - Rotate 180 degree\n");
printf("\t4 - Rotate 90 degree\n");
printf("\t5 - Rotate 90 degree right and vertical flip\n");
printf("\t6 - Rotate 90 degree right and horizontal flip\n");
printf("\t7 - Rotate 90 degree left\n");
printf("Choose rotation: ");
scanf("%u", &rotate);
if (rotate > 7) {
printf("Invalid value\n");
return -1;
}
return v4l2_rotate(fd, rotate);
}
static int cmd_brightness(int fd)
{
int brightness = 0;
int ret = -1;
/* Read current brightness value */
v4l2_get_brightness(fd, &brightness);
printf("Enter brightness [0-100%%] (current: %u%%): ", brightness);
if ((scanf("%u", &brightness)) != 1 || should_stop) {
return ret;
}
if (brightness > 100 || brightness < 0) {
printf("Brightness value [%d] out of range.\n", brightness);
} else {
ret = v4l2_set_brightness(fd, brightness);
}
return ret;
}
static int cmd_saturation(int fd)
{
int saturation;
int ret = -1;
/* Read current saturation value */
v4l2_get_saturation(fd, &saturation);
printf("Enter saturation (valid values are 0, 25, 37, 50, 75, 100 and 150) [0-150%%] (current: %u%%): ", saturation);
if (scanf("%u", &saturation) != 1 || should_stop)
return ret;
if (saturation > 150 || saturation < 0) {
printf("Saturation value [%d] out of range.\n", saturation);
} else {
ret = v4l2_set_saturation(fd, saturation);
}
return ret;
}
static int cmd_zoom(int fd)
{
int zoom;
int ret = -1;
printf("Enter zooming percentage [100 - 300]%%: ");
if ((scanf("%i", &zoom)) != 1)
return ret;
if (zoom < 100 || zoom > 300) {
printf("Zoom value [%d] out of range.\n", zoom);
} else {
ret = v4l2_zoom(fd, zoom);
}
return ret;
}
static int cmd_area_zoom(int fd)
{
struct v4l2_rect zoom_rectangle;
int ret = -1;
printf("Enter rectangle's values (top, left, width [>=8], height [>=8]): ");
if ((scanf("%d,%d,%d,%d", &zoom_rectangle.top, &zoom_rectangle.left,
&zoom_rectangle.width, &zoom_rectangle.height)) != 4 || should_stop) {
printf("Enter four parameters\n");
return ret;
} else {
ret = v4l2_area_zoom(fd, &zoom_rectangle);
}
return ret;
}
static int cmd_color_balance(int fd, char cmd)
{
int ret = -1;
int red, blue, black;
red = blue = black = 0;
switch (cmd) {
case 'r':
if (v4l2_get_red_balance(fd, &red) < 0) {
printf("\n[ERROR] Unable to get Red balance\n\n");
} else {
printf("Enter Red balance value (current: %d): ", red);
scanf("%u", &red);
ret = v4l2_set_red_balance(fd, red);
}
break;
case 'b':
if (v4l2_get_blue_balance(fd, &blue) < 0) {
printf("\n[ERROR] Unable to get Blue balance\n\n");
} else {
printf("Enter Blue balance value (current: %d): ", blue);
scanf("%u", &blue);
ret = v4l2_set_blue_balance(fd, blue);
}
break;
case 'w':
printf("\nNot implemented (yet...)\n\n");
break;
case 'l':
if (v4l2_get_black_level(fd, &black) < 0) {
printf("\n[ERROR] Unable to get Black level\n\n");
} else {
printf("Enter Black level value (current: %d): ", black);
scanf("%u", &black);
ret = v4l2_set_black_level(fd, black);
}
break;
default:
break;
}
return ret;
}
static int cmd_global_alpha(int fd)
{
int ret = -1;
int alpha_value;
printf("Enter alpha_value global transparency [0-100%%]: ");
if (scanf("%d", &alpha_value) != 1 || should_stop)
return ret;
if (alpha_value > 100 || alpha_value < 0) {
printf("Alpha value [%d] out of range.\n", alpha_value);
return ret;
}
ret = v4l2_global_alpha_set(fd, 1, alpha_value);
return ret;
}
static int cmd_local_alpha(ARGUMENTS * args)
{
int ret = -1;
struct v4l2_rect alpha_rectangle;
int alpha_value;
printf("Enter rectangle's values (top, left, width, height): ");
if ((scanf("%d,%d,%d,%d", &alpha_rectangle.top, &alpha_rectangle.left,
&alpha_rectangle.width, &alpha_rectangle.height)) != 4 || should_stop) {
printf("Enter four parameters\n");
return ret;
} else {
printf("Enter rectangle's transparency [0-100%%]: ");
if (scanf("%d", &alpha_value) != 1 || should_stop)
return ret;
if (alpha_value > 100 || alpha_value < 0) {
printf("Alpha value [%d] out of range.\n", alpha_value);
return ret;
}
ret = v4l2_local_alpha_set(args, fb_fg_fd, &alpha_rectangle, alpha_value);
}
return ret;
}
static void display_color_balance_menu(void)
{
printf("Color balance:\n");
printf("\t[r]adjust Red balance\n");
printf("\t[b]adjust Blue balance\n");
printf("\t[w]adjust White balance\n");
printf("\t[l]adjust bLack level\n");
printf("Choose option: ");
}
int main(int argc, char **argv)
{
int opt;
int retval = 0;
ARGUMENTS args;
pthread_t v4l2_camera_th;
int ret = 0;
char cmd[64] = "";
struct sigaction act;
char fb_device_flag = 0; /* fb_device set in command line */
/* Signal handling */
memset(&act, 0, sizeof(struct sigaction));
sigemptyset(&act.sa_mask);
act.sa_flags = SA_SIGINFO;
act.sa_sigaction = signal_handler;
if ((ret = sigaction(SIGINT, &act, NULL)) < 0) {
log("Signal installation error: %d\n", SIGINT);
return -1;
}
/* Initialize options */
memset(&args, 0, sizeof(args));
args.options.width = 640;
args.options.height = 480;
args.options.format = V4L2_PIX_FMT_UYVY;
args.options.capturemode = 0;
strcpy(args.fb_device, "/dev/fb0");
strcpy(args.v4l2_device, "/dev/video0");
/* Input processing */
while ((opt = getopt(argc, argv, "w:d:h:l:t:o:xc:vru?")) != -1) {
switch (opt) {
case '?':
printUsage(stderr);
return 1;
case 'd':
strncpy(args.v4l2_device, optarg, sizeof(args.v4l2_device) - 1);
args.v4l2_device[sizeof(args.v4l2_device) - 1] = '\0';
break;
case 'w':
args.options.width = atoi(optarg);
break;
case 't':
args.options.top = atoi(optarg);
break;
case 'l':
args.options.left = atoi(optarg);
break;
case 'h':
args.options.height = atoi(optarg);
break;
case 'o':
strncpy(args.fb_device, optarg, sizeof(args.fb_device) - 1);
args.fb_device[sizeof(args.fb_device) - 1] = '\0';
fb_device_flag = 1;
break;
case 'r':
args.options.format = V4L2_PIX_FMT_RGB565;
break;
case 'u':
args.options.format = V4L2_PIX_FMT_YUYV;
break;
case 'x':
args.options.non_destructive = 1;
break;
case 'c':
args.options.capturemode = atoi(optarg);
break;
case 'v':
verbose = 1;
break;
}
}
/* Input validation */
if (args.options.height == 0 || args.options.width == 0) {
printf("Invalid input: Display height and width cannot be zero.\n");
exit(-EINVAL);
}
if (args.options.non_destructive) {
if (fb_device_flag) {
printf("\n[WARNING] The application will discard '-o' option and use"
" the overlay background framebuffer device.\n");
}
if (v4l2_get_overlay_bg(args.fb_device) < 0) {
printf("Unable to find overlay background framebuffer device\n");
exit(-1);
}
}
printf("\nVideo height %d width %d top %d left %d\n\n",
args.options.height, args.options.width, args.options.top, args.options.left);
/* Open input device */
if ((args.fd_in = open(args.v4l2_device, O_RDWR, 0)) < 0) {
printf("Unable to open %s: %s\n", args.v4l2_device, strerror(errno));
exit(-1);
}
log("Opened %s\n", args.v4l2_device);
log("V4L2 preview test application started.\n");
if (pthread_create(&v4l2_camera_th, NULL, v4l2_camera_thread, (void *)&args)) {
exit(-1);
}
while (should_stop != TRUE) {
v4l2_display_menu(args.options.non_destructive);
cmd[0] = ' ';
errno = 0;
scanf("%s", cmd);
switch (cmd[0]) {
case 'x': /* Exit */
should_stop = TRUE;
break;
case 'h': /* Help */
/* Nothing to do, as the help is shown in each iteration */
break;
case 'r':
cmd_rotate(args.fd_in);
break;
case 'b':
cmd_brightness(args.fd_in);
break;
case 's':
cmd_saturation(args.fd_in);
break;
case 'z':
cmd_zoom(args.fd_in);
break;
case 'a':
cmd_area_zoom(args.fd_in);
break;
case 'c':
display_color_balance_menu();
scanf("%s", cmd);
cmd_color_balance(args.fd_in, cmd[0]);
break;
case 'g':
if (args.options.non_destructive)
cmd_global_alpha(args.fd_out);
break;
case 'l':
if (args.options.non_destructive)
cmd_local_alpha(&args);
break;
default:
break;
}
}
if (pthread_join(v4l2_camera_th, NULL)) {
exit(-1);
}
log("V4L2 preview test application finished.\n");
return retval;
}

View File

@ -1,390 +0,0 @@
/*
* Copyright 2004-2010 Freescale Semiconductor, Inc. All rights reserved.
* Copyright 2010 Digi International. All rights reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
/*
* @file v4l2_still.c
*
* @brief Video For Linux 2 driver test application
*
*/
#ifdef __cplusplus
extern "C" {
#endif
/*=======================================================================
INCLUDE FILES
=======================================================================*/
/* Standard Include Files */
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <asm/types.h>
#include <sys/mman.h>
#include <string.h>
#include <malloc.h>
#include "v4l2_defs.h"
#define ipu_fourcc(a,b,c,d)\
(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
#define IPU_PIX_FMT_YUYV ipu_fourcc('Y','U','Y','V') /*!< 16 YUV 4:2:2 */
#define IPU_PIX_FMT_UYVY ipu_fourcc('U','Y','V','Y') /*!< 16 YUV 4:2:2 */
#define IPU_PIX_FMT_NV12 ipu_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */
#define IPU_PIX_FMT_YUV420P ipu_fourcc('I','4','2','0') /*!< 12 YUV 4:2:0 */
#define IPU_PIX_FMT_YUV420P2 ipu_fourcc('Y','U','1','2') /*!< 12 YUV 4:2:0 */
#define IPU_PIX_FMT_YUV422P ipu_fourcc('4','2','2','P') /*!< 16 YUV 4:2:2 */
#define IPU_PIX_FMT_YUV444 ipu_fourcc('Y','4','4','4') /*!< 24 YUV 4:4:4 */
#define IPU_PIX_FMT_RGB565 ipu_fourcc('R','G','B','P') /*!< 16 RGB-5-6-5 */
#define IPU_PIX_FMT_BGR24 ipu_fourcc('B','G','R','3') /*!< 24 BGR-8-8-8 */
#define IPU_PIX_FMT_RGB24 ipu_fourcc('R','G','B','3') /*!< 24 RGB-8-8-8 */
#define IPU_PIX_FMT_BGR32 ipu_fourcc('B','G','R','4') /*!< 32 BGR-8-8-8-8 */
#define IPU_PIX_FMT_BGRA32 ipu_fourcc('B','G','R','A') /*!< 32 BGR-8-8-8-8 */
#define IPU_PIX_FMT_RGB32 ipu_fourcc('R','G','B','4') /*!< 32 RGB-8-8-8-8 */
#define IPU_PIX_FMT_RGBA32 ipu_fourcc('R','G','B','A') /*!< 32 RGB-8-8-8-8 */
#define IPU_PIX_FMT_ABGR32 ipu_fourcc('A','B','G','R') /*!< 32 ABGR-8-8-8-8 */
static int g_convert = 0;
static int g_width = 640;
static int g_height = 480;
static int g_top = 0;
static int g_left = 0;
static unsigned long g_pixelformat = IPU_PIX_FMT_UYVY;
static int g_bpp = 16;
static int g_camera_framerate = 30;
static int g_capture_mode = 0;
static char g_v4l_device[100] = "/dev/video0";
void usage(void)
{
printf("Usage: v4l2_still [-w width] [-h height] [-t top] [-l left] [-f pixformat] [-c] [-m] [-fr]\n"
"-w Image width, 640 by default\n"
"-h Image height, 480 by default\n"
"-t Image top(crop from the source frame), 0 by default\n"
"-l Image left(crop from the source frame), 0 by default\n"
"-f Image pixel format, YUV420, YUV422P, YUYV, UYVY ((default) or YUV444\n"
"-c Convert to YUV420P. This option is valid for interleaved pixel\n"
" formats only - YUYV, UYVY, YUV444\n"
"-m Capture mode, 0-low resolution(default), 1-high resolution \n"
"-d Camera select, /dev/video0, /dev/video1 \n"
"-fr Capture frame rate, 30fps by default\n"
"The output is saved in ./still.uyvy\n"
);
}
/* Convert to YUV420 format */
void fmt_convert(char *dest, char *src, struct v4l2_format *fmt)
{
int row, col, pos = 0;
int bpp, yoff, uoff, voff;
if (fmt->fmt.pix.pixelformat == IPU_PIX_FMT_YUYV) {
bpp = 2;
yoff = 0;
uoff = 1;
voff = 3;
}
else if (fmt->fmt.pix.pixelformat == IPU_PIX_FMT_UYVY) {
bpp = 2;
yoff = 1;
uoff = 0;
voff = 2;
}
else { /* YUV444 */
bpp = 4;
yoff = 0;
uoff = 1;
voff = 2;
}
/* Copy Y */
for (row = 0; row < fmt->fmt.pix.height; row++)
for (col = 0; col < fmt->fmt.pix.width; col++)
dest[pos++] = src[row * fmt->fmt.pix.bytesperline + col * bpp + yoff];
/* Copy U */
for (row = 0; row < fmt->fmt.pix.height; row += 2) {
for (col = 0; col < fmt->fmt.pix.width; col += 2)
dest[pos++] = src[row * fmt->fmt.pix.bytesperline + col * bpp + uoff];
}
/* Copy V */
for (row = 0; row < fmt->fmt.pix.height; row += 2) {
for (col = 0; col < fmt->fmt.pix.width; col += 2)
dest[pos++] = src[row * fmt->fmt.pix.bytesperline + col * bpp + voff];
}
}
int bytes_per_pixel(int fmt)
{
switch (fmt) {
case IPU_PIX_FMT_YUV420P:
case IPU_PIX_FMT_YUV422P:
case IPU_PIX_FMT_NV12:
return 1;
break;
case IPU_PIX_FMT_RGB565:
case IPU_PIX_FMT_YUYV:
case IPU_PIX_FMT_UYVY:
return 2;
break;
case IPU_PIX_FMT_BGR24:
case IPU_PIX_FMT_RGB24:
return 3;
break;
case IPU_PIX_FMT_BGR32:
case IPU_PIX_FMT_BGRA32:
case IPU_PIX_FMT_RGB32:
case IPU_PIX_FMT_RGBA32:
case IPU_PIX_FMT_ABGR32:
return 4;
break;
default:
return 1;
break;
}
return 0;
}
int v4l_capture_setup(int * fd_v4l)
{
struct v4l2_streamparm parm;
struct v4l2_format fmt;
struct v4l2_crop crop;
int ret = 0;
if ((*fd_v4l = open(g_v4l_device, O_RDWR, 0)) < 0)
{
printf("Unable to open %s\n", g_v4l_device);
return -1;
}
parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
parm.parm.capture.timeperframe.numerator = 1;
parm.parm.capture.timeperframe.denominator = g_camera_framerate;
parm.parm.capture.capturemode = g_capture_mode;
if ((ret = ioctl(*fd_v4l, VIDIOC_S_PARM, &parm)) < 0)
{
printf("VIDIOC_S_PARM failed\n");
return ret;
}
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
crop.c.left = g_left;
crop.c.top = g_top;
crop.c.width = g_width;
crop.c.height = g_height;
if ((ret = ioctl(*fd_v4l, VIDIOC_S_CROP, &crop)) < 0)
{
printf("set cropping failed\n");
return ret;
}
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.pixelformat = g_pixelformat;
fmt.fmt.pix.width = g_width;
fmt.fmt.pix.height = g_height;
fmt.fmt.pix.sizeimage = fmt.fmt.pix.width * fmt.fmt.pix.height * g_bpp / 8;
fmt.fmt.pix.bytesperline = g_width * bytes_per_pixel(g_pixelformat);
if ((ret = ioctl(*fd_v4l, VIDIOC_S_FMT, &fmt)) < 0)
{
printf("set format failed\n");
return ret;
}
return ret;
}
int v4l_capture_test(int fd_v4l)
{
struct v4l2_format fmt;
int fd_still = 0, ret = 0;
char *buf1, *buf2;
char still_file[100] = "./still.uyvy";
int bytes = 0;
if ((fd_still = open(still_file, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) < 0)
{
printf("Unable to create y frame recording file\n");
return -1;
}
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if ((ret = ioctl(fd_v4l, VIDIOC_G_FMT, &fmt)) < 0) {
printf("get format failed\n");
goto exit1;
} else {
printf("\t Width = %d\n", fmt.fmt.pix.width);
printf("\t Height = %d\n", fmt.fmt.pix.height);
printf("\t Image size = %d\n", fmt.fmt.pix.sizeimage);
printf("\t Pixel format = %c%c%c%c\n",
(char)(fmt.fmt.pix.pixelformat & 0xFF),
(char)((fmt.fmt.pix.pixelformat & 0xFF00) >> 8),
(char)((fmt.fmt.pix.pixelformat & 0xFF0000) >> 16),
(char)((fmt.fmt.pix.pixelformat & 0xFF000000) >> 24));
}
buf1 = (char *)malloc(fmt.fmt.pix.sizeimage);
buf2 = (char *)malloc(fmt.fmt.pix.sizeimage);
if (!buf1 || !buf2)
goto exit0;
memset(buf1, 0, fmt.fmt.pix.sizeimage);
memset(buf2, 0, fmt.fmt.pix.sizeimage);
if ((bytes = read(fd_v4l, buf1, fmt.fmt.pix.sizeimage)) != fmt.fmt.pix.sizeimage) {
printf("v4l2 read error.\n");
printf("read %d, expected %d.\n",bytes, fmt.fmt.pix.sizeimage);
goto exit0;
}
if ((g_convert == 1) && (g_pixelformat != IPU_PIX_FMT_YUV422P)
&& (g_pixelformat != IPU_PIX_FMT_YUV420P2)) {
fmt_convert(buf2, buf1, &fmt);
if ((write(fd_still, buf2, fmt.fmt.pix.width * fmt.fmt.pix.height * 3 / 2)) < 0)
goto exit0;
}
else
if ((write(fd_still, buf1, fmt.fmt.pix.sizeimage)) < 0)
goto exit0;
exit0:
free(buf1);
free(buf2);
close(fd_v4l);
exit1:
close(fd_still);
return ret;
}
int main(int argc, char **argv)
{
int fd_v4l;
int i;
int ret;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-w") == 0) {
if (argv[++i])
g_width = atoi(argv[i]);
else {
usage();
return -1;
}
}
else if (strcmp(argv[i], "-h") == 0) {
if (argv[++i])
g_height = atoi(argv[i]);
else {
usage();
return -1;
}
}
else if (strcmp(argv[i], "-t") == 0) {
if (argv[++i])
g_top = atoi(argv[i]);
else {
usage();
return -1;
}
}
else if (strcmp(argv[i], "-l") == 0) {
if (argv[++i])
g_left = atoi(argv[i]);
else {
usage();
return -1;
}
}
else if (strcmp(argv[i], "-c") == 0) {
g_convert = 1;
}
else if (strcmp(argv[i], "-m") == 0) {
if (argv[++i])
g_capture_mode = atoi(argv[i]);
else {
usage();
return -1;
}
}
else if (strcmp(argv[i], "-d") == 0) {
strcpy(g_v4l_device, argv[++i]);
}
else if (strcmp(argv[i], "-fr") == 0) {
if (argv[++i])
g_camera_framerate = atoi(argv[i]);
else {
usage();
return -1;
}
}
else if (strcmp(argv[i], "-f") == 0) {
i++;
if (strcmp(argv[i], "NV12") == 0) {
g_pixelformat = IPU_PIX_FMT_NV12;
g_bpp = 12;
}
else if (strcmp(argv[i], "YUV420") == 0) {
g_pixelformat = IPU_PIX_FMT_YUV420P2;
g_bpp = 12;
}
else if (strcmp(argv[i], "YUV422P") == 0) {
g_pixelformat = IPU_PIX_FMT_YUV422P;
g_bpp = 16;
}
else if (strcmp(argv[i], "YUYV") == 0) {
g_pixelformat = IPU_PIX_FMT_YUYV;
g_bpp = 16;
}
else if (strcmp(argv[i], "UYVY") == 0) {
g_pixelformat = IPU_PIX_FMT_UYVY;
g_bpp = 16;
}
else if (strcmp(argv[i], "YUV444") == 0) {
g_pixelformat = IPU_PIX_FMT_YUV444;
g_bpp = 32;
}
else if (strcmp(argv[i], "RGB565") == 0) {
g_pixelformat = IPU_PIX_FMT_RGB565;
g_bpp = 16;
}
else {
printf("Pixel format not supported.\n");
usage();
return -1;
}
}
else {
usage();
return -1;
}
}
ret = v4l_capture_setup(&fd_v4l);
if (ret)
return ret;
ret = v4l_capture_test(fd_v4l);
return ret;
}

View File

@ -1,97 +0,0 @@
/*
* fmtheaders.h
*/
#ifndef _FMTHEADERS_H
#define _FMTHEADERS_H 1
#include <sys/types.h>
/* Definitions for .VOC files */
#define MAGIC_STRING "Creative Voice File\x1A"
#define ACTUAL_VERSION 0x010A
#define VOC_SAMPLESIZE 8
#define MODE_MONO 0
#define MODE_STEREO 1
#define DATALEN(bp) ((u_long)(bp->datalen) | \
((u_long)(bp->datalen_m) << 8) | \
((u_long)(bp->datalen_h) << 16) )
typedef struct _vocheader {
u_char magic[20]; /* must be MAGIC_STRING */
u_short headerlen; /* Headerlength, should be 0x1A */
u_short version; /* VOC-file version */
u_short coded_ver; /* 0x1233-version */
} VocHeader;
typedef struct _blocktype {
u_char type;
u_char datalen; /* low-byte */
u_char datalen_m; /* medium-byte */
u_char datalen_h; /* high-byte */
} BlockType;
typedef struct _voice_data {
u_char tc;
u_char pack;
} Voice_data;
typedef struct _ext_block {
u_short tc;
u_char pack;
u_char mode;
} Ext_Block;
/* Definitions for Microsoft WAVE format */
#define RIFF 0x46464952
#define WAVE 0x45564157
#define FMT 0x20746D66
#define DATA 0x61746164
#define PCM_CODE 1
#define WAVE_MONO 1
#define WAVE_STEREO 2
/* it's in chunks like .voc and AMIGA iff, but my source say there
are in only in this combination, so I combined them in one header;
it works on all WAVE-file I have
*/
typedef struct _waveheader {
u_long main_chunk; /* 'RIFF' */
u_long length; /* filelen */
u_long chunk_type; /* 'WAVE' */
u_long sub_chunk; /* 'fmt ' */
u_long sc_len; /* length of sub_chunk, =16 */
u_short format; /* should be 1 for PCM-code */
u_short modus; /* 1 Mono, 2 Stereo */
u_long sample_fq; /* frequence of sample */
u_long byte_p_sec;
u_short byte_p_spl; /* samplesize; 1 or 2 bytes */
u_short bit_p_spl; /* 8, 12 or 16 bit */
u_long data_chunk; /* 'data' */
u_long data_length; /* samplecount */
} WaveHeader;
typedef struct {
long magic; /* must be equal to SND_MAGIC */
long dataLocation; /* Offset or pointer to the raw data */
long dataSize; /* Number of bytes of data in the raw data */
long dataFormat; /* The data format code */
long samplingRate; /* The sampling rate */
long channelCount; /* The number of channels */
} SndHeader;
#define SND_MAGIC ((long int)0x2e736e64)
#define SND_FORMAT_UNSPECIFIED (0)
#define SND_FORMAT_MULAW_8 (1)
#define SND_FORMAT_LINEAR_8 (2)
#define SND_FORMAT_LINEAR_16 (3)
#define SND_FORMAT_LINEAR_24 (4)
#define SND_FORMAT_LINEAR_32 (5)
#define SND_FORMAT_FLOAT (6)
#endif

View File

@ -1,945 +0,0 @@
/*
* vplay.c
*
* Copyright (C) 2009-2013 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* Description: play and record sound files
*
* Just cosmetic changes of vplay.c from OSS project:
*
* <http://www.opensound.com/oss.html>
* <http://mercurial.opensound.com/>
*
* with following original notice:
*
* vplay.c - plays and records
* CREATIVE LABS VOICE-files, Microsoft WAVE-files and raw data
*
* Autor: Michael Beck - beck@informatik.hu-berlin.de
*
*/
#include <stdio.h>
#include <malloc.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include "fmtheaders.h"
#include <netinet/in.h>
#define DEFAULT_DSP_SPEED 8000
#define RECORD 0
#define PLAY 1
#define AUDIO "/dev/dsp"
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define d_printf(x) if (verbose_mode) fprintf x
#define VOC_FMT 0
#define WAVE_FMT 1
#define RAW_DATA 2
#define SND_FMT 3
/* global data */
int timelimit = 0, dsp_speed = DEFAULT_DSP_SPEED, dsp_stereo = 0;
int samplesize = 8;
int quiet_mode = 0;
int verbose_mode = 0;
int convert = 0;
int record_type = VOC_FMT;
u_long count;
int audio, abuf_size, zbuf_size;
int direction, omode;
u_char *audiobuf, *zerobuf;
char *command;
int vocminor, vocmajor; /* .VOC version */
/* defaults for playing raw data */
struct {
int timelimit, dsp_speed, dsp_stereo, samplesize;
} raw_info = {
0, DEFAULT_DSP_SPEED, 0, 8
};
/* needed prototypes */
void record_play(char *name);
void start_voc(int fd, u_long count);
void start_wave(int fd, u_long count);
void start_snd(int fd, u_long count);
void end_voc(int fd);
void end_wave_raw(int fd);
void end_snd(int fd);
u_long calc_count();
struct fmt_record {
void (*start) (int fd, u_long count);
void (*end) (int fd);
char *what;
} fmt_rec_table[] = {
{start_voc, end_voc, "VOC"},
{start_wave, end_wave_raw, "WAVE"},
{NULL, end_wave_raw, "raw data"},
{start_snd, end_snd, "SND"}
};
int main(int argc, char *argv[])
{
int c, n = 0;
command = argv[0];
if (strstr(argv[0], "vrec")) {
direction = RECORD;
omode = O_RDONLY;
} else if (strstr(argv[0], "vplay")) {
direction = PLAY;
omode = O_WRONLY;
} else {
fprintf(stderr, "Error: command should be named either vrec or vplay\n");
exit(1);
}
while ((c = getopt(argc, argv, "aqs:St:b:vrwd")) != EOF)
switch (c) {
case 'S':
dsp_stereo = raw_info.dsp_stereo = 1;
break;
case 'q':
quiet_mode = 1;
break;
case 'r':
record_type = RAW_DATA;
break;
case 'v':
record_type = VOC_FMT;
break;
case 'w':
record_type = WAVE_FMT;
break;
case 'a':
record_type = SND_FMT;
break;
case 's':
dsp_speed = atoi(optarg);
if (dsp_speed < 300)
dsp_speed *= 1000;
raw_info.dsp_speed = dsp_speed;
break;
case 't':
timelimit = raw_info.timelimit = atoi(optarg);
break;
case 'b':
samplesize = raw_info.samplesize = atoi(optarg);
break;
case 'd':
verbose_mode = 1;
quiet_mode = 0;
break;
default:
fprintf(stderr,
"Usage: %s [-qvwraS] [-t secs] [-s Hz] [-b 8|12|16] [filename]\n",
command);
exit(-1);
}
audio = open(AUDIO, omode, 0);
if (audio == -1) {
perror(AUDIO);
exit(-1);
}
abuf_size = -1;
ioctl(audio, SNDCTL_DSP_GETBLKSIZE, &abuf_size);
if (abuf_size < 4 || abuf_size > 65536) {
if (abuf_size == -1) {
perror(AUDIO);
exit(-1);
}
abuf_size = 1024;
}
zbuf_size = 256;
if ((audiobuf = (u_char *) malloc(abuf_size)) == NULL ||
(zerobuf = (u_char *) malloc(zbuf_size)) == NULL) {
fprintf(stderr, "%s: unable to allocate input/output buffer\n", command);
exit(-1);
}
memset((char *)zerobuf, 128, zbuf_size);
if (optind > argc - 1)
record_play(NULL);
else
while (optind <= argc - 1) {
if (n++ > 0)
if (ioctl(audio, SNDCTL_DSP_SYNC, NULL) < 0) {
perror(AUDIO);
exit(-1);
}
record_play(argv[optind++]);
}
close(audio);
return 0;
}
/*
* Function: test_vocfile
* Description: test, if it is a .VOC file
* Return: >= 0 if ok (this is the length of rest)
* < 0 if not
*/
int test_vocfile(void *buffer)
{
VocHeader *vp = buffer;
if (!strcmp((const char *)vp->magic, MAGIC_STRING)) {
vocminor = vp->version & 0xFF;
vocmajor = vp->version / 256;
if (vp->version != (0x1233 - vp->coded_ver))
return -2; /* coded version mismatch */
return vp->headerlen - sizeof(VocHeader); /* 0 mostly */
}
return -1; /* magic string fail */
}
/*
* Function: test_wavefile
* Description: test, if it is a .WAV file
* Return: 0 if ok (and set the speed, stereo etc.)
* < 0 if not
*/
int test_wavefile(void *buffer)
{
WaveHeader *wp = buffer;
if (wp->main_chunk == RIFF && wp->chunk_type == WAVE &&
wp->sub_chunk == FMT && wp->data_chunk == DATA) {
if (wp->format != PCM_CODE) {
fprintf(stderr, "%s: can't play not PCM-coded WAVE-files\n", command);
exit(-1);
}
if (wp->modus > 2) {
fprintf(stderr,
"%s: can't play WAVE-files with %d tracks\n",
command, wp->modus);
exit(-1);
}
dsp_stereo = (wp->modus == WAVE_STEREO) ? 1 : 0;
samplesize = wp->bit_p_spl;
dsp_speed = wp->sample_fq;
count = wp->data_length;
return 0;
}
return -1;
}
/*
* Function: test_sndfile
* Description: test, if it is a .SND file
* Return: 0 if ok (and set the speed, stereo etc.)
* < 0 if not
*/
int test_sndfile(void *buffer, int fd)
{
long infolen;
char *info;
SndHeader *snd = buffer;
if (snd->magic == SND_MAGIC)
convert = 0;
else {
if (htonl(snd->magic) == SND_MAGIC) {
convert = 1;
snd->dataLocation = htonl(snd->dataLocation);
snd->dataSize = htonl(snd->dataSize);
snd->dataFormat = htonl(snd->dataFormat);
snd->samplingRate = htonl(snd->samplingRate);
snd->channelCount = htonl(snd->channelCount);
} else {
/* No SoundFile */
return (-1);
}
}
switch (snd->dataFormat) {
case SND_FORMAT_LINEAR_8:
samplesize = 8;
break;
case SND_FORMAT_LINEAR_16:
samplesize = 16;
break;
default:
fprintf(stderr, "%s: Unsupported SND_FORMAT\n", command);
exit(-1);
}
dsp_stereo = (snd->channelCount == 2) ? 1 : 0;
dsp_speed = snd->samplingRate;
count = snd->dataSize;
/* read Info-Strings */
infolen = snd->dataLocation - sizeof(SndHeader);
info = (char *)malloc(infolen);
read(fd, info, infolen);
if (!quiet_mode)
fprintf(stderr, "SoundFile Info: %s\n", info);
free(info);
return 0;
}
/*
* Function: write_zeros
* Description: write zeros from zerobuf to simulate silence
*/
void write_zeros(unsigned x)
{
unsigned l;
while (x) {
l = min(x, zbuf_size);
if (write(audio, (char *)zerobuf, l) != l) {
perror(AUDIO);
exit(-1);
}
x -= l;
}
}
/*
* Function: sync_dsp
* Description: (is needed if we plan to change speed, stereo ... during output)
*/
void sync_dsp(void)
{
#if 0
if (ioctl(audio, SNDCTL_DSP_SYNC, NULL) < 0) {
perror(AUDIO);
exit(-1);
}
#endif
}
/*
* Function: set_dsp_speed
* Description: set the speed for output
*/
void set_dsp_speed(int *dsp_speed)
{
if (ioctl(audio, SNDCTL_DSP_SPEED, dsp_speed) < 0) {
fprintf(stderr, "%s: unable to set audio speed\n", command);
perror(AUDIO);
exit(-1);
}
}
/*
* Function: one_channel
* Description:
*
* if to_mono:
* compress 8 bit stereo data 2:1, needed if we want play 'one track';
* this is useful, if you habe SB 1.0 - 2.0 (I have 1.0) and want
* hear the sample (in Mono)
*
* if to_8:
* compress 16 bit to 8 by using hi-byte; wave-files use signed words,
* so we need to convert it in "unsigned" sample (0x80 is now zero)
*
* WARNING: this procedure can't compress 16 bit stereo to 16 bit mono,
* because if you have a 16 (or 12) bit card you should have
* stereo (or I'm wrong ?? )
*/
u_long one_channel(u_char * buf, u_long l, char to_mono, char to_8)
{
register u_char *w = buf;
register u_char *w2 = buf;
char ofs = 0;
u_long incr = 0;
u_long c, ret;
if (to_mono)
++incr;
if (to_8) {
++incr;
++w2;
ofs = 128;
}
ret = c = l >> incr;
incr = incr << 1;
while (c--) {
*w++ = *w2 + ofs;
w2 += incr;
}
return ret;
}
/*
* Function: vplay
* Description: play a .voc file
*/
void vplay(int fd, int ofs, char *name)
{
int l, real_l;
BlockType *bp;
Voice_data *vd;
Ext_Block *eb;
u_long nextblock, in_buffer;
u_char *data = audiobuf;
char was_extended = 0, output = 0;
u_short *sp, repeat = 0;
u_long silence;
int filepos = 0;
char one_chn = 0;
#define COUNT(x) nextblock -= x; in_buffer -=x ;data += x
/* first SYNC the dsp */
sync_dsp();
if (!quiet_mode)
fprintf(stderr, "Playing Creative Labs Voice file ...\n");
/* first we waste the rest of header, ugly but we don't need seek */
while (ofs > abuf_size) {
read(fd, (char *)audiobuf, abuf_size);
ofs -= abuf_size;
}
if (ofs)
read(fd, audiobuf, ofs);
/* .voc files are 8 bit (now) */
samplesize = VOC_SAMPLESIZE;
ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &samplesize);
if (samplesize != VOC_SAMPLESIZE) {
fprintf(stderr, "%s: unable to set 8 bit sample size!\n", command);
exit(-1);
}
/* and there are MONO by default */
dsp_stereo = MODE_MONO;
ioctl(audio, SNDCTL_DSP_STEREO, &dsp_stereo);
in_buffer = nextblock = 0;
while (1) {
Fill_the_buffer: /* need this for repeat */
if (in_buffer < 32) {
/* move the rest of buffer to pos 0 and fill the audiobuf up */
if (in_buffer)
memcpy((char *)audiobuf, data, in_buffer);
data = audiobuf;
if ((l =
read(fd, (char *)audiobuf + in_buffer, abuf_size - in_buffer)) > 0)
in_buffer += l;
else if (!in_buffer) {
/* the file is truncated, so simulate 'Terminator'
and reduce the datablock for save landing */
nextblock = audiobuf[0] = 0;
if (l == -1) {
perror(name);
exit(-1);
}
}
}
while (!nextblock) { /* this is a new block */
bp = (BlockType *) data;
COUNT(sizeof(BlockType));
nextblock = DATALEN(bp);
if (output && !quiet_mode)
fprintf(stderr, "\n"); /* write /n after ASCII-out */
output = 0;
switch (bp->type) {
case 0:
d_printf((stderr, "Terminator\n"));
return; /* VOC-file stop */
case 1:
vd = (Voice_data *) data;
COUNT(sizeof(Voice_data));
/* we need a SYNC, before we can set new SPEED, STEREO ... */
sync_dsp();
if (!was_extended) {
dsp_speed = (int)(vd->tc);
dsp_speed = 1000000 / (256 - dsp_speed);
d_printf((stderr, "Voice data %d Hz\n", dsp_speed));
if (vd->pack) { /* /dev/dsp can't it */
fprintf(stderr,
"%s: can't play packed .voc files\n",
command);
return;
}
if (dsp_stereo) { /* if we are in Stereo-Mode, switch back */
dsp_stereo = MODE_MONO;
ioctl(audio, SNDCTL_DSP_STEREO, &dsp_stereo);
}
} else { /* there was extended block */
if (one_chn) /* if one Stereo fails, why test another ? */
dsp_stereo = MODE_MONO;
else if (dsp_stereo) { /* want Stereo */
/* shit, my MACRO dosn't work here */
#ifdef SOUND_VERSION
if (ioctl
(audio, SNDCTL_DSP_STEREO,
&dsp_stereo) < 0) {
#else
if (dsp_stereo !=
ioctl(audio,
SNDCTL_DSP_STEREO, dsp_stereo)) {
#endif
dsp_stereo = MODE_MONO;
fprintf(stderr,
"%s: can't play in Stereo; playing only one channel\n",
command);
one_chn = 1;
}
}
was_extended = 0;
}
set_dsp_speed(&dsp_speed);
break;
case 2: /* nothing to do, pure data */
d_printf((stderr, "Voice continuation\n"));
break;
case 3: /* a silence block, no data, only a count */
sp = (u_short *) data;
COUNT(sizeof(u_short));
dsp_speed = (int)(*data);
COUNT(1);
dsp_speed = 1000000 / (256 - dsp_speed);
sync_dsp();
set_dsp_speed(&dsp_speed);
silence = (((u_long) * sp) * 1000) / dsp_speed;
d_printf((stderr, "Silence for %ld ms\n", silence));
write_zeros(*sp);
break;
case 4: /* a marker for syncronisation, no effect */
sp = (u_short *) data;
COUNT(sizeof(u_short));
d_printf((stderr, "Marker %d\n", *sp));
break;
case 5: /* ASCII text, we copy to stderr */
output = 1;
d_printf((stderr, "ASCII - text :\n"));
break;
case 6: /* repeat marker, says repeatcount */
/* my specs don't say it: maybe this can be recursive, but
I don't think somebody use it */
repeat = *(u_short *) data;
COUNT(sizeof(u_short));
d_printf((stderr, "Repeat loop %d times\n", repeat));
if (filepos >= 0) /* if < 0, one seek fails, why test another */
if ((filepos = lseek(fd, 0, 1)) < 0) {
fprintf(stderr,
"%s: can't play loops; %s isn't seekable\n",
command, name);
repeat = 0;
} else
filepos -= in_buffer; /* set filepos after repeat */
else
repeat = 0;
break;
case 7: /* ok, lets repeat that be rewinding tape */
if (repeat) {
if (repeat != 0xFFFF) {
d_printf((stderr, "Repeat loop %d\n", repeat));
--repeat;
} else
d_printf((stderr, "Neverending loop\n"));
lseek(fd, filepos, 0);
in_buffer = 0; /* clear the buffer */
goto Fill_the_buffer;
} else
d_printf((stderr, "End repeat loop\n"));
break;
case 8: /* the extension to play Stereo, I have SB 1.0 :-( */
was_extended = 1;
eb = (Ext_Block *) data;
COUNT(sizeof(Ext_Block));
dsp_speed = (int)(eb->tc);
dsp_speed = 256000000L / (65536 - dsp_speed);
dsp_stereo = eb->mode;
if (dsp_stereo == MODE_STEREO)
dsp_speed = dsp_speed >> 1;
if (eb->pack) { /* /dev/dsp can't it */
fprintf(stderr,
"%s: can't play packed .voc files\n", command);
return;
}
d_printf((stderr, "Extended block %s %d Hz\n",
(eb->mode ? "Stereo" : "Mono"), dsp_speed));
break;
default:
fprintf(stderr,
"%s: unknown blocktype %d. terminate.\n",
command, bp->type);
return;
} /* switch (bp->type) */
} /* while (! nextblock) */
/* put nextblock data bytes to dsp */
l = min(in_buffer, nextblock);
if (l) {
if (output && !quiet_mode)
write(2, data, l); /* to stderr */
else {
real_l = one_chn ? one_channel(data, l, one_chn, 0) : l;
if (write(audio, data, real_l) != real_l) {
perror(AUDIO);
exit(-1);
}
}
COUNT(l);
}
} /* while(1) */
}
/*
* Function: init_raw_data
* Description: set the globals for playing raw data
*/
void init_raw_data(void)
{
timelimit = raw_info.timelimit;
dsp_speed = raw_info.dsp_speed;
dsp_stereo = raw_info.dsp_stereo;
samplesize = raw_info.samplesize;
}
/*
* Function: calc_count
* Description: calculate the data count to read from/to dsp
*/
u_long calc_count(void)
{
u_long count;
if (!timelimit)
count = 0x7fffffff;
else {
count = timelimit * dsp_speed;
if (dsp_stereo)
count *= 2;
if (samplesize != 8)
count *= 2;
}
return count;
}
/*
* Function: start_voc
* Description: write a VOC header
*/
void start_voc(int fd, u_long cnt)
{
VocHeader vh;
BlockType bt;
Voice_data vd;
Ext_Block eb;
strcpy((char *)vh.magic, MAGIC_STRING);
vh.headerlen = sizeof(VocHeader);
vh.version = ACTUAL_VERSION;
vh.coded_ver = 0x1233 - ACTUAL_VERSION;
write(fd, &vh, sizeof(VocHeader));
if (dsp_stereo) {
/* write a extended block */
bt.type = 8;
bt.datalen = 4;
bt.datalen_m = bt.datalen_h = 0;
write(fd, &bt, sizeof(BlockType));
eb.tc = (u_short) (65536 - 256000000L / (dsp_speed << 1));
eb.pack = 0;
eb.mode = 1;
write(fd, &eb, sizeof(Ext_Block));
}
bt.type = 1;
cnt += sizeof(Voice_data); /* Voice_data block follows */
bt.datalen = (u_char) (cnt & 0xFF);
bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8);
bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
write(fd, &bt, sizeof(BlockType));
vd.tc = (u_char) (256 - (1000000 / dsp_speed));
vd.pack = 0;
write(fd, &vd, sizeof(Voice_data));
}
/*
* Function: start_wave
* Description: write a WAVE header
*/
void start_wave(int fd, u_long cnt)
{
WaveHeader wh;
wh.main_chunk = RIFF;
wh.length = cnt + sizeof(WaveHeader) - 8;
wh.chunk_type = WAVE;
wh.sub_chunk = FMT;
wh.sc_len = 16;
wh.format = PCM_CODE;
wh.modus = dsp_stereo ? 2 : 1;
wh.sample_fq = dsp_speed;
wh.byte_p_spl = ((samplesize == 8) ? 1 : 2) * (dsp_stereo ? 2 : 1);
wh.byte_p_sec = dsp_speed * wh.modus * wh.byte_p_spl;
wh.bit_p_spl = samplesize;
wh.data_chunk = DATA;
wh.data_length = cnt;
write(fd, &wh, sizeof(WaveHeader));
}
/*
* Function: end_voc
* Description: close VOC
*/
void end_voc(int fd)
{
char dummy = 0; /* Write a Terminator */
write(fd, &dummy, 1);
if (fd != 1)
close(fd);
}
/*
* Function: end_wave_raw
* Description: close WAV, RAW
*/
void end_wave_raw(int fd)
{ /* only close output */
if (fd != 1)
close(fd);
}
/*
* Function: start_snd
* Description: write a SND header
*/
void start_snd(int fd, u_long count)
{
SndHeader snd;
char *sndinfo = "Recorded by vrec\000";
snd.magic = SND_MAGIC;
snd.dataLocation = sizeof(SndHeader) + strlen(sndinfo);
snd.dataSize = count;
switch (samplesize) {
case 8:
snd.dataFormat = SND_FORMAT_LINEAR_8;
break;
case 16:
snd.dataFormat = SND_FORMAT_LINEAR_16;
break;
default:
fprintf(stderr,
"%d bit: unsupported sample size for NeXt sound file!\n", samplesize);
exit(-1);
}
snd.samplingRate = dsp_speed;
snd.channelCount = dsp_stereo ? 2 : 1;
write(fd, &snd, sizeof(SndHeader));
write(fd, sndinfo, strlen(sndinfo));
}
/*
* Function: end_snd
* Description: close SND
*/
void end_snd(int fd)
{
if (fd != 1)
close(fd);
}
/*
* Function: recplay
* Description: play/record raw data. This proc handles WAVE files and recording
* VOCs (as one block)
*/
void recplay(int fd, int loaded, u_long count, int rtype, char *name)
{
int l, real_l;
u_long c;
char one_chn = 0;
char to_8 = 0;
int tmps;
sync_dsp();
tmps = samplesize;
ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &tmps);
if (tmps != samplesize) {
fprintf(stderr, "%s: unable to set %d bit sample size", command, samplesize);
if (samplesize == 16) {
samplesize = 8;
ioctl(audio, SNDCTL_DSP_SAMPLESIZE, &samplesize);
if (samplesize != 8) {
fprintf(stderr,
"%s: unable to set 8 bit sample size!\n", command);
exit(-1);
}
fprintf(stderr, "; playing 8 bit\n");
to_8 = 1;
} else {
fprintf(stderr, "\n");
exit(-1);
}
}
#ifdef SOUND_VERSION
if (ioctl(audio, SNDCTL_DSP_STEREO, &dsp_stereo) < 0) {
#else
if (dsp_stereo != ioctl(audio, SNDCTL_DSP_STEREO, dsp_stereo)) {
#endif
if (direction == PLAY) {
fprintf(stderr,
"%s: can't play in Stereo; playing only one channel\n",
command);
dsp_stereo = MODE_MONO;
one_chn = 1;
} else {
fprintf(stderr, "%s: can't record in Stereo\n", command);
exit(-1);
}
}
set_dsp_speed(&dsp_speed);
if (!quiet_mode) {
fprintf(stderr, "%s %s : ",
(direction == PLAY) ? "Playing" : "Recording",
fmt_rec_table[rtype].what);
if (samplesize != 8)
fprintf(stderr, "%d bit, ", samplesize);
fprintf(stderr, "Speed %d Hz ", dsp_speed);
fprintf(stderr, "%d bits ", samplesize);
fprintf(stderr, "%s ...\n", dsp_stereo ? "Stereo" : "Mono");
}
if (direction == PLAY) {
while (count) {
c = count;
if (c > abuf_size)
c = abuf_size;
if ((l = read(fd, (char *)audiobuf + loaded, c - loaded)) > 0) {
l += loaded;
loaded = 0; /* correct the count; ugly but ... */
real_l = (one_chn
|| to_8) ? one_channel(audiobuf, l,
one_chn, to_8) : l;
/* change byte order if necessary */
if (convert && (samplesize == 16)) {
long i;
for (i = 0; i < real_l; i += 2)
*((short *)(audiobuf + i)) =
htons(*((short *)(audiobuf + i)));
}
if (write(audio, (char *)audiobuf, real_l) != real_l) {
perror(AUDIO);
exit(-1);
}
count -= l;
} else {
if (l == -1) {
perror(name);
exit(-1);
}
count = 0; /* Stop */
}
} /* while (count) */
} else { /* we are recording */
while (count) {
c = count;
if (c > abuf_size)
c = abuf_size;
if ((l = read(audio, (char *)audiobuf, c)) > 0) {
if (write(fd, (char *)audiobuf, l) != l) {
perror(name);
exit(-1);
}
count -= l;
}
if (l == -1) {
perror(AUDIO);
exit(-1);
}
} /* While count */
}
}
/*
* Function: record_play
* Description: play or record a file
*/
void record_play(char *name)
{
int fd, ofs;
if (direction == PLAY) {
if (!name) {
fd = 0;
name = "stdin";
} else if ((fd = open(name, O_RDONLY, 0)) == -1) {
perror(name);
exit(-1);
}
/* Read the smallest header first, then the
missing bytes for the next, etc. */
/* read SND-header */
read(fd, (char *)audiobuf, sizeof(SndHeader));
if (test_sndfile(audiobuf, fd) >= 0)
recplay(fd, 0, count, SND_FMT, name);
else {
/* read VOC-Header */
read(fd, (char *)audiobuf + sizeof(SndHeader),
sizeof(VocHeader) - sizeof(SndHeader));
if ((ofs = test_vocfile(audiobuf)) >= 0)
vplay(fd, ofs, name);
else {
/* read bytes for WAVE-header */
read(fd, (char *)audiobuf + sizeof(VocHeader),
sizeof(WaveHeader) - sizeof(VocHeader));
if (test_wavefile(audiobuf) >= 0)
recplay(fd, 0, count, WAVE_FMT, name);
else {
/* should be raw data */
init_raw_data();
count = calc_count();
recplay(fd, sizeof(WaveHeader), count, RAW_DATA, name);
}
}
}
if (fd != 0)
close(fd);
} else { /* recording ... */
if (!name) {
fd = 1;
name = "stdout";
} else {
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) {
perror(name);
exit(-1);
}
}
count = calc_count() & 0xFFFFFFFE;
/* WAVE-file should be even (I'm not sure), but wasting one byte
isn't a problem (this can only be in 8 bit mono) */
if (fmt_rec_table[record_type].start)
fmt_rec_table[record_type].start(fd, count);
recplay(fd, 0, count, record_type, name);
fmt_rec_table[record_type].end(fd);
}
}

View File

@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca
DEPENDS = "libsoc libsocketcan libgpiod"
SRCBRANCH ?= "dey-3.0/maint"
SRCBRANCH ?= "master"
SRCREV = "${AUTOREV}"
LIBDIGIAPIX_URI_STASH = "${DIGI_MTK_GIT}dey/libdigiapix.git;protocol=ssh"

View File

@ -9,7 +9,6 @@ inherit packagegroup
RDEPENDS_${PN} = "\
${@bb.utils.contains("MACHINE_FEATURES", "alsa", "dey-examples-alsa", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "alsa", "dey-examples-vplay", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt-gatt-server", "", d)} \
@ -23,18 +22,9 @@ RDEPENDS_${PN} = "\
dey-examples-digiapix \
dey-examples-rtc \
"
RDEPENDS_${PN}_append_ccimx6 = "\
${@bb.utils.contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \
dey-examples-v4l2 \
"
RDEPENDS_${PN}_append_ccimx8x = "\
dey-examples-v4l2 \
"
RDEPENDS_${PN}_append_ccimx8m = "\
dey-examples-v4l2 \
"
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x|ccimx8m)"

View File

@ -297,6 +297,7 @@ BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant | tr -d '\0')"
BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn | tr -d '\0')"
BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version | tr -d '\0')"
BOARD_ID="$(cat /proc/device-tree/digi,carrierboard,id | tr -d '\0')"
SOC_REV="$(cat /proc/device-tree/cpus/rev | tr -d '\0')"
if grep -qs '\<digi,ccimx6ul\>' /proc/device-tree/compatible; then
MCA_NODE="/sys/bus/i2c/devices/0-007e"
@ -328,7 +329,11 @@ REPORT_PATH="/tmp/sysinfo-${DEY_VERSION}-${BOARD_SN}-${DATE}"
echo ""
echo "||*Component*||*Version*"
echo "|| DUT | SN-${BOARD_SN}, ${MACHINE} ${BOARD_VARIANT} SBCv${BOARD_VERSION} board_ID=${BOARD_ID}."
if [ -n "$SOC_REV" ]; then
echo "|| DUT | SN-${BOARD_SN}, ${MACHINE} ${BOARD_VARIANT} SBCv${BOARD_VERSION} board_ID=${BOARD_ID} SOC_REV=${SOC_REV}."
else
echo "|| DUT | SN-${BOARD_SN}, ${MACHINE} ${BOARD_VARIANT} SBCv${BOARD_VERSION} board_ID=${BOARD_ID}."
fi
echo "|| U-Boot | ${UBOOT_VERSION}"
echo "|| Firmware | ${DISTRO}-${DEY_VERSION}-$(cat /etc/version)"
echo "|| Kernel | $(uname -a)"

View File

@ -0,0 +1,3 @@
# Copyright 2020, Digi International Inc.
BBCLASSEXTEND_append = " nativesdk"

View File

@ -1,6 +0,0 @@
require recipes-graphics/imx-dpu-g2d/imx-dpu-g2d_1.7.0.bb
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[md5sum] = "5e6af255a9a8f76bc2ad2e82e039b526"
SRC_URI[sha256sum] = "7266413be48e1e517e17c78d6d32cafb2e08eecb840716c9117c834dd7227145"

View File

@ -0,0 +1,8 @@
require recipes-graphics/imx-dpu-g2d/imx-dpu-g2d_1.7.0.bb
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[md5sum] = "2b8fea58c87a724c1d5c023ee8bd551b"
SRC_URI[sha256sum] = "7533e34f447e8b076fa6461ac83806efdd677310094741eef2a67858034730fe"
RDEPENDS_${PN} += "libopencl-imx"

View File

@ -1,10 +0,0 @@
require recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.4.p4.0.bb
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
FSLBIN_NAME_arm = "${PN}-${PV}-${TARGET_ARCH}"
SRC_URI[aarch64.md5sum] = "89a3f1329f3e09b6c327bb70a74b00d9"
SRC_URI[aarch64.sha256sum] = "0e1a3112eacdd45d1ebb41257d8ff92608128c512f06b9467454f2f47b86cc50"
SRC_URI[arm.md5sum] = "6e8f7ef862ffbefe19fab2e99cab6c5a"
SRC_URI[arm.sha256sum] = "ad737f53291d71be57c2e0e8e93e5dbc4e95d63a790f98f662188ce4d6ace3ed"

View File

@ -0,0 +1,10 @@
require recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.4.p4.0.bb
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
FSLBIN_NAME_arm = "${PN}-${PV}-${TARGET_ARCH}"
SRC_URI[aarch64.md5sum] = "88f98e03f3f85c9a768ea5e4ff7475fa"
SRC_URI[aarch64.sha256sum] = "553bbe9ee1caa222fd14b835deb2afedf9ed936b7a13424328df75892286f666"
SRC_URI[arm.md5sum] = "3b12892309d166554c697a87e8084b16"
SRC_URI[arm.sha256sum] = "010bab5780476f26406e16b058514453dc235a0e7f4b995fa03c976d06e5cb96"

View File

@ -13,9 +13,15 @@ GLES3_HEADER_REMOVALS_mx8mp = "gl32.h"
FILES_libgbm-imx_mx8 = "${libdir}/libgbm*${SOLIBS}"
FILES_libopenvx-imx = "${libdir}/libOpenVX*${SOLIBS} ${libdir}/libOvx*${SOLIBS}"
FILES_libopenvx-imx-dev = "${includedir}/VX"
FILES_libvulkan-imx_append = " ${libdir}/libvulkan_VSI${REALSOLIBS}"
INSANE_SKIP_libvulkan-imx += "dev-so"
FILES_libopenvx-imx_append = " ${libdir}/libOpenVX${REALSOLIBS} ${libdir}/libOvx*${SOLIBS}"
RDEPENDS_libopenvx-imx = "libnn-imx"
INSANE_SKIP_libopenvx-imx += "dev-so"
FILES_libopencl-imx_append = " ${libdir}/libOpenCL${REALSOLIBS}"
INSANE_SKIP_libopencl-imx += "dev-so"
FILES_libnn-imx = "${libdir}/libNN*${SOLIBS}"

View File

@ -1,17 +0,0 @@
require imx-gpu-viv-v6.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
# FIXME: Remove this patch when upstream handles backend-specific libGL
SRC_URI += "file://Add-dummy-libgl.patch"
SRC_URI[md5sum] = "66a99971a0fd6c49840194096720f639"
SRC_URI[sha256sum] = "5609e0e22fc0bd88f2bd5e8c5e4e3f3c08701e144a22ffe741cdbe6877b4dd77"
do_install_append() {
if [ "${USE_WL}" = "yes" -o "${USE_X11}" = "yes" ]; then
cp ${S}/gpu-core/usr/lib/libGL-${backend}.so ${D}${libdir}/libGL.so.1.2.0
fi
}
COMPATIBLE_MACHINE = "(mx8)"

View File

@ -5,8 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
# FIXME: Remove this patch when upstream handles backend-specific libGL
SRC_URI += "file://Add-dummy-libgl.patch"
SRC_URI[md5sum] = "4733a2638815fe2242a396a1e9385258"
SRC_URI[sha256sum] = "cd3bc4d6be6d620aa8b15ed783b1d1e5a1b209130e12bc96163af0ab7d07e371"
SRC_URI[md5sum] = "cd5e9ba9247aa0da5d97b0f030e2ede1"
SRC_URI[sha256sum] = "9cc4c6594083f5970bc394a698a0a8ed0c7f2a1a753dfbf25cb0be5ab8bdcbd5"
do_install_append() {
if [ "${IS_MX6SL}" != "1" ]; then

View File

@ -0,0 +1,31 @@
require imx-gpu-viv-v6.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[md5sum] = "633029434f0ccc0e8a6b01d92cae95b2"
SRC_URI[sha256sum] = "a295f41a6346c507fc8a677c26ecf9b2f416735e32e6d0734516ef5363027720"
do_install_append() {
if [ "${USE_WL}" = "yes" -o "${USE_X11}" = "yes" ]; then
cp ${S}/gpu-core/usr/lib/libGL-${backend}.so ${D}${libdir}/libGL.so.1.2.0
fi
# Remove the work done by the upstream install for libvulkan so
# we can install the newly versioned library files
rm ${D}${libdir}/libvulkan_VSI.so
# Copy backend-specific library and rename it for use by vulkan-loader
# library of the same name
for i in fb wl x11; do
if [ "$i" = "${backend}" ]; then
mv ${D}${libdir}/libvulkan-${backend}.so.1.1.3 ${D}${libdir}/libvulkan_VSI.so.1.1.3
else
rm ${D}${libdir}/libvulkan-${i}.so.1.1.3
fi
done
patchelf --set-soname libvulkan_VSI.so.1 ${D}${libdir}/libvulkan_VSI.so.1.1.3
rm ${D}${libdir}/libvulkan.so.1 ${D}${libdir}/libvulkan.so
ln -s libvulkan_VSI.so.1.1.3 ${D}${libdir}/libvulkan_VSI.so.1
ln -s libvulkan_VSI.so.1.1.3 ${D}${libdir}/libvulkan_VSI.so
}
COMPATIBLE_MACHINE = "(mx8)"

View File

@ -1 +0,0 @@
COMPATIBLE_MACHINE_imxgpu = "(-)"

View File

@ -1,3 +1,6 @@
DEPENDS_remove = "vulkan"
DEPENDS_append = " vulkan-headers vulkan-loader"
# Digi: The vulkan-validationlayers package is necessary for the demos to work
RDEPENDS_${PN} = "vulkan-validationlayers"

View File

@ -30,3 +30,9 @@ PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON -DD
PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland"
UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
# libvulkan.so is loaded dynamically, so put it in the main package
# instead of -dev
FILES_SOLIBSDEV = ""
FILES_${PN} += "${libdir}/lib*${SOLIBSDEV}"
INSANE_SKIP_${PN} += "dev-so"

View File

@ -3,7 +3,7 @@ require recipes-graphics/wayland/weston_7.0.0.bb
SRC_URI_remove = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz"
WESTON_SRC ?= "git://source.codeaurora.org/external/imx/weston-imx.git;protocol=https"
SRC_URI_prepend = "${WESTON_SRC};branch=weston-imx-8.0 "
SRCREV = "f6a7d35650121fbe7c20d4cbe0eaac730fab3b2a"
SRCREV = "27cde5253235104c45b8ce72963e7ae159134f89"
S = "${WORKDIR}/git"
# Disable OpenGL for parts with GPU support for 2D but not 3D

View File

@ -1,8 +1,6 @@
Section "Device"
Identifier "i.MX Accelerated DRM Device"
Driver "vivante"
Option "kmsdev" "/dev/dri/card0"
Option "fbdev" "/dev/fb0"
Section "Module"
Load "dri2"
Load "glamoregl"
EndSection
Section "ServerFlags"
@ -10,7 +8,4 @@ Section "ServerFlags"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
Option "Xinerama" "off"
Option "Clone" "on"
Option "SWcursor" "true"
EndSection

View File

@ -0,0 +1,32 @@
From ed3c55fa6260ad125a32f9ac67f9e44a9bce7cf1 Mon Sep 17 00:00:00 2001
From: Prabhu Sundararaj <prabhu.sundarara@nxp.com>
Date: Mon, 11 May 2020 19:12:51 -0500
Subject: [PATCH] MGS-5186 Per Specification EGL_NATIVE_PIXMAP_KHR requires
EGL_NO_CONTEXT
https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt
Per Specification EGL_NATIVE_PIXMAP_KHR requires EGL_NO_CONTEXT.
So passing context will result in error.
Signed-off-by: Prabhu Sundararaj <prabhu.sundarara@nxp.com>
---
hw/xwayland/xwayland-glamor-gbm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 80655fd16..e8c623e56 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -174,7 +174,7 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo,
xwl_pixmap->bo = bo;
xwl_pixmap->buffer = NULL;
xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display,
- xwl_screen->egl_context,
+ EGL_NO_CONTEXT /*xwl_screen->egl_context*/,
EGL_NATIVE_PIXMAP_KHR,
xwl_pixmap->bo, NULL);
if (xwl_pixmap->image == EGL_NO_IMAGE_KHR)
--
2.17.1

View File

@ -0,0 +1,32 @@
From 65b31124191b53e65d2cb2ab7349144f219543da Mon Sep 17 00:00:00 2001
From: Prabhu Sundararaj <prabhu.sundarara@nxp.com>
Date: Mon, 11 May 2020 23:26:19 -0500
Subject: [PATCH] MGS-5186 Per Specification EGL_NATIVE_PIXMAP_KHR requires
EGL_NO_CONTEXT
https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_pixmap.txt
Per Specification EGL_NATIVE_PIXMAP_KHR requires EGL_NO_CONTEXT.
So passing a valid context will result in error.
Signed-off-by: Prabhu Sundararaj <prabhu.sundarara@nxp.com>
---
glamor/glamor_egl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index d3c678d6b..5385e7c90 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -233,7 +233,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
glamor_make_current(glamor_priv);
image = eglCreateImageKHR(glamor_egl->display,
- glamor_egl->context,
+ EGL_NO_CONTEXT /*glamor_egl->context*/,
EGL_NATIVE_PIXMAP_KHR, bo, NULL);
if (image == EGL_NO_IMAGE_KHR) {
glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
--
2.17.1

View File

@ -1,4 +1,8 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
# Trailing space is intentional due to a bug in meta-freescale
SRC_URI += "file://0001-glamor-Use-CFLAGS-for-EGL-and-GBM.patch "
SRC_URI += "file://0001-glamor-Use-CFLAGS-for-EGL-and-GBM.patch \
file://0001-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch \
file://0002-MGS-5186-Per-Specification-EGL_NATIVE_PIXMAP_KHR-req.patch"
PACKAGECONFIG_append_mx8 = " glamor"

View File

@ -18,7 +18,7 @@ LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=94d55d512a9ba36caa9b7df079bae19f"
inherit autotools pkgconfig use-imx-headers
IMXALSA_SRC ?= "git://source.codeaurora.org/external/imx/imx-alsa-plugins.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRC_URI = "${IMXALSA_SRC};branch=${SRCBRANCH}"
SRCREV = "cde60d68ab2acee913dbfacb8aabb53d87dd3e38"

View File

@ -3,14 +3,14 @@ require recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.16.2.bb
DEPENDS += "jpeg libdrm"
DEPENDS_append_imxgpu2d = " virtual/libg2d"
PV = "1.16.0.imx"
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/${PN}:"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
GST1.0-PLUGINS-BAD_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-bad.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCREV = "eea4cfe9315a9c648d116cfff3cd532e9a31237d"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "2fdaef1839ebfef7ea3bc8c1c59463a9ef0ae19a"
SRC_URI = " \
${GST1.0-PLUGINS-BAD_SRC};branch=${SRCBRANCH} \
file://configure-allow-to-disable-libssh2.patch \

View File

@ -1,14 +1,14 @@
require recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.2.bb
PV = "1.16.0.imx"
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/${PN}:"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
GST1.0-PLUGINS-BASE_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-base.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCREV = "5221bd72a116341738ab060b195b38a2cbed1c58"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "cad00a3c4318c787c9661990e8f9328e4a69a329"
SRC_URI = " \
${GST1.0-PLUGINS-BASE_SRC};branch=${SRCBRANCH} \
file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \

View File

@ -1,43 +0,0 @@
Things break with overlapping defines between glib and gstreamer with glibc 2.30.
Discussion in the link below, basically internal __ prefixed variables
shouldn't be redefined.
Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/635]
RP 2019/8/6
Index: gst-plugins-good-1.16.0/sys/v4l2/ext/types-compat.h
===================================================================
--- gst-plugins-good-1.16.0.orig/sys/v4l2/ext/types-compat.h
+++ gst-plugins-good-1.16.0/sys/v4l2/ext/types-compat.h
@@ -24,29 +24,6 @@
#ifndef __TYPES_COMPAT_H__
#define __TYPES_COMPAT_H__
-/* From linux/types.h */
-#ifndef __bitwise__
-# ifdef __CHECKER__
-# define __bitwise__ __attribute__((bitwise))
-# else
-# define __bitwise__
-# endif
-#endif
-
-#ifndef __bitwise
-# ifdef __CHECK_ENDIAN__
-# define __bitwise __bitwise__
-# else
-# define __bitwise
-# endif
-#endif
-
-#define __u64 guint64
-#define __u32 guint32
-#define __u16 guint16
-#define __u8 guint8
-#define __s64 gint64
-#define __s32 gint32
-#define __le32 guint32 __bitwise
+#include <linux/types.h>
#endif /* __TYPES_COMPAT_H__ */

View File

@ -1,18 +1,17 @@
require recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.2.bb
PV = "1.16.0.imx"
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/${PN}:"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
GST1.0-PLUGINS-GOOD_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-good.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCREV = "3bcc85705695ee629ac3fb687411bb196d231918"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "fc6d8ccf3bd775517fafb1ce1d9224312d2812d8"
SRC_URI = " \
${GST1.0-PLUGINS-GOOD_SRC};branch=${SRCBRANCH} \
file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \
file://headerfix.patch \
"
S = "${WORKDIR}/git"

View File

@ -1,13 +1,13 @@
require recipes-multimedia/gstreamer/gstreamer1.0_1.16.2.bb
PV = "1.16.0.imx"
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
# Use i.MX fork of GST for customizations
GST1.0_SRC ?= "gitsm://source.codeaurora.org/external/imx/gstreamer.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCREV = "a4c220605ac0923596b89f4f07c05d235bc09259"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "beca1b382febc2ba38a21fcb8f5092209773eb7f"
SRC_URI = " \
${GST1.0_SRC};branch=${SRCBRANCH} \
file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \

View File

@ -21,12 +21,12 @@ LIC_FILES_CHKSUM = "file://COPYING-LGPL-2;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
file://COPYING-LGPL-2.1;md5=fbc093901857fcd118f065f900982c24"
IMXGST_SRC ?= "git://source.codeaurora.org/external/imx/imx-gst1.0-plugin.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRC_URI = "${IMXGST_SRC};branch=${SRCBRANCH} \
file://0001-imx-gst1.0-plugin-Update-KERNEL_VERSION-check.patch \
"
SRCREV = "77760c4e4177f2afd80d7d09f3d1fb137b96adfa"
SRCREV = "4d2e5c1547c5f8a5e4e26a034ab87c809b34fb54"
S = "${WORKDIR}/git"

View File

@ -6,7 +6,7 @@ require imx-codec.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[md5sum] = "35d16ca40f876845bdd82184f467c276"
SRC_URI[sha256sum] = "caeff002e216b605cf6917c93b3362babb8d9d7d773a2eb8b01bce6ab91733d6"
SRC_URI[md5sum] = "5472ae7b57a8390224761d151632a2a6"
SRC_URI[sha256sum] = "b0d5a6f847df99ee213cc79dae4f5e7194f567859c43d68d7c7c794a97f90294"
COMPATIBLE_MACHINE = "(mx6|mx7|mx8)"

View File

@ -6,7 +6,7 @@ include imx-parser.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
SRC_URI[md5sum] = "477804cac59d4fff3d2ed46c530f5ad1"
SRC_URI[sha256sum] = "d408b2e62548c463dacf13bf603751fd1ad7df3993af4f733ebc238202f5262f"
SRC_URI[md5sum] = "0845c64d2b64c2822328e8bc8442f5b8"
SRC_URI[sha256sum] = "33b8377a663b2ca749f40ef1164918335913e4de02a3857f2892707647d243de"
COMPATIBLE_MACHINE = "(mx6|mx7|mx8)"

View File

@ -8,10 +8,10 @@ LICENSE = "Proprietary"
SECTION = "multimedia"
LIC_FILES_CHKSUM = "file://COPYING;md5=228c72f2a91452b8a03c4cab30f30ef9"
IMX_VPUWRAP_SRC ?= "git://github.com/NXP/vpu_wrapper.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
IMX_VPUWRAP_SRC ?= "git://github.com/NXP/imx-vpuwrap.git;protocol=https"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRC_URI = "${IMX_VPUWRAP_SRC};branch=${SRCBRANCH}"
SRCREV = "d9db34dd0d4a096d74a590f5760904919ae9b7c0"
SRCREV = "76225d8e15b2b72cd11ce073706473473e446294"
S = "${WORKDIR}/git"
inherit autotools pkgconfig

View File

@ -7,15 +7,15 @@ DEPENDS += "gstreamer1.0-plugins-base virtual/kernel libcap zlib bzip2 \
"
GST1.0-PLUGINS-GOOD_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-good.git;protocol=https"
SRCBRANCH = "MM_04.05.04_2002_L5.4.3"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRC_URI = " \
${GST1.0-PLUGINS-GOOD_SRC};branch=${SRCBRANCH} \
file://0001-configure.ac-Add-prefix-to-correct-the-QT_PATH.patch \
"
SRCREV = "3bcc85705695ee629ac3fb687411bb196d231918"
SRCREV = "fc6d8ccf3bd775517fafb1ce1d9224312d2812d8"
PV = "1.16.0.imx"
PV = "1.16.1.imx"
S = "${WORKDIR}/git"

View File

@ -154,7 +154,7 @@ if pushd ${YOCTO_INST_DIR}; then
error "Revision \"${DY_REVISION}\" not found"
fi
fi
yes "" 2>/dev/null | ${REPO} init --no-repo-verify -u ${MANIFEST_URL} ${repo_revision}
yes "" 2>/dev/null | ${REPO} init --depth=1 --no-repo-verify -u ${MANIFEST_URL} ${repo_revision}
${REPO} forall -p -c 'git remote prune $(git remote)'
time ${REPO} sync -d ${MAKE_JOBS}
popd

View File

@ -209,7 +209,7 @@ if pushd ${YOCTO_INST_DIR}; then
error "Revision \"${DY_REVISION}\" not found"
fi
fi
yes "" 2>/dev/null | ${REPO} init --no-repo-verify -u ${MANIFEST_URL} ${repo_revision}
yes "" 2>/dev/null | ${REPO} init --depth=1 --no-repo-verify -u ${MANIFEST_URL} ${repo_revision}
${REPO} forall -p -c 'git remote prune $(git remote)'
time ${REPO} sync -d ${MAKE_JOBS}
popd