制作根文件系统出现错误:No init found

问题:
1.构建最小根文件系统时,出现错误:
Warning: unable to open an initial console.
Failed to execute /linuxrc. Attempting defaults…
Kernel panic - not syncing: No init found. Try passing init= option to kernel。

实验条件:
1)虚拟机软件为VMware Workstatio pro 15,
2)虚拟机系统为Ubuntu 16.04,
3)虚拟机上的交叉编译器为arm-linux-gcc-4.3.2;
4)linux开发板采用韦东山的jz2440V3;
5)开发板上的烧录的u-boot为U-boot 1.1.6,且该u-boot在虚拟机Ubuntu 16.04上使用arm-linux-gcc-4.3.2交叉编译;
6)开发板上的烧录的内核为linux-2.6.22.6,且该内核在虚拟机Ubuntu 16.04上使用arm-linux-gcc-4.3.2交叉编译;
7)根文件系统使用busybox v1.7.0制作,在虚拟机Ubuntu 16.04上使用arm-linux-gcc-4.3.2交叉编译安装;
8)镜像工具为韦东山视频里mkyaffs2image;
9)根文件系统采用动态链接库,根文件系统下的lib目录里存放的是arm-linux-gcc-4.3.2的glibc库,arm-linux-gcc-4.3.2的libc目录下,有三种glibc库:1.位于该目录下的lib和usr/lib里面;2.位于该目录下的armv4t/lib和armv4t/usr/lib里面;3.该目录下的thumb2/lib和thumb2/usr/lib里面。我选用的是第二种。

最小根文件系统的构建是按照韦东山旧第一期视频里介绍的步骤来做,只是在复制C库的时候,因为韦东山视频里用的交叉编译器为arm-linux-gcc-3.4.5,他所用的C库为该交叉编译器的lib目录下的C库,而我用的交叉编译器为arm-linux-gcc-4.3.2,所以使用的C库为arm-linux-gcc-4.3.2的libc目录下的armv4t/lib和armv4t/usr/lib里面的动态链接库(.so文件)。最后制作好根文件系统,并使用镜像工具mkyaffs2image生成镜像文件,烧录的开发板上后运行,出现上述问题。
排查问题:
在开发板的u-boot、内核都不变的情况下,即开发板上的烧录的u-boot为U-boot 1.1.6,且该u-boot在虚拟机Ubuntu 16.04上使用arm-linux-gcc-4.3.2交叉编译;开发板上的烧录的内核为linux-2.6.22.6,且该内核在虚拟机Ubuntu 16.04上使用arm-linux-gcc-4.3.2交叉编译。将虚拟机Ubuntu 16.04上使用交叉编译器换成arm-linux-gcc-3.4.5,在按照韦东山旧第一期视频,构建最小根文件系统,最后开发板上电运行情况如下:
U-Boot 1.1.6 enable Ethernet alltime(Jan 12 2021 - 14:58:12)

DRAM: 64 MB
JEDEC PROBE: ID 90 0 0
Flash: 0 kB
NAND: 256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
UPLLVal [M:38h,P:2h,S:2h]
MPLLVal [M:5ch,P:1h,S:1h]
CLKDIVN:5h

±--------------------------------------------+
| S3C2440A USB Downloader ver R0.03 2004 Jan |
±--------------------------------------------+
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+CS:2
NOTE: Power off/on or press the reset button for 1 sec
in order to get a valid USB device address.

Hit any key to stop autoboot: 0
Booting Linux …

NAND read: device 0 offset 0x60000, size 0x200000

Reading data from 0x25f800 – 100% complete.
2097152 bytes read: OK

Booting image at 30007fc0 …

Image Name: Linux-2.6.22.6
Created: 2021-01-12 7:30:07 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1812700 Bytes = 1.7 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum … OK
XIP Kernel Image … OK

Starting kernel …

Uncompressing Linux… done, booting the kernel.
Linux version 2.6.22.6 (yuchengqiu@yuchengqiu-virtual-machine) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #7 Tue Jan 12 15:29:58 CST 2021
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SMDK2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C24XX Clocks, © 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200
irq: clearing pending ext status 00000200
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61056KB available (3200K code, 451K data, 136K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410 Power Management, © 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C2440: Clock Support, DVS off
S3C24XX DMA Driver, © 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
Registering GDB sysrq handler
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
yaffs Jan 12 2021 15:28:00 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 60x34
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
S3C2410 Watchdog Timer, © 2004 Simtec Electronics
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2440-uart.0: s3c2410_serial0 at MMIO map 0x50000000 mem 0xf0400000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO map 0x50004000 mem 0xf0404000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO map 0x50008000 mem 0xf0408000 (irq = 76) is a S3C2440
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: module loaded
line 400 I/O: c486a000, VID: 90000a46
line 408 I/O: c486a000, VID: 90000a46
error version, chip_revision = 0x1a, chip_info = 0x3
id_val=0
S3C24XX NAND Driver, © 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 130 at 0x01040000
Bad eraseblock 1096 at 0x08900000
Bad eraseblock 1372 at 0x0ab80000
Bad eraseblock 1394 at 0x0ae40000
Bad eraseblock 1559 at 0x0c2e0000
Bad eraseblock 1972 at 0x0f680000
Bad eraseblock 1976 at 0x0f700000
Creating 4 MTD partitions on “NAND 256MiB 3,3V 8-bit”:
0x00000000-0x00040000 : “bootloader”
0x00040000-0x00060000 : “params”
0x00060000-0x00260000 : “kernel”
0x00260000-0x10000000 : “root”
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver…
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /class/input/input0
S3C24XX RTC, © 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 390 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
mapped channel 0 to 0
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
usbcore: registered new interface driver hiddev
s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #2 op:UNKNOWN(8) arg:0x000001aa flags:0x0875 retries:0 Status:nothing to complete
s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #3 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
ASoC version 0.13.1
s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #4 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete
s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #5 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete
s3c2410iis_probe…
s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #6 op:APP_CMD(55) arg:0x00000000 flags:0x0875 retries:0 Status:nothing to complete
s3c2440-sdi s3c2440-sdi: CMD[TIMEOUT] #7 op:ALL_SEND_OCR(1) arg:0x00000000 flags:0x0861 retries:0 Status:nothing to complete
s3c2440-sdi s3c2440-sdi: powered down.
UDA1341 audio driver initialized
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 1
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
UDF-fs: No VRS found
yaffs: dev is 32505859 name is “mtdblock3”
yaffs: passed flags “”
yaffs: Attempting MTD mount on 31.3, “mtdblock3”
yaffs: auto selecting yaffs2
block 112 is bad
block 1078 is bad
block 1354 is bad
block 1376 is bad
block 1541 is bad
block 1954 is bad
block 1958 is bad
VFS: Mounted root (yaffs filesystem).
Freeing init memory: 136K
init started: BusyBox v1.7.0 (2021-01-14 21:52:48 CST)

process ‘-/bin/sh’ (pid 763) exited. Scheduling it for restart.

Please press Enter to activate this console.

------------------------分割线---------------------
最小根文件系统正常运行。由上述初步判断,用arm-linux-gcc-4.3.2交叉编译的 u-boot、内核没问题,镜像工具mkyaffs2image没问题,因为两次对比试验,只有在构建最小根文件系统时不同,在使用arm-linux-gcc-3.4.5交叉编译器制作出根文件系统能正常运行,而使用arm-linux-gcc-4.3.2交叉编译器制作出的根文件系统却不能正常运行。从而初步判断问题的根源在根文件系统的制作上,是C库选用不对还是,还是其他?
进一步排查问题,用arm-linux-gcc-4.3.2交叉编译器制作出根文件系统,C库分别用arm-linux-gcc-4.3.2的libc目录下的三种glibc库:1.位于该目录下的lib和usr/lib里面;2.位于该目录下的armv4t/lib和armv4t/usr/lib里面;3.该目录下的thumb2/lib和thumb2/usr/lib里面。
经过排查,三种C库都尝试过,根文件系统还是不能正常运行。难道是C库不是这三种,或者是三种中的某些文件,或者要使用arm-linux-gcc-3.4.5下的C库,还是问题的根源不在C库?
再次排查,使用rm-linux-gcc-4.3.2交叉编译器制作出根文件系统,C库使用arm-linux-gcc-3.4.5下的C库,还是不能正常运行。
问题的根源到底是什么?网上说的linuxrc要有可执行权限,这个在制造根文件系统是已经保证了linuxrc有可执行权限,所以问题不是出在linuxrc;还有说问题出在镜像工具mkyaffs2image,需要使用mkyaffs2image-128M,但在使用arm-linux-gcc-3.4.5交叉编译器制作出根文件系统,使用的镜像工具也是mkyaffs2image,根文件系统镜像文件烧录到开发板上能正常运行,所以应该不是出在镜像工具mkyaffs2image。那问题的根源到底在哪?难道必须要使用arm-linux-gcc-3.4.5交叉编译器?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值