yashsingh1/xdaforums huggingface dataset:
[Shield Android TV General] Sompom:
With the risk of looking like an idiot, there is a very simple solution to fix the problem I was having which will possibly fix other's problems as well.

mount returns 0 on success. So just stuff it in a while loop and keep trying to mount until it works...

I am having 100% success rate with this mild hack.

Here is my init.c now:

#include <sys/mount.h>
#include <unistd.h>
#include <linux/reboot.h>
#include <fcntl.h>

//Half-assed debugging attempt
//#include <stdio.h>
//#include <errno.h>

extern char **environ;

int main(int argc, char **unused) {
int maxAttempts = 10;
int attempts = 0;

mount("/dev", "/dev", "devtmpfs", 0, NULL);

//mount returns 0 on success
while(mount("/dev/sda2", "/dest", "ext4", 0, NULL) < 0
&& attempts < maxAttempts){
sleep(1);
attempts++;
}

/*Commented out half-assed debug attempt, because I don't want to accidentally
trash my sdcard, and since I'm a terrible C programmer, that is very much a
possibility.
//Check if the mount appears to have succeeded
if (attempts == maxAttempts){
//Make some sort of attempt to poop out error information
if(mount("/dev/mmcblk1p1", "/sdcard", "msdos", 0, NULL) == 0){
FILE * fp = fopen("/sdcard/mountError.txt", "w");
fprintf(fp, "%d", errno);
fclose(fp);
umount("/dev/mmcblk1p1");
return -1; //Kernel panic! Yay!
}
}
*/
//fclose(fopen("/dest/touchLastBoot", "ab+"));
//mount("/dev/mmcblk1p1", "/dest", "ext4", 0, NULL);
//mount Android system
//mount("/dev/mmcblk0p19", "/mnt", "ext4", 0, NULL);
mount("/dev", "/dest/dev", NULL, MS_BIND, NULL);
chroot("/dest");
chdir("/");

char * const argv[] = { "/sbin/init", NULL };
execve(argv[0], argv, environ);
}

Note that I never hit the code in the "Half-assed debug attempt" block, because the while loop seems to be 100% effective. Since the only SD card I have around is the one out of my phone, which has lots of data that I'm too lazy to back up but which I still don't really want to lose, I have commented it out for safety.

I suspect that this works because it just takes the USB a little bit to be ready, so trying, waiting, and trying again is successful.
[Shield Android TV General] yahoo2016:
That's very smart way to make USB working, it could be extended to try different medias/partitions with the same kernel, similar to BOIS' boot orders.
[Shield Android TV General] rxg846zebra:
Clever indeed. If it really takes the USB some time to get ready, the action of pressing keys generates some delay in the process, so by the time mount USB is executed, the USB is ready? But why does it appear to be fine when booting from miniSD to USB adapter?

Maybe we can also use some other syscalls like getdents() so that we only mount when sda1 is present under /dev, so that we don't just keep mounting?

Anyhow, I have tried your solution and it solves my problem, thank you!
[Shield Android TV General] Sompom:
We could get infinitely clever, but probably the best solution is to chainload U-Boot or Barebox* and have it properly handle booting as, indeed, a bootloader is supposed to do ;)

Of course, that would require a working port of one or the other... Maybe I'll get some USB serial adapters and see if I can figure anything out...

*Does everyone here know of BareBox? I like it better thant U-Boot, and it seems to have more features. I haven't looked at it in awhile but, if I recall correctly, it "just works" with the older Tegra processors.
[Shield Android TV General] yahoo2016:
I agree with a better bootloader. I'm not familiar with BareBox. I was able to built U-boot for Jetson TX1, but it doesn't work for SATV unmodified.

Without serial console port, either netconsole or USBtty could be used for debugging bootloader. I'm too busy lately to work on bootloader.
[Shield Android TV General] rxg846zebra:
Is there any way to check the GPU core usage on SATV? Based on my readings, some people have used nvidia-smi and nvidia-settings in doing so, but I can't seem to find them on SATV. I've read something about Nvidia visual profiler as well, but I wonder how other people are doing it?

Thanks!
[Shield Android TV General] raubtier2:
Vulkan Support on L4T

Maybe somebody is interested:

Yesterday I installed on my Shield: Linux for Tegra (L4T) Release R24.1 Early-Access ("BETA")

see here:

(1) https://developer.nvidia.com/embedded/vulkan

This version supports the new Vulkan low level api to the GPU.

My experience:

The L4T version is very similiar to L4T R23.1. It's the same 32 bit stuff.

The prebuilt Vulkan SDK by NVIDIA (see (1)) is running. it's possible to run the demos inside.

One programm, vulkaninfo, program gives this output

c

There are to more examples in the SDK: cube and tri. Both are running but not very excited.

There is another example, see (1):

Vulkan Demo Program ("Chopper")

My experience: It's possible to compile the program. But the output from chopper_tx1 is the following:

That's not a very encouraging result.

For me it was a test for a new L4T version. It's still 32bit with vulkan support, but no newer Ubuntu version

(still 14.04). If you like to have a look into "vulkan", this is a possibilty, but it looks very "EARLY".
[Shield Android TV General] yahoo2016:
Thanks for the updates.

I have mixed feeling about Nvidia. Many users are waiting 64 bit user space L4T for months, it has been delayed again and again. Cuda performance of TX1 is not as good as TK1. Instead of investing resources for Vulkan, Nvidia should release 64 bit user space L4T and improve Cuda performance first.

It appears shield pre-release OTA did fix shield bootloader issues, but without other significant improvements, I'd rather stay with known good 1.3 bootloader until 64 bit L4T release.
[Shield Android TV General] NoDiskNoFun:
Hey there,

i just get my Shield TV. I build the initrd with USB support written by Sompom and combined it with yahoo2016's prebuild boot.img on Page 6 or 7 of this thread with abootimg. It boots up but without GUI (screen stays black but get Signal), i can ssh into the machine, but after about 3~5 minutes it reboots. I tried 2 different HDDs and 2 different Displays, also i tried L4T sample rootfs and ubuntu-core image with the same result. My machine is up-to-date version 3.0 MM. Should i downgrade it to 1.3 or what am i doing wrong?
[Shield Android TV General] NoDiskNoFun:
fixed it by flashing factory image 1.3 but android wont boot anymore, but that's okay. Anyways HDMI still doesn't work.
[Shield Android TV General] NoDiskNoFun:
Updated everythind to 14.04.4 and reinstalled nVidia driver now everything works like a charm.
[Shield Android TV General] yahoo2016:
Glad you have it working. The most important is to replace bootloader with 1.3 (or the latest 3.0 after it's proven) to have recover mode working reliably.
[Shield Android TV General] yahoo2016:
Rooted SHIELD Android TV Image 3.0 is available:

https://developer.nvidia.com/gameworksdownload#?search=SHIELD%20ANDROID%20TV%20Developer&tx=$additional,shield

There is instruction for flashing:

If your SHIELD device OS is currently running Android Lollipop or lower
(i.e. the Android version is less than 6.0) or you are unsure of the OS
version, follow these intructions:

*** Prerequisites:
1. Ensure that the bootloader is unlocked (see above step)
2. Ensure USB debugging is enabled and adb is working (when not
in fastboot mode)

*** Flashing instructions:
1. Execute these commands IN ORDER on the host PC:

adb reboot bootloader
fastboot flash staging blob
fastboot flash boot boot.img
fastboot reboot
adb wait-for-device
adb reboot bootloader
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash vendor vendor.img
fastboot reboot

Please note, the steps are different from instructions of previous releases, e.g., bootloader is reflashed first, and reboot after bootloader is reflashed. I believe this step is necessary to replace buggy bootloaders (1.4~2.1) before other steps..

Also, I noticed the step to reflash dtb is missing.

When I reflashed bootloader 3.0 and tried hardware recovery mode (hold power button for ~3 seconds), it does not work any more!!!
[Shield Android TV General] raubtier2:
For me it is possible to get to the fastboot menu:

Hold power button longer, till the menu appears.
[Shield Android TV General] yahoo2016:
I tried your approach and it worked. Did you reflash new dtb?

I found I can't boot into Ubuntu by "fastboot boot" or "fastboot flash" after update to ROM 3.0.

I was able to revert to rooted ROM 1.3 and boot to ubuntu again.
[Shield Android TV General] yahoo2016:
I was able to build kernel using cm13.0 source

https://github.com/CM-Shield/android_kernel_nvidia_foster/tree/cm-13.0

and boot to L4T R23.1 rootfs.

Configuration file for CM13.0, kernel image, and "boot.img" can be downloaded from the following link:

https://drive.google.com/file/d/0Bz...0Bz5kaPQJx_AgT1ZTWGxtQzBzSW8/view?usp=sharing

To have wifi working, the following 2 files from your SATV need to be copied to linux rootfs:

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

CONFIG_BCMDHD_NVRAM_PATH="/data/misc/wifi/firmware/nvram.txt"
[Shield Android TV General] raubtier2:
Maybe someone is interested.

I got a functional kernel from the official resources for the shield 3.0 version.

How to get it, see here:

http://nv-tegra.nvidia.com/gitweb/?p=manifest/android/binary.git;a=blob_plain;f=README_SHIELD;hb=rel-24-foster-r2-partner

You need to install 'repo' on your computer. Be careful, you get the full android sources. You need a lot

of space.

You can go into the kernel-subdirectory and compile a kernel (same procedure and Enviroment-Variables

as usual).

But you can use 'tegra21_defconfig' without corrections to get a kernel, that boots Ubuntu from L4T 23.1 or 23.2. I don't know if wifi or bluetooth is running.

My experience is, the main thing is to find a Kernel that fits to 'tegra210-foster-e-p2530-0930-e02-00.dtb' from the new 3.0 Version, if you like to use android and linux (from recovery partition or vice versa) together.
[Shield Android TV General] yahoo2016:
I have verified kernel built using source from above link and 'tegra21_defconfig' can boot to ubuntu.

Wifi is not working even firmware files are in the right folders and there is no error in "dmesg". 'tegra21_defconfig' may need to be modified to have wifi working..

When I used the configuration file from

http://xdaforums.com/showpost.php?p=65682781&postcount=202

and official shield 3.0 kernel source to build kernel , wifi is working.
[Shield Android TV General] crnkoj:
Hey, do you perhaps have the old firmwares lying around, nvidia removed them from their site and i mistakenly deleted them on my pc ...

thanks
[Shield Android TV General] yahoo2016:
Rooted ROM 1.3 is here:

https://drive.google.com/file/d/0Bz5kaPQJx_AgT3hOUzJhLUFlSzg/view?usp=sharing

Other ROM versions have bootloader bugs, please let me know if you need them (they are ~700MB each).
[Shield Android TV General] crnkoj:
thank yousir, well imade the mistake of upgrading one of my two shields to the 3.0 version, wanted to go back to 2.1 cuz on 2.1 i have a working system for dvb-s tuner, can i use t he 1.3 bootloader with the rest of the 2.1 system?
[Shield Android TV General] yahoo2016:
Rooted ROM 2.1 is below:

https://drive.google.com/file/d/0Bz5kaPQJx_AgeW10dGVKUmRucms/view?usp=sharing

I bricked my first SATV by using "flash_all.sh" to upgrade from ROM 1.3 to ROM 2.1.

I did downgrade from ROM3.0 to ROM1.3 without issue, I then upgraded from ROM 1.3 to ROM 3.0 without issue.

You may be able to use other files from ROM2.1 and boodloaders from ROM1.3 or ROM3.0.

Bootloader from ROM3.0 seems stable, recovery mode seems always work by holding power button until entering recovery mode.

Bootloader from ROM1.3 seems stable, recovery mode seems always work by holding power button ~3 seconds after power up.

Since I have not tried to use other files from ROM2.1 and boodloaders from ROM1.3 or ROM3.0, there may be risks.
[Shield Android TV General] crnkoj:
thanks, yes on 3.0, it first took me 1 hour to figure out how i can go to fastboot by button (have to hold it just after plugging inthe shield, than hold it approx 3 seconds than let it go and instantly hold it again for 2-3 seconds). Thanks

well if the 1.3 bootloader works for button fastboot thers no issue, the question is only if 2.1 system will work with 1.3 bootloader, im pretty sure pre 3.0 wont work with the 3.0 bootloader though.

btw have yougotten anywhere to using the 3.0 sources for a kernel?
[Shield Android TV General] yahoo2016:
I'm currently using SATV ROM 3.0 with boot partition replace by kernel built from both modified and original 3.0 source :

http://xdaforums.com/showpost.php?p=65682781&postcount=202

http://xdaforums.com/showpost.php?p=65692654&postcount=204

I have L4T 23.1 in external SD, SATV 3.0 kernel in recovery partition, I can dual boot Ubuntu or SATV 3.0:

http://xdaforums.com/shield-tv/general/trick-to-dual-boot-android-ubuntu-os-t3324994
[Shield Android TV General] crnkoj:
thanks, i need to get normal 3.0 kernel , basically stock to work recompile with the dvb components, have 2.1 with working dvb-s, tvheadend and kodi on the other one, so figuring if its easier to just backup it and restore to second one or to try to get dvb and tvheadend to work on 3.0...

btw do you have experience with any of the custom recoveries?
[Shield Android TV General] yahoo2016:
I believe to build SATV 3.0 kernel from official shield open source should be similar to building linux kernel from the same source, except the "defconfig" files are different. I can try that when I have time.

By "custom recoveries", do you mean:

http://xdaforums.com/shield-tv/general/recovery-twrp-2-8-6-0-shield-tv-variants-t3140926

I had built twrp from source (cm12) following the posts from steel01 in the above thread, but was not able to build twrp 3.0 from cm13 source, I got some errors using source from twrp 3.0. Since I mainly use linux, I did not spend more time on building twrp 3.0.

I'm sure steel01 can help on building twrp from the latest source.
[Shield Android TV General] crnkoj:
ah, dont waste too much time, ill first try to downgrade and see than, as far as i can tell 3.0 doesnt bring any real advantages over 2.1... and on 2.1 i have everything working. i wonder if i can use the cm12 twrp with 2.1, i guess it should work
[Shield Android TV General] dprovinciani:
Hi, i try to compile the source:

github.co m/CM-Shield/andr oid_kernel_nvidia_foster/tree/cm-13.0

with the configuration file that you share on google drive "satv30_defconfig" but the compilation process fails.

The output of the compilation process is:

pastebin.co m/0u9hgrPG

Have you any idea what happen..?

P/D: Sorry but i not able to paste URLs

System:

Linux shieldteam 3.16.0-62-generic #83~14.04.1-Ubuntu SMP Fri Feb 26 22:52:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Compilation tools version: 4.8

Compilation script:

export ARCH=arm64
export CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-
export CROSS32CC=arm-linux-androideabi-gcc

export TEGRA_KERNEL_OUT=../outCM13satv30

mkdir $TEGRA_KERNEL_OUT

make -j9 mrproper
make -j9 O=$TEGRA_KERNEL_OUT mrproper

make -j9 O=$TEGRA_KERNEL_OUT satv30_defconfig

make -j9 O=$TEGRA_KERNEL_OUT zImage
[Shield Android TV General] yahoo2016:
It seems you have a file missing:

/root/cm-shield-kernel-nvidia-foster/cm-13.0-original/sound/soc/tegra-alt/tegra_t210ref_mobile_alt.c:33:29: fatal error: mach/gpio-tegra.h: No such file or directory

Sometimes re-download kernel source file may solve the issue.

I'll check if that file exists in my local copy of CM13.0 when I get home from work.
[Shield Android TV General] dprovinciani:
Thanks for help me..! I tried to download again the source code and the file exist now. The compilation process ends successfully and i can to boot with this build. I can't know because the first download was incomplete.

Another ask... Which configuration file you used to generate the file that you are sharing?

I am interested in knowing that you had to change so that this kernel made to work with android system, can be used with a ubuntu system.

Thank you very much again.
[Shield Android TV General] yahoo2016:
That's a good question, I had to find the right defconfig file to start with. It turned out to be the "cyanogenmod_foster_defconfig" in "arch/arm64/configs".

I have comments in "satv30_defconfig" for what I had changed, you can confirm it by diff "satv30_defconfig" with "cyanogenmod_foster_defconfig".
[Shield Android TV General] mkrists:
Hi all!

I am thinking of building a small AIO PC from 22" 1080p monitor and Nvidia Shield TV or Atom Z8300 stick.

Before going Nvidia route, I would like to understand few things:

1. How reliable is Shield TV dual booting setup of Ubuntu & Shield Android OS?

2. Do you feel Shield TV w/ Ubuntu can be used as a daily pc?

3. Can I use Ubuntu fully the same way as for example running it on some cheap X86 Atom setup?

4. How is the Shield's performance in Ubuntu environment? Is the system responsive doing some casual actions like browsing the web, word processing , code editing, etc? For example, I find Raspberry PI2+Linux a bit slow for using it as a daily PC .

5. What is the status of 3D acceleration under Ubuntu? Can i play some emulator games or some older titles like Quake/ Doom etc.? If not - does it affect 2D performance of Ubuntu environment?

Thank you for the answers in advance!
[Shield Android TV General] yahoo2016:
(1). I never had issue to switch between Ubuntu & Shield TV stock Android OS (3.0) using power button:

http://xdaforums.com/shield-tv/general/trick-to-dual-boot-android-ubuntu-os-t3324994

(2). I'd use used laptops as daily pc. Used laptops can cost less than Shield TV, be more powerful without external keyboard, mouse and monitor and run Windows.

(3). Shield TV is more powerful than Atom, but some software may not run for ARM processor of Shield TV.

(4). Shield TV is far more powerful than Raspberry PI2. You can find benchmarks of Shield TV running Ubuntu 15.

(5). Tegra X1 GPU in Shield TV is very powerful, however, L4T file system for X1 is still 32 bits. Performance should improve when Nvidia releases 64 bit L4T for X1. Some software may not run on ARM processors.
[Shield Android TV General] bobekfpj:
I wish someone would make a blog showing a tutorial for noobs, like me :)

With some screenshots and more holding hands tutorial.

It has been a year and there is absolutely zero presence in youtube, com on people make some noobs happy :)

Even if I would just like to just boot into ubuntu image to try it out, reading all this side stuff in this forum is exhausting to understand.

Did anybody try this stuff with latest L4T - R24.1 Early-Access ("BETA") Vulkan - February 2016 or Jetson TX1 R23.2 - March 2016
[Shield Android TV General] festivus_muppet:
Using 3.0 Dev Rooted and L4T 23.1 file system

I was not able to boot with this boot.img file, just hangs at nvidia screen.

Using 2.1

I was able to downgrade to 2.1 and boot the system in the OP however it was unstable when I flashed the boot.img to the device for persistence- USB was unusable.

When downgrading, it was necessary to boot the recovery kernel, then hold down the powerbutton (when you see the dead droid) until the recovery menu pops up and format the device.

Does anyone have a good kernel for 3.0? Or has anyone experienced the issues with the 2.1 kernel?

Have any others had success building a kernel for 3.0?
[Shield Android TV General] yahoo2016:
http://xdaforums.com/showpost.php?p=65682781&postcount=202
[Shield Android TV General] festivus_muppet:
Tried this- for me it just hung at the nvidia screen-

I did the rsync of the L4T 23.1 rootfs to microsd, downloaded the boot.img file from the google drive link that you have posted but it doesn't seem to like the boot.img file.

I apologize- I was using a 4K TV for this... for whatever reason the boot sequence didn't display for the 3.0 kernel while the 1.3 kernel post was able to render the boot. Most likely due to the 4k tv. The kernel did boot, I was just being too impatient. :x oops!
[Shield Android TV General] yahoo2016:
I had rooted ROM 3.0, I just updated to rooted ROM 3.1 from

https://developer.nvidia.com/shield-developer-os-images

I was able to boot to SATV 3.1 after upgrade.

I then flashed recovery partition with "boot.img" from the above google drive and was able to boot to L4T 23.1.

I just saw your update, I did not try 4K TV or 4K monitor, there may be some issues for some 4K TVs or 4K monitors.
[Shield Android TV General] festivus_muppet:
I was able to sort out my issue, your original method for the rootfs copy was the solution. It was a permissions error caused by extracting the rootfs tbz2 archive using sudo tar... and then using the rsync command to copy the contents.

Using:

cd /mnt/sdcard

sudo tar -xpfj ~/Downloads/Tegra_Linux_Sample-Root-Filesystem_R23.1.1_armhf.tbz2

Was the solution to my permissions issue, thanks for posting the boot.img and sharing your experience.
[Shield Android TV General] yahoo2016:
I ran into the same problem when using "rsync" today while copying rootfs from L4T24.1, I changed the first post back to my original method.
[Shield Android TV General] bfall17:
Those two files to get wifi working...is there a way to get them off the device? I can't extract them from a release build device...do I need to do a full build and take them from there?
[Shield Android TV General] yahoo2016:
If you can boot to ubuntu, you can try "sudo find / -name fw_bcmdhd.bin". you should find "fw_bcmdhd.bin" under "*/vendor/firmware/bcm4354".

You can also try "sudo find / -name nvram.txt" to find a copy of "nvram.txt" which you can access and change the MAC address.

The first post should have a link to those 2 files.
[Shield Android TV General] yuan.wang:
Confuse about installing Ubuntu on SATV

Hey mate：

Thank heaps for sharing the experience of building L4T on SATV.

I was very impressive by the hardware configuration and performance of SATV, so I bought the SATV pro model and attempt to install(or flash, build) linux on it and hopping to compile toolkits like openCV and build some of the robotics vision like apps on it.

I read the link you give at the very beginning carefully and attempted a few times:

http://xdaforums.com/shield-tv/general/ubuntu-utopic-nvidia-shield-tv-t3150352

I did the 'fastboot oem unlock' first to unlock the SATV and got a successful information on windows cmd

then, following the instruction, I put the linux system img file(tried both utopic and xenial) given the google drive (adress provided in the link) img into a micro and plug into the SATV sdcard slot, set as removable storage.

then I started the SATV boot loader by command 'adb reboot bootloader' and successfully enter the SATV boot loader.

And followed by trying both method mentioned in the post of doing

a) fastboot boot nvidia_boot.img (in windows cmd)

b)fastboot flash recovery nvidia_boot.img (in windows cmd)

and reboot choosing 'boot recovery kernel' in SATV bootloader

for both attempt I end up getting a nvidia logo screen and followed by a black screen. with starting normal andriod 6.0 as nomal at the end, without installing or booting into linux.

I also read your post carefully but as Im still new to both linux and andriod, it seems too complicate for me to build kernel from source and boot Ubuntu

Still eager to do the work, and you seems to be an expert on both linux and SATV, I want to ask if I miss any step or any file in the above process. Or if there are any detail or easier linux installation instruction on SATV.

Sincerely thanks for your help! :)

all the best

Jim
[Shield Android TV General] yahoo2016:
I do not recommend use SATV ROM between 1.4 and 2.x because they are more likely to brick SATV.

Pre-built "boot.img" for ROM 3.x can be downloaded from:

http://xdaforums.com/showpost.php?p=65682781&postcount=202

The first post has instructions on how to download and flash L4T 23.x rootfs to micro SD.

L4T 24.1 will not work.

I noticed you have SATV Pro, I only have SATA 16GB and can't verify if the "boot.img" works for SATA Pro.