From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1354209845081037967==" MIME-Version: 1.0 From: Ricardo Neri Subject: [PATCH 3/9] chipsec: do not custom-build the chipsec kernel module Date: Fri, 10 Mar 2017 15:36:15 -0800 Message-ID: <1489188981-23886-4-git-send-email-ricardo.neri-calderon@linux.intel.com> In-Reply-To: <1489188981-23886-1-git-send-email-ricardo.neri-calderon@linux.intel.com> List-Id: To: chipsec@lists.01.org --===============1354209845081037967== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In v1.2.5, CHIPSEC is capable of building its kernel module and install it in the appropriate location. The only precondition is that we should provide the correct location of the kernel source directory. CHIPSEC uses by default the kernel headers of the host system. Instead, we need to provide the headers of the kernel with which LUV is distributed. Let CHIPSEC perform the task of building its kernel module instead of doing it within the recipe. This makes the recipe simpler and cleaner. The kernel module's makefile is updated at buildtime with the correct kernel source directory. Likewise, we don't need to insert the module separately; CHIPSEC does it by itself. Thus, update the chipsec LUV runner accordingly. Drop the patches and code we were using for our custom build. Signed-off-by: Ricardo Neri sq cust --- ...ux-Do-not-host-system-s-kernel-source-dir.patch | 29 +++++++++++++++++ ...ux-Don-t-build-userland-app-automatically.patch | 37 ------------------= ---- meta-luv/recipes-core/chipsec/chipsec/chipsec | 5 --- meta-luv/recipes-core/chipsec/chipsec_git.bb | 34 ++++--------------= -- 4 files changed, 35 insertions(+), 70 deletions(-) create mode 100644 meta-luv/recipes-core/chipsec/chipsec/0001-drivers-linu= x-Do-not-host-system-s-kernel-source-dir.patch delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/0006-drivers-linu= x-Don-t-build-userland-app-automatically.patch diff --git a/meta-luv/recipes-core/chipsec/chipsec/0001-drivers-linux-Do-no= t-host-system-s-kernel-source-dir.patch b/meta-luv/recipes-core/chipsec/chi= psec/0001-drivers-linux-Do-not-host-system-s-kernel-source-dir.patch new file mode 100644 index 0000000..3d8a763 --- /dev/null +++ b/meta-luv/recipes-core/chipsec/chipsec/0001-drivers-linux-Do-not-host-= system-s-kernel-source-dir.patch @@ -0,0 +1,29 @@ +From 1200ddb15787de7186bf687ccdea2d9f3a7a7870 Mon Sep 17 00:00:00 2001 +From: Ricardo Neri +Date: Thu, 9 Mar 2017 19:32:58 -0800 +Subject: [PATCH] drivers: linux: Do not host system's kernel source direct= ory + +When building under the Yocto Project, we perform a cross-build for +a target that is not the same as the host. Thus, we ougt use the +kernel source directory of our target's build. Instead, insert a text +pattern that can be replaced at build time with the appropriate kernel +source directory. + +Signed-off-by: Ricardo Neri +--- + drivers/linux/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/linux/Makefile b/drivers/linux/Makefile +index 0766cd9..f94c3a2 100644 +--- a/drivers/linux/Makefile ++++ b/drivers/linux/Makefile +@@ -1,4 +1,4 @@ +-KERNEL_SRC_DIR ?=3D /lib/modules/`uname -r`/build ++KERNEL_SRC_DIR =3D LUV_KERNEL_SRC_DIR + #KERNEL_SRC_DIR =3D /usr/src/android/3.0-mid + = + ifeq ($(ARCH),i386) +-- = +2.9.3 + diff --git a/meta-luv/recipes-core/chipsec/chipsec/0006-drivers-linux-Don-t= -build-userland-app-automatically.patch b/meta-luv/recipes-core/chipsec/chi= psec/0006-drivers-linux-Don-t-build-userland-app-automatically.patch deleted file mode 100644 index f171332..0000000 --- a/meta-luv/recipes-core/chipsec/chipsec/0006-drivers-linux-Don-t-build-= userland-app-automatically.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b377b98053583d23fa2a7dc68f353d03131ef3ed Mon Sep 17 00:00:00 2001 -From: Matt Fleming -Date: Tue, 21 Apr 2015 16:50:31 +0100 -Subject: [PATCH] drivers/linux: Don't build userland app automatically - -The OpenEmbedded build infrastructure has very different toolchain -settings for compiling kernel modules and userland utilities. - -Don't automatically build the userland utility and instead expect the -user to do that manually. - -Signed-off-by: Matt Fleming ---- - source/drivers/linux/Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/source/drivers/linux/Makefile b/source/drivers/linux/Makefile -index 4342977..e2fe2be 100644 ---- a/source/drivers/linux/Makefile -+++ b/source/drivers/linux/Makefile -@@ -24,11 +24,11 @@ chipsec64 : clean - echo $(chipsec-objs) - nasm -f elf64 -o amd64/cpu.o amd64/cpu.asm; - make -C $(KERNEL_SRC_DIR) SUBDIRS=3D`pwd` modules -- cd ../../tool/chipsec/helper/linux; make -+# cd ../../tool/chipsec/helper/linux; make - chipsec32 : clean - nasm -f elf32 -o i386/cpu.o i386/cpu.asm; - make -C $(KERNEL_SRC_DIR) SUBDIRS=3D`pwd` modules -- cd ../../tool/chipsec/helper/linux; make -+# cd ../../tool/chipsec/helper/linux; make - = - install: - ./run.sh --- = -1.9.1 - diff --git a/meta-luv/recipes-core/chipsec/chipsec/chipsec b/meta-luv/recip= es-core/chipsec/chipsec/chipsec index 888df89..fa72e45 100644 --- a/meta-luv/recipes-core/chipsec/chipsec/chipsec +++ b/meta-luv/recipes-core/chipsec/chipsec/chipsec @@ -4,11 +4,6 @@ # # Load the CHIPSEC kernel module and invoke the chipsec main file. = -modprobe -q chipsec -if [ $? -ne 0 ]; then - exit 1 -fi - # The below is replaced with the python site packages path during # do_patch(). python PYTHONPATH/chipsec_main.py -i -v diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipe= s-core/chipsec/chipsec_git.bb index 9aaf796..8f96440 100644 --- a/meta-luv/recipes-core/chipsec/chipsec_git.bb +++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb @@ -7,7 +7,7 @@ LICENSE =3D "GPLv2" LIC_FILES_CHKSUM =3D "file://LICENSE;md5=3D8c16666ae6c159876a0ba6309961438= 1" = SRC_URI =3D "git://github.com/chipsec/chipsec.git \ - file://0006-drivers-linux-Don-t-build-userland-app-automatically.patch= \ + file://0001-drivers-linux-Do-not-host-system-s-kernel-source-dir.patch= \ file://chipsec file://luv-parser-chipsec \ file://fix-setup.py-for-Linux.patch \ file://chipsec-setup-install-cores-library-under-helper-lin.patch \ @@ -51,48 +51,26 @@ fix_mod_path() { sed -i -e "s:PYTHONPATH:${PYTHON_SITEPACKAGES_DIR}:" ${WORKDIR}/chipsec } = +fix_kernel_source_dir() { + sed -i "s:LUV_KERNEL_SRC_DIR:${STAGING_KERNEL_DIR}:" ${S}/drivers/linu= x/Makefile +} + do_patch_append() { bb.build.exec_func('fix_mod_path', d) + bb.build.exec_func('fix_kernel_source_dir', d) } = do_compile_prepend() { cd ${S}/source/tool } = -do_compile_append() { - unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS - - oe_runmake KERNEL_SRC_DIR=3D${STAGING_KERNEL_DIR} \ - KERNEL_VERSION=3D${KERNEL_VERSION} \ - CC=3D"${KERNEL_CC}" LD=3D"${KERNEL_LD}" \ - AR=3D"${KERNEL_AR}" -C ${STAGING_KERNEL_DIR} \ - scripts - - oe_runmake KERNEL_SRC_DIR=3D${STAGING_KERNEL_DIR} \ - KERNEL_VERSION=3D${KERNEL_VERSION} \ - CC=3D"${KERNEL_CC}" LD=3D"${KERNEL_LD}" \ - AR=3D"${KERNEL_AR}" INC=3D"${INC}" -C ${S}/source/drivers/linux - - oe_runmake -C ${S}/source/tool/chipsec/helper/linux -} - do_install_prepend() { cd ${S}/source/tool } = do_install_append() { - unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS - install -d ${D}${bindir} install -m 0755 ${WORKDIR}/chipsec ${D}${bindir} - - # Install the kernel driver - oe_runmake DEPMOD=3Decho INSTALL_MOD_PATH=3D"${D}" \ - KERNEL_SRC=3D${STAGING_KERNEL_DIR} \ - CC=3D"${KERNEL_CC}" LD=3D"${KERNEL_LD}" \ - -C ${STAGING_KERNEL_DIR} \ - M=3D"${S}/source/drivers/linux" \ - modules_install } = LUV_TEST_LOG_PARSER=3D"luv-parser-chipsec" -- = 2.7.4 --===============1354209845081037967==--