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.

Linux/TCI6638K2K: Facing issue with flashing UBI

Part Number: TCI6638K2K


Tool/software: Linux

Hi,

setup details:

SDK: ti-processor-sdk-linux-k2hk-evm-02.00.02.11

Platform: XTCIEVMK2X

Images used:

ubi: tisdk-server-rootfs-image-k2hk-evm.ubi

u-boot: u-boot-spi-k2hk-evm.gph


We trying to flash pre-build ubi image to XTCIEVMK2X platfrom from U-Boot, But we faced following issues:

U-Boot SPL 2015.07 (Apr 05 2016 - 20:26:28)


U-Boot 2015.07 (Apr 05 2016 - 20:26:28 -0400)

CPU: 66AK2Hx SR1.1
I2C:   ready
DRAM:  DDR3A Speed will be configured for 1333 Operation.
Detected SO-DIMM [SQR-SD3T-2G1333SED]
DDR3 speed 1333
DRAM: 2 GiB (includes reported below)
2 GiB
NAND:  512 MiB
Net:   Phy 2 not found
Phy 3 not found
K2HK_EMAC, K2HK_EMAC1
Error: K2HK_EMAC1 address not set.
, K2HK_EMAC2
Error: K2HK_EMAC2 address not set.
, K2HK_EMAC3
Error: K2HK_EMAC3 address not set.

Hit any key to stop autoboot:  0
UBI: attaching mtd1 to ubi0
UBI: scanning is finished
UBI: volume 0 ("rootfs") re-sized from 3129 to 4000 LEBs
UBI: attached mtd1 (name "mtd=2", size 510 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 4080, bad PEBs: 4, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1237718748
UBI: available PEBs: 0, total reserved PEBs: 4080, PEBs reserved for bad PEB handling: 76
Error reading superblock on volume 'boot' errno=-22!
ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume
UBIFS not mounted, use ubifs mount to mount volume first!
ubifsload - load file from an UBIFS filesystem

Usage:
ubifsload <addr> <filename> [bytes]
    - load file 'filename' to address 'addr'

Can anyone please help me to sort out this issue.

Thanks in advance.

Regards,

Yashavanth

  • Hi, Yashavanth,

    Is the u-boot logs in the post captured before or after you flashed the ubi image? If it is after flashing and trying to boot with the image, how did you flash the image, and if from u-boot prompt, could you show the commands you used for flashing the ubi image? What was the u-boot version before flashing? You listed 2 images, do you flash both or what did you do with them? Any reason the ProcSDK 2.0.2.11 is used instead of the latest one, 4.2.0.9? Sorry for all these questions, I just try to see if anything wrong I can capture in the process.

    I don't have 2.0.2 installed on my system, could you check the size of ubi and be sure it fits the NAND. I am not sure since which release, tisdk-server-rootfs ubi file size became too big to fit in the NAND. If that's the case, you may want to try using arago-base ubi image.

    If you really want to use tisdk-server-rootfs for development, will NFS mounted filesystem work for you?

    Rex
  • Hi Rex,

    SDK: ProSDK 4.2.0.9

    Uboot: U-Boot 2017.01-g340fb36f04

    I'm able to flash the Prebuild UBI image of ProcSDK 4.2.0.9, But I'm facing issue in flashing newly created UBI file.

    UBI create command:

    ./mkfs.ubifs -r tisdk-server-rootfs-image-k2hk-evm/ -o tisdk-k2hk-evm.ubifs -F -m 2048 -e 126976 -c 3969

    vim ubinize.cfg

    [ubifs_rootfs_volume]
    mode=ubi
    image=tisdk-k2hk-evm.ubifs
    vol_id=0
    vol_size=497MiB
    vol_type=dynamic
    vol_name=rootfs
    vol_flags=autoresize

    ./ubinize -o tisdk-k2hk-evm.ubi -m 2048 -p 128KiB -s 2048 -O 2048 ubinize.cfg

    Procedure followed to flash UBI:

    => env default -f -a
    ## Resetting to default environment
    => setenv serverip 192.168.1.2
    => setenv ipaddr 192.168.1.1
    => setenv tftp_root /tftpboot/sdk_4.02
    => nand erase.part ubifs


    NAND erase.part: device 0 offset 0x180000, size 0x1fe80000
    Skipping bad block at  0x1ff80000                                          
    Skipping bad block at  0x1ffa0000                                          
    Skipping bad block at  0x1ffc0000                                          
    Skipping bad block at  0x1ffe0000                                          

    OK


    => tftp ${addr_ubi} ${tftp_root}/tisdk-k2hk-evm.ubi

    netcp@2000000 Waiting for SGMII auto negotiation to complete. done
    Using netcp@2000000 device
    TFTP from server 192.168.1.2; our IP address is 192.168.1.1
    Filename '/tftpboot/sdk_4.02/ tisdk-k2hk-evm.ubi'.
    Load address: 0x82000000
    Loading: #################################################################
             #################################################################

             2.1 MiB/s
    done
    Bytes transferred = 520617984 (1f080000 hex)
    => nand write ${addr_ubi} ubifs ${filesize}

    NAND write: device 0 offset 0x180000, size 0x1f080000
     520617984 bytes written: OK

    following error I got after flashing newly created ubi from u-boot console while boot.

    => boot
    ubi0: detaching mtd1
    ubi0: mtd1 is detached
    ubi0: attaching mtd1
    ubi0: scanning is finished
    ubi0: attached mtd1 (name "mtd=2", size 510 MiB)
    ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
    ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
    ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
    ubi0: good PEBs: 4080, bad PEBs: 4, corrupted PEBs: 0
    ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
    ubi0: max/mean erase counter: 1/1, WL threshold: 4096, image sequence number: 0
    ubi0: available PEBs: 4000, total reserved PEBs: 80, PEBs reserved for bad PEB handling: 76
    Error reading superblock on volume 'ubi:rootfs' errno=-19!
    ubifsmount - mount UBIFS volume

    Usage:
    ubifsmount <volume-name>
        - mount 'volume-name' volume
    UBIFS not mounted, use ubifs mount to mount volume first!
    ubifsload - load file from an UBIFS filesystem

    Usage:
    ubifsload <addr> <filename> [bytes]
        - load file 'filename' to address 'addr'
    UBIFS not mounted, use ubifs mount to mount volume first!
    ubifsload - load file from an UBIFS filesystem

    Usage:
    ubifsload <addr> <filename> [bytes]
        - load file 'filename' to address 'addr'
    UBIFS not mounted, use ubifs mount to mount volume first!
    ubifsload - load file from an UBIFS filesystem

    Usage:
    ubifsload <addr> <filename> [bytes]
        - load file 'filename' to address 'addr'
    UBIFS not mounted, use ubifs mount to mount volume first!
    ubifsload - load file from an UBIFS filesystem

    Usage:
    ubifsload <addr> <filename> [bytes]
        - load file 'filename' to address 'addr'

    Image size:

    tisdk-k2hk-evm.ubi - 497 Mb -> Newly build image (Failed while booting)

    tisdk-server-rootfs-image-k2hk-evm.ubi - 497 Mb -> Prebuild UBI image(Flashed successfully able to boot completely)

    Nand size - 512 MB

    => mtdparts

    device nand0 <davinci_nand.0>, # parts = 3
     #: name                size            offset          mask_flags
     0: bootloader          0x00100000      0x00000000      1
     1: params              0x00080000      0x00100000      1
     2: ubifs               0x1fe80000      0x00180000      0

    active partition: nand0,0 - (bootloader) 0x00100000 @ 0x00000000

    defaults:
    mtdids  : nand0=davinci_nand.0
    mtdparts: mtdparts=davinci_nand.0:1024k(bootloader)ro,512k(params)ro,-(ubifs)

    Can you please let me know, am I doing anything wrong in following the procedure?


    Thanks in advance.

    With regards,

    Yashavanth

  • Hi, Yashavanth,

    Ok. If the prebuilt ubi image works, then the issue is ubi file creation. Let me look into it.

    Rex
  • Hi, Yashavanth,

    I am able to ubinize the image and boot from ubi.

    2218 mkfs.ubifs -r tisdk -o k2hk.ubifs -F -m 2048 -e 126976 -c 3970
    2229 ubinize -o k2hk.ubi -m 2048 -p 128KiB -s 2048 -O 2048 ubinize.cfg

    I used "-c 3970" not your "-c 3969" because the system suggests it when I use "-c 3900" as in yocto build.

    and my ubinize.cfg is

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

    udb-station:~/tftpboot/psdk4209-k2h$ ll *.ubi
    lrwxrwxrwx 1 xxxxxxxx cleartnp 8 Feb 9 15:13 k2hk-evm-ubifs.ubi -> k2hk.ubi
    -rw-r--r-- 1 xxxxxxxx cleartnp 520617984 Feb 9 16:16 k2hk.ubi


    Boot logs:

    => run get_ubi_net

    netcp@2000000 Waiting for SGMII auto negotiation to complete. done
    BOOTP broadcast 1
    BOOTP broadcast 2
    BOOTP broadcast 3
    DHCP client bound to address 158.218.109.236 (1065 ms)
    Using netcp@2000000 device
    TFTP from server 158.218.109.194; our IP address is 158.218.109.236
    Filename 'psdk4209-k2h/k2hk-evm-ubifs.ubi'.
    Load address: 0x82000000
    Loading: #################################################################
    #################################################################
    #################################################################
    2.1 MiB/s
    done
    Bytes transferred = 520617984 (1f080000 hex)
    => run burn_ubi

    NAND erase.part: device 0 offset 0x180000, size 0x1fe80000
    Skipping bad block at 0x1ff80000
    Skipping bad block at 0x1ffa0000
    Skipping bad block at 0x1ffc0000
    Skipping bad block at 0x1ffe0000

    OK

    NAND write: device 0 offset 0x180000, size 0x1f080000
    520617984 bytes written: OK
    => pri init_ubi
    init_ubi=run args_all args_ubi; ubi part ubifs; ubifsmount ubi:rootfs;
    => ubi part ubifs
    ubi0: attaching mtd1
    ubi0: scanning is finished
    ubi0: volume 0 ("rootfs") re-sized from 3970 to 4000 LEBs
    ubi0: attached mtd1 (name "mtd=2", size 510 MiB)
    ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
    ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
    ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
    ubi0: good PEBs: 4080, bad PEBs: 4, corrupted PEBs: 0
    ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
    ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 444634120
    ubi0: available PEBs: 0, total reserved PEBs: 4080, PEBs reserved for bad PEB handling: 76
    => ubifsmount ubi:rootfs
    => setenv boot ubi
    => boot
    Unmounting UBIFS volume rootfs!
    ubi0: detaching mtd1
    ubi0: mtd1 is detached
    ubi0: attaching mtd1
    ubi0: scanning is finished
    ubi0: attached mtd1 (name "mtd=2", size 510 MiB)
    ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
    ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
    ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
    ubi0: good PEBs: 4080, bad PEBs: 4, corrupted PEBs: 0
    ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
    ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 444634120
    ubi0: available PEBs: 0, total reserved PEBs: 4080, PEBs reserved for bad PEB handling: 76
    Loading file '/boot/skern-k2hk.bin' to addr 0x87000000...
    Done
    K2_BM_15.07-53-ge1f885a SoC:k2hk built:09:52:35, Dec 23 2017

    ## installed monitor @ 0xc5f0000, freq [200000000], status 207552512
    Loading file '/boot/zImage' to addr 0x82000000...
    Done
    Loading file '/boot/k2-fw-initrd.cpio.gz' to addr 0x88080000...
    Done
    Loading file '/boot/keystone-k2hk-evm.dtb' to addr 0x88000000...
    Done
    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Ramdisk to 8fff3000, end 8ffff3aa ... OK
    Loading Device Tree to 8ffe5000, end 8fff2ba5 ... OK

    Starting kernel ...

    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Linux version 4.9.59-ga75d8e9305 (gtbldadm@ubuntu-16) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 SMP PREEMPT Sat Dec 23 10:05:30 EST 2017
    [ 0.000000] CPU: ARMv7 Processor [412fc0f4] revision 4 (ARMv7), cr=30c5387d
    [ 0.000000] CPU: div instructions available: patching division code
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
    [ 0.000000] OF: fdt:Machine model: Texas Instruments Keystone 2 Kepler/Hawking EVM
    [ 0.000000] Switching physical address space to 0x800000000
    [ 0.000000] efi: Getting EFI parameters from FDT:
    [ 0.000000] efi: UEFI not found.
    [ 0.000000] Reserved memory: created CMA memory pool at 0x000000081f800000, size 8 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_cma_pool@81f800000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000820000000, size 256 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_mpm_pool@820000000, compatible id shared-dma-pool

    Though the size of the ubi file is less than 512MB, I am not sure is it because I have some bad sectors, Kernel boot does not get the login prompt, but getting "sh-3.2#" as shown below. This is the symptom I usually see when image does not fit in the flash. Once I change it to arago image, it works fine. Hopefully, your image fits.

    [ 39.858527] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
    [ 39.867194] hub 2-0:1.0: USB hub found
    [ 39.870978] hub 2-0:1.0: 1 port detected
    [ 42.635007] netcp-1.0 2620110.netcp eth0: Link is Up - 1Gbps/Full - flow control rx/tx
    [ 42.642962] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

    sh-3.2# [ 279.130074] random: crng init done

    sh-3.2#
    sh-3.2#
    sh-3.2#
    sh-3.2#

    Please click resolve button if this helps to solve your issue.

    Rex