[meta-intel] [PATCH 1/1 dizzy] meta-crystalforest: Zlib QAT_MEM MM Module

Saul Wold sgw at linux.intel.com
Fri Jul 3 08:26:57 PDT 2015


On 07/02/2015 11:03 PM, venkatasubramanian pattu wrote:
> The zlib software library and the Intel QuickAssist Technology both implement
> the deflate algorithm as described in RFC 1951.
>
> This software accelerates the data compression algorithm in the zlib software
> library via the Intel QuickAssist Technology implemented on Intel
> Communications Chipsets.
>
> Signed-off-by: venkatasubramanian pattu <venkatasubramanianx.pattu at intel.com>
> ---
>   .../recipes-extended/zlib-qat/zlib-qat.bb          | 110 +++++++++++++++++++++
>   .../0001-Fix-for-Zlib-qat-Compilation-issue.patch  |  54 ++++++++++
>   2 files changed, 164 insertions(+)
>   create mode 100644 meta-crystalforest/recipes-extended/zlib-qat/zlib-qat.bb
>   create mode 100644 meta-crystalforest/recipes-extended/zlib-qat/zlib-qat/0001-Fix-for-Zlib-qat-Compilation-issue.patch
>
> diff --git a/meta-crystalforest/recipes-extended/zlib-qat/zlib-qat.bb b/meta-crystalforest/recipes-extended/zlib-qat/zlib-qat.bb
> new file mode 100644
> index 0000000..25b5361
> --- /dev/null
> +++ b/meta-crystalforest/recipes-extended/zlib-qat/zlib-qat.bb
> @@ -0,0 +1,110 @@
> +SUMMARY = "Zlib QAT_MEM Memory Management Module for Intel Quick Assist \
> +Technology"
> +
> +DESCRIPTION = "This software acelerates the data compression algorithm \
> +in the zlib software library via the Intel QuickAssist Technology \
> +implemented on Intel Communications Chipset 89xx and 895x Series based platforms."
> +
> +HOMEPAGE = "http://zlib.net/"
> +SECTION = "libs"
> +LICENSE = "Zlib & GPLv2 & BSD"
> +LIC_FILES_CHKSUM = "file://${WORKDIR}/zlib-${ZLIB_VERSION}/zlib.h;beginline=4;endline=23;md5=fde612df1e5933c428b73844a0c494fd \
> +		file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \
> +		file://${COMMON_LICENSE_DIR}/BSD;md5=3775480a712fc46a69647678acb234cb"
> +
spaces are preferred over tabs

> +# For target side versions of openssl enable support for OCF Linux driver
> +# if they are available.
> +DEPENDS += "cryptodev-linux pkgconfig qat16"
> +
I can't test this since I still can't build the qat16 recipe 
successfully, so I decided to spend a brief effort to fix.

Which I think I finally found the problem to, there is a Makefile buried 
deep that uses "gcc" directly instead "$(CC)" so it's not using the 
correct cross-compiler and not getting -sysroot set correctly.  Maybe on 
your local machine you have installed a libcrypto which it's finding, 
rather than the correct sysroot.

Both QAT15 and QAT16 have this problem in:

./quickassist/lookaside/access_layer/src/sample_code/functional/dc/stateless_multi_op_checksum_sample/Makefile

default: clean
         gcc -Wall -O1 $(USER_INCLUDES)  -DUSER_SPACE \
         $(USER_SOURCE_FILES) $(ADDITIONAL_OBJECTS) -o $(OUTPUT_NAME)

I think someone tried to add "-L/usr/lib" to the ADDITIONAL_OBJECTS, 
that should be removed.

This took me about 30 minutes to discover, and patch, the attached patch 
works for both qat15 and qat16 and can be placed in the files patch 
directory of qat.



> +ZLIB_VERSION = "1.2.8"
> +ZLIB_QAT_VERSION = "0.4.7-002"
> +
> +S = "${WORKDIR}/zlib-${ZLIB_VERSION}"
> +
Normally this would be after the SRC_URI line below

> +export ICP_ROOT = "${PKG_CONFIG_SYSROOT_DIR}"
> +export ZLIB_ROOT = "${S}"
> +export ICP_ZLIBQAT = "${S}"
> +export ICP_BUILD_OUTPUT = "${ICP_ROOT}/lib"
> +export KERNEL_SOURCE_ROOT = "${STAGING_KERNEL_DIR}"
> +
> +SRC_URI = "http://www.zlib.net/zlib-${ZLIB_VERSION}.tar.gz;name=zlib \
> +	   https://01.org/sites/default/files/page/zlib_shim_0.4.7-002_withdocumentation.zip;name=zlibqat \
> +	file://0001-Fix-for-Zlib-qat-Compilation-issue.patch \
> +	"
> +
White space, this should be indented equally to the level of the first 
http:...

Please review the recipe style guide:
http://www.openembedded.org/wiki/Styleguide

Important things to note are ordering, 4 spaces for Python / Actual tabs 
for shell, but spaces for pretty much every other indentation.

I need to update it to remove the PR wording, we don't use PR anymore.

> +SRC_URI[zlib.md5sum] = "44d667c142d7cda120332623eab69f40"
> +SRC_URI[zlib.sha256sum] = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d"
> +
> +SRC_URI[zlibqat.md5sum] = "dfde8618198aa8d35ecc00d10dcc7000"
> +SRC_URI[zlibqat.sha256sum] = "8e5786400bbc2a879ae705c864ec63b53ae019b4f2d1c94524a97223847b6e46"
> +
> +CFLAGS += "\
> +		-I${ICP_ROOT}/usr/include \
> +		-I${ICP_ROOT}/usr/include/dc \
> +		-I${ZLIB_ROOT}/ \
> +		-D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -DUSE_QAT_MEM -I${ZLIB_ROOT}/contrib/qat/qat_mem -D_GNU_SOURCE \
> +		-L${ZLIB_ROOT} -lz \
> +		-L${ICP_ROOT}/usr/lib/ -lpthread -lcrypto -ldl -lrt \
> +		-L${ICP_ROOT}/usr/lib/ -licp_qa_al -losal -ladf_proxy"
> +
> +inherit module
> +MODULE_DIR = "${D}${base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers"
> +MEM_PATH = "${S}/contrib/qat"
> +
> +do_unpack2(){
> +	cd ${WORKDIR}/
> +	unzip zlib_quickassist_patch_l.0.4.7_002_stable.zip
> +	cd zlib_quickassist_patch_l.0.4.7_002_devbranch
> +	tar -xvzf zlib-1.2.8-qat.L.0.4.7-002.tar.gz
> +	cp zlib-1.2.8-qat.patch ${WORKDIR}
> +}
> +
> +addtask unpack2 after do_unpack before do_patch
> +
> +do_patch() {
> +	cd ${S}
> +	patch -p1  < ${WORKDIR}/zlib-1.2.8-qat.patch
> +	patch -p1  < ${WORKDIR}/0001-Fix-for-Zlib-qat-Compilation-issue.patch
> +}
> +
> +do_configure() {
> +	cd ${S}
> +	./configure
> +}
> +
> +do_compile() {
> +	EXTRA_OEMAKE="'CFLAGS=${CFLAGS} -fPIC'"
> +	cd ${MEM_PATH}/qat_mem/
> +	oe_runmake
> +	cd ${S}/
> +	oe_runmake
> +	cd ${MEM_PATH}/qat_zlib_test/
> +	oe_runmake
> +}
> +
> +do_install() {
> +	chrpath -d ${MEM_PATH}/qat_zlib_test/comptestapp
> +	install -m 0755 -d		${MODULE_DIR}/
> +	install -m 0755 -d		${D}${bindir}/
> +	install -m 0755 -d		${D}${sysconfdir}/zlib_conf/
> +	install -m 640  ${MEM_PATH}/qat_mem/qat_mem.ko		${MODULE_DIR}/
> +	install -m 0755 ${WORKDIR}/zlib-${ZLIB_VERSION}/zpipe		${D}${bindir}/
> +	install -m 0755 ${WORKDIR}/zlib-${ZLIB_VERSION}/minigzip	${D}${bindir}/
> +	install -m 0755 ${MEM_PATH}/qat_zlib_test/comptestapp		${D}${bindir}/
> +	install -m 660  ${MEM_PATH}/config/dh895xcc/multi_thread_optimized/*	${D}${sysconfdir}/zlib_conf/
> +	install -m 660  ${MEM_PATH}/config/dh89xxcc/multi_thread_optimized/*	${D}${sysconfdir}/zlib_conf/
> +}
The makefile does not have it's own install section?  I know I have 
brought this up with other packages in the past?

> +
> +PACKAGES += "${PN}-app"
> +
> +FILES_${PN} += " \
> +		${sysconfdir}/zlib_conf/ \
> +		"
> +
> +FILES_${PN}-app += " \
> +		${bindir}/* \
> +	"
> +
> +FILES_${PN}-dbg += " \
> +		${bindir}/.debug \
> +		"
> diff --git a/meta-crystalforest/recipes-extended/zlib-qat/zlib-qat/0001-Fix-for-Zlib-qat-Compilation-issue.patch b/meta-crystalforest/recipes-extended/zlib-qat/zlib-qat/0001-Fix-for-Zlib-qat-Compilation-issue.patch
> new file mode 100644
> index 0000000..71633b8
> --- /dev/null
> +++ b/meta-crystalforest/recipes-extended/zlib-qat/zlib-qat/0001-Fix-for-Zlib-qat-Compilation-issue.patch
> @@ -0,0 +1,54 @@
> +From 9ba7bca8e30f76cdc9d667dd7b6d203314301edc Mon Sep 17 00:00:00 2001
> +From: venkatasubramanian pattu <venkatasubramanianx.pattu at intel.com>
> +Date: Thu, 11 Jun 2015 11:45:33 +0800
> +Subject: [PATCH] Fix for Zlib-qat Compilation issue
> +
> +This patch is used to fix the compliation issue when QAT is enabled with
> +Zlib.
> +
> +When compiling the Zlib-qat by default it takes the kernel source from the host machine .
> +Since we are working on the yocto recipe implementation we need to change the path
> +of the kernel source by exporting the variable (KERNEL_SOURCE_ROOT) in the main recipe.
> +
> +Upstream Status: Inappropriate
> +
Upstream-Status: please

> +Signed-off-by: venkatasubramanian pattu <venkatasubramanianx.pattu at intel.com>
> +---
> + contrib/qat/qat_mem/Makefile | 12 ++++--------
> + 1 file changed, 4 insertions(+), 8 deletions(-)
> +
> +diff --git a/contrib/qat/qat_mem/Makefile b/contrib/qat/qat_mem/Makefile
> +index ddf5b59..0a521f2 100644
> +--- a/contrib/qat/qat_mem/Makefile
> ++++ b/contrib/qat/qat_mem/Makefile
> +@@ -61,16 +61,10 @@
> + #########################################################################
> +
> + MODULENAME 	:= qat_mem
> +-KDIR		:= /lib/modules/$(shell uname -r)/build
> ++KDIR		:= $(KERNEL_SOURCE_ROOT)
> + PWD		:= $(shell pwd)
> +
> +-ifeq ($(shell uname -r|grep -c grsec-WR), 1)
> +-AUTO_CONF=/lib/modules/$(shell uname -r)/build/include/generated/autoconf.h
> +-else
> +-AUTO_CONF=/usr/src/kernels/$(shell uname -r)/include/linux/autoconf.h
> +-endif
> +-
> +-CC		:= gcc -Wall -imacros $(AUTO_CONF)
> ++CC		:= gcc -Wall -imacros $(KERNEL_SOURCE_ROOT)/include/generated/autoconf.h
> +
> + ifeq ($(KERNELRELEASE),)
> + all:	$(MODULENAME)_test
> +@@ -80,6 +74,8 @@ else
> +   obj-m	:= $(MODULENAME).o
> + endif
> +
> ++modules_install:
> ++	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
> + $(MODULENAME)_test: $(MODULENAME)_test.c
> + 	$(CC) -g -o $(MODULENAME)_test $(MODULENAME)_test.c
> +
> +--
> +1.9.1
> +
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use-cross-compiler.patch
Type: text/x-diff
Size: 1094 bytes
Desc: not available
URL: <http://lists.yoctoproject.org/pipermail/meta-intel/attachments/20150703/e8c8f2e0/attachment-0001.patch>


More information about the meta-intel mailing list