TS-7680 kernel compile guide: Difference between revisions

From embeddedTS Manuals
(Created page with "For adding new support to the kernel, or recompiling with more specific options you will need to have an x86 compatible Linux host available that can handle the cross compilin...")
 
m (Non-link text auto-updated for 2022 re-branding ( https://github.com/embeddedarm/linux-3.14.28-imx28.git →‎ https://github.com/embeddedTS/linux-3.14.28-imx28.git ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7680-linux/cross-toolchains/imx28-cross-glibc.tar.bz2 →‎ ftp://ftp.embeddedTS.com/ts-arm-sbc/ts-7680-linux/cross-toolchains/imx28-cross-glibc.tar.bz2))
 
(12 intermediate revisions by one other user not shown)
Line 2: Line 2:


''' Prerequisites '''
''' Prerequisites '''
All systems:
Download and unpack the cross compiler:
{{Note|The cross compiler set up in the [[#Cross_Compiling|Cross Compiling section]] is 64-bit and can be used instead of the 32-bit cross compiler below. If using the aforementioned compiler, it is not necessary to install the 32-bit compatibility libraries as is it for the 32-bit cross compiler on a 64-bit Debian Jessie installation.}}
<source lang=bash>
wget ftp://ftp.embeddedTS.com/ts-arm-sbc/ts-7680-linux/cross-toolchains/imx28-cross-glibc.tar.bz2
tar xvf imx28-cross-glibc.tar.bz2 -C /path/to/folder/
</source>
/path/to/folder can be any directory so long as the current user has permissions to write to it.  Remember this path as its used later during the kernel build procedure.


RHEL/Fedora/CentOS:
RHEL/Fedora/CentOS:
Line 8: Line 19:
yum groupinstall "Development Tools" "Development Libraries"
yum groupinstall "Development Tools" "Development Libraries"
</source>
</source>
Ubuntu/Debian:
Ubuntu/Debian:
<source lang=bash>
<source lang=bash>
sudo apt-get install build-essential libncurses5-dev libncursesw5-dev git
sudo apt-get install build-essential libncurses5-dev libncursesw5-dev git u-boot-tools
## If you are on a 64-bit system then 32-bit libraries will be required for the toolchain
</source>
# sudo apt-get install ia32-libs
 
 
If you are on a 64-bit system, then 32-bit libraries will be required for the toolchain, for newer Debian and Ubuntu distrubutions with Multiarch support, use the command:
<source lang=bash>
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6-dev:i386 zlib1g-dev:i386
</source>
 
On older distributions:
<source lang=bash>
sudo apt-get install ia32-libs
</source>
</source>


For other distributions, please refer to their documentation to find equivalent tools.
For other distributions, please refer to their documentation to find equivalent tools.


''' Download sources and configure '''
''' Download sources and configure '''


<source lang=bash>
<source lang=bash>
git clone https://github.com/embeddedarm/linux-2.6.35.3-imx28.git
git clone https://github.com/embeddedTS/linux-3.14.28-imx28.git
cd linux-2.6.35.3-imx28/
cd linux-3.14.28-imx28/
 
# These next commands set up some necessary environment variables
export ARCH=arm
export CROSS_COMPILE=/path/to/folder/arm-fsl-linux-gnueabi/bin/arm-linux-
# If using the 64-bit cross compiler from the Cross Compiling section, the following CROSS_COMPILE variable can be
# used if the environment PATH is set up properly:
# export CROSS_COMPILE=arm-linux-gnueabi-
export LOADADDR=0x40008000


# This sets up the default configuration that we ship with
# This sets up the default configuration that we ship with
make ts7680_defconfig
make ts76xx_defconfig
ln -sf initramfs.cpio-ts7680 initramfs.cpio
</source>
</source>


Line 41: Line 74:
make && make uImage && make modules
make && make uImage && make modules
</source>
</source>
We recommend running 'make' with the -jX argument, where X is the number of CPU cores+1 present on the build machine.  This will greatly increase build speed.


'''Build bootstream'''
'''Install the kernel/initramfs, headers, and modules '''
 
The i.MX28 utilizes what Freescale calls a "bootstream," this is a series of "bootlets" that are all put together in a binary blob.  The default bootstream sets up RAM, power, and contains the kernel to be run.  Every time a kernel is rebuilt, a new bootstream must be compiled containing the new kernel image. The following script is used to take the newly built kernel and output a bootstream for the SD card:
<source lang=bash>
./build_bootstream
</source>
 
This will create imx-bootlets-src-10.12.01/imx28_ivt_linux.sb The .sb file is the standard image used for the SD card and NAND.
 
'''Building External Wireless Modules'''
 
In order to support the wide range of USB wifi modules that Technologic Systems has offered over the years, the compat-wireless project is used to build all compatible modules.  A simple command is used to build them:
<source lang=bash>
./build_wireless
</source>
 
'''Install the bootstream (kernel/initramfs) and Modules '''


Next you need to install the kernel and modules to the SD card.  We provide a simple script to copy the kernel file, kernel modules, headers, and compat-wireless modules to the SD card to update everything at once.
Next you need to install the kernel and modules to the SD card.  We provide a simple script to copy the kernel uImage file, kernel modules, and headers to the SD card to update everything at once.


For example, if your workstation's SD card is /dev/mmcblk0:
For example, if your workstation's SD card is /dev/mmcblk0:

Latest revision as of 14:32, 18 January 2022

For adding new support to the kernel, or recompiling with more specific options you will need to have an x86 compatible Linux host available that can handle the cross compiling. Compiling the kernel on the board is not supported or recommended. Before building the kernel you will need to install a few support libraries on your workstation:

Prerequisites

All systems:

Download and unpack the cross compiler:

Note: The cross compiler set up in the Cross Compiling section is 64-bit and can be used instead of the 32-bit cross compiler below. If using the aforementioned compiler, it is not necessary to install the 32-bit compatibility libraries as is it for the 32-bit cross compiler on a 64-bit Debian Jessie installation.
wget ftp://ftp.embeddedTS.com/ts-arm-sbc/ts-7680-linux/cross-toolchains/imx28-cross-glibc.tar.bz2
tar xvf imx28-cross-glibc.tar.bz2 -C /path/to/folder/

/path/to/folder can be any directory so long as the current user has permissions to write to it. Remember this path as its used later during the kernel build procedure.


RHEL/Fedora/CentOS:

yum install ncurses-devel ncurses
yum groupinstall "Development Tools" "Development Libraries"


Ubuntu/Debian:

sudo apt-get install build-essential libncurses5-dev libncursesw5-dev git u-boot-tools


If you are on a 64-bit system, then 32-bit libraries will be required for the toolchain, for newer Debian and Ubuntu distrubutions with Multiarch support, use the command:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6-dev:i386 zlib1g-dev:i386

On older distributions:

sudo apt-get install ia32-libs


For other distributions, please refer to their documentation to find equivalent tools.


Download sources and configure

git clone https://github.com/embeddedTS/linux-3.14.28-imx28.git
cd linux-3.14.28-imx28/

# These next commands set up some necessary environment variables
export ARCH=arm
export CROSS_COMPILE=/path/to/folder/arm-fsl-linux-gnueabi/bin/arm-linux-
# If using the 64-bit cross compiler from the Cross Compiling section, the following CROSS_COMPILE variable can be
# used if the environment PATH is set up properly:
# export CROSS_COMPILE=arm-linux-gnueabi-
export LOADADDR=0x40008000

# This sets up the default configuration that we ship with
make ts76xx_defconfig

Once you have the configuration ready you can make your changes to the kernel. Commonly a reason for recompiling is to add support that was not built into the standard image's kernel. You can get a menu to browse available options by running:

make menuconfig

You can use the "/" key to search for specific terms through the kernel.

Build the kernel

Once you have it configured you can begin building the kernel. This usually takes about 5-10 minutes. This group of commands will also output a uImage file used by U-Boot on the TS-7680.

make && make uImage && make modules

We recommend running 'make' with the -jX argument, where X is the number of CPU cores+1 present on the build machine. This will greatly increase build speed.

Install the kernel/initramfs, headers, and modules

Next you need to install the kernel and modules to the SD card. We provide a simple script to copy the kernel uImage file, kernel modules, and headers to the SD card to update everything at once.

For example, if your workstation's SD card is /dev/mmcblk0:

./install_hdr_mod mmcblk0p2


If your workstation's SD card is /dev/sdc:

./install_hdr_mod sdc2