This article describes how to build and install a Debian 8 (Jessie) Linux distribution on a Direct Insight Triton TX6 i.MX6 based SOM using Debian Debootstrap. You can find more information on debootstrap here: https://wiki.debian.org/EmDebian/CrossDebootstrap.
This is an ideal platform for evaluation purposes because you can very easily install any Debian packages using the Debian Advanced Package Tool (apt). Once you have identified the features you require you can then build this into a more appropriate embedded rootfs using either Yocto or the Karo “native” Linux distribution.
After building the rootfs you will need to install it into a TX6 module using the manufacturing tool. You will find details on how to do this here:
https://www.karo-electronics.com/1550.html?&L=1
This process has been validated on Debian or Ubuntu development machines. Be very careful if using “copy and paste” to run the commands.
On your Linux development machine, install the required packages:
sudo apt-get install qemu-user-static debootstrap binfmt-support
QEM is emulation software for different architectures. Although our development machine is most likely x86 we are building a rootfs for ARM.
Configure the environment:
export targetdir=/opt/tx6-armel-rootfs export distro=jessie sudo mkdir -p $targetdir sudo debootstrap --arch=armel --foreign $distro $targetdir
Copy the qemu-arm-static etc into the right place:
sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin sudo cp /etc/resolv.conf $targetdir/etc
That’s a basic armel rootfs. Now stage 2:
sudo chroot $targetdir # we are now root in the target directory, emulating ARM export distro=jessie export LANG=C /debootstrap/debootstrap --second-stage
Set up the apt sources for jessie. Create/edit /etc/apt/sources.list and add (note $distro should get replaced with the distro name in this case jessie). You may use the screen editor “nano” if you prefer:
cat << EOT > /etc/apt/sources.list deb http://httpredir.debian.org/debian $distro main contrib non-free deb-src http://httpredir.debian.org/debian $distro main contrib non-free deb http://httpredir.debian.org/debian $distro-updates main contrib non-free deb-src http://httpredir.debian.org/debian $distro-updates main contrib non-free deb http://security.debian.org/debian-security $distro/updates main contrib non-free deb-src http://security.debian.org/debian-security $distro/updates main contrib non-free EOT
Create the file /etc/apt/apt.conf.d/71-no-recomends:
cat << EOT > /etc/apt/apt.conf.d/71-no-recomends APT::Install-Recommends "0"; APT::Install-Suggests "0"; EOT
Now pull latest updates and install locales packages:
apt-get update apt-get install –y locales dialog dpkg-reconfigure locales
For UK locales select en_GB (all three entries)
Install additional packages:
apt-get install –y openssh-server sudo ntpdate
The Karo kernels use the sysVinit init system, however the default Jessie init system is systemd, so it is necessary to switch:
apt-get install sysvinit apt-get install –y sysvinit-core sysvinit-utils apt-get remove –y systemd # dpkg may give errors! apt-get -f install # forces removal
Set root password:
passwd
Add a sudo user:
adduser debian adduser debian sudo
Set up basic networking with DHCP:
cat << EOT >> /etc/network/interfaces allow-hotplug eth0 iface eth0 inet dhcp EOT
Set the host name:
echo tx6 > /etc/hostname
Enable serial console:
echo T0:2345:respawn:/sbin/getty -L ttymxc0 115200 linux >> /etc/inittab
Exit and clean up:
exit sudo rm $targetdir/etc/resolv.conf sudo rm $targetdir/usr/bin/qemu-arm-static
Now $targetdir contains the final rootfs. You can tar this up in preperation for programming into a TX6 module:
cd $targetdir sudo tar cjf ~/$distro-armhf-rootfs.tar.bz2 * cd ~
Now install the rootfs on a TX module. If you are using a NAND device you will need an SD card. If you are using an eMMC module the rootfs can be installed directly on the module itself.
You will need to update the U-Boot environment in order for the Debian 8 rootfs to load after the kernel boots. You can either manually do this in U-Boot itself on the module or create an environment file containing the appropriate environment:
append_bootargs=init=/sbin/init
Use the Karo manufacturing tool to install the image by copying the rootfs tar archive and the environment file to the custom folder. See details here:
https://www.karo-electronics.com/1550.html?&L=1
Once the rootfs tar archive and U-Boot environment is copied to the custom folder simply configure the manufacturing tool as usual but use the custom rootfs and environment file when prompted. The manufacturing tool will then select the custom files and the default kernel, dtb and U-Boot images to program into the module.
The module is now ready to boot the Linux Debian 8 distribution.