Flash Jetson TK1 on SD card

I am trying to flash my Jetson board software (drivers, OS and all, using the Grinch kernel) onto an external SD card. I followed the guide here:

http://demotomohiro.github.io/hardware/jetson_tk1/setup/external_storage.html

Unfortunately, my Jetson board won’t boot from it. I would rather use the SD card than the internal emmc. If anybody has any input, I would greatly appreciate it! Thanks!

I did some testing of a few different boot options for a supplement I’m trying to work on, and discovered what others had already mentioned…not all SD cards work even when the software install is correct. Typically you will see a series of checksum errors after the boot has started successfully. For regular data use the failed SD cards still work…they just can’t boot. Did your boot start and then offer checksum errors?

FYI, the gist of the whole thing is to install a normal installation to eMMC using u-boot; once u-boot is installed and eMMC has a /boot with everything you need it is very simple to add a duplicate entry to the primary boot entry and point it at /dev/mmcblk1p1 instead of /dev/mmcblk0p1. The eMMC could be booted still and SD card can be chosen (serial console is needed to access any choice other than default). Regardless of which choice you use for u-boot…to install to eMMC or to install to SD card…the actual u-boot will be on eMMC; the option changes where u-boot looks to find /boot configuration.

The method I used to create an SD card to boot is that it was formatted ext4 and covers the entire SD card space (I used a 16 GB SD card). After this I unpacked the sample rootfs onto the card (with sudo to preserve permissions), and then ran the “apply_binaries.sh” script using the “–root /mnt/sdcard” option (where my ext4 SD card was already mounted on /mnt/sdcard).

No checksum errors, it won’t even boot up into the graphical environment (I ran the installer for the GUI beforehand).

Default boot loader changes depending on version. Which version are you using? If it is u-boot you are in luck.

Whichever boot loader they use in these instructions.

https://devtalk.nvidia.com/default/topic/766303/embedded-systems/-customkernel-the-grinch-19-3-6-for-jetson-tk1/

I might flash it on the emmc and then do as you said and point it to the sd card. Thanks!

That would likely be the default boot loader of R19.x unless you specified otherwise…which is fastboot. What was the exact command used to flash?

I used :

sudo ./flash.sh jetson-tk1 mmcblk1p1

I read somewhere that this one is the one to boot from an SD card:

sudo ./flash.sh -L bootloader/ardbeg/u-boot.bin ardbeg mmcblk1p1

Haven’t tried ^ yet, but I might sometime this weekend. Is R19.x the most recent version, or should I use another?

The command line you used would probably fail. The reason being is that on R19.x the default boot loader is fastboot, and fastboot requires naming the kernel in partition 6…the “-k 6” option is missing:

sudo ./flash.sh -L bootloader/ardbeg/fastboot.bin -k 6 jetson-tk1 mmcblk1p1

(in the above the “-L …” would have been there by default, I think the “-k 6” would still be required)

Under u-boot you’ll likely have more success anyway, but the command line you have for that is also incorrect. I’d suggest first installing to the regular eMMC and then creating an entry to boot SD card instead…once u-boot is flashed you don’t have to flash to set up anything else. So initially install without the SD card via u-boot:

sudo ./flash.sh -L bootloader/ardbeg/u-boot.bin jetson-tk1 mmcblk0p1

Once Jetson runs on u-boot you can just add an extra entry in /boot/extlinux.conf that copies the mmcblk0p1 entry, but instead says mmcblk1p1. A root file system can be added to the SD card, and you can also use the “install_binaries.sh” script with “–root” naming the SD card mount point.

In retrospect, I suspect fastboot failed because either it failed to look at partition 6 or else partition 6 didn’t have the kernel installed. U-boot resides in the eMMC regardless of whether you tell it to find configuration in /boot of eMMC (mmcblk0p1) or /boot of SD (mmcblk1p1). By having mmcblk0p1 as the boot partition you will always have a bootable system that can aim at SD card or SATA drive, so on, and be edited without the presence of the SD card or SATA. With fastboot pointed at the SD card you’ll always need that card installed for a bootable system…any changes using fastboot this way require a complete flash. U-boot is just a simple file edit, so it wins.

@linuxdev , when you say “add an extra entry in /boot/extlinux.conf”, do you mean keep the entry that is already there by default (eMMC) and below it also add a entry for SD card? So two entries, not one. Or do you mean replace it with the SD card entry? I have a similar scenario (using uboot on 21.2.0) where i installed on internal, and then have a SD card with system.img i DD’ed on it (l4t 19.3). If i replace the eMMC entry in the extlinux.conf with a SD card entry, it wont allow me to boot into either the emmc or sd (tried using uboot terminal as well but couldnt get it to work)

Yes, keep the old entry, add a blank line, and put a copy of that block in to edit. The copy to edit will need a different “LABEL”, e.g., “R19.3-gf455cd4_SD”, a new “MENU LABEL”, e.g., “R19.3 on SD Card”, and change the “root=/dev/mmcblk0p1” to be “root=/dev/mmcblk1p1”. When this second non-default entry is selected, it will look for a root file system on the SD card’s first partition. The original default entry will still load the same kernel and eMMC.

To pick the alternate entry use a serial console and use a keystroke to interrupt u-boot when it lists the kernel choices. If you hit a button too soon just use command “boot” to tell it to keep booting, and then hit a key again (the prompts are very short in duration you have to watch closely). If you are satisfied that you want the SD card to be the default you can make the “LABEL” of the new entry “primary” and set the original “LABEL” to something like “original_R19-3”.

Regardless of where the root file system is to be found, this scheme adds any new kernels or dtb files to the eMMC’s /boot…any /boot anywhere except the eMMC would be ignored.

Oh, one thing I forgot. On all flash commands you might want to add a manually set size of eMMC to use:

-S 14580MiB

…or whatever size you want on the eMMC root. It’ll still boot to SD card if you pick SD as boot choice, so maybe you won’t want your eMMC to occupy max space.

Sample:

TIMEOUT 30
DEFAULT primary

MENU TITLE Jetson-TK1 eMMC boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX zImage
      FDT tegra124-pm375.dtb
      APPEND console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 video=tegrafb mem=1862M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmuboard=0x0177:0x0000:0x02:0x43:0x00 vpr=151M@3945M tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal usb_port_owner_info=0 fbcon=map:1 commchip_id=0 usb_port_owner_info=0 lane_owner_info=6 emc_max_dvfs=0 touch_id=0@0 tegra_fbmem=32899072@0xad012000 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt

LABEL R19.3-gf455cd4_SD
      MENU LABEL R19.3 on SD Card
      LINUX zImage
      FDT tegra124-pm375.dtb
      APPEND console=ttyS0,115200n8 console=tty1 no_console_suspend=1 lp0_vec=2064@0xf46ff000 video=tegrafb mem=1862M@2048M memtype=255 ddr_die=2048M@2048M section=256M pmuboard=0x0177:0x0000:0x02:0x43:0x00 vpr=151M@3945M tsec=32M@3913M otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150 core_edp_ma=4000 tegraid=40.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter audio_codec=rt5640 modem_id=0 android.kerneltype=normal usb_port_owner_info=0 fbcon=map:1 commchip_id=0 usb_port_owner_info=0 lane_owner_info=6 emc_max_dvfs=0 touch_id=0@0 tegra_fbmem=32899072@0xad012000 board_info=0x0177:0x0000:0x02:0x43:0x00 root=/dev/mmcblk1p1 rw rootwait tegraboot=sdmmc gpt

SD card boot on R21.2 can work properly.

Just format sdcard as ext4 and copy the content of rootfs over to sdcard.
Then copy sdcard version extlinux.conf

cp ./boot/extlinux/jetson-tk1_extlinux.conf.sdcard ./boot/extlinux/extlinux.conf

The trouble with flashing u-boot with mmcblk1p1 (SD card contains config this way, but still lives on eMMC) is that the system will never boot without an SD card containing all of u-boot configuration, including kernel and dtb files. U-boot itself would still be on eMMC even if it looks to the SD card to configure…might as well just leave it all on eMMC and have it look for config on eMMC…this config easily can point to SD card and leave everything bootable even when the SD card is removed. I’ve set it up to use the eMMC by default, but to allow boot of anything on SD card or /dev/sda1. This works to rescue things if something goes wrong…so long as /boot lives. On the other hand, my SD cards all still have a copy of /boot as backup. I could flash and destroy eMMC and point at the SD cards and have my whole system back.

Just to clarify, installing u-boot with eMMC parameter mmcblk0p1 installs both u-boot and configuration to eMMC; installing u-boot to mmcblk1p1 still installs u-boot to eMMC…it’s only where u-boot looks for config and boot files that changes by switching parameters from mmcblk0p1 to mmcblk1p1.