Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4611822
  • 博文数量: 385
  • 博客积分: 21208
  • 博客等级: 上将
  • 技术积分: 4393
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-30 13:40
文章分类

全部博文(385)

文章存档

2015年(1)

2014年(3)

2012年(16)

2011年(42)

2010年(1)

2009年(2)

2008年(34)

2007年(188)

2006年(110)

分类: LINUX

2006-12-19 15:38:28

本次port  linux2.6.11.7 的过程:参考了嵌入式高手superlp的经验:

1:download kernel


decompress and no patch is needed

b>install the gcc compiler
ftp://ftp.handhelds.org/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2


2 modify kernel source

a>add your nand flash partition information
modify the arch/arm/mach-s3c2410/devs.c file
for example:

/***********add here*************/
#include
#include
#include
/***********end add*************/


//hujun add  start
static struct mtd_partition partition_info[] ={
{
    name: "loader",
    size: 0x00020000,
    offset: 0,
},

{
    name: "param",
    size: 0x00010000,
    offset: 0x00020000,
},
{
    name: "kernel",
    size: 0x001c0000,
    offset: 0x00030000,
},    
{
    name: "root",
    size:   0x00400000,
    offset: 0x00200000,
    mask_flags: MTD_WRITEABLE,
},
{
    name: "user",
    size:   0x03a00000,
    offset: 0x00600000,
}
};

struct s3c2410_nand_set nandset ={
nr_partitions: 5 ,
partitions: partition_info ,
};

struct s3c2410_platform_nand  hujunPlatform={
tacls:0,
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};

//hujun add end

struct platform_device s3c_device_nand = {
    .name          = "s3c2410-nand",
    .id          = -1,
    .num_resources      = ARRAY_SIZE(s3c_nand_resource),
    .resource      = s3c_nand_resource,
//hujun add start
         .dev={
     .platform_data = &hujunPlatform        //注意此处不要","号  **********add here*****
//hujun add  end
};

EXPORT_SYMBOL(s3c_device_nand);  //此句原来就有,此处列出是要求上面加的代码在此句之前。


b>add "&s3c_device_nand" to the __initdata in the arch/arm/mach-s3c2410/mach-smdk2410.c
 
static struct platform_device *smdk2410_devices[] __initdata = {
    &s3c_device_usb,
    &s3c_device_lcd,
    &s3c_device_wdt,
    &s3c_device_i2c,
    &s3c_device_iis,

        &s3c_device_nand,     //hujun add         //在这里加,注意有逗号
};
注意别加错了地方, 刚开始我加在
static struct map_desc smdk2410_iodesc[] __initdata = {
  /* nothing here yet */
//hujun add start
 &s3c_device_nand          
//hujun add end
};
结果内核启动时没有发现mtd分区信息。  具体原因待查。


c>disable the ecc


modify the drivers/mtd/nand/s3c2410.c
for example:
/**** chip->eccmode = NAND_ECC_SOFT; **/
chip->eccmode = NAND_ECC_NONE;

3 config the kernel


a>modify the MakeFile

for example:

##SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
## -e s/arm.*/arm/ -e s/sa110/arm/ \
## -e s/s390x/s390/ -e s/parisc64/parisc/ )


SUBARCH :=arm

##CROSS_COMPILE ?=
CROSS_COMPILE ?=/usr/local/arm/3.4.1/bin/arm-linux-



b>make menuconfig....
 the config file  is       
文件:config.tar.bz2
大小:4KB
下载:下载
                                                                              
 说明: 我在kernel配置中没有使用cmd line  ,是在vivi 中
vivi>param set linux_cmd_line "noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0"
param save
load flash kernel  t

boot

上面改动的文件一起保存如下
 
文件:upTo2.6Files.tar.bz2
大小:16KB
下载:下载
 
启动信息记录:

                                                                          
                                                                                            
MC2410E DEVELOP KIT
                                                                                            
VIVI version 0.1.4 (root@Rhvd) (gcc version 2.95.2 20000516 (release) [Rebel.com]) #0.1.4 Th6MMU table base address = 0x33DFC000
Succeed memory mapping.
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Found saved vivi parameters.
CS8900 - type: 630e, rev: a00
CS8900 - status: ad6 (EEPROM present)
Setting MAC address...
Display format changed to VGA 640X480 mode
Press Return to start the LINUX now, any other key for vivi
type "help" for help.
vivi> param set linux_cmd_line "noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0"Change linux command line to "noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0"
vivi> param save
Found block size = 0x00010000
Erasing...    ... done
Writing...    ... done
Written 65536 bytes
Saved vivi private data
vivi> load flash kernel t
Found block size = 0x001c0000
Erasing...    ... done
Ready for downloading using tftp...
Waiting...
Setting MAC address...
Type "tftp -i 59.69.75.186  PUT {input-filename}" on the host PC
Press ESC key to exit
Starting the TFTP download...
...................................
Received 11ff58 Bytes, END...
Download end
Downloaded file at 0x30000000, size = 1179480 bytes
Found block size = 0x00120000
Erasing...    ... done
Writing...    ... done
Written 1179480 bytes
vivi> boot
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x001c0000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0"
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux..........................................................................Linux version 2.6.11.7 (root@hujunlinux) (gcc version 3.4.1) #4 Tue Dec 19 13:34:53 EST 2006
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
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
Machine: SMDK2410
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
BUG: mapping for 0x00000000 at 0xc021293c overlaps vmalloc space
S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
S3C2410 Clock control, (c) 2004 Simtec Electronics
Built 1 zonelists
Kernel command line: noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0
irq: clearing pending ext status 00000800
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64MB = 64MB total
Memory: 62336KB available (1982K code, 424K data, 88K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410: Initialising architecture
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
NetWinder Floating Point Emulator V0.97 (double precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS version 1.0, (C) 1999, 2000  Axis Communications AB
JFFS2 version 2.2. (C) 2001-2003 Red Hat, Inc.
S3C2410 RTC, (c) 2004 Simtec Electronics
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing enabled
s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
devfs_mk_dev: could not append to parent for tts/0
s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
devfs_mk_dev: could not append to parent for tts/1
s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
devfs_mk_dev: could not append to parent for tts/2
io scheduler noop registered
loop: loaded (max 8 devices)
nbd: registered device at major 43
Linux video capture interface: v1.00
V4L-Driver for Vision CPiA based cameras v1.2.3
Since in-kernel colorspace conversion is not allowed, it is disabled by default now. Users s$INFTL: inftlcore.c $Revision: 1.18 $, inftlmount.c $Revision: 1.16 $
S3C2410 NAND Driver, (c) 2004 Simtec Electronics
NAND device: Manufacturer ID: 0x98, Chip ID: 0x39 (Toshiba NAND 8MiB 1,8V 8-bit)
flash size: 8 MiB
page size: 512 bytes
OOB area size: 16 bytes
sector size: 8 KiB
pages number: 16384
pages per sector: 16
bus width: 8
bits in sector size: 13
bits in page size: 9
bits in OOB size: 4
flash size with OOB: 8448 KiB
page address bytes: 3
sector address bytes: 2
options: 0x62
Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 8MiB 1,8V 8-bit":
0x00000000-0x00800000 : "NAND simulator partition"
ftl_cs: FTL header not found.
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usbcore: registered new driver ov511
drivers/usb/media/ov511.c: v1.64 for Linux 2.5 : ov511 USB Camera Driver
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
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)



一定要注意启动信息, 因为我们烧写的是内核, 内核是否能跑起来,从启动信息可以找到问题出在哪里,
其实这跟调试程序是一个道理。



                                                                        
                                                                                            
MC2410E DEVELOP KIT
                                                                                            
VIVI version 0.1.4 (root@Rhvd) (gcc version 2.95.2 20000516 (release) [Rebel.com]) #0.1.4 Th6MMU table base address = 0x33DFC000
Succeed memory mapping.
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Found saved vivi parameters.
CS8900 - type: 630e, rev: a00
CS8900 - status: ad6 (EEPROM present)
Setting MAC address...
Display format changed to VGA 640X480 mode
Press Return to start the LINUX now, any other key for vivi
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x001c0000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0"
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux................................................................... done,.Linux version 2.6.11.7 (root@hujunlinux) (gcc version 3.4.1) #7 Tue Dec 19 14:09:18 EST 2006
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
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
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 Clock control, (c) 2004 Simtec Electronics
Built 1 zonelists
Kernel command line: noinitrd root=/dev/mtdblock/3  init=/linuxrc console=ttySAC0
irq: clearing pending ext status 00000800
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64MB = 64MB total
Memory: 62592KB available (1692K code, 417K data, 84K init)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2410: Initialising architecture
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
NetWinder Floating Point Emulator V0.97 (double precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: devfs_debug: 0x0
devfs: boot_options: 0x1
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
io scheduler noop registered
loop: loaded (max 8 devices)
nbd: registered device at major 43
NFTL driver: nftlcore.c $Revision: 1.97 $, nftlmount.c $Revision: 1.40 $
S3C2410 NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand: mapped registers at c4880000
s3c2410-nand: timing: Tacls 10ns, Twrph0 40ns, Twrph1 10ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Bad eraseblock 385 at 0x00604000
Bad eraseblock 386 at 0x00608000
。。。。。
Bad eraseblock 413 at 0x00674000
Bad eraseblock 414 at 0x00678000
Bad eraseblock 415 at 0x0067c000
Bad eraseblock 416 at 0x00680000
Bad eraseblock 417 at 0x00684000
Bad eraseblock 418 at 0x00688000
Bad eraseblock 419 at 0x0068c000
Bad eraseblock 420 at 0x00690000
Bad eraseblock 421 at 0x00694000
Bad eraseblock 422 at 0x00698000

Bad eraseblock 1038 at 0x01038000           //很多很多,晕啊
。。。。。

Bad eraseblock 1635 at 0x0198c000
Bad eraseblock 1636 at 0x01990000
Creating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00020000 : "loader"
0x00020000-0x00030000 : "param"
0x00030000-0x001f0000 : "kernel"
0x00200000-0x00600000 : "root"
0x00600000-0x04000000 : "user"
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
NET: Registered protocol family 1
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
Reading data from NAND FLASH without ECC is not recommended
VFS: Mounted root (cramfs filesystem) readonly.
Mounted devfs on /dev
Freeing init memory: 84K
mount /etc  as ramfs
No module found in object
insmod: cannot insert `/lib/yaffs.o': Invalid module format (-1): Exec format error
mount: Mounting /dev/mtdblock/4 on /usr failed: No such device
begin to run rcS
mount: /dev/mtdblock/3 is write-protected, mounting read-only
SIOCSIFADDR: No such device
SIOCSIFNETMASK: No such device
SIOCGIFFLAGS: No such device
route: SIOC[ADD|DEL]RT: Network is unreachable
mount: RPC: Unable to send; errno = Network is unreachable
mount: nfsmount failed: Bad file descriptor
mount: Mounting 59.69.74.87:/public on /tmp failed: Bad file descriptor
                                                                                            
Please press Enter to activate this console.
                                                                                            
                                                                                            
BusyBox v1.2.1 (2006.12.18-02:49+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
                                                                                            
-sh: can't access tty; job control turned off
begin to run /etc/profile .
Set search library path in /etc/profile
[@hjembed /]#





                                                                                             

                    
阅读(4582) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-03-25 17:31:25

大大 可以把config.tar寄給我嗎?thanks!!

chinaunix网友2009-03-25 17:31:25

大大 可以把config.tar寄給我嗎?thanks!!