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.

AM6442: How to create ospi.rootfs(UBIFS) and boot Linux from OSPI without SD

Part Number: AM6442

Hello TI expert,

I would like to develop the device using AM6442 which can boot-up from OSPI without SD.

Currently, I am investigating the reference doc at https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/07_03_01_006/exports/docs/linux/Foundational_Components/U-Boot/UG-QSPI.html

and read information at  https://e2e.ti.com/support/processors-group/processors/f/processors-forum/848408/ccs-am6548-ubifs-create-error

Could you provide me how to create the ospi.rootfs(UBIFS) from the files of processor_sdk_linux_am64x_07_03_01_006/yocto-build/build/arago-tmp-external-arm-glibc/deploy/images/am64xx-evm/

Thanks

  • Hi Thinh,
    It'd take several steps to fully boot u-boot/kernel/dtb/rootfs... completely from OSPI in general.
    As a first step, have you tried building/flashing/booting u-boot (i.e. tiboot3.bin, tispl.bin, u-boot.img) from OSPI on AM64x EVM?
    For your reference, there's additional workaround when building/booting u-boot using SDK 7.3.1 as discussed in another e2e.
    e2e.ti.com/.../3759656

    Best,
    -Hong

  • Hi Hong,

    I have already build all of image package by yocto successfully.

    and my board can boot from OSPI and enter u-boot without SD.

    I want to run ospi.rootfs(ubifs) only because I have removed eMMC and SD device on my product. I will build a tiny rootfs for my product.

    Your reference ticket does not help me yet to resolve this issue.

    Thanks,

  • Hi Thinh,
    I'm attaching the log using SDK 7.3.1 from "mtdinfo -a" running @kernel.
    I think it is feasible to mount a small footprint rootfs as UBIFS on mtd5 (ospi.rootfs)
    I'll spend some time on this, and get back to you, most likely sometime next week.
    Best,
    -Hong

    am6_7.3.1_mtdinfo.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    am64xx-evm login: root
    root@am64xx-evm:~# uname -a
    Linux am64xx-evm 5.4.106-g023faefa70 #1 SMP PREEMPT Fri May 28 14:38:23 UTC 2021 aarch64 GNU/Linux
    root@am64xx-evm:~# mtdinfo -a
    Count of MTD devices: 7
    Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6
    Sysfs interface supported: yes
    mtd0
    Name: ospi.tiboot3
    Type: nor
    Eraseblock size: 262144 bytes, 256.0 KiB
    Amount of eraseblocks: 2 (524288 bytes, 512.0 KiB)
    Minimum input/output unit size: 16 bytes
    Sub-page size: 16 bytes
    Character device major/minor: 90:0
    Bad blocks are allowed: false
    Device is writable: true
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Dear Hong Guan64,

    Maybe you could not understand my opinions.

    I would like to clarify some information that I'm being stuck in that is: processor_sdk_linux_am64x_07_03_01_006 does not have any script to create the ubifs for ospi.rootfs. That is why my process of Linux booting is stuck at u-boot. (My product has only OSPI flash memory, not use eMMC/SD).

    Could you give me the script to create the ubifs?

    Thanks

  • Hi Thinh,
    Yes, understood your inquiry.
    I'll spend some time looking into the full OSPI boot flow, i.e. generating rootfs UBIFS, & UBI files which depends on AM64x EVM on-board OSPI parameters etc..., will get back to you, most likely earlier next week.
    Best,
    -Hong

  • Hello Hong,

    I am doing workaround by get the script from the old AM65x SDK and can make the ubifs file with some missing image from /root/boot/ (Image, dtb, vmlinx,) as log below:

    I have built a tiny rootfs from Yocto and decompress it into tmp/arago-am64x-tiny-image/

    After copy /targetNFS/boot/* to tmp/arago-am64x-tiny-image/boot/

    And then create ubifs file as below

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    brian@brian:~/processor_sdk_linux_am64x_07_03_01_006$ sudo ./create-ubifs.sh tmp/arago-am64x-tiny-image -v rootfs
    SDK path: /home/brian/processor_sdk_linux_am64x_07_03_01_006
    Parameters:
    image_rootfs_dir ..... "tmp/arago-am64x-tiny-image"
    image_name_prefix .... "/home/brian/processor_sdk_linux_am64x_07_03_01_006/filesystem/custom-am64xx-evm-rootfs"
    vol_name ............. "rootfs"
    mkfs.ubifs
    root: tmp/arago-am64x-tiny-image/
    min_io_size: 8
    leb_size: 130944
    max_leb_cnt: 448
    output: /home/brian/processor_sdk_linux_am64x_07_03_01_006/filesystem/custom-am64xx-evm-rootfs.ubifs
    jrn_size: 7201920
    reserved: 0
    compr: lzo
    keyhash: r5
    fanout: 8
    orph_lebs: 1
    space_fixup: 0
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And then downloading it into OSPI Flash and boot up:

    => dhcp 0x80000000 custom-am64xx-evm-rootfs.ubifs
    link up on port 1, speed 1000, full duplex
    BOOTP broadcast 1
    DHCP client bound to address 192.168.1.11 (11 ms)
    Using ethernet@8000000 device
    TFTP from server 192.168.1.9; our IP address is 192.168.1.11
    Filename 'custom-am64xx-evm-rootfs.ubifs'.
    Load address: 0x80000000
    Loading: #################
             289.1 KiB/s
    done
    Bytes transferred = 23308032 (163a700 hex)

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    => sf probe
    WARN: Unable to get temperature. Assuming room temperature
    SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
    => sf erase 0x800000 2000000
    SF: 33554432 bytes @ 0x800000 Erased: OK
    => sf update 0x80000000 0x800000 0x$filesize
    device 0 offset 0x800000, size 0x163a700
    23045888 bytes written, 262144 bytes skipped in 143.294s, speed 167683 B/s
    => env set boot ubi
    => boot
    SD/MMC found on device 1
    ## Error: "init_ubi" not defined
    ## Error: "get_kern_ubi" not defined
    ## Error: "get_fdt_ubi" not defined
    Bad Linux ARM64 Image magic!
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I don't know why 262144 bytes skipped in write command and it can not bootup.

    I went to SD Linux and mout my ubifs and

    shown wrong fs type, bad option, bad superblock on ubi0:thinh_ubi, missing codepage or helper program, or other error.

    It seems there is an error in ubifs file.

  • Hi Thinh,
    I'm looking into your inquiry, including root_fs UBIFS/UBI files creation etc..., will get back to you early next week.
    Best,
    -Hong

  • Hello Hong,

    While waiting for your feedback I continue to workaround as below process.

    1. Bootup Linux from SD card and create the ubifs filesystem on mtd5 partition of SNOR.

    1.1 List out partions by the following command:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    root@am64xx-evm:/# cat /proc/mtd
    dev: size erasesize name
    mtd0: 00080000 00040000 "ospi.tiboot3"
    mtd1: 00200000 00040000 "ospi.tispl"
    mtd2: 00400000 00040000 "ospi.u-boot"
    mtd3: 00040000 00040000 "ospi.env"
    mtd4: 00040000 00040000 "ospi.env.backup"
    mtd5: 037c0000 00040000 "ospi.rootfs"
    mtd6: 00040000 00040000 "ospi.phypattern"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.2 Format the ospi.rootfs partition:

    Fullscreen
    1
    2
    3
    4
    5
    root@am64xx-evm:/# ubiformat /dev/mtd5
    ubiformat: mtd5 (nor), size 58458112 bytes (55.7 MiB), 223 eraseblocks of 262144 bytes (256.0 KiB), min. I/O size 16 bytes
    libscan: scanning eraseblock 222 -- 100 % complete
    ubiformat: 223 eraseblocks are supposedly empty
    ubiformat: formatting eraseblock 222 -- 100 % complete
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.3 Attach /dev/mtd5 (ospi.rootfs) to UBI:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    root@am64xx-evm:/# ubiattach /dev/ubi_ctrl -m 5
    [ 1812.828857] ubi0: attaching mtd5
    [ 1812.845075] ubi0: scanning is finished
    [ 1812.852783] ubi0: attached mtd5 (name "ospi.rootfs", size 55 MiB)
    [ 1812.858967] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
    [ 1812.865908] ubi0: min./max. I/O unit sizes: 16/256, sub-page size 16
    [ 1812.872300] ubi0: VID header offset: 64 (aligned 64), data offset: 128
    [ 1812.878838] ubi0: good PEBs: 223, bad PEBs: 0, corrupted PEBs: 0
    [ 1812.884861] ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
    [ 1812.892089] ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 403966760
    [ 1812.901135] ubi0: available PEBs: 219, total reserved PEBs: 4, PEBs reserved for bad PEB handling: 0
    [ 1812.910278] ubi0: background thread "ubi_bgt0d" started, PID 976
    UBI device number 0, total 223 LEBs (58429568 bytes, 55.7 MiB), available 219 LEBs (57381504 bytes, 54.7 MiB), LEB size 262016 bytes (255.8 K)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.4 Create UBI volumes:

    Fullscreen
    1
    2
    root@am64xx-evm:/# ubimkvol /dev/ubi0 -s 50MiB -N rootfs
    Volume ID 0, size 201 LEBs (52665216 bytes, 50.2 MiB), LEB size 262016 bytes (255.8 KiB), dynamic, name "rootfs", alignment 1
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.5 Create a rootfs.ubi directory in root:

    Fullscreen
    1
    root@am64xx-evm:/# mkdir rootfs.ubi
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.6 Mount ubi0.rootfs(ospi.rootfs) into the created directory rootfs.ubi

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    [ 2130.561582] UBIFS (ubi0:0): default file-system created
    [ 2130.566898] UBIFS (ubi0:0): Mounting in unauthenticated mode
    [ 2130.573133] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 1025
    [ 2130.589493] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
    [ 2130.596979] UBIFS (ubi0:0): LEB size: 262016 bytes (255 KiB), min./max. I/O unit sizes: 16 bytes/256 bytes
    [ 2130.606656] UBIFS (ubi0:0): FS size: 50045056 bytes (47 MiB, 191 LEBs), journal size 2620160 bytes (2 MiB, 10 LEBs)
    [ 2130.617093] UBIFS (ubi0:0): reserved for root: 2363750 bytes (2308 KiB)
    [ 2130.623716] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID D3EEC4F0-9471-483F-B448-1F31D53EB8F3, small LPT model
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.7 Decompress the tisdk-tiny-image into the rootfs.ubi directory:

    Fullscreen
    1
    2
    root@am64xx-evm:/# tar -xvf tisdk-tiny-image-am64xx-evm-20210714070458.rootfs.tar.xz -C rootfs.ubi/
    root@am64xx-evm:/# sync
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1.8 copy all things in /boot/* to /rootfs.ubi/boot/

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    root@am64xx-evm:/# cp boot/* rootfs.ubi/boot/
    root@am64xx-evm:/# sync
    root@am64xx-evm:/# ls rootfs.ubi/boot/
    Image k3-am642-evm.dtb vmlinux.gz-5.4.87-gb6adce5bd1
    Image-5.4.87-gb6adce5bd1 vmlinux.gz
    root@am64xx-evm:/# ls rootfs.ubi/
    bin dev home linuxrc mnt run sys usr
    boot etc lib media proc sbin tmp var
    root@am64xx-evm:/# umount rootfs.ubi/
    [ 2058.377258] UBIFS (ubi0:0): un-mount UBI device 0
    [ 2058.382258] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" stops
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    2. Verify the ubifs on the ospi.rootfs partition
    Reboot the board and still bootup again from SD card,
    login the root dir after that attaching /dev/mtd5 to UBI,
    mount ubi0.rootfs to the created dir /rootfs.ubi/ and checking kerel image and dtb file.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    root@am64xx-evm:/# ubiattach /dev/ubi_ctrl -m 5
    [ 311.268337] ubi0: attaching mtd5
    [ 311.283124] ubi0: scanning is finished
    [ 311.291413] ubi0: attached mtd5 (name "ospi.rootfs", size 55 MiB)
    [ 311.297549] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
    [ 311.305921] ubi0: min./max. I/O unit sizes: 16/256, sub-page size 16
    [ 311.312734] ubi0: VID header offset: 64 (aligned 64), data offset: 128
    [ 311.319336] ubi0: good PEBs: 223, bad PEBs: 0, corrupted PEBs: 0
    [ 311.325415] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
    [ 311.332644] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 403966760
    [ 311.341689] ubi0: available PEBs: 18, total reserved PEBs: 205, PEBs reserved for bad PEB handling: 0
    [ 311.351010] ubi0: background thread "ubi_bgt0d" started, PID 791
    UBI device number 0, total 223 LEBs (58429568 bytes, 55.7 MiB), available 18 LEBs (4716288 bytes, 4.4 MiB), LEB size 262016 bytes (255.8 KiB)
    root@am64xx-evm:/# mount -t ubifs ubi0:rootfs rootfs.ubi/
    [ 338.021255] UBIFS (ubi0:0): Mounting in unauthenticated mode
    [ 338.027208] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 803
    [ 338.038447] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
    [ 338.045932] UBIFS (ubi0:0): LEB size: 262016 bytes (255 KiB), min./max. I/O unit sizes: 16 bytes/256 bytes
    [ 338.055615] UBIFS (ubi0:0): FS size: 50045056 bytes (47 MiB, 191 LEBs), journal size 2620160 bytes (2 MiB, 10 LEBs)
    [ 338.066055] UBIFS (ubi0:0): reserved for root: 2363750 bytes (2308 KiB)
    [ 338.072677] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID D3EEC4F0-9471-483F-B448-1F31D53EB8F3, small LPT model
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Conclusion: UBIFS was created on ospi.rootfs by application on ARAGO Linux successfully.

    3. Poweroff the EVM board, and to switch off the power switch.

    And then switch OSPI boot mode, switch on the power switch.
     And enter the u-boot.
    3.1 Checking u-boot env

    Fullscreen
    1
    2
    3
    4
    => print
    args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 ${mtdparts}
    args_ubi=setenv bootargs ${console} ${optargs} rootfstype=ubifs root=ubi0:rootfs rw ubi.mtd=ospi.rootfs
    init_ubi=run args_all args_ubi; sf probe; ubi part ospi.rootfs; ubifsmount ubi:rootfs;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    3.2 Run some the following commands:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    => run args_all
    => run args_ubi
    => sf probe
    WARN: Unable to get temperature. Assuming room temperature
    SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
    => ubi part ospi.rootfs
    ubi0: attaching mtd6
    ubi0: scanning is finished
    ubi0 error: vtbl_check: bad CRC at record 127: 0xf116c36b, not 0x000000
    Volume table record 127 dump:
    reserved_pebs 0
    alignment 0
    data_pad 0
    vol_type 0
    upd_marker 0
    name_len 0
    name NULL
    ubi0: volume table was restored
    ubi0: attached mtd6 (name "ospi.rootfs", size 55 MiB)
    ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
    ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    There is a problem in attaching ospi.rootfs to UBI.
    There is a difference in the " min/max. I/O unit sizes " of UBI function between u-boot and Linux apps.
    Please take a look the message and help me to resolve the issue. Thanks.

  • Hi Thinh,
    I'm able to have full OSPI boot on AM64x EVM using SDK 7.3.1, and summarizing the steps for your reference:
    1. Re-partition OSPI MTD partitions
    There are 7 partitions in kernel in SDK 7.3.1 as listed below:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    [ 2.139178] spi-nor spi0.0: s28hs512t (65536 Kbytes)
    [ 2.144180] 7 cmdlinepart partitions found on MTD device fc40000.spi.0
    [ 2.150702] Creating 7 MTD partitions on "fc40000.spi.0":
    [ 2.156102] 0x000000000000-0x000000080000 : "ospi.tiboot3"
    [ 2.162856] 0x000000080000-0x000000280000 : "ospi.tispl"
    [ 2.169423] 0x000000280000-0x000000680000 : "ospi.u-boot"
    [ 2.176018] 0x000000680000-0x0000006c0000 : "ospi.env"
    [ 2.182348] 0x0000006c0000-0x000000700000 : "ospi.env.backup"
    [ 2.189285] 0x000000800000-0x000003fc0000 : "ospi.rootfs"
    [ 2.195853] 0x000003fc0000-0x000004000000 : "ospi.phypattern"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I re-partition OSPI by modifying "mtdparts" bootargs as listed below:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    setenv mtdparts mtdparts=fc40000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),1m(ospi.dtb),20m@8m(ospi.kernel),36608k(ospi.rootfs),256k(ospi.phypattern)
    =>
    [ 2.139098] spi-nor spi0.0: s28hs512t (65536 Kbytes)
    [ 2.144100] 9 cmdlinepart partitions found on MTD device fc40000.spi.0
    [ 2.150622] Creating 9 MTD partitions on "fc40000.spi.0":
    [ 2.156021] 0x000000000000-0x000000080000 : "ospi.tiboot3"
    [ 2.162771] 0x000000080000-0x000000280000 : "ospi.tispl"
    [ 2.169339] 0x000000280000-0x000000680000 : "ospi.u-boot"
    [ 2.175928] 0x000000680000-0x0000006c0000 : "ospi.env"
    [ 2.182260] 0x0000006c0000-0x000000700000 : "ospi.env.backup"
    [ 2.189192] 0x000000700000-0x000000800000 : "ospi.dtb"
    [ 2.195457] 0x000000800000-0x000001c00000 : "ospi.kernel"
    [ 2.202151] 0x000001c00000-0x000003fc0000 : "ospi.rootfs"
    [ 2.208732] 0x000003fc0000-0x000004000000 : "ospi.phypattern"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Where the two additional fixed partitions are added for "ospi.dtb" and "ospi.kernel". Refer to the attached log file "am6_mtdinfo_ospi.txt" for more details. By doing so, it is possible to load the kernel/dtb to DDR from OSPI using "sf..." cmd @u-boot instead of accessing them from "ospi.rootfs" under UBI.

    2. Generate UBIFS/UBI rootfs files
    I used the following cmds to generate UBIFS/UBI files for a reference SDK tiny file system "sdk-tiny-fs" (~8MiB):

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    - "mkfs.ubifs -r sdk-tiny-fs -o am6-sdk-tiny-fs.ubifs -m 16 -e 262016 -c 143 -v"
    - "ubinize -o am6-sdk-tiny-fs.ubi -m 16 -s 16 -p 256KiB ubinize.cfg -v"
    ubinize.cfg:
    [ubifs]
    mode=ubi
    image=am6-sdk-tiny-fs.ubifs
    vol_id=0
    vol_type=dynamic
    vol_name=rootfs
    vol_flags=autoresize
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Note that:
    - I found very useful reference on MTD/UBI/UBIFS:
    www.linux-mtd.infradead.org/.../ubi.html
    www.linux-mtd.infradead.org/.../ubifs.html
    - The parameters used in the above "mkfs.ubifs..." and "ubinize..." cmds are based on the MTD7 partition for ospi.rootfs as listed below.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    mtd7
    Name: ospi.rootfs
    Type: nor
    Eraseblock size: 262144 bytes, 256.0 KiB
    Amount of eraseblocks: 143 (37486592 bytes, 35.7 MiB)
    Minimum input/output unit size: 16 bytes
    Sub-page size: 16 bytes
    Character device major/minor: 90:14
    Bad blocks are allowed: false
    Device is writable: true
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    3. Flash the generated UBI rootfs file "am6-sdk-tiny-fs.ubi" to OSPI in kernel from SD card boot as an example:
    I used "ubiformat /dev/mtd7 -f am6-sdk-tiny-fs.ubi" at kernel to flash/format the UBI rootfs file to MTD7 (ospi.rootfs).
    Refer to the attached log file "am6_ubiformat_ospi.txt" for more details.
    I also attached another log file "am6_ubiattach_ospi.txt" to show attaching MDT7 (ospi.rootfs) for testing.

    4. Flash rest of files to OSPI at u-boot from SD card boot as an example:
    Refer to the attached log file "am6_flash_ospi.txt" for flashing tiboot3.bin/tispl.bin/u-boot.img/kernel/dtb to OSPI @u-boot from SD card boot

    5. Full boot from OSPI
    Note the following u-boot cmds, and refer to the attached log file "am6_7.3.1_ospi_boot.txt" for full OSPI boot log:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    - OSPI MTD re-partition
    setenv mtdparts mtdparts=fc40000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),1m(ospi.dtb),20m@8m(ospi.kernel),36608k(ospi.rootfs),256k(ospi.phypattern)
    - env setup
    run findfdt; run envboot; run args_all; run finduuid
    setenv bootargs console=${console} ${optargs} root=ubi0:rootfs rw ubi.mtd=ospi.rootfs rootfstype=ubifs rootwait=1
    - load kernel/dtb from OSPI to DDR, and then boot kernel....
    sf probe; sf read ${loadaddr} 0x800000 0x1100000; sf read ${fdtaddr} 0x700000 0x10000; run run_kern
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Best,

    -Hong

    am6_mtdinfo_ospi.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 16:20:13 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    SPL initial stack usage: 13396 bytes
    Trying to boot from MMC2
    Starting ATF on ARM64 core...
    NOTICE: BL31: v2.4(release):2021.00.003-dirty
    NOTICE: BL31: Built : 14:41:43, May 28 2021
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    Trying to boot from MMC2
    U-Boot 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SoC: AM64X SR1.0
    Model: Texas Instruments AM642 EVM
    Board: AM64-GPEVM rev E2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    am6_ubiformat_ospi.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 16:20:13 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    SPL initial stack usage: 13396 bytes
    Trying to boot from MMC2
    Starting ATF on ARM64 core...
    NOTICE: BL31: v2.4(release):2021.00.003-dirty
    NOTICE: BL31: Built : 14:41:43, May 28 2021
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    Trying to boot from MMC2
    U-Boot 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SoC: AM64X SR1.0
    Model: Texas Instruments AM642 EVM
    Board: AM64-GPEVM rev E2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    am6_ubiattach_ospi.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    root@am64xx-evm:/boot# uname -a
    Linux am64xx-evm 5.4.106-g023faefa70 #1 SMP PREEMPT Fri May 28 14:38:23 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
    root@am64xx-evm:/boot# mtdinfo -a
    Count of MTD devices: 9
    Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7, mtd8
    Sysfs interface supported: yes
    mtd0
    Name: ospi.tiboot3
    Type: nor
    Eraseblock size: 262144 bytes, 256.0 KiB
    Amount of eraseblocks: 2 (524288 bytes, 512.0 KiB)
    Minimum input/output unit size: 16 bytes
    Sub-page size: 16 bytes
    Character device major/minor: 90:0
    Bad blocks are allowed: false
    Device is writable: true
    mtd1
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    am6_flash_ospi.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 16:20:13 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    SPL initial stack usage: 13396 bytes
    Trying to boot from MMC2
    Starting ATF on ARM64 core...
    NOTICE: BL31: v2.4(release):2021.00.003-dirty
    NOTICE: BL31: Built : 14:41:43, May 28 2021
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    Trying to boot from MMC2
    U-Boot 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SoC: AM64X SR1.0
    Model: Texas Instruments AM642 EVM
    Board: AM64-GPEVM rev E2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    5482.am6_7.3.1_ospi_boot.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 16:20:13 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    SPL initial stack usage: 13396 bytes
    Trying to boot from SPI
    WARN: Unable to get temperature. Assuming room temperature
    Starting ATF on ARM64 core...
    NOTICE: BL31: v2.4(release):2021.00.003-dirty
    NOTICE: BL31: Built : 14:41:43, May 28 2021
    U-Boot SPL 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    Trying to boot from SPI
    WARN: Unable to get temperature. Assuming room temperature
    U-Boot 2020.01-ge995ed0ec1 (May 28 2021 - 14:48:57 +0000)
    SoC: AM64X SR1.0
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Hong,

    Thanks for your response. It is very useful item for me. My board works well.

    Today I have also tried to load/start kernel/dtb by command

    run args_all
    run args_ubi
    setenv boot ubi
    ext4load mmc 1:2 0x82000000 /boot/Image
    ext4load mmc 1:2 0x81200000 /boot/k3-j721e-common-proc-board.dtb
    booti 0x82000000 - 0x81200000

    =>>>> Kernel driver can attach mtd6 to UBI well thereby affirming that the ubi on U-Boot have issue.
    ubi part ospi.rootfs has error at attaching mtd6 process)

    Does TI plan to fix ubi on your u-boot in the upcoming SDK?

    Thanks you again.
  • Hi Thinh,
    It is good to know you were able to have full OSPI boot at your setup.

    The ubi/ubifsmount... cmds at u-boot in SDK 7.3.1 are not fully enabled/validated.
    In fact, using the native "sf..." cmd to load kernel/dtb as in my last reply would run faster than "ubi part rootfs", "ubifsmount ubi:rootfs", "ubifsload..." in general.

    I'd think to use the "sf..." cmd at u-boot to load kernel/dtb from OSPI to DDR, launch kernel, and
    then mount UBIFS/UBI "ospi.rootfs" with kernel MTD utility as we've already verified the full OSPI boot flow.

    Best,
    -Hong

  • Hello Hong,

    I am really to thank you so much for your support.

    If you don't mind, please take a look my following descriptions and please explain some ARG parameters of mkfs.ubifs/ubinize command I didn't understand.

    I have read carefully the "Minimum flash input/output unit" at link

    http://www.linux-mtd.infradead.org/doc/ubi.html#L_min_io_unit

         which has

    • NOR flashes usually have a minimum I/O unit size of 1 byte, because NOR flashes usually allow reading and writing single bytes (in fact, it is even be possible to change individual bits).
    • Some NOR flashes may have other minimum I/O unit sizes, e.g. 16 or 32 bytes in the case of ECC'd NOR flashes.

    In AM64x-EVM board uses NOR s28hs512t has Built-in Error Correcting Code (ECC) corrects Single-bit Erro.

    1. Could you explain me why you select the mkfs.ubifs ARGS is -m -16, I now can't find the document that describes NOT s28hs512t read/write sigle as 16 bytes.

    2. parameter: -p 256KiB that means is physical erase size 256 KiB. Right?

    3. parameter: -e 262016 -c 143 that means is 262016 multiplied by 143 that is about 35MiB. the resulting image filesystem may be put on volumes up to about 35MiB. How you can calculate the parameters of -e and -c? Please let me know your recipe?

    Thank you so much.

  • Hi Thinh,

    Yes, I found very useful reference on MTD/UBIFS/UBI:
    www.linux-mtd.infradead.org/.../ubi.html
    www.linux-mtd.infradead.org/.../ubifs.html

    Let's see steps I used to get the parameters for the following two cmds to generate UBIFS/UBI files (am6-sdk-tiny-fs.ubifs/am6-sdk-tiny-fs.ubi)
    for MTD partition mtd7(ospi.rootfs) mounted on OSPI-NOR on AM64x GP EVM:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    - "mkfs.ubifs -r sdk-tiny-fs -o am6-sdk-tiny-fs.ubifs -m 16 -e 262016 -c 143 -v"
    - "ubinize -o am6-sdk-tiny-fs.ubi -m 16 -s 16 -p 256KiB ubinize.cfg -v"
    ubinize.cfg:
    [ubifs]
    mode=ubi
    image=am6-sdk-tiny-fs.ubifs
    vol_id=0
    vol_type=dynamic
    vol_name=rootfs
    vol_flags=autoresize
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    #1. OSPI-NOR is MTD partitioned as defined in the "mtdparts" bootargs, where both u-boot and kernel would used it for mtdparts.

    Fullscreen
    1
    setenv mtdparts mtdparts=fc40000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),1m(ospi.dtb),20m@8m(ospi.kernel),36608k(ospi.rootfs),256k(ospi.phypattern)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    #2. Run "mtdinfo -a" after kernel boot-up from any working boot media (i.e. SD card)

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    root@am64xx-evm:~# mtdinfo -a
    Count of MTD devices: 9
    Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7, mtd8
    Sysfs interface supported: yes
    ...
    ...
    mtd7
    Name: ospi.rootfs
    Type: nor
    Eraseblock size: 262144 bytes, 256.0 KiB
    Amount of eraseblocks: 143 (37486592 bytes, 35.7 MiB)
    Minimum input/output unit size: 16 bytes
    Sub-page size: 16 bytes
    Character device major/minor: 90:14
    Bad blocks are allowed: false
    Device is writable: true
    ...
    ...
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    #3. Note on how I got the parameters used in the two cmds (mkfs.ubifs/ubinize) based on mtd7 (ospi.rootfs) info from #2 above:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    a). "mkfs.ubifs -r sdk-tiny-fs -o am6-sdk-tiny-fs.ubifs -m 16 -e 262016 -c 143 -v"
    - "Minimum input/output unit size: 16 bytes" => "-m 16"
    - 262144 - 128 (see the note below on ubi headers) = 262016 => "-e 262016"
    - "Amount of eraseblocks: 143 (37486592 bytes, 35.7 MiB)" => "-c 143"
    b). "ubinize -o am6-sdk-tiny-fs.ubi -m 16 -s 16 -p 256KiB ubinize.cfg -v"
    - "Minimum input/output unit size: 16 bytes" => "-m 16"
    - "Sub-page size: 16 bytes" => "-s 16"
    - "Eraseblock size: 262144 bytes, 256.0 KiB" => "-p 256KiB"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Note on "ubi header"
    www.linux-mtd.infradead.org/.../ubi.html
    UBI stores 2 small 64-byte headers at the beginning of each non-bad physical eraseblock:
    - erase counter header (or EC header) which contains the erase counter of the physical eraseblock (PEB) plus other information;
    - volume identifier header (or VID header) which stores the volume ID and the logical eraseblock (LEB) number to which this PEB belongs.

    Hope these steps are helpful!

    Best,

    -Hong

  • Hello Hong,

    I am really thank you for your explanations.

    I have a special case in the fact. I design a prototype board using only the ospi, uart, Ethernet, but without eMMC/SD. In order to get some parameters of mkfs.ubifs/ubinize, I perform step 1, and step 2 using NFS booting. Do you think it's possible?

    In the event of without media device, ethernet. I don't know how to get the accurate parameters as above. Do you have suggestion for me?

    Thanks

    Thinh Nguyen

  • Hi Thinh,
    Yes, it is feasible and easier to get the parameters for cmds to generate UBIFS/UBI files from running "mtdinfo -a" after kernel up.
    In fact, these parameters are dependent on OSPI-NOR device, and can be calculated beforehand.
    "-c 143" can also be determined based on the MTD partition size selected for "ospi.rootfs".
    Best,
    -Hong