问题解决了,这里将编译过程中遇到的问题和在网上搜索到的一些解决方法写在这里,也算是这段时间学习的小小总结,希望能给遇到同样问题的初学者一点帮助:
记录:
1.下载linux-2.6.36.1.tar.bz2
问题:tar -zxvf 解压压缩文件出现问题,无法识别.
解决:1.通过file linux-2.6.36.1.tar.bz2 查看压缩格式
2.通过命令 bzip2 -d linux-2.6.36.1.tar.bz2解压
3.再通过tar xvf linux-2.6.36.1.tar解压,不能使用
tar zxvf linux-2.6.22.6.tar解压
4.上面也可以通过一条指令bzip2 -dc linux-2.6.XX.tar.bz2 | tar xvf -
其中XX为内核压缩包文件名
2.下载patch-2.6.36.1.bz2补丁文件
1.解压 bzip2 -d patch-2.6.36.1.bz2
2.cd linux-2.6.36.1/
3.patch -p1 < ../patch-2.6.36.1
3.先编译看下内核有没有问题,运行make命令出现下面的错误:
问题:drivers/input/touchscreen/eeti_ts.c:65: 错误: 隐式声明函数‘irq_to_gpio’
解决:重新make menuconfig,将driver中的输入设备->触摸设备中,将EETI选项不选,保存退出后,重新make.
4.将编译成功的内核zImage下载到板子中,出现如下问题:
问题:NOW, Booting Linux......
Uncompressing Linux... done, booting the kernel.
然后没有反应....
解决:1.Device Drivers--->Character devices--->Serial drivers
下,选择:Samsung SoC serial support
Support for console on Samsung SoC serial port
Samsung S3C2440/S3C2442 Serial port support
2.发现对应选项在Device Drivers->Character devices->Serial drivers中
一看,原来根本就没有加载Samsung SoC serial support , 选成静态编译之后又出现了
Support for console on Samsung SoC serial port ,就是它了,选上, 退出的时候顺便把
Kernel low-level debugging functions给取消了否则我们设置的printk会自行输出,就不知道ttySAC有没有加载成功了
3.最后发现原来时内核编译时需要传入一个启动命令:noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,
make menuconfig -> Boot options -> 第三行添加上面的启动命令,保存退出,启动成功~
5.启动过程中,出现问题:
问题:Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000005 [#1]
last sysfs file:
Modules linked in:
CPU: 0 Not tainted (2.6.36.1 #20)
PC is at 0x0
LR is at s3c_gpio_setpull+0x80/0x8c
解决:参考网址:
http://blog.csdn.net/ExclusivePig/archive/2010/10/24/5961869.aspx 将static inline int s3c_gpio_do_setpull函数修改为以下内容:
static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip,
unsigned int off, s3c_gpio_pull_t pull)
{
if(NULL != chip->config->set_pull)
return (chip->config->set_pull)(chip, off, pull);
else
return EINVAL;
}
6.内核终于启动起来了,但是接着又出现了下面的问题:
问题:List of all partitions:
1f00 256 mtdblock0 (driver?)
1f01 64 mtdblock1 (driver?)
1f02 2048 mtdblock2 (driver?)
1f03 63152 mtdblock3 (driver?)
1f04 65536 mtdblock4 (driver?)
No filesystem could mount root, tried: cramfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
解决:原来是没有添加YAFFS2文件系统,从网上下载,给内核打上补丁,重新make menuconfig,在file system中选择YAFFS2,重新make.
打补丁如下:./patch-ker.sh c /work/system/linux-2.6.36.1
7.编译出现问题,最新内核去掉了一些函数,和改变了一些函数的名字,致使YAFFS2在编译过程中出现错误。
解决:请参考:
http://www.linuxhq.com/kernel/v2.6/36-rc1/fs/attr.c 8.再次下载编译好的内核,运行出现下面问题:
问题:yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) readonly on device 31:2.
devtmpfs: error mounting -2
Freeing init memory: 120K
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
解决:1.启动命令有问题,根据查看分区信息(supervivi:part show)得知root分区在mtdblock3上,不是在2上
修改为:noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
2.问题依旧,重新make menuconfig,并对比友善之臂提供的mini2440源代码配置,重新选择,
Device Driver ->Generic Driver Options ->(取消)devtmpfs: error mounting -2被解决了,
但是依然无法启动继续查看。
3.系统在启动过程中出现了很多yaffs: block 456 is marked bad,block 457 is bad这样的错误,越来越多,通过网上搜寻找到解决办法:
我用的是板子自带的supervivi,使用命令bon part 0,就起到格式化整个Nand Flash芯片的作用,假坏块自然就化为乌有了。随后问题就柳暗花明。
4.将mini2440自带的文件系统重新烧如板子,用mini2440自带的内核文件启动,正常,说明文件系统没有问题,将自己编译的内核下载进去,依然无法启动,
5.添加一些内核输出信息,终于发现内核在:search_binary_handler()函数中的fn(bprm, regs)函数后,执行失败了。非常郁闷...
6.文件系统没有问题,显然还是内核编译有问题,然后通过网上查找说是load_elf_binary执行有问题,可能是加载文件系统的文件时不识别文件格式,于是
重新make menuconfig最后发现原来是要将General setup --->Choose SLAB allocator --->选上SLAB,不要选择SLUB。重新make
哈哈,终于启动成功了,再次查看了一下mini2440板子上的配置,发现它的内核里选择的是SLUB,而我用的内核选上SLUB反而启动不起来,不知道什么原因,
希望知道的人能回答一下,下面是系统启动信息:
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 782
NOW, Booting Linux......
Uncompressing Linux... done, booting the kernel.
s3c24xx_serial_initconsole
s3c24xx_serial_init_ports: initialising ports...
s3c24xx_serial_init_port: port=c03fa7d4, platdev=c04082f8
s3c24xx_serial_init_port: c03fa7d4 (hw 0)...
resource c03e5868 (50000000..50003fff)
port: map=50000000, mem=f5000000, irq=70 (70,71), clock=1
s3c2440_serial_resetport: port=c03fa7d4 (50000000), cfg=c040826c
s3c24xx_serial_init_port: port=c03fa88c, platdev=c03e69f8
s3c24xx_serial_init_port: c03fa88c (hw 1)...
resource c03e58a0 (50004000..50007fff)
port: map=50004000, mem=f5004000, irq=73 (73,74), clock=1
s3c2440_serial_resetport: port=c03fa88c (50004000), cfg=c040828c
s3c24xx_serial_init_port: port=c03fa944, platdev=c03e6ab0
s3c24xx_serial_init_port: c03fa944 (hw 2)...
resource c03e58d8 (50008000..5000bfff)
port: map=50008000, mem=f5008000, irq=76 (76,77), clock=1
s3c2440_serial_resetport: port=c03fa944 (50008000), cfg=c04082ac
s3c24xx_serial_init_ports: Complete...
s3c24xx_serial_console_setup: co=c03fa778 (0), (null)
s3c24xx_serial_console_setup: port=c03fa7d4 (0)
s3c24xx_serial_get_options: port=c03fa7d4
registers: ulcon=00000003, ucon=000003c5, ubdriv=0000001a
calculated baud 117187
s3c24xx_serial_console_setup: baud 117187
selecting clock c03e6520
config: 8bits/char
setting ulcon to 00000003, brddiv to 26, udivslot 00000000
uart: ulcon = 0x00000003, ucon = 0x000003c5, ufcon = 0x00000051
Linux version 2.6.36.1 (weitianhu613@weitianhu613-laptop) (gcc version 4.2.1) #71 PREEMPT Sun Dec 19 00:13:18 CST 2010
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc rootfstype=yaffs console=ttySAC0 mem=64M rw
PID hash table entries: 256 (order: -2, 1024 bytes)
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: 60612k/60612k available, 4924k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc4800000 - 0xe0000000 ( 440 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0024000 ( 112 kB)
.text : 0xc0024000 - 0xc03e0000 (3824 kB)
.data : 0xc03e0000 - 0xc0407fa0 ( 160 kB)
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
gpiochip_add: gpios 288..303 (GPIOK) failed to register
gpiochip_add: gpios 320..334 (GPIOL) failed to register
gpiochip_add: gpios 352..353 (GPIOM) failed to register
regulator: core version 0.5
NET: Registered protocol family 16
MINI2440: Option string mini2440=0tb
MINI2440: 't' ignored, touchscreen not compiled in
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.23.
FS-Cache: Loaded
CacheFiles: Loaded
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
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
yaffs Dec 18 2010 23:50:20 Installing.
msgmni has been set to 118
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
s3c24xx_serial_init(c03faa84,c03faa50)
s3c2440_serial_probe: dev=c04082f8
s3c24xx_serial_probe(c04082f8, c03faa50) 0
s3c24xx_serial_probe: initialising port c03fa7b0...
s3c24xx_serial_init_port: port=c03fa7d4, platdev=c04082f8
s3c24xx_serial_probe: adding port
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440_serial_probe: dev=c03e69f8
s3c24xx_serial_probe(c03e69f8, c03faa50) 1
s3c24xx_serial_probe: initialising port c03fa868...
s3c24xx_serial_init_port: port=c03fa88c, platdev=c03e69f8
s3c24xx_serial_probe: adding port
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440_serial_probe: dev=c03e6ab0
s3c24xx_serial_probe(c03e6ab0, c03faa50) 2
s3c24xx_serial_probe: initialising port c03fa920...
s3c24xx_serial_init_port: port=c03fa944, platdev=c03e6ab0
s3c24xx_serial_probe: adding port
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 364 at 0x0000005b0000
cmdlinepart partition parsing not available
Creating 3 MTD partitions on "NAND":
0x000000000000-0x000000050000 : "supervivi"
0x000000050000-0x000000250000 : "Kernel"
0x000000250000-0x000003ffc000 : "root"
Fixed MDIO Bus: probed
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
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: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.36.1 ohci_hcd
usb usb1: SerialNumber: s3c24xx
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.
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
Linux video capture interface: v2.00
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 - using pio, sw SDIO IRQ
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ALSA device list:
No soundcards found.
oprofile: hardware counters not available
oprofile: using timer interrupt.
TCP cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
s3c24xx_serial_startup: port=50000000 (f5000000,c03fa9f8)
requesting tx irq...
s3c24xx_serial_startup ok
config: 8bits/char
setting ulcon to 00000003, brddiv to 26, udivslot 00000000
uart: ulcon = 0x00000003, ucon = 0x000003c5, ufcon = 0x00000051
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: block 216 is marked bad
block 217 is bad
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 112K
执行命令:/linuxrc -------------->config: 8bits/char
setting ulcon to 00000003, brddiv to 26, udivslot 00000000
uart: ulcon = 0x00000003, ucon = 0x000003c5, ufcon = 0x00000051
config: 8bits/char
setting ulcon to 00000003, brddiv to 26, udivslot 00000000
uart: ulcon = 0x00000003, ucon = 0x000003c5, ufcon = 0x00000051
hwclock: can't open '/dev/misc/rtc': No such file or directory
[01/Jan/1970:00:00:07 +0000] boa: server version Boa/0.94.13
[01/Jan/1970:00:00:07 +0000] boa: server built Mar 26 2009 at 15:28:42.
[01/Jan/1970:00:00:07 +0000] boa: starting server pid=57, port 80
open device leds: No such file or directory
Try to bring eth0 interface up......ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCSIFHWADDR: No such device
ifconfig: SIOCSIFADDR: No such device
route: SIOCADDRT: Network is unreachable
Done
config: 8bits/char
setting ulcon to 00000003, brddiv to 26, udivslot 00000000
uart: ulcon = 0x00000003, ucon = 0x000003c5, ufcon = 0x00000051
Please press Enter to activate this console.
[root@FriendlyARM /]# ls
bin home lost+found root tmp www
dev lib opt sbin usr
etc linuxrc proc sys var
[root@FriendlyARM /]#