]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/multi-kernel.inc
ti814x.inc: Use '+=' not '?=' in IMAGE_FSTYPES
[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-"
19 MODULES_IMAGE_BASE_NAME = "modules-${PV}-${PR}-${MACHINE}"
21 do_preparekernel () {
22         unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
23         oe_runmake prepare CC="${KERNEL_CC}" LD="${KERNEL_LD}"
24 }
26 addtask preparekernel after do_configure before do_compile
28 do_compileconfigs () {
30   # fixup for fetcher change
31   if [ -e ${WORKDIR}/configs/configs ] ; then
32       if [ -e ${WORKDIR}/configs/configs/empty ] ; then
33           mv ${WORKDIR}/configs/configs/empty ${WORKDIR}/configs/
34       fi
35       mv ${WORKDIR}/configs/configs/* ${WORKDIR}/configs/
36       rm -rf ${WORKDIR}/configs/configs
37   fi
39   # Compile and Install additional kernel configs if found
40   if [ -e ${WORKDIR}/configs/empty ] ; then
41        echo "No configs found in configs/ directory, skipping to regular build"
42   else
43       echo "Multiple configs found, building those first"
45       # Context Save the regular 'defconfig'
46       cp ${WORKDIR}/defconfig ${WORKDIR}/defconfig.save
48       for config in ${WORKDIR}/configs/* ; do
50         # Copy in alternative config
51         cd ${S}
52         cp $config ${WORKDIR}/defconfig
54         # Enable config to be viewed on the target
55         echo "CONFIG_IKCONFIG=y" >> ${WORKDIR}/defconfig
56         echo "CONFIG_IKCONFIG_PROC=y" >> ${WORKDIR}/defconfig
57         
58         # Build and Install this alternative kernel
59         do_configure
60         kernel_do_compile
61         do_compile_kernelmodules
62         kernel_do_install
64         # Drop the resulting images in the deploy dir
65         install -d ${DEPLOY_DIR_IMAGE}
66         install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
68         if [ -d "${D}/lib" ]; then
69             tar --owner=root --group=root -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz -C ${D} lib
70         fi
71  
72         # Install the final config alongside the images
73         cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
75         # Create symlinks
76         cd ${DEPLOY_DIR_IMAGE}
77         rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
78         ln -sf ${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
79         rm -f modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
80         ln -sf ${MODULES_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
81         rm -f config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
82         ln -sf config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
84       done
86       # Restore the regular 'defconfig'
87       cp ${WORKDIR}/defconfig.save ${WORKDIR}/defconfig
88     fi
89 }
91 # For reference, copy .config to deploy image
92 do_deploy_append () {
94         install -d ${DEPLOY_DIR_IMAGE}
96     # Drop the regular defconfig along side the others for consistency
97     cd ${S}
98     cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.config
100     # add symlink
101     cd ${DEPLOY_DIR_IMAGE}    
102     rm -f config-${MACHINE}.config
103     ln -s config-${PV}-${PR}-${MACHINE}.config config-${MACHINE}.config
105     rm -f modules-${MACHINE}.tgz
106     ln -sf ${MODULES_IMAGE_BASE_NAME}.tgz modules-${MACHINE}.tgz
110 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"
111 addtask compileconfigs after do_preparekernel before do_compile