您尚未登录。

楼主 # 2021-07-06 17:54:27

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

请教一个SD卡启动卡在/dev/mmcblk0p2的问题

大佬们,我用的是荔枝派nano,用tf卡来启动。我的内核是自己参考官方wiki上那个config自己添加了一些内容后编译出来的。但我自己编译的设备树和zImage总是有问题,不是卡在starting kernel就是卡在waiting for root device /dev/mmcblk0p2。
    现在就挺想砸电脑的。卡在starting kernel勉勉强强规避过去了这个错误,但是又**卡在mmcblk0p2那里。通过控制变量法交叉替换了设备树和zImage后我把问题定位了在我自己编译的内核上。反反复复编译内核,从昨天晚上3点多到现在,本来不想麻烦辛苦各位的但是小弟实在能力有限,实在不知道我错在了哪里。
   我在uboot输了下mmc part,发现分区是正确加载的,但是不知道为什么进入kernel后就会卡在mmcblk0p2那里,求各位大神指点指点!
    分享下我的.config和启动log

U-Boot SPL 2018.01-05679-g013ca457fd (May 22 2021 - 16:34:18)                   
DRAM: 32 MiB                                                                    
Trying to boot from MMC1                                                        
                                                                                
                                                                                
U-Boot 2018.01-05679-g013ca457fd (May 22 2021 - 16:34:18 +0800) Allwinner Techny
                                                                                
CPU:   Allwinner F Series (SUNIV)                                               
Model: Lichee Pi Nano                                                           
DRAM:  32 MiB                                                                   
MMC:   SUNXI SD/MMC: 0                                                          
*** 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                                                
switch to partitions #0, OK                                                     
mmc0 is current device                                                          
Scanning mmc 0:1...                                                             
Found U-Boot script /boot.scr                                                   
reading /boot.scr                                                               
280 bytes read in 14 ms (19.5 KiB/s)                                            
## Executing script at 80c50000                                                 
reading suniv-f1c100s-licheepi-nano.dtb                                         
6072 bytes read in 31 ms (190.4 KiB/s)                                          
reading zImage                                                                  
6142928 bytes read in 316 ms (18.5 MiB/s)                                       
## Flattened Device Tree blob at 80c00000                                       
   Booting using the fdt blob at 0x80c00000                                     
   Loading Device Tree to 816fb000, end 816ff7b7 ... OK                         
                                                                                
Starting kernel ...                                                             
                                                                                
[    0.000000] Booting Linux on physical CPU 0x0                                
[    0.000000] Linux version 5.8.13myversion (bakamitai@bakamitai-X555LI) (arm-1
[    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] Zone ranges:                                                     
[    0.000000]   Normal   [mem 0x0000000080000000-0x0000000081ffffff]           
[    0.000000] Movable zone start for each node                                 
[    0.000000] Early memory node ranges                                         
[    0.000000]   node   0: [mem 0x0000000080000000-0x0000000081ffffff]          
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x0000000081ffffff] 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128      
[    0.000000] Kernel command line: console=tty0 console=ttyS0,115200 panic=5 rw
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes, li)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes, line)
[    0.000000] mem auto-init: stack:off, heap alloc:on, heap free:off           
[    0.000000] Memory: 16744K/32768K available (9216K kernel code, 725K rwdata,)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1       
[    0.000000] ftrace: allocating 30117 entries in 59 pages                     
[    0.000000] ftrace: allocated 59 pages with 5 groups                         
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16                  
[    0.000000] random: get_random_bytes called from start_kernel+0x374/0x5a0 wi0
[    0.000048] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 8947s
[    0.000124] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, maxs
[    0.000925] Console: colour dummy device 80x30                               
[    0.001994] printk: console [tty0] enabled                                   
[    0.002171] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)          
[    0.070340] pid_max: default: 32768 minimum: 301                             
[    0.070822] LSM: Security Framework initializing                             
[    0.071055] Yama: becoming mindful.                                          
[    0.071861] AppArmor: AppArmor initialized                                   
[    0.072526] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, line)
[    0.072673] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes,)
[    0.075899] CPU: Testing write buffer coherency: ok                          
[    0.078589] Setting up static identity map for 0x80100000 - 0x80100058       
[    0.086113] devtmpfs: initialized                                            
[    0.095328] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, ms
[    0.095530] futex hash table entries: 256 (order: -1, 3072 bytes, linear)    
[    0.096286] pinctrl core: initialized pinctrl subsystem                      
[    0.100993] NET: Registered protocol family 16                               
[    0.103094] DMA: preallocated 256 KiB pool for atomic coherent allocations   
[    0.104659] audit: initializing netlink subsys (disabled)                    
[    0.107402] cpuidle: using governor ladder                                   
[    0.107527] cpuidle: using governor menu                                     
[    0.110383] audit: type=2000 audit(0.100:1): state=initialized audit_enabled1
[    0.174728] fbcon: Taking over console                                       
[    0.179510] SCSI subsystem initialized                                       
[    0.180920] usbcore: registered new interface driver usbfs                   
[    0.181250] usbcore: registered new interface driver hub                     
[    0.181618] usbcore: registered new device driver usb                        
[    0.182425] pps_core: LinuxPPS API ver. 1 registered                         
[    0.182527] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giom>
[    0.182688] PTP clock support registered                                     
[    0.185563] NetLabel: Initializing                                           
[    0.185686] NetLabel:  domain hash size = 128                                
[    0.185741] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO                 
[    0.186090] NetLabel:  unlabeled traffic allowed by default                  
[    0.187373] clocksource: Switched to clocksource timer                       
[    0.438765] VFS: Disk quotas dquot_6.6.0                                     
[    0.439120] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)  
[    0.440980] AppArmor: AppArmor Filesystem Enabled                            
[    0.487226] NET: Registered protocol family 2                                
[    0.490474] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096)
[    0.490710] TCP established hash table entries: 1024 (order: 0, 4096 bytes, )
[    0.490860] TCP bind hash table entries: 1024 (order: 0, 4096 bytes, linear) 
[    0.490957] TCP: Hash tables configured (established 1024 bind 1024)         
[    0.491405] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)       
[    0.491553] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)  
[    0.492519] NET: Registered protocol family 1                                
[    0.492750] NET: Registered protocol family 44                               
[    0.494215] NetWinder Floating Point Emulator V0.97 (double precision)       
[    0.498526] Initialise system trusted keyrings                               
[    0.498760] Key type blacklist registered                                    
[    0.499535] workingset: timestamp_bits=30 max_order=13 bucket_order=0        
[    0.525288] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.            
[    0.527594] fuse: init (API version 7.31)                                    
[    0.529716] JFS: nTxBlock = 130, nTxLock = 1046                              
[    0.532605] integrity: Platform Keyring initialized                          
[    0.800934] Key type asymmetric registered                                   
[    0.801055] Asymmetric key parser 'x509' registered                          
[    0.801302] Block layer SCSI generic (bsg) driver version 0.4 loaded (major )
[    0.802402] io scheduler mq-deadline registered                              
[    0.818856] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO drir
[    1.107335] Serial: 8250/16550 driver, 8 ports, IRQ sharing enabled          
[    1.119631] suniv-f1c100s-pinctrl 1c20800.pinctrl: supply vcc-pe not found, r
[    1.121824] printk: console [ttyS0] disabled                                 
[    1.142356] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 21, base_baud = 6A
[    1.665349] printk: console [ttyS0] enabled                                  
[    1.708332] loop: module loaded                                              
[    1.717782] libphy: Fixed MDIO Bus: probed                                   
[    1.722126] PPP generic driver version 2.4.2                                 
[    1.728379] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver       
[    1.735079] ehci-platform: EHCI generic platform driver                      
[    1.740837] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver           
[    1.747161] ohci-platform: OHCI generic platform driver                      
[    1.754340] mousedev: PS/2 mouse device common for all mice                  
[    1.760407] i2c /dev entries driver                                          
[    1.765031] sdhci: Secure Digital Host Controller Interface driver           
[    1.771436] sdhci: Copyright(c) Pierre Ossman                                
[    1.776612] suniv-f1c100s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, r
[    1.787075] ledtrig-cpu: registered to indicate activity on CPUs             
[    1.793778] drop_monitor: Initializing network drop monitor service          
[    1.803488] NET: Registered protocol family 10                               
[    1.818790] Segment Routing with IPv6                                        
[    1.822878] NET: Registered protocol family 17                               
[    1.828830] Key type dns_resolver registered                                 
[    1.834691] registered taskstats version 1                                   
[    1.839222] Loading compiled-in X.509 certificates                           
[    1.871287] Loaded X.509 cert 'Build time autogenerated kernel key: 9e1f01fc'
[    1.882689] Key type ._fscrypt registered                                    
[    1.886803] Key type .fscrypt registered                                     
[    1.890981] Key type fscrypt-provisioning registered                         
[    1.899994] Key type encrypted registered                                    
[    1.904152] AppArmor: AppArmor sha1 policy hashing enabled                   
[    1.910445] ima: No TPM chip found, activating TPM-bypass!                   
[    1.916155] ima: Allocated hash algorithm: sha1                              
[    1.921161] ima: No architecture policies found                              
[    1.925978] evm: Initialising EVM extended attributes:                       
[    1.931310] evm: security.selinux                                            
[    1.934683] evm: security.SMACK64                                            
[    1.938107] evm: security.SMACK64EXEC                                        
[    1.941810] evm: security.SMACK64TRANSMUTE                                   
[    1.945931] evm: security.SMACK64MMAP                                        
[    1.949688] evm: security.apparmor                                           
[    1.953125] evm: security.ima                                                
[    1.956117] evm: security.capability                                         
[    1.959777] evm: HMAC attrs: 0x1                                             
[    1.982114] suniv-f1c100s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, r
[    1.993437] suniv-f1c100s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, r
[    2.006761] Waiting for root device /dev/mmcblk0p2...                        
[    3.747393] random: fast init done

离线

楼主 #2 2021-07-06 22:43:29

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

jimmy 说:

[    2.006761] Waiting for root device /dev/mmcblk0p2...                       

看你日志,都没有生成mmc分区呢

确实啊,但是设备树没问题,我明明配置了mmc在menuconfig里边。很想不通

离线

楼主 #4 2021-07-06 23:11:09

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

哇酷小二 说:

请贴出 .config 和  suniv-f1c100s-licheepi-nano.dts

好的

// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/*
 * Copyright 2018 Icenowy Zheng <icenowy@aosc.io>
 */

/dts-v1/;
#include "suniv-f1c100s.dtsi"
#include <dt-bindings/gpio/gpio.h>

/ {
	model = "Lichee Pi Nano";
	compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s";

	aliases {
		serial0 = &uart0;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};
	
	reg_vcc3v3: vcc3v3 {
			compatible = "regulator-fixed";
			regulator-name = "vcc3v3";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
	};
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pe_pins>;
	status = "okay";
};

&mmc0 {
        vmmc-supply = <&reg_vcc3v3>;
        bus-width = <4>;
        broken-cd;
        status = "okay";
};

dts没有问题,我已经排查过了,问题定位在我编译内核的时候可能有几个关于驱动的选项没配置好
.config被我刚刚删掉了 因为这是个痛苦的回忆...抱歉,我自己再重新配一个新的.config,如果有问题就继续提问,解决了我就发帖填坑吧
谢谢关心!

离线

楼主 #5 2021-07-07 17:47:21

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

@mmcblk0p2

大哥 我还是有问题啊。
我又在内核里边配置了一份,但是很离谱
我在uboot里边mmc part,我的设备真真实实是存在的

=> mmc part

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            131072          3347b09d-01     06
  2     133120          124602368       3347b09d-02     83

但是很曹丹的是,到了内核,又开始了喜闻乐见的waiting for root device

Waiting for root device /dev/mmcblk0p2

离线

楼主 #7 2021-07-07 17:53:58

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

这里上传一下我的config文件,辛苦各位大哥帮忙检查下
config_20210707-1748.txt

离线

楼主 #8 2021-07-07 17:55:09

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

哇酷小二 说:

@mmcblk0p2
你到本站右上角搜一下其他启动日志,一定要出现mmc分区才行的。

我弄到了一个正常的启动日志

[    1.072757] suniv-f1c100s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, using dummy regulr
[    1.109572] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB

[    1.220243] Waiting for root device /dev/mmcblk0p2...
[    1.250442] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.264089] mmc0: new high speed SDXC card at address aaaa
[    1.271528] mmcblk0: mmc0:aaaa SC64G 59.5 GiB 
[    1.283130]  mmcblk0: p1 p2

真是羡慕别人为啥不会碰到这个错误啊,嗟乎

离线

楼主 #11 2021-07-07 18:06:38

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

哇酷小二 说:

换张卡试一试?

我也想试,但我手上就这一张卡,
而且我估计卡没问题,因为uboot读得出来

离线

楼主 #12 2021-07-07 18:51:27

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

哇酷小二 说:

换张卡试一试?

大哥 我发现好像根本没有加载mmc的驱动
因为我翻了mmc的驱动代码,发现我的启动根本没有输出
不知道为什么,但我实在把mmc编译进去了并且设备树配置正确了啊

离线

楼主 #13 2021-07-07 19:14:07

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

大哥们,我已经破案了,是我自己内核编译选项没配置好。
我在设备树里是这样描述mmc设备的

&mmc0 {
        vmmc-supply = <&reg_vcc3v3>;
        bus-width = <4>;
        broken-cd;
        status = "okay";
};

后来我发现reg_vcc3v3这个设备需要vcc3v3,但是vcc3v3并没有在我的设备树中体现。于是我就删掉了
vmmc-supply = <&reg_vcc3v3>;
后来我发现平时一声不吭的sunxi-mmc终于闪出来™报错了,我才知道问题出在这么一个不起眼的vmmc-supply上
后来发现原来我是在内核里边没有配置

Voltage and Current Regulator Support

而我们应该将

Fixed voltage regulator support

按Y编译进内核。linux默认是把这个编译成模块的。
真是天坑啊

离线

楼主 #15 2021-07-07 19:19:35

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

哇酷小二 说:

还有这种操作.gif

最后,恭喜楼主成功出坑!

谢谢大哥关心啊

离线

楼主 #17 2023-11-14 10:01:05

mmcblk0p2
会员
注册时间: 2021-07-06
已发帖子: 14
积分: 16.5

Re: 请教一个SD卡启动卡在/dev/mmcblk0p2的问题

JerryShuuei 说:

@mmcblk0p2
我配置了fixed voltage regulator support 还是卡在wait root service,,,

肯定还是有问题,别自己折腾了,赶紧去用官方给的东西

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn