ti-local-power-manager : Build and Install Utilities, Remove Module.bbclass
authorRoger Monk <r-monk@ti.com>
Mon, 8 Feb 2010 15:41:58 +0000 (15:41 +0000)
committerKoen Kooi <koen@openembedded.org>
Mon, 12 Apr 2010 17:43:17 +0000 (19:43 +0200)
    * rebuild and install the utility modules (lpmOn/Off)
       * these are needed for non-codec-engine dsplink users
    * remove module.bbclass
       * this recipe builds kernel and userspace and doesn't currently utilise
       * replace with relevant module specific pieces (KERNEL_PR/DEPENDS/pre/postinst)
    * preparing scene for building complete lpm library
    * temporary generate config.bld for xdc build
       * may move this to separate recipe/package later
    * move SOC_FAMILY defines for LPM inside recipe

Signed-off-by: Roger Monk <r-monk@ti.com>
recipes/ti/ti-local-power-manager.inc
recipes/ti/ti-multimedia-common.inc

index 5cb304a..ece42ff 100644 (file)
@@ -1,23 +1,73 @@
 DESCRIPTION = "TI Local Power Manager (LPM)"
 HOMEPAGE = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm"
 
+# TODO : Hardcoded path to evm3530 - need to fix when adding omap24xx/dm6446 (other lpm targets)
+
 require ti-paths.inc
 require ti-staging.inc
 
 PROVIDES = "ti-lpm-module"
+PROVIDES += "ti-lpm-utils"
 
-inherit module
-
-#This is a kernel module, don't set PR directly
-MACHINE_KERNEL_PR_append = "b"
+# This package builds a kernel module, use kernel PR as base and append a local version
+PR = "${MACHINE_KERNEL_PR}"
+PR_append = "c"
 
 S = "${WORKDIR}/local_power_manager_linux_${PV}"
 
 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm/${PV}/exports/local_power_manager_linux_${PV}.tar.gz;name=lpmtarball"
 
-DEPENDS = "ti-dsplink-module"
+DEPENDS = "ti-dsplink-module ti-xdctools"
+DEPENDS += "virtual/kernel"
+
+# SOC_FAMILY configuration
+
+LPMDSPPOWERSOC_omap3  = "omap3530"
+LPMDSPPOWERSOC_dm6446 = "dm6446"
+LPMDSPPOWERSOC        ?= "<UNDEFINED_LPMDSPPOWERSOC>"
+
+do_configure () {
+
+    # Generate a config.bld for XDC
+
+    cat > ${S}/config.bld <<EOF
+
+/* Generated by ti-local-power-manager.inc OE recipe */
+
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+var GCArmv5T = xdc.useModule('gnu.targets.arm.GCArmv5T');
+GCArmv5T.LONGNAME = "bin/${TARGET_PREFIX}gcc";
+GCArmv5T.rootDir = "${TOOLCHAIN_PATH}";
+GCArmv5T.ccOpts.prefix += " -Wall -fno-strict-aliasing ";
+GCArmv5T.lnkOpts.suffix = GCArmv5T.lnkOpts.suffix.replace("-lstdc++", "");
+GCArmv5T.lnkOpts.suffix += " -lpthread ";
+GCArmv5T.platform = null;
+GCArmv5T.platforms = [
+    "${XDC_PLATFORM}"
+];
+
+/* remove profiles we don't use */
+delete GCArmv5T.profiles["coverage"];
+delete GCArmv5T.profiles["profile"];
+
+Build.targets.\$add(GCArmv5T);
+EOF
+
+}
+
+do_prepsources () {
+
+    # Prepare the tree for rebuiling - generate makefiles and clean
+    XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc .make -PR .
+    XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc clean -PR .
+}
+
+addtask prepsources after do_configure before do_compile
 
 do_compile () {
+
+    # Build the LPM kernel module
     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
     cd ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm
     make \
@@ -25,22 +75,50 @@ do_compile () {
       LINUXKERNEL_INSTALL_DIR="${STAGING_KERNEL_DIR}" \
       MVTOOL_PREFIX="${TARGET_PREFIX}" \
       clean default
+
+    # Build the user space library
+    # TODO
+
+    # Build the utilities (lpmON/OFF)
+    cd ${S}
+    XDCPATH=${S} ${XDC_INSTALL_DIR}/xdc -PR .
 }
 
+KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
+
 do_install () {
-# TODO install the apps and the scripts
 
+    # Install the kernel module 
     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
     install -m 0755 ${S}/packages/ti/bios/power/modules/${LPMDSPPOWERSOC}/lpm/*.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
-}
 
-do_stage() {
-    install -d ${LPM_INSTALL_DIR}
-    cp -pPrf ${S}/* ${LPM_INSTALL_DIR}
+    # Install the Utilities
+    install -d ${D}/${installdir}/ti-lpm-utils
+    install -m 0755 ${S}/packages/ti/bios/power/utils/bin/ti_platforms_evm3530/linux/release/* ${D}/${installdir}/ti-lpm-utils
+
+    # Install/Stage the Source Tree 
+    install -d ${D}${LPM_INSTALL_DIR_RECIPE}
+    cp -pPrf ${S}/* ${D}${LPM_INSTALL_DIR_RECIPE}
 }
 
-PACKAGES =+ "ti-lpm-module "
+PACKAGES += "ti-lpm-module"
 FILES_ti-lpm-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/*lpm*ko"
-RDEPENDS_ti-lpm-module += " ti-dsplink-module"
+RDEPENDS_ti-lpm-module += "ti-dsplink-module"
+RDEPENDS_ti-lpm-module += "update-modules"
+
+pkg_postinst_ti-lpm-module_append () {
+        if [ -n "$D" ]; then
+                exit 1
+        fi
+        depmod -a
+        update-modules || true
+}
+
+pkg_postrm_ti-lpm-module_append () {
+        update-modules || true
+}
 
-# TODO add " ti-lpm-apps/scripts" package as appropriate
+PACKAGES += "ti-lpm-utils"
+RDEPENDS_ti-lpm-utils += "ti-lpm-module"
+FILES_ti-lpm-utils = "${installdir}/ti-lpm-utils/*"
+INSANE_SKIP_ti-lpm-utils = True
index dab27a9..9f3da99 100644 (file)
@@ -61,10 +61,6 @@ export XDC_PLATFORM
 
 export PLATFORM_XDC = ${XDC_PLATFORM}
 
-LPMDSPPOWERSOC_omap3  = "omap3530"
-
-export LPMDSPPOWERSOC
-
 DSPSUFFIX_omapl137 = "x674"
 DSPSUFFIX_omapl138 = "x674"
 DSPSUFFIX ?= "x64P"