Build kernel from source and boot to Ubuntu using L4T (Linux for Tegra) rootfs

Search This thread

ithuestad

Member
Oct 12, 2010
7
1
I've been playing around with the Shield for a while now, and would love to flash the boot image to native storage along with the contents of the SDcard. It looks like 'fastboot flash boot \path\boot.img' should work as long as I choose the proper image to boot from the emmc. However I'm having difficulty finding out how to move rootfs to the emmc. I'm wondering if there is a straight forward way such as 'fastboot flash rootfs' ? Any help would be greatly appreciated.
 

yahoo2016

Senior Member
Nov 24, 2015
392
88
I've been playing around with the Shield for a while now, and would love to flash the boot image to native storage along with the contents of the SDcard. It looks like 'fastboot flash boot \path\boot.img' should work as long as I choose the proper image to boot from the emmc. However I'm having difficulty finding out how to move rootfs to the emmc. I'm wondering if there is a straight forward way such as 'fastboot flash rootfs' ? Any help would be greatly appreciated.
It has been a while, as I recall, you boot to Ubuntu on SATV SD card first, then extract L4T24.2.1 rootfs to a folder on SD card and apply binaries as you did on ubuntu host PC.
You can then change to rootfs folder and use:
sudo cp -a * /dev/mmcblk0p29 && sync
to install rootfs on User Data partition. You'll not be able to use Android after User Data partition is overwritten.

Then you will need to flash "mmcblk0p29.img" from the link on the first post to boot partition.

You should notice ubuntu boots much faster from emmc than from SD card.
 
Last edited:

crnkoj

Senior Member
Feb 16, 2011
1,841
397
It has been a while, as I recall, you boot to Ubuntu on SATV SD card first, then extract L4T24.2.1 rootfs to a folder on SD card and apply binaries as you did on ubuntu host PC.
You can then change to rootfs folder and use:
sudo cp -a * /dev/mmcblk0p29 && sync
to install rootfs on User Data partition. You'll not be able to use Android after User Data partition is overwritten.

Then you will need to flash "mmcblk0p29.img" from the link on the first post to boot partition.

You should notice ubuntu boots much faster from emmc than from SD card.

Hey mate,
i was considering to buidl the kernel myself, because i need a few options in the kernel for "iotop" to work, namely "CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING", but wasnt sure from the first post which source code and defconfig to use, since there it says for cm12, but now the kernel is substantially newer. Do you have a current branch that you use, or could you eventually do a prebuilt kernel with these options enabled? THe thing is, im using an usb 3.0 key (rather fast read/write 350/250mb/s) and for some reason the thing keeps blinking constantly- even in absolute idle, like it would be constantly accessed, but i cant find the reason for it (latest L4T - 24.2 and your prebuilt kernel). Did anyone else perhaps find out why it constantly keeps accessing the root storage?
 

yahoo2016

Senior Member
Nov 24, 2015
392
88
Hey mate,
i was considering to buidl the kernel myself, because i need a few options in the kernel for "iotop" to work, namely "CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING", but wasnt sure from the first post which source code and defconfig to use, since there it says for cm12, but now the kernel is substantially newer. Do you have a current branch that you use, or could you eventually do a prebuilt kernel with these options enabled? THe thing is, im using an usb 3.0 key (rather fast read/write 350/250mb/s) and for some reason the thing keeps blinking constantly- even in absolute idle, like it would be constantly accessed, but i cant find the reason for it (latest L4T - 24.2 and your prebuilt kernel). Did anyone else perhaps find out why it constantly keeps accessing the root storage?
I deleted outdated steps in the first post and added information of building kernel from the latest L4T. A link to example configuration is added.
 
  • Like
Reactions: crnkoj

crnkoj

Senior Member
Feb 16, 2011
1,841
397
I deleted outdated steps in the first post and added information of building kernel from the latest L4T. A link to example configuration is added.

thanks mate
btw, they released a minor update to l4t - 24.2.1, nothing really impressive:
https://developer.nvidia.com/embedded/linux-tegra

edit:
which toolchain did you actually use to compile the kernel, the one that nvidia suggested or the default one in ubuntu?
edit1: sorry to be stupid again, but how do i get the compiled kernel into the img that we can flash (needs ramdisk and everything)?
thanks
edit2:
k got it to work with help of abootimg to replace your kernel with mine in teh image.
but how could i do a full image from scratch, where did you get the ramdisk and the cmd line?
 
Last edited:

shiquanwang

New member
Nov 21, 2011
4
0
Is this process applicable for Shield TV 2017

A quick question: Is this process applicable for Shield TV 2017 (pro or not) to build and run L4T with CUDA capabilities?
 

deerish

Member
Jan 6, 2016
35
8
Just to note, some other "fastboot oem" commands are; audio-uart, audio-no-uart, ecid, off-mode-charge.
 

rascustoms

New member
Feb 22, 2017
1
0
Has anyone else came across the issue where after running 'fastboot flash recovery mmcblk1p1.img', upon entering fastboot and selecting 'Boot recovery kernel' the nvidia logo will appear for a short period follow by a sick andriod with a warning logo in it's chest with 'No command' appearing above it? If 'fastboot boot mmcblk1p1.img' is ran, this boots no problems.

Also @deerish, are you running l4t off a usb or the internal mmc in your sheild 2017?

Thanks
 

deerish

Member
Jan 6, 2016
35
8
Has anyone else came across the issue where after running 'fastboot flash recovery mmcblk1p1.img', upon entering fastboot and selecting 'Boot recovery kernel' the nvidia logo will appear for a short period follow by a sick andriod with a warning logo in it's chest with 'No command' appearing above it? If 'fastboot boot mmcblk1p1.img' is ran, this boots no problems.

Also @deerish, are you running l4t off a usb or the internal mmc in your sheild 2017?

Thanks

I have run it off of both. My init looks first for a USB drive, but will mount "mmcblk0p33" if a USB drive is not found.
 

dronus2

New member
May 13, 2016
3
0
Module version mismatch?

Hi,

many thanks for the kernel images!

However, using Tegra210_Linux_R24.2.1_aarch64.tbz2 and 24.2.1 sample rootfs, the kernel version magic doesn't match the kernel modules it seems. The rootfs modules version magic has a "-tegra" suffix that the kernel does'nt it seems.

It is booting anyway from USB, but won't boot properly from mmclk0p29 if written there, getting stuck in framebuffer terminal after failing to run the graphical desktop.

On both accasions, there are no modules loaded from the beginning, but for the USB variant, graphics and eth0 is up.

So for what are the modules needed? How to get them right?
 

Slayerkodi

Senior Member
Apr 6, 2016
212
13
ok so im trying to install this to boot from my 16 micro sd card, but my card reader is not working but i can access my card over network using the shield network storage option. so following the tut im up to:

3. Copy L4T rootfs to SD card or USB drive
Prepare your SD card or USB drive such that it has at least one primary partition, using fdisk or gparted.
Assuming the first partition of the SD card or USB drive shows as "/dev/sdb1" on your ubuntu laptop and your are still in <L4T_install_folder>/Linux_for_Tegra folder:
Code:

sudo mkfs.ext4 /dev/sdb1
sudo mount /dev/sdb1 /mnt
sudo cp -a rootfs/* /mnt && sync

im wondering if there is a way to change the path from dev/memblock0 (or whatever it is) to the network path for the memcard instead, is this possible?? sorry if i didnt explain my point very well
 

abdul.malek

Member
Apr 2, 2017
9
0
2017 Pro not working microSD or ext USB

@deerish I picked up one of the 2017 pro units, Yahoo2016's images don't work on either the microSD or the external USB (with the same SD). Confirmed the rootfs is correct by loading it on a microSD in my 2015 16gb unit. Compiled my own images, same problem.

Effectively, no matter what I do on the 2017 Pro, it's looking for the rootfs and doesn't find it (I can replicate the behaviour by using the mmcblk1p1 image on my 2015 16GB and not plugging in the microSD). It loads up like it's loading linux fine, then 9 seconds in it panics.

Anyone also deal with this? What are our options? Load the rootfs directly on the SSHD from another linux box?
 

Slayerkodi

Senior Member
Apr 6, 2016
212
13
ok i thought i figured it out but it only booted that first time, i reinstalled to try to get wifi working but it didnt work, it looks like its going to load but then it says it will reboot in 30 seconds and turns off. i have tried to follow the instructions but i dont know where im going wrong. can someone look at this and see what the problem is please. https://pastebin.com/ZTa6C0QE

---------- Post added at 06:53 PM ---------- Previous post was at 06:21 PM ----------

This is whats happening to me https://youtu.be/vNz_QvDx30Q
 

yahoo2016

Senior Member
Nov 24, 2015
392
88
I did not receive email notification and missed this thread for a while. I do not have SATV 2017 and am wondering what changes of SATV 2017 have made to make older L4T kernel not working. If I know the difference, I could make a new kernel for SATV 2017.
 

abdul.malek

Member
Apr 2, 2017
9
0
I did not receive email notification and missed this thread for a while. I do not have SATV 2017 and am wondering what changes of SATV 2017 have made to make older L4T kernel not working. If I know the difference, I could make a new kernel for SATV 2017.

For one, it's using a different DTB, but there shouldn't be any difference between the SATV Pro 2017 and 2015. Similar to Slayerkodi's problem above, you can see in the video that it's looking for the rootfs and not finding it, so my guess is that something's amiss with the init files so the boot images no longer work. May be as simple as recognising the SD or external USB as a different drive.
 

yahoo2016

Senior Member
Nov 24, 2015
392
88
For one, it's using a different DTB, but there shouldn't be any difference between the SATV Pro 2017 and 2015. Similar to Slayerkodi's problem above, you can see in the video that it's looking for the rootfs and not finding it, so my guess is that something's amiss with the init files so the boot images no longer work. May be as simple as recognising the SD or external USB as a different drive.
That's what I thought. As I recall SATA 2017 16GB removed micro SD slot and the DTB could be different.

For Ubuntu to work for SATV 2015, the DTB must be from L4T, which DTB do you use for SATA 2017? What happens if you use DTB from L4T?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 18
    Update (08/26/2017) Update:

    I updated my SATV Pro 2015 to ROM 5.x, I did not have to replace dtb file. The img files from link below seem still working.


    The following have been tested for SATV ROM 3.x.

    Latest boot images based on L4T24.2 for external SD card, USB drive, internal EMMC and internal HDD can be downloaded from:
    https://drive.google.com/file/d/0Bz5kaPQJx_AgZ3lvWWZFNmJFcmM/view?usp=sharing

    Where,
    "mmcblk1p1.img" is for booting to rootfs on external SD card.
    "sda1.img" is for booting to rootfs on external USB drive (or SD card in USB adapter), or internal SATA HDD of modified 16GB SATV.
    "mmcblk0p29.img" is for booting to rootfs on partition 29 (User Data) of internal eMMC of 16GB SATV if only Ubuntu is needed.
    "mmcblk0p1.img" is for boot to rootfs on partition 1 of internal eMMC of SATV Pro.
    "sda32.img" is for booting to rootfs on partition 32 (User Data) of HDD of 500GB SATV Pro if only Ubuntu is needed.
    "sda33.img" is for booting to rootfs on partition 33 of HDD of 500GB SATV Pro for Ubuntu (modification of HDD partition table is needed).
    "sda34.img" is for booting to rootfs on partition 34 of HDD of 500GB SATV Pro for Ubuntu (modification of HDD partition table is needed).


    You will need to download L4T24.2 driver package and rootfs from Nvidia (https://developer.nvidia.com/embedded/linux-tegra), apply binary drivers to rootfs and copy it to external SD card/USB drive, see this post:

    http://xdaforums.com/showpost.php?p=69202451&postcount=421

    or internal eMMC or HDD (of SATV Pro):
    http://xdaforums.com/showpost.php?p=69202672&postcount=422

    L4T24.2 dtb from L4T24.2 rootfs "/boot" needs to be flashed. To find dtb name for your SATV, type the following in recovery mode:
    sudo fastboot oem dtbname

    Flash the wrong dtb will likely brick the SATV!!!

    To have Wifi working, "/lib/firmware/brcm/fw_bcmdhd.bin" need to be replaced with the one from SATV (in /system/vendor/firmware/bcm4354).

    To build kernel from source, download the latest L4T kernel source, modify tegra21_defconfig by adding "CONFIG_ANDROID=y", example configuration file can be downloaded from the following link

    https://xdaforums.com/showpost.php?p=69078331&postcount=417
    4
    I was able to build kernel using cm13.0 source 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"


    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.
    3
    Hello yahoo2016,

    you are right, if you use the kernel and tegra210-foster-e-p2530-0930-e02-00.dtb from L4T24.1 64bit over SATV ROM 3.1, you can successfully start the ubuntu desktop with 4k resolution But at this point android is broken. But you can switch back to SATV ROM 3.1 without a problem. That was differnt with version 2.1.

    Maybe you are interested to know this.

    One correction,

    I made a mistake. SATV ROM 3.1 works with the tegra210-foster-e-p2530-0930-e02-00.dtb from L4T24.1.

    So you can run android and ubuntu from sd-card parallel without a problem.
    2
    Thank you very much for sharing how to install L4T on Shield TV!
    I found this post and I'm using this boot.img, because I am lazy.
    http://xdaforums.com/showpost.php?p=64589752&postcount=53
    It worked very well and I can run CUDA samples and develop my CUDA program on it.

    I'm using my Shield TVwith lastest update 2.1.
    I flashed linux boot.img to boot partition and boot.img in NVIDIA SHIELD ANDROID TV Recovery OS Image 2.1.0 to recovery partition.
    So I can boot both Ubuntu and Android.
    When I use ubuntu, just turn on Shield TV or reboot.
    When I use android, I boot fastboot and select "boot recovery kernel".
    This is how to get fastboot menu with update 2.1.
    1. Turn off shield
    Touch and hold about 10s in android or "sudo shutdown -h now" in ubuntu.
    2. Tap power button once to turn on. Don't keep touching.
    3. Wait for about 1 second.
    4. Touch and hold power button until you see fastboot menu.
    Shield TV need to be connect to PC with use-otg cable.
    I can get fastboot menu without unpluging power supply.
    It works in 1 or 2 tries.
    2
    I read first post in this thread, built my boot.img and flashed it to my shield TV.
    I could connect to my shield using ssh, but it couldn’t display a desktop.
    And “sudo shutdown -h now” didn’t work.
    The boot.img built by yahoo2016 can display desktop and shutdown/reboot worked fine.
    My display is “SEIKI SE39UY04” and it supports 3840x2160@30Hz mode.

    I compared shieldTv_defconfig and cyanogenmod_foster_defconfig, and I found that some framebuffer options are set in shieldTv_defconfig.
    CONFIG_FB_NVIDIA=y
    CONFIG_FB_NVIDIA_BACKLIGHT=y
    CONFIG_FB_SIMPLE=y
    They are set yes in shieldTV_defconfig, but they are not set in cyanogenmod_foster_defconfig.
    They are also not set in Jetson TK1, but it displays console message to my display before desktop screen comes.
    I remember that Gentoo wiki for x86/64 says in-kernel nvidia framebuffer driver conflicts with the nvidia binary driver.
    I don’t know wether it also true or not in arm64 CPU or Shield TV, I removed these options and rebuilt the kernel.
    But I still didn’t see desktop and shutdown deosn’t work.
    Then, I removed “CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y”, but no change.
    Then, I removed following options:
    CONFIG_DUMMY_CONSOLE=y
    CONFIG_FRAMEBUFFER_CONSOLE=y
    CONFIG_FONT_8x8=y
    CONFIG_FONT_8x16=y
    They are enabled in Jetson TK1 but I disabled them.
    It worked! I got desktop and shutdown/reboot worked from a ssh client.
    But I found a problem. When I connect display to my shield TV but don’t connect mouse and keyboard, my shield TV displays NVIDIA logo forever and I cannot connect to my shield TV from a ssh client.
    When I connect display, mouse and keyboard, I can get the desktop.
    When I disconnect both display, mouse and keyboard, I can use shield from ssh client and my console CUDA program works.
    No matter if framebuffer related options are set yes or not, I don’t see console message from my display.

    I should try more combinations of kernel options to find out which options do wrong.
    But I will do it later.
    I'm going to talk about L4T on Shield TV on Jetson meet up event in Japan next week.
    I have to make the slide which compare shield TV and jetson TX1, explains why installing linux on shield tv, and how to do it in Japanese.
    I will put link to this topic on my slide.
    I think there are many people who are interested in shield TV as linux machine in my country.