挖坑网/填坑网 DebugDump Forum

别人挖坑默默填上,自己挖坑含泪填上。天下没有填不了的坑,只有不会填坑的人。来吧,加入我们,挖坑行,填坑你更行! 站长QQ: 516333132 点击这里给我发消息

您尚未登录。

#1 2018-05-11 22:01:29

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

licheepi nano 内核启动 无法识别spiflash

U-Boot 2018.01-05676-g0018878-dirty (May 11 2018 - 21:37:08 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected mx25l12805 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0
SF: Detected mx25l12805 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
device 0 offset 0x100000, size 0x10000
SF: 65536 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 816fb000, end 816ffd96 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (zx@zx-VirtualBox) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #3 Thu May 10 22:06:57 CST 2018
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,4M(kernel)ro,-(rootfs) root=31:03 rw rootfstype=jffs2
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22680K/32768K available (6144K kernel code, 237K rwdata, 1408K rodata, 1024K init, 246K bss, 10088K reserved, 0K 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 : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 238 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 247 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000045] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000109] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000634] Console: colour dummy device 80x30
[    0.000719] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070230] pid_max: default: 32768 minimum: 301
[    0.070537] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070576] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.071975] CPU: Testing write buffer coherency: ok
[    0.073589] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076097] devtmpfs: initialized
[    0.082581] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082646] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.082892] pinctrl core: initialized pinctrl subsystem
[    0.084823] NET: Registered protocol family 16
[    0.086330] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088056] cpuidle: using governor menu
[    0.113279] SCSI subsystem initialized
[    0.113592] usbcore: registered new interface driver usbfs
[    0.113737] usbcore: registered new interface driver hub
[    0.113932] usbcore: registered new device driver usb
[    0.114365] pps_core: LinuxPPS API ver. 1 registered
[    0.114395] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.114452] PTP clock support registered
[    0.114891] Advanced Linux Sound Architecture Driver Initialized.
[    0.116515] clocksource: Switched to clocksource timer
[    0.141961] NET: Registered protocol family 2
[    0.143346] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.143422] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.143472] TCP: Hash tables configured (established 1024 bind 1024)
[    0.143734] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.143792] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.144252] NET: Registered protocol family 1
[    0.145403] RPC: Registered named UNIX socket transport module.
[    0.145443] RPC: Registered udp transport module.
[    0.145459] RPC: Registered tcp transport module.
[    0.145475] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.147898] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.149657] Initialise system trusted keyrings
[    0.150181] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.167279] NFS: Registering the id_resolver key type
[    0.167362] Key type id_resolver registered
[    0.167382] Key type id_legacy registered
[    0.167496] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.181507] Key type asymmetric registered
[    0.181547] Asymmetric key parser 'x509' registered
[    0.181749] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.181783] io scheduler noop registered
[    0.181801] io scheduler deadline registered
[    0.182555] io scheduler cfq registered (default)
[    0.182589] io scheduler mq-deadline registered
[    0.182606] io scheduler kyber registered
[    0.183676] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.193210] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.357585] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.364078] console [ttyS0] disabled
[    0.384327] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.864194] console [ttyS0] enabled
[    0.874441] panel-simple panel: panel supply power not found, using dummy regulator
[    0.883749] SCSI Media Changer driver v0.25
[    0.889365] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.895900] ehci-platform: EHCI generic platform driver
[    0.901482] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.907775] ohci-platform: OHCI generic platform driver
[    0.913388] usbcore: registered new interface driver usb-storage
[    0.920399] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    0.929438] i2c /dev entries driver
[    0.986640] sunxi-mmc 1c0f000.mmc: base:0x1b13b58a irq:19
[    0.993989] usbcore: registered new interface driver usbhid
[    0.999685] usbhid: USB HID core driver
[    1.021228] NET: Registered protocol family 17
[    1.025915] Key type dns_resolver registered
[    1.032617] Loading compiled-in X.509 certificates
[    1.047558] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[    1.056334] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[    1.064121] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.070781] [drm] No driver support for vblank timestamp query.
[    1.124725] Console: switching to colour frame buffer device 60x34
[    1.148135] sun4i-drm display-engine: fb0:  frame buffer device
[    1.155273] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.164464] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.176353] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.182277] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.192436] hub 1-0:1.0: USB hub found
[    1.196360] hub 1-0:1.0: 1 port detected
[    1.201954] using random self ethernet address
[    1.206587] using random host ethernet address
[    1.212828] usb0: HOST MAC 36:09:ad:c1:4e:8f
[    1.217349] usb0: MAC 7a:33:18:f2:2f:f5
[    1.221352] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[    1.228910] g_cdc gadget: g_cdc ready
[    1.233490] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.251122] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.257988] vcc3v3: disabling
[    1.260972] ALSA device list:
[    1.263937]   #0: Loopback 1
[    1.267763] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.276436] cfg80211: failed to load regulatory.db
[    1.282223] VFS: Cannot open root device "31:03" or unknown-block(31,3): error -19
[    1.289993] Please append a correct "root=" boot option; here are the available partitions:
[    1.298410] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)
[    1.306755] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-rc8-licheepi-nano+ #3
[    1.314127] Hardware name: Allwinner suniv Family
[    1.318905] [<c010e550>] (unwind_backtrace) from [<c010b6a8>] (show_stack+0x10/0x14)
[    1.326663] [<c010b6a8>] (show_stack) from [<c0116878>] (panic+0xb8/0x230)
[    1.333557] [<c0116878>] (panic) from [<c0901190>] (mount_block_root+0x170/0x250)
[    1.341043] [<c0901190>] (mount_block_root) from [<c0901364>] (mount_root+0xf4/0x120)
[    1.348870] [<c0901364>] (mount_root) from [<c09014b8>] (prepare_namespace+0x128/0x188)
[    1.356869] [<c09014b8>] (prepare_namespace) from [<c0900dc0>] (kernel_init_freeable+0x174/0x1b8)
[    1.365750] [<c0900dc0>] (kernel_init_freeable) from [<c0663c30>] (kernel_init+0x8/0x10c)
[    1.373937] [<c0663c30>] (kernel_init) from [<c0107dc0>] (ret_from_fork+0x14/0x34)
[    1.381499] Rebooting in 5 seconds..
[    7.360731] Reboot failed -- System halted

与正常的启动代码对比了,发现没有识别spiflash,但是我在内核里已经做了相关配置:

1.png
2.png

不知道哪里还有毛病?是需要增加spiflash的驱动在kernel里面吗?

离线

#2 2018-05-11 22:05:54

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

看起来是rootfs有问题,
u-boot的bootargs 是什么?
你也是主线u-boot + bsp linux ?

离线

#3 2018-05-11 22:10:02

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

我就是按照nano.lichee.pro的里面做的,然后对照zero spiflash 教程 做的:
http://zero.lichee.pro/%E7%B3%BB%E7%BB%9F%E5%BC%80%E5%8F%91/SPI_flash_build.html#id16

晕哥 说:

看起来是rootfs有问题,
u-boot的bootargs 是什么?
你也是主线u-boot + bsp linux ?

离线

#4 2018-05-11 22:11:19

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

bootargs 是这个: console=ttyS0,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,4M(kernel)ro,-(rootfs) root=31:03 rw rootfstype=jffs2

晕哥 说:

看起来是rootfs有问题,
u-boot的bootargs 是什么?
你也是主线u-boot + bsp linux ?

离线

#5 2018-05-11 22:12:01

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

我看看

离线

#6 2018-05-11 22:13:08

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

正常启动的内核能打印出来这个:
[    0.747219] m25p80 spi32766.0: w25q128 (16384 Kbytes)
[    0.752288] in cmdline partion
[    0.755486] p4 : size=100000
[    0.758369] p4 : size=10000
[    0.761160] p4 : size=400000
[    0.764037] p4 : size=ffffffff

所以我怀疑是linux内核spi驱动问题。。

离线

#7 2018-05-11 22:14:48

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

配置uboot默认环境变量
在文件 include/configs/sun8i.h 中添加默认bootcmd和bootargs的环境变量设置,注意添加的位置在“ #include <configs/sunxi-common.h> ”的前边。

貌似这里有问题, 应该改成 ./include/configs/sun4i.h

可能没有把 u-boot 的bootargs传进来?

离线

#8 2018-05-11 22:16:56

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

我直接在 include/configs/suniv.h里改的,f1c100s用的是这个头文件吧。

晕哥 说:

配置uboot默认环境变量
在文件 include/configs/sun8i.h 中添加默认bootcmd和bootargs的环境变量设置,注意添加的位置在“ #include <configs/sunxi-common.h> ”的前边。

貌似这里有问题, 应该改成 ./include/configs/sun4i.h

可能没有把 u-boot 的bootargs传进来?

离线

#9 2018-05-11 22:16:56

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

为了确定一下,你进入 u-boot 命令行,
==> printenv bootcmd
==> printenv bootargs

离线

#10 2018-05-11 22:18:02

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

Environment size: 4718/32764 bytes
=> printenv bootcmd
bootcmd=sf probe 0 4000000; sf read 0x80c00000 0x100000 0x10000; sf read 0x80008000 0x110000 0x400000; bootz 0x80008000 - 0x80c00000
=> printenv bootargs
bootargs=console=ttyS0,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,4M(kernel)ro,-(rootfs) root=31:03 rw rootfstype=jffs2
=>

晕哥 说:

为了确定一下,你进入 u-boot 命令行,
==> printenv bootcmd
==> printenv bootargs

离线

#11 2018-05-11 22:28:29

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

https://debugdump.com/t_493.html

https://debugdump.com/p_1304.html#p1304

看下这个帖子, 有没有启发?











------------------------------------------------------------

我搜了一下, Booting Linux with rootfs on a JFFS2 File System

看是不是因为这样:

Step through the following procedure to enable a JFFS2 root filesystem in the sample networking configuration:
Modify the Linux kernel configuration to not include the rootfs into the uImage. For this, run make kmenuconfig in the project directory and uncheck (disable) the Initial RAM filesystem... option:
General setup --->
[ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support

你是不是勾上了 initramfs/initrd 这个根文件系统?

离线

#12 2018-05-11 22:32:45

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

这的√上了,我取消一下重新编译一下看看。

晕哥 说:

https://debugdump.com/t_493.html

https://debugdump.com/p_1304.html#p1304

看下这个帖子, 有没有启发?











------------------------------------------------------------

我搜了一下, Booting Linux with rootfs on a JFFS2 File System

看是不是因为这样:

Step through the following procedure to enable a JFFS2 root filesystem in the sample networking configuration:
Modify the Linux kernel configuration to not include the rootfs into the uImage. For this, run make kmenuconfig in the project directory and uncheck (disable) the Initial RAM filesystem... option:
General setup --->
[ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support

你是不是勾上了 initramfs/initrd 这个根文件系统?

离线

#13 2018-05-11 22:33:44

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

那 99.9%是这个问题了。

离线

#14 2018-06-09 16:44:42

三贪猪
会员
注册时间: 2018-06-09
累计发帖: 3

Re: licheepi nano 内核启动 无法识别spiflash

我也遇到了相同问题,取消Initial RAM filesystem and RAM disk (initramfs/initrd) support选项的勾选也没有用,哎

离线

#15 2018-06-09 17:23:04

晕哥
Administrator
注册时间: 1970-01-01
累计发帖: 2,482

Re: licheepi nano 内核启动 无法识别spiflash

好诡异, 我碰到这个问题的时候按上面取消 initramfs 就可以了。

离线

#16 2018-06-09 23:48:17

三贪猪
会员
注册时间: 2018-06-09
累计发帖: 3

Re: licheepi nano 内核启动 无法识别spiflash

应该和initramfs选项无关,这个选项只是用于是否把initramfs编译进内核镜像。感觉问题还是在内核spi驱动支持上面,应该是内核没有识别到w25q128这个芯片,不知道官网的spi-nor.c是怎么修改的,正常打印会有 m25p80 spi0.0: w25q128 (16384 Kbytes)这句,不知道m25p80是怎么对应上w25q128的,我在spi-nor.c里没有找到对应语句。我的uboot可以正确识别该芯片为w25q128bv,不知道内核为啥不能识别。

离线

#17 2018-06-10 00:26:02

david
会员
注册时间: 2018-03-05
累计发帖: 5

Re: licheepi nano 内核启动 无法识别spiflash

EddyZhan 说:

U-Boot 2018.01-05676-g0018878-dirty (May 11 2018 - 21:37:08 +0800) Allwinner Technology

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (zx@zx-VirtualBox) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #3 Thu May 10 22:06:57 CST 2018
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback

顺便问下,你这个是在哪个分支上编译的?

离线

#18 2018-06-10 10:04:09

三贪猪
会员
注册时间: 2018-06-09
累计发帖: 3

Re: licheepi nano 内核启动 无法识别spiflash

几乎熬了个通宵,终于找到原因了并解决问题了:官网下载的config文件,开错了全志的spi控制器开关,正确的配置是# CONFIG_SPI_SUN4I is not set
CONFIG_SPI_SUN6I=y(看来f1c100s用的是新版本的spi控制器)。修改后内核可以正确识别到spi flash了。另外,官网页面上还有个问题, uboot的bootargs 参数设置中, root=/dev/mtdblock3必须要修改为root=31:3,否则无法正确加载rootfs。修改以上两点后可以正确启动到控制台了。云盘中的sdk包4.13和docker中的4.15版本均是如此修改。

离线

#19 2018-06-10 10:20:20

超级萌新
会员
注册时间: 2018-05-04
累计发帖: 43

Re: licheepi nano 内核启动 无法识别spiflash

仰望楼上,大神的修炼过程.

离线

#20 2018-06-14 16:41:23

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

确实主要原因是内核里对SPIflash的支持问题,按照坛友的做法目前已经启动正常了。

离线

#21 2018-06-14 16:42:56

EddyZhan
会员
注册时间: 2018-05-11
累计发帖: 13

Re: licheepi nano 内核启动 无法识别spiflash

我是直接手动修改的.config文件。
参数传递,在uboot里直接用的bootargs,参考的zero spiflash烧写步骤,需要把spi32776.0改成spi0.0.

三贪猪 说:

几乎熬了个通宵,终于找到原因了并解决问题了:官网下载的config文件,开错了全志的spi控制器开关,正确的配置是# CONFIG_SPI_SUN4I is not set
CONFIG_SPI_SUN6I=y(看来f1c100s用的是新版本的spi控制器)。修改后内核可以正确识别到spi flash了。另外,官网页面上还有个问题, uboot的bootargs 参数设置中, root=/dev/mtdblock3必须要修改为root=31:3,否则无法正确加载rootfs。修改以上两点后可以正确启动到控制台了。云盘中的sdk包4.13和docker中的4.15版本均是如此修改。

离线

页脚