Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Funtoo on the Nvidia TK1"

From Funtoo
Jump to navigation Jump to search
Line 86: Line 86:


== Flash the TK1 ==
== Flash the TK1 ==
Read [https://devtalk.nvidia.com/default/topic/775932/jetson-tk1-u-boot-doesn-t-search-mmcblk0p1/ this].
DO NOT DO THIS! This is still being tested. Much of what is documented is just rootfs flashing. We are also trying to flash the kernel.
Put your system into “reset recovery mode” by holding down the “RECOVERY” button and press “RESET” button once on the main board.
Put your system into “reset recovery mode” by holding down the “RECOVERY” button and press “RESET” button once on the main board.


Line 98: Line 95:
}}
}}


Cross your fingers.
Try flashing the kernel first to the partition id LNX. Cross your fingers.
{{console|body=
{{console|body=
# cd $TOOLS
# cd $TOOLS
 
#./flash.sh -k LNX -L bootloader/fastboot.bin -K $XC_KERNEL_SRC/arch/arm/boot/zImage jetson-tk1 mmcblk0p1
# ./flash.sh -S 8GiB jetson-tk1 mmcblk0p1
copying bctfile(/usr/src/fun_kernel/tools/TK1/Linux_for_Tegra/bootloader/ardbeg/BCT/PM375_Hynix_2GB_H5TC4G63AFR_H5TC4G63CFR_RDA_924MHz.cfg)... done.
copying bctfile(/usr/src/fun_kernel/tools/TK1/Linux_for_Tegra/bootloader/ardbeg/BCT/PM375_Hynix_2GB_H5TC4G63AFR_H5TC4G63CFR_RDA_924MHz.cfg)... done.
copying bootloader(/usr/src/fun_kernel/tools/TK1/Linux_for_Tegra/bootloader/ardbeg/u-boot.bin)... done.
Existing bootloader(/usr/src/fun_kernel/tools/TK1/Linux_for_Tegra/bootloader/fastboot.bin) reused.
populating kernel to rootfs... done.
making zero initrd...  
populating jetson-tk1_extlinux.conf.emmc to rootfs... done.
done.
done.
Making Boot image... done.
Making system.img...
populating rootfs from /mnt/Workspace/Jetson/21-5/Linux_for_Tegra/rootfs ... done.
Sync'ing system.img ... done.
Converting RAW image to Sparse image...
---- Raw to Sparse Image Converter v1.0 ----------------------------
  0: RAW:    4231168(  1033 blks) ==>          28:4231180
  1: SKP:      40960(    10 blks) ==>    4231208:40972
  2: RAW:        4096(      1 blks) ==>    4231220:4108
...<lots o output>...
...<lots o output>...
Create, format and download  took 1907 Secs
RCM communication completed
Time taken for flashing 1912 Secs
downloading bootloader -- load address: 0x83d88000 entry point: 0x83d88000
*** The target ardbeg has been flashed successfully. ***
sending file: fastboot.bin
Reset the board to boot from internal eMMC.
- 594363/594363 bytes sent
 
fastboot.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully
sending file: boot.img
\ 6021120/6021120 bytes sent
boot.img sent successfully
Time taken for flashing 4 Secs
*** The 6:LNX has been updated successfully. ***
}}
}}


New doorstop?
New doorstop?

Revision as of 15:02, February 27, 2017

Introduction

Read this.

And this

And this.

And this

Getting the Sources

Use the tools issued by Nvidia to handle kernel sources via git. Checkout the desired kernel version, which probably should match the version of the driver package (RXX-X), update the environment variables and create a branch named by the kernel version.

root # wget http://developer.nvidia.com/embedded/dlc/l4t-Jetson-TK1-Driver-Package-R21-5 -O $TOOLS/l4t-Jetson-TK1-Driver-Package-R21-5
root # cd $TOOLS
root # tar jxf l4t-Jetson-TK1-Driver-Package-R21-5
root # rm l4t-Jetson-TK1-Driver-Package-R21-5
root # cd Linux_for_Tegra
root # ./source_sync.sh  #skip tag selection both times
root # cd sources/kernel_source
root # git ls-remote
root # git checkout tegra-l4t-r21.5
root # ln -s $PWD $XC_KERNEL_SRC
root # . xcompile_variables.sh
root # git checkout -b `get_kernel_version`

Kernel Building

You need a working kernel config. You can get one from a running TK1 and get it into your $XC_KERNEL_SRC directory.

root # zcat /proc/config.gz > my_TK1_config
root # scp my_TK1_config <xc_user>@<xc_host>:~
root # cp ~/my_TK1_config $CONFIGS/`get_kernel_version`.kconf


Or you can get it from the kernel headers.

root # cd $TOOLS/Linux_for_Tegra/kernel
root # tar xvf kernel_headers.tbz2
root # cp linux-headers-<kernel_version>/.config $CONFIGS/`get_kernel_version`.kconf

Make the Kernel

root # . xcompile_variables.sh
root # cd $XC_KERNEL_SRC
root # cp $XC_KERNEL_OLDCONFIG .config
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make oldconfig
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make zImage modules dtbs

Download and Configure Stage3

See http://www.funtoo.org/Crossdev_Automation#Stage3_Configuration

Don't configure fstab and leave a serial console configured on ttyS2 in $XC_STAGES/etc/inittab.

root # echo "# UNCONFIGURED FSTAB FOR BASE SYSTEM" > $XC_STAGE3S/fstab

Install Super Special Blobs

This probably messes with portage, but we have to do it. Dissecting apply_binaries.sh is a good idea.

root # cd $TOOLS/Linux_for_Tegra
root # rmdir rootfs
root # ln -s $XC_STAGE3S rootfs
root # ./apply_binaries.sh

Copy over Everything

root # cd $XC_KERNEL_SRC
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- INSTALL_MOD_PATH=$XC_STAGE3S INSTALL_MOD_STRIP=1 make modules_install
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- INSTALL_MOD_PATH=$XC_STAGE3S make firmware_install
root # rsync -avz $XC_FIRMWARE/ $XC_STAGE3S/lib/firmware
root # rsync -avz arch/arm/boot/zImage $XC_STAGE3S/boot
root # rsync -avz arch/arm/boot/dts/*.dtb $XC_STAGE3S/boot
root # rm $XC_STAGE3S/lib/modules/`get_kernel_release`/{build,source}



Flash the TK1

Put your system into “reset recovery mode” by holding down the “RECOVERY” button and press “RESET” button once on the main board.

Ensure your Linux host system is connected to the target device through the USB cable for flashing.

root # lsusb | grep -i nvidia
Bus 003 Device 002: ID 0955:7140 NVidia Corp.

Try flashing the kernel first to the partition id LNX. Cross your fingers.

root # cd $TOOLS
root #./flash.sh -k LNX -L bootloader/fastboot.bin -K $XC_KERNEL_SRC/arch/arm/boot/zImage jetson-tk1 mmcblk0p1
copying bctfile(/usr/src/fun_kernel/tools/TK1/Linux_for_Tegra/bootloader/ardbeg/BCT/PM375_Hynix_2GB_H5TC4G63AFR_H5TC4G63CFR_RDA_924MHz.cfg)... done.
Existing bootloader(/usr/src/fun_kernel/tools/TK1/Linux_for_Tegra/bootloader/fastboot.bin) reused.
making zero initrd... 
done.
Making Boot image... done.
Making system.img... 
	populating rootfs from /mnt/Workspace/Jetson/21-5/Linux_for_Tegra/rootfs ... done.
	Sync'ing system.img ... done.
	Converting RAW image to Sparse image... 

---- Raw to Sparse Image Converter v1.0 ----------------------------
  0: RAW:     4231168(   1033 blks) ==>          28:4231180
  1: SKP:       40960(     10 blks) ==>     4231208:40972
  2: RAW:        4096(      1 blks) ==>     4231220:4108
...<lots o output>...
RCM communication completed
downloading bootloader -- load address: 0x83d88000 entry point: 0x83d88000
sending file: fastboot.bin
- 594363/594363 bytes sent
fastboot.bin sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully
sending file: boot.img
 6021120/6021120 bytes sent
boot.img sent successfully
Time taken for flashing 4 Secs
*** The 6:LNX has been updated successfully. ***

New doorstop?