Linux4Tegra with CUDA support on Nvidia Shield TV

The Nvidia Shield TV Box offers 256 CUDA cores delivering over 1 TeraFLOPs of performance for around 200 €. Great value for mobile deep learning experiments – if only a standard linux would run on it. Fortunately some people over at XDA-Developers have figured out a way to do just that. The instructions are however assuming much previous knowledge, which is why I attempted to compile a recipe here with everything in one place.

For some of the cross compiling you will either need a native Ubuntu Trusty x64 machine or a VM. As I don’t have a x64 machine with Ubuntu Trusty, I will go the VM route. I hate Virtual Box and its laggy awkward UI. Fortunately I have revently discovered vagrant, which automates and hides many of those things.

0. Installing and connecting to a Trusty x64 VM is now as easy as:

Unfortunately the memory of the VM is too small for compiling the kernel, so edit the vagrant file to add some more ram and cpus and the ability to capture sdcardreaders:

Further hints for designing filters can be obtained by:

Unmount the sd card reader from the host system and reload vagrant to restart with the new config:

1. Now we can prepare a MicroSD card with the operating system. First identify your sd card reader, init the sd card with ext4 and mount it:

Download the root file system and some additional tegra drivers from Nvidia

Finally, to fix the wifi firmware, download and extract to host ~. The in the vm

Sync the prepared rootfs to the sdcard and unmount the disk:

You can safely remove the micro sd card now and plug it into the back of your nvidia shield tv console.

2. Unlock the bootloader

First install the ADB tools for OS X

or Linux

Enable debugging on the Shield TV

1. Goto Settings
2. Go across to About in Device
3. Go down to Build and click on it 10x until it says you are in development mode

Enable ADB over USB

1. Make sure you have performed the above steps „Enable debugging“
2. Goto Settings
3. Go Across to Developer options
4. Go down to Debugging
5. Toggle USB debugging to On

Now boot into fastboot

– Perform software shutdown on SHIELD by holding Power button for 10 seconds
– Connect USB OTG cable to SHIELD
– Start pressing power button for 3 seconds
– HDMI TV should be always connected to SHIELD

You should now be able to see your shield from your computer by typing:

if not, unplug the device, stop the adb server, add the nvidia vendor id to db_usb.ini and restart the server:

plug the device back in and try add devices again.

Now get some information about the bootloader:

If your bootloader is locked, it must be unlocked first with:

Select ‚Confirm‘ to unlock the bootloader which may take up to 2 hours for the pro device.

Now fastboot getvar all should read:

Now you have to setup Android TV again and activate debug mode again 🙁


Perform a downgrade to firmware 1.3, and root the shield while you are at it. With the current firmwares that is not necessary and recommended anymore. Firmware & bootloader updates always carry a inherent risk of bricking your device.

Register for Nvidia developer account, obtain and unzip the files, bring device into fast boot mode:

3. To build a boot.img download the patched kernel source from GoogleDrive into your host machines vagrant dir. It should be auto mounted to /vagrant. Then extract the sources:

compile the kernel:

and finally make a bootable

4. Put the sd card in Shield TV SD card slot, Plug OTG cable between Shield TV and PC go into fast boot mode

To boot Linux 4 Tegra once run from the VM:

The Nvidia Logo will pop up and go away while ubuntu starts, which may take a good 2 min. Log in with ubuntu/ubunu. If the Ubuntu desktop is too large for your tv screen, you may want to disable overscan in your tv’s settings.

Once that works, you may want to write boot.img into the recovery spot

or even replace Android altogether by:

and then flash the original boot into the recovery spot. SSH into your shield

the password is ‚ubuntu‘.

Then first prevent the Nvidia driver for Tegra X1 being overwritten by apt-get upgrade by:

Add yourself as a new user and copy your public key, install some frequently used packages:

Now lets install the CUDA support. Download and apt-get sources and scp them to your shield.

Finally add the CUDA stuff to the path:

Now you should be able to call the CUDA compiler:

Next, tune the shield to achieve the full performance:

Now you can try out some of the examples in

War dieser Beitrag hilfreich?
[Gesamt:7    Durchschnitt: 2.7/5]

  • Danilo Haruo

    Hey Tatsch, Great Job. You compiled many topics from XDA thread. Really awesome. Thank you.

    Could you help me with some questions?

    1. What is the max resolution you got using HDMI and TV? Could you get a 4k resolution? Have any other Nvidia drive been required?

    2. Does Bluetooth work on L4T? and remote controller(Joystick)?

    3. When you downgrade to 1.3 version, did you use the default dtb(tegra210-foster-e-p2530-0930-e02-00.dtb) from nvidia zip file? The Sha256 and md5 are different from the thread.

    4. Do you have audio passthru over HDMI?

    Best Regards.


    • jmtatsch

      Hey Danilo,

      1. I get fullHD out of the box without any additional drivers. I don’t have a 4K display to test with yet.
      2. No, but someone in the XDA forum is working on it. Joystick requires working bluetooth afaik.

      3. I downgraded with NVIDAS’s flash_all and the rooted 1.3 developer firmware without exchanging any dtbs
      4. Yes, audio over HDMI works like a charm

  • Kostya Novikov

    > source cm-12.1/
    This produces the following error:
    mkdir: cannot create directory ‘../cmOutDir1’: Permission denied

    cd to cm-12.1 && source works

    Internal card reader didn’t work on my Mid2014 rMBP until I changed –usbehci to –usbxhci in Vargantfile

  • Edouard Griffiths

    Sorry but from point 3 on this is totally confusing:
    – where does initrd.tar.gz come from? I dont have this in /vagrant following the preceding steps
    – how is ~/cmOutDir1/boot.img constructed? I don have this either
    – from where is sudo fastboot flash recovery ~/cmOutDir1/boot.img executed? The VM, the host, the Shield?

    I am stuck here …

    You should also mention that these instructions are valid from a Mac OSx host only

    All in all I find this post totally useless.

  • Edouard Griffiths

    OK… let’s try on a more positive note. To build the image you need to look at this post: and open this in Google drive (without spaces): / sl6rMu this is where you can find the relevant files. These are:

    – the cpio directory
    – bootimg.cfg
    – init.c
    – Makefile

    You will rather get the zImage that you just built in cmOutDir/arch/arm64/boot

    Copy everything in a subdirectory of your Vagrant shared directory (as discussed in the main post).
    Log to the VM and cd to this directory
    Now you can type make and get the resulting boot image file. You will need abootimg installed as discussed in the main post.

    Also it took me time and look around to understand why you need to downgrade to 1.3 in fact this is just to be able to do a ‚fastboot boot command‘. In later versions this does not work and you need to flash the image as a recovery image and start the recovery kernel from the fastboot menu on the Shield. This is of course less flexible and makes you loose the recovery kernel you had there (ex: TWRP) but it should work.

    On the SD card you need only one ext4 partition where you copy all the rootfs files. The code in init.c should assign the root filesystem to the first partition of the external SD card. Make sure permissions are preserved. Alternatively you can tar.gz the rootfs you obtained on the VM transfer it to the host in /vagrant folder and untar it directly from the host on the first partition of the SD card. In addition this avoids all the hassle of having the SD card recognized in the VM.

  • hoohoo

    Thanks Tatsch, this is good info!

  • cpwfx

    Thanks for compiling this, excellent resource!

    Since nVidia released the L4T R24.1 it seems it’s possible to use this as well. Contains Vulkan support but based on 32bit Ubuntu 14.04 as L4T R23.1. Have you had a chance to test if this works?

    • jmtatsch

      I will wait for the 16.04 LTS coming in spring that also brings a 64-bit userland…

  • Praveen Kumar

    I downgraded by Shield TV 500GB to 1.3 by building it my PC.

    My device is stuck in boot loop.
    „android“ is appearing after Nvidia logo and again it is rebooting.
    Any pointer to boot my device

    Some of adb log:

    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/default/use_optimistic: No such file or directory
    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/dummy0/use_optimistic: No such file or directory
    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/eth0/use_optimistic: No such file or directory
    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/ip6tnl0/use_optimistic: No such file or directory
    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/lo/use_optimistic: No such file or directory
    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/sit0/use_optimistic: No such file or directory
    E/Netd ( 227): Failed to open /proc/sys/net/ipv6/conf/wlan0/use_optimistic: No such file or directory

    E/sdcard ( 251): missing packages.list; retrying

    E/gralloc ( 201): NvGrAllocExt: formats – internal 0x1, external 0x1 usage 0x1a00
    E/gralloc ( 201): NvGrAllocExt: formats with color space – internal 0x1, external 0x1 usage 0x1a00

    I/CameraService( 231): CameraService started (pid=231)
    E/HAL ( 231): load: module=/vendor/lib/hw/
    E/HAL ( 231): dlopen failed: library „“ not found

    • jmtatsch

      Can you still get into bootloader mode? When you have adb maybe you can ‚adb reboot bootloader‘?
      Then try reflashing the rooted 1.3 software…

      • Praveen Kumar

        I am able to boot to bootloader with help of keys.

        I tried flashing image from still no success.

        I saw one difference, the getvar all in my case is showing different address. Can it cause the problem?

        (bootloader) partition-size:userdata: 0x000000739e2ee200

        (bootloader) partition-type:userdata: ext4

        I got the shield console pro with firmware 3.0.0

        • jmtatsch

          I guess that your addresses are different because you have a shield pro. There is also a different recovery image for the shield pro. Make sure you flash that.

  • Julian

    (sorry for my bad english)

    Hi Tatsch, You’ve done an excellent job, Thank you.

    My name is julian, I am a student of engineering in Argentina. We acquired four consoles shield, with the intention to build a gpu cluster

    Could you help me with some concerns?

    1.(STEP 2). Because it is necessary to make a downgrade? Currently I have android, nvidia rooted version 3.0

    2.(STEP 3) whats is „‚the patched kernel source“? Where does it come from? which is modified from the original ? have any relationship with CyanogenMod?

    My intention is to compile the kernel from nvidia’s repo (;a=summary), do you think this is possible without dying in the attempt?

    Again I apologize for my English.

    From already thank you very much

    • jmtatsch

      Hi Julian,

      1) Fw 3.0 brought a new fixed bootloader, so I guess its not strictly necessary to downgrade anymore
      2) CableBurner from xdc-developers forum has gotten the kernel from Nvidia’s repo working. Have a look at apparently there are some issues with the latest version but 22r18 seems to work fine

  • Sasha Vingardt

    Hi Tatsch,
    thank you for the post. I’m able to boot into ubuntu (I see the console login screen) but I don’t see the machine on the network (arp -a) and not sure how to ssh into it. Any pointers? Do you log into it directly (keyboard) for the first time to set up networking?

    Thank you

    • jmtatsch

      I don’t remember for sure but I think I needed to log in with keyboard and screen first and then launch sshd.

      • Sasha Vingardt

        Was the login ubuntu/ubuntu? I’ve tried it and it’s not logging me in. Thank you!

        • jmtatsch

          Yes, it should be ubuntu/ubuntu. You get an alert that the password is wrong?

          • Sasha Vingardt

            Yes it keeps prompting me for login and password. Weird.

  • Billy Silly

    Tatsch, thank you for detailed and comprehensive instruction.
    But. I never understood why should I downgrade, as I succeeded booting a ready-made image (it was stopping at GUI but booting anyway).
    I did the downgrade and seemingly bricked the shield, no video, no adb, nothing but green led.
    In order for others to avoid massive pain in the a@@, I’d like you to clarify – is there a real need in downgrade?
    Thank you. Now am trying to unbrick…

    • jmtatsch

      Hi Billy, if I remember correctly the fw 1.3 then had the only stable boot loader. The 2.0 fw randomly crashed and bricked devices. Of course there may be much newer firmware now where that is fixed. Also there should be Ubuntu 16.04 with 64 bit userland now available from NVIDIA so I would not regard this post as current word by word instruction anymore.

      • Billy Silly

        Hey, I don’t ask you to unbrick it. 🙂 (but hey #2 – if you could, it’d be very nice.)
        I just advise you to update the article a bit. Maybe even using red caps. Do not downgrade if unsure – not to be caught like some Silly guy.