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/AM3352: Mounting file system on linux startup by using SPI Nor flash

Part Number: AM3352

Tool/software: Linux

I have custom board whose MCU is am3352. I am working on sdk 02.00.02.11

I am trying to boot linux system by using SPI Nor Flash.

I succeeded in writing MLO.byteswap, u-boot.img, dtb, and zImage on SPI Nor Flash.

However, I couldn't mount the file-system on Linux startup.

I wrote my rootfs.jffs2 on flash's 6th partition.

So, I set the spiroot to '/dev/mtdblock6 rw'.

I don't know what mistake I made on my system.

It's possible to mount the 6th partition (file-system) of flash after finishing entire booting. So I'm sure that the file-system is well-written

I attatched the kernel log, u-boot env, and dts file.

Anyone help me.. I couldn't find the mtdblock series on "List of all partitions" of kernel log.

This is kernel booting log

U-Boot 2015.07 (Mar 03 2017 - 18:39:01 +0900)

I2C:   ready
DRAM:  256 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
SF: Detected S25FL512S_256K with page size 512 Bytes, erase size 256 KiB, total 64 MiB
*** Warning - bad CRC, using default environment

Net:   cpsw, usb_ether
Hit any key to stop autoboot:  0
U-Boot# setenv spiroot '/dev/mtdblock6 rw'
U-Boot# setenv spiargs 'setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}'
U-Boot# setenv spiboot 'echo Booting from spi ...; sf probe 0:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; sf read ${fdtaddr} ${spifdtaddr} ${spifdtsize}; run spiargs; bootz ${loadaddr} - ${fdtaddr}'
U-Boot# run spiboot
Booting from spi ...
SF: Detected S25FL512S_256K with page size 512 Bytes, erase size 256 KiB, total 64 MiB
device 0 offset 0xe0000, size 0x362000
SF: 3547136 bytes @ 0xe0000 Read: OK
device 0 offset 0x80000, size 0xf000
SF: 61440 bytes @ 0x80000 Read: OK
Kernel image @ 0x82000000 [ 0x000000 - 0x31d810 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ef2f000, end 8ef3a454 ... 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.1.18-gbbe8cfc (root@ubuntu) (gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05) ) #39 PREEMPT Fri Feb 24 18:32:42 KST 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 EVM
[    0.000000] cma: Reserved 24 MiB at 0x8d000000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (neon )
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mtdblock6 rw rootfstype=jffs2
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 225568K/262144K available (6315K kernel code, 247K rwdata, 2148K rodata, 268K init, 233K bss, 12000K reserved, 24576K 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 : 0xd0800000 - 0xff000000   ( 744 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc084c05c   (8465 kB)
[    0.000000]       .init : 0xc084d000 - 0xc0890000   ( 268 kB)
[    0.000000]       .data : 0xc0890000 - 0xc08cdfa0   ( 248 kB)
[    0.000000]        .bss : 0xc08d0000 - 0xc090a7c8   ( 234 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Additional per-CPU info printed with stalls.
[    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.000016] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000037] clocksource timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000048] OMAP clocksource: timer1 at 24000000 Hz
[    0.000242] Console: colour dummy device 80x30
[    0.000269] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    0.000276] This ensures that you still see kernel messages. Please
[    0.000282] update your kernel commandline.
[    0.000302] Calibrating delay loop... 795.44 BogoMIPS (lpj=3977216)
[    0.089134] pid_max: default: 32768 minimum: 301
[    0.089237] Security Framework initialized
[    0.089293] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.089304] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090017] Initializing cgroup subsys blkio
[    0.090045] Initializing cgroup subsys memory
[    0.090090] Initializing cgroup subsys devices
[    0.090105] Initializing cgroup subsys freezer
[    0.090120] Initializing cgroup subsys perf_event
[    0.090150] CPU: Testing write buffer coherency: ok
[    0.090580] Setting up static identity map for 0x80008200 - 0x80008270
[    0.092245] devtmpfs: initialized
[    0.102756] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.168837] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.171255] pinctrl core: initialized pinctrl subsystem
[    0.172584] NET: Registered protocol family 16
[    0.174928] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.199130] cpuidle: using governor ladder
[    0.229116] cpuidle: using governor menu
[    0.233695] OMAP GPIO hardware version 0.1
[    0.241853] omap-gpmc 50000000.gpmc: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/gpmc_pins_default, deferring probe
[    0.243478] No ATAGs?
[    0.243505] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.289321] edma 49000000.edma: TI EDMA DMA engine driver
[    0.292776] vgaarb: loaded
[    0.293362] SCSI subsystem initialized
[    0.293889] omap_i2c 4802a000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/i2c1_pins_default, deferring probe
[    0.294011] media: Linux media interface: v0.10
[    0.294085] Linux video capture interface: v2.00
[    0.294136] pps_core: LinuxPPS API ver. 1 registered
[    0.294145] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.294174] PTP clock support registered
[    0.295022] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[    0.295261] Advanced Linux Sound Architecture Driver Initialized.
[    0.296131] Switched to clocksource timer1
[    0.307385] NET: Registered protocol family 2
[    0.308269] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.308305] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.308334] TCP: Hash tables configured (established 2048 bind 2048)
[    0.308422] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.308442] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.308614] NET: Registered protocol family 1
[    0.309025] RPC: Registered named UNIX socket transport module.
[    0.309040] RPC: Registered udp transport module.
[    0.309047] RPC: Registered tcp transport module.
[    0.309054] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.309983] CPU PMU: Failed to parse /pmu/interrupt-affinity[0]
[    0.310031] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    0.312084] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.312175] audit: initializing netlink subsys (disabled)
[    0.312242] audit: type=2000 audit(0.290:1): initialized
[    0.320215] VFS: Disk quotas dquot_6.6.0
[    0.320438] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.322774] NFS: Registering the id_resolver key type
[    0.322856] Key type id_resolver registered
[    0.322865] Key type id_legacy registered
[    0.322944] jffs2: version 2.2. (NAND) (SUMMARY)  ⓒ 2001-2006 Red Hat, Inc.
[    0.324841] NET: Registered protocol family 38
[    0.324906] io scheduler noop registered
[    0.324919] io scheduler deadline registered
[    0.324976] io scheduler cfq registered (default)
[    0.325991] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    0.329030] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
[    0.332831] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 158, base_baud = 3000000) is a 8250
[    0.953139] console [ttyS0] enabled
[    0.957736] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 159, base_baud = 3000000) is a 8250
[    0.967543] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 160, base_baud = 3000000) is a 8250
[    0.977283] 481aa000.serial: ttyS5 at MMIO 0x481aa000 (irq = 161, base_baud = 3000000) is a 8250
[    0.987160] [drm] Initialized drm 1.1.0 20060810
[    1.003215] brd: module loaded
[    1.011830] loop: module loaded
[    1.015955] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.086197] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    1.092338] libphy: 4a101000.mdio: probed
[    1.098050] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver TI DP83867
[    1.106472] davinci_mdio 4a101000.mdio: phy[16]: device 4a101000.mdio:10, driver TI DP83867
[    1.115609] cpsw 4a100000.ethernet: Detected MACID = b0:d5:cc:c4:ad:89
[    1.124132] mousedev: PS/2 mouse device common for all mice
[    1.129942] i2c /dev entries driver
[    1.134711] omap_hsmmc 47810000.mmc: Got CD GPIO
[    1.139808] omap_hsmmc 47810000.mmc: unable to obtain RX DMA engine channel 0
[    1.176566] ledtrig-cpu: registered to indicate activity on CPUs
[    1.184536] oprofile: using arm/armv7
[    1.188736] Initializing XFRM netlink socket
[    1.193074] NET: Registered protocol family 17
[    1.197664] NET: Registered protocol family 15
[    1.202256] Key type dns_resolver registered
[    1.206873] omap_voltage_late_init: Voltage driver support not added
[    1.213612] /cpus/cpu@0: could not get #voltdm-cells for /ocp/i2c@44e0b000/tps@2d/regulators/regulator@2
[    1.223245] cpu cpu0: Failed to register cpu0 clock notifier: -22
[    1.229431] cpufreq-voltdm: probe of cpufreq-voltdm.0 failed with error -22
[    1.236796] ThumbEE CPU extension supported.
[    1.241115] Registering SWP/SWPB emulation handler
[    1.248615] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    1.253800] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    1.261687] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
[    1.267843] hctosys: unable to open rtc device (rtc0)
[    1.276819] vbat: disabling
[    1.279751] ALSA device list:
[    1.282732]   No soundcards found.
[    1.287468] List of all partitions:
[    1.291004] 0100            8096 ram0  (driver?)
[    1.295653] 0101            8096 ram1  (driver?)
[    1.300498] 0102            8096 ram2  (driver?)
[    1.305141] 0103            8096 ram3  (driver?)
[    1.309837] 0104            8096 ram4  (driver?)
[    1.314480] 0105            8096 ram5  (driver?)
[    1.319174] 0106            8096 ram6  (driver?)
[    1.323817] 0107            8096 ram7  (driver?)
[    1.328497] 0108            8096 ram8  (driver?)
[    1.333140] 0109            8096 ram9  (driver?)
[    1.337802] 010a            8096 ram10  (driver?)
[    1.342531] 010b            8096 ram11  (driver?)
[    1.347278] 010c            8096 ram12  (driver?)
[    1.352007] 010d            8096 ram13  (driver?)
[    1.356753] 010e            8096 ram14  (driver?)
[    1.361486] 010f            8096 ram15  (driver?)
[    1.366229] No filesystem could mount root, tried:  jffs2
[    1.371667] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.379977] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[   82.686140] random: nonblocking pool is initialized

This is u-boot env.

U-Boot# print
arch=arm
args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
baudrate=115200
board=am335x
board_name=my_board
board_rev=unknown
board_serial=unknown
boot_fdt=try
bootcmd=run findfdt; run init_console; run netboot;run spiboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;
bootcount=900
bootdelay=2
bootdir=/boot
bootenvfile=uEnv.txt
bootfile=zImage
bootm_size=0x10000000
bootpart=0:2
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttyO0,115200n8
cpu=armv7
envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
eth1addr=b0:d5:cc:c4:ad:8b
ethact=cpsw
ethaddr=b0:d5:cc:c4:ad:89
fdt_addr_r=0x88000000
fdtaddr=0x88000000
fdtfile=undefined
findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi; if test $board_name = A335_ICE; then setenv fdtfile am335x-icev2.dtb; fi; if test $board_name = my_board; then setenv fdtfile am335x-ERTU.dtb; fi; if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
finduuid=part uuid mmc 0:2 uuid
importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
init_console=if test $board_name = A335_ICE; then setenv console ttyO3,115200n8;else setenv console ttyO0,115200n8;fi;
ipaddr=10.11.22.22
kernel_addr_r=0x82000000
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
mmcboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};run envboot; if run loadimage; then run mmcloados;fi;fi;
mmcdev=0
mmcloados=run args_mmc; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcrootfstype=ext4 rootwait
netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
netboot=echo Booting from network ...; setenv autoload no; run netloadimage; run findfdt; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
netloadfdt=tftp ${fdtaddr} ${fdtfile}
netloadimage=tftp ${loadaddr} ${bootfile}
netmask=255.255.255.0
nfsopts=nolock
partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}
ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype}
ramboot=echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr}
ramdisk_addr_r=0x88080000
ramroot=/dev/ram0 rw
ramrootfstype=ext2
rdaddr=0x88080000
rootpath=/home/ghlee/ti-processor-sdk/targetFS
serverip=10.11.22.33
soc=am33xx
spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}
spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; sf read ${fdtaddr} ${spifdtaddr} ${spifdtsize}; bootz ${loadaddr} - ${fdtaddr}
spiboot_mmcfs=setenv spiargs setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
spiboot_mmcroot=PARTUUID=${uuid} rw
spiboot_mmcrootfstype=${mmcrootfstype}
spibusno=0
spifdtaddr=0x80000
spifdtsize=0xf000
spiimgsize=0x362000
spiroot=/dev/mtdblock4 rw
spirootfstype=jffs2
spisrcaddr=0xe0000
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
stderr=serial_omap
stdin=serial_omap
stdout=serial_omap
usbnet_devaddr=b0:d5:cc:c4:ad:8b
vendor=ti
ver=U-Boot 2015.07 (Mar 03 2017 - 18:39:01 +0900)

Finally, spi area in dts file

&spi0 {
     status = "okay";
     pinctrl-names = "default";
     pinctrl-0 = <&spi0_pins_default>;
 
     spi-flash@0,0 {
         compatible = "m25p80";
         spi-max-frequency = <24000000>;
         reg = <0>;
 
         #address-cells = <1>;
         #size-cells = <1>;
 
         partition@0 {
             label = "NOR.MLO.byteswap";
             reg = <0x00000000 0x00020000>;
             read-only;
         };
         partition@1 {
             label = "NOR.u-boot.img";
            reg = <0x00020000 0x00060000>;
             read-only;
         };
         partition@2 {
             label = "NOR.fdt";
             reg = <0x00080000 0x00020000>;
             read-only;
         };
         partition@3 {
             label = "NOR.1st u-boot-env";
             reg = <0x000a0000 0x00020000>;
         };
         partition@4 {
             label = "NOR.2nd u-boot-env";
             reg = <0x000c0000 0x00020000>;
         };
         partition@5 {
             label = "NOR.linux kernel";
             reg = <0x000e0000 0x00340000>;
             read-only;
         };
         partition@6 {
             label = "NOR.file-system";
             reg = <0x00440000 0x03bc0000>;
         };
     };
 };