kernel.bbclass: Find the kernel consistently.
PATCH 1/2 kernel.bbclass: Find the kernel consistently.
Use KERNEL_OUTPUT variable to find the generated kernel image rather than duplicating the existing path. This also means it can be overridden simply.
--- meta/classes/kernel.bbclass | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/kernel.bbclass +1 -1
@@ -476,7 +476,7 @@ KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" kernel_do_deploy() { - install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin + install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib fi
Signature · 1 line
1.7.2.5
PATCH 2/2 kernel.bbclass: support kernel image type of vmlinux.gz
Add support for a gzipped vmlinux kernel by specifying:
KERNEL_IMAGETYPE = "vmlinux.gz"
--- meta/classes/kernel.bbclass | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
meta/classes/kernel.bbclass +6 -1
@@ -75,10 +75,15 @@ EXTRA_OEMAKE = "" KERNEL_ALT_IMAGETYPE ??= "" +KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(bb.data.getVar('KERNEL_IMAGETYPE', d, 1))}" + kernel_do_compile() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}" - oe_runmake ${KERNEL_IMAGETYPE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" + oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" + if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then + gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}" + fi } do_compile_kernelmodules() {
Signature · 1 line
1.7.2.5
Quoted 3 lines · Mike Crowe
Use
KERNEL_OUTPUTvariable to find the generated kernel image rather than duplicating the existing path. This also means it can be overridden simply.
There are other places in kernel.bbclass that use the path vs KERNEL_OUTPUT, is there a reason you did not change those also?
Sau!
Quoted 18 lines
Signed-off-by Mike Crowe<[email protected]>--- meta/classes/kernel.bbclass | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)meta/classes/kernel.bbclass +1
-1@@ -476,7 +476,7 @@ KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" kernel_do_deploy() { - install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin + install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib fi
Quoted 6 lines · Saul Wold
Quoted 3 lines · Mike Crowe
Use
KERNEL_OUTPUTvariable to find the generated kernel image rather than duplicating the existing path. This also means it can be overridden simply.There are other places in kernel.bbclass that use the path vs
KERNEL_OUTPUT, is there a reason you did not change those also?
The patch came out of an earlier attempt to do what I was doing in PATCH 2/2 and I hadn't needed to change the other places. :(
Looking at the other places now I think that the two in do_sizecheck are candidates for changing to KERNEL_OUTPUT. I'm less sure about the uImage ones in kernel_do_deploy due to there being other references to arch/${ARCH}/boot/... nearby. I wouldn't want to make the code less clear.
Updated patch follows.
Thanks for your comments.
Mike.
PATCH v2 1/1 kernel.bbclass: Find the kernel consistently.
Use KERNEL_OUTPUT variable to find the generated kernel image rather than duplicating the existing path. This also means it can be overridden simply.
--- meta/classes/kernel.bbclass | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
meta/classes/kernel.bbclass +3 -3
@@ -460,9 +460,9 @@ python populate_packages_prepend () { # with a fixed length or there is a limit in transferring the kernel to memory do_sizecheck() { if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then - size=`ls -l arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | awk '{ print $5}'` + size=`ls -l ${KERNEL_OUTPUT} | awk '{ print $5}'` if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then - rm arch/${ARCH}/boot/${KERNEL_IMAGETYPE} + rm ${KERNEL_OUTPUT} die "This kernel (size=$size > ${KERNEL_IMAGE_MAXSIZE}) is too big for your device. Please reduce the size of the kernel by making more of it modular." fi fi
@@ -476,7 +476,7 @@ KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" kernel_do_deploy() { - install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin + install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib fi
Signature · 1 line
1.7.2.5
Richard Purdie
AppliedQuoted 7 lines · Mike Crowe
Use
KERNEL_OUTPUTvariable to find the generated kernel image rather than duplicating the existing path. This also means it can be overridden simply.Signed-off-by Mike Crowe <[email protected]>--- meta/classes/kernel.bbclass | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Merged to master, thanks.
Richard