Skip to content

Commit

Permalink
Adding vdu kernel module/firmware/library to apu (Xilinx#6884)
Browse files Browse the repository at this point in the history
* adding vdu kernel module to apu

* cleaning up

* stopped calling modprobe f vdu modules
  • Loading branch information
chvamshi-xilinx authored Aug 4, 2022
1 parent 6bbd1c9 commit 8c3c7df
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 4 deletions.
36 changes: 35 additions & 1 deletion build/build_edge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ install_recipes()
eval "$SAVED_OPTIONS_LOCAL"
}

enable_vdu()
{
echo "IMAGE_INSTALL:append = \" libvdu-xlnx kernel-module-vdu vdu-firmware\"" >> build/conf/local.conf
}

config_versal_project()
{
VERSAL_PROJECT_DIR=$1
Expand Down Expand Up @@ -167,6 +172,33 @@ config_versal_project()
cp $SERVICE_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/skd/files
cp $BB_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/skd
cp $INIT_SCRIPT $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/skd/files

# Generate vdu modules and add them to apu package

# Enable VDU kernel module
VDU_MOD_BB_FILE=$APU_RECIPES_DIR/kernel-module-vdu.bb
if [ ! -d $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/kernel-module-vdu ]; then
$PETA_BIN/petalinux-config --silentconfig
$PETA_BIN/petalinux-create -t apps --template install -n kernel-module-vdu --enable
fi
cp -rf $VDU_MOD_BB_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/kernel-module-vdu/

# Enable VDU firmware
VDU_FIRMWARE_BB_FILE=$APU_RECIPES_DIR/vdu-firmware.bb
if [ ! -d $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/vdu-firmware ]; then
$PETA_BIN/petalinux-config --silentconfig
$PETA_BIN/petalinux-create -t apps --template install -n vdu-firmware --enable
fi
cp -rf $VDU_FIRMWARE_BB_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/vdu-firmware/

# Enable VDU control software library
# This is not required as PS Kernels statically linking with control software, Enabling this to debug standalone control software
VDU_LIBRARY_BB_FILE=$APU_RECIPES_DIR/libvdu-xlnx.bb
if [ ! -d $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/libvdu-xlnx ]; then
$PETA_BIN/petalinux-config --silentconfig
$PETA_BIN/petalinux-create -t apps --template install -n libvdu-xlnx --enable
fi
cp -rf $VDU_LIBRARY_BB_FILE $VERSAL_PROJECT_DIR/project-spec/meta-user/recipes-apps/libvdu-xlnx/

}

Expand Down Expand Up @@ -347,6 +379,7 @@ if [[ $full == 1 ]]; then
if [[ $AARCH = $versal_dir ]]; then
# configure the project with appropriate options
config_versal_project .
enable_vdu
fi

echo "[CMD]: petalinux-config -c kernel --silentconfig"
Expand Down Expand Up @@ -418,7 +451,8 @@ cp $ORIGINAL_DIR/$PETALINUX_NAME/reinstall_xrt.sh $ORIGINAL_DIR/$PETALINUX_NAME/
if [[ $full == 1 ]]; then
mkdir -p $ORIGINAL_DIR/$PETALINUX_NAME/apu_packages
export PATH=$PETALINUX/../../tool/petalinux-v$PETALINUX_VER-final/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/bin:$PATH
$XRT_REPO_DIR/src/runtime_src/tools/scripts/pkgapu.sh -output $ORIGINAL_DIR/$PETALINUX_NAME/apu_packages -images $ORIGINAL_DIR/$PETALINUX_NAME/images/linux/
$XRT_REPO_DIR/src/runtime_src/tools/scripts/pkgapu.sh -output $ORIGINAL_DIR/$PETALINUX_NAME/apu_packages -images $ORIGINAL_DIR/$PETALINUX_NAME/images/linux/ -idcode "0x14ca8093"

fi

cd $ORIGINAL_DIR
Expand Down
2 changes: 1 addition & 1 deletion build/petalinux.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# When updating Petalinux build please file a SH ticket to retain the build
# https://jira.xilinx.com/secure/CreateIssue!default.jspa
PETALINUX="/proj/petalinux/2022.2/petalinux-v2022.2_06081049/tool/petalinux-v2022.2-final"
PETALINUX="/proj/petalinux/2022.2/petalinux-v2022.2_07291250/tool/petalinux-v2022.2-final"
30 changes: 30 additions & 0 deletions src/runtime_src/tools/scripts/apu_recipes/kernel-module-vdu.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
SUMMARY = "Linux kernel module for Video Decode Unit"
DESCRIPTION = "Out-of-tree VDU decoder common kernel modules provider for Telluride"
SECTION = "kernel/modules"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eb723b61539feef013de476e68b5c50a"

XILINX_VDU_VERSION = "1.0.0"
PV = "${XILINX_VDU_VERSION}-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}"

S = "${WORKDIR}/git"

BRANCH ?= "master-vnc"
REPO ?= "git://gitenterprise.xilinx.com/xilinx-vcu/vdu-modules.git;protocol=https"
SRCREV ?= "${AUTOREV}"

BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"

inherit module

EXTRA_OEMAKE += "O=${STAGING_KERNEL_BUILDDIR}"

RDEPENDS:${PN} = "vdu-firmware"

COMPATIBLE_MACHINE = "^$"
COMPATIBLE_MACHINE:versal = "versal"

PACKAGE_ARCH = "${SOC_FAMILY_ARCH}"

KERNEL_MODULE_AUTOLOAD += "dmaproxy"
40 changes: 40 additions & 0 deletions src/runtime_src/tools/scripts/apu_recipes/libvdu-xlnx.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SUMMARY = "Control Software for VDU"
DESCRIPTION = "Control software libraries, test applications and headers provider for VDU"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=4c17252c6e9cea63b97af29362d9886a"

XILINX_VDU_VERSION = "1.0.0"
PV = "${XILINX_VDU_VERSION}-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}"

BRANCH ?= "master-vnc"
REPO ?= "git://gitenterprise.xilinx.com/xilinx-vcu/vdu-ctrl-sw.git;protocol=https"
SRCREV ?= "${AUTOREV}"

BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"

S = "${WORKDIR}/git"

COMPATIBLE_MACHINE = "^$"
COMPATIBLE_MACHINE:versal = "versal"

PACKAGE_ARCH = "${SOC_FAMILY_ARCH}"

RDEPENDS:${PN} = "kernel-module-vdu"

EXTRA_OEMAKE = "CC='${CC}' CXX='${CXX} ${CXXFLAGS}'"

do_install() {
install -d ${D}${libdir}
install -d ${D}${includedir}/allegro-vdu-ctrl-sw/include

install -Dm 0755 ${S}/bin/AL_Decoder.exe ${D}/${bindir}/AL_Decoder.exe

oe_runmake install_headers INSTALL_HDR_PATH=${D}${includedir}/allegro-vdu-ctrl-sw/include
oe_libinstall -C ${S}/bin/ -so liballegro_decode ${D}/${libdir}/
}

# These libraries shouldn't get installed in world builds unless something
# explicitly depends upon them.

EXCLUDE_FROM_WORLD = "1"
37 changes: 37 additions & 0 deletions src/runtime_src/tools/scripts/apu_recipes/vdu-firmware.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
SUMMARY = "Firmware for VDU"
DESCRIPTION = "Firmware binaries provider for VDU"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=4c17252c6e9cea63b97af29362d9886a"

XILINX_VDU_VERSION = "1.0.0"
PV = "${XILINX_VDU_VERSION}-xilinx-${XILINX_RELEASE_VERSION}+git${SRCPV}"

S = "${WORKDIR}/git"

BRANCH ?= "master-vnc"
REPO ?= "git://gitenterprise.xilinx.com/xilinx-vcu/vdu-firmware.git;protocol=https"
SRCREV ?= "${AUTOREV}"

BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"

COMPATIBLE_MACHINE = "^$"
COMPATIBLE_MACHINE:versal = "versal"

PACKAGE_ARCH = "${SOC_FAMILY_ARCH}"

do_install() {
install -Dm 0644 ${S}/${XILINX_VDU_VERSION}/lib/firmware/al5d_b.fw ${D}/lib/firmware/al5d_b.fw
install -Dm 0644 ${S}/${XILINX_VDU_VERSION}/lib/firmware/al5d.fw ${D}/lib/firmware/al5d.fw
}

# Inhibit warnings about files being stripped
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
FILES:${PN} = "/lib/firmware/*"

# These libraries shouldn't get installed in world builds unless something
# explicitly depends upon them.
EXCLUDE_FROM_WORLD = "1"

INSANE_SKIP:${PN} = "ldflags"
12 changes: 10 additions & 2 deletions src/runtime_src/tools/scripts/pkgapu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ usage()
echo " -images Versal images path"
echo " -clean Remove build files"
echo " -output output path"
echo " -idcode id code of the part"
echo "This script requires tools: mkimage, xclbinutil, bootgen, rpmbuild, dpkg-deb. "
echo "There is mkimage in petalinux build, e.g."
echo "/proj/petalinux/2021.2/petalinux-v2021.2_daily_latest/tool/petalinux-v2021.2-final/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/mkimage"
Expand Down Expand Up @@ -114,6 +115,9 @@ ROOTFS_ADDR="0x21000000"
METADATA_ADDR="0x7FBD0000"
METADATA_BUFFER_LEN=131072

# default id code is for vck5000 part
ID_CODE="0x14ca8093"

clean=0
while [ $# -gt 0 ]; do
case $1 in
Expand All @@ -128,6 +132,10 @@ while [ $# -gt 0 ]; do
shift
OUTPUT_DIR=$1
;;
-idcode )
shift
ID_CODE=$1
;;
-clean )
clean=1
;;
Expand Down Expand Up @@ -198,7 +206,7 @@ BIF_FILE="$BUILD_DIR/apu.bif"
cat << EOF > $BIF_FILE
all:
{
id_code = 0x14ca8093
id_code = $ID_CODE
extended_id_code = 0x01
image {
id = 0x1c000000, name=apu_subsystem
Expand All @@ -220,7 +228,7 @@ MKIMAGE=mkimage
UBOOT_SCRIPT="$BUILD_DIR/boot.scr"
UBOOT_CMD="$BUILD_DIR/boot.cmd"
cat << EOF > $UBOOT_CMD
setenv bootargs "console=ttyUL0 clk_ignore_unused"
setenv bootargs "console=ttyUL0 clk_ignore_unused modprobe.blacklist=allegro,al5d"
bootm $KERNEL_ADDR $ROOTFS_ADDR $SYSTEM_DTB_ADDR
EOF
$MKIMAGE -A arm -O linux -T script -C none -a 0 -e 0 -n "boot" -d $UBOOT_CMD $UBOOT_SCRIPT
Expand Down

0 comments on commit 8c3c7df

Please sign in to comment.