• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Linux4Tegra R23.1/R24.1 beta for the Shield Tablet

Search This thread

Bogdacutu

Senior Member
Nov 5, 2012
407
833
Stuff that doesn't work: 3G/LTE, accelerometer, GPS, camera, and maybe some other stuff that I'm not remembering
Stuff that does work: GPU (full OpenGL 4.5 and Vulkan), sound, USB device and host, WiFi, Bluetooth, touchscreen (including stylus), SD/USB install

Downloads:

Installation instructions:
  1. Install MultiROM (+ TWRP + touch support + patched kernel)
  2. Download Linux4Tegra and install it through TWRP (Advanced -> MultiROM -> Add ROM)

Tips/notes:

 
Last edited:

Bogdacutu

Senior Member
Nov 5, 2012
407
833
I am *very* interested in knowing which kernel you have used for this. Upstream, L4T, Android? This looks very promising in any case.

I've tried L4T 21.2, 19.3 and Lollipop. All of them need a small kernel patch (which might break HDMI, I have no idea) for the graphics to work, but apart from that they should all work fine for the most part.

Code:
In drivers/video/tegra/dc/dc.c, in tegra_dc_probe, after "int i;" add:

        static int num_probed = 0;
        if (++num_probed > 1) return -ENOENT;

Edit: this actually isn't needed, I was just using the wrong cmdline
 
Last edited:

Bogdacutu

Senior Member
Nov 5, 2012
407
833
Getting Started

THESE INSTRUCTIONS ARE OUTDATED. CONSIDER USING THE PREBUILT INSTALLER FROM THE MAIN POST INSTEAD!

You need a computer with Linux installed and some free space (I don't have the exact numbers, but 5GB would probably be enough). On the tablet, you need 2-3GB of free space (on the internal memory), an unlocked bootloader , root and you need Busybox installed too.

On the computer, you'll need to compile your kernel first (this guide includes the compiler, and there's a prebuilt boot.img in the attachments if you want to skip this part). I recommend using https://github.com/Bogdacutu/STLinux-Kernel, with st8_linux_defconfig.

The initramfs is pretty simple, it just mounts the relevant system partitions and loads Linux from them: https://github.com/Bogdacutu/STLinux-Initramfs. You'll need to edit KERNEL_PATH in build.sh and make the kernel beforehand, then running build.sh will result in a boot.img which you can boot with fastboot:
Code:
fastboot boot new_boot.img -c "console=tty1 fbcon=map:10 fbcon=rotate:2 fbfix"

For the rootfs, Linux4Tegra is the easiest place to start from. All the Tegra K1 versions should work fine. For example, with R21.2: (the sudo is necessary there)
Code:
$ wget http://developer.download.nvidia.com/mobile/tegra/l4t/r21.2.0/pm375_release_armhf/Tegra124_Linux_R21.2.0_armhf.tbz2
$ tar xfvj Tegra124_Linux_R21.2.0_armhf.tbz2
$ cd Linux_for_Tegra
/Linux_for_Tegra$ wget http://developer.download.nvidia.com/mobile/tegra/l4t/r21.2.0/pm375_release_armhf/Tegra_Linux_Sample-Root-Filesystem_R21.2.0_armhf.tbz2
/Linux_for_Tegra$ cd rootfs
/Linux_for_Tegra/rootfs$ sudo tar xfvj ../Tegra_Linux_Sample-Root-Filesystem_R21.2.0_armhf.tbz2
/Linux_for_Tegra/rootfs$ cd ..
/Linux_for_Tegra$ sudo ./apply_binaries.sh
/Linux_for_Tegra$ cd rootfs
/Linux_for_Tegra/rootfs$ sudo tar cfvj ../rootfs.tar.bz2 .
The resulting rootfs.tar.bz2 you'll need to somehow get on the device. For the next part, I'll assume it's in /sdcard/rootfs.tar.bz2. You'll need to do this on the device (through ADB or through Terminal Emulator)
Code:
$ su
# cd data
/data# mkdir linux
/data# cd linux
/data/linux# tar xfvj ../media/0/rootfs.tar.bz2

Enabling Bluetooth with brcm_patchram_plus:
Code:
$ sudo brcm_patchram_plus -d --patchram /system/etc/firmware/bcm43241.hcd --baudrate 3000000 --enable_lpm --enable_hci --use_baudrate_for_download --no2bytes --tosleep 1000 /dev/ttyTHS2

Prebuilt boot images:
  • new_boot(80).img - working WiFi and sound
  • new_boot(90).img - added pointer emulation to touchscreen driver
  • new_boot(94).img - fixed Bluetooth stability
  • new_boot(114).img - fixed HDMI, added support for non-LTE partition table, my tegra driver patch is now optional (without it fbcon doesn't work properly, enable by adding fbfix to cmdline)
  • new_boot(123).img (newest at the moment) - fbfix isn't needed anymore, added support for tmpfs ACLs, enabled XZ compression (because after reaching a certain size, the kernel wouldn't find the initramfs anymore), enabled KVM
 
Last edited:

joshtheitguy

Senior Member
Nov 23, 2006
138
47
Cleveland
Unless you are looking to completely break the Ubuntu install, do not perform a release upgrade to 14.10.

Everyone here probably already knows this but I wanted to see what would happen, which was rendering the x-server unusable. These results did not surprise me but hopefully this will save someone else who has the same idea as I did some time.
 

Bogdacutu

Senior Member
Nov 5, 2012
407
833
Unless you are looking to completely break the Ubuntu install, do not perform a release upgrade to 14.10.

Everyone here probably already knows this but I wanted to see what would happen, which was rendering the x-server unusable. These results did not surprise me but hopefully this will save someone else who has the same idea as I did some time.

Try doing
Code:
sudo apt-mark hold xserver-xorg-core
before doing the upgrade, to prevent the driver from being overwritten.
 

etienne51

Member
Sep 25, 2005
32
30
What works:
  • Audio
  • WiFi
Got it working thanks to /u/GenuineAster, will post a full guide in a day or two.

I got my tablet 2 days ago, and I'm already trying to mess up with it... I decided to try to install Ubuntu on my Shield Tablet (WiFi only, EU model).

So basically, I managed to boot it up thanks to you tutorial. It seems to be working well, but there are some things that does not work, and I see you apparently solved those issues already...

The issues I have are the following, ordered by priority:
- No WiFi (I see that you apparently solved this issue, can you please explain how you managed to do that?)
- While I was writing this message, I went to keyboard layout options, and the OS crashed, it went back to login screen twice (I was on the same window each time, it showed nvidia black screen, then the login screen)
- No audio (I only have a device named "Dummy audio input/output", you seem to have audio, can you confirm that?)
- Graphics flickering on some textures, for example, on the main sidebar menu, when my mouse pointer is over an icon, there is a background on that icon, but the background is flickering, that's weird...
- No touchscreen (But you don't neither)

For the moment, I think the most important thing is WiFi, since I can't do anything without network connexion. Can you help me with that? Thank you!
 
  • Like
Reactions: elite-NSX

Bogdacutu

Senior Member
Nov 5, 2012
407
833
I got my tablet 2 days ago, and I'm already trying to mess up with it... I decided to try to install Ubuntu on my Shield Tablet (WiFi only, EU model).

So basically, I managed to boot it up thanks to you tutorial. It seems to be working well, but there are some things that does not work, and I see you apparently solved those issues already...

The issues I have are the following, ordered by priority:
- No WiFi (I see that you apparently solved this issue, can you please explain how you managed to do that?)
- While I was writing this message, I went to keyboard layout options, and the OS crashed, it went back to login screen twice (I was on the same window each time, it showed nvidia black screen, then the login screen)
- No audio (I only have a device named "Dummy audio input/output", you seem to have audio, can you confirm that?)
- Graphics flickering on some textures, for example, on the main sidebar menu, when my mouse pointer is over an icon, there is a background on that icon, but the background is flickering, that's weird...
- No touchscreen (But you don't neither)

For the moment, I think the most important thing is WiFi, since I can't do anything without network connexion. Can you help me with that? Thank you!

I just updated the boot.img from post #4, WiFi and sound work now, Bluetooth works if you load firmware but it's pretty unstable at the moment.
 

etienne51

Member
Sep 25, 2005
32
30
Ok, I just tested it, and I confirm it works! I haven't tried bluetooth for the moment, but I have WiFi and audio now with v80. Thank you for the update!

I have another question, I saw your previous screenshot showing glxgears running at around 900-1000fps. Since I have some small lags sometimes, I decided to try glxgears and I'm running at around 450fps, that's less that half the framerate you have on your Shield Tablet. Did you do something special with the drivers after the tutorial you wrote?
 

Bogdacutu

Senior Member
Nov 5, 2012
407
833
Ok, I just tested it, and I confirm it works! I haven't tried bluetooth for the moment, but I have WiFi and audio now with v80. Thank you for the update!

I have another question, I saw your previous screenshot showing glxgears running at around 900-1000fps. Since I have some small lags sometimes, I decided to try glxgears and I'm running at around 450fps, that's less that half the framerate you have on your Shield Tablet. Did you do something special with the drivers after the tutorial you wrote?

Not really, you can try messing with the governors and max frequency, iirc there's a script in the driver package that automatically sets the CPU frequency lower on boot.
 
  • Like
Reactions: elite-NSX

Bogdacutu

Senior Member
Nov 5, 2012
407
833
/u/GenuineAster confirmed that HDMI isn't working. I'm going to get an Ethernet adapter for netconsole soon, so that I can find out why it doesn't work with my patch to the tegra driver (which I'm sure is the reason HDMI isn't working). I'm also working on a way to get libGL.so to work in an i386 chroot (so that we can try to play desktop games that aren't compiled for ARM yet).
 

Steel01

Recognized Developer
Dec 14, 2008
1,266
2,811
I'm impressed that this actually works so well. Makes what I have on my Shield Portable look pitiful. No sound, no video acceleration, etc. Now the question is, what changes have to be made to a mainline kernel to get similar results? Well, minus the video acceleration that's likely hard-coded to a specific kernel version. Bogdacutu, do you have a patch of your changes? Your github repo isn't a forked copy of the kernel, so it's hard to see the initial changes. I'd like to get a copy of Fedora running. Also looking forward to your touchscreen fix. My usb-otg cable is flakey to the point it causes Ubuntu to reboot if I bump it too much...

Question to the larger community: Anyone know how to get the wireless controller to work with this? I poked at wpa_cli and a couple of the p2p_ commands, but so far haven't picked up anything from the controller when it's searching.

Edit: Seems the otg charging thing doesn't work either. Makes long-term use impracticle when an input device has to be plugged in. Any of the kernel hackers know the bits that changed in nvidia's lollipop kernel to allow this?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 55
    Stuff that doesn't work: 3G/LTE, accelerometer, GPS, camera, and maybe some other stuff that I'm not remembering
    Stuff that does work: GPU (full OpenGL 4.5 and Vulkan), sound, USB device and host, WiFi, Bluetooth, touchscreen (including stylus), SD/USB install

    Downloads:

    Installation instructions:
    1. Install MultiROM (+ TWRP + touch support + patched kernel)
    2. Download Linux4Tegra and install it through TWRP (Advanced -> MultiROM -> Add ROM)

    Tips/notes:

    12
    Linux4Tegra R23.1 has been released; it's for the Tegra X1, but the GPU drivers seem to work fine on the K1 too, so I'll probably release a new package this weekend (also going to add SD/USB boot support for MultiROM).
    7
    Successfully started linux on BitO kernel. Everything works except multirom, including xorg driver, suspend, bt, wifi. Touchscreen works after fixing driver reports. I used fastboot to run kernel, so we need to fix multirom with kexec-hardboot patch to make it work correctly.
    Other way is reflash kernel every time, or use it instead of recovery, but both usage is dangerous

    Kernel patch:
    http://pastebin.com/xdVAm08t
    Kernel config:
    http://pastebin.com/RSNVw5HG
    Based on bito-k10 source (BitO-K10-011,2596fbe41fa94eb894a618243619270295741a33)
    Android system partition mounted to /system to make firmwares load correctly

    P.S Finally got kexec-hardboot to work, but kexec'ed kernel ignoring initrd image from kexec and trying to boot android.

    Found workaround: hard-coded full path to installed multirom root, disabled compressed initrd support to prevent using bootloader's initrd.
    ==================================================
    Working 3.10.106 kernel for Ubuntu

    What works:


    1. wifi
    2. bluetooth
    3. touchscreen
    4. suspend
    5. nvidia drivers

    What does not work:

    1. Passing any command-line or initrd from kexec-hardboot. Command-line is hard-coded, need recompile to change it. initrd is linked in, external initrd support disabled
    2. ext4 ACL is broken, so mount tmpfs to /media to make udisks work
    3. loadable modules disabled
    4. Suspend while charging. It disabled in dtb, android kernel does not enter deep sleep when charger connected too.

    Only installing to /data partition works. You will need to rebuild kernel to run from different partition or change command-line

    Kernel binaries, source and Install Instructions:

    https://github.com/mittorn/android_kernel_nvidia_shieldtablet/releases
    Based on BitO-K10

    Cool, for finally getting "something workable" to readily install on.

    But I, for one, think ubuntu is by now a dead end.
    If I was you, I'd try to get aboard the postmarketOS bandwagon.
    I only prepared kernel for already released build. Kernel should work with any distro that uses glibc and have xorg-server 1.15 availiable (L4T drivers compatibility), but adding drivers to other distro and configuring it means big amount of work. It's better to spend this time doing something in ubunto than just setting up other distro.
    PostmarketOS based on Alpine, which using musl, not glibc. It will be incompatible with nvidia drivers and with android drivers too.
    Also, musl does not support some development utilities which i need. For example, address sanitizer will not work under alpine. So postmarketos is not choiсe for me at all

    So wait, did the initrd issue only crop up when using kexec/multirom or was the bootloader always meddling with the initrd somehow?
    That might explain some of my issues getting non-Android OSes to work...
    It seems to be a kernel and bootloader issue. Kernel reads initrd from address got from dtb, which is patched by bootloader (nvidia blob). And default initrd from boot.img still present here
    But kexec or kernel unpacker/relocator places it to different places. I do not want spend much time now searching what stage actually broken (already spent almost 2 days), embedded initrd/commandline is enough for me, but it is not enough for multirom.
    It is better to contact custom kernel developers, they should know.

    `/dev/mmcblk0p13 /system/ auto ro 0 0`
    looks like partitions table was change on some point - it's a `mmcblk0p14` in 5.4 firmware, while before it was 13 for non-LTE version. for LTE +1
    can you share you firmware version?
    it is Android 7.0 and non-lte tablet

    Hey,

    shouldnt it be possible to install mainline kernel and arch linux since the Acer CB5-311 Chromebook which have a TK1 does work nice with mainline+mesa+nouveau. --> Arch Linux ARM | Acer CB5-311 Mainline.

    i tried to boot the kernel i got inside bootfolder of my Acer CB5, but this ended in a black screen. Anyways i didnt do some modification to it and also havnt installed any linux on the shield (hoped for a busybox cmdline or error message). I dont now if fastboot is even capatable of booting a 4.x kernel but if this is possible than we could install an up-to-date linux on this devices, which, for my Chromebook, would run supersmooth.

    I think it is not possible. Mainline kernel needs mainline u-boot, but NST has signed nvboot bootloader. If you flash boot loader that not able to start, you will never unbrick tablet
    7
    Howdy

    3CN7Lgd.png
    7
    Uploaded R23.1, link is in the first post. SD/USB boot now works properly, USB device mode also works without any additional configuration, and the screen is now properly rotated during setup.