Skip to contentSkip to conversation

kernel-devsrc: add 'make scripts' postinstall

PATCH In review Ming Liu 2 participants 3 messages Nov 22, 2015 – Nov 23, 2015

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/1 kernel-devsrc: add 'make scripts' postinstall

From: Ming Liu <[email protected]>

Run 'make scripts' inside qemu in order to create script binaries that needed by external modules build on the target.

This 'make scripts' might fail in some cases, for instance, if toolchain or make command is not installed on the target, but the postinstall should always succeed, it will not break the package installation so the behaviour is consistent.

[YOCTO #6630]

---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-kernel/linux/kernel-devsrc.bb +12 -1
index 196c8c7..8b366c3 100644
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425
 inherit linux-kernel-base
 
 # Whilst not a module, this ensures we don't get multilib extended (which would make no sense)
-inherit module-base
+inherit module-base qemu
 
 # We need the kernel to be staged (unpacked, patched and configured) before
 # we can grab the source and make the source package. We also need the bits from
@@ -71,6 +71,17 @@ do_install() {
 # Ensure we don't race against "make scripts" during cpio
 do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
 
+pkg_postinst_${PN} () {
+	if [ -n "$D" ]; then
+		${@qemu_run_binary(d, '$D', '${bindir}/make')} \
+			-C $D${KERNEL_SRC_PATH} O=$D${KERNEL_SRC_PATH} scripts
+	else
+		make -C ${KERNEL_SRC_PATH} O=${KERNEL_SRC_PATH} scripts \
+			>/dev/null 2>&1 || true
+	fi
+}
+
 PACKAGES = "kernel-devsrc"
 FILES_${PN} = "${KERNEL_SRC_PATH}"
+DEPENDS = "qemu-native"
 RDEPENDS_${PN} = "bc"
Signature · 1 line
1.9.1
#1 lore raw
Quoted 9 lines · Ming Liu

From: Ming Liu <[email protected]>

Run 'make scripts' inside qemu in order to create script binaries that needed by external modules build on the target.

This 'make scripts' might fail in some cases, for instance, if toolchain or make command is not installed on the target, but the postinstall should always succeed, it will not break the package installation so the behaviour is consistent.

What about just making the package depend on the toolchain ? That was the approach that I was going to take .. but haven't gotten there yet.

The compilation step worried me at first, but since devsrc is already quite heavy, adding the extra dependency and compile phase shouldn't be a big issue.

For Yocto 2.1, I'm changing the packaging of the kernel source, headers and development chunks. But this change shouldn't be an issue with that. I'll let you know when I get a bit further along with that work.

Quoted 2 lines

[YOCTO #6630]

Once minor 'nit .. if you are submitting a change for a bug that is assigned to me .. why haven't I heard anything about it until now ?

Bruce

Quoted 38 lines
---
  meta/recipes-kernel/linux/kernel-devsrc.bb | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-kernel/linux/kernel-devsrc.bb +12 -1
index 196c8c7..8b366c3 100644
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425
  inherit linux-kernel-base
 
  # Whilst not a module, this ensures we don't get multilib extended (which would make no sense)
-inherit module-base
+inherit module-base qemu
 
  # We need the kernel to be staged (unpacked, patched and configured) before
  # we can grab the source and make the source package. We also need the bits from
@@ -71,6 +71,17 @@ do_install() {
  # Ensure we don't race against "make scripts" during cpio
  do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
 
+pkg_postinst_${PN} () {
+	if [ -n "$D" ]; then
+		${@qemu_run_binary(d, '$D', '${bindir}/make')} \
+			-C $D${KERNEL_SRC_PATH} O=$D${KERNEL_SRC_PATH} scripts
+	else
+		make -C ${KERNEL_SRC_PATH} O=${KERNEL_SRC_PATH} scripts \
+			>/dev/null 2>&1 || true
+	fi
+}
+
  PACKAGES = "kernel-devsrc"
  FILES_${PN} = "${KERNEL_SRC_PATH}"
+DEPENDS = "qemu-native"
  RDEPENDS_${PN} = "bc"
author
#2 lore raw
Quoted 6 lines · Bruce Ashfield
Quoted 5 lines · Ming Liu

From: Ming Liu <[email protected]>

Run 'make scripts' inside qemu in order to create script binaries that needed by external modules build on the target.

Quoted 7 lines
Quoted 4 lines

This 'make scripts' might fail in some cases, for instance, if toolchain or make command is not installed on the target, but the postinstall should always succeed, it will not break the package installation so the behaviour is consistent.

What about just making the package depend on the toolchain ? That was the approach that I was going to take .. but haven't gotten there yet.

Yes, that makes more sense from the dependency point of view, I also thought about that, but I did not want to introduce extra dependencies at that time. But maybe it's a better solution, I will send the V1 soon.

Quoted 4 lines

The compilation step worried me at first, but since devsrc is already quite heavy, adding the extra dependency and compile phase shouldn't be a big issue.

I am on board.

Quoted 4 lines

For Yocto 2.1, I'm changing the packaging of the kernel source, headers and development chunks. But this change shouldn't be an issue with that. I'll let you know when I get a bit further along with that work.

Thanks, good to know that.

Quoted 7 lines
Quoted 3 lines

[YOCTO #6630]

Once minor 'nit .. if you are submitting a change for a bug that is assigned to me .. why haven't I heard anything about it until now ?

Really sorry about that, I just started to look at it on last Sunday, then this solution came out of my mind, but I should talk to you before submitting it.

//Ming Liu

Quoted 46 lines

Bruce

Quoted 42 lines
---
  meta/recipes-kernel/linux/kernel-devsrc.bb | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-kernel/linux/kernel-devsrc.bb +0 -0
index 196c8c7..8b366c3 100644
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = 

"file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425
inherit linux-kernel-base

# Whilst not a module, this ensures we don't get multilib extended
(which would make no sense)

meta/recipes-kernel/linux/kernel-devsrc.bb +1 -1
-inherit module-base
+inherit module-base qemu
 
  # We need the kernel to be staged (unpacked, patched and 

configured) before

  # we can grab the source and make the source package. We also need 
the bits from
meta/recipes-kernel/linux/kernel-devsrc.bb +11 -0
@@ -71,6 +71,17 @@ do_install() {
  # Ensure we don't race against "make scripts" during cpio
  do_install[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
 
+pkg_postinst_${PN} () {
+    if [ -n "$D" ]; then
+        ${@qemu_run_binary(d, '$D', '${bindir}/make')} \
+            -C $D${KERNEL_SRC_PATH} O=$D${KERNEL_SRC_PATH} scripts
+    else
+        make -C ${KERNEL_SRC_PATH} O=${KERNEL_SRC_PATH} scripts \
+            >/dev/null 2>&1 || true
+    fi
+}
+
  PACKAGES = "kernel-devsrc"
  FILES_${PN} = "${KERNEL_SRC_PATH}"
+DEPENDS = "qemu-native"
  RDEPENDS_${PN} = "bc"