NVIDIA's latest JetPack 2.3.1 consists of the following items:
To get a base L4T root file system ready to accept later JetPack installation you may now install NVIDIA's JetPack 2.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-2.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 V2.6.1 Beta 2):
[user@host ~]$ wget -c http://developer.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Images/Apalis_TK1_LinuxImageV2.6.1Beta2_20161122.tar.bz2 [user@host ~]$ sudo tar xjvf Apalis_TK1_LinuxImageV2.6.1Beta2_20161122.tar.bz2 [user@host ~]$ cd Apalis_TK1_LinuxImageV2.6.1/rootfs [user@host rootfs]$ sudo tar cjvf ../mod.tar.bz2 lib/modules [user@host rootfs]$ cd .. [user@host Apalis_TK1_LinuxImageV2.6.1]$ sudo rm -rf rootfs [user@host Apalis_TK1_LinuxImageV2.6.1]$ sudo tar xjvf ~/TK1/Linux_for_Tegra_tk1/rootfs.tar.bz2 [user@host Apalis_TK1_LinuxImageV2.6.1]$ cd rootfs [user@host rootfs]$ sudo tar xjvf ../mod.tar.bz2 [user@host rootfs]$ cd ..
As the L4T root file system is quite big we do have to adjust the minimum partition free size in order for it not to overflow e.g. as follows:
[user@host Apalis_TK1_LinuxImageV2.6.1]$ sudo sed -i -e 's/set -e/#set -e/' -e 's/MIN_PARTITION_FREE_SIZE=100/MIN_PARTITION_FREE_SIZE=300/' update.sh
As our current update script only provisions the partitioning for 8GB rather than 16GB one needs to proceed as follows:
[user@host Apalis_TK1_LinuxImageV2.6.1]$ sudo sed -i -e 's/7450/15642/' update.sh
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_LinuxImageV2.6.1]$ ./update.sh -c -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
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. Please check /home/ubuntu/_installer/logs/TK1/flash_os_tk1.log for more details. Then press Enter key and try again.
Which you confirm again with the installer proceeding as follows:
Determining the IP address of target...
After a minute or two 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.
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