yashsingh1/xdaforums huggingface dataset:
[Shield Android TV General] yahoo2016:
I have tried to build L4T kernels using 2 different configurations:

(1). "tegra21_defconfig" which already has CONFIG_DEVTMPFS=y and CONFIG_ANDROID_PARANOID_NETWORK not set.

(2). modified "tegra21_android_defconfig" with CONFIG_DEVTMPFS=y and CONFIG_ANDROID_PARANOID_NETWORK=n

Neither can boot to ubuntu.

OP did no mention which tool chains he used, I suspect he used Android tool chains instead Linux tool chains.

When using OP's ".config", everyone seem getting the same errors which indicate wrong tool chains was used.

I have 0 experience on Android development, it seems to me the kernel for Shield TV should be Android kernel even the rootfs is ubntu or archLinux, unless boot loader is changed.

I'll start to learn Android SDK.

BTW, my fastboot seems work as expected, I can always push power button for 3~4 seconds to bring up fastboot and I can "sudo fastboot boot [boot.img]". I did get OTA update the first day I received my Shield TV, I then reverted to rooted ROM 1.3. Now I can bypass OTA.
[Shield Android TV General] crnkoj:
I'm not that kind of an expert in it either, but the problem certainly is that we don't get any output from it to debug the booting. There is an option to add the default output (hdmi etc) onto the cmdline of the kernel. It might be your initramfs is missing something. I find those things to always be terribly messy. As far as I know there no possibility of getting a serial console onto the shield or?
[Shield Android TV General] yahoo2016:
As I mentioned in almost all my posts, lacking of log is unacceptable for developers. I have tried "adb logcat", but it doesn't work in this case. (it worked for Android after Android is booted). I have opened my Shield TV and used an oscilloscope to probe many pads on PCB while booting, none seems have bits toggling like a serial console port (I had identified many embedded devices in this way). When I searched "Andriod boot log", I found many people complained about lacking of log during booting.

I tried to add "console=tty1" to command line but it did nothing.

It's possible to add netconsole. I have not tried it yet.

I have verified the problem is not ramdisk, I used the "nvidia_initrd.gz" generate by Makefile and zImage extracted from OP and it worked. So the issue is the kernel it self.

(I used "abootimg -x nvidia_boot.img" to extract zImage from OP's "nvidia_boot.img)

---------- Post added at 08:06 PM ---------- Previous post was at 07:59 PM ----------

You are the expert building twrp from source, can you make twrp print out logs while booting? I'm still trying to figure out it's boot loader or kernel issue without logging during boot.
[Shield Android TV General] Thanks_Meter:
I wonder if you tried ".config" from "kernel_headers.tbz2" from "Tegra210_Linux_R23.1.1_armhf.tbz2". If this is the configuration which leads to the big kernel which does not fit into boot/recovery partition you can activate "CONFIG_CC_OPTIMIZE_FOR_SIZE=y".
[Shield Android TV General] Steel01:
Is earlyprintk enabled? That should work. Reference [MENTION=4937137]Bogdacutu[/MENTION]'s Ubuntu stuff for the shield tablet. I don't expect there'd be a major amount of differences between that and this. Might be able to rip his command line directly to get the boot messages working. I think I recall something odd needing done, but I don't recall what.
[Shield Android TV General] yahoo2016:
The ".config" from "kernel_headers.tbz2" generated the same "Image" in "Linux_for_Tegra_tx1/kernel". It did not boot ubuntu.

I figured out why those images could not fix boot or recovery partition. The issue was due to OP's Makefile. The OP's Makefile has:

abootimg --create /tmp/boot.img -f bootimg.cfg -k [z]Image -r /tmp/nvidia_initrd.gz

where the the [z]Image file is in the same directory as Makefile and therefore makes the ramdisk "nvidia_initrd.gz" very large (8MB including compressed [z]Image).

The Makefile should be changed to something like:

abootimg --create /tmp/boot.img -f bootimg.cfg -k ../Linux_for_Tegra_tx1/kernel/Image -r nvidia_initrd.gz

i.e., the [z]Image file should be outside of Makefile directory.

My new ramdisk file (nvidia_initrd.gz) is only 480 KB, and my new boot.img files always fit into boot or recovery partition.
[Shield Android TV General] Thanks_Meter:
Ok, I already wondered why the kernel should be part of the ramdisk when it's already part of boot image. Do you still have the boot image from OP in the boot partition? I have the suspicion that this is the reason why I cannot boot anything from recovery anymore (not even the same boot image I have in boot partition).
[Shield Android TV General] crnkoj:
Nvidia keeps using weird console outputs for the lcds etc. That i remember from the old atrix days, ive searched a few posts up:

for instance there, serial console was over the headphone jack ^ ^

http://xdaforums.com/showthread.php?t=1081743

http://xdaforums.com/showthread.php?t=1141506 and here we could use the idea of dmesg in normal android tv to see the boot parameters, than perhaps use the console output

http://xdaforums.com/showthread.php?t=1190184 and here it seems nvidia uses weird console outputs

console=tty50,115200n8

i believe to remember that there was a post where they developed a custom kernel for it for android 4 where they managed to get the boot output to the atrix's screen, but i cant find it... ill look more

edit: found it http://xdaforums.com/search.php?searchid=397337843 might have to go through it.

UART/JTAG ist not possible here on the shield as you said.
[Shield Android TV General] yahoo2016:
I have OP's boot.img in "boot" partition for convenience since it always boots to ubuntu after power up.

To test other kernels (Android boot, Android recovery, Steel01's twrp and the kernels I built), I push power button 4s after power up (with OTG cable connected to laptop) to start recovery mode and use "sudo fastboot boot new_boot.img" or "sudo fastboot flash recovery new_boot.img".

Android boot, Android recovery, Steel01's twrp always worked.

My kernels got Nvidia icon, black screen for 10s then monitor went offline, no response to ping or Ctl-Alt-F1.

---------- Post added at 09:49 PM ---------- Previous post was at 09:40 PM ----------

"earlyprintk" is new to me. It seems twrp is a nice small program fits entirely in recovery partition of Shield TV (I did abootimg -i and abootimg -x to twrp.img). I may need to learn Android kernel and to enable boot logs by building twrp.

---------- Post added at 09:51 PM ---------- Previous post was at 09:49 PM ----------

It seems there is hope to make boot log working.

I'm too tired and need a nap. I'll be back.
[Shield Android TV General] Thanks_Meter:
I guess you already mentioned that you installed an old Android version. In version 2.1 neither holding power button to get into fastboot nor "fastboot boot" does work.
[Shield Android TV General] crnkoj:
weird, for me it worked without an issue (had to return mine for other reasons), but hope on the new one itll work too...

Edit: i tried it on the one i bought for my dad (obviously dont want to unlock/dev there), fastboot works if i have microusb in the shield and usb to a pc running linux, with the 4 seconds pwr button method, it however didnt work without the usb cable...
[Shield Android TV General] yahoo2016:
My Shield TV always needs OTG cable plugged to another laptop to have power button work.
[Shield Android TV General] yahoo2016:
Finally I was able to build working kernel for ubuntu on Shield TV from source.

Instead of from L4T kernel source, I used Android kernel source, e.g.:

https://github.com/CM-Shield/android_kernel_nvidia_foster

I used OP's .config file with only few (4) "N" answers.

In order to build kernel using Android kernel source I had to install Android compiler by:

sudo apt-get install gcc-arm-linux-androideabi
[Shield Android TV General] crnkoj:
is that with OPs rootfs?
[Shield Android TV General] yahoo2016:
It's ubuntu 14.02 LTS from L4T, not utopic from OP.
[Shield Android TV General] crnkoj:
but that one is not 64 bit if i understand correctly?
[Shield Android TV General] yahoo2016:
It's correct, but it has Cuda 7.0 support, I can run all Cuda 7.0 samples with decent benchmarks.

The next L4TX1 could be 64 bits.
[Shield Android TV General] raubtier2:
Hello yahoo2016,

thank you very much, that was very helpful.

I had a few problems to compile the kernel. I changed a few #include <*.h> to #include "*.h". But now I have a functional kernel, too.

Do you have an idea, where the big differences to the tx1-development-board-kernel-sources are?

My main problem still exists: 3840x2160-resolution with unity-desktop from the tx1-ubuntu-rootfs.

But it's good to know, how to compile a functional kernel. Thank you very much again. :good:
[Shield Android TV General] yahoo2016:
I was surprised by working kernels are more Android than Linux. E.g., Linux "lsmod" doesn't show any driver but the Android way of "ls /sys/module/" showed many drivers. That's indication the working kernels use Android directory structure.

Which source did you use? The OP seems pointed to the same source as L4TX1 but earlier version. I tried different configurations, but couldn't build working kernel from L4TX1 .

I believe the key to have working kernel for Shield TV is to build Android type kernel rather than Linux type kernel. It appears OP's ".config" made kernel be Android, but it's not compatible with later version of kernel source (I got 30+ questions when using OP's .config on new kernel source).

I do not have 4K monitor, but I do have issues with difference monitors, my current Ubuntu from L4T works for 1080P TVs and Dell 1920x1080 monitor, I can change screen resolutions. But I always got black screen when using 1920x1200 HP monitors. I'm sure it's nvidia driver issue, but not sure it's kernel or L4T rootfs issue. I recall people also have issues with Jetson TX1 for resolutions higher than 1920x1080.

Since Android for Shield TV works for higher resolution than 1920x1080, the solution may be somehow to use Android driver on kernel build for ubuntu, or wait for Nvidia to fix their driver.

I did not change #include <*.h> to #include "*.h" and still get some warnings, I had to change some "int err" "int ret"" to "int err=0" "int ret=0" to work around some errors.
[Shield Android TV General] yahoo2016:
Here is my latest updates:

(1). I used kernel source from:

https://github.com/CM-Shield/android_kernel_nvidia_foster

(2). I made the following changes to "cyanogenmod_foster_defconfig" in "android_kernel_nvidia_foster-cm-12.1/arch/arm64/configs":

CONFIG_VT=y

CONFIG_VGASTATE=y

CONFIG_BCMDHD_ENCRYPTED_NVRAM=n

CONFIG_DEVTMPFS=y

CONFIG_DEVTMPFS_MOUNT=y

(3). I installed 2 cross compilers (I use Intel X64 ubuntu 14.04 LTS):

sudo apt-get install gcc-aarch64-linux-gnu

sudo apt-get install gcc-arm-linux-androideabi

(4). I built new kernel by:

export ARCH=arm64

export CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-

export CROSS32CC=arm-linux-androideabi-gcc

export TEGRA_KERNEL_OUT=../cmOutDir1

mkdir $TEGRA_KERNEL_OUT

make mrproper

make O=$TEGRA_KERNEL_OUT mrproper

make O=$TEGRA_KERNEL_OUT cyanogenmod_foster_defconfig

make O=$TEGRA_KERNEL_OUT zImage

I found change to "CONFIG_ANDROID_PARANOID_NETWORK=n" is needed to have wired network working.

My 1920x1200 monitor is working with new kernel, I got black screen when using OP's kernel. The same rootfs from L4T was used in both cases. (My 1920x1080 monitor works with both kernels).

The above changes will allow booting to ubuntu desktop using L4T 23.1 rootfs.

To be able to boot to command line console such as archLinx, the following changes to "cyanogenmod_foster_defconfig" are needed:

CONFIG_DUMMY_CONSOLE=y

CONFIG_FRAMEBUFFER_CONSOLE=y

CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y

CONFIG_FB_SIMPLE=y

CONFIG_FB_NVIDIA=y

CONFIG_KEYBOARD_TEGRA=y

CONFIG_USB_SERIAL=y
[Shield Android TV General] kdb424:
I'm definately looking to run arch on my shield. Have you gotten a working graphics driver with cuda support yet as some Ubuntu images have? If so, any chance you'd make an image to share if it didn't work by default in the generic rootfs, which I assume it won't?
[Shield Android TV General] yahoo2016:
I have not gone beyond installing archLinux generic aarch64 rootfs. My main goal is to have Cuda 7.0 working for Tegra X1 without buying the $600 Jetson TX1.

Since Nvidia has not had 64bit user space L4T working, I don't believe they have Cuda 7.0 support for 64 bit archLinux.

It seems the 64 bit kernel I recently built using CM1.2 kernel source and the rootfs from L4T (32bit) have working graphics driver with Cuda 7.0 support, I'll wait for the next 64 bit L4T release to test 64 bit rootfs.

My suggestion would be to try ubuntu first before try other distributions since ubuntu is officially supported by Nvidia.

---------- Post added at 01:22 PM ---------- Previous post was at 01:14 PM ----------

I believe I found out why wifi and bluetooth are not working with OP's kernel and the new kernel I built.

In OP's .config and other defconfig files, "/systems" and "/data" paths are used for BCM firmware, but "/systems" and "/data" do not exist for Ubuntu.

I'm not sure what' the best way to include BCM firmware files, i.e., to include them in ramdisk or rootfs.
[Shield Android TV General] raubtier2:
Hello yahoo2016,

you made my day.

My new kernel build by your recipe works great. I got my 4K-resolution without a problem. It's really nice to have 3840x2160-resolution with my shield. Thank you very much again for your help. :good:
[Shield Android TV General] yahoo2016:
I'm glad the new kernel works for you and thanks for your feedback.

It's very convenient for me since I have 1920x1200 monitors at 2 different locations, they all working now with the new kernel.
[Shield Android TV General] raubtier2:
I tested my buildung this afternoon, and I am very happy with the results. Thank you again.

I was looking for a silent workstation with 4k-resolution for a while. But I didn't find a solution.

I bought a jetson-tk1-developement-board and was happy with it, but in the end you need a case

and a new fan (to noisy).

I bought my shield one day before the l4t-release for tx1 was announced, because it was available

for a short time in germany and I read this thread. Thank you again for jagger11, I think he made

a great work. But in the meantime I think, he could give a few more hints, how he gets his environment

working. If he reads the whole thread, he will be smiling about a few posts, I think. But I think,

he didn't read this thread for a longer time.

But again, thank yahoo2016, we have now a full working gpu-accelerated ubuntu-linux system

with 4K-resolution. no other arm solutions has a gpu-accelerated potential like this.

I was looking for rockchip (rk3288) and my hope was allwinner a80 (very frustrating) for gpu-acceleration

for x11, but all fail.

With your linux-kernel-recipe, the shield is my number one in the arm business for linux desktop, because the price for the shield console is falling and very competitive to other arm boxes.

Next steps, I think, is to achieve wifi and bluetooth working.

But the main hope is to get a full 64-bit-environment. It's a little bit disappointed, that the available

linux for the tx1-development-board is only 32 bit.

I don't understand, why NVIDIA presents no linux-environment for the shield-tv themselves, but again

jagger11 and you are my heroes. :fingers-crossed:
[Shield Android TV General] Thanks_Meter:
Are there any other advantages besides new screen resolutions (e.g. working shutdown) ?
[Shield Android TV General] yahoo2016:
Thanks for support from you and others.

I believe I found the problem of WIFI and BT, they use the same BCM chip, but the .config files point the path of firmware to non-existing "/system" directory.

Many people complained the 32 bit user space issue, Nvidia promised to address the issue in future L4T releases.

I agree the hardware of Shield TV is one of the best with price, performance and other features, the fw/sw can be improved in future.

---------- Post added at 09:03 PM ---------- Previous post was at 08:49 PM ----------

Others can confirm, but it appears Ubuntu shutdown works every time on my Shield TV with L4T rootfs.

Many members expressed desire to build kernel from source, when OP is not around, that's the only way to fix issues such as display, wifi, bt.

You may try to follow steps in Nvidia site to use "./applybinaries" instead of simply decompressing 3 tar files to SD card.
[Shield Android TV General] kdb424:
Anyone wanting to share a kernel that's bootable with the fixes included? I had a working install, then installed some programs, and while kodi was installing (Wanted to test) the screen went black, and ssh access was still avaliable. Upon reboot, I can ping it, but no screen or ssh access. Wondering if that may help.
[Shield Android TV General] yahoo2016:
I had many similar issues in the process of having more stable system. Is there a public folder allowing me to upload binaries?

I had OP's rootfs (the *.2G file) working only once, I'm using L4T roorfs. The following are steps to configure L4T rootfs from Nvidia site:

**********************************************************************************

INSTRUCTIONS:

1. Download the latest L4T release package for your developer system and the

sample file system from https://developer.nvidia.com/linux-tegra

2. Untar the files and assemble the rootfs:

sudo tar xpf Tegra210_Linux_R23.1.1_armhf.tbz2

cd Linux_for_Tegra/rootfs/

sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R23.1.1_armhf.tbz2

cd ../

sudo ./apply_binaries.sh

***************************************************************

after that you can "cd rootfs" and "tar -cpf ../rootfs.tar ." then mount SD card and "cd /mnt" and "sudo tar -xpf [the rootfs.tar]".
[Shield Android TV General] kdb424:
Thanks for the instructions. As for public folder, I recommend google drive as it lets you upload very big files for free. As for the binaries, I don't think that's quite my issue. It seems to be a kernel panic upon further inspection. I actually got Arch Linux working with the generic build, but it ended up having the same issue, so I'm starting to think that it really is a kernel panic which is another reason I'm looking for someone to post a kernel (the thing that's flashed with fastboot)
[Shield Android TV General] Thanks_Meter:
Ok, great! I tried to compile the kernel myself but I got lots of warnings. Now I wonder if I should suppress the "all warnings being treated as errors" to get it compiled. Which branch did you use?
[Shield Android TV General] yahoo2016:
Please try if you can access this file:

https://drive.google.com/file/d/0Bz5kaPQJx_AgZWZza3FqUXRVeEk

and the updated one to support booting to console without gui:

https://drive.google.com/open?id=0Bz5kaPQJx_AgUklNekxGeWFuNW8

---------- Post added at 11:22 PM ---------- Previous post was at 11:17 PM ----------

I used cm1.2 kernel source as mentioned in:

http://xdaforums.com/showpost.php?p=64330336&postcount=147

There should be only 2 compiler dependent fatal errors: uninitialized "int err; " and "int ret;" , I changed them to "int err = 0; " and "int ret = 0;", I ignored non-fatal errors.
[Shield Android TV General] Thanks_Meter:
Thanks. I got Image (19.379.280 bytes) and zImage (7.464.176 bytes). Now I wonder which one I should use for the boot image.

Maybe there is a chance to get nouveau working since there is a gm20b driver in the kernel sources. Then there is a future for the shield tv even if nvidia should stop to support for the tx1 one day.
[Shield Android TV General] yahoo2016:
Image should be used.
[Shield Android TV General] Thanks_Meter:
Yeah, shutdown does now work! You are my hero!:good:
[Shield Android TV General] yahoo2016:
It's easier to shutdown than boot up.;)
[Shield Android TV General] kdb424:
Downloaded that. I was stuck on the Nvidia splash screen. I have the 16GB model, but I don't think that matters.

Which kernel image were you using if you don't mind me asking.
[Shield Android TV General] yahoo2016:
I verified the "boot.img" after downloading it. I have 16GB model.

Fail to read SD card will cause stuck on the Nvidia splash screen, can you try power cycle or try different card?

My Shield TV won't boot with U3 SD card.
[Shield Android TV General] Thanks_Meter:
I used cm12.1 kernel source as mentioned in:

http://xdaforums.com/showpost.php?p=64330336&postcount=147

That is strange. My sandisk 16gb extreme pro 95 mbps micro sd card does work.
[Shield Android TV General] yahoo2016:
Sandisk should be the best with compatibilities, I ordered Sandisk 32 GB U1s first but the vendor cancelled my order due to out of stock and End-Of-Live. I ordered Kingston 32 GB U3s for similar price, they have many issues, e.g., they do not work for HP Zbook in SD card slot, but worked with USB adapter.
[Shield Android TV General] Thanks_Meter:
Maybe it's an option to install Ubuntu to some other device (e.g. internal emmc or external USB storage). I guess you just need to adjust the rootfs in the init application (hardcoded -> recompile) which is part of the initramfs.
[Shield Android TV General] yahoo2016:
If I want, I could modify "init.c" by changing

mount("/dev/mmcblk1p1", "/dest", "ext4", 0, NULL);

to:

mount("/dev/sda1", "/dest", "ext4", 0, NULL);

But my class10 SD cards worked just fine. I had very sluggish system with older kernel/rootfs and I thought it was slow SD card. My Shield TV is booting fast and very responsive now with new kernel/rootfs.

I'd like to keep Android and do not want to use emmc.

My top priority now is to figure out WIFI issue.

Wifi is working for my Shield TV!!!

If you check "dmesg | grep "failed"," you should see failed firmware download for BCM wifi chip. In the defconf files, there are lines:

CONFIG_BCM4354=y

CONFIG_BCMDHD_FW_PATH="/data/misc/wifi/firmware/fw_bcmdhd.bin"

CONFIG_BCMDHD_NVRAM_PATH="/data/misc/wifi/firmware/nvram.txt"

But "/data" does not exist for Ubuntu. You will need to create those 2 paths under Ubuntu rootfs. and use adb to pull those 2 files from your Shield TV when booting to Android and put them in the right paths. Or you could change the above paths and copy those 2 files accordingly. Those 2 files from your Shield TV should be the right ones for your WIFI chip and MAC address.

Since "nvram.txt" file is plain text file, you need to make sure "CONFIG_BCMDHD_ENCRYPTED_NVRAM=n"
[Shield Android TV General] kdb424:
Well, good news. I got arch back up and running. Using the stock kernel from the OP, I was able to just use the generic aarch64 image. Running on framebuffer, so video performance is just ok, vut I had vlc playing 1080p videos at watchable framerates. If anyone is interested in what all I installed, let me know. Other than that, I'm planning on trying to get the proper tegra drivers working at some point to get better video performance, though someone said above that they only support 32 bit now I believe. Once they are confirmed to work on 64 bit, I'll start work.
[Shield Android TV General] yahoo2016:
You may want to start a new thread with "archLinux 64 bits for Shield TV" like the OP for Ubuntu (actually Utopic) with instructions. Otherwise, it could be buried in many posts of this thread.

A list of features would be helpful, e.g., sound, wifi, BT, Cuda.
[Shield Android TV General] Thanks_Meter:
Too bad that I broke my Android installation. I tried some firmware I found via google but that didn't work. Does anyone know if there is a way to get access to these files via Ubuntu? Unfortunately in /data there are only symlinks to non existing destinations.
[Shield Android TV General] yahoo2016:
It's very easy to re-install any version of Shield ROM (rooted or unrooted) from Nvidia and use fastboot to flash.

I believe MAC and other device information are stored somewhere else (EEPROM?). Android pulls those information and create nvram.txt in /data.

I can access other Android partitions from Ubuntu except /data, I believe it's protected for privacy.

I had to use "adb su" to access /data from Android.