64-bit userspace on Nvidia TX1

I’ve been having trouble getting a 64-bit userspace up on the Nvidia TX1 (Linux4Tegra uses 32-bit), so I thought I’d share my progress and steps.

See the end of this post for a comment about how I actually got this working. These instructions don’t work as they are, but I’m leaving them here for posterity.

To begin with, I use Debian (or Ubuntu, or whatever) for most of my work, so that’s what this guide will be based on. Also, you’ll need to have another drive to use with your TX1. Linux4Tegra (L4T) will be installed on the on-board MMC device, and we’ll be installing Debian Sid on the other drive.

You’ll need to copy the extensive partition scheme that Nvidia builds on the MMC (there’s something like 8-9 partitions) onto your target drive. I do this by dd’ing the entire MMC onto the target

sudo dd if=/dev/mmcblk0 of=/dev/mmcblk1 bs=4096

Then we need to mount the root filesystem on the target device somewhere

sudo mkdir /mnt/rootfs
sudo mkfs.ext3 /dev/mmcblk1p1
sudo mount /dev/mmcblk1p1 /mnt/rootfs

Debootstrap will do the work of making the new (very minimal) root filesystem. It’s very important to include the –arch flag, otherwise the bootstrap process will generate a rootfs using armhf, and we’ll be stuck with a 32-bit userspace again.

sudo apt-get install debootstrap
sudo debootstrap --arch=arm64 sid /mnt/rootfs http://debian.osuosl.org/debian

As I said the rootfs will be VERY minimal, so we need to install tons of important stuff, including locales, keyboard maps, ssh server, etc… But, before we do that we have to chroot into the new rootfs:

sudo mount -o rbind /dev rootfs/dev
sudo mount -t proc none rootfs/proc
sudo mount -o bind /sys rootfs/sys
sudo chroot rootfs /bin/bash
source /etc/profile
apt-get update
apt-get install ssh openssh-server make gcc libncurses5-dev bc locales
dpkg-reconfigure locales

Then, we need to add information about the network interface to /etc/network/interfaces:

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

The current linux-upstream kernel has support (though apparently, rudimentary) for the TX1. This should obviate the need for the binaries supplied with L4T. So, let’s clone the kernel repo and build one.

cd /usr/src
git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux-next
cd linux-next
cp /proc/config.gz ./
gunzip config.gz
cp config .config
make oldconfig (press enter until it's done)
make menuconfig
(in General Setup, select "open by fhandle syscalls")
(in Drivers->General, delete all the extra firmware names listed)
cp build

Next, we have to copy the entry that selects the boot mode in /boot/extlinux/extlinux.conf and edit it to select our new rootfs. We’ll leave the old one there so we can swift back and forth. This is especially helpful if something breaks.

LABEL debian
MENU LABEL debian kernel
LINUX /boot/Image-next
FDT /boot/tegra210-p2371-2180.dtb
APPEND fbcon=map:0 console=tty0 console=ttyS0,115200n8 tegraid= ddr_die=2048M@2048M ddr_die=2048M@4096M section=256M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=${lp0_vec} nvdumper_reserved=${nvdumper_reserved} core_edp_mv=1125 core_edp_ma=4000 gpt root=/dev/mmcblk1p1 rw rootwait

The last thing to do in the chroot is to set the root password to something, and allow (for now, change it later!!) root login over ssh:

vi /etc/ssh/sshd_config
PermitRootLogin yes

Now, we need to really dive into to some somewhat painful work. We have to setup a serial console onto the board, and have another computer (specifically a x86-64 machine running Ubuntu 14.04) to run the L4T apply_binaries.sh tool. First, the serial port connection is explained at elinux. Then, you need open a serial terminal to the board with 115200 baud. Once that’s done, reboot the board, and prevent u-boot from autobooting. In the uboot console, enable the USB Mass Storage mode:

Tegra210 (P2371-2180) # ums 0 mmc 1
UMS: disk start sector: 0x0, count: 0x39f0000

Then, with the usb cable connected from the TX1 to your x86-64 box run apply_binaries.sh:

sudo mount /dev/sdg1 /mnt/rootfs/
sudo LDK_ROOTFS_DIR=/mnt/rootfs ./apply_binaries.sh
sudo umount /mnt/rootfs

The problem I’ve been having is that the USB keyboard that I have doesn’t work on the console. It’s obviously a HUGE bummer to not be able to login to a machine using the console. 🙁

I ended up following these instructions to net-install debian arm64 on my SD card. The limitation here is that most of the things that makes this an Nvidia device (GPU, CUDA, etc) don’t work. For my needs, I only want a Arm64 to work on a Swift port, so I don’t care.



, , , , , ,

  1. No comments yet.
(will not be published)

Please complete this capcha. I get almost 1000 spam comments a day! * Time limit is exhausted. Please reload CAPTCHA.