[ZT]S3C44B0開發板移植內核2.6 uclinux記錄

S3C44B0開發板移植內核2.6 uclinux記錄

Sam Fei (email: [email protected])

最新內核編譯 2
這個編譯器不支持.incbin的緣故, 下載新的編譯器 2
現在註釋掉gettimeoffset = s3c44b0x_gettimeoffset後,編譯: 3
註釋掉MOD_DEC_USE_COUNT和MOD_INC_USE_COUNT 3
2.6.9內核 5
開始動手 5
沒有內核映象文件 6
修改Makefile,增加bzImage 6
還是沒有希望的映象出現. 和2.4內核編譯的Makefile進行比較: 7
修改Makefile,增加linux,images 7
運行試試看 8
修正RAM和FLASH地址問題 9
增加romfs 10
編譯,運行 11
檢查romfs/bin, 缺省配置的命令太少了. 12
增加了命令配置,重新編譯,但好像內核映象沒有改變.但命令確實編譯出來了 12
增加串口驅動 13
增加了串口驅動,錯誤依然.應該跟串口驅動沒有關係了. 15
Panic錯誤原因 17
串口驅動波特率問題 24
去除簡易串口驅動配置 24
2個sh 27
串口正常後提示信息,第一階段完成 27
最後說明 29


開發板: Micetek EV44B0-II board, CPU:S3C44B0X RAM:8M FLASH:2M SMSC LAN91C113網卡.

S3C44B0 CPU 2.6內核的官方網站是http://opensrc.sec.samsung.com/, 看了網站的資料後,我們首先要做的就是下載最新的內核來試試看.其中下面的文章值得一讀.
http://opensrc.sec.samsung.com/document/Getting_Familiar_with_uClinuxARM2_6.html

最新內核編譯
http://opensrc.sec.samsung.com/下載補丁linux-2.6.11.8-hsc0.patch.gz
www.kernel.org下載linux-2.6.11.8.tar.gz.
[root@samfei ]# tar zxvf linux-2.6.11.8.tar.gz
[root@samfei ]# cd linux-2.6.11.8
[root@samfei linux-2.6.11.8]# patch -p1 < ../linux-2.6.11.8-hsc0.patch
[root@samfei linux-2.6.11.8]# ARCH=arm CROSS_COMPILE=arm-elf- make menuconfig
[root@samfei linux-2.6.11.8]# ARCH=arm CROSS_COMPILE=arm-elf- make
CC arch/arm/kernel/asm-offsets.s
In file included from arch/arm/kernel/asm-offsets.c:13:
include/linux/sched.h: In function `arch_pick_mmap_layout':
include/linux/sched.h:1174: `TASK_UNMAPPED_BASE' undeclared (first use in this function)
include/linux/sched.h:1174: (Each undeclared identifier is reported only once
include/linux/sched.h:1174: for each function it appears in.)
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make: *** [arch/arm/kernel/asm-offsets.s] Error 2
include/asm/arch/memory.h中增加TASK_UNMAPPED_BASE定義
[root@samfei linux-2.6.11.8]# ARCH=arm CROSS_COMPILE=arm-elf- make
usr/initramfs_data.S: Assembler messages:
usr/initramfs_data.S:29: Error: Unknown pseudo-op: `.incbin'
make[1]: *** [usr/initramfs_data.o] Error 1
make: *** [usr] Error 2

這個編譯器不支持.incbin的緣故, 下載新的編譯器
我現在使用的是arm-elf-tools-20030314.sh.下載新的編譯器:
http://opensrc.sec.samsung.com/download/arm-elf-tools-20040427.sh
並安裝後,重新編譯:

[root@samfei linux-2.6.11.8]# ARCH=arm CROSS_COMPILE=arm-elf- make
arch/arm/mach-s3c44b0x/time.c: In function `s3c44b0x_time_init':
arch/arm/mach-s3c44b0x/time.c:95: `gettimeoffset' undeclared (first use in this function)
arch/arm/mach-s3c44b0x/time.c:95: (Each undeclared identifier is reported only once
arch/arm/mach-s3c44b0x/time.c:95: for each function it appears in.)
arch/arm/mach-s3c44b0x/time.c:99: warning: implicit declaration of function `s3c44b0x_clear_pb'
arch/arm/mach-s3c44b0x/time.c:100: warning: implicit declaration of function `s3c44b0x_unmask_irq'
make[1]: *** [arch/arm/mach-s3c44b0x/time.o] Error 1
make: *** [arch/arm/mach-s3c44b0x] Error 2
[root@samfei linux-2.6.11.8]#

現在註釋掉gettimeoffset = s3c44b0x_gettimeoffset後,編譯:
[root@samfei linux-2.6.11.8]# ARCH=arm CROSS_COMPILE=arm-elf- make
CC arch/arm/mach-s3c44b0x/driver/rtl8019.o
arch/arm/mach-s3c44b0x/driver/rtl8019.c: In function `nic_8019_open':
arch/arm/mach-s3c44b0x/driver/rtl8019.c:218: `MOD_INC_USE_COUNT' undeclared (first use in this function)
arch/arm/mach-s3c44b0x/driver/rtl8019.c:218: (Each undeclared identifier is reported only once
arch/arm/mach-s3c44b0x/driver/rtl8019.c:218: for each function it appears in.)
arch/arm/mach-s3c44b0x/driver/rtl8019.c:216: warning: unused variable `j'
arch/arm/mach-s3c44b0x/driver/rtl8019.c: In function `nic_8019_stop':
arch/arm/mach-s3c44b0x/driver/rtl8019.c:286: `MOD_DEC_USE_COUNT' undeclared (first use in this function)
arch/arm/mach-s3c44b0x/driver/rtl8019.c: In function `nic_8019_start_xmit':
arch/arm/mach-s3c44b0x/driver/rtl8019.c:296: warning: unused variable `priv'
make[2]: *** [arch/arm/mach-s3c44b0x/driver/rtl8019.o] Error 1
make[1]: *** [arch/arm/mach-s3c44b0x/driver] Error 2
make: *** [arch/arm/mach-s3c44b0x] Error 2
[root@samfei linux-2.6.11.8]#

註釋掉MOD_DEC_USE_COUNT和MOD_INC_USE_COUNT

GEN .version
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_flush_user_cache_range'
arch/arm/mm/built-in.o(.text+0x1480): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_flush_user_cache_all'
arch/arm/mm/built-in.o(.text+0x1480): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_coherent_kern_range'
arch/arm/mm/built-in.o(.text+0x148c): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.init.data+0x0): multiple definition of `v3_cache_fns'
arch/arm/mm/built-in.o(.init.data+0x70): first defined here
/usr/local/bin/arm-elf-ld.real: Warning: size of symbol `v3_cache_fns' changed from 36 in arch/arm/mm/built-in.o to 32 in arch/arm/mach-s3c44b0x/built-in.o
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_dma_flush_range'
arch/arm/mm/built-in.o(.text+0x1490): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_flush_kern_cache_all'
arch/arm/mm/built-in.o(.text+0x1480): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_flush_kern_dcache_page'
arch/arm/mm/built-in.o(.text+0x1490): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_dma_inv_range'
arch/arm/mm/built-in.o(.text+0x1490): first defined here
arch/arm/mach-s3c44b0x/built-in.o(.text+0x170): In function `v3_dma_clean_range':
: multiple definition of `v3_dma_clean_range'
arch/arm/mm/built-in.o(.text+0x1498): first defined here
kernel/built-in.o(.text+0x1cfb4): In function `kallsyms_expand_symbol':
: undefined reference to `kallsyms_names'
kernel/built-in.o(.text+0x1cfb8): In function `kallsyms_expand_symbol':
: undefined reference to `kallsyms_token_index'
kernel/built-in.o(.text+0x1cfbc): In function `kallsyms_expand_symbol':
: undefined reference to `kallsyms_token_table'
kernel/built-in.o(.text+0x1d020): In function `kallsyms_get_symbol_type':
: undefined reference to `kallsyms_names'
kernel/built-in.o(.text+0x1d024): In function `kallsyms_get_symbol_type':
: undefined reference to `kallsyms_token_index'
kernel/built-in.o(.text+0x1d028): In function `kallsyms_get_symbol_type':
: undefined reference to `kallsyms_token_table'
kernel/built-in.o(.text+0x1d07c): In function `get_symbol_offset':
: undefined reference to `kallsyms_markers'
kernel/built-in.o(.text+0x1d080): In function `get_symbol_offset':
: undefined reference to `kallsyms_names'
kernel/built-in.o(.text+0x1d0fc): In function `kallsyms_lookup_name':
: undefined reference to `kallsyms_num_syms'
kernel/built-in.o(.text+0x1d100): In function `kallsyms_lookup_name':
: undefined reference to `kallsyms_addresses'
kernel/built-in.o(.text+0x1d300): In function `kallsyms_lookup':
: undefined reference to `kallsyms_addresses'
kernel/built-in.o(.text+0x1d318): In function `kallsyms_lookup':
: undefined reference to `kallsyms_num_syms'
kernel/built-in.o(.text+0x1d450): In function `get_ksymbol_mod':
: undefined reference to `kallsyms_num_syms'
kernel/built-in.o(.text+0x1d4a4): In function `get_ksymbol_core':
: undefined reference to `kallsyms_addresses'
kernel/built-in.o(.text+0x1d570): In function `update_iter':
: undefined reference to `kallsyms_num_syms'
make: *** [.tmp_vmlinux1] Error 1
[root@samfei linux-2.6.11.8]#

一直不太明白上面的錯誤,實在搞不定了.而且後面試了其他的方法,但都有不定的錯誤.實在不行,於是另尋辦法.

2.6.9內核
經過網上資料的查詢和閱讀,還是覺得2.6.9內核比較容易,因爲網站上有2.6.9的uclinux補丁.具體是:
http://opensrc.sec.samsung.com/download/linux-2.6.9-uc0-hsc0.patch.gz

因此我們從www.kernel.org上下載了linux-2.6.9.tar.bz2. 從www.uclinux.org上下載了linux-2.6.9-uc0.patch,這樣呢我們就有了3個文件.

-rw-r--r-- 1 root root 36261440 2004-10-19 linux-2.6.9.tar.bz2
-rw-r--r-- 1 root root 357214 2004-11-23 linux-2.6.9-uc0-hsc0.patch
-rw-r--r-- 1 root root 1231190 2004-10-28 linux-2.6.9-uc0.patch

然後我們從頭開始做. 另一個需要的就是uclinux-dist包,我們使用uClinux-dist-20041215.tar.gz,因爲我們用這個版本已經可以跑2.4內核了.

開始動手
具體我們參考上面文章中提到的方法.
解壓uclinux-dist包:
[root@samfei 44b0]# tar zxvf /home/software/uClinux-dist-20041215.tar.gz
[root@samfei 44b0]# mv uClinux-dist micetek
[root@samfei 44b0]# cd micetek
[root@samfei micetek]# rm -rf linux-2.6.x
[root@samfei micetek]# mv linux-2.6.9 linux-2.6.x
[root@samfei micetek]# cd linux-2.6.x
[root@samfei linux-2.6.x]# patch -p1 < ../../linux-2.6.9-uc0.patch
[root@samfei linux-2.6.x]# patch -p1 < ../../linux-2.6.9-uc0-hsc0.patch

按照2.4內核的方法,增加vendor的文件.
[root@samfei micetek]# cp linux-2.6.x/arch/armnommu/configs/s3c44b0x_defconfig vendors/Micetek/44b0//config.linux-2.6.x

然後make menuconfig配置後,編譯:
[root@samfei micetek]# make dep; make
make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.6.x dep
make[1]: Entering directory `/home/44b0/micetek/linux-2.6.x'
*** Warning: make dep is unnecessary now.
make[1]: Leaving directory `/home/44b0/micetek/linux-2.6.x'
make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.6.x || exit 1
make[1]: Entering directory `/home/44b0/micetek/linux-2.6.x'
CHK include/linux/version.h
UPD include/linux/version.h
SYMLINK include/asm -> include/asm-armnommu
SPLIT include/linux/autoconf.h -> include/config/*
……..

沒有內核映象文件
編譯完了,很正常,但沒有看到我希望的images下面的映象文件,只有一個romfs.img:
[root@samfei micetek]# ls -l images
×&#220;&#211;&#195;&#193;&#191; 152
-rw-r--r-- 1 root root 150528 10&#212;&#194; 3 17:11 romfs.img

修改Makefile,增加bzImage
增加 LINUXTARGET = bzImage

[root@samfei micetek]# make
make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.6.x bzImage || exit 1
make[1]: Entering directory `/home/44b0/micetek/linux-2.6.x'
……

[root@samfei micetek]# ls -l images
×&#220;&#211;&#195;&#193;&#191; 152
-rw-r--r-- 1 root root 150528 10&#212;&#194; 3 17:20 romfs.img
[root@samfei micetek]#

還是沒有希望的映象出現. 和2.4內核編譯的Makefile進行比較:
[root@samfei micetek]# diff Makefile ../xm44b0/Makefile
43d42
<
237a237,240
> .PHONY: images
> images:
> $(MAKE) -C $(VENDDIR) images
>
271c274,275
< subdirs: linux
---
> #subdirs: linux
> subdirs:

修改Makefile,增加linux,images
20 all: subdirs romfs modules modules_install image linux images

237 .PHONY: images
238 images:
239 $(MAKE) -C $(VENDDIR) images
240

273 .PHONY: subdirs
274 #subdirs: linux
275 subdirs:

[root@samfei micetek]# make
for dir in include lib include user ; do [ ! -d $dir ] || make ARCH=armnommu CROSS_COMPILE=arm-elf- -C $dir || exit 1 ; done
make[1]: Entering directory `/home/44b0/micetek/include'
……..

[root@samfei micetek]# ls images/
linux_bootram.bin linux_bootrom.bin romfs.img
[root@samfei micetek]#

這下有了.

運行試試看


Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: T T T *********************************************************************************************************************************************************************************************************************************************************** done
Bytes transferred = 1283292 (1394dc hex)
## Starting application at 0x0c008000 ...


沒有顯示啊!肯定是串口設置的問題了.配置的時候也沒有去修改時鐘頻率.我現在是用MBL(u-boot)來引導的,因此其他的CPU參數還可以不用管.

修正RAM和FLASH地址問題
修改了CONFIG_ARM_CLK,但依然還是一樣.經過仔細檢查,發現RAM和FLASH的地址沒有配置對.

配置正確後,運行:
Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ****************************************************************************************************************************************************************************************************************************************************************************** done
Bytes transferred = 1381596 (1514dc hex)
## Starting application at 0x0c008000 ...
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #5 Mon Oct 3 20:02:08 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line:
PID hash table entries: 64 (order: 6, 1024 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6664KB available (1239K code, 120K data, 52K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
NET: Registered protocol family 16
init_module
Samsung S3C44B0 Rtl8019as driver version 0.1 (2002-02-20) <[email protected]>
init
eth0: 12:34:56:78:90:ab
get_stats
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
loop: loaded (max 8 devices)
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
VFS: Cannot open root device "<NULL>" or unknown-block(0,255)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)


增加romfs
由於2.6內核中沒有了blkmem,因此具體的romfs文件不能按照2.4內核的做法,網上查到下面文章:
在S3C4510B上運行uClinux-2.6的過程(romfs直接鏈入image.ram)
http://bbs.edw.com.cn/dispbbs.asp?boardID=20&ID=46160&page=1
我們參考其romfs的方法,具體做法:
修改linux-2.6.x/arch/armnommu/arch/kernel/vmlinux.lds.S, 添加romfs.o
81 *(.got) /* Global offset table */
82 romfs_start = .;
83 romfs.o
84 romfs_end = .;
修改linux-2.6.x/arch/armnommu/kernel/setup.c,添加變量romfs_start,romfs_end及設置default_command_line
64 extern int _stext, _text, _etext, _edata, _end;
65 extern int romfs_start,romfs_end;
683 char *from = default_command_line;
685 sprintf(default_command_line, "root=/dev/ram0 initrd=0x%08lx,%ldk keepinitrd", (unsigned
long)&romfs_start,((unsigned long)&romfs_end - (unsigned long)&romfs_start)>>10);

由於root文件系統使用/dev/ram0, 因此rc時就不能使用/dev/ram0, 而使用/dev/ram1, /dev/ram2, 因此同時修改vendors/Micetek/44b0/rc文件.
2 /bin/expand /etc/ramfs.img /dev/ram1

編譯,運行
Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ************************************************************************************************************************************************************************************************************************************************************************************************************* done
Bytes transferred = 1537244 (1774dc hex)
## Starting application at 0x0c008000 ...
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #6 Mon Oct 3 20:51:33 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c14aef0,147k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6512KB available (1386K code, 125K data, 52K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
init_module
Samsung S3C44B0 Rtl8019as driver version 0.1 (2002-02-20) <[email protected]>
init
eth0: 12:34:56:78:90:ab
get_stats
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
loop: loaded (max 8 devices)
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 147KiB [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 52K
Warning: unable to open an initial console.
Kernel panic - not syncing: Attempted to kill init!

檢查romfs/bin, 缺省配置的命令太少了.
[root@samfei micetek]# ls -l romfs/bin
×&#220;&#211;&#195;&#193;&#191; 140
-rwxr--r-- 1 root root 28196 10&#212;&#194; 3 20:51 expand
-rwxr--r-- 1 root root 29692 10&#212;&#194; 3 20:51 init
-rwxr--r-- 1 root root 76236 10&#212;&#194; 3 20:51 sh
[root@samfei micetek]#

增加了命令配置,重新編譯,但好像內核映象沒有改變.但命令確實編譯出來了
[root@samfei micetek]# ls -l romfs/bin
×&#220;&#211;&#195;&#193;&#191; 2212
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 busybox
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 df
-rwxr--r-- 1 root root 29888 10&#212;&#194; 3 21:31 erase
-rwxr--r-- 1 root root 32900 10&#212;&#194; 3 21:31 eraseall
-rwxr--r-- 1 root root 28196 10&#212;&#194; 3 21:31 expand
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 ifconfig
-rwxr--r-- 1 root root 38888 10&#212;&#194; 3 21:31 inetd
-rwxr--r-- 1 root root 29692 10&#212;&#194; 3 21:31 init
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 mount
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 netstat
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 ping
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 route
-rwxr--r-- 1 root root 76236 10&#212;&#194; 3 21:31 sh
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 tail
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 telnet
-rwxr--r-- 1 root root 50288 10&#212;&#194; 3 21:31 telnetd
-rwxr--r-- 1 root root 54200 10&#212;&#194; 3 21:31 tftp
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 umount
-rwxr--r-- 11 root root 166372 10&#212;&#194; 3 21:31 vi
[root@samfei micetek]#

修改了命令配置後,編譯出來的內核還是老的romfs.o,這個應該是Makefile文件關聯的問題,romfs.o是後加的.
重新編譯後,panic情況依然如此!

增加串口驅動
增加文件drivers/serial/serial_s3c44b0.c和include/asm/arch/uart.h,修改drivers/serial/Kconfig, drivers/serial/Makefile及/include/linux/serial_core.h文件.
In file included from drivers/serial/serial_s3c44b0.c:59:
include/asm/arch/system.h: In function `arch_reset':
include/asm/arch/system.h:19: warning: implicit declaration of function `mdelay'
drivers/serial/serial_s3c44b0.c: In function `raw_printk':
drivers/serial/serial_s3c44b0.c:133: warning: implicit declaration of function `raw_vprintk'
drivers/serial/serial_s3c44b0.c: In function `raw_vprintk':
drivers/serial/serial_s3c44b0.c:172: warning: control reaches end of non-void function
drivers/serial/serial_s3c44b0.c: In function `__s3c44b0_rx_char':
drivers/serial/serial_s3c44b0.c:220: warning: unused variable `status'
drivers/serial/serial_s3c44b0.c: At top level:
drivers/serial/serial_s3c44b0.c:546: `PORT_S3C44B0' undeclared here (not in a function)
drivers/serial/serial_s3c44b0.c:546: initializer element is not constant
drivers/serial/serial_s3c44b0.c:546: (near initialization for `__s3c44b0_ports[0].type')
drivers/serial/serial_s3c44b0.c:547: initializer element is not constant
drivers/serial/serial_s3c44b0.c:547: (near initialization for `__s3c44b0_ports[0]')
drivers/serial/serial_s3c44b0.c:556: `PORT_S3C44B0' undeclared here (not in a function)
drivers/serial/serial_s3c44b0.c:556: initializer element is not constant
drivers/serial/serial_s3c44b0.c:556: (near initialization for `__s3c44b0_ports[1].type')
drivers/serial/serial_s3c44b0.c:557: initializer element is not constant
drivers/serial/serial_s3c44b0.c:557: (near initialization for `__s3c44b0_ports[1]')
include/asm/arch/system.h:12: warning: `arch_idle' defined but not used
make[3]: *** [drivers/serial/serial_s3c44b0.o] Error 1
make[2]: *** [drivers/serial] Error 2
make[1]: *** [drivers] Error 2
上面錯誤是沒有在serial_core.h中增加PORT_S3C44B0定義造成的.

Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************** done
Bytes transferred = 1770576 (1b0450 hex)
## Starting application at 0x0c008000 ...
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #9 Mon Oct 3 22:26:53 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c12a66c,511k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
drivers/serial/serial_s3c44b0.c:613 __s3c44b0_console_init
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6300KB available (1616K code, 106K data, 56K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
init_module
Samsung S3C44B0 Rtl8019as driver version 0.1 (2002-02-20) <[email protected]>
init
eth0: 12:34:56:78:90:ab
get_stats
ttyS0 at I/O 0x1d00000 (irq = 3) is a Samsung S3C44B0X Internal UART
ttyS1 at I/O 0x1d04000 (irq = 2) is a Samsung S3C44B0X Internal UART
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 511KiB [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 56K
Warning: unable to open an initial console.
Kernel panic - not syncing: Attempted to kill init!

增加了串口驅動,錯誤依然.應該跟串口驅動沒有關係了.

修改linux/init/main.c中:
732 #if 0
733 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
734 printk("Warning: unable to open an initial console./n");
735 #else
736 if (sys_open((const char __user *) "/dev/ttyS0", O_RDWR, 0) < 0)
737 printk("Warning: unable to open an initial console./n");
738 #endif

編譯,運行後提示:
Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************** done
Bytes transferred = 1770576 (1b0450 hex)
## Starting application at 0x0c008000 ...
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #10 Mon Oct 3 22:32:44 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c12a66c,511k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
drivers/serial/serial_s3c44b0.c:613 __s3c44b0_console_init
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6300KB available (1616K code, 106K data, 56K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
init_module
Samsung S3C44B0 Rtl8019as driver version 0.1 (2002-02-20) <[email protected]>
init
eth0: 12:34:56:78:90:ab
get_stats
ttyS0 at I/O 0x1d00000 (irq = 3) is a Samsung S3C44B0X Internal UART
ttyS1 at I/O 0x1d04000 (irq = 2) is a Samsung S3C44B0X Internal UART
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 511KiB [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 56K
divisor=32
沒有任何信息了.panic錯誤信息也沒有了,還是沒有打印出來?

Panic錯誤原因
經過一點一點調試,應該可以確定:
1. Kernel panic - not syncing: Attempted to kill init!
應該是/etc/inittab爲空(也就是沒有一行有效的,全是#開頭!), 增加了inetd的定義後,沒有出現這個錯誤.
2. ttyS0串口設置後,後面printk就出不來,表示串口驅動還是有問題.下面的信息是去除串口驅動配置後的提示,/bin/sh啓動的時候,由於串口打不開,而一直在重新啓動.

Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ******************************************************************************************************************************************************************************************************************************************************************************************************************************************************* done
Bytes transferred = 1753456 (1ac170 hex)
## Starting application at 0x0c008000 ...
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #19 Mon Oct 3 23:32:35 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c125ff8,511k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6316KB available (1598K code, 106K data, 56K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
fs/namei.c:932 path_lookup name=/dev
fs/namei.c:932 path_lookup name=/dev
fs/namei.c:932 path_lookup name=/dev
fs/namei.c:932 path_lookup name=/dev/console
fs/namei.c:932 path_lookup name=/dev/console
fs/namei.c:932 path_lookup name=/dev/console
fs/namei.c:932 path_lookup name=/root
fs/namei.c:932 path_lookup name=/root
fs/namei.c:932 path_lookup name=/root
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
fs/open.c:952 sys_open filename=/initrd.image
fs/open.c:764 filp_open filename=/initrd.image
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/initrd.image
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
NET: Registered protocol family 16
init_module
Samsung S3C44B0 Rtl8019as driver version 0.1 (2002-02-20) <[email protected]>
init
eth0: 12:34:56:78:90:ab
get_stats
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
fs/namei.c:932 path_lookup name=/init
fs/namei.c:932 path_lookup name=/sys
fs/namei.c:932 path_lookup name=/sys
fs/open.c:952 sys_open filename=/sys/block/ram0/dev
fs/open.c:764 filp_open filename=/sys/block/ram0/dev
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/sys/block/ram0/dev
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/sys
fs/namei.c:932 path_lookup name=/sys
fs/namei.c:932 path_lookup name=/dev/ram
fs/namei.c:932 path_lookup name=/dev/ram
fs/open.c:952 sys_open filename=/dev/ram
fs/open.c:764 filp_open filename=/dev/ram
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ram
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/initrd.image
fs/open.c:764 filp_open filename=/initrd.image
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/initrd.image
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 511KiB [1 disk] into ram disk... done.
fs/namei.c:932 path_lookup name=/dev/ram
fs/namei.c:932 path_lookup name=/initrd.image
fs/namei.c:932 path_lookup name=/dev/root
fs/namei.c:932 path_lookup name=/dev/root
fs/namei.c:932 path_lookup name=/root
fs/namei.c:932 path_lookup name=/dev/root
fs/namei.c:932 path_lookup name=/root
fs/namei.c:932 path_lookup name=/dev/root
fs/namei.c:932 path_lookup name=/root
VFS: Mounted root (romfs filesystem) readonly.
fs/namei.c:932 path_lookup name=/
fs/namei.c:932 path_lookup name=.
fs/namei.c:932 path_lookup name=.
Freeing init memory: 56K
fs/open.c:952 sys_open filename=/dev/console
fs/open.c:764 filp_open filename=/dev/console
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/console
fs/namei.c:1429 open_namei error=0
fs/open.c:821 dentry_open
Warning: unable to open an initial console.
fs/namei.c:932 path_lookup name=/sbin/init
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/etc/singleboot
fs/open.c:952 sys_open filename=/dev/null
fs/open.c:764 filp_open filename=/dev/null
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/null
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/bin/sh
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/etc/rc
fs/open.c:764 filp_open filename=/etc/rc
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/rc
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/bin/hostname
fs/namei.c:932 path_lookup name=/usr/bin/hostname
fs/namei.c:932 path_lookup name=/etc/hostname
fs/namei.c:932 path_lookup name=/sbin/hostname
fs/namei.c:932 path_lookup name=/usr/sbin/hostname
fs/namei.c:932 path_lookup name=/bin/expand
fs/namei.c:932 path_lookup name=/bin/expand
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/etc/ramfs.img
fs/open.c:764 filp_open filename=/etc/ramfs.img
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/ramfs.img
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/ram1
fs/open.c:764 filp_open filename=/dev/ram1
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ram1
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/bin/mount
fs/namei.c:932 path_lookup name=/bin/mount
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=proc
fs/namei.c:932 path_lookup name=/proc
fs/namei.c:932 path_lookup name=/bin/mount
fs/namei.c:932 path_lookup name=/bin/mount
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/dev/ram1
fs/namei.c:932 path_lookup name=/var
fs/namei.c:932 path_lookup name=/dev/ram1
fs/namei.c:932 path_lookup name=/bin/mkdir
fs/namei.c:932 path_lookup name=/usr/bin/mkdir
fs/namei.c:932 path_lookup name=/etc/mkdir
fs/namei.c:932 path_lookup name=/sbin/mkdir
fs/namei.c:932 path_lookup name=/usr/sbin/mkdir
fs/namei.c:932 path_lookup name=/var/config
fs/namei.c:932 path_lookup name=/bin/mkdir
fs/namei.c:932 path_lookup name=/usr/bin/mkdir
fs/namei.c:932 path_lookup name=/etc/mkdir
fs/namei.c:932 path_lookup name=/sbin/mkdir
fs/namei.c:932 path_lookup name=/usr/sbin/mkdir
fs/namei.c:932 path_lookup name=/var/tmp
fs/namei.c:932 path_lookup name=/bin/mkdir
fs/namei.c:932 path_lookup name=/usr/bin/mkdir
fs/namei.c:932 path_lookup name=/etc/mkdir
fs/namei.c:932 path_lookup name=/sbin/mkdir
fs/namei.c:932 path_lookup name=/usr/sbin/mkdir
fs/namei.c:932 path_lookup name=/var/log
fs/namei.c:932 path_lookup name=/bin/mkdir
fs/namei.c:932 path_lookup name=/usr/bin/mkdir
fs/namei.c:932 path_lookup name=/etc/mkdir
fs/namei.c:932 path_lookup name=/sbin/mkdir
fs/namei.c:932 path_lookup name=/usr/sbin/mkdir
fs/namei.c:932 path_lookup name=/var/run
fs/namei.c:932 path_lookup name=/bin/mkdir
fs/namei.c:932 path_lookup name=/usr/bin/mkdir
fs/namei.c:932 path_lookup name=/etc/mkdir
fs/namei.c:932 path_lookup name=/sbin/mkdir
fs/namei.c:932 path_lookup name=/usr/sbin/mkdir
fs/namei.c:932 path_lookup name=/var/lock
fs/namei.c:932 path_lookup name=/bin/cat
fs/namei.c:932 path_lookup name=/usr/bin/cat
fs/namei.c:932 path_lookup name=/etc/cat
fs/namei.c:932 path_lookup name=/sbin/cat
fs/namei.c:932 path_lookup name=/usr/sbin/cat
fs/open.c:952 sys_open filename=/etc/motd
fs/open.c:764 filp_open filename=/etc/motd
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/motd
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/bin/ifconfig
fs/namei.c:932 path_lookup name=/bin/ifconfig
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/bin/route
fs/namei.c:932 path_lookup name=/bin/route
fs/open.c:817 dentry_open
fs/namei.c:932 path_lookup name=/bin/dhcpcd
fs/namei.c:932 path_lookup name=/usr/bin/dhcpcd
fs/namei.c:932 path_lookup name=/etc/dhcpcd
fs/namei.c:932 path_lookup name=/sbin/dhcpcd
fs/namei.c:932 path_lookup name=/usr/sbin/dhcpcd
fs/namei.c:932 path_lookup name=/bin/dhcpcd
fs/namei.c:932 path_lookup name=/usr/bin/dhcpcd
fs/namei.c:932 path_lookup name=/etc/dhcpcd
fs/namei.c:932 path_lookup name=/sbin/dhcpcd
fs/namei.c:932 path_lookup name=/usr/sbin/dhcpcd
fs/open.c:952 sys_open filename=/etc/inittab
fs/open.c:764 filp_open filename=/etc/inittab
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/inittab
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/inet
fs/open.c:764 filp_open filename=/dev/inet
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/inet
fs/namei.c:932 path_lookup name=/bin/inetd
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/ttyS0
fs/open.c:764 filp_open filename=/dev/ttyS0
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ttyS0
fs/namei.c:1429 open_namei error=0
fs/open.c:821 dentry_open
fs/namei.c:932 path_lookup name=/bin/sh
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/null
fs/open.c:764 filp_open filename=/dev/null
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/null
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/null
fs/open.c:764 filp_open filename=/dev/null
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/null
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/var/run/inetd.pid
fs/open.c:764 filp_open filename=/var/run/inetd.pid
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/var/run/inetd.pid
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/etc/inetd.conf
fs/open.c:764 filp_open filename=/etc/inetd.conf
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/inetd.conf
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/etc/services
fs/open.c:764 filp_open filename=/etc/services
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/services
fs/namei.c:1429 open_namei error=0
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/etc/config/inetd.conf
fs/open.c:764 filp_open filename=/etc/config/inetd.conf
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/etc/config/inetd.conf
fs/open.c:952 sys_open filename=/dev/ttyS0
fs/open.c:764 filp_open filename=/dev/ttyS0
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ttyS0
fs/namei.c:1429 open_namei error=0
fs/open.c:821 dentry_open
fs/namei.c:932 path_lookup name=/bin/sh
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/ttyS0
fs/open.c:764 filp_open filename=/dev/ttyS0
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ttyS0
fs/namei.c:1429 open_namei error=0
fs/open.c:821 dentry_open
fs/namei.c:932 path_lookup name=/bin/sh
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/ttyS0
fs/open.c:764 filp_open filename=/dev/ttyS0
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ttyS0
fs/namei.c:1429 open_namei error=0
fs/open.c:821 dentry_open
fs/namei.c:932 path_lookup name=/bin/sh
fs/open.c:817 dentry_open
fs/open.c:952 sys_open filename=/dev/ttyS0
fs/open.c:764 filp_open filename=/dev/ttyS0
fs/namei.c:1335 open_namei
fs/namei.c:932 path_lookup name=/dev/ttyS0
fs/namei.c:1429 open_namei error=0
fs/open.c:821 dentry_open
fs/namei.c:932 path_lookup name=/bin/sh
fs/open.c:817 dentry_open

串口驅動波特率問題
串口驅動增加後,原來是:
fs/namei.c:1429 open_namei error=0
divisor=32
divisor=32
drivers/serial/serial_s3c44b0.c:472 __s3c44b0_set_termios baud=9600
drivers/serial/serial_s3c44b0.c:474 __s3c44b0_set_termios quot=391à
波特率不對!

原來2.4內核配置的時候有缺省的console波特率的,但2.6檢查後沒有找到. 如果沒有設置過,那麼uart_get_baud_rate返回的波特率就是9600.

缺省的波特率是在調用console_setup的時候初始話的,但我們現在用的console是簡易的串口驅動的console,因此沒有調用過.也就是沒有設置過波特率.

這裏面要說明的就是: 2.6內核中帶了1個串口的驅動,只是只有console部分,還不是完整的串口驅動,但它對我們調試內核是非常有幫助的,因爲串口能很早就輸出了,對於我調試後面的串口驅動是非常有好處的.如果你仔細看程序,我裏面增加了一個raw_printk函數,也是這樣的作用.

去除簡易串口驅動配置
具體顯示信息:
Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************* done
Bytes transferred = 1761776 (1ae1f0 hex)
## Starting application at 0x0c008000 ...
drivers/serial/serial_core.c:1840 uart_set_options baud=115200
drivers/serial/serial_s3c44b0.c:473 __s3c44b0_set_termios baud=115200
drivers/serial/serial_s3c44b0.c:475 __s3c44b0_set_termios quot=33
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #28 Tue Oct 4 08:19:19 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c12994c,511k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
drivers/serial/serial_s3c44b0.c:617 __s3c44b0_console_init
drivers/serial/serial_s3c44b0.c:585 __s3c44b0_console_setup
divisor=32
divisor=32
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6308KB available (1613K code, 101K data, 56K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
ttyS0 at I/O 0x1d00000 (irq = 3) is a Samsung S3C44B0X Internal UART
ttyS1 at I/O 0x1d04000 (irq = 2) is a Samsung S3C44B0X Internal UART
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 511KiB [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 56K
divisor=32
divisor=32
drivers/serial/serial_s3c44b0.c:473 __s3c44b0_set_termios baud=115200
drivers/serial/serial_s3c44b0.c:475 __s3c44b0_set_termios quot=33
Shell invoked to run file: /etc/rc
Command: hostname EV44B0II
Command: /bin/expand /etc/ramfs.img /dev/ram1
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram1 /var
Command: mkdir /var/config
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ /| | | |/ // /
| |_| | |__| || | | | | |_| |/ /
| ___/____|_||_|_| |_|/____|/_//_/
| |
|_|
for MICETEK EV44B0-II board
Support by MICETEK Shanghai 2003.01
<[email protected]>
For further information check:
http://www.uclinux.org/

Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: dhcpcd -p -a eth0 &
dhcpcd: Bad command or file name
[16]
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/>
Sash command shell (version 1.1.1)
/>

前面調用過console_setup後,後面的波特率就對了.

2個sh
一個sh是配置了enable console shell,一個sh是inittab裏的ttyS0:unknow:/bin/sh. 只需要一個就可以.
串口正常後提示信息,第一階段完成
使用正常的串口驅動作爲console.

Welcome to MICETEK World!
M(icetek)B(oot)L(oader) v1.0.2 (Jan 21 2003 - 15:09:41)

MBL code range: 0x0c700000 -> 0x0c717a98
DRAM Configuration:
Bank #0: start 0x0c000000 8 MB
FLASH Configuration:
Bank: 2 MB
Hit any key to stop autoboot: 0
EV44B0II ethernet driver v1.0 2003/01/08 by Qinwei, MICETEK Shanghai
ARP broadcast 1
Server eth addr: 00:e0:4c:b1:22:0c
TFTP from server 192.168.1.25; our IP address is 192.168.1.101
Filename 'linux_bootram.bin'.
Load address: 0xc008000
Loading: ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************* done
Bytes transferred = 1761776 (1ae1f0 hex)
## Starting application at 0x0c008000 ...
drivers/serial/serial_core.c:1840 uart_set_options baud=115200
drivers/serial/serial_s3c44b0.c:473 __s3c44b0_set_termios baud=115200
drivers/serial/serial_s3c44b0.c:475 __s3c44b0_set_termios quot=33
Linux version 2.6.9-hsc0 ([email protected]) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #31 Tue Oct 4 08:31:03 CST 2005
CPU: Samsung-S3C44B0x [44b07700] revision 0 (ARMv4T)
Machine: S3C44B0X Development Board
Built 1 zonelists
Kernel command line: root=/dev/ram0 initrd=0x0c129950,511k keepinitrd
PID hash table entries: 64 (order: 6, 1024 bytes)
drivers/serial/serial_s3c44b0.c:617 __s3c44b0_console_init
drivers/serial/serial_s3c44b0.c:585 __s3c44b0_console_setup
divisor=32
divisor=32
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6308KB available (1613K code, 101K data, 56K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
checking if image is initramfs...it isn't (ungzip failed); looks like an initrd
NET: Registered protocol family 16
ttyS0 at I/O 0x1d00000 (irq = 3) is a Samsung S3C44B0X Internal UART
ttyS1 at I/O 0x1d04000 (irq = 2) is a Samsung S3C44B0X Internal UART
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: romfs filesystem found at block 0
RAMDISK: Loading 511KiB [1 disk] into ram disk... done.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 56K
divisor=32
divisor=32
drivers/serial/serial_s3c44b0.c:473 __s3c44b0_set_termios baud=115200
drivers/serial/serial_s3c44b0.c:475 __s3c44b0_set_termios quot=33
Shell invoked to run file: /etc/rc
Command: hostname EV44B0II
Command: /bin/expand /etc/ramfs.img /dev/ram1
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram1 /var
Command: mkdir /var/config
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ /| | | |/ // /
| |_| | |__| || | | | | |_| |/ /
| ___/____|_||_|_| |_|/____|/_//_/
| |
|_|
for MICETEK EV44B0-II board
Support by MICETEK Shanghai 2003.01
<[email protected]>
For further information check:
http://www.uclinux.org/

Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: dhcpcd -p -a eth0 &
dhcpcd: Bad command or file name
[16]
Execution Finished, Exiting

Sash command shell (version 1.1.1)
/> ps ax
PID PORT STAT SIZE SHARED %CPU COMMAND
1 S 147K 0K 13.8 /sbin/init
2 R 0K 0K 0.0 ksoftirqd/0
3 S 0K 0K 0.1 events/0
4 S 0K 0K 0.0 khelper
5 S 0K 0K 0.0 kblockd/0
6 S 0K 0K 0.0 pdflush
7 S 0K 0K 0.0 pdflush
9 S 0K 0K 0.0 aio/0
8 S 0K 0K 0.0 kswapd0
17 S 67K 0K 1.4 /bin/inetd
18 S0 R 133K 0K 4.2 /bin/sh
/>
最後說明
後面我繼續調試了網卡驅動和MTD驅動,但都沒有成功,而且碰到了比較大的困難.本來準備完成後再發表這個記錄.但目前無法完成,因此提前發表這個記錄.如果有誰成功完成網卡或MTD驅動的,希望能共享相關的信息. 我的附件patch中也包含了網卡和mtd的一些修改內容,各位也可以試試.

我聯繫email: [email protected].,有什麼問題也可以email聯繫我.  
發佈了21 篇原創文章 · 獲贊 2 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章