**All the files will be placed in your $HOME directory. Clean up afterwards.** Fetch the Apalis image and prepare the filesystem. (Check for a newer image at http://developer.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Images/ and update accordingly) ``` cd wget -c http://developer.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Images/Apalis_T30_LinuxImageV2.6_20160826.tar.bz2 sudo tar xjf Apalis_T30_LinuxImageV2.6_20160826.tar.bz2; echo 'Done.' cd Apalis_T30_LinuxImageV2.6 sudo rm -rf rootfs sudo mkdir L4T; cd L4T ``` ### Fetch driver packages and sample root filesystem. ``` sudo wget -c http://developer.download.nvidia.com/mobile/tegra/l4t/r16.5.0/cardhu_release_armhf/Tegra30_Linux_R16.5_armhf.tbz2 sudo wget -c http://developer.download.nvidia.com/mobile/tegra/l4t/r16.5.0/cardhu_release_armhf/Tegra_Linux_Sample-Root-Filesystem_R16.5_armhf.tbz2 ``` ### Configure sample root filesystem and driver packages. ``` sudo tar xjf Tegra30_Linux_R16.5_armhf.tbz2; echo 'Done.' cd Linux_for_Tegra/rootfs/ sudo tar xjf ../../Tegra_Linux_Sample-Root-Filesystem_R16.5_armhf.tbz2; echo 'Done.' cd .. sudo ./apply_binaries.sh ``` ### Fix potential issues. ``` cd rootfs sudo sh -c 'echo "" >> etc/issue' sudo sh -c 'echo "Apalis_T30" >> etc/issue' ``` Uncomment the line `# echo 1 > /sys/module/cpu_tegra3/parameters/auto_hotplug` in `etc/init/nv.conf`: ``` gksudo gedit etc/init/nv.conf cd ../../../ sudo ln -s L4T/Linux_for_Tegra/rootfs/ ``` This is enough to have a properly working Linux without WiFi. If you do not need WiFi skip to part **Flash the Filesystem and Kernel to the SD Card**. ### Setup toolchain. ``` cd wget -c https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz tar xvf gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz ln -s gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf gcc-linaro export ARCH=arm export PATH=~/gcc-linaro/bin/:$PATH export CROSS_COMPILE=arm-linux-gnueabihf- ``` Install DTC and U-Boot tools. ``` sudo apt-get install device-tree-compiler u-boot-tools ``` ### Configure U-Boot. ``` git clone -b 2015.04-toradex git://git.toradex.com/u-boot-toradex.git cd u-boot-toradex make apalis_t30_defconfig make -j8 2>&1 | tee build.log cd ~/Apalis_T30_LinuxImageV2.6/apalis-t30_bin sudo cp ~/u-boot-toradex/u-boot-dtb-tegra.bin ./u-boot-dtb-tegra-custom.bin sudo ln -fs u-boot-dtb-tegra-custom.bin u-boot-dtb-tegra.bin ``` ### Build Linux kernel. ``` cd git clone -b tegra git://git.toradex.com/linux-toradex.git cd linux-toradex make apalis_t30_defconfig make nconfig ``` Now follow the instructions here: http://developer.toradex.com/knowledge-base/wi-fi-(linux)#MiniPCIe >Device Drivers ---> > [\*] Network device support ---> > [\*] Wireless LAN ---> > <*> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlagn) > < F6 > Confirm Save. > < F9 > Exit. Update the config by removing CONFIG_CFG80211. DO NOT REMOVE WLAN AS SPECIFIED in [2]! `sed -i '/CONFIG_CFG80211=y/c\# CONFIG_CFG80211 is not set' .config` ### Build the image and the modules. ``` make -j8 uImage 2>&1 | tee build.log make -j8 # Just to make sure. make -j8 modules sudo -E make INSTALL_MOD_PATH=~/Apalis_T30_LinuxImageV2.6/rootfs modules_install ``` ### Build backported WiFi drivers. ``` export ARCH=arm export CROSS_COMPILE=~/gcc-linaro/bin/arm-linux-gnueabihf- export KLIB=~/build_iwlwifi export KLIB_BUILD=~/linux-toradex cd wget -c https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.11.8/backports-3.11.8-1.tar.bz2 tar xjf backports-3.11.8-1.tar.bz2; echo 'Done.' cd backports-3.11.8-1/ sed -i '/#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))/c\#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))' backport-include/linux/export.h make defconfig-iwlwifi make -j8 ``` Uncomment/remove update-initramfs.sh and backport\_firmware_install.sh from the Makefiles. (The only Makefile I found this in was Makefile.real) ``` sed -i '/@.\/scripts\/update-initramfs.sh \$(KLIB)/c\# Deleted.' Makefile.real sed -i '/@.\/scripts\/backport_firmware_install.sh/c\# Deleted.' Makefile.real make install ``` ### Setup Ethernet and WiFi configuration. ``` ./${PATH_TO_SETUP_SCRIPT}/setup_wifi_eth.sh ``` (This script adds wifi/ethernet interfaces in /etc/network, the wpa_supplicant with a defined wifi network and copies the prebuilt iwlwifi-7260-7.ucode to rootfs/lib/firmware, since for some reason this is never built using the previous instructions. Also all the modules from build_iwlwifi/lib/modules are copied.) ### Flash the Filesystem and Kernel to the SD Card.** ``` cd ~/Apalis_T30_LinuxImageV2.6 ./update.sh -o ${SD_CARD} cp ~/linux-toradex/arch/arm/boot/uImage ${SD_CARD}/apalis-t30 ``` Resize the filesystem. The default value is around 400 MB, which leaves around 50 MB free after kernel installation. We set the size to 1GB. ``` cd ${SD_CARD}/apalis_t30 e2fsck -f root.ext3 sudo resize2fs root.ext3 1G ``` Now connect Apalis using Serial and do: ``` screen /dev/ttyUSBX 115200 ``` Enter the boot by pressing any key and run: ``` run setupdate run update_uboot run update ``` Login is: ``` Login: ubuntu Password: ubuntu ``` After logging in do: ``` sudo apt-get update sudo apt-get install linux-firmware # And any other tools you would need, e.g. nano ``` Additional step is required to configure Ethernet in case you skipped WiFi configuration. **DO NOT EXECUTE IF YOU CONFIGURED WIFI SUPPORT**: ``` echo -e 'auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet dhcp' | sudo tee /etc/network/interfaces and reboot. ``` **And we are done! Sit back and enjoy the day.** ### FAQ #### The kernel does not boot after run update. The u-boot is not properly compiled. #### How to check if the WiFi module is recognized and the drivers are there? Run lspci and dmesg | grep iwlwifi. The output should be something like: `$ lspci` > 00:00.0 PCI bridge: NVIDIA Corporation Device 0e1d (rev a1) > 01:00.0 Network controller: Intel Corporation Device 08b1 (rev bb) > 02:00.0 PCI bridge: NVIDIA Corporation Device 0e1d (rev a1) > 03:00.0 Ethernet controller: Intel Corporation Device 157b (rev 03) `$ dmesg | grep iwlwifi` >[ 10.367570] iwlwifi 0000:01:00.0: loaded firmware version 22.1.7.0 op_mode iwlmvm >[ 12.422167] iwlwifi 0000:01:00.0: Detected Intel(R) Dual Band Wireless AC 7260, REV=0x144 >[ 12.422360] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S >[ 12.422585] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S >[ 12.981950] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S >[ 12.982166] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S ### How to check if the module is properly installed? Run iwconfig. You should see something like this: `$ iwconfig` > wlan0 IEEE 802.11abgn ESSID:"xxx" >Mode:Managed Frequency:5.24 GHz Access Point: 78:24:AF:96:D8:A4 >Bit Rate=6 Mb/s Tx-Power=0 dBm >Retry long limit:7 RTS thr:off Fragment thr:off >Power Management:on >Link Quality=46/70 Signal level=-64 dBm >Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 >Tx excessive retries:0 Invalid misc:5 Missed beacon:0 ### How to change the WiFi connection? To change the wifi settings edit the `/etc/wpa_supplicant/wpa_supplicant.conf` file. ### References: - [1] http://developer.toradex.com/knowledge-base/using-the-nvidia-provided-l4t-rootfs - [2] http://developer.toradex.com/knowledge-base/kernel-backports-integration - [3] http://developer.toradex.com/knowledge-base/wi-fi-(linux) - [4] http://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code - [5] https://wiki.rapyuta-robotics.com/doku.php?id=engineering:apalis_t30:flash_images_and_kernels