How To Compile the Mainline Linux Kernel v4.9 for TS-4900

embedded-linux-ts-board

Here’s a quick how-to guide straight from one of our engineers on how to compile the mainline Linux Kernel v4.9-rc1 and install it on the TS-4900. Support for the TS-4900 in the mainline kernel image (v4.9 and up) is a pretty big deal for us, and we’re excited about it. A big shout out to our friends at Savoir-faire Linux for their hard work in making this happen!

Step 1: Install the Toolchain

We need to install the toolchain from Ubuntu or Debian Jessie by running the following command:              Home

apt-get install gcc-arm-linux-gnueabihf build-essential lzop u-boot-tools libncursesw5-dev -y

Step 2: Clone the Kernel Git Repository:

We’ll now clone the kernel source code from the official Linux kernel Git repository and change directory into the cloned path.

git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git -b v4.9-rc1
cd linux

Step 3: Setup Build Environment Variables

We need to setup important environment variables so everything compiles appropriately for the TS-4900 ARM CPU and load address.

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export LOADADDR=0x10008000

Step 4: Grab Official TS-4900 Kernel Defconfig File

Next step is grabbing the defconfig file which defines what kernel features we need in order to get it working on the TS-4900. If you want to make any modifications to this, you can run make menuconfig before continuing to the compiling step.

wget ftp.embeddedTS.com/ftp/ts-socket-macrocontrollers/ts-4900-linux/sources/vanilla-rc1-defconfig -O .config

Step 5: Compile!

Now we’ll actually compile the kernel image using a fairly standard ‘make’ command.

make -j8 uImage

Step 6: Install

This next step comes directly from the “Compile the Kernel” section of the TS-4900 manual. Basically, we’ll be installing it to the microSD card, so you’ll need a microSD card reader and have the microSD card plugged in. Let’s assume your Linux rootfs is all on /dev/sdc1, and we’ll execute each of these commands in order. Replace /dev/sdc1 with your specific Linux rootfs after determining using fdisk -l.

export DEV=/dev/sdc1
sudo mount "$DEV" /mnt/sd
sudo rm /mnt/sd/boot/uImage
sudo cp arch/arm/boot/uImage /mnt/sd/boot/uImage
sudo cp arch/arm/boot/dts/imx6*ts*.dtb /mnt/sd/boot/
INSTALL_MOD_PATH="/mnt/sd" sudo -E make modules_install
INSTALL_HDR_PATH="/mnt/sd" sudo -E make headers_install
sudo umount /mnt/sd/
sync

Final Confirmation

After installing the microSD card into the TS-4900, power up the board to a command prompt. Execute the uname -a command to verify the kernel version.

Home

root@ts-imx6:~# uname -a
Linux ts-imx6 4.9.0-rc1 #7 SMP Tue Oct 18 08:45:39 MST 2016 armv7l GNU/Linux

5 thoughts on “How To Compile the Mainline Linux Kernel v4.9 for TS-4900”

  1. So what if I wanted to do the same thing for only a TS-7260? I’ve already compiled the kernel by replacing the proper deconf file and have copied the uImage file to my sdcard. Which dts files should I copy over? I did a search for “Technologic” and only found the dts file for the 4900.

  2. Wow – that was fast! – OK – I’m finding a lot of ways to get to what I’m trying to do. Thanks Derek.

    1. Sure thing! Good luck to you. My only other thought, which I’m sure you’re already aware of, is that the TS-7260 is quite old now. I might recommend looking at the TS-7250-V2, but I know our sales team would be much better at pairing the right system to your needs. 😉

  3. Hello…I see you have some very interesting info. here. I thank you for producing info. about Linux, kernel ideas, and giving me some pointers.

    If you know what type of machine from your company is good for producing kernel compilation, please reply.

    Seth

Leave a Reply

Your email address will not be published. Required fields are marked *