This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] How to build, flash and boot Linux from GPMC-NAND on AM64x

  • The u-boot patch to boot u-boot from GPMC-NAND with SDK 12.1.0.5.3

    1/. Apply the attached u-boot patch set (4 patches) on u-boot (ti-u-boot-2026.01 with tag 12.01.00.05) in AM64x Linux SDK 12.1.0.5.3
    - add the gpmc-nand configuration as fragment for R5 & A53 u-boot build
    - add the gpmc-nand dtb for AM64x EVM + gpmc-nand daughter card
    - add the gpmc-nand boot environment variables in AM64x u-boot
    - add the bootcmd to auto-boot kernel & root_fs ubi from gpmc-nand

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/2402.am64_5F00_uboot_5F00_patch_5F00_gpmc_2D00_nand.tar.xz

    2/. build u-boot using the default *.defconfig with the additional fragments "am64x_evm_r5_gpmc.config" for R5, and "am64x_evm_a53_gpmc.config" for A53 as listed below
    - "am64x_evm_r5_defconfig am64x_evm_r5_gpmc.config"
    - "am64x_evm_a53_defconfig am64x_evm_a53_gpmc.config"

    The kernel patch to boot kernel from GPMC-NAND with SDK 12.1.0.5.3
    Apply the attached kernel patch on kernel (ti-linux-6.18.y with tag 12.01.00.05) in AM64x Linux SDK 12.1.0.5.3
    - build the gpmc-nand driver into kernel to boot and mount root_fs ubi from the mtd partition

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/1854.am64_5F00_kernel_5F00_patch_5F00_gpmc_2D00_nand.tar.xz

    Generate the root_fs ubifs/ubi files
    - the cmd to create ubifs file, where "am64_base_root_fs" is the SDK "tisdk-base-image-am64xx-evm.rootfs.tar.xz" as an example

    mkfs.ubifs -r  am64_base_root_fs -o rootfs.ubifs -F -m 4096 -e 258048 -c 4054

    - the cmd to create ubi file, where I'm attaching the ubinize.cfg used

    ubinize -o am64_base_root_fs.ubi -m 4096 -p 256KiB -s 1024 -O 1024 ubinize.cfg

    - ubinize.cfg file used in the above cmd

    [ubifs]
    mode=ubi
    image=rootfs.ubifs
    vol_id=0
    vol_type=dynamic
    vol_name=rootfs
    vol_flags=autoresize

    - The parameters in the above two cmds are based on the gpmc-nand mtd partition "NAND.file-system" information

    Flashing u-boot binary and root_fs ubi to GPMC-NAND
    - am64_12.1.0.5.3_nand_flash.log: the log showing how to flash u-boot binary and root_fs ubi to GPMC-NAND with "mtd..." cmd from u-boot which is booted from SD boot mode as an example.

    U-Boot SPL 2026.01-g81bb31811776-dirty (Aug 12 2026 - 11:47:33 -0500)
    Resetting on cold boot to workaround ErrataID:i2331
    Please resend tiboot3.bin in case of UART/DFU boot
    resetting ...
    
    U-Boot SPL 2026.01-g81bb31811776-dirty (Aug 12 2026 - 11:47:33 -0500)
    SYSFW ABI: 4.0 (firmware rev 0x000c '12.1.2--v12.01.02 (Clever Cat)')
    Set clock rates for '/a53@0', CPU: 1000MHz at Speed Grade 'S'
    SPL initial stack usage: 13528 bytes
    Trying to boot from MMC2
    Authentication passed
    Authentication passed
    Loading Environment from nowhere... OK
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.15.0(release):v2.15.0
    NOTICE:  BL31: Built : 16:29:49, May 28 2026
    I/TC: 
    I/TC: OP-TEE version: 4.10.0 (gcc version 15.3.0 (GCC)) #1 Fri Apr 17 09:49:20 UTC 2026 aarch64
    I/TC: WARNING: This OP-TEE configuration might be insecure!
    I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
    I/TC: Primary CPU initializing
    I/TC: GIC redistributor base address not provided
    I/TC: Assuming default GIC group status and modifier
    I/TC: SYSFW ABI: 4.0 (firmware rev 0x000c '12.1.2--v12.01.02 (Clever Cat)')
    I/TC: Activated SA2UL device
    I/TC: Enabled firewalls for SA2UL TRNG device
    I/TC: EIP76D TRNG initialized
    I/TC: SA2UL Drivers initialized
    I/TC: HUK Initialized
    I/TC: Disabling output console
    
    U-Boot SPL 2026.01-g81bb31811776-dirty (Aug 12 2026 - 11:47:58 -0500)
    SYSFW ABI: 4.0 (firmware rev 0x000c '12.1.2--v12.01.02 (Clever Cat)')
    Trying to boot from MMC2
    Authentication passed
    Authentication passed
    
    
    U-Boot 2026.01-g81bb31811776-dirty (Aug 12 2026 - 11:47:58 -0500)
    
    SoC:   AM64X SR2.0 HS-FS
    Reset reason: RST
    Model: Texas Instruments AM642 EVM
    Board: AM64-EVM rev D
    DRAM:  2 GiB
    Core:  115 devices, 39 uclasses, devicetree: separate
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial@2800000
    Out:   serial@2800000
    Err:   serial@2800000
    Net:   eth0: ethernet@8000000port@1, eth2: icssg1-eth-port@0
    Hit any key to stop autoboot:  2 
    Hit any key to stop autoboot: 0
    => md.l 0x43000030 1
    43000030: 00000243                             C...
    => nand erase.chip
    
    NAND erase.chip: device 0 whole chip
    
    Erasing at 0x0 --   0% complete.
    Erasing at 0xa00000 --   1% complete.
    Erasing at 0x1440000 --   2% complete.
    Erasing at 0x1e80000 --   3% complete.
    Erasing at 0x28c0000 --   4% complete.
    Erasing at 0x3300000 --   5% complete.
    Erasing at 0x3d40000 --   6% complete.
    Erasing at 0x4780000 --   7% complete.
    Erasing at 0x51c0000 --   8% complete.
    Erasing at 0x5c00000 --   9% complete.
    Erasing at 0x6640000 --  10% complete.
    Erasing at 0x7080000 --  11% complete.
    Erasing at 0x7ac0000 --  12% complete.
    Erasing at 0x8500000 --  13% complete.
    Erasing at 0x8f40000 --  14% complete.
    Erasing at 0x9980000 --  15% complete.
    Erasing at 0xa3c0000 --  16% complete.
    Erasing at 0xae00000 --  17% complete.
    Erasing at 0xb840000 --  18% complete.
    Erasing at 0xc280000 --  19% complete.
    Erasing at 0xccc0000 --  20% complete.
    Erasing at 0xd700000 --  21% complete.
    Erasing at 0xe140000 --  22% complete.
    Erasing at 0xeb80000 --  23% complete.
    Erasing at 0xf5c0000 --  24% complete.
    Erasing at 0xffc0000 --  25% complete.
    Erasing at 0x10a00000 --  26% complete.
    Erasing at 0x11440000 --  27% complete.
    Erasing at 0x11e80000 --  28% complete.
    Erasing at 0x128c0000 --  29% complete.
    Erasing at 0x13300000 --  30% complete.
    Erasing at 0x13d40000 --  31% complete.
    Erasing at 0x14780000 --  32% complete.
    Erasing at 0x151c0000 --  33% complete.
    Erasing at 0x15c00000 --  34% complete.
    Erasing at 0x16640000 --  35% complete.
    Erasing at 0x17080000 --  36% complete.
    Erasing at 0x17ac0000 --  37% complete.
    Erasing at 0x18500000 --  38% complete.
    Erasing at 0x18f40000 --  39% complete.
    Erasing at 0x19980000 --  40% complete.
    Erasing at 0x1a3c0000 --  41% complete.
    Erasing at 0x1ae00000 --  42% complete.
    Erasing at 0x1b840000 --  43% complete.
    Erasing at 0x1c280000 --  44% complete.
    Erasing at 0x1ccc0000 --  45% complete.
    Erasing at 0x1d700000 --  46% complete.
    Erasing at 0x1e140000 --  47% complete.
    Erasing at 0x1eb80000 --  48% complete.
    Erasing at 0x1f5c0000 --  49% complete.
    Erasing at 0x1ffc0000 --  50% complete.
    Erasing at 0x20a00000 --  51% complete.
    Erasing at 0x21440000 --  52% complete.
    Erasing at 0x21e80000 --  53% complete.
    Erasing at 0x228c0000 --  54% complete.
    Erasing at 0x23300000 --  55% complete.
    Erasing at 0x23d40000 --  56% complete.
    Erasing at 0x24780000 --  57% complete.
    Erasing at 0x251c0000 --  58% complete.
    Erasing at 0x25c00000 --  59% complete.
    Erasing at 0x26640000 --  60% complete.
    Erasing at 0x27080000 --  61% complete.
    Erasing at 0x27ac0000 --  62% complete.
    Erasing at 0x28500000 --  63% complete.
    Erasing at 0x28f40000 --  64% complete.
    Erasing at 0x29980000 --  65% complete.
    Erasing at 0x2a3c0000 --  66% complete.
    Erasing at 0x2ae00000 --  67% complete.
    Erasing at 0x2b840000 --  68% complete.
    Erasing at 0x2c280000 --  69% complete.
    Erasing at 0x2ccc0000 --  70% complete.
    Erasing at 0x2d700000 --  71% complete.
    Erasing at 0x2e140000 --  72% complete.
    Erasing at 0x2eb80000 --  73% complete.
    Erasing at 0x2f5c0000 --  74% complete.
    Erasing at 0x2ffc0000 --  75% complete.
    Erasing at 0x30a00000 --  76% complete.
    Erasing at 0x31440000 --  77% complete.
    Erasing at 0x31e80000 --  78% complete.
    Erasing at 0x328c0000 --  79% complete.
    Erasing at 0x33300000 --  80% complete.
    Erasing at 0x33d40000 --  81% complete.
    Erasing at 0x34780000 --  82% complete.
    Erasing at 0x351c0000 --  83% complete.
    Erasing at 0x35c00000 --  84% complete.
    Erasing at 0x36640000 --  85% complete.
    Erasing at 0x37080000 --  86% complete.
    Erasing at 0x37ac0000 --  87% complete.
    Erasing at 0x38500000 --  88% complete.
    Erasing at 0x38f40000 --  89% complete.
    Erasing at 0x39980000 --  90% complete.
    Erasing at 0x3a3c0000 --  91% complete.
    Erasing at 0x3ae00000 --  92% complete.
    Erasing at 0x3b840000 --  93% complete.
    Erasing at 0x3c280000 --  94% complete.
    Erasing at 0x3ccc0000 --  95% complete.
    Erasing at 0x3d700000 --  96% complete.
    Erasing at 0x3e140000 --  97% complete.
    Erasing at 0x3eb80000 --  98% complete.
    Erasing at 0x3f5c0000 --  99% complete.
    Erasing at 0x3ffc0000 -- 100% complete.
    OK
    => nand bad
    
    Device 0 bad blocks:
    => nand info
    
    Device 0: nand0, sector size 256 KiB
      Page size         4096 b
      OOB size           256 b
      Erase size      262144 b
      ecc strength         8 bits
      ecc step size      512 b
      subpagesize       1024 b
      options       0x0000400c
      bbt options   0x00000000
    => mtd list
    SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
    List of MTD devices:
    * nand0
      - device: nand@0,0
      - parent: memory-controller@3b000000
      - driver: gpmc-nand
      - path: /bus@f4000/memory-controller@3b000000/nand@0,0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 256 bytes
      - OOB available: 142 bytes
      - ECC strength: 8 bits
      - ECC step size: 512 bytes
      - bitflip threshold: 6 bits
      - 0x000000000000-0x000040000000 : "nand0"
    	  - 0x000000000000-0x000000200000 : "NAND.tiboot3"
    	  - 0x000000200000-0x000000400000 : "NAND.tispl"
    	  - 0x000000400000-0x000000600000 : "NAND.tiboot3.backup"
    	  - 0x000000600000-0x000000a00000 : "NAND.u-boot"
    	  - 0x000000a00000-0x000000a40000 : "NAND.u-boot-env"
    	  - 0x000000a40000-0x000000a80000 : "NAND.u-boot-env.backup"
    	  - 0x000000a80000-0x000040000000 : "NAND.file-system"
    * nor0
      - device: flash@0
      - parent: spi@fc40000
      - driver: jedec_spi_nor
      - path: /bus@f4000/bus@fc00000/spi@fc40000/flash@0
      - type: NOR flash
      - block size: 0x40000 bytes
      - min I/O: 0x10 bytes
      - 0x000000000000-0x000004000000 : "nor0"
    	  - 0x000000000000-0x000000100000 : "ospi.tiboot3"
    	  - 0x000000100000-0x000000300000 : "ospi.tispl"
    	  - 0x000000300000-0x000000700000 : "ospi.u-boot"
    	  - 0x000000700000-0x000000740000 : "ospi.env"
    	  - 0x000000740000-0x000000780000 : "ospi.env.backup"
    	  - 0x000000800000-0x000003fc0000 : "ospi.rootfs"
    	  - 0x000003fc0000-0x000004000000 : "ospi.phypattern"
    => load mmc 1 ${loadaddr} tiboot3.bin
    566814 bytes read in 10 ms (54.1 MiB/s)
    => mtd write "NAND.tiboot3" ${loadaddr} 0 ${filesize}
    Size not on a page boundary (0x1000), rounding to 0x8b000
    Writing 569344 byte(s) (139 page(s)) at offset 0x00000000
    => load mmc 1 ${loadaddr} tispl.bin
    1157419 bytes read in 14 ms (78.8 MiB/s)
    => mtd write "NAND.tispl" ${loadaddr} 0 ${filesize}
    Size not on a page boundary (0x1000), rounding to 0x11b000
    Writing 1159168 byte(s) (283 page(s)) at offset 0x00000000
    => load mmc 1 ${loadaddr} u-boot.img
    1657859 bytes read in 22 ms (71.9 MiB/s)
    => mtd write "NAND.u-boot" ${loadaddr} 0 ${filesize}
    Size not on a page boundary (0x1000), rounding to 0x195000
    Writing 1658880 byte(s) (405 page(s)) at offset 0x00000000
    => load mmc 1:2 ${loadaddr} boot/am64_base_root_fs.ubi
    245104640 bytes read in 2589 ms (90.3 MiB/s)
    => mtd write "NAND.file-system" ${loadaddr} 0 ${filesize}
    Writing 245104640 byte(s) (59840 page(s)) at offset 0x00000000
    => 

    Booting u-boot/kernel/root_fs from GPMC-NAND
    - am64_12.1.0.5.3_nand_boot_full.log: the full boot log (u-boot, kernel, root_fs) from GPMC-NAND

    am64_12.1.0.5.3_nand_boot_full.zip