3b576e805934ce8f216a54bfa6a5f6b17396391e
[vuplus_openembedded] / packages / linux / compulab-pxa270_2.6.16.bb
1 SECTION = "kernel"
2 DESCRIPTION = "Linux kernel for the Compulab PXA270 system"
3 LICENSE = "GPL"
4 PR = "r6"
5
6 # Note, the compulab package contains a binary NAND driver that is not
7 # EABI compatible
8 # if you get a md5 sum error on x270-linux-drv.zip, compulab has probably
9 # changed the binary.  Remove it and the md5 file from your tmp directory, 
10 # and rebuild the kernel.  If you still get md5 failures, contact cbrake
11 # on the #oe IRC channel -- this recipe probably needs updated.
12
13 SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-2.6.16.tar.bz2 \
14            file://linux-2.6.16.patch;patch=1 \
15            file://defconfig \
16            http://www.compulab.co.il/x270/download/x270-linux-drv.zip;md5sum=05989295a5f99055c2f60f8b6f7abb6b"
17
18 S = "${WORKDIR}/linux-2.6.16"
19
20 COMPATIBLE_HOST = 'arm.*-linux'
21
22 inherit kernel
23 inherit package
24
25 ARCH = "arm"
26 KERNEL_IMAGETYPE = "zImage"
27
28 FILES_kernel-image = ""
29
30 do_configure_prepend() {
31         install -m 0644 ${WORKDIR}/defconfig ${S}/.config
32         install -m 0644 ${WORKDIR}/2.6.16/CL_FlashDrv ${S}/drivers/block/cl_flash
33 }
34
35 do_deploy() {
36         KNAME=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin
37         install -d ${DEPLOY_DIR_IMAGE}
38         install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${KNAME}
39 }
40
41 python do_compulab_image() {
42         import os
43         import os.path
44         import struct
45
46         deploy_dir = bb.data.getVar('DEPLOY_DIR_IMAGE', d, 1)
47         kernel_name = os.path.join(deploy_dir, bb.data.expand('${KERNEL_IMAGETYPE}-${MACHINE}.bin', d))
48
49         img_file = os.path.join(deploy_dir, 'zImage-compulab-pxa270.img')
50
51         fo = open(img_file, 'wb')
52
53         image_data = open(kernel_name, 'rb').read()
54
55         # first write size into first 4 bytes
56         size_s = struct.pack('i', len(image_data))
57
58         # truncate size if we are running on a 64-bit host
59         size_s = size_s[:4]
60
61         fo.write(size_s)
62         fo.write(image_data)
63         fo.close()
64 }
65
66
67 do_deploy[dirs] = "${S}"
68
69 addtask deploy before do_install after do_compile
70 addtask compulab_image before do_install after do_deploy
71
72 COMPATIBLE_MACHINE = "compulab-pxa270"
73