您尚未登录。

#1 2018-09-13 10:02:07

pqfeng
会员
注册时间: 2018-08-18
累计积分: 129

为什么我的系统连Ramdisk也进不去了?

系统连Ramdisk也进不去了。。。。。。
原来这个配置文件下的文件系统能正常的。相同的参数,突然就不正常了。不知道哪里出了问题。。。。。。。

U-Boot SPL 2017.01-rc2-00073-gdd6e874-dirty (Sep 12 2018 - 18:06:00)
DRAM: 64 MiB
Trying to boot from sunxi SPI

U-Boot 2017.01-rc2-00073-gdd6e874-dirty (Sep 12 2018 - 18:06:00 -0700) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000


U-Boot 2017.01-rc2-00073-gdd6e874-dirty (Sep 12 2018 - 18:06:00 -0700) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x10000
SF: 65536 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x900000
SF: 9437184 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 41a10000
   Booting using the fdt blob at 0x41a10000
   Loading Device Tree to 42dfa000, end 42dff206 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.13.16-licheepi-zero+ (pqfeng@ubuntu) (gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09)) #17 SMP Wed Sep 12 18:48:37 PDT 2018
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Zero
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] percpu: Embedded 16 pages/cpu @c3de8000 s33920 r8192 d23424 u65536
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 15883
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,9M(kernel)ro,-(rootfs) root=/dev/ram0 ro
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 49496K/64036K available (6144K kernel code, 217K rwdata, 1436K rodata, 5120K init, 262K bss, 14540K 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 : 0xc4000000 - 0xff800000   ( 952 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc3e89000   (  62 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0700000   (7136 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0e00000   (5120 kB)
[    0.000000]       .data : 0xc0e00000 - 0xc0e367c0   ( 218 kB)
[    0.000000]        .bss : 0xc0e3d868 - 0xc0e7f1fc   ( 263 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU event tracing is enabled.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000007] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000020] Switching to timer-based delay loop, resolution 41ns
[    0.000168] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000387] Console: colour dummy device 80x30
[    0.000424] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.000439] pid_max: default: 32768 minimum: 301
[    0.000575] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000591] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.001199] CPU: Testing write buffer coherency: ok
[    0.001584] /cpus/cpu@0 missing clock-frequency property
[    0.001610] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002047] Setting up static identity map for 0x40100000 - 0x40100060
[    0.002235] Hierarchical SRCU implementation.
[    0.002736] smp: Bringing up secondary CPUs ...
[    0.002753] smp: Brought up 1 node, 1 CPU
[    0.002761] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[    0.002768] CPU: All CPU(s) started in SVC mode.
[    0.003544] devtmpfs: initialized
[    0.006022] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.006321] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.006352] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.006520] pinctrl core: initialized pinctrl subsystem
[    0.007389] random: get_random_u32 called from bucket_table_alloc+0xf0/0x240 with crng_init=0
[    0.007523] NET: Registered protocol family 16
[    0.007993] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.009086] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.009104] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.020614] SCSI subsystem initialized
[    0.020894] usbcore: registered new interface driver usbfs
[    0.020962] usbcore: registered new interface driver hub
[    0.021053] usbcore: registered new device driver usb
[    0.021279] pps_core: LinuxPPS API ver. 1 registered
[    0.021289] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.021310] PTP clock support registered
[    0.021541] Advanced Linux Sound Architecture Driver Initialized.
[    0.023305] clocksource: Switched to clocksource arch_sys_counter
[    0.024172] simple-framebuffer 43e89000.framebuffer: framebuffer at 0x43e89000, 0x177000 bytes, mapped to 0xc4080000
[    0.024192] simple-framebuffer 43e89000.framebuffer: format=x8r8g8b8, mode=800x480x32, linelength=3200
[    0.031048] Console: switching to colour frame buffer device 100x30
[    0.037190] simple-framebuffer 43e89000.framebuffer: fb0: simplefb registered!
[    0.047012] NET: Registered protocol family 2
[    0.047624] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.047659] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    0.047683] TCP: Hash tables configured (established 1024 bind 1024)
[    0.047828] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.047877] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.048100] NET: Registered protocol family 1
[    0.048701] RPC: Registered named UNIX socket transport module.
[    0.048725] RPC: Registered udp transport module.
[    0.048731] RPC: Registered tcp transport module.
[    0.048737] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.380184] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.389321] NFS: Registering the id_resolver key type
[    0.389378] Key type id_resolver registered
[    0.389386] Key type id_legacy registered
[    0.390366] random: fast init done
[    0.393194] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.393216] io scheduler noop registered
[    0.393224] io scheduler deadline registered
[    0.393602] io scheduler cfq registered (default)
[    0.393616] io scheduler mq-deadline registered
[    0.393624] io scheduler kyber registered
[    0.398105] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.464657] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.468038] console [ttyS0] disabled
[    0.488319] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 31, base_baud = 1500000) is a U6_16550A
[    1.107409] console [ttyS0] enabled
[    1.114802] m25p80 spi32766.0: w25q128 (16384 Kbytes)
[    1.119888] spi32766.0: parser cmdlinepart: 4
[    1.124351] 4 cmdlinepart partitions found on MTD device spi32766.0
[    1.130613] Creating 4 MTD partitions on "spi32766.0":
[    1.135785] 0x000000000000-0x000000100000 : "uboot"
[    1.141312] 0x000000100000-0x000000110000 : "dtb"
[    1.146479] 0x000000110000-0x000000a10000 : "kernel"
[    1.151787] 0x000000a10000-0x000001000000 : "rootfs"
[    1.157565] libphy: Fixed MDIO Bus: probed
[    1.161973] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.168582] ehci-platform: EHCI generic platform driver
[    1.173925] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.180136] ohci-platform: OHCI generic platform driver
[    1.185897] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    1.195497] sun6i-rtc 1c20400.rtc: rtc core: registered rtc-sun6i as rtc0
[    1.202291] sun6i-rtc 1c20400.rtc: RTC enabled
[    1.206901] i2c /dev entries driver
[    1.211711] input: ns2009_ts as /devices/platform/soc/1c2ac00.i2c/i2c-0/0-0048/input/input0
[    1.221139] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    1.283347] sunxi-mmc 1c0f000.mmc: base:0xc405f000 irq:23
[    1.289706] usbcore: registered new interface driver usbhid
[    1.295373] usbhid: USB HID core driver
[    1.301302] NET: Registered protocol family 17
[    1.305992] Key type dns_resolver registered
[    1.310405] Registering SWP/SWPB emulation handler
[    1.321722] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.333172] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.339031] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.350259] hub 1-0:1.0: USB hub found
[    1.354246] hub 1-0:1.0: 1 port detected
[    1.359427] using random self ethernet address
[    1.364005] using random host ethernet address
[    1.369521] usb0: HOST MAC 1e:70:f5:9e:da:04
[    1.374000] usb0: MAC 9a:9f:1c:a2:b6:1a
[    1.377905] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[    1.385432] g_cdc gadget: g_cdc ready
[    1.389445] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01 00:00:23 UTC (23)
[    1.397742] vcc3v0: disabling
[    1.400720] vcc5v0: disabling
[    1.403743] ALSA device list:
[    1.406709]   No soundcards found.
[    1.410900] Waiting for root device /dev/ram0...

离线

#2 2018-09-13 10:07:09

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

console=ttyS0,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,9M(kernel)ro,-(rootfs) root=/dev/ram0 ro

好神奇的问题, 是不是最后那个 ro 的问题? 删掉 ro试一试.

离线

#3 2018-09-13 10:13:16

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

看下我的这个, 加 rdinit=/init:

console=ttySl,115200 earlyprintk panic=5 rootwait mtdparts=spi32766.0:960k(uboot),64k(dtb),1M(background),1M(animation),8M(kernel),-(rootfs) root=/dev/ram0 rdinit=/init vt.global_cursor_default=0

离线

#4 2018-09-13 10:14:25

pqfeng
会员
注册时间: 2018-08-18
累计积分: 129

Re: 为什么我的系统连Ramdisk也进不去了?

去掉也,依然没有变化 。ro 是只读,前面三个文件系统都用了ro

离线

#5 2018-09-13 10:18:12

pqfeng
会员
注册时间: 2018-08-18
累计积分: 129

Re: 为什么我的系统连Ramdisk也进不去了?

用你的最新参数依然没有变化。。。。。吐血了

离线

#6 2018-09-13 10:20:23

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

你的 /dev/console 是如何加进去的?

离线

#7 2018-09-13 10:22:11

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

$ ls dev/* -l
crw-r--r-- 1 root root 5,  1 May 18 21:18 dev/console
crw-r--r-- 1 root root 1,  3 May 18 21:18 dev/null
crw-r--r-- 1 root root 4, 64 May 18 21:18 dev/ttyS0

看下设备号对不对.

离线

#8 2018-09-13 10:24:57

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

你的根文件系统是不是缺这个文件: /dev/ttyS0

你的启动命令行是: console=ttyS0,115200

导致到这一步之后,系统找不到控制台了.

如果有 /dev/ttyS0, 看下设备编号是否正确.

以上纯属猜测.

离线

#9 2019-04-24 17:59:51

cityf
会员
注册时间: 2017-11-03
累计积分: 195

Re: 为什么我的系统连Ramdisk也进不去了?

奇怪, 我用 initrd ramfs 也是这样, 输入回车键有反应, 但是就是没有 # :

[    1.700700] vcc5v0: disabling
[    1.703677] ALSA device list:
[    1.706704]   #0: V3s Audio Codec
[    1.710871] Waiting for root device /dev/ram0...
[    1.716577] mmc1: queuing unknown CIS tuple 0x01 (3 bytes)
[    1.729164] mmc1: queuing unknown CIS tuple 0x1a (5 bytes)
[    1.737730] mmc1: queuing unknown CIS tuple 0x1b (8 bytes)
[    1.745082] mmc1: queuing unknown CIS tuple 0x80 (1 bytes)
[    1.750690] mmc1: queuing unknown CIS tuple 0x81 (1 bytes)
[    1.756244] mmc1: queuing unknown CIS tuple 0x82 (1 bytes)
[    1.761755] mmc1: new high speed SDIO card at address 0001
[  212.885618] random: crng init done

换一个文件系统就可以启动到shell, 什么都没变。

离线

#10 2019-04-25 14:14:51

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

参考1: https://github.com/torvalds/linux/blob/master/init/do_mounts.c
参考2: https://github.com/torvalds/linux/blob/master/init/main.c

main.c:

static int __init rdinit_setup(char *str)
{
	unsigned int i;

	ramdisk_execute_command = str;
	/* See "auto" comment in init_setup */
	for (i = 1; i < MAX_INIT_ARGS; i++)
		argv_init[i] = NULL;
	return 1;
}

__setup("rdinit=", rdinit_setup);

从上面可以看出, 如果挂载的是 initrd 文件系统, 那么 bootargs 需要传递 rdinit 环境变量,










main.c

	if (!ramdisk_execute_command)
		ramdisk_execute_command = "/init";

	if (ksys_access((const char __user *)
			ramdisk_execute_command, 0) != 0) {
		ramdisk_execute_command = NULL;
		prepare_namespace();
	}

如果 bootargs 没有找到 rdinit 环境变量, 那么就强行设置为 /init 并作为第一个进程跑,











do_mounts.c

/*
 * Prepare the namespace - decide what/where to mount, load ramdisks, etc.
 */
void __init prepare_namespace(void)
{


.............


	/* wait for any asynchronous scanning to complete */
	if ((ROOT_DEV == 0) && root_wait) {
		printk(KERN_INFO "Waiting for root device %s...\n",
			saved_root_name);
		while (driver_probe_done() != 0 ||
			(ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
			msleep(5);
		async_synchronize_full();
	}


.............
}

如果 rdinit=没有设置 和 initrd 文件系统里面没有一找到/init 文件,
那么文件系统初始化就挂了, 并且抛出 Waiting for root device /dev/ram0 这个错误

离线

#11 2019-04-25 14:25:09

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,191

Re: 为什么我的系统连Ramdisk也进不去了?

cityf 说:

奇怪, 我用 initrd ramfs 也是这样, 输入回车键有反应, 但是就是没有 # :

[    1.700700] vcc5v0: disabling
[    1.703677] ALSA device list:
[    1.706704]   #0: V3s Audio Codec
[    1.710871] Waiting for root device /dev/ram0...
[    1.716577] mmc1: queuing unknown CIS tuple 0x01 (3 bytes)
[    1.729164] mmc1: queuing unknown CIS tuple 0x1a (5 bytes)
[    1.737730] mmc1: queuing unknown CIS tuple 0x1b (8 bytes)
[    1.745082] mmc1: queuing unknown CIS tuple 0x80 (1 bytes)
[    1.750690] mmc1: queuing unknown CIS tuple 0x81 (1 bytes)
[    1.756244] mmc1: queuing unknown CIS tuple 0x82 (1 bytes)
[    1.761755] mmc1: new high speed SDIO card at address 0001
[  212.885618] random: crng init done

换一个文件系统就可以启动到shell, 什么都没变。

Waiting for root device /dev/ram0...
所以解决这个不能进入 shell 的问题, 你可以有两种解决方案:

1. 在 bootargs 加上 rdinit=/linuxrc
2. 根文件系统执行复制: cp linuxrc init -rf

离线

页脚

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

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