rename packages/ to recipes/ per earlier agreement
[vuplus_openembedded] / recipes / char-driver / char-driver.bb
1 # FIXME, consider using kernel staging directory instead of KERNEL_SOURCE which is
2 # located in the work directory. see module.bbclass
3
4 DESCRIPTION = "char-driver and userspace program"
5 PRIORITY = "optional"
6 SECTION = "base"
7 LICENSE = "GPL"
8 RDEPENDS = "kernel (${KERNEL_VERSION})"
9 DEPENDS = "virtual/kernel"
10
11 PR = "r3"
12
13 SRC_URI = "http://www.davehylands.com/gumstix-wiki/char-driver/char-driver-2.6.21.tar.gz \
14    file://makefile.patch;patch=1 \
15 #   file://sysctl.patch;patch=1 \
16    "
17
18 S = "${WORKDIR}/char-driver"
19
20 inherit module-base
21
22 addtask builddir after do_fetch before do_unpack
23 addtask movesrc after do_unpack before do_patch
24
25 EXTRA_OEMAKE = 'CROSS_COMPILE="${CROSS_COMPILE}" \
26                 KERNELDIR="${KERNEL_SOURCE}" \
27                 CC="${CC}" \
28                 '
29
30 PARALLEL_MAKE = ""
31
32 do_builddir () {
33    mkdir -p ${S}
34 }
35
36 do_movesrc () {
37    cd ${WORKDIR}
38    mv char-driver*.c sample.c char-driver*.h Makefile ${S}
39 }
40
41 do_configure () {
42         echo "Nothing to configure for char-driver"
43 }
44
45 do_compile () {
46    unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
47    cd ${S}   
48         oe_runmake
49 }
50
51 do_install () {
52    # install programs to bindir
53    install -m 0755 -d ${D}${bindir}
54         install -m 0755  ${S}/sample ${D}${bindir}
55
56    # kernel module installs with other modules
57    install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra/
58    # use cp instead of install so the driver doesn't get stripped
59    cp ${S}/char-driver.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra/
60 }
61
62 PACKAGES = "${PN}"
63 FILES_${PN} = "${bindir}/sample"
64 FILES_${PN} += "${base_libdir}/modules/${KERNEL_VERSION}/extra/char-driver.ko"
65