This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/EVMK2H: How to compile my own linux

Part Number: EVMK2H

Tool/software: Linux

I want to optimize my linux and reduce the boot up time, in order to do so, i want to compile my own linux, i believe downloading the latest SDK is the starting point, i can find some pre compiled images in the SDK as well, but how do i compile my own linux, with features and drivers i only require? Kindly answer with details, as i am new to it.

Best Regards

Sheraz Javaid

  • Hi,

    For K2H the instructions are as follows:
    export ARCH=arm
    export PATH=~/ti-processor-sdk-linux-k2hk-evm-04.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/:$PATH
    export CROSS_COMPILE=arm-linux-gnueabihf-

    make clean
    make tisdk_k2hk-evm_defconfig
    make -j4

    In order to use only the drivers you need you should modify the tisdk_k2hk-evm_defconfig file located in arch/arm/configs. You may also need to modify your dts: arch/arm/boot/dts/keystone-k2hk-evm.dts & keystone-k2hk.dtsi

    Best Regards,
    Yordan
  • Hi Yordon,
    Thanks for your reply, it was very easy to follow, please note that i am using the rt version, thus, i modified the export path and deconfig file name accordingly, when i issue the command make tisdk_k2hk-evm-rt_defconfig it says,

    make: *** No rule to make target `tisdk_k2hk-evm-rt_defconfig'. Stop.

    i checked the rules.make file, according to it

    #defconfig
    DEFCONFIG=tisdk_k2hk-evm-rt_defconfig

    and the file exists in the path you mentioned as well, any idea what i might be doing wrong?
  • Hi,

    Can you navigate to arch/arm/configs, execute ls -la and share the result?

    Best Regards,
    Yordan
  • Hi Yordon,

    Here are the results you asked for

    sheraz@sheraz-VirtualBox:/opt/ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b/arch/arm/configs$ ls -la
    total 832
    drwxr-xr-x 2 1001 1001 4096 Jun 28 16:56 .
    drwxr-xr-x 99 1001 1001 4096 Jun 28 16:43 ..
    -rw-r--r-- 1 1001 1001 1998 Jun 28 16:43 acs5k_defconfig
    -rw-r--r-- 1 1001 1001 2011 Jun 28 16:43 acs5k_tiny_defconfig
    -rw-r--r-- 1 1001 1001 2617 Jun 28 16:43 am200epdkit_defconfig
    -rw-r--r-- 1 1001 1001 2260 Jun 28 16:43 aspeed_g4_defconfig
    -rw-r--r-- 1 1001 1001 2308 Jun 28 16:43 aspeed_g5_defconfig
    -rw-r--r-- 1 1001 1001 1315 Jun 28 16:43 assabet_defconfig
    -rw-r--r-- 1 1001 1001 5400 Jun 28 16:43 at91_dt_defconfig
    -rw-r--r-- 1 1001 1001 5719 Jun 28 16:43 axm55xx_defconfig
    -rw-r--r-- 1 1001 1001 2573 Jun 28 16:43 badge4_defconfig
    -rw-r--r-- 1 1001 1001 3342 Jun 28 16:43 bcm2835_defconfig
    -rw-r--r-- 1 1001 1001 1659 Jun 28 16:43 cerfcube_defconfig
    -rw-r--r-- 1 1001 1001 2193 Jun 28 16:43 clps711x_defconfig
    -rw-r--r-- 1 1001 1001 4278 Jun 28 16:43 cm_x2xx_defconfig
    -rw-r--r-- 1 1001 1001 4160 Jun 28 16:43 cm_x300_defconfig
    -rw-r--r-- 1 1001 1001 1908 Jun 28 16:43 cns3420vb_defconfig
    -rw-r--r-- 1 1001 1001 3984 Jun 28 16:43 colibri_pxa270_defconfig
    -rw-r--r-- 1 1001 1001 1656 Jun 28 16:43 colibri_pxa300_defconfig
    -rw-r--r-- 1 1001 1001 2319 Jun 28 16:43 collie_defconfig
    -rw-r--r-- 1 1001 1001 6136 Jun 28 16:43 corgi_defconfig
    -rw-r--r-- 1 1001 1001 5580 Jun 28 16:43 davinci_all_defconfig
    -rw-r--r-- 1 1001 1001 3230 Jun 28 16:43 dove_defconfig
    -rw-r--r-- 1 1001 1001 28 Jun 28 16:43 dram_0x00000000.config
    -rw-r--r-- 1 1001 1001 1657 Jun 28 16:43 ebsa110_defconfig
    -rw-r--r-- 1 1001 1001 2848 Jun 28 16:43 efm32_defconfig
    -rw-r--r-- 1 1001 1001 4409 Jun 28 16:43 em_x270_defconfig
    -rw-r--r-- 1 1001 1001 3088 Jun 28 16:43 ep93xx_defconfig
    -rw-r--r-- 1 1001 1001 2794 Jun 28 16:43 eseries_pxa_defconfig
    -rw-r--r-- 1 1001 1001 6394 Jun 28 16:43 exynos_defconfig
    -rw-r--r-- 1 1001 1001 10605 Jun 28 16:43 ezx_defconfig
    -rw-r--r-- 1 1001 1001 2520 Jun 28 16:43 footbridge_defconfig
    -rw-r--r-- 1 1001 1001 1529 Jun 28 16:43 h3600_defconfig
    -rw-r--r-- 1 1001 1001 2015 Jun 28 16:43 h5000_defconfig
    -rw-r--r-- 1 1001 1001 1113 Jun 28 16:43 hackkit_defconfig
    -rw-r--r-- 1 1001 1001 1966 Jun 28 16:43 hisi_defconfig
    -rw-r--r-- 1 1001 1001 9953 Jun 28 16:43 imote2_defconfig
    -rw-r--r-- 1 1001 1001 4328 Jun 28 16:43 imx_v4_v5_defconfig
    -rw-r--r-- 1 1001 1001 9156 Jun 28 16:43 imx_v6_v7_defconfig
    -rw-r--r-- 1 1001 1001 1874 Jun 28 16:43 integrator_defconfig
    -rw-r--r-- 1 1001 1001 2838 Jun 28 16:43 iop13xx_defconfig
    -rw-r--r-- 1 1001 1001 3030 Jun 28 16:43 iop32x_defconfig
    -rw-r--r-- 1 1001 1001 2183 Jun 28 16:43 iop33x_defconfig
    -rw-r--r-- 1 1001 1001 4452 Jun 28 16:43 ixp4xx_defconfig
    -rw-r--r-- 1 1001 1001 2745 Jun 28 16:43 jornada720_defconfig
    -rw-r--r-- 1 1001 1001 4943 Jun 28 16:43 keystone_defconfig
    -rw-r--r-- 1 1001 1001 1769 Jun 28 16:43 ks8695_defconfig
    -rw-r--r-- 1 1001 1001 1513 Jun 28 16:43 lart_defconfig
    -rw-r--r-- 1 1001 1001 4586 Jun 28 16:43 lpc18xx_defconfig
    -rw-r--r-- 1 1001 1001 4957 Jun 28 16:43 lpc32xx_defconfig
    -rw-r--r-- 1 1001 1001 1482 Jun 28 16:43 lpd270_defconfig
    -rw-r--r-- 1 1001 1001 1226 Jun 28 16:43 lubbock_defconfig
    -rw-r--r-- 1 1001 1001 4158 Jun 28 16:43 magician_defconfig
    -rw-r--r-- 1 1001 1001 1199 Jun 28 16:43 mainstone_defconfig
    -rw-r--r-- 1 1001 1001 8818 Jun 28 16:43 mini2440_defconfig
    -rw-r--r-- 1 1001 1001 2467 Jun 28 16:43 mmp2_defconfig
    -rw-r--r-- 1 1001 1001 3942 Jun 28 16:43 moxart_defconfig
    -rw-r--r-- 1 1001 1001 3036 Jun 28 16:43 mps2_defconfig
    -rw-r--r-- 1 1001 1001 2395 Jun 28 16:43 multi_v4t_defconfig
    -rw-r--r-- 1 1001 1001 6393 Jun 28 16:43 multi_v5_defconfig
    -rw-r--r-- 1 1001 1001 21737 Jun 28 16:43 multi_v7_defconfig
    -rw-r--r-- 1 1001 1001 3226 Jun 28 16:43 mv78xx0_defconfig
    -rw-r--r-- 1 1001 1001 4746 Jun 28 16:43 mvebu_v5_defconfig
    -rw-r--r-- 1 1001 1001 3385 Jun 28 16:43 mvebu_v7_defconfig
    -rw-r--r-- 1 1001 1001 4197 Jun 28 16:43 mxs_defconfig
    -rw-r--r-- 1 1001 1001 2059 Jun 28 16:43 neponset_defconfig
    -rw-r--r-- 1 1001 1001 1773 Jun 28 16:43 netwinder_defconfig
    -rw-r--r-- 1 1001 1001 1829 Jun 28 16:43 netx_defconfig
    -rw-r--r-- 1 1001 1001 2978 Jun 28 16:43 nhk8815_defconfig
    -rw-r--r-- 1 1001 1001 1559 Jun 28 16:43 nuc910_defconfig
    -rw-r--r-- 1 1001 1001 1953 Jun 28 16:43 nuc950_defconfig
    -rw-r--r-- 1 1001 1001 1702 Jun 28 16:43 nuc960_defconfig
    -rw-r--r-- 1 1001 1001 6026 Jun 28 16:43 omap1_defconfig
    -rw-r--r-- 1 1001 1001 11541 Jun 28 16:43 omap2plus_defconfig
    -rw-r--r-- 1 1001 1001 3912 Jun 28 16:43 orion5x_defconfig
    -rw-r--r-- 1 1001 1001 2090 Jun 28 16:43 palmz72_defconfig
    -rw-r--r-- 1 1001 1001 2415 Jun 28 16:43 pcm027_defconfig
    -rw-r--r-- 1 1001 1001 1374 Jun 28 16:43 pleb_defconfig
    -rw-r--r-- 1 1001 1001 1599 Jun 28 16:43 prima2_defconfig
    -rw-r--r-- 1 1001 1001 1835 Jun 28 16:43 pxa168_defconfig
    -rw-r--r-- 1 1001 1001 1289 Jun 28 16:43 pxa255-idp_defconfig
    -rw-r--r-- 1 1001 1001 3409 Jun 28 16:43 pxa3xx_defconfig
    -rw-r--r-- 1 1001 1001 2034 Jun 28 16:43 pxa910_defconfig
    -rw-r--r-- 1 1001 1001 17973 Jun 28 16:43 pxa_defconfig
    -rw-r--r-- 1 1001 1001 4446 Jun 28 16:43 qcom_defconfig
    -rw-r--r-- 1 1001 1001 4780 Jun 28 16:43 raumfeld_defconfig
    -rw-r--r-- 1 1001 1001 2459 Jun 28 16:43 realview_defconfig
    -rw-r--r-- 1 1001 1001 3146 Jun 28 16:43 rpc_defconfig
    -rw-r--r-- 1 1001 1001 11245 Jun 28 16:43 s3c2410_defconfig
    -rw-r--r-- 1 1001 1001 2244 Jun 28 16:43 s3c6400_defconfig
    -rw-r--r-- 1 1001 1001 1811 Jun 28 16:43 s5pv210_defconfig
    -rw-r--r-- 1 1001 1001 5652 Jun 28 16:43 sama5_defconfig
    -rw-r--r-- 1 1001 1001 1041 Jun 28 16:43 shannon_defconfig
    -rw-r--r-- 1 1001 1001 5106 Jun 28 16:43 shmobile_defconfig
    -rw-r--r-- 1 1001 1001 2433 Jun 28 16:43 simpad_defconfig
    -rw-r--r-- 1 1001 1001 2671 Jun 28 16:43 socfpga_defconfig
    -rw-r--r-- 1 1001 1001 2573 Jun 28 16:43 spear13xx_defconfig
    -rw-r--r-- 1 1001 1001 2150 Jun 28 16:43 spear3xx_defconfig
    -rw-r--r-- 1 1001 1001 1901 Jun 28 16:43 spear6xx_defconfig
    -rw-r--r-- 1 1001 1001 6224 Jun 28 16:43 spitz_defconfig
    -rw-r--r-- 1 1001 1001 1921 Jun 28 16:43 stm32_defconfig
    -rw-r--r-- 1 1001 1001 3606 Jun 28 16:43 sunxi_defconfig
    -rw-r--r-- 1 1001 1001 1744 Jun 28 16:43 tct_hammer_defconfig
    -rw-r--r-- 1 1001 1001 6983 Jun 28 16:43 tegra_defconfig
    -rw-r--r-- 1 1001 1001 140309 Jun 28 16:56 tisdk_k2hk-evm-rt_defconfig
    -rw------- 1 1001 1001 43975 Jun 28 16:55 ti_sdk_keystone_rt_release_defconfig
    -rw-r--r-- 1 1001 1001 4936 Jun 28 16:43 trizeps4_defconfig
    -rw-r--r-- 1 1001 1001 1853 Jun 28 16:43 u300_defconfig
    -rw-r--r-- 1 1001 1001 3303 Jun 28 16:43 u8500_defconfig
    -rw-r--r-- 1 1001 1001 1993 Jun 28 16:43 versatile_defconfig
    -rw-r--r-- 1 1001 1001 3663 Jun 28 16:43 vexpress_defconfig
    -rw-r--r-- 1 1001 1001 1177 Jun 28 16:43 vf610m4_defconfig
    -rw-r--r-- 1 1001 1001 4064 Jun 28 16:43 viper_defconfig
    -rw-r--r-- 1 1001 1001 2059 Jun 28 16:43 vt8500_v6_v7_defconfig
    -rw-r--r-- 1 1001 1001 2542 Jun 28 16:43 xcep_defconfig
    -rw-r--r-- 1 1001 1001 4379 Jun 28 16:43 zeus_defconfig
    -rw-r--r-- 1 1001 1001 2904 Jun 28 16:43 zx_defconfig
    sheraz@sheraz-VirtualBox:/opt/ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b/arch/arm/configs$
  • Ok, one more thing I forgot to mention in my response with the steps for compiling linux kernel. From which folder do you execute make tisdk_k2hk-evm-rt_defconfig?

    You should navigate to ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b first. So the steps are:
    cd /opt/ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b/
    export ARCH=arm
    export PATH=~/ti-processor-sdk-linux-k2hk-evm-04.00.00.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/:$PATH
    export CROSS_COMPILE=arm-linux-gnueabihf-

    make clean
    make tisdk_k2hk-evm-rt_defconfig
    make -j4

    Best Regards,
    Yordan
  • Initially i was executing make tisdk_k2hk-evm-rt_defconfig from ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04 folder, where i received
    make: *** No rule to make target `tisdk_k2hk-evm-rt_defconfig'. Stop. error,

    but the make clean command was working fine,

    now that i have navigated to the directory you mentioned, and following the steps, neither make clean works, nor the make deconfig.



    when i make clean



    sheraz@sheraz-VirtualBox:/opt/ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b$ make clean
    ./scripts/gcc-version.sh: line 25: arm-linux-gnueabihf-gcc: command not found
    ./scripts/gcc-version.sh: line 26: arm-linux-gnueabihf-gcc: command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    ./scripts/gcc-version.sh: line 25: arm-linux-gnueabihf-gcc: command not found
    ./scripts/gcc-version.sh: line 26: arm-linux-gnueabihf-gcc: command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    ./scripts/gcc-version.sh: line 25: arm-linux-gnueabihf-gcc: command not found
    ./scripts/gcc-version.sh: line 26: arm-linux-gnueabihf-gcc: command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found
    make: arm-linux-gnueabihf-gcc: Command not found



    and when i execute make tisdk_k2hk-evm-rt_defconfig:

    sheraz@sheraz-VirtualBox:/opt/ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b$ make tisdk_k2hk-evm-rt_defconfig
    HOSTCC scripts/basic/fixdep
    scripts/basic/fixdep.c:449:1: fatal error: opening dependency file scripts/basic/.fixdep.d: Permission denied
    }
    ^
    compilation terminated.
    make[1]: *** [scripts/basic/fixdep] Error 1
    make: *** [scripts_basic] Error 2
    sheraz@sheraz-VirtualBox:/opt/ti-processor-sdk-linux-rt-k2hk-evm-04.00.00.04/board-support/linux-rt-4.9.28+gitAUTOINC+786e64041b-g786e64041b$
  • You've installed your sdk in /opt folder of your machine. We recommend installing the sources in your home folder:
    processors.wiki.ti.com/.../Processor_SDK_Linux_Installer

    Since you're running from /opt you must make sure you're logged in as root, so that you don't get:
    sripts/basic/fixdep.c:449:1: fatal error: opening dependency file scripts/basic/.fixdep.d: Permission denied

    Also I see you're getting:
    make: arm-linux-gnueabihf-gcc: Command not found

    Please navigate to linux-devkit/sysroots/x86_64-arago-linux/usr/bin/ and see which cross compiler is used, it is possible that for the RT release the toolchain prefix deviates from arm-linux-gnueabihf-, see what is used & correct your CROSS_COMPILE exports. It is also possible that you get the " Command not found" error, because you don't have permission to linux-devkit/sysroots/x86_64-arago-linux/usr/bin/, because you're NOT logged in as root.

    As I said, I'd recommend following the installer defaults & install the sources in your $HOME directory, as described here:
    processors.wiki.ti.com/.../Processor_SDK_Linux_Installer

    Best Regards,
    Yordan
  • Hi Yordon
    Installing the sdk in home directory resolved both of the issues, i have a few more questions as well, where is the newly compiled linux located? also, what are the the output files of the above process? I understand that i need .ubi and .gph files to port my OS into the board, does this process output the .ubi and .gph files or i need some extra effort to create the .ubi and .gph images.
  • Hi,

    i have a few more questions as well, where is the newly compiled linux located? also, what are the the output files of the above process?

    The kernel image is arch/arm/boot/zImage, the corresponding .dtb file is located in arch/arm/boot/dts/

    I understand that i need .ubi and .gph files to port my OS into the board, does this process output the .ubi and .gph files or i need some extra effort to create the .ubi and .gph images.

    The .gph is u-boot image. You need to rebuild your u-boot if you want to modify it.
    The .ubi ima is the filesystem. I don't think you'll need to change the file system. What I do is use the prebuild ubi image to flash my rootfs partition. Then I log on the board & replace the zImage & keystone-k2hk-evm.dtb, which are located in /boot. This is enough to use your customized linux kernel.

    If you want to rebuild your filesystem, you can follow this wiki:
    processors.wiki.ti.com/.../Processor_SDK_Building_The_SDK
    This builds your sysfs. After compilation is complete & you have your filesystem, you need to ubinize it:
    processors.wiki.ti.com/.../Linux_Core_NAND_User's_Guide

    Best Regards,
    Yordan
  • Hi Yordon,
    I looked into the link
    processors.wiki.ti.com/.../Linux_Core_NAND_User's_Guide

    However it does not state the .config file settings specifically for k2h board, it only mentions about k2e and k2l, which settings i am supposed to use?
    Best Regards
    Sheraz Javaid
  • Hi Yordon,
    I am confused now, I am very new to all of this, thus i am still trying to figure out how all of this actually works. Currently i am using linux 3.10.72-rt version, I never had to change the OS, but now i have to, since i am using a newer sdk, and a different kernel version, i believe i should generate my own file system and .gph files.
    I already have generated the zImage and .dtb file, as per your guidance above. What steps should i follow now to have a new .ubi and uboot images?
    Can i use the .gph file provided in the prebuilt images directory in the SDK? If no, Kindly guide me how to rebuild it.

    The link you provided me, to rebuild my file system and ubinize it, is pretty confusing, it would be great, if you can provide me with the exact steps, like you mentioned for compiling the kernel.

    Best Regards
    Sheraz Javaid