[oe-commits] org.oe.dev compulab-pxa270 2.6.16: add task to create a kernel image file.

cbrake commit openembedded-commits at lists.openembedded.org
Mon Apr 23 21:53:01 UTC 2007


compulab-pxa270 2.6.16: add task to create a kernel image file.
The cm-x270 bootloader requires kernel image files in a special
format and this addition adds that.

Author: cbrake at openembedded.org
Branch: org.openembedded.dev
Revision: 08f3e67da9f900288d552eba8842531d6ca225d0
ViewMTN: http://monotone.openembedded.org/revision.psp?id=08f3e67da9f900288d552eba8842531d6ca225d0
Files:
1
packages/linux/compulab-pxa270_2.6.16.bb
Diffs:

#
# mt diff -rd0de2c6b30e2b66758bb03e1bca02e39362b0a18 -r08f3e67da9f900288d552eba8842531d6ca225d0
#
# 
# 
# patch "packages/linux/compulab-pxa270_2.6.16.bb"
#  from [1b36f665982ec12f080f168061849198c405cfdd]
#    to [14edb6a24ca428f066e5090a5a593ddd38be2f97]
# 
============================================================
--- packages/linux/compulab-pxa270_2.6.16.bb	1b36f665982ec12f080f168061849198c405cfdd
+++ packages/linux/compulab-pxa270_2.6.16.bb	14edb6a24ca428f066e5090a5a593ddd38be2f97
@@ -1,7 +1,7 @@ LICENSE = "GPL"
 SECTION = "kernel"
 DESCRIPTION = "Linux kernel for the Compulab PXA270 system"
 LICENSE = "GPL"
-PR = "r3"
+PR = "r4"
 
 # Note, the compulab package contains a binary NAND driver that is not
 # EABI compatible
@@ -32,25 +32,38 @@ do_deploy() {
 	KNAME=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin
         install -d ${DEPLOY_DIR_IMAGE}
         install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${KNAME}
-	# Create an image file that has the size prepended (used by cm-x270 BL)
-	# The following can only be done on a little endian machine
-	# the following does not work on all computers as it requires a recent
-	# version of coreutils (>= 6.0).  We will eventually replace the following
-	# with python code.
-	#size=$(stat --printf=%s ${KNAME})
-	#size_=$(printf '\%03o'\
-	#$((size & 0x000000FF))\
-	#$((size>>8 & 0x000000FF))\
-	#$((size>>16 & 0x000000FF))\
-	#$((size>>24 & 0x000000FF)))
-	#size_=${size_}'\c'
-	#echo -e $size_ > ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}-${DATETIME}.img
-	#cat ${KNAME} >> ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}-${DATETIME}.img
 }
 
+python do_compulab_image() {
+	import os
+	import os.path
+	import struct
+
+	deploy_dir = bb.data.getVar('DEPLOY_DIR_IMAGE', d, 1)
+	kernel_name = os.path.join(deploy_dir, bb.data.expand('${KERNEL_IMAGETYPE}-${MACHINE}.bin', d))
+
+	img_file = os.path.join(deploy_dir, 'zImage-compulab-pxa270.img')
+
+	fo = open(img_file, 'wb')
+
+	image_data = open(kernel_name, 'rb').read()
+
+	# first write size into first 4 bytes
+	size_s = struct.pack('i', len(image_data))
+
+	# truncate size if we are running on a 64-bit host
+	size_s = size_s[:4]
+
+	fo.write(size_s)
+	fo.write(image_data)
+	fo.close()
+}
+
+
 do_deploy[dirs] = "${S}"
 
 addtask deploy before do_build after do_compile
+addtask compulab_image before do_build after do_deploy
 
 COMPATIBLE_MACHINE = "compulab-pxa270"
 






More information about the Openembedded-commits mailing list