diff options
author | Cliff Brake <cbrake@bec-systems.com> | 2007-04-23 21:42:22 +0000 |
---|---|---|
committer | Cliff Brake <cbrake@bec-systems.com> | 2007-04-23 21:42:22 +0000 |
commit | 48ae898759466084fd9c5907a263f9ae1ae2674a (patch) | |
tree | 6239344f33bd87ba218a187d233dbc50524beceb | |
parent | 4292d49584f53cf73d4631399e9bb02a1eef5cfa (diff) |
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.
-rw-r--r-- | packages/linux/compulab-pxa270_2.6.16.bb | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/packages/linux/compulab-pxa270_2.6.16.bb b/packages/linux/compulab-pxa270_2.6.16.bb index 6e09281546..043fc22777 100644 --- a/packages/linux/compulab-pxa270_2.6.16.bb +++ b/packages/linux/compulab-pxa270_2.6.16.bb @@ -1,7 +1,7 @@ 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" |