CM-T335: Linux: Kernel
Overview
Linux kernel for the CompuLab CM-T335 System-on-Module / Computer-on-Module provides support for on-board peripherals and abstracts the functionality provided by the hardware. CompuLab provides ready-to-run binary kernel images, and source code of the modifications and additions made to the Linux kernel to work properly with CM-T335 modules.
Building kernel for CM-T335
Getting kernel sources
There are various ways to get Linux kernel sources that can be used as a baseline for CM-T335 kernel. For instance, a copy of linux-stable git tree can be created or a Linux kernel sources snapshot can be downloaded.
Assuming that the /home/development/cm-t335/kernel directory structure has been created for CM-T335 kernel development.
Snapshot download
- Download v4.4 snapshot with a web browser.
- Extract the downloaded archive linux-4.4.tar.gz
cd /home/development/cm-t335/kernel tar xvf /path/to/downloaded/linux-4.4.tar.gz mv linux-4.4 linux-cm-t335
- This will create /home/development/cm-t335/kernel/linux-cm-t335 directory containing linux kernel tree.
- Apply the cm-t335 patch
cd /home/development/cm-t335/kernel/linux-cm-t335 patch -p1 < /path/to/cm-t335-linux/kernel/linux-4.4.0-cm-t335-5.1.patch
Git clone
- Install git version control system.
- Create a clone of linux kernel tree
cd /home/development/cm-t335/kernel git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-cm-t335
- Create a branch for CM-T335 development. The CM-T335 patches are generated vs. v4.4 tag (b5be40b90dbaa6bd337f3b77de361bfc0723468b commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd /home/development/cm-t335/kernel/linux-cm-t335 git checkout -b cm-t335-dev v4.4
- Apply the CM-T335 patch
git am /path/to/cm-t335-linux/kernel/patches/*.patch
Future stable kernel versions of 4.4 can also be used by adding the Linux kernel stable repository as a remote and checking out any later tag of the v4.4.y stable kernel branch. |
Building the kernel
- Run the following commands:
export ARCH=arm export CROSS_COMPILE=arm-none-linux-eabi- make cm_t335_defconfig && make menuconfig make && INSTALL_MOD_PATH=/home/development/cm-t335/rootfs make modules_install
In the example above:
- The Linux kernel image zImage will be created in /home/development/cm-t335/kernel/linux-cm-t335/arch/arm/boot
- The Device Tree binary am335x-sbc-t335.dtb will be created in /home/development/cm-t335/kernel/linux-cm-t335/arch/arm/boot/dts
- The Device Tree binary am335x-cm-t335.dtb will be created in /home/development/cm-t335/kernel/linux-cm-t335/arch/arm/boot/dts
- The loadable kernel modules will be installed into the /home/development/cm-t335/rootfs/lib/modules directory.
When the CM-T335 is booted with the kernel image and Device Tree binary created as described above and with networked root filesystem at /home/development/cm-t335/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.
Basic platform support
The CM-T335 basic platform support is implemented in device tree files located in arch/arm/boot/dts/ folder of Linux kernel source tree.
Device Tree
Device Tree (DT), is a data structure and language for describing hardware. More specifically, it is a description of hardware that is readable by an operating system so that the operating system doesn't need to hard code details of the machine.
A device tree file, named *.dts, is a text file that describes the hardware platform. It is compiled into a device tree blob, *.dtb, which is loaded into memory before the Linux kernel is started. The Linux kernel then uses that device tree blob to initialize itself at runtime.
CM-T335 device tree organization
The SBC-T335 product is built from 3 major components:
┌───────────────────────────────┐ │ SB-T335 baseboard │ │ │ │ ┌─────────────────────┐ │ │ │ CM-T335 SoM │ │ │ │ │ │ │ │ ┌─────────────┐ │ │ │ │ │TI AM335x SoC│ │ │ │ │ └─────────────┘ │ │ │ └─────────────────────┘ │ └───────────────────────────────┘
SBC-T335 Device tree hierarchy reflects the hardware hierarchy:
am33xx.dtsi ∧ │ am335x-cm-t335.dts ∧ │ am335x-sbc-t335.dts
- am33xx.dtsi is the SoC vendor device tree describing the AM33x SoC group.
- am335x-cm-t335.dts is the SoM vendor device tree describing the CM-T335 SoM.
- am335x-sbc-t335.dts describes the SB-T335 baseboard. The SB-T335 board is simulating the customer board. The file should be updated according to the customer main board.
For more details visit official Device Tree WiKi pages and make an overview of a Device Tree tutorial
Kernel configuration
MMC/SDIO support
In the kernel configuration menu choose Device Drivers ---> MMC/SD/SDIO card support submenu and enable:
- TI OMAP High Speed Multimedia Card Interface support
┌─────────────────────────────── MMC/SD/SDIO card support ──────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ ... │ │ │ │ --- MMC/SD/SDIO card support │ │ │ │ ... │ │ │ │ < > Secure Digital Host Controller Interface support │ │ │ │ <M> TI OMAP Multimedia Card Interface support │ │ │ │ <M> TI OMAP High Speed Multimedia Card Interface support │ │ │ │ < > Synopsys DesignWare Memory Card Interface │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
NAND support
In the kernel configuration menu choose Device Drivers ---> Memory Technology Device (MTD) support ---> NAND Device Support submenu and enable:
- NAND Flash device on OMAP2, OMAP3 and OMAP4
- Support hardware based BCH error correction
- Support software BCH ECC
┌─────────────────────────── NAND Device Support ───────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- NAND Device Support │ │ │ │ [*] Support software BCH ECC │ │ │ │ < > Support Denali NAND controller as a DT device │ │ │ │ < > GPIO assisted NAND Flash driver │ │ │ │ <*> NAND Flash device on OMAP2, OMAP3 and OMAP4 │ │ │ │ [*] Support hardware based BCH error correction │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
SPI support
In the kernel configuration menu choose Device Drivers ---> SPI support submenu and enable:
- McSPI driver for OMAP
┌─────────────────────────────── SPI support ───────────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- SPI support │ │ │ │ ... │ │ │ │ <*> McSPI driver for OMAP │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
UART support
In the kernel configuration menu choose Device Drivers ---> Character devices ---> Serial drivers submenu and enable:
- OMAP serial port support
- Console on OMAP serial port
┌───────────────────────────── Serial drivers ──────────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ <*> OMAP serial port support │ │ │ │ [*] Console on OMAP serial port │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
Ethernet support
In the kernel configuration menu choose Device Drivers ---> Network device support ---> Ethernet driver support submenu and enable:
- Texas Instruments (TI) devices
- TI DaVinci MDIO Support
- TI DaVinci CPDMA Support
- TI CPSW ALE Support
┌──────────────────────── Ethernet driver support ──────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ ... │ │ │ │ [*] Texas Instruments (TI) devices │ │ │ │ <*> TI DaVinci EMAC Support │ │ │ │ -*- TI DaVinci MDIO Support │ │ │ │ -*- TI DaVinci CPDMA Support │ │ │ │ -*- TI CPSW Switch Phy sel Support │ │ │ │ -*- TI CPSW ALE Support │ │ │ │ <*> TI CPSW Switch Support │ │ │ │ [*] TI Common Platform Time Sync (CPTS) Support │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
In the kernel configuration menu choose Device Drivers ---> Network device support ---> PHY Device support and infrastructure submenu and enable:
- Drivers for Atheros AT803X PHYs
┌────────────────── PHY Device support and infrastructure ──────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- PHY Device support and infrastructure │ │ │ │ *** MII PHY device drivers *** │ │ │ │ < > Drivers for the Aquantia PHYs │ │ │ │ <*> Drivers for Atheros AT803X PHYs │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
Display support
CM-T335 has a single parallel RGB display interface which drives multiple display connectors, including: a parallel RGB LCD + touchscreen connector, a DVI connector, and an LVDS connector. Since all 3 connectors are driven by the same interface, they should not be used simultaneously.
In the kernel configuration menu choose Device Drivers ---> Graphics support ---> Frame buffer Devices ---> OMAP2+ Display Subsystem support submenu and enable:
- DPI support
- OMAP2+ frame buffer support
┌──────────────────── OMAP2+ Display Subsystem support ─────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- OMAP2+ Display Subsystem support │ │ │ │ ... │ │ │ │ [*] DPI support │ │ │ │ ... │ │ │ │ <M> OMAP2+ frame buffer support ---> │ │ │ │ OMAP Display Device Drivers (new device model) ---> │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ ├───────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
Wifi support
The WiFi chip is connected to the SoC via SPI interface, so make sure you have SPI support turned on. Also, make sure wireless support is turned on under Network support.
In the kernel configuration menu choose Device Drivers ---> Network device support ---> Wireless LAN ---> TI Wireless LAN support submenu and enable:
- TI wl12xx support
- TI wlcore support
- TI wlcore SPI support
┌───────────────────────── TI Wireless LAN support ─────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- TI Wireless LAN support │ │ │ │ < > TI wl1251 driver support ---- │ │ │ │ <M> TI wl12xx support │ │ │ │ < > TI wl18xx support │ │ │ │ -M- TI wlcore support │ │ │ │ <M> TI wlcore SPI support │ │ │ │ < > TI wlcore SDIO support │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
Bluetooth support
The Bluetooth chip is connected to the SoC via UART interface, so make sure you have UART support turned on. Also, make sure bluetooth support is turned on under Network support ---> Bluetooth subsystem support.
In the kernel configuration menu choose Networking support ---> Bluetooth subsystem support ---> Bluetooth device drivers submenu and enable:
- HCI SDIO driver
- HCI UART driver
- Marvell Bluetooth driver support
- Marvell BT-over-SDIO driver
┌──────────────────────── Bluetooth device drivers ─────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ ... │ │ │ │ <M> HCI UART driver │ │ │ │ [*] UART (H4) protocol support │ │ │ │ [*] BCSP protocol support │ │ │ │ [ ] Atheros AR300x serial support │ │ │ │ [*] HCILL protocol support │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
Audio support
In the kernel configuration menu choose Device Drivers ---> Sound card support ---> Advanced Linux Sound Architecture ---> ALSA for SoC audio support submenu and enable:
- SoC Audio for Texas Instruments chips using eDMA
- Multichannel Audio Serial Port (McASP) support
- ASoC Simple sound card support
┌─────────────────────── ALSA for SoC audio support ────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- ALSA for SoC audio support │ │ │ │ < > SoC Audio for the Atmel System-on-Chip │ │ │ │ <M> SoC Audio for Texas Instruments chips using eDMA │ │ │ │ <M> Multichannel Audio Serial Port (McASP) support │ │ │ │ ... │ │ │ │ CODEC drivers ---> │ │ │ │ <M> ASoC Simple sound card support │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
Under the CODEC drivers submenu of the same section enable:
- Texas Instruments TLV320AIC23 audio CODEC - I2C
┌────────────────────────────── CODEC drivers ──────────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ ... │ │ │ │ <M> Texas Instruments TLV320AIC23 audio CODEC - I2C │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
CAN bus support
In the kernel configuration menu choose Networking support ---> CAN bus subsystem support submenu and enable:
- Raw CAN Protocol (raw access with CAN-ID filtering)
- Broadcast Manager CAN Protocol (with content filtering)
┌──────────────────────── CAN bus subsystem support ────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ --- CAN bus subsystem support │ │ │ │ <M> Raw CAN Protocol (raw access with CAN-ID filtering) │ │ │ │ <M> Broadcast Manager CAN Protocol (with content filtering) │ │ │ │ < > CAN Gateway/Router (with netlink configuration) │ │ │ │ CAN Device Drivers ---> │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘
In the kernel configuration menu choose Networking support ---> CAN bus subsystem support ---> CAN Device Drivers submenu and enable:
- Platform CAN drivers with Netlink support
- Bosch C_CAN/D_CAN devices
┌─────────────────────────── CAN Device Drivers ────────────────────────────┐ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ < > Virtual Local CAN Interface (vcan) │ │ │ │ < > Serial / USB serial CAN Adaptors (slcan) │ │ │ │ <M> Platform CAN drivers with Netlink support │ │ │ │ [*] CAN bit-timing calculation │ │ │ │ [ ] Enable LED triggers for Netlink based drivers │ │ │ │ < > TI High End CAN Controller │ │ │ │ < > Support for Freescale FLEXCAN based chips │ │ │ │ < > Aeroflex Gaisler GRCAN and GRHCAN CAN devices │ │ │ │ < > Renesas R-Car CAN controller │ │ │ │ < > Philips/NXP SJA1000 devices ---- │ │ │ │ <M> Bosch C_CAN/D_CAN devices ---> │ │ │ │ ... │ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ <Select> < Exit > < Help > < Save > < Load > │ └───────────────────────────────────────────────────────────────────────────┘