]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/multi-kernel.inc
cloud9-image: include CAN support
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / multi-kernel.inc
1 # This .inc file allows you to build and deploy multiple sets of kernel + modules with different defconfigs
2 #
3 # Note that this include will NOT stage anything nor create packages, since that is virtually impossible
4 # Userspace should be built against the 'regular' kernel
5 #
6 # The intended usecase is for machines that have mutually exclusive drivers due to e.g. pinmuxing issues.
7 # For example the LogicPD omap-l138 experimenter board can have multiple mutually exclusive expansion boards
8 # like lcd, ethernet, sound, 20x2 character LCD, etc. To be able to easily test all of those you can use this .inc
9 #
10 # To make it easier finding the original defconfig from a running kernel, this also forcefully turns on 
11 # CONFIG_IKCONFIG_PROC so people can do 'zcat /proc/config.gz' on the target.
13 require linux.inc
15 SRC_URI += " \
16            file://configs/* "
18 MULTI_CONFIG_BASE_SUFFIX = "multi-config-"
20 do_compileconfigs () {
22   # fixup for fetcher change
23   if [ -e ${WORKDIR}/configs/configs ] ; then
24       if [ -e ${WORKDIR}/configs/configs/empty ] ; then
25           mv ${WORKDIR}/configs/configs/empty ${WORKDIR}/configs/
26       fi
27       mv ${WORKDIR}/configs/configs/* ${WORKDIR}/configs/
28       rm -rf ${WORKDIR}/configs/configs
29   fi
31   # Compile and Install additional kernel configs if found
32   if [ -e ${WORKDIR}/configs/empty ] ; then
33        echo "No configs found in configs/ directory, skipping to regular build"
34   else
35       echo "Multiple configs found, building those first"
37       # Context Save the regular 'defconfig'
38       cp ${WORKDIR}/defconfig ${WORKDIR}/defconfig.save
40       for config in ${WORKDIR}/configs/* ; do
42         # Copy in alternative config
43         cd ${S}
44         cp $config ${WORKDIR}/defconfig
46         # Enable config to be viewed on the target
47         echo "CONFIG_IKCONFIG=y" >> ${WORKDIR}/defconfig
48         echo "CONFIG_IKCONFIG_PROC=y" >> ${WORKDIR}/defconfig
49         
50         # Build and Install this alternative kernel
51         do_configure
52         kernel_do_compile
53         do_compile_kernelmodules
54         kernel_do_install
56         # Drop the resulting images in the deploy dir
57         install -d ${DEPLOY_DIR_IMAGE}
58         install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
60         if [ -d "${D}/lib" ]; then
61             tar --owner=root --group=root -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz -C ${D} lib
62         fi
63  
64         # Install the final config alongside the images
65         cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
67         # Create symlinks
68         cd ${DEPLOY_DIR_IMAGE}
69         rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
70         ln -sf ${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
71         rm -f modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
72         ln -sf ${MODULES_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
73         rm -f config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
74         ln -sf config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
76       done
78       # Restore the regular 'defconfig'
79       cp ${WORKDIR}/defconfig.save ${WORKDIR}/defconfig
80     fi
81 }
83 # For reference, copy .config to deploy image
84 do_deploy_append () {
86         install -d ${DEPLOY_DIR_IMAGE}
88     # Drop the regular defconfig along side the others for consistency
89     cd ${S}
90     cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.config
92     # add symlink
93     cd ${DEPLOY_DIR_IMAGE}    
94     rm -f config-${MACHINE}.config
95     ln -s config-${PV}-${PR}-${MACHINE}.config config-${MACHINE}.config
97     rm -f modules-${MACHINE}.tgz
98     ln -sf ${MODULES_IMAGE_BASE_NAME}.tgz modules-${MACHINE}.tgz
102 do_compileconfigs[depends] += "u-boot-mkimage-native:do_populate_sysroot virtual/${TARGET_PREFIX}gcc:do_populate_sysroot virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX}:do_populate_sysroot"
103 addtask compileconfigs after do_patch before do_configure