嵌入式|linux_内核移植方法及错误

出现问题:
## Starting application at 0x30008000 ...
Uncompressing Linux.............................................................
解决方案:
setenv bootargs console=ttySAC0,115200 mem=64M ; console明令在哪暂时还没解决???
setenv
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
解决方法:把
08.05.11、<*> RAM disk support
09.27.07、<*> Compressed ROM file system support (cramfs)
1. 问题一
下载内核到flash中,运行到如下即停止没有下文:
Uncompressing Linux……………………done,booting the kernel卡在这里不动了
原因分析:可能是内核的启动参数传递时没有填写正确,也可能是在linux内核中没对flash分区,还有另一可能原因是在内核编译配置时没将串口驱动勾选。
解决办法:
如果是命令参数问题,则作如下修改:注释掉arch/arm/kernel/setup.c文件中的parse_tag_cmdline()函数中的strlcpy()函数,这样就可以使用默认的CONFIG_CMDLINE了,在.config文件中它被定义为"root=/dev/mtdblock2 ro init=/linuxrc console=ttySAC0,115200"(视具体情况而定),在内核配置文件的Boot options中填入也可。
如果是内核NAND flash分区的问题,则作如下修改:
1. 1 修改文件arch/arm/mach-s3c2410/devs.c,添加如下信息:
#include
#include
#include
static struct mtd_partition partition_info[]={
{
name:"bootloader",
size:0x00040000,
offset:0,
},
{
name:"kernel",
size:0x001c0000,
offset:0x00040000,

},
{
name:"rootfs",
size: 0x01e00000,
offset:0x00200000,

},
{
name:"ext-fs1",
size: 0x01000000,
offset:0x02000000,
},
{
name:"ext-fs2",
size: 0x01000000,
offset:0x03000000,
},
};

//以上分区和NAND flash物理分区一样,分区不一样没试过,根据自己板子情况而定
struct s3c2410_nand_set nandset=
{
nr_partitions:5,
partitions:partition_info,
};
struct s3c2410_platform_nand s3c_nand_info=
{
tacls:0,
twrph0:30,
twrph1:0,
sets:&nandset,
nr_sets:1,
};

以上分区和NAND flash物理分区一样,分区不一样没试过,根据自己板子情况而定
struct s3c2410_nand_set nandset=
{

nr_partitions:5,
partitions:partition_info,
};
struct s3c2410_platform_nand s3c_nand_info=
{
tacls:0,
twrph0:30,
twrph1:0,
sets:&nandset,
nr_sets:1,
};

struct platform_device s3c_device_nand={
.name="s3c2410-nand",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_nand_resources),
.resource = s3c_nand_resource, /*黑体为新加内容*/
.dev = {
.platform_data=https://www.it610.com/article/&s3c_nand_info
}
};

1.2 在arch/arm/mach-s3c2410/mach-smdk2410.c文件中添加&s3c_device_nand,如下所示:
static struct platform_device * smdk2410_device[] _initdata=https://www.it610.com/article/
{
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
};

配置好以上内容后重新编译内核即可。
如果是串口驱动没有勾选,则一定记住将勾上如下选项:
Character devices
-> Serial Drivers下的项勾上.
2. 出现如下错误:VFS:Cannot open root device "mtdblock/2" or unknown-block(0,0)
Please append a correct "root=" boot option.
Kernel panic not syncing,VFS Unable to mount root fs on unknown-block(0,0)
原因分析:出现这种情况一般有两种情况:没有文件系统或boot options参数不正确,如我的系统文件系统为cramfs格式,存放文件系统的分区为第三个分区,启动参数为:
"noinitrd root=/dev/mtdblock2 ro init=/linuxrc console=ttySAC0,115200 rootfstype=cramfs mem=64M"

其中文件系统使用busybox-1.10.1制作
重新编译即可。
3. 系统启动后出现如下错误:
Kernel panic -not syncing:VFS:Unable to mount root fs on unknown-block(31,2)
或者类似的错误。
原因分析:我在这里耗了大量的时间,这种情况一般是NAND flash分区未能分正确,或者所在的分区上没有文件系统,当启动中出现类似如下信息时表明分区正确了
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00040000 : "boot"
mtd: Giving out device 0 to boot
0x00040000-0x00200000 : "kernel"
mtd: Giving out device 1 to kernel
0x00200000-0x02000000 : "rootfs"
mtd: Giving out device 2 to rootfs
0x02000000-0x03000000 : "ext-fs1"
mtd: Giving out device 3 to ext-fs1
0x03000000-0x04000000 : "ext-fs2"
mtd: Giving out device 4 to ext-fs2
从上面看出我的文件系统放在第三个分区rootfs上,其设备号为2,启动后文件系统能挂上,如下所示

Reading data from NAND FLASH without ECC is not recommended
the error code is:0,name=/dev/root,fs=cramfs,flags=32769
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 104K
Reading data from NAND FLASH without ECC is not recommended
init started: BusyBox v1.10.1 (2008-04-23 23:20:41 CST)
starting pid 229, tty '': '/etc/init.d/rcS'
Reading data from NAND FLASH without ECC is not recommended
the error code is:0,name=/dev/root,fs=cramfs,flags=32769
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 104K
Reading data from NAND FLASH without ECC is not recommended
init started: BusyBox v1.10.1 (2008-04-23 23:20:41 CST)
starting pid 229, tty '': '/etc/init.d/rcS'
Please press Enter to activate this console.
4. 系统启动到到如下语句即停止不前,停在那里:
VFS:Mounted root (cramfs filesystem) readonly.
Freeing init memory:104
卡在这里没有下文
原因分析:系统在启用init函数时有这么一句,粗体所示

static int init(void * unused)
{
if(execute_command)
{
run_init_process(execute_command);
}
………………


在这句里面出错就会没有下文
解决办法:在配置内核时少选了几句,将如下选择全选上
Floating Point emulation
->At least one emulation must be selected:
NWFPE math emulation
Support extended precision
FastFPE math emulation(EXPERIMENTAL)
5. 关于文件系统问题:在有些资料上提到在配置内核时选上devfs,如果不存在时则手动在文件里加上。但我在内核里面和busybox-1.10.1中都未加devfs支持,文件系统运行正常。在linux-2.6.14.1及以后版本中已去掉devfs。
6. linux-2.6.15.4这个版本也能成功在s3c2410上运行.
内核编译成功后,启动后出现如下提示后就停住了。。。。。。 矩阵通信网-通信.IT人的精神家园 n4}I-?QR{` t7sJ
Freeing init memory: 72K 矩阵通信网-通信.IT人的精神家园%Eq"w-?0~; {8rTm
Warning: unable to open an initial console.矩阵通信网-通信.IT人的精神家园8`9Pjq&_/N
!C+Q7f W ][0这个也是控制台console的问题,linux-2.6.13以后的内核都支持devfs,而之后版本的内核就把devfs这块去掉了,虽然还能在内核源码中找到对应的源码,你也可以把它加进内核,但是也不是太好用。2.6.13 后的版本改为支持udev了,udev这块我也没太弄懂,正在研究。-
--> Kernel Features
--> Preemption Mode
.config 里面的 CONFIG_PREEMPT_NONE 选项决定了kernel在挂在文件系统后可不能进入shell。
-------------------------------------------------------------------------------
--> Floating point emulation
FPE_NWFPE 选项如果未选上
现象:
…………
IPv4 over IPv4 tunneling driver
TCP bic registered
NET: Registered protocol family 1
IP-Config: No network devices available.
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 4196KiB [1 disk] into ram disk... done.
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 96K
kernel 启动到这里就停止了。
-------------------------------------------------------------------------
--> Device Drivers
--> Block devices
CONFIG_BLK_DEV_RAM选项未选上
CONFIG_BLK_DEV_INITRD选项未选上
现象:
………………
loop: loaded (max 8 devices)
nbd: registered device at major 43
mice: PS/2 mouse device common for all mice
IPv4 over IPv4 tunneling driver
TCP bic registered
NET: Registered protocol family 1
IP-Config: No network devices available.
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "ram0" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

1. 加载kernel后出现如下错误:
NET: Registered protocol family 1
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "mtdblock3" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
其中,linux command line is: "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200"
解决方法,在make menuconfig 后,选中mtd支持,cramfs支持,/dev fs支持。
其中,添加/dev fs支持具体操作如下:
修改fs/Kconfig,支持启动时挂载devfs
$vim fs/ Kconfig
找到menu “Pseudo filesystem”
在其中添加:
config DEVFS_FS
bool “/dev file system support (OBSOLETE)”
default y

config DEVFS_MOUNT
bool “Automatically mount at boot”
default y
depends on DEVFS_FS

之后,boot信息如下:

boot
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x00100000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock/3 init=/linuxrc console=ttySAC0,115200"
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux................................................................... done, booting the kernel.
Linux version 2.6.15.4 (zjw@zjw.linux) (gcc version 4.1.1) #5 Thu Aug 2 20:47:27 CST 2007
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C2410 Clocks, (c) 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
Kernel command line: noinitrd root=/dev/mtdblock/3 init=/linuxrc console=ttySAC0,115200
irq: clearing subpending status 00000007
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 4096 bytes)
timer tcon=00000000, 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: 32MB = 32MB total
Memory: 30248KB available (1676K code, 376K data, 88K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410: Initialising architecture
S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics
DMA channel 0 at c2800000, irq 33
DMA channel 1 at c2800040, irq 34
DMA channel 2 at c2800080, irq 35
DMA channel 3 at c28000c0, irq 36
NetWinder Floating Point Emulator V0.97 (extended precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: devfs_debug: 0x0//可以看出,已经支持devfs
devfs: boot_options: 0x1
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 80x25
fb0: Virtual frame buffer device, using 1024K of video memory
s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand: Tacls=1, 10ns Twrph0=4 40ns, Twrph1=1 10ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 32MiB 3,3V 8-bit":
0x00000000-0x00020000 : "loader"
0x00020000-0x00030000 : "param"
0x00030000-0x001f0000 : "kernel"
0x00200000-0x00600000 : "root"
0x00600000-0x04000000 : "user"
mtd: partition "user" extends beyond the end of device "NAND 32MiB 3,3V 8-bit" -- size truncated to 0x1a00000
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "mtdblock/3" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)



根据网上的一些指导,将linux_cmd_line设置为"noinitrd root=/dev/mtdblock/3 init=/linuxrc console=ttySAC0,115200",问题
依旧。尝试了几乎所有网上的办法,问题没有得到解决。于是尝试换一个内核,下载了2.6.22的内核,按照2.6.15.4一样
配置编译了内核,当然,该版本的移植步骤有点变化,最主要的区别是,2.6.22的内核已经没有了/arch/arm/mach-s3c2410/dev.c文件,
所以,分区信息要在arch/arm/mach-s3c2410/common-smdk.c中修改static struct mtd_partition smdk_default_nand_part[] 。
boot后:

boot
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x001d0000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200"
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux.................................................................................................. done, booting the kernel.
Linux version 2.6.22 (zjw@zjw.linux) (gcc version 4.1.1) #3 Sun Aug 5 16:00:32 CST 2007
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C24XX Clocks, (c) 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: 8128
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200
irq: clearing subpending status 00000007
irq: clearing subpending status 00000002
PID hash table entries: 128 (order: 7, 512 bytes)
timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 29224KB available (2780K code, 309K data, 132K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2410: Initialising architecture
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c2800000, irq 33
DMA channel 1 at c2800040, irq 34
DMA channel 2 at c2800080, irq 35
DMA channel 3 at c28000c0, irq 36
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: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) ?? 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach
s3c2410-lcd: probe of s3c2410-lcd failed with error -22
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: module loaded
dm9000 Ethernet Driver
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=1, 10ns Twrph0=4 40ns, Twrph1=1 10ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 32MiB 3,3V 8-bit":
0x00000000-0x00020000 : "loader"
0x00020000-0x00030000 : "param"
0x00030000-0x00200000 : "kernel"
0x00200000-0x00600000 : "root"
0x00600000-0x02000000 : "user"
usbmon: debugfs is not available
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
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-i2c s3c2410-i2c: slave address 0x10
s3c2410-i2c s3c2410-i2c: bus frequency set to 390 KHz
s3c2410-i2c s3c2410-i2c: i2c-0: S3C I2C adapter
TCP cubic registered
NET: Registered protocol family 1
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 132K
Warning: unable to open an initial console.
Failed to execute /linuxrc.Attempting defaults...

看来,mtdblock3已经能认出来了,不知道上个问题是不是2.6.15.4内核本身的问题。现在的问题,好像是cramfs文件系统有问题了。
也可以理解,我下载的是在2.4内核下能成功加载的文件系统,到2.6下可能不行,看来要重新制作文件系统了。

下载了1.6.1版本的buzybox,修改了makefile的arch和CROSS_COMPILER,make menuconfig,选了一些自认为需要的选项。当我选了静态编译后,编译出错,所以最后选的是动态加载,这样的话就要在编译后的添加的lib目录中将交叉编译工具的一些lib拷贝进去了。
make install 后,生成了bin, sbin ,usr三个目录,然后
mkdir mnt root var tmp proc boot etc lib
mkdir /var/{lock,log,mail,run,spool},然后mkcramfs,生成.cramfs文件,下载,boot,问题依旧,


drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 132K
Warning: unable to open an initial console.
Failed to execute /linuxrc.Attempting defaults...
后来发现busybox生成的文件系统根目录下并没有linuxrc,所以无从执行,于是网上搜索了一下,自己编辑了一个linuxrc脚本,属性改为可执行,内容如下:
#!/bin/sh
echo "mount /etc as ramfs"
/bin/mount -n -t ramfs ramfs /etc
/bin/cp -a /mnt/etc/* /etc
echo "re-create the /etc/mtab entries"
/bin/mount -f -t cramfs -o remount,ro /dev/mtdblock/3 /
/bin/mount -f -t ramfs ramfs /etc
exec /sbin/init

重新压缩下载,boot,问题依旧,真是郁闷。仔细分析了启动信息,发现虽然同样在fs/kconfig中添加了devfs的信息并且在内核编译选项中选中了
相应的内容,但是启动信息中并没有体现出来,所以怀疑devfs驱动没有加载,查看了内核的源代码,发现devfs相关的代码已经完全被删除了,看来
linux确实要和devfs断绝关系了,试着将devfs的代码拷回去,编译错误一大堆,估计要移植过去有点工作量,既然说它不好,那我也不必一定要用它
了,强扭的瓜也不甜,所以准备使用udev。
busybox中有一个裁减的udev --〉mdev命令!选上它,又选择了一些其它的命令,重新make install busybox。发现根目录下有了linuxrc文件了!!
不是很确定到底是添加了哪些选项后出来的,也不想去试验了。赶快打包,下载,boot后,终于:

Copy linux kernel from 0x00030000 to 0x30008000, size = 0x001d0000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200"
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux.................................................................................................. done, booting the kernel.
Linux version 2.6.22 (zjw@zjw.linux) (gcc version 4.1.1) #3 Sun Aug 5 16:00:32 CST 2007
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C24XX Clocks, (c) 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: 8128
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200
irq: clearing subpending status 00000007
irq: clearing subpending status 00000002
PID hash table entries: 128 (order: 7, 512 bytes)
timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 29224KB available (2780K code, 309K data, 132K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2410: Initialising architecture
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c2800000, irq 33
DMA channel 1 at c2800040, irq 34
DMA channel 2 at c2800080, irq 35
DMA channel 3 at c28000c0, irq 36
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: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) ?? 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach
s3c2410-lcd: probe of s3c2410-lcd failed with error -22
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: module loaded
dm9000 Ethernet Driver
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=1, 10ns Twrph0=4 40ns, Twrph1=1 10ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 32MiB 3,3V 8-bit":
0x00000000-0x00020000 : "loader"
0x00020000-0x00030000 : "param"
0x00030000-0x00200000 : "kernel"
0x00200000-0x00600000 : "root"
0x00600000-0x02000000 : "user"
usbmon: debugfs is not available
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
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-i2c s3c2410-i2c: slave address 0x10
s3c2410-i2c s3c2410-i2c: bus frequency set to 390 KHz
s3c2410-i2c s3c2410-i2c: i2c-0: S3C I2C adapter
TCP cubic registered
NET: Registered protocol family 1
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 132K
init started: BusyBox v1.6.1 (2007-08-04 22:24:34 CST) multi-call binary
starting pid 739, tty '': '/etc/init.d/rcS'
Cannot run '/etc/init.d/rcS': No such file or directory
starting pid 740, tty '': '/bin/sh'
Cannot run '/bin/sh': No such file or directory
process '-/bin/sh' (pid 740) exited. Scheduling it for restart.
starting pid 741, tty '': '/bin/sh'
Cannot run '/bin/sh': No such file or directory
process '-/bin/sh' (pid 741) exited. Scheduling it for restart.
starting pid 742, tty '': '/bin/sh'


终于有点进展了,可是新问题又出现了。重新配置busybox,发现是忘了把shell给选上了,选了ash,make install,


//
2440启动内核是出现
end_request: I/O error, dev mtdblock3, sector 912
Buffer I/O error on device mtdblock3, logical block 114
end_request: I/O error, dev mtdblock3, sector 912
Buffer I/O error on device mtdblock3, logical block 114
end_request: I/O error, dev mtdblock3, sector 920
Buffer I/O error on device mtdblock3, logical block 115
end_request: I/O error, dev mtdblock3, sector 920
Buffer I/O error on device mtdblock3, logical block 115
end_request: I/O error, dev mtdblock3, sector 912
Buffer I/O error on device mtdblock3, logical block 114
end_request: I/O error, dev mtdblock3, sector 920
Buffer I/O error on device mtdblock3, logical block 115
然后panic了
原因:
把drivers\mtd\nand\s3c2410.c中
chip->ecc.mode= NAND_ECC_SOFT
改成
chip->ecc.mode= NAND_ECC_NONE
///
Starting pid 18, console /dev/tts/0: '/bin/sh'
[2410]移植cramfs文件系统和busybox到linux2.6
2008-08-11 10:12

目前还没有成功,先把问题摆上了,挨个解决
首先是busybox的linuxrc文件的问题
按照教程上是编译完busybox后,用自己写的linxurc覆盖自动产生的这个文件
但是我的那些busybox命令好像都是链接(why?)到linuxrc的,如果替换成自己的lixnurc,全都不正确了
如果把生成的cramfs文件烧入nand中,会出现如下错误
VFS: Mounted root (cramfs filesystem) readonly.
Mounted devfs on /dev
Freeing init memory: 92K
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
但是如果不修改linuxrc文件,也会出现错误
VFS: Mounted root (cramfs filesystem) readonly.
Mounted devfs on /dev
Freeing init memory: 92K
Reading data from NAND FLASH without ECC is not recommended
init started: BusyBox v1.1.3 (2008.08.11-01:57+0000) multi-call binary
Starting pid 16, console /dev/tts/0: '/etc/init.d/rcS'
Bummer,
Please press Enter to activate this console.
Starting pid 18, console /dev/tts/0: '/bin/sh'
Bummer, could not run '/bin/sh': No such file or directory
Bummer, could not run '/bin/sh': No such file or directory
头大啊该怎么办呢?
顺带说下ubuntu默认没有装zlib,make cramfs时有问题,用新立得装一下吧
将mkcramfs文件拷贝到系统的usr/bin目录下就可以使用了
对my_rootfs目录使用命令mkcramfs my_rootfs my_rootfs.cramfs生成cramfs文件系统
烧入nand闪存的第三分区,即我设定的0x400000,linux运行时可找到文件系统
==================================================
解决的第二个错误,用busybox默认的linxurc文件可以正常启动
刚才不能启动的原因是没有将ash设为默认,故没有生成/bin/sh命令
1、要这样配置:
? │ │ ? ? ? ? ? ? ? Shells ?---> ? ?
│ ? ? ? Choose your default shell (ash) ?---> ? ? ?
2、如果是这样配置的话,虽然可以生成ash,但不能生成sh:
? │ │ ? ? ? Choose your default shell (none) ?---> ? ? ? ? ? ? ? ? ? ? ? ?│ │
? │ │ ? [*] ash ?
参考如上,可惜这样不是自己的linuxrc文件,继续寻找解决方法中
VFS: Mounted root (cramfs filesystem) readonly.
Mounted devfs on /dev
Freeing init memory: 92K
Reading data from NAND FLASH without ECC is not recommended
init started: BusyBox v1.1.3 (2008.08.11-02:20+0000) multi-call binary
Starting pid 16, console /dev/tts/0: '/etc/init.d/rcS'
Bummer,
Please press Enter to activate this console.
Starting pid 18, console /dev/tts/0: '/bin/sh'

BusyBox v1.1.3 (2008.08.11-02:20+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
#
# ls
binetclibmntrootsysusr
devhomelinuxrc procsbintmp
#
==================================================

ECC问题,如果不把
Device Drivers--->
Memory Technology Devices (MTD)--->
NAND Flash Device Drivers--->
[*]S3C2410 NAND Hardware ECC
去掉会出现如下的问题:
end_request: I/O error, dev mtdblock3, sector 2
EXT3-fs: unable to read superblock
end_request: I/O error, dev mtdblock3, sector 0
Buffer I/O error on device mtdblock3, logical block 0
end_request: I/O error, dev mtdblock3, sector 0
Buffer I/O error on device mtdblock3, logical block 0
end_request: I/O error, dev mtdblock3, sector 8
Buffer I/O error on device mtdblock3, logical block 1
end_request: I/O error, dev mtdblock3, sector 8
Buffer I/O error on device mtdblock3, logical block 1
end_request: I/O error, dev mtdblock3, sector 16
Buffer I/O error on device mtdblock3, logical block 2
end_request: I/O error, dev mtdblock3, sector 16
Buffer I/O error on device mtdblock3, logical block 2
end_request: I/O error, dev mtdblock3, sector 24
Buffer I/O error on device mtdblock3, logical block 3
end_request: I/O error, dev mtdblock3, sector 24
Buffer I/O error on device mtdblock3, logical block 3
end_request: I/O error, dev mtdblock3, sector 0
FAT: unable to read boot sector
VFS: Cannot open root device "mtdblock3" or unknown-block(31,3)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)
另外,还要在在/linux-2.6.14.1/drivers/mtd/nand/s3c_2410.c中将
chip->eccmode = NAND_ECC_SOFT 改为 chip->eccmode = NAND_ECC_NONE;

关于initrd及RamDisk的问题
在做2.6.14内核移植之前,我本来是想移植2.6.15的,但是出现了如是的一些问题:就是无法打开根文件系统,终端显示的信息如下:
VFS: Cannot open root device "mtdblock3" or unknown-block(31,3)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)
后来改成2.6.14,同样的配置,却不会出现如上的问题。但是在这个过程中我却对RamDisk有了较好的掌握,包括它也initrd的关系。
Ramdisk是用来挂载根文件系统而在内存中开辟的地块区域,如果你需要你的内核支持Ramdisk,那么你需要作以下的更改:
1). 首先,设置vivi的linux_cmd_line为:
param set linux_cmd_line"initrd=0x30800000,0x400000 root=/dev/ram0 init=/linuxrcconsole=ttySAC0max=00:0e:3a:aa:bb:cc"
如果你的bootloader不可以设置启动参数,也可以在
Boot options--->中的第三个选项中按回车进行设置。
我通过多次的测试,发现initrd=0x30800000,0x400000的作用就是在RAM中开辟一块始起地址为0x30800000,大小为4MB的Ramdisk.
2). 其次还要在配置内核的时候注意以下的选项:
Device Drivers--->
Block devices--->
<*> RAM disk support│ │
│ │(16)Default number of RAM disks (NEW)│ │
│ │(4096) Default RAM disk size (kbytes) (NEW)│ │
│ │[*]Initial RAM disk (initrd) support
这样内核就可以支持从Ramdisk启动了。其中4096KB要与上面设置的Ramdisk大小一致,这里为4MB。
编译内核之后,这样子启动:
net tftp 192.168.1.100 30008000 zImage
net tftp 192.168.1.100 30800000 root_china.cramfs
boot ram 30008000 0x12fee8
如果你不想用Ramdisk来挂载文件系统,直接从Flash中打开文件系统,那么在配置内核的时候,可以将RAMdisk support支持去掉。

Set boot params = root=1f02 init=/linuxrc console=ttyS0,115200 devfs=mount display=shp240
Uncompressing Linux.......................................................................................... done, booting the kernel.

2.6内核的console用的是console=ttySAC0,修改一下试试
/Reading data from NAND FLASH without ECC is not recommended
VFS: Mounted root (cramfs filesystem) readonly.
Mounted devfs on /dev
Freeing init memory: 92K
Failed to execute /linuxrc.Attempting defaults...
Kernel panic - not syncing: No init found.Try passing init= option to kernel.

移植了内核2.6.14.1
自己制作了文件系统cramfs,
#touch linuxrc
#chmod 777 linuxrc
#ls -al
-rwxrwxrwx1502 root533 08-10 10:56 linuxrc

启动却出现这种错误。请各位大侠帮忙分析一下 ,多谢!

【嵌入式|linux_内核移植方法及错误】

    推荐阅读