Search code examples
yoctonvidia-jetsonnvidia-jetson-nano

Flashing custom Yocto image to Jetson Nano production module eMMC?


I'm building a yocto image to run on the Jetson Nano. Right now I'm working on a Jetson Nano devkit which boots from the SD-card, and the flashing is described on the meta-tegra GitHub repo wiki. It doesn't say how to flash onto the eMMC on the Jetson Nano, only on the SDcard.

Can I copy the yocto build rootfs to the nvidia_sdk L4T tools (replacing the 'rootfs' folder)? But what about the rest of the folders (bootloader, kernel, lib, nv_tegra)? It should be the same binaries, I'm just not so sure the kernel and bootloader is the same, and don't really know about the rest.

Anyone dealing with the same issue or, even better, found a way to do this, please let me know.


Solution

  • I had a conversation with the maintainer of the meta-tegra layer and ended up with creating a new machine configuration:

    #@TYPE: Machine
    #@NAME: Nvidia Jetson Nano
    #@DESCRIPTION: Nvidia Jetson Nano prod board
    
    KERNEL_ARGS ?= "console=ttyS0,115200 console=tty0 fbcon=map:0 net.ifnames=0"
    KERNEL_ROOTSPEC ?= "root=/dev/mmcblk0p${@uboot_var('distro_bootpart')} rw rootwait"
    IMAGE_ROOTFS_ALIGNMENT ?= "1024"
    
    require conf/machine/include/tegra210.inc
    
    KERNEL_DEVICETREE ?= "_ddot_/_ddot_/_ddot_/_ddot_/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dtb"
    
    MACHINE_FEATURES += "ext2 ext3 vfat"
    
    UBOOT_MACHINE = "p3450-porg_defconfig"
    
    EMMC_SIZE ?= "17179869184"
    EMMC_DEVSECT_SIZE ?= "512"
    BOOTPART_SIZE ?= ""
    BOOTPART_LIMIT ?= "10485760"
    ROOTFSPART_SIZE ?= "3221225472"
    ODMDATA ?= "0x94000"
    EMMC_BCT ?= "P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg"
    NVIDIA_BOARD ?= "t210ref"
    NVIDIA_PRODUCT ?= "p3450-porg"
    NVIDIA_BOARD_CFG ?= ""
    TEGRA210_REDUNDANT_BOOT ?= "0"
    PARTITION_LAYOUT_TEMPLATE ?= "flash_l4t_t210_emmc_p3448.xml"
    TEGRA_SPIFLASH_BOOT ?= "0"
    TEGRA_FAB ?= "300"
    TEGRA_BOARDID ?= "3448"
    

    The machine configuration is almost identical to the devkit's, but some parts had to be changed to match to Jetson Nano Production Module configurations, i.e. change the KERNEL_DEVICETREE the the one matching the newer eMMC Jetson Nano and change TEGRA_FAB accordingly. Then change the PARTITION_LAYOUT_TEMPLATE to match the emmc layout instead of the spi_sd layout (the flash_l4t_t210_emmc_p3448 is the default p3448 emmc layout provided with meta-tegra).

    After this, Yocto will produce a tegraflash zip that contains the necessary partition files and a rootfs image (along side some flashing tools). Put the Jetson Nano production module into recovery mode (FORCE RECOVERY + RESET), plug in the micro-usb cable and run the doflash.sh script to flash the nano, and voila.