NVIDIA's latest JetPack 3.1 consists of the following items:
The preparation steps need to be executed on the x86/x86-64 development host running a Linux distribution (e.g. Fedora or Ubuntu).
The following host applications and 32-bit libraries are a pre-requisite for executing the update script and the 32bit x86 tools contained in the image tarball.
E.g. for Ubuntu 14.04 (64-bit)
sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install dosfstools e2fsprogs gawk mtools parted sudo apt-get install zlib1g:i386 liblzo2-2:i386 libuuid1:i386 libusb-1.0-0:i386
E.g. for Ubuntu 14.04 (32-bit)
sudo apt-get update sudo apt-get install dosfstools e2fsprogs gawk mtools parted sudo apt-get install zlib1g liblzo2-2 libuuid1 libusb-1.0-0
E.g. for Fedora 21 (32 and 64-bit)
yum install dosfstools e2fsprogs gawk mtools parted yum install zlib.i686 lzo.i686 libuuid.i686 libusbx.i686
On older distros (e.g. Ubuntu 12.04) the tool to create a FAT filesystem was named mkfs.vfat while the update.sh script uses mkfs.fat. If you get an error that mkfs.fat is missing then find the full path to mkfs.vfat and create a symlink by doing the following:
trdx@trdx:~$ sudo sh -c "command -v mkfs.vfat" /sbin/mkfs.vfat trdx@trdx:~$ sudo ln -s /sbin/mkfs.vfat /sbin/mkfs.fat
To get a base L4T root file system ready to accept later JetPack installation you may now install NVIDIA's JetPack 3.1 on your development workstation. As NVIDIA only supports this for x86 64-bit Ubuntu 14.04 LTS which you may not be using one can revert to a VM e.g. using VirtualBox or the like. For the JetPack installation just download e.g. JetPack-L4T-3.1-linux-x64.run and install it as explained in NVIDIA's documentation as linked to on the top. When asked just proceed using the default standard options for Jetson TK1 up to its post installation steps.
Note: Due to Toradex Apalis TK1 being pin compatible to the rest of the Apalis family there are a few subtle hardware differences and one can not just flash straight Jetson TK1 firmware onto it.
Therefore at the post installation during the USB recovery mode step one can not connect/flash the Apalis TK1 using the JetPack installer but we rather extract the base L4T root file system and flash it onto the Apalis TK1 by our regular procedure and subsequently install the rest of the JetPack as usual via Ethernet.
First we have to get to the L4T root file system:
ubuntu@ubuntu-14:~$ cd ~/TK1/Linux_for_Tegra_tk1/ ubuntu@ubuntu-14:~/TK1/Linux_for_Tegra_tk1$ sudo tar cjvf rootfs.tar.bz2 rootfs
Now we continue integrating the above into our regular Apalis TK1 Embedded Linux BSP demo image package and replace its rootfs with the L4T one as obtained above (use the latest image, at the time of writing this is 2.7b3):
[user@host ~]$ wget -c http://developer.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Images/Apalis-TK1_LXDE-Image_2.7b3-20170630.tar.bz2 [user@host ~]$ sudo tar xjvf Apalis-TK1_LXDE-Image_2.7b3-20170630.tar.bz2 [user@host ~]$ cd Apalis-TK1_LXDE-Image_2.7.3/rootfs [user@host rootfs]$ sudo cp lib/firmware/apalis-tk1-k20.bin ../ [user@host rootfs]$ sudo tar cjvf ../mod.tar.bz2 lib/modules [user@host rootfs]$ cd .. [user@host Apalis-TK1_LXDE-Image_2.7.3]$ sudo rm -rf rootfs [user@host Apalis-TK1_LXDE-Image_2.7.3]$ sudo tar xjvf ~/TK1/Linux_for_Tegra_tk1/rootfs.tar.bz2 [user@host Apalis-TK1_LXDE-Image_2.7.3]$ cd rootfs [user@host rootfs]$ sudo cp ../apalis-tk1-k20.bin lib/firmware/ [user@host rootfs]$ sudo tar xjvf ../mod.tar.bz2 [user@host rootfs]$ cd ..
Now proceed to generate an update media (e.g. SD card or TFTP location) as usual. Make sure to pass the -m 2 parameter to our update.sh script in order for it to assume a Apalis TK1 root file system to be generated e.g. as follows:
[user@host Apalis-TK1_LXDE-Image_2.7.3]$ ./update.sh -m 2 -o /var/lib/tftpboot/
First we have to make sure the latest U-Boot boot loader and its default environment are installed. We use the one from our latest BSP release which we already generated an update media for in the previous step.
Update U-Boot as usual e.g.:
Apalis TK1 # run setupdate Apalis TK1 # run update_uboot
Should the above fail you may be running an older prototype U-Boot version which used a different board/board_name. This can be worked around by additionally doing the following right before the above:
Apalis TK1 # setenv board apalis-tk1 Apalis TK1 # setenv board_name apalis-tk1
Once running the latest U-Boot also make sure to use resp. latest default environment e.g.:
Apalis TK1 # env default -a; saveenv; reset
As Ubuntu 14.04 requires the root file system to initially already be mounted in read/write mode change the emmcargs e.g. as follows:
Apalis TK1 # setenv emmcargs 'ip=off root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait'; saveenv; reset
Should your module not boot into U-Boot anymore you will have to use the flashing from scratch procedure as explained in the following article.
You are now running the latest boot loader.
Then back at your boot loader prompt proceed with the installation as follows:
Apalis TK1 # run setupdate Apalis TK1 # run update
The update takes some time and completes with a reset. Your Apalis TK1 should now boot into a base L4T system.
You may now disable the screen power-saving and lock as well as enable auto login.
Unless you do have a single channel LVDS display connected you may want to disable the built-in display as well.
For the L4T root file system one has to manually re-size the file system to use the full partition size as follows:
ubuntu@tegra-ubuntu:~$ sudo resize2fs /dev/mmcblk0p2
As a further convenience one may want to add a DISPLAY variable to the regular terminal e.g. as follows:
ubuntu@tegra-ubuntu:~$ sudo sh -c 'echo "" >> /etc/profile' ubuntu@tegra-ubuntu:~$ sudo sh -c 'echo "test -z \"\$DISPLAY\" && DISPLAY=\":0.0\" # have the X display defined, unless it is already set, e.g. by a ssh connection" >> /etc/profile' ubuntu@tegra-ubuntu:~$ sudo sh -c 'echo "export DISPLAY" >> /etc/profile'
If you are using an Ixora carrier board an optional fan may be enabled via its GPIO as follows:
ubuntu@tegra-ubuntu:~$ sudo sh -c 'echo 234 > /sys/class/gpio/export' ubuntu@tegra-ubuntu:~$ sudo sh -c 'echo high > /sys/class/gpio/gpio234/direction'
The above may of course be added to any Ubuntu start script of your liking.
After a reboot your Apalis TK1 should now be ready to accept further JetPack installation.
You may still have your JetPack installer waiting at the post installation USB recovery mode step. If not just proceed through the JetPack installer again using the default options for Jetson TK1 up to its post installation steps. Do not connect your development workstation to your target by means of a USB device cable and do not put your target into recovery mode but rather ensure both your development workstation as well as your Apalis TK1 do have basic Ethernet connectivity on the same subnet. Then just confirm the following question given in a separate terminal:
Please put your device to Force USB Recovery Mode, when you are ready, press Enter key
Upon which the installer will respond as follows:
Failed to flash device. Check /home/ubuntu/_installer/logs/TK1/flash_os_tk1.log for more details. Please close this terminal window, fix the issue mentioned in log, and run JetPack again to reinstall.
Previous JetPack installers may respond as follows:
Failed to flash device. Please check /home/ubuntu/_installer/logs/TK1/flash_os_tk1.log for more details. Then press Enter key and try again.
Do NOT close the terminal window as suggested but just hit ENTER in that terminal with the installer proceeding as follows:
Determining the IP address of target...
Now if after three more minutes you do not get any response yet you need to manually kill nc in a separate new terminal as follows:
killall -s SIGKILL nc
Now you should get the following response:
JetPack is unable to determine the IP address of the Jetson Developer Kit Please select which action do you want: 1. Retry 2. Manually enter IP address Your Option is <1/2>:
This you confirm with 2 to be able to manually enter your boards IP address into the main JetPack installer UI.
On the Apalis TK1 you may find out about your currently obtained IP address using the following command:
ubuntu@tegra-ubuntu:~$ ip addr
The relevant interface for the gigabit Ethernet connection is called eth0.
After the successful JetPack installation first make sure to remove any excess .deb files as they will use up all space of our precious root file system.
Then finally proceed to updating your L4T system e.g. as follows:
ubuntu@tegra-ubuntu:~$ sudo apt-get update ubuntu@tegra-ubuntu:~$ sudo apt-get dist-upgrade ubuntu@tegra-ubuntu:~$ sudo apt-get autoremove ubuntu@tegra-ubuntu:~$ sudo apt-get autoclean ubuntu@tegra-ubuntu:~$ sudo apt-get clean
Congratulations, your Apalis TK1 should now be running a fully up-to-date JetPack/L4T installation.
While we recommend cross-compiling the Linux kernel as explained in the following article one can of course natively build it as well.
First one needs to get the proper Linux kernel sources for our BSP from the Toradex git server:
ubuntu@tegra-ubuntu:~$ git clone -b toradex_tk1_l4t_r21.5 git://git.toradex.com/linux-toradex.git
Then to be able to create an uImage later the u-boot-tools need installing:
ubuntu@tegra-ubuntu:~$ sudo apt-get update ubuntu@tegra-ubuntu:~$ sudo apt-get install u-boot-tools
Now configure and compile the kernel as follows:
ubuntu@tegra-ubuntu:~$ cd linux-toradex/ ubuntu@tegra-ubuntu:~linux-toradex$ make apalis-tk1_defconfig ubuntu@tegra-ubuntu:~linux-toradex$ make -j6 ubuntu@tegra-ubuntu:~linux-toradex$ make -j6 uImage
And we deploy the kernel binary and its accompanying device tree blob:
ubuntu@tegra-ubuntu:~linux-toradex$ cp arch/arm/boot/uImage /media/ubuntu/boot/ ubuntu@tegra-ubuntu:~linux-toradex$ cp arch/arm/boot/dts/tegra124-apalis-eval.dtb /media/ubuntu/boot/
Last but not least we deploy the matching kernel modules:
ubuntu@tegra-ubuntu:~linux-toradex$ sudo make modules_install
Now before attempting to compile further kernel modules out-of-tree reboot into this freshly built kernel:
ubuntu@tegra-ubuntu:~linux-toradex$ sudo reboot
After rebooting one can go ahead and compile out-of-tree kernel modules as well. As an example I show how one can do this for the Hello, World (part 1): The Simplest Module:
ubuntu@tegra-ubuntu:~$ cd kernel_module/ ubuntu@tegra-ubuntu:~/kernel_module$ make make -C /lib/modules/3.10.40-g19722d4/build M=/home/ubuntu/kernel_module modules make: Entering directory `/home/ubuntu/linux-toradex' CC [M] /home/ubuntu/kernel_module/hello-1.o Building modules, stage 2. MODPOST 1 modules CC /home/ubuntu/kernel_module/hello-1.mod.o LD [M] /home/ubuntu/kernel_module/hello-1.ko make: Leaving directory `/home/ubuntu/linux-toradex' ubuntu@tegra-ubuntu:~/kernel_module$ uname -a Linux tegra-ubuntu 3.10.40-g19722d4 #1 SMP PREEMPT Thu Mar 23 09:54:35 UTC 2017 armv7l armv7l armv7l GNU/Linux ubuntu@tegra-ubuntu:~/kernel_module$ modinfo hello-1.ko filename: /home/ubuntu/kernel_module/hello-1.ko srcversion: 140276773A3090F6F33891F depends: vermagic: 3.10.40-g19722d4 SMP preempt mod_unload modversions ARMv7 p2v8 ubuntu@tegra-ubuntu:~/kernel_module$ sudo insmod hello-1.ko ubuntu@tegra-ubuntu:~/kernel_module$ lsmod Module Size Used by hello_1 684 0 joydev 8195 0 rfcomm 33184 0 bnep 9543 2 apalis_tk1_k20 9080 0 bluetooth 269569 10 bnep,rfcomm rfkill 10359 3 bluetooth nvhost_vi 2889 0