制作根文件系统出现错误: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交叉編譯器?
總結
以上是生活随笔為你收集整理的制作根文件系统出现错误:No init found的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android JNI 报错(signa
- 下一篇: NXP I.MX6ULL 交叉编译工具链