]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-bsp/linux/multi-kernel.inc
TI BSP: multi-kernel.inc: deploy can be empty, so make sure it exist before trying...
[glsdk/meta-ti-glsdk.git] / recipes-bsp / 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_append = " \
16            file://configs/ "
18 MULTI_CONFIG_BASE_SUFFIX = "multi-config-"
20 # bitbake.conf only prepends PARALLEL make in tasks called do_compile, which isn't the case for multiconfig
21 # So explicitly enable it for compileconfigs in here
22 EXTRA_OEMAKE = "${PARALLEL_MAKE} "
24 do_compileconfigs () {
26   # Compile and Install additional kernel configs if found
27   if [ -e ${WORKDIR}/configs/.empty ] ; then
28        echo "No configs found in configs/ directory, skipping to regular build"
29   else
30        echo "Multiple configs found, building those first"
32       # Context Save the regular 'defconfig'
33       cp ${WORKDIR}/defconfig ${WORKDIR}/defconfig.save
35       for config in ${WORKDIR}/configs/* ; do
37         # Copy in alternative config
38         cd ${S}
39         cp $config ${WORKDIR}/defconfig
41         # Enable config to be viewed on the target
42         echo "CONFIG_IKCONFIG=y" >> ${WORKDIR}/defconfig
43         echo "CONFIG_IKCONFIG_PROC=y" >> ${WORKDIR}/defconfig
44         
45         # Build and Install this alternative kernel
46         do_configure
47         kernel_do_compile
48         do_compile_kernelmodules
49         kernel_do_install
51         # Drop the resulting images in the deploy dir
52         install -d ${DEPLOY_DIR_IMAGE}
53         install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
55         if [ -d "${D}/lib" ]; then
56             fakeroot tar -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz -C ${D} lib
57         fi
58  
59         # Install the final config alongside the images
60         cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
62         # Create symlinks
63         cd ${DEPLOY_DIR_IMAGE}
64         rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
65         ln -sf ${KERNEL_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin ${KERNEL_IMAGE_SYMLINK_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).bin
66         rm -f modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
67         ln -sf ${MODULES_IMAGE_BASE_NAME}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz modules-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).tgz
68         rm -f config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
69         ln -sf config-${PV}-${PR}-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config config-${MACHINE}.${MULTI_CONFIG_BASE_SUFFIX}$(basename $config).config
71       done
73       # Restore the regular 'defconfig'
74       cp ${WORKDIR}/defconfig.save ${WORKDIR}/defconfig
75     fi
76 }
78 # For reference, copy .config to deploy image
79 do_deploy_append () {
81         install -d ${DEPLOY_DIR_IMAGE}
83     # Drop the regular defconfig along side the others for consistency
84     cd ${S}
85     cp .config ${DEPLOY_DIR_IMAGE}/config-${PV}-${PR}-${MACHINE}.config
87     # add symlink
88     cd ${DEPLOY_DIR_IMAGE}    
89     rm -f config-${MACHINE}.config
90     ln -s config-${PV}-${PR}-${MACHINE}.config config-${MACHINE}.config
92     rm -f modules-${MACHINE}.tgz
93     ln -sf ${MODULES_IMAGE_BASE_NAME}.tgz modules-${MACHINE}.tgz
95 }
97 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"
98 addtask compileconfigs after do_patch before do_configure