Skip to contentSkip to conversation

more kernel.bbclass updates

PATCH Superseded Martin Jansa 6 participants 14 messages Mar 29, 2012 – Apr 27, 2012

lore
Share & tools
lore
#0 lore raw

cover more kernel.bbclass updates

The following changes since commit 432e36300d7231c9b01cd2c6c4b39b84cf4fddca:

rpm: Ensure we depend on file (2012-03-28 18:40:20 +0100)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib jansa/kernel2
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=jansa/kernel2

Martin Jansa (2):
kernel.bbclass: merge uboot_mkimage improvements from meta-oe kernel.bbclass: unify white spaces

 meta/classes/kernel.bbclass |   77 +++++++++++++++++++++++-------------------
 1 files changed, 42 insertions(+), 35 deletions(-)
Signature · 1 line
1.7.8.5
#1 lore raw

PATCH 1/2 kernel.bbclass: merge uboot_mkimage improvements from meta-oe

---
 meta/classes/kernel.bbclass |   39 +++++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 16 deletions(-)
meta/classes/kernel.bbclass +23 -16
index 3519e7c..8cd5fc7 100644
@@ -502,32 +502,39 @@ do_sizecheck() {
 
 addtask sizecheck before do_install after do_compile
 
-KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
-# Don't include the DATETIME variable in the sstate package signatures
-KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
-KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
-
-kernel_do_deploy() {
-	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
-
+do_uboot_mkimage() {
 	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
-		if test -e arch/${ARCH}/boot/uImage ; then
-			cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-		elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then
+		ENTRYPOINT=${UBOOT_ENTRYPOINT}
+		if test -n "${UBOOT_ENTRYSYMBOL}"; then
+			ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+				awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+		fi
+		if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
 			${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
 			rm -f linux.bin
 		else
 			${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
 			rm -f linux.bin.gz
 			gzip -9 linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
 			rm -f linux.bin.gz
 		fi
 	fi
+}
+
+addtask uboot_mkimage before do_install after do_compile
+
+KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
+# Don't include the DATETIME variable in the sstate package signatures
+KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
+KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
+
+kernel_do_deploy() {
+	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
 
 	cd ${DEPLOYDIR}
 	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
Signature · 1 line
1.7.8.5
#2 lore raw

PATCH 2/2 kernel.bbclass: unify white spaces

* indentation was with spaces and tabs, unify to use tabs instead of spaces, because "python populate_packages" expects tabs (or 8 spaces) and we're doing populate_packages_preppend here

---
 meta/classes/kernel.bbclass |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)
meta/classes/kernel.bbclass +19 -19
index 8cd5fc7..f1494b1 100644
@@ -11,15 +11,15 @@ INITRAMFS_IMAGE ?= ""
 INITRAMFS_TASK ?= ""
 
 python __anonymous () {
-    kerneltype = d.getVar('KERNEL_IMAGETYPE', True) or ''
-    if kerneltype == 'uImage':
-    	depends = d.getVar("DEPENDS", True)
-    	depends = "%s u-boot-mkimage-native" % depends
-    	d.setVar("DEPENDS", depends)
-
-    image = d.getVar('INITRAMFS_IMAGE', True)
-    if image:
-        d.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs')
+	kerneltype = d.getVar('KERNEL_IMAGETYPE', True) or ''
+	if kerneltype == 'uImage':
+		depends = d.getVar("DEPENDS", True)
+		depends = "%s u-boot-mkimage-native" % depends
+		d.setVar("DEPENDS", depends)
+
+	image = d.getVar('INITRAMFS_IMAGE', True)
+	if image:
+		d.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs')
 }
 
 inherit kernel-arch deploy
@@ -91,7 +91,7 @@ kernel_do_compile() {
 do_compile_kernelmodules() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
-		oe_runmake ${PARALLEL_MAKE} modules  CC="${KERNEL_CC}" LD="${KERNEL_LD}"
+		oe_runmake ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}"
 	else
 		bbnote "no modules to compile"
 	fi
@@ -115,7 +115,7 @@ kernel_do_install() {
 
 	#
 	# Install various kernel output (zImage, map file, config, module support files)
-	#	
+	#
 	install -d ${D}/${KERNEL_IMAGEDEST}
 	install -d ${D}/boot
 	install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
@@ -188,7 +188,7 @@ kernel_do_install() {
 	bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
 	           arch/powerpc/boot/mktree"
 	for entry in $bin_files; do
-	        rm -f $kerneldir/$entry
+		rm -f $kerneldir/$entry
 	done
 }
 
@@ -386,10 +386,10 @@ python populate_packages_prepend () {
 		return deps
 	
 	def get_dependencies(file, pattern, format):
-                # file no longer includes PKGD
+		# file no longer includes PKGD
 		file = file.replace(d.getVar('PKGD', True) or '', '', 1)
-                # instead is prefixed with /lib/modules/${KERNEL_VERSION}
-                file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
+		# instead is prefixed with /lib/modules/${KERNEL_VERSION}
+		file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
 
 		if module_deps.has_key(file):
 			import re
@@ -493,11 +493,11 @@ python populate_packages_prepend () {
 do_sizecheck() {
 	if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
 		size=`ls -l ${KERNEL_OUTPUT} | awk '{ print $5}'`
-        	if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
+		if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
 			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
+			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
 }
 
 addtask sizecheck before do_install after do_compile
Signature · 1 line
1.7.8.5
#3 lore raw

Re: [PATCH 2/2] kernel.bbclass: unify white spaces

Quoted 8 lines · Martin Jansa

* indentation was with spaces and tabs, unify to use tabs instead of spaces, because "python populate_packages" expects tabs (or 8 spaces) and we're doing populate_packages_preppend here

---
 meta/classes/kernel.bbclass |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

FWIW, we're supposed to be using tabs for shell code and spaces (4) for python. Unfortunately populate_package() is special due to the number of places we append/prepend it and the need to be consistent with whitespace.

I'm therefore not sure it makes sense to re-indent the anonymous python.

Cheers,

Richard

#4 lore raw

Re: [PATCH 2/2] kernel.bbclass: unify white spaces

Quoted 10 lines · Richard Purdie
Quoted 8 lines · Martin Jansa

* indentation was with spaces and tabs, unify to use tabs instead of spaces, because "python populate_packages" expects tabs (or 8 spaces) and we're doing populate_packages_preppend here

---
 meta/classes/kernel.bbclass |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)
Quoted 6 lines

FWIW, we're supposed to be using tabs for shell code and spaces (4) for python. Unfortunately populate_package() is special due to the number of places we append/prepend it and the need to be consistent with whitespace.

I'm therefore not sure it makes sense to re-indent the anonymous python.

Agreed, but that anonymous python used spaces and tabs in the same function which is ugly.

Cheers,

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw

Re: [PATCH 2/2] kernel.bbclass: unify white spaces

Quoted 16 lines · Martin Jansa
Quoted 15 lines · Richard Purdie
Quoted 8 lines · Martin Jansa

* indentation was with spaces and tabs, unify to use tabs instead of spaces, because "python populate_packages" expects tabs (or 8 spaces) and we're doing populate_packages_preppend here

---
 meta/classes/kernel.bbclass |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

FWIW, we're supposed to be using tabs for shell code and spaces (4) for python. Unfortunately populate_package() is special due to the number of places we append/prepend it and the need to be consistent with whitespace.

Quoted 4 lines
Quoted 1 line

I'm therefore not sure it makes sense to re-indent the anonymous python.

Agreed, but that anonymous python used spaces and tabs in the same function which is ugly.

I'm fine with cleaning that up but lets continue to use tabs for shell and spaces for python where at all possible, then we're consistent :)

Cheers,

Richard

#6 lore raw

Re: [PATCH 1/2] kernel.bbclass: merge uboot_mkimage improvements from meta-oe

In reply to Martin Jansa
Quoted 25 lines · Martin Jansa

---
 meta/classes/kernel.bbclass |   39 +++++++++++++++++++++++----------------

 1 files changed, 23 insertions(+), 16 deletions(-)
meta/classes/kernel.bbclass +0 -0
index 3519e7c..8cd5fc7 100644
@@ -502,32 +502,39 @@ do_sizecheck() {
 

 addtask sizecheck before do_install after do_compile

meta/classes/kernel.bbclass +1 -11
-KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
-# Don't include the DATETIME variable in the sstate package signatures
-KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
-KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
-
-kernel_do_deploy() {
-       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
-
+do_uboot_mkimage() {
Quoted 3 lines

       if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
-               if test -e arch/${ARCH}/boot/uImage ; then
-                       cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin

We continually try and remove this, but it is a valid use case where some people do want the kernel's uImage to be used and not regenerate it outside of the kernel build process.

The last time this was discussed, it concluded that rather than making this a simple test, we should do it via a flag .. and I'm still of the opinion that would
be the right approach here. There's no reason to break either use case.

Cheers,

Bruce

Quoted 45 lines

-               elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then
+               ENTRYPOINT=${UBOOT_ENTRYPOINT}
+               if test -n "${UBOOT_ENTRYSYMBOL}"; then
+                       ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+                               awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+               fi
+               if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
                       ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-                       uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+                       uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage rm -f linux.bin
               else
                       ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
                       rm -f linux.bin.gz
                       gzip -9 linux.bin
-                       uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+                       uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage rm -f linux.bin.gz
               fi
       fi

meta/classes/kernel.bbclass +14 -0
+}
+
+addtask uboot_mkimage before do_install after do_compile
+
+KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
+# Don't include the DATETIME variable in the sstate package signatures
+KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
+KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
+
+kernel_do_deploy() {
+       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

       cd ${DEPLOYDIR}
       rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
--
1.7.8.5

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
#7 lore raw

Re: [PATCH 1/2] kernel.bbclass: merge uboot_mkimage improvements from meta-oe

In reply to Martin Jansa
Quoted 1 line · Martin Jansa

A commit log here would have been nice. Since it isn't apparently clear what the improvements are to myself or others.

I especially don't understand these cases where people start manually running mkimage vs. taking the uImage from the kernel build. If there is magic address foo needed to make a useful uImage for the platform, then why isn't this data in the kernel Makefiles, vs. being squirrelled off in some recipe? At a minimum, some comments in the recipe indicating what the need for the custom mkimage call was about, and why it differed from the default kernel uImage would be good.

Thanks,
Paul.

Quoted 64 lines
---
 meta/classes/kernel.bbclass |   39 +++++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 16 deletions(-)
meta/classes/kernel.bbclass +23 -16
index 3519e7c..8cd5fc7 100644
@@ -502,32 +502,39 @@ do_sizecheck() {
 
 addtask sizecheck before do_install after do_compile
 
-KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
-# Don't include the DATETIME variable in the sstate package signatures
-KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
-KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
-
-kernel_do_deploy() {
-	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
-
+do_uboot_mkimage() {
 	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
-		if test -e arch/${ARCH}/boot/uImage ; then
-			cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-		elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then
+		ENTRYPOINT=${UBOOT_ENTRYPOINT}
+		if test -n "${UBOOT_ENTRYSYMBOL}"; then
+			ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+				awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+		fi
+		if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
 			${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
 			rm -f linux.bin
 		else
 			${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
 			rm -f linux.bin.gz
 			gzip -9 linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
 			rm -f linux.bin.gz
 		fi
 	fi
+}
+
+addtask uboot_mkimage before do_install after do_compile
+
+KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
+# Don't include the DATETIME variable in the sstate package signatures
+KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
+KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
+
+kernel_do_deploy() {
+	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
 
 	cd ${DEPLOYDIR}
 	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
#8 lore raw

v2 cover more kernel.bbclass updates

In reply to Martin Jansa

The following changes since commit 432e36300d7231c9b01cd2c6c4b39b84cf4fddca:

rpm: Ensure we depend on file (2012-03-28 18:40:20 +0100)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib jansa/kernel2
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=jansa/kernel2

Martin Jansa (2):
kernel.bbclass: merge uboot_mkimage improvements from meta-oe kernel.bbclass: unify white spaces

 meta/classes/kernel.bbclass |   67 ++++++++++++++++++++++++------------------
 1 files changed, 38 insertions(+), 29 deletions(-)
Signature · 1 line
1.7.8.5
#9 lore raw

PATCH v2 1/2 kernel.bbclass: merge uboot_mkimage improvements from meta-oe

* allows to detect ENTRYPOINT from kernel binary marked with UBOOT_ENTRYSYMBOL used e.g. by ben-nanonote

---
 meta/classes/kernel.bbclass |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)
meta/classes/kernel.bbclass +25 -16
index 3519e7c..0ae9bed 100644
@@ -507,28 +507,37 @@ KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME
 KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
 KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
 
+do_uboot_mkimage() {
+	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
+		if test ! -e arch/${ARCH}/boot/uImage ; then
+			ENTRYPOINT=${UBOOT_ENTRYPOINT}
+			if test -n "${UBOOT_ENTRYSYMBOL}"; then
+				ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+					awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+			fi
+			if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
+				${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
+				uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
+				rm -f linux.bin
+			else
+				${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
+				rm -f linux.bin.gz
+				gzip -9 linux.bin
+				uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
+				rm -f linux.bin.gz
+			fi
+		fi
+	fi
+}
+
+addtask uboot_mkimage before do_install after do_compile
+
 kernel_do_deploy() {
 	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
 
-	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then 
-		if test -e arch/${ARCH}/boot/uImage ; then
-			cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-		elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then
-			${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-			rm -f linux.bin
-		else
-			${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
-			rm -f linux.bin.gz
-			gzip -9 linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-			rm -f linux.bin.gz
-		fi
-	fi
-
 	cd ${DEPLOYDIR}
 	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
 	ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin
Signature · 1 line
1.7.8.5
#10 lore raw

PATCH v2 2/2 kernel.bbclass: unify white spaces

* indentation was with spaces and tabs, unify to use tabs instead of spaces, for shell code and populate_packages_preppend, because "python populate_packages" expects tabs (or 8 spaces)
* and use 4 spaces for anonymous python

---
 meta/classes/kernel.bbclass |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
meta/classes/kernel.bbclass +13 -13
index 0ae9bed..cf060c6 100644
@@ -13,9 +13,9 @@ INITRAMFS_TASK ?= ""
 python __anonymous () {
     kerneltype = d.getVar('KERNEL_IMAGETYPE', True) or ''
     if kerneltype == 'uImage':
-    	depends = d.getVar("DEPENDS", True)
-    	depends = "%s u-boot-mkimage-native" % depends
-    	d.setVar("DEPENDS", depends)
+        depends = d.getVar("DEPENDS", True)
+        depends = "%s u-boot-mkimage-native" % depends
+        d.setVar("DEPENDS", depends)
 
     image = d.getVar('INITRAMFS_IMAGE', True)
     if image:
@@ -91,7 +91,7 @@ kernel_do_compile() {
 do_compile_kernelmodules() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
-		oe_runmake ${PARALLEL_MAKE} modules  CC="${KERNEL_CC}" LD="${KERNEL_LD}"
+		oe_runmake ${PARALLEL_MAKE} modules CC="${KERNEL_CC}" LD="${KERNEL_LD}"
 	else
 		bbnote "no modules to compile"
 	fi
@@ -115,7 +115,7 @@ kernel_do_install() {
 
 	#
 	# Install various kernel output (zImage, map file, config, module support files)
-	#	
+	#
 	install -d ${D}/${KERNEL_IMAGEDEST}
 	install -d ${D}/boot
 	install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
@@ -188,7 +188,7 @@ kernel_do_install() {
 	bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
 	           arch/powerpc/boot/mktree"
 	for entry in $bin_files; do
-	        rm -f $kerneldir/$entry
+		rm -f $kerneldir/$entry
 	done
 }
 
@@ -386,10 +386,10 @@ python populate_packages_prepend () {
 		return deps
 	
 	def get_dependencies(file, pattern, format):
-                # file no longer includes PKGD
+		# file no longer includes PKGD
 		file = file.replace(d.getVar('PKGD', True) or '', '', 1)
-                # instead is prefixed with /lib/modules/${KERNEL_VERSION}
-                file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
+		# instead is prefixed with /lib/modules/${KERNEL_VERSION}
+		file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
 
 		if module_deps.has_key(file):
 			import re
@@ -493,11 +493,11 @@ python populate_packages_prepend () {
 do_sizecheck() {
 	if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
 		size=`ls -l ${KERNEL_OUTPUT} | awk '{ print $5}'`
-        	if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
+		if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
 			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
+			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
 }
 
 addtask sizecheck before do_install after do_compile
Signature · 1 line
1.7.8.5
Acked-by on v2 1/2
#11 lore raw

Re: [PATCHv2 1/2] kernel.bbclass: merge uboot_mkimage improvements from meta-oe

In reply to Martin Jansa
Quoted 2 lines · Martin Jansa

* allows to detect ENTRYPOINT from kernel binary marked with UBOOT_ENTRYSYMBOL used e.g. by ben-nanonote

Nice to see the big benefit called out, definitely helps the casual reader :)

Looks like we've got all the use cases preserved, so I have no objections.

Cheers,

Bruce

Quoted 64 lines
---
  meta/classes/kernel.bbclass |   41 +++++++++++++++++++++++++----------------
  1 files changed, 25 insertions(+), 16 deletions(-)
meta/classes/kernel.bbclass +25 -16
index 3519e7c..0ae9bed 100644
@@ -507,28 +507,37 @@ KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME
  KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
  KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}"
 
+do_uboot_mkimage() {
+	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
+		if test ! -e arch/${ARCH}/boot/uImage ; then
+			ENTRYPOINT=${UBOOT_ENTRYPOINT}
+			if test -n "${UBOOT_ENTRYSYMBOL}"; then
+				ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
+					awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
+			fi
+			if test -e arch/${ARCH}/boot/compressed/vmlinux ; then
+				${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
+				uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage
+				rm -f linux.bin
+			else
+				${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
+				rm -f linux.bin.gz
+				gzip -9 linux.bin
+				uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage
+				rm -f linux.bin.gz
+			fi
+		fi
+	fi
+}
+
+addtask uboot_mkimage before do_install after do_compile
+
  kernel_do_deploy() {
  	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
 
-	if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
-		if test -e arch/${ARCH}/boot/uImage ; then
-			cp arch/${ARCH}/boot/uImage ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-		elif test -e arch/${ARCH}/boot/compressed/vmlinux ; then
-			${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C none -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-			rm -f linux.bin
-		else
-			${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin
-			rm -f linux.bin.gz
-			gzip -9 linux.bin
-			uboot-mkimage -A ${ARCH} -O linux -T kernel -C gzip -a ${UBOOT_ENTRYPOINT} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
-			rm -f linux.bin.gz
-		fi
-	fi
-
  	cd ${DEPLOYDIR}
  	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin
  	ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin
#12 lore raw
In reply to Martin Jansa
Quoted 8 lines · Martin Jansa

The following changes since commit 432e36300d7231c9b01cd2c6c4b39b84cf4fddca:

rpm: Ensure we depend on file (2012-03-28 18:40:20 +0100)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib jansa/kernel2
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=jansa/kernel2

Quoted 6 lines

Martin Jansa (2):
kernel.bbclass: merge uboot_mkimage improvements from meta-oe kernel.bbclass: unify white spaces

 meta/classes/kernel.bbclass |   67 ++++++++++++++++++++++++------------------
 1 files changed, 38 insertions(+), 29 deletions(-)

Can this go to master-next?

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
Applied
#13 lore raw
In reply to Martin Jansa
Quoted 8 lines · Martin Jansa

The following changes since commit 432e36300d7231c9b01cd2c6c4b39b84cf4fddca:

rpm: Ensure we depend on file (2012-03-28 18:40:20 +0100)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib jansa/kernel2
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=jansa/kernel2

Quoted 7 lines

Martin Jansa (2):
kernel.bbclass: merge uboot_mkimage improvements from meta-oe kernel.bbclass: unify white spaces

  meta/classes/kernel.bbclass |   67 ++++++++++++++++++++++++------------------
  1 files changed, 38 insertions(+), 29 deletions(-)

Merged into OE-Core

Thanks
Sau!