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/AM3358: am3358

Part Number: AM3358
Other Parts Discussed in Thread: AM3352, TPS65217

Tool/software: Linux

 
Hi
I am using linux 4.4 version from yocto poky .The below option is not available in latest kernel . How to enable this option in linux-kernel for NAND boot .

<*> Direct char device access to MTD devices
Please suggest the kernel patch to enable the Direct char device to access MTD devices in kernel 4.4. series

In Nand boot i am not able to mount the ubifs  filesystem .

ubi0: attaching mtd9
[ 3.769254] ubi0: scanning is finished
[ 3.773620] ubi0 error: ubi_read_volume_table: the layout volume was not found
[ 3.781991] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
[ 3.789154] UBI error: cannot attach mtd9
[ 3.793452] hctosys: unable to open rtc device (rtc0)
[ 3.804128] UBIFS error (pid: 1): cannot open "ubi0:rootfs", error -19VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
[ 3.817485] Please append a correct "root=" boot option; here are the available

Regzrds

Rajalakshmi a

  • Hi Raji,

    You need to pass correct mtdparts at the boot time. Or specify in the device tree. And use them in root= option. MTD char device is enabled by default, in the codebase. To confirm if it is enabled open drivers/mtd/Makefile and see that mtdchar.o is selected as default.

    Refer: processors.wiki.ti.com/.../Linux_Core_U-Boot_User's_Guide

  • Hi Dwarkesh
    As you said ,char device is enabled .Correct rootoption is given in U-boot environment .. My mtdparts are given below

    U-boot MTDPARTS:

    device nand0 <nand.0>, # parts = 10
    #: name size offset mask_flags
    0: NAND.SPL 0x00020000 0x00000000 0
    1: NAND.SPL.backup1 0x00020000 0x00020000 0
    2: NAND.SPL.backup2 0x00020000 0x00040000 0
    3: NAND.SPL.backup3 0x00020000 0x00060000 0
    4: NAND.u-boot-spl-os 0x00040000 0x00080000 0
    5: NAND.u-boot 0x00100000 0x000c0000 0
    6: NAND.u-boot-env 0x00020000 0x001c0000 0
    7: NAND.u-boot-env.backup10x00020000 0x001e0000 0
    8: NAND.kernel 0x00800000 0x00200000 0
    9: NAND.file-system 0x1f600000 0x00a00000 0

    active partition: nand0,0 - (NAND.SPL) 0x00020000 @ 0x00000000
    Kernel -Devicetree MTD parts :
    ] 0x000000000000-0x000000040000 : "NAND.SPL"
    [ 1.603034] 0x000000040000-0x000000080000 : "NAND.SPL.backup1"
    [ 1.611968] 0x000000080000-0x0000000c0000 : "NAND.SPL.backup2"
    [ 1.620846] 0x0000000c0000-0x000000100000 : "NAND.SPL.backup3"
    [ 1.629693] 0x000000100000-0x000000180000 : "NAND.u-boot-spl-os"
    [ 1.638966] 0x000000180000-0x000000280000 : "NAND.u-boot"
    [ 1.648157] 0x000000280000-0x0000002c0000 : "NAND.u-boot-env"
    [ 1.657050] 0x0000002c0000-0x000000300000 : "NAND.u-boot-env.backup1"
    [ 1.666622] 0x000000300000-0x000000a00000 : "NAND.kernel"
    [ 1.680969] 0x000000a00000-0x000020000000 : "NAND.file-system"

    It is my Cmdline Parameter command line: console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048 rootfstype=ubifs rootwait=1

    I dont know why i am getting ubi error..
  • Hi,

    Can you share the full bootlogs ? Also check if mtdparts is passed in command line, if not try passing it.
  • Hi,
    One more thing, how did you flash the ubifs into the required partition ?
  • Hi
    I am flashing to NAND from u-boot by following commands.

    fatload mmc 0 $loadaddr zImage

    nand write $loadaddr NAND.kernel

    fatload mmc 0 $loadaddr am335x-boneblack.dtb

    nand write $loadaddr NAND.u-boot-spl-os

    nand erase 0xa00000 0x2000000
    fatload mmc 0 $loadaddr rootfs.ubifs
    nand write $loadaddr 0xa00000 0x2000000
    run nandboot

    U-boot env variables for NAND is as follows

    nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfstype=${nandrootfstype}
    nandboot=echo Booting from nand ...; run nandargs; nand read ${fdtaddr} NAND.u-boot-spl-os; nand read ${loadaddr} NAND.kernel; bootz ${loadaddr} - ${fdtaddr}
    nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
    nandrootfstype=ubifs rootwait=1


    Creation of Ubifs from poky-morty.

    MKUBIFS_ARGS = " -F -m 2048 -e 129024 -c 1580"
    UBINIZE_ARGS = "-m 2048 -p 128KiB -s 512 -O 2048"

    i have tesed in SD boot , using mtd-utils , format the mtd partition and able to mount ubifs filesystem ..

    Regards
    Rajalakshmi A
  • Hi
    With mtdparts parameter in command line,also getting same error.
  • Hi
    Here i have shared my complete boot log for your reference.


    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Device Tree to 8fff3000, end 8ffff927 ... OK

    Starting kernel ...

    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Initializing cgroup subsys cpu
    [ 0.000000] Initializing cgroup subsys cpuacct
    [ 0.000000] Linux version 4.4.54-gecd4eada6f (raji@venus) (gcc version 6.2.0 (GCC) ) #70 PREEMPT Mon May 29 10:19:45 IST 2017
    [ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [ 0.000000] Machine model: TI AM335x BeagleBone Black
    [ 0.000000] cma: Reserved 48 MiB at 0x9d000000
    [ 0.000000] Memory policy: Data cache writeback
    [ 0.000000] CPU: All CPU(s) started in SVC mode.
    [ 0.000000] AM335X ES2.1 (sgx neon )
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 129920
    [ 0.000000] Kernel command line: console=ttyO0,115200n8 mtdparts=mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system) root=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048 rootfstype=ubifs rootwait=1
    [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
    [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    [ 0.000000] Memory: 460168K/524288K available (6459K kernel code, 311K rwdata, 2328K rodata, 260K init, 263K bss, 14968K reserved, 49152K cma-reserved, 0K highmem)
    [ 0.000000] Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
    [ 0.000000] vmalloc : 0xe0800000 - 0xff800000 ( 496 MB)
    [ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
    [ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
    [ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
    [ 0.000000] .text : 0xc0008000 - 0xc089cfdc (8788 kB)
    [ 0.000000] .init : 0xc089d000 - 0xc08de000 ( 260 kB)
    [ 0.000000] .data : 0xc08de000 - 0xc092bd30 ( 312 kB)
    [ 0.000000] .bss : 0xc092bd30 - 0xc096dc18 ( 264 kB)
    [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [ 0.000000] Preemptible hierarchical RCU implementation.
    [ 0.000000] Build-time adjustment of leaf fanout to 32.
    [ 0.000000] NR_IRQS:16 nr_irqs:16 16
    [ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
    [ 0.000032] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    [ 0.000080] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    [ 0.000105] OMAP clocksource: timer1 at 24000000 Hz
    [ 0.000531] clocksource_probe: no matching clocksources found
    [ 0.000896] Console: colour dummy device 80x30
    [ 0.000966] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
    [ 0.000983] This ensures that you still see kernel messages. Please
    [ 0.000997] update your kernel commandline.
    [ 0.001036] Calibrating delay loop... 298.59 BogoMIPS (lpj=1492992)
    [ 0.067527] pid_max: default: 32768 minimum: 301
    [ 0.067846] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.067875] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.069449] Initializing cgroup subsys io
    [ 0.069514] Initializing cgroup subsys memory
    [ 0.069595] Initializing cgroup subsys devices
    [ 0.069630] Initializing cgroup subsys freezer
    [ 0.069663] Initializing cgroup subsys perf_event
    [ 0.069695] Initializing cgroup subsys pids
    [ 0.069763] CPU: Testing write buffer coherency: ok
    [ 0.070552] Setting up static identity map for 0x80008200 - 0x80008260
    [ 0.075859] devtmpfs: initialized
    [ 0.107739] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [ 0.142127] omap_hwmod: debugss: _wait_target_disable failed
    [ 0.212360] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [ 0.212433] futex hash table entries: 256 (order: -1, 3072 bytes)
    [ 0.220992] pinctrl core: initialized pinctrl subsystem
    [ 0.223897] NET: Registered protocol family 16
    [ 0.229338] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [ 0.257612] cpuidle: using governor ladder
    [ 0.287594] cpuidle: using governor menu
    [ 0.298881] OMAP GPIO hardware version 0.1
    [ 0.319633] omap-gpmc 50000000.gpmc: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/nand_flash_x16, deferring probe
    [ 0.325985] hw-breakpoint: debug architecture 0x4 unsupported.
    [ 0.388727] edma 49000000.edma: TI EDMA DMA engine driver
    [ 0.398144] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
    [ 0.398270] omap_i2c 4802a000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c1_pins, deferring probe
    [ 0.398584] media: Linux media interface: v0.10
    [ 0.398737] Linux video capture interface: v2.00
    [ 0.398855] pps_core: LinuxPPS API ver. 1 registered
    [ 0.398875] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [ 0.398944] PTP clock support registered
    [ 0.399100] EDAC MC: Ver: 3.0.0
    [ 0.401807] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
    [ 0.405221] clocksource: Switched to clocksource timer1
    [ 0.432937] NET: Registered protocol family 2
    [ 0.434676] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.434816] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.434937] TCP: Hash tables configured (established 4096 bind 4096)
    [ 0.435105] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.435155] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.435649] NET: Registered protocol family 1
    [ 0.436482] RPC: Registered named UNIX socket transport module.
    [ 0.436511] RPC: Registered udp transport module.
    [ 0.436528] RPC: Registered tcp transport module.
    [ 0.436546] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.438603] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
    [ 0.464474] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [ 0.466634] NFS: Registering the id_resolver key type
    [ 0.466778] Key type id_resolver registered
    [ 0.466799] Key type id_legacy registered
    [ 0.467006] ntfs: driver 2.1.32 [Flags: R/O].
    [ 0.467778] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
    [ 0.477260] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
    [ 0.477322] io scheduler noop registered
    [ 0.477354] io scheduler deadline registered
    [ 0.477455] io scheduler cfq registered (default)
    [ 0.480736] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
    [ 0.644316] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    [ 0.654296] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
    [ 1.298107] console [ttyS0] enabled
    [ 1.304316] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a 8250
    [ 1.315861] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 160, base_baud = 3000000) is a 8250
    [ 1.327202] 481aa000.serial: ttyS5 at MMIO 0x481aa000 (irq = 161, base_baud = 3000000) is a 8250
    [ 1.338682] [drm] Initialized drm 1.1.0 20060810
    [ 1.348057] tilcdc 4830e000.lcdc: no encoders/connectors found
    [ 1.371878] loop: module loaded
    [ 1.376168] LinMux: *** Enter Cinterion Wireless Modules Serial Multiplex Driver ***
    [ 1.384069] LinMux: Kernel-Version: 4.4.54
    [ 1.388361] LinMux: LinMux-Version: 3.06
    [ 1.399522] libphy: Fixed MDIO Bus: probed
    [ 1.405661] PPP generic driver version 2.4.2
    [ 1.410518] PPP Deflate Compression module registered
    [ 1.417459] mousedev: PS/2 mouse device common for all mice
    [ 1.424456] i2c /dev entries driver
    [ 1.430797] cpuidle: enable-method property 'ti,am3352' found operations
    [ 1.439586] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 1.490582] ledtrig-cpu: registered to indicate activity on CPUs
    [ 1.507091] NET: Registered protocol family 10
    [ 1.514519] sit: IPv6 over IPv4 tunneling driver
    [ 1.521232] NET: Registered protocol family 17
    [ 1.526722] Key type dns_resolver registered
    [ 1.531611] omap_voltage_late_init: Voltage driver support not added
    [ 1.544118] mmc0: host does not support reading read-only switch, assuming write-enable
    [ 1.554876] omap-gpmc 50000000.gpmc: GPMC revision 6.0
    [ 1.560448] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
    [ 1.566967] mmc0: new high speed SDHC card at address 1234
    [ 1.576399] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
    [ 1.582803] nand: Micron MT29F4G08ABADAWP
    [ 1.587670] mmcblk0: mmc0:1234 SA16G 14.4 GiB
    [ 1.593887] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
    [ 1.601860] mmcblk0: p1 p2
    [ 1.605447] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme
    [ 1.611125] 10 ofpart partitions found on MTD device 8000000.nand
    [ 1.619103] Creating 10 MTD partitions on "8000000.nand":
    [ 1.624576] 0x000000000000-0x000000040000 : "NAND.SPL"
    [ 1.633223] 0x000000040000-0x000000080000 : "NAND.SPL.backup1"
    [ 1.642134] 0x000000080000-0x0000000c0000 : "NAND.SPL.backup2"
    [ 1.650985] 0x0000000c0000-0x000000100000 : "NAND.SPL.backup3"
    [ 1.659837] 0x000000100000-0x000000180000 : "NAND.u-boot-spl-os"
    [ 1.669102] 0x000000180000-0x000000280000 : "NAND.u-boot"
    [ 1.678304] 0x000000280000-0x0000002c0000 : "NAND.u-boot-env"
    [ 1.687206] 0x0000002c0000-0x000000300000 : "NAND.u-boot-env.backup1"
    [ 1.696776] 0x000000300000-0x000000a00000 : "NAND.kernel"
    [ 1.711116] 0x000000a00000-0x000020000000 : "NAND.file-system"
    [ 2.178008] tps65217 0-0024: TPS65217 ID 0xe version 1.2
    [ 2.183982] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
    [ 2.191080] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
    [ 2.199032] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
    [ 2.210462] ubi0: attaching mtd9
    [ 3.789599] ubi0: scanning is finished
    [ 3.793974] ubi0 error: ubi_read_volume_table: the layout volume was not found
    [ 3.802346] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
    [ 3.809511] UBI error: cannot attach mtd9
    [ 3.813820] hctosys: unable to open rtc device (rtc0)
    [ 3.824507] UBIFS error (pid: 1): cannot open "ubi0:rootfs", error -19VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
    [ 3.837858] Please append a correct "root=" boot option; here are the available partitions:
    [ 3.846306] b300 15114240 mmcblk0 driver: mmcblk
    [ 3.851652] b301 71680 mmcblk0p1 00097e91-01
    [ 3.857010] b302 2097152 mmcblk0p2 00097e91-02
    [ 3.862352] 1f00 256 mtdblock0 (driver?)
    [ 3.867444] 1f01 256 mtdblock1 (driver?)
    [ 3.872522] 1f02 256 mtdblock2 (driver?)
    [ 3.877613] 1f03 256 mtdblock3 (driver?)
    [ 3.882691] 1f04 512 mtdblock4 (driver?)
    [ 3.887783] 1f05 1024 mtdblock5 (driver?)
    [ 3.892861] 1f06 256 mtdblock6 (driver?)
    [ 3.897953] 1f07 256 mtdblock7 (driver?)
    [ 3.903032] 1f08 7168 mtdblock8 (driver?)
    [ 3.908122] 1f09 514048 mtdblock9 (driver?)
    [ 3.913202] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    [ 3.921508] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    [ 80.805211] random: nonblocking pool is initialized
  • Hi,

    I think you need to provide a ubinize.cfg, containing Volume table info to ubinize args. Have you tried giving ?

    Please refer: http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mkfubifs

  • Thank you so much Dwarakesh. Issue was fixed now .i can able to boot from nand .
    ubi0: attaching mtd9
    [ 2.772938] ubi0: scanning is finished
    [ 2.796378] ubi0: volume 0 ("rootfs") re-sized from 173 to 1884 LEBs
    [ 2.803652] ubi0: attached mtd9 (name "NAND.file-system", size 246 MiB)
    [ 2.810372] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
    [ 2.817293] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 512
    [ 2.824022] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
    [ 2.831022] ubi0: good PEBs: 1968, bad PEBs: 0, corrupted PEBs: 0
    [ 2.837150] ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
    [ 2.844403] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1543942669
    [ 2.853582] ubi0: available PEBs: 0, total reserved PEBs: 1968, PEBs reserved for bad PEB handling: 80
    [ 2.863008] ubi0: background thread "ubi_bgt0d" started, PID 60
    [ 2.869388] hctosys: unable to open rtc device (rtc0)
    [ 2.895257] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 61
    [ 2.956583] UBIFS (ubi0:0): start fixing up free space
    [ 6.738497] UBIFS (ubi0:0): free space fixup complete
    [ 6.766452] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
    [ 6.773903] UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
    [ 6.805055] UBIFS (ubi0:0): FS size: 199225344 bytes (189 MiB, 1569 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
    [ 6.825237] UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
    [ 6.831102] UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 2DC09F3C-840D-452D-B226-DC5C48EC6E79, small LPT model
    [ 6.866746] VFS: Mounted root (ubifs filesystem) on device 0:14.
    [ 6.874581] devtmpfs: mounted
    [ 6.895483] Freeing unused kernel memory: 260K (c089d000 - c08de000)
    [ 6.901866] This architecture does not have kernel memory protection.
    INIT: version 2.88 booting
  • Hi Raji,
    Good to know. Please close this thread and realted thread, marking/commenting on the correct answers/solution.