oe-chipsec.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] chipsec: bump to v1.2.5+
@ 2017-03-10 23:36 Ricardo Neri
  2017-03-10 23:36 ` [PATCH 1/9] core-image-efi-initramfs: Temporarily disable chipsec Ricardo Neri
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 2559 bytes --]

This patches aims to update to CHIPSEC v1.2.5 plus the latest contents
of the CHIPSEC repository. The intention is to pave the way to update
to v1.2.6 once it is out; provided it does not vary significantly wrt
the current code base.

Many things have changed in CHIPSEC since the last time we updated it:

 * CHIPSEC now relies more on various python modules and less on custom
   solutions.
 * CHIPSEC now handles the build and insertion of the chipsec.ko
   kernel module.
 * The structure of the repository has changed significantly

All these changes need to be reflected in our recipe. In order to not
break builds, these changes would need to be done in a single gigantic
patch. Instead, I disabled CHIPSEC temporarily to be able to split
all the needed changes in a more logical and simpler manner. CHIPSEC
is re-enabled towards the end of the series.

Thanks and BR,
Ricardo

Ricardo Neri (9):
  core-image-efi-initramfs: Temporarily disable chipsec
  chipsec: update support for 32-bit
  chipsec: do not custom-build the chipsec kernel module
  chipsec: remove _prepend's that change directories
  chipsec: correct location of installation
  chipsec: update build time and runtime dependencies
  chipsec: bump to v1.2.5+
  chipsec: do not ship manual
  core-image-efi-initramfs: Re-enable chipsec

 .../0001-chipsec-building-for-32-bit-systems.patch | 49 ++++----------
 .../chipsec/0001-chipsec-do-not-ship-manual.patch  | 38 +++++++++++
 ...ux-Do-not-host-system-s-kernel-source-dir.patch | 29 +++++++++
 ...utilize-inode_lock-unlock-wrappers-for-ne.patch | 44 -------------
 ...ux-Don-t-build-userland-app-automatically.patch | 37 -----------
 meta-luv/recipes-core/chipsec/chipsec/chipsec      |  5 --
 ...up-install-cores-library-under-helper-lin.patch | 31 ---------
 meta-luv/recipes-core/chipsec/chipsec_git.bb       | 75 +++++++++-------------
 8 files changed, 110 insertions(+), 198 deletions(-)
 create mode 100644 meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-do-not-ship-manual.patch
 create mode 100644 meta-luv/recipes-core/chipsec/chipsec/0001-drivers-linux-Do-not-host-system-s-kernel-source-dir.patch
 delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/0002-chipsec_km-utilize-inode_lock-unlock-wrappers-for-ne.patch
 delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/0006-drivers-linux-Don-t-build-userland-app-automatically.patch
 delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/chipsec-setup-install-cores-library-under-helper-lin.patch

-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/9] core-image-efi-initramfs: Temporarily disable chipsec
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 2/9] chipsec: update support for 32-bit Ricardo Neri
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]

Many things have changed since CHIPCSEC v1.2.2 (e.g., build steps,
location of files, etc). This implies that we need to rework its recipe
significantly. In order to not break builds, all the updates would need
to be performed in a single gigantic patch, which would be very difficult
to review. Instead, CHIPSEC can be disabled temporarily to perform the
the update in several, smaller, patches.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 meta-luv/recipes-core/images/core-image-efi-initramfs.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-luv/recipes-core/images/core-image-efi-initramfs.bb b/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
index 5048946..8f9aa75 100644
--- a/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
+++ b/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
@@ -10,7 +10,7 @@ IMAGE_INSTALL = "\
     psplash kernel-efi-warnings linux-firmware kexec \
     "
 
-X86_ADDITIONS = "chipsec python-codecs python-subprocess vmcore-dmesg bits \
+X86_ADDITIONS = "python-codecs python-subprocess vmcore-dmesg bits \
                  kernel-modules"
 
 IMAGE_INSTALL_append_qemux86 = "${X86_ADDITIONS}"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/9] chipsec: update support for 32-bit
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
  2017-03-10 23:36 ` [PATCH 1/9] core-image-efi-initramfs: Temporarily disable chipsec Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 3/9] chipsec: do not custom-build the chipsec kernel module Ricardo Neri
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 2856 bytes --]

Most of the fixes we carry have been taken upstream. Update our recipe
accordingly to remove what has been updated in v1.2.5.

Cc: Megha Dey <megha.dey@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 .../0001-chipsec-building-for-32-bit-systems.patch | 49 ++++++----------------
 1 file changed, 13 insertions(+), 36 deletions(-)

diff --git a/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-building-for-32-bit-systems.patch b/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-building-for-32-bit-systems.patch
index 93ddd5f..601d3f0 100644
--- a/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-building-for-32-bit-systems.patch
+++ b/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-building-for-32-bit-systems.patch
@@ -8,43 +8,20 @@ architectures.
 
 Signed-off-by: Megha Dey <megha.dey@intel.com>
 ---
- source/drivers/linux/Makefile     | 2 +-
- source/drivers/linux/chipsec_km.c | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
+ drivers/linux/chipsec_km.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/source/drivers/linux/Makefile b/source/drivers/linux/Makefile
-index 4342977..bdc0acc 100644
---- a/source/drivers/linux/Makefile
-+++ b/source/drivers/linux/Makefile
-@@ -10,7 +10,7 @@ VERSION=
- #ifeq ($(shell uname -m),x86_64)
- ifeq ($(ARCH),i386)
- obj-m += chipsec.o
--chipsec-objs := chipsec_ko.o i386/cpu.o
-+chipsec-objs := chipsec_km.o i386/cpu.o
- all:	clean chipsec32
- else
- obj-m += chipsec.o
-diff --git a/source/drivers/linux/chipsec_km.c b/source/drivers/linux/chipsec_km.c
-index e76f6a9..a9080ec 100644
---- a/source/drivers/linux/chipsec_km.c
-+++ b/source/drivers/linux/chipsec_km.c
-@@ -946,7 +946,7 @@ static long d_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioc
-         #ifdef __x86_64__
- 		ptr[1] = (uint32_t)(dtr.base >> 32);
-         #else
--        ptr[1] = 0
-+        ptr[1] = 0;
-         #endif
- 		ptr[2] = (uint32_t)dtr.base;
- 
-@@ -1368,8 +1368,8 @@ static long d_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioc
-                 first = ioread32(ioaddr);
-                 second = ioread32( ioaddr + 4 );
-                 ptr[0] = first | (second << 32);
--                break;
-             #endif
-+                break;
+diff --git a/drivers/linux/chipsec_km.c b/drivers/linux/chipsec_km.c
+index 60e1247..4f993f6 100644
+--- a/drivers/linux/chipsec_km.c
++++ b/drivers/linux/chipsec_km.c
+@@ -1437,8 +1437,8 @@ static long d_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioc
+ 				first = ioread32(ioaddr);
+ 				second = ioread32( ioaddr + 4 );
+ 				ptr[0] = first | (second << 32);
+-				break;
+ 			#endif
++				break;
  		}
  
  		my_unxlate_dev_mem_ptr(addr, ioaddr);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/9] chipsec: do not custom-build the chipsec kernel module
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
  2017-03-10 23:36 ` [PATCH 1/9] core-image-efi-initramfs: Temporarily disable chipsec Ricardo Neri
  2017-03-10 23:36 ` [PATCH 2/9] chipsec: update support for 32-bit Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 4/9] chipsec: remove _prepend's that change directories Ricardo Neri
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 7572 bytes --]

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 <ricardo.neri-calderon@linux.intel.com>

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-linux-Do-not-host-system-s-kernel-source-dir.patch
 delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/0006-drivers-linux-Don-t-build-userland-app-automatically.patch

diff --git a/meta-luv/recipes-core/chipsec/chipsec/0001-drivers-linux-Do-not-host-system-s-kernel-source-dir.patch b/meta-luv/recipes-core/chipsec/chipsec/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 <ricardo.neri-calderon@linux.intel.com>
+Date: Thu, 9 Mar 2017 19:32:58 -0800
+Subject: [PATCH] drivers: linux: Do not host system's kernel source directory
+
+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 <ricardo.neri-calderon@linux.intel.com>
+---
+ 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 ?= /lib/modules/`uname -r`/build
++KERNEL_SRC_DIR = LUV_KERNEL_SRC_DIR
+ #KERNEL_SRC_DIR = /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/chipsec/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 <matt.fleming@intel.com>
-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 <matt.fleming@intel.com>
----
- 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=`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=`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/recipes-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/recipes-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 = "GPLv2"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=8c16666ae6c159876a0ba63099614381"
 
 SRC_URI = "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/linux/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=${STAGING_KERNEL_DIR}   \
-        KERNEL_VERSION=${KERNEL_VERSION}    \
-        CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
-        AR="${KERNEL_AR}" -C ${STAGING_KERNEL_DIR} \
-        scripts
-
-    oe_runmake KERNEL_SRC_DIR=${STAGING_KERNEL_DIR}   \
-        KERNEL_VERSION=${KERNEL_VERSION}    \
-        CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
-        AR="${KERNEL_AR}" INC="${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=echo INSTALL_MOD_PATH="${D}" \
-        KERNEL_SRC=${STAGING_KERNEL_DIR} \
-        CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
-        -C ${STAGING_KERNEL_DIR} \
-        M="${S}/source/drivers/linux" \
-        modules_install
 }
 
 LUV_TEST_LOG_PARSER="luv-parser-chipsec"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/9] chipsec: remove _prepend's that change directories
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (2 preceding siblings ...)
  2017-03-10 23:36 ` [PATCH 3/9] chipsec: do not custom-build the chipsec kernel module Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 5/9] chipsec: correct location of installation Ricardo Neri
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]

In CHIPSEC v1.2.5 there is no need to change directories since
things can now be built from the root of the repository.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 meta-luv/recipes-core/chipsec/chipsec_git.bb | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipes-core/chipsec/chipsec_git.bb
index 8f96440..da0f970 100644
--- a/meta-luv/recipes-core/chipsec/chipsec_git.bb
+++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb
@@ -60,14 +60,6 @@ do_patch_append() {
     bb.build.exec_func('fix_kernel_source_dir', d)
 }
 
-do_compile_prepend() {
-    cd ${S}/source/tool
-}
-
-do_install_prepend() {
-    cd ${S}/source/tool
-}
-
 do_install_append() {
     install -d ${D}${bindir}
     install -m 0755 ${WORKDIR}/chipsec ${D}${bindir}
@@ -75,5 +67,4 @@ do_install_append() {
 
 LUV_TEST_LOG_PARSER="luv-parser-chipsec"
 
-FILES_${PN} += "/lib/modules/${KERNEL_VERSION}/extra/chipsec.ko"
 FILES_${PN}-dbg +="${libdir}/${PYTHON_DIR}/site-packages/${PN}/helper/linux/.debug"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/9] chipsec: correct location of installation
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (3 preceding siblings ...)
  2017-03-10 23:36 ` [PATCH 4/9] chipsec: remove _prepend's that change directories Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 6/9] chipsec: update build time and runtime dependencies Ricardo Neri
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]

Now chipsec relies on setuptools to install chipsec. This leads to a
bizarre issue in which the chipsec artifacts are buried under a
directory structure ${D}/${PYTHON_SITEPACKAGES_DIR}${D}/
${PYTHON_SITEPACKAGES_DIR}. Relocate the chipsec binaries to the
expected location.

Also, we use the --root option in setup.py to get rid of the CPU
architecture and the operating system sufix to the package name.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 meta-luv/recipes-core/chipsec/chipsec_git.bb | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipes-core/chipsec/chipsec_git.bb
index da0f970..2f7bcb6 100644
--- a/meta-luv/recipes-core/chipsec/chipsec_git.bb
+++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb
@@ -46,6 +46,9 @@ def get_target_arch(d):
 
 EXTRA_OEMAKE += "ARCH="${@get_target_arch(d)}""
 
+DISTUTILS_INSTALL_ARGS = "--root=${D}${PYTHON_SITEPACKAGES_DIR} \
+    --install-data=${D}/${datadir}"
+
 fix_mod_path() {
     sed -i -e "s:^INSTALL_MOD_PATH_PREFIX = .*:INSTALL_MOD_PATH_PREFIX = \"${PYTHON_SITEPACKAGES_DIR}\":" ${S}/source/tool/chipsec_main.py
     sed -i -e "s:PYTHONPATH:${PYTHON_SITEPACKAGES_DIR}:" ${WORKDIR}/chipsec
@@ -63,6 +66,19 @@ do_patch_append() {
 do_install_append() {
     install -d ${D}${bindir}
     install -m 0755 ${WORKDIR}/chipsec ${D}${bindir}
+
+    #
+    # FIXME: for some reason chipsec ends up installed in a repeated
+    # directory structure. Thus, we need to move it to its proper location
+    # under PYTHON_SITEPACKAGES_DIR
+    #
+
+    install -d ${D}${PYTHON_SITEPACKAGES_DIR}/${PN}
+    mv ${D}${PYTHON_SITEPACKAGES_DIR}${D}${PYTHON_SITEPACKAGES_DIR}/* ${D}${PYTHON_SITEPACKAGES_DIR}/${PN}
+    # remove old files
+    cd ${D}${PYTHON_SITEPACKAGES_DIR}
+    ls | grep -v chipsec | xargs rm -fr
+    cd $OLDPWD
 }
 
 LUV_TEST_LOG_PARSER="luv-parser-chipsec"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/9] chipsec: update build time and runtime dependencies
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (4 preceding siblings ...)
  2017-03-10 23:36 ` [PATCH 5/9] chipsec: correct location of installation Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 7/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

At build time, now CHIPSEC uses python-setuptools-native to manage
installation in sysroot.

At runtime, CHIPSEC now uses json, mmap and resource. Add these
tree as runtime dependencies.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 meta-luv/recipes-core/chipsec/chipsec_git.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipes-core/chipsec/chipsec_git.bb
index 2f7bcb6..1365da2 100644
--- a/meta-luv/recipes-core/chipsec/chipsec_git.bb
+++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb
@@ -17,9 +17,10 @@ SRC_URI = "git://github.com/chipsec/chipsec.git \
 SRCREV="20cc5a30675548a764dadfe0dc677a283816906c"
 PV="1.2.2"
 
-DEPENDS = "virtual/kernel python-core nasm-native"
+DEPENDS = "virtual/kernel python-core nasm-native python-setuptools-native"
 RDEPENDS_${PN} = "python python-shell python-stringold python-xml \
-    python-ctypes python-fcntl python-importlib"
+    python-ctypes python-fcntl python-importlib python-json python-mmap \
+    python-resource"
 
 COMPATIBLE_HOST='(i.86|x86_64).*'
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/9] chipsec: bump to v1.2.5+
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (5 preceding siblings ...)
  2017-03-10 23:36 ` [PATCH 6/9] chipsec: update build time and runtime dependencies Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 8/9] chipsec: do not ship manual Ricardo Neri
  2017-03-10 23:36 ` [PATCH 9/9] core-image-efi-initramfs: Re-enable chipsec Ricardo Neri
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 6706 bytes --]

Bump our recipe for CHIPSEC v1.2.5+. While here, drop three patches
that are not longer needed as these changes are already present in the
CHIPSEC source code.

Also, update the path of chipsec_main.py with its new location for the
LUV runner script.

The version is renamed as v1.2.5+ as it includes CHIPSEC v1.2.5 plus
all the changes present in its repository available at the time
of writing this patch.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 ...utilize-inode_lock-unlock-wrappers-for-ne.patch | 44 ----------------------
 ...up-install-cores-library-under-helper-lin.patch | 31 ---------------
 meta-luv/recipes-core/chipsec/chipsec_git.bb       | 12 +++---
 3 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/0002-chipsec_km-utilize-inode_lock-unlock-wrappers-for-ne.patch
 delete mode 100644 meta-luv/recipes-core/chipsec/chipsec/chipsec-setup-install-cores-library-under-helper-lin.patch

diff --git a/meta-luv/recipes-core/chipsec/chipsec/0002-chipsec_km-utilize-inode_lock-unlock-wrappers-for-ne.patch b/meta-luv/recipes-core/chipsec/chipsec/0002-chipsec_km-utilize-inode_lock-unlock-wrappers-for-ne.patch
deleted file mode 100644
index 486c0f6..0000000
--- a/meta-luv/recipes-core/chipsec/chipsec/0002-chipsec_km-utilize-inode_lock-unlock-wrappers-for-ne.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 69f6b51a0291cc49854b5125aac7ebbb576a73a3 Mon Sep 17 00:00:00 2001
-From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
-Date: Thu, 2 Jun 2016 09:46:45 -0700
-Subject: [PATCH] chipsec_km: utilize inode_lock/unlock wrappers for new
- kernels
-
-As of v4.5, wrappers to lock and unlock the inode's mutex were
-introduced. This change is useful to leverage future changes in the
-implementation of inode locking. For instance, a new change coming in
-Linux v4.7-rc1 changed the i_node locking mechanism from using a mutex
-to a rw sempahore.
-
-Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
----
- source/drivers/linux/chipsec_km.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/source/drivers/linux/chipsec_km.c b/source/drivers/linux/chipsec_km.c
-index e76f6a9..f2d8332 100644
---- a/source/drivers/linux/chipsec_km.c
-+++ b/source/drivers/linux/chipsec_km.c
-@@ -535,6 +535,9 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
- //Older kernels (<20) uses f_dentry instead of f_path.dentry
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
- 	mutex_lock(&file->f_dentry->d_inode->i_mutex);
-+//As of v4.5, use the wrappers inode_lock/unlock
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
-+	inode_lock(file->f_path.dentry->d_inode);
- #else
- 	mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
- #endif 
-@@ -556,6 +559,9 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
- //Older kernels (<20) uses f_dentry instead of f_path.dentry
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
- 	mutex_unlock(&file->f_dentry->d_inode->i_mutex);
-+//As of v4.5, use the wrappers inode_lock/unlock
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
-+	inode_unlock(file->f_path.dentry->d_inode);
- #else
- 	mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
- #endif 
--- 
-2.8.3
-
diff --git a/meta-luv/recipes-core/chipsec/chipsec/chipsec-setup-install-cores-library-under-helper-lin.patch b/meta-luv/recipes-core/chipsec/chipsec/chipsec-setup-install-cores-library-under-helper-lin.patch
deleted file mode 100644
index 979a3e7..0000000
--- a/meta-luv/recipes-core/chipsec/chipsec/chipsec-setup-install-cores-library-under-helper-lin.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 7693ec8b167a1b82b58d997f79640048e4e896b5 Mon Sep 17 00:00:00 2001
-From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
-Date: Mon, 14 Dec 2015 07:23:36 -0800
-Subject: [PATCH] chipsec: setup: install cores library under helper/linux
-
-Simply setting 'cores' in the constructor of Extension causes the library
-to be installed under the root of the package. However, the helper.py module
-expects to find it under [package-root]/helper/linux. Thus, install the library
-where helper.py can find it.
-
-Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
----
- source/tool/setup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/source/tool/setup.py b/source/tool/setup.py
-index 7dce743..66a74d5 100644
---- a/source/tool/setup.py
-+++ b/source/tool/setup.py
-@@ -49,7 +49,7 @@ if platform.system().lower() == "windows":
- 
- if platform.system().lower() == "linux":
-     data_files = []
--    extensions = [ Extension('cores', sources=['chipsec/helper/linux/cores.c']) ]
-+    extensions = [ Extension('chipsec.helper.linux.cores', sources=['chipsec/helper/linux/cores.c']) ]
- 
- version      = ""
- VERSION_FILE = os.path.join( os.path.dirname( __file__ ),'VERSION' )
--- 
-1.9.1
-
diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipes-core/chipsec/chipsec_git.bb
index 1365da2..5755e4e 100644
--- a/meta-luv/recipes-core/chipsec/chipsec_git.bb
+++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb
@@ -9,13 +9,11 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=8c16666ae6c159876a0ba63099614381"
 SRC_URI = "git://github.com/chipsec/chipsec.git \
     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 \
     file://0001-chipsec-building-for-32-bit-systems.patch \
-    file://0002-chipsec_km-utilize-inode_lock-unlock-wrappers-for-ne.patch"
+    "
 
-SRCREV="20cc5a30675548a764dadfe0dc677a283816906c"
-PV="1.2.2"
+SRCREV="2fbb7a4eeb3752998dfbcbdf771cd3f8ed1985ae"
+PV="1.2.5+"
 
 DEPENDS = "virtual/kernel python-core nasm-native python-setuptools-native"
 RDEPENDS_${PN} = "python python-shell python-stringold python-xml \
@@ -51,8 +49,8 @@ DISTUTILS_INSTALL_ARGS = "--root=${D}${PYTHON_SITEPACKAGES_DIR} \
     --install-data=${D}/${datadir}"
 
 fix_mod_path() {
-    sed -i -e "s:^INSTALL_MOD_PATH_PREFIX = .*:INSTALL_MOD_PATH_PREFIX = \"${PYTHON_SITEPACKAGES_DIR}\":" ${S}/source/tool/chipsec_main.py
-    sed -i -e "s:PYTHONPATH:${PYTHON_SITEPACKAGES_DIR}:" ${WORKDIR}/chipsec
+    sed -i -e "s:^INSTALL_MOD_PATH_PREFIX = .*:INSTALL_MOD_PATH_PREFIX = \"${PYTHON_SITEPACKAGES_DIR}\":" ${S}/chipsec_main.py
+    sed -i -e "s:PYTHONPATH:${PYTHON_SITEPACKAGES_DIR}/chipsec:" ${WORKDIR}/chipsec
 }
 
 fix_kernel_source_dir() {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 8/9] chipsec: do not ship manual
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (6 preceding siblings ...)
  2017-03-10 23:36 ` [PATCH 7/9] chipsec: bump to v1.2.5+ Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  2017-03-10 23:36 ` [PATCH 9/9] core-image-efi-initramfs: Re-enable chipsec Ricardo Neri
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 3116 bytes --]

The usage model of LUV is intended to be automated. Then, CHIPSEC runs
in an automated manner. Thus, there is no need to ship the CHIPSEC
manual in our ramdisk. Furthermore, we don't ship a PDF reader. Hence,
it is unlikely that someone would try to retrieve the manual from our
ramdisk when easier alternatives exists (e.g., the CHIPSEC repository).
Removing the manual helps us to save several Kbytes of valuable
ramdisk space.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 .../chipsec/0001-chipsec-do-not-ship-manual.patch  | 38 ++++++++++++++++++++++
 meta-luv/recipes-core/chipsec/chipsec_git.bb       |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-do-not-ship-manual.patch

diff --git a/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-do-not-ship-manual.patch b/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-do-not-ship-manual.patch
new file mode 100644
index 0000000..09fa941
--- /dev/null
+++ b/meta-luv/recipes-core/chipsec/chipsec/0001-chipsec-do-not-ship-manual.patch
@@ -0,0 +1,38 @@
+From eb378df238531c1d10543e2fb643cccb74a8f421 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Fri, 10 Mar 2017 12:30:20 -0800
+Subject: [PATCH] chipsec: do not ship manual
+
+Given that LUV is an automated tool we don't ship a PDF reader,
+it does not make sense to include the chipsec manual. We can save
+a few Kbytes of valuable ramdisk space.
+
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+---
+ setup.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 89bcc91..fb0da43 100644
+--- a/setup.py
++++ b/setup.py
+@@ -141,7 +141,7 @@ package_data = {
+     "chipsec": ["VERSION", "WARNING.txt"],
+     "chipsec.cfg": ["*.xml", "*.xsd"],
+ }
+-data_files = [("", ["chipsec-manual.pdf"])]
++data_files = []
+ install_requires = []
+ extra_kw = {}
+ 
+@@ -155,7 +155,6 @@ if platform.system().lower() == "windows":
+ elif platform.system().lower() == "linux":
+     compression_source_files = []
+     package_data["chipsec_tools.linux"] = ['*']
+-    data_files = [(os.path.join("share","doc","chipsec"), ["chipsec-manual.pdf"])]
+     for root, dir, path in os.walk( os.path.join( "chipsec_tools", "compression" ) ):
+         for f in path:
+             if os.path.splitext(f)[1][1:] == 'h':
+-- 
+2.9.3
+
diff --git a/meta-luv/recipes-core/chipsec/chipsec_git.bb b/meta-luv/recipes-core/chipsec/chipsec_git.bb
index 5755e4e..d6c1bef 100644
--- a/meta-luv/recipes-core/chipsec/chipsec_git.bb
+++ b/meta-luv/recipes-core/chipsec/chipsec_git.bb
@@ -10,6 +10,7 @@ SRC_URI = "git://github.com/chipsec/chipsec.git \
     file://0001-drivers-linux-Do-not-host-system-s-kernel-source-dir.patch \
     file://chipsec file://luv-parser-chipsec \
     file://0001-chipsec-building-for-32-bit-systems.patch \
+    file://0001-chipsec-do-not-ship-manual.patch \
     "
 
 SRCREV="2fbb7a4eeb3752998dfbcbdf771cd3f8ed1985ae"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 9/9] core-image-efi-initramfs: Re-enable chipsec
  2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
                   ` (7 preceding siblings ...)
  2017-03-10 23:36 ` [PATCH 8/9] chipsec: do not ship manual Ricardo Neri
@ 2017-03-10 23:36 ` Ricardo Neri
  8 siblings, 0 replies; 10+ messages in thread
From: Ricardo Neri @ 2017-03-10 23:36 UTC (permalink / raw)
  To: chipsec

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

Now that we have bumped to v1.2.5+, and everything builds correctly,
re-enable chipsec in our ramdisk.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 meta-luv/recipes-core/images/core-image-efi-initramfs.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-luv/recipes-core/images/core-image-efi-initramfs.bb b/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
index 8f9aa75..5048946 100644
--- a/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
+++ b/meta-luv/recipes-core/images/core-image-efi-initramfs.bb
@@ -10,7 +10,7 @@ IMAGE_INSTALL = "\
     psplash kernel-efi-warnings linux-firmware kexec \
     "
 
-X86_ADDITIONS = "python-codecs python-subprocess vmcore-dmesg bits \
+X86_ADDITIONS = "chipsec python-codecs python-subprocess vmcore-dmesg bits \
                  kernel-modules"
 
 IMAGE_INSTALL_append_qemux86 = "${X86_ADDITIONS}"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-10 23:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 23:36 [PATCH 0/9] chipsec: bump to v1.2.5+ Ricardo Neri
2017-03-10 23:36 ` [PATCH 1/9] core-image-efi-initramfs: Temporarily disable chipsec Ricardo Neri
2017-03-10 23:36 ` [PATCH 2/9] chipsec: update support for 32-bit Ricardo Neri
2017-03-10 23:36 ` [PATCH 3/9] chipsec: do not custom-build the chipsec kernel module Ricardo Neri
2017-03-10 23:36 ` [PATCH 4/9] chipsec: remove _prepend's that change directories Ricardo Neri
2017-03-10 23:36 ` [PATCH 5/9] chipsec: correct location of installation Ricardo Neri
2017-03-10 23:36 ` [PATCH 6/9] chipsec: update build time and runtime dependencies Ricardo Neri
2017-03-10 23:36 ` [PATCH 7/9] chipsec: bump to v1.2.5+ Ricardo Neri
2017-03-10 23:36 ` [PATCH 8/9] chipsec: do not ship manual Ricardo Neri
2017-03-10 23:36 ` [PATCH 9/9] core-image-efi-initramfs: Re-enable chipsec Ricardo Neri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).