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

Bogdacutu

Senior Member
Nov 5, 2012
407
833
0
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
0
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
0
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
0
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
0
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.
 

joshtheitguy

Senior Member
Nov 23, 2006
138
47
0
Cleveland
Try doing
Code:
sudo apt-mark hold xserver-xorg-core
before doing the upgrade, to prevent the driver from being overwritten.
Thanks, that was the command I couldn't remember. Let me do a backup of it first then I will try again to see if the outcome is any different, I'll let you know how it goes once I have a chance.
 

etienne51

Member
Sep 25, 2005
32
30
0
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
0
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
0
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
0
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
0
How is HDMI out? I find it mildly function on Android, can I expect the same from Ubuntu? Also, I didn't see if LTE is supported.
No idea if HDMI works, I don't have a cable (my patch might break it though, in which case we'll probably need to change it). And it works on LTE tablets, but mobile data doesn't work (at least for now).
 
  • Like
Reactions: elite-NSX

Bogdacutu

Senior Member
Nov 5, 2012
407
833
0
/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,253
2,799
143
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: