TS-47xx Kernel Compile Guide: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Non-link text auto-updated for 2022 re-branding ( ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4700-linux/cross-toolchains/arm-2008q3.tar.gz →‎ ftp://ftp.embeddedTS.com/ts-socket-macrocontrollers/ts-4700-linux/cross-toolchains/arm-2008q3.tar.gz https://github.com/embeddedarm/linux-2.6.34-ts471x.git →‎ https://github.com/embeddedTS/linux-2.6.34-ts471x.git))
 
(10 intermediate revisions by one other user not shown)
Line 10: Line 10:
Ubuntu/Debian:
Ubuntu/Debian:
<source lang=bash>
<source lang=bash>
apt-get install build-essential libncurses5-dev libncursesw5-dev git
sudo apt-get install build-essential libncurses5-dev libncursesw5-dev git
## If you are on a 64-bit system then 32-bit libraries will be required for the toolchain
# sudo apt-get install ia32-libs
# On newer distributions with Multiarch support:
#sudo dpkg --add-architecture i386
#sudo apt-get update
#sudo apt-get install libc6-dev:i386 zlib1g-dev:i386
</source>
</source>


Line 19: Line 25:
<source lang=bash>
<source lang=bash>
# Download the cross compile toolchain (EABI)from Technologic Systems:
# Download the cross compile toolchain (EABI)from Technologic Systems:
wget ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4700-linux/cross-toolchains/arm-2008q3.tar.gz
wget ftp://ftp.embeddedTS.com/ts-socket-macrocontrollers/ts-4700-linux/cross-toolchains/arm-2008q3.tar.gz


# Extract the toolchain
# Extract the toolchain
Line 29: Line 35:


# Download the Kernel sources
# Download the Kernel sources
git clone https://github.com/embeddedarm/linux-2.6.34-ts471x.git
git clone https://github.com/embeddedTS/linux-2.6.34-ts471x.git


cd linux-2.6.34-ts471x
cd linux-2.6.34-ts471x
Line 41: Line 47:
</source>
</source>


This will bring up a graphical menu where you can edit the configuration to include support for new devicesFor Example, to include support for a Prolific USB to serial adapter you would go to 'Device Drivers -> USB Support-> USB Serial Support' and then select 'USB Prolific 2303 Single Port Serial Driver'.  Since the kernel only has a limited space, build drivers as modules whenever possible.
Once you have the configuration ready you can make your changes to the kernelCommonly a reason for recompiling is to add support that was not built into the standard image's kernelYou can get a menu to browse available options by running:
 
<source lang=bash>
<source lang=bash>
make menuconfig
make menuconfig
</source>
</source>
You can use the "/" key to search for specific terms through the kernel.


'''Build the kernel'''
'''Build the kernel'''


Once you have it configured, start building.  This usually takes about 5-10 minutes.
Once you have it configured you can begin building the kernel.  This usually takes about 5-10 minutes.
<source lang=bash>
<source lang=bash>
make
make
Line 58: Line 65:
'''Install the Kernel and Modules '''
'''Install the Kernel and Modules '''


Install the target SD card in your workstation, and mount the Debian partition.  For example, if your workstation's SD card is /dev/mmcblk0:
Install the target SD card in your workstation, and mount the Debian partition.  For example, if your workstation's SD card is /dev/sdb:
<source lang=bash>
# Update this to point to your SD card block device
export DEV=/dev/sdb
sudo mkdir /mnt/sd/
sudo dd if=arch/arm/boot/zImage of="$DEV"1 conv=fsync
sudo mount "$DEV"2 /mnt/sd/
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
</source>
 
''' Build compat-drivers (optional) '''
 
Optionally if you use the WIFI-N-USB2 module or another recent USB wireless device you can build "compat-drivers" which provides more recent compatibility on this kernel.
<source lang=bash>
<source lang=bash>
mkdir /mnt/sd/
# Assuming you are still in the 2.6.34 kernel directory
mount /dev/mmcblk0p2 /mnt/sd/
cd ../
INSTALL_MOD_PATH=/mnt/sd/ make modules_install
export ARCH=arm
export CROSS_COMPILE=/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-


## If you use sudo, you can use -E to retain your environment flags.
# Update this to point to your SD card block device
#INSTALL_MOD_PATH=/mnt/sd/ sudo -E make modules_install
export DEV=/dev/sdb
export KLIB=/mnt/sd
# Update these paths to point to the linux tree
export KLIB_BUILD=../linux-2.6.34-ts471x/


# To install the updated kernel:
wget http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.8.3/compat-drivers-3.8.3-2-snpu.tar.bz2 && \
dd if=arch/arm/boot/Image of=/dev/mmcblk0p1
tar xf compat-drivers-3.8.3-2-snpu.tar.bz2 && \
cd compat-drivers-3.8.3-2-snpu/ && \
make && \
sudo mount "$DEV"2 /mnt/sd/ && \
INSTALL_MOD_PATH=/mnt/sd/ sudo -E make install-modules && \
sudo umount /mnt/sd/ && \
sync
</source>
</source>

Latest revision as of 14:22, 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

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
## If you are on a 64-bit system then 32-bit libraries will be required for the toolchain
# sudo apt-get install ia32-libs
# On newer distributions with Multiarch support:
#sudo dpkg --add-architecture i386
#sudo apt-get update
#sudo apt-get install libc6-dev:i386 zlib1g-dev:i386

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

Set up the Sources and Toolchain

# Download the cross compile toolchain (EABI)from Technologic Systems:
wget ftp://ftp.embeddedTS.com/ts-socket-macrocontrollers/ts-4700-linux/cross-toolchains/arm-2008q3.tar.gz

# Extract the toolchain
tar xvf arm-2008q3.tar.gz

# Move arm-2008q3 to a permanent location, eg /opt/toolchains/
mkdir /opt/toolchains/
mv arm-2008q3 /opt/toolchains/

# Download the Kernel sources
git clone https://github.com/embeddedTS/linux-2.6.34-ts471x.git

cd linux-2.6.34-ts471x

# Set the CROSS_COMPILE variable to the absolute path to the toolchain.
export CROSS_COMPILE=/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-
export ARCH=arm

# This sets up the default configuration that we ship with for the TS-471x
make ts471x_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.

make

The new kernel will be at "arch/arm/boot/Image".

Install the Kernel and Modules

Install the target SD card in your workstation, and mount the Debian partition. For example, if your workstation's SD card is /dev/sdb:

# Update this to point to your SD card block device
export DEV=/dev/sdb
sudo mkdir /mnt/sd/
sudo dd if=arch/arm/boot/zImage of="$DEV"1 conv=fsync
sudo mount "$DEV"2 /mnt/sd/
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

Build compat-drivers (optional)

Optionally if you use the WIFI-N-USB2 module or another recent USB wireless device you can build "compat-drivers" which provides more recent compatibility on this kernel.

# Assuming you are still in the 2.6.34 kernel directory
cd ../
export ARCH=arm
export CROSS_COMPILE=/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-

# Update this to point to your SD card block device
export DEV=/dev/sdb
export KLIB=/mnt/sd
# Update these paths to point to the linux tree
export KLIB_BUILD=../linux-2.6.34-ts471x/

wget http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.8.3/compat-drivers-3.8.3-2-snpu.tar.bz2 && \
tar xf compat-drivers-3.8.3-2-snpu.tar.bz2 && \
cd compat-drivers-3.8.3-2-snpu/ && \
make && \
sudo mount "$DEV"2 /mnt/sd/ && \
INSTALL_MOD_PATH=/mnt/sd/ sudo -E make install-modules && \
sudo umount /mnt/sd/ && \
sync