Jetson TX2 : boot on SD Card

Hello,

First of all, I am sorry if this topic is a duplicate of : https://devtalk.nvidia.com/default/topic/1017248/jetson-tx2/boot-jetson-tx2-from-sd-card-require-to-know-config-changes/. I can’t seem to find a clear answer on this topic.

Let me first explain my case. I am “playing” with a Jetson Tx2 development kit. When I first received it I took an old SSD of 64GB and followed this really clear tutorial to boot and work on my ssd : https://www.jetsonhacks.com/2017/08/05/develop-on-ssd-nvidia-jetson-tx1-and-jetson-tx2/. It worked like a charm !

Moving forward with the “playing” part, I integrated the Jetson Tx2 development kit in a mobile base. The connection with the SSD being rather ‘messy’ with the cables I wanted to replace it with a 128GB SD card.

So, I googled a bit and I found a similar tutorial in jetsonhacks but for Jetson Tx1http://www.jetsonhacks.com/2017/01/26/run-jetson-tx1-sd-card/.
Only difference is that I’m copying the whole content of my SSD to the SD card (with sudo cp -ax /dev/sda1 /dev/mmcblk1p1 && sync) instead of starting from the eMMC. So far no problem the copy seems perfect.

After the copy, the tutorial for the Jetson Tx1 makes me change the /boot/extlinux/extlinux.conf to add the SD card part so that I can boot on it. However, again in this tutorial, this change is done in the extlinux.conf of the SD card which seems rather weird to me because the procedure was different for the SSD… So after rebooting the Jetson tx2 and removing the old SSD… the Jetson boots on the eMMC ! Meaning that something failed here…

I tried two different things afterwards :

  • Instead of changing the extlinux.conf of the SD card, I changed the one of the eMMC… still a failure to boot on the SD card.
  • I tried to copy the content of the eMMC (instead of copying the content of my SSD) to the SD card and changed the extlinux.conf of the eMMC (but also the one on the SD card actually)… still a failure.

So, my question is rather simple. Is it possible to boot the Jetson Tx2 from an SD card ? If yes, is there something I am doing wrong here (I hope there is !) ?

Any help, advise is much appreciated !

Thanks to all for reading… and for answering :).

In the JetsonHacks article, note that the system being used is a Jetson TX1 running L4T 24.2.1. In those systems, the boot order is such that if there is a SD card present, it will boot from the SD card before checking the internal eMMC.

Newer systems (L4T 28+) have a different device boot preference, and do not boot from the SD card in the same way.

It is my understanding that the system does not boot from the SD card on a L4T 28+ system, it boots from the internal eMMC. You can however set the root system to that of the SD card.

Hi Kangalow,

Thank you for your answer.

As I wrote in my first post, I was aware that the JetsonHacks article was done on a Jetson TX1.

This make sense that on all L4T 28+ system the boot will always start from the internal eMMC.
In my post I said However, again in this tutorial, this change is done in the extlinux.conf of the SD card which seems rather weird to me because the procedure was different for the SSD.
The SSD tutorial was done on a Jetson Tx2, which explains the change of procedure.

Still, I do not see what I’m doing wrong. My SD card has only one ext4 partition, the eMMC extlinux.conf refers to it to start booting from it. But after a reboot, the jetson still boots on the eMMC…

So, when you say You can however set the root system to that of the SD card., do you tsuggest to another procedure to do that ?

You have not said what version of L4T you are running. Please consider doing so as this helps us to better understand your question. Different versions have different boot device priorities.

I will try to restate this again. In the tutorial, the system is L4T 24.2.1. The priority boot order is to try to boot from the SD card first, and then the eMMC. The reason that you change the SD card extlinux.conf in that scenario is because that is where the system is booting from. If you did not, it will use the copy of the extlinux.conf from the eMMC, which instructs it to use eMMC.

In L4T 28+, the system looks first on the eMMC and tries to boot from there. It does not matter how the extlinux.conf is set on other volumes, tain’t looking there.

I would suggest that you use the same procedure as described in the articles to set the root directory.

There are two possible “/boot” partitions. One on the SD, one on eMMC. If you flashed to mmcblk0p1, then the “/boot” of eMMC is used. This includes the extlinux.conf there.

If you edit that extlinux.conf to have a second entry, and the entry points at the SD card, then after reading extlinux.conf on eMMC the rootfs of SD card becomes rootfs.

If you flashed to mmcblk1p1, then the “/boot” of SD card is used. I’d discourage this since it means your Jetson will no longer boot without that SD card.

There are some macros in U-Boot’s environment which can change which one is used based on a search order and whether extlinux.conf is found on that medium.

Regardless of whether the extlinux.conf is on eMMC or SD card, look for the “root=/dev/mmcblk1p1” (SD card) versus “root=/dev/mmcblk0p1” (eMMC).

Thanks again for the answer.

I am using the latest Jetpack version (not sure if it has a link to the L4T version). I will still check tomorrow on my Jetson to give the exact L4T version.

As for your restatement, I totally got it thank you :). Actually I was aware of it.

This is why, like I said in my first post : Instead of changing the extlinux.conf of the SD card, I changed the one of the eMMC… still a failure to boot on the SD card.

So, I actually have the correct extlinux.conf in the eMMC (the same I was using to boot on the SSD which worked!) which links the SD card (root=/dev/mmcblk1p1 instead of /dev/sda1).

Am I correct or are your actually suggesting something different ?

Hi linuxdev,

Thanks for the answer.

To be clear, I already tried on the eMMC’s extlinux.conf to add a second entry which corresponds to my SD card.

Obviously I added the root=/dev/mmcblk1p1 which is my SD card and not the root=/dev/mmcblk0p1 which is the eMMC.

It seems like my first post was not clear at all :( ! Either that or I’m not getting both, Linuxdev and Kangalow, your statements.

Use “head -n 1 /etc/nv_tegra_release”. If you’ve flashed before, then you can see this same file at “Linux_for_Tegra/rootfs/etc/nv_tegra_release”.

You might post your extlinux.conf you used from both eMMC and from SD card. You can attach it if you rename it “extlinux.txt”. If you hover your mouse over the quote mark of one of your existing posts a paper clip icon will show up and you can attach with that. Otherwise you can mouse copy and paste it and highlight it and mark it with the “code” icon (looks like “</>” in the editing bar of a new post).

Thanks linuxdev, I will do that first in the morning tomorrow ! (Paris time here !)

Hi linuxdev,

I am writing from the Jetson : it is still booting from the eMMC.

Here is the output of “head -n 1 /etc/nv_tegra_release” :

# R28 (release), REVISION: 2.0, GCID: 10567845, BOARD: t186ref, EABI: aarch64, DATE: Fri Mar  2 04:57:01 UTC 2018

Also, is the output of /boot/extlinux/extlinux.conf of the eMMC :

TIMEOUT 30
DEFAULT sdcard

MENU TITLE p2771-0000 eMMC boot options

LABEL sdcard
      MENU LABEL sdcard SATA SSD
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} root=/dev/mmcblk1p1 rw rootwait rootfstype=ext4

LABEL satassd
      MENU LABEL primary SATA SSD
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} root=/dev/sda1 rw rootwait

LABEL emmc
      MENU LABEL Internal eMMC
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

And finally, here is the output of /boot/extlinux/extlinux.conf of the sd Card (/dev/mmcblk1p1) :

TIMEOUT 30
DEFAULT primary

MENU TITLE p2771-0000 eMMC boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image 
      APPEND ${cbootargs} root=/dev/mmcblk1p1 rw rootwait

LABEL eMMC
      MENU LABEL eMMC kernel
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

Also, I just noticed something. When booting the Jetson, my SD card is already mounted under /media/nvidia/jetsonSD.

Edit :

I also did another test. In i]/boot/extlinux/extlinux.conf[/i] of the eMMC i put the following.
I increased the timeout (to 6 and 10 seconds, also tried with 0 to see if I could choose the boot, no success) and removed the eMMC label…

TIMEOUT 60
DEFAULT sdcard

MENU TITLE p2771-0000 sdcard eMMC boot options

LABEL sdcard
      MENU LABEL sdcard SATA SSD
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk1p1 rw rootwait rootfstype=ext4

LABEL satassd
      MENU LABEL primary SATA SSD
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} root=/dev/sda1 rw rootwait

This didn’t work either… it still booted on the eMMC. It’s like the only change that has an effect and works is changing the DEFAULT to satassd :( ! Note that if sdcard and SSD are plugged and DEFAULT is set to satassd, Jetson TX2 still boots on the eMMC. I only manage to boot on SSD if SD card was not plugged on boot… rather weird.

Here is the output of ‘fdisk -l’ (I only put the info regarding the SD card) :

Disk /dev/mmcblk1: 119.1 GiB, 127865454592 bytes, 249737216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3798D99C-F9CD-4008-B297-EF01ABA00E10

Device         Start       End   Sectors   Size Type
/dev/mmcblk1p1  2048 249737182 249735135 119.1G Linux filesystem

Just to be clear, I do not want to boot totally from the SD card. I am fine with booting on the eMMC if it is capable of booting on my SD card.

How do you check that it still boots on eMMC when SD Card is inserted ?
Using :

mount | head -n 1

should show which partition is used as rootfs.

Note that booting from SD Card would show the eMMC as a SD Card.

Last, if you still face problems only when booting from SD Card, you may try to modify file /lib/init/fstab and change /dev/root into /dev/mmcblk1p1 (It was for TX1, but you may read this article).

FYI, the extlinux.conf entries seem ok.

If your system does boot to eMMC, then it is reasonable that the SD card could be automatically mounted as a hot plug device…but this would not be causing failure to use the SD card as rootfs.

After boot what do you see from this:

cat /proc/cmdline

(U-Boot and earlier stages inherit and pass along some of the boot environment…this will show what the actual Linux kernel command line was…perhaps there is more than one conflicting “root=”)

Btw, you should be using a GPT partition scheme instead of old style BIOS. Linux can use both, but I don’t know if U-Boot can. “gdisk” is the GPT version of the older style BIOS “fdisk” tool. What do you see from:

sudo gdisk -l /dev/whichever/sd/card/device/it/is

One other thing which sometimes gets in the way is the U-Boot cannot understand 64-bit extensions. Linux doesn’t care and works well with 32-bit or 64-bit (the SD card would be completely function inside of Linux, but it is U-Boot which looks for extlinux.conf). If your host formatted the partition with 64-bit extensions, then it is as good as being random bits and not having a file system at all so far as U-Boot is concerned. From the host you formatted the SD card partition from, look at “etc/mke2fs.conf”. Within the “ext4” section make sure none of these show up:

metadata_csum
64bit

If they do, then all is explained with that. You’d need to reformat with a command to forcibly ignore 64-bit via:

sudo mkfs.ext4 -O ^metadata_csum,^64bit /dev/what/ever/the/sd/card/partition/1/is

Prior to formatting, if your disk is old style BIOS partitioned, I’d recommend completely removing all of the partitions and repartitioning with gdisk or diskparted (or any GPT-enabled tool).

Hello Honey_Patouceul,

Thanks for the answer.

The content of the eMMC and the SD Card (which again as I said in my first post is a plain copy of my old SSD) is different.

Checking the difference is easy when I either have a screen plugged to the Jetson or just SSH in the Jetson : the home folder is different between the SD Card (I have my developments) and the eMMC (I did nothing on the eMMC).

Anyway, here is the output of mount | head -n 1 when booting on the SSD :

/dev/sda1 on / type ext4 (rw,relatime,data=ordered)

When booting… on the eMMC (both extlinux.conf is set to boot on sdcard root=/dev/mmcblk1p1 and I also changed /lib/init/fstab) :

/dev/mmcblk0p1 on / type ext4 (rw,relatime,data=ordered)

And the change in /lib/init/fstab :

# /lib/init/fstab: static file system information.
#
# These are the filesystems that are always mounted on boot, you can
# override any of these by copying the appropriate line from this file into
# /etc/fstab and tweaking it as you see fit.  See fstab(5).
#
# <file system> <mount point>             <type>          <options>                               <dump> <pass>
/dev/mmcblk1p1       /                         rootfs          defaults                                     0 1
none            /proc                     proc            nodev,noexec,nosuid                          0 0
none            /proc/sys/fs/binfmt_misc  binfmt_misc     nodev,noexec,nosuid,optional                 0 0
none            /sys                      sysfs           nodev,noexec,nosuid                          0 0
none            /sys/fs/cgroup            tmpfs           optional,uid=0,gid=0,mode=0755,size=1024     0 0
none            /sys/fs/fuse/connections  fusectl         optional                                     0 0
none            /sys/kernel/debug         debugfs         optional                                     0 0
none            /sys/kernel/security      securityfs      optional                                     0 0
none            /sys/firmware/efi/efivars efivarfs        optional                                     0 0
none            /spu                      spufs           gid=spu,optional                             0 0
none            /dev                      devtmpfs,tmpfs  mode=0755                                    0 0
none            /dev/pts                  devpts          noexec,nosuid,gid=tty,mode=0620              0 0
none            /tmp                      none            defaults                                     0 0
none            /run                      tmpfs           noexec,nosuid,size=10%,mode=0755             0 0
none            /run/lock                 tmpfs           nodev,noexec,nosuid,size=5242880             0 0
none            /run/shm                  tmpfs           nosuid,nodev                                 0 0
none            /run/user                 tmpfs           nodev,noexec,nosuid,size=104857600,mode=0755 0 0
none            /sys/fs/pstore            pstore          optional                                     0 0

It’s like my Jetson TX2 doesn’t care for the sd card.

Does anyone see something I did wrong ?

Hi Linuxdev,

Here is the output of cat /proc/cmdline after boot :

root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 OS=l4t fbcon=map:0 net.ifnames=0 memtype=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x03100000 nvdumper_reserved=0x2772e0000 gpt tegraid=18.1.2.0.0 tegra_keep_boot_clocks maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.2.1 androidboot.serialno=0322017038269 bl_prof_dataptr=0x10000@0x277040000 sdhci_tegra.en_boot_part_access=1 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

You are right something is conflicting, it doesn’t care for the “root=/dev/mmmcblk1p1” which I see !

Also, here is the output of sudo gdisk -l /dev/mmmcblk1p1, seems like the partition table is not good… :

sudo gdisk -l /dev/mmcblk1p1 
[sudo] password for nvidia: 
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.
Disk /dev/mmcblk1p1: 249735135 sectors, 119.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F952E5E2-775A-4BCE-AACA-2B52615BE05B
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 249735101
Partitions will be aligned on 2048-sector boundaries
Total free space is 249735068 sectors (119.1 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name

As for the formating of the SD card, I honestly just used gnome-disks gui directly on the Jetson Tx2.
So here is the output of /etc/mke2fs.conf :

[defaults]
	base_features = sparse_super,large_file,filetype,resize_inode,dir_index,ext_attr
	default_mntopts = acl,user_xattr
	enable_periodic_fsck = 0
	blocksize = 4096
	inode_size = 256
	inode_ratio = 16384

[fs_types]
	ext3 = {
		features = has_journal
	}
	ext4 = {
		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
		auto_64-bit_support = 1
		inode_size = 256
	}
	ext4dev = {
		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
		inode_size = 256
		options = test_fs=1
	}
	small = {
		blocksize = 1024
		inode_size = 128
		inode_ratio = 4096
	}
	floppy = {
		blocksize = 1024
		inode_size = 128
		inode_ratio = 8192
	}
	big = {
		inode_ratio = 32768
	}
	huge = {
		inode_ratio = 65536
	}
	news = {
		inode_ratio = 4096
	}
	largefile = {
		inode_ratio = 1048576
		blocksize = -1
	}
	largefile4 = {
		inode_ratio = 4194304
		blocksize = -1
	}
	hurd = {
	     blocksize = 4096
	     inode_size = 128
	}

The “root=” was listed twice. Not normally a problem as it should pick the last one in the line. Unfortunately, all of them were “root=/dev/mmcblk0p1” (eMMC).

The mke2fs.conf is ok, nothing conflicting in it.

It is quite odd that both the first and last “root=” were to eMMC since your extlinux.conf had mmcblk1p1. Are you using a serial console at boot time to pick an entry? If not, perhaps the “default” is failing. The only way both entries could be for eMMC is if the extlinux.conf entry which was chosen also has mmcblk0p1.

One thing you can do to verify which extlinux.conf is used is to alter the “MENU LABEL” to specify which. So for example for each MENU LABEL of eMMC’s extlinux.conf, something like this (several examples, this isn’t a complete entry):

# pick mmcblk<b>0</b>p1 via eMMC's extlinux.conf
MENU LABEL eMMC via eMMC extlinux

# pick mmcblk<b>0</b>p1 via SD's extlinux.conf
MENU LABEL eMMC via SD extlinux

# pick mmcblk<b>1</b>p1 via eMMC's extlinux.conf
MENU LABEL SD via eMMC extlinux

# pick mmcblk<b>1</b>p1 via SD's extlinux.conf
MENU LABEL SD via SD extlinux

You will only be able to see the menu changes from serial console. Can you try to edit the eMMC when SD card is not connected, then edit the SD, and reboot with serial console connected to verify which entry is used?

Thanks for the answer Linuxdev.

Unfortunately, I don’t have a serial cable for now. Since it seems like it is not possible to access it using the micro usb cable (I quickly googled that, if it is wrong please tell me.) this will have to wait until monday.

Just to make sure, you want me to edit the extlinux.conf of the eMMC to add this :

# pick mmcblk0p1 via eMMC's extlinux.conf
MENU LABEL eMMC via eMMC extlinux

# pick mmcblk1p1 via eMMC's extlinux.conf
MENU LABEL SD via eMMC extlinux

And then edit the extlinux.conf of the SD to add this :

# pick mmcblk0p1 via SD's extlinux.conf
MENU LABEL eMMC via SD extlinux

# pick mmcblk1p1 via SD's extlinux.conf
MENU LABEL SD via SD extlinux

Am I right ? Also, again to make sure, I can just add those lines in the extlinux.conf right ? I don’t see the MENU LABEL entry in my extlinux.conf I only have a MENU TITLE entry.

I suppose @Linuxdev meant that you change menu labels so that you can see on serial console which entries are proposed by extlinux conf in u-boot.

In your post #10, you show normal extlinux.conf files having some lines for timeout, default config and main menu title, then several entries such as:

LABEL sdcard
      <b>MENU LABEL</b> sdcard SATA SSD
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk1p1 rw rootwait rootfstype=ext4

These are the options shown by u-boot menu on serial console.
If you don’t select it before timeout (which is given in tenth of seconds, so 30 is 3 seconds), then the default config will be used.

@Honey_Patouceul is correct. You’ll need a serial console to be sure you are getting the correct boot entry and to know for sure which extlinux.conf is being used. I suspect the entry you expect to be used is not really being used. You’ll be much happier with Jetson development if you get that serial cable…there isn’t much you can do with the bootloader debugging without it.

Hey guys,

Thank you both for the answer. I actually have serial cables… but at the office not at home.

Anyway, I managed to boot on my SD Card… Here is what I did.

First, I reflashed the eMMC with Jetpack 3.3. Then I copied the whole content to my SD card and finally I changed both extlinux.conf of eMMC and SD card to boot on SD card. It worked…

Well I wasn’t that happy that it worked because in the end I don’t understand the roots of the problem.

So I booted again from the eMMC, plugged my old SSD, reformated the SD card (with gparted), and started again the whole process. Only difference is that I copied the content of the old SSD to the SD card. I left the extlinux.conf of eMMC the same since it was supposed to boot on mmcblk1p1 but I changed again the extlinux.conf of the SD card to have also mmcblk1p1 in it (which I agree should be useless!). Well after rebooting… it worked too !

So in the end, it took a lot of time but it worked. Still feel bad because I don’t see what was the issue… Probably like you, @linuxdev, suspected the root=/dev/mmcblk0p1 was read from somewhere ! Only the serial cable would have showed me this !

Anyway, thanks to all !

Hi wbfbr15,
Could I ask for a summary of how you managed to create a bootable SD card and then, what changes you made to the extlinux.conf files to make it work?
Also, does your system fall back to booting from eMMC, if the SD card is removed?
Many thanks