Linux2.6.24.4 移植到S3C2410(nano2410)

admin @ 2014-03-25 , reply:0

內核移植篇
CS8900 移植
建立nfs 根文件系統(busybox1.9.2)

【平台信息】
目標板(Nano2410)------------------------
CPU: S3C2410X
SDRAM: HY57V561620(32MB)
FLASH: K9F1208(64MB)
NET: CS8900
HOST---------------------------------------
Linux Realse Version: Fecora Cor 8 (FC8)
CrossCompiler: gcc-4.1.1/glibc-2.3.2

Linux2.6.24.4 移植到S3C2410(nano2410)之:內核移植篇
1. 解壓linux-2.6.24.4。
2. 編輯Makefile,修改目標cpu 體系結構和交叉編譯工具的路徑。
[kevin@localhost linux-2.6.24.4]$ vim Makefile
第193 行改為:
ARCH ?= arm
CROSS_COMPILE ?= /opt/tool/gcc-4.1.1-glibc-2.3.2/arm-9tdmi-
CROSS_COMPILE 根據自己所使用的交叉編譯器路徑設置。
3.複製編譯配置文件到linux-2.6.24.4 下面。移植過程以sdmk2410 開發板為模板。
[kevin@localhostlinux-2.6.24.4]$cp arch/arm/configs/s3c2410_defconfig .config
4.修改NandFlash 分區信息。
[kevin@localhostlinux-2.6.24.4]$vim arch/arm/plat-s3c24xx/common-smdk.c
第108 行smdk_default_nand_part[]修改如下:
static struct mtd_partition smdk_default_nand_part[] = {
#if 0
[0] = {
.name = "Boot Agent",
.size = SZ_16K,
.offset = 0,
},
[1] = {
.name = "S3C2410 flash partition 1",
.offset = 0,
.size = SZ_2M,
},
[2] = {
.name = "S3C2410 flash partition 2",
.offset = SZ_4M,
.size = SZ_4M,
},
[3] = {
.name = "S3C2410 flash partition 3",
.offset = SZ_8M,
.size = SZ_2M,
},
[4] = {
.name = "S3C2410 flash partition 4",
.offset = SZ_1M * 10,
.size = SZ_4M,
},
[5] = {
.name = "S3C2410 flash partition 5",
.offset = SZ_1M * 14,
.size = SZ_1M * 10,
},
[6] = {
.name = "S3C2410 flash partition 6",
.offset = SZ_1M * 24,
.size = SZ_1M * 24,
},
[7] = {
.name = "S3C2410 flash partition 7",
.offset = SZ_1M * 48,
.size = SZ_16M,
}
#else
[0] = {
.name = "U-Boot",
.size = SZ_1M,
.offset = 0,
},
[1] = {
.name = "Linux Kernel",
.offset = SZ_1M,
.size = SZ_3M,
},
[2] = {
.name = "Root",
.offset = SZ_4M,
.size = SZ_4M * 10,
},
[3] = {
.name = "User",
.offset = SZ_4M * 11,
.size = SZ_4M * 5,
},
#endif
};
5.為了我們的內核支持devfs 以及在啟動時並在/sbin/init 運行之前能自動掛載/dev 為devfs 文件系統。編輯fs/Kconfig:
在902 行menu "Pseudo filesystems"下面添加如下代碼:
#+kevin -->
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
#+kevin <--
6.OK,現在先編譯一下內核。下載到目標板看看內核能否啟動。
[kevin@localhost linux-2.6.24.4]$ make menuconfig
在配置菜單中,選擇system type-->s3c2410 machines 中的smdk2410
其他的arch-machines 全部取消。
[kevin@localhost linux-2.6.24.4]$ make zImage
編譯完成後在arch/arm/boot 下會有一個zImage
[kevin@localhost linux-2.6.24.4]$ cd arch/arm/boot
[kevin@localhost boot]$ ls
bootp compressed Image install.sh Makefile zImage
因為使用的bootloader 是UBoot,下面需要把zImga 轉換成Uboot 可以使用的uImage.
將Uboot 編譯後生成的tools/mkImage 文件copy 到/bin 下面。然後允許下面的命令
mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008040 - n "linux kernel" -d zImage
uImage
我將該命令寫在一個腳本文件mk.sh 中了。執行該命令后在boot 目錄會多出一個uImage 文件
[kevin@localhost boot]$ sh mk.sh
Image Name: linux kernel
Created: Sat Mar 29 16:50:21 2008
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1545360 Bytes = 1509.14 kB = 1.47 MB
Load Address: 0x30008000
Entry Point: 0x30008040
通過uboot 把uImage 載入到SDRAM 的0x30008000 處,並執行bootm。會看到以下啟動信息。
Kevin2410 > run lk
TFTP from server 192.168.0.102; our IP address is 192.168.0.69
Filename 'uImage'.
Load address: 0x30008000
Loading: #################################################################
#########################################
done
Bytes transferred = 1545424 (1794d0 hex)
## Booting image at 30008000 ...
Image Name: linux kernel
Created: 2008-03-29 8:50:21 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1545360 Bytes = 1.5 MB
Load Address: 30008000
Entry Point: 30008040
Verifying Checksum ... OK
XIP Kernel Image ... OK
Starting kernel ...
Uncompressing Linux.................................................................................................... done,
booting the kernel.
Linux version 2.6.24.4 (kevin@localhost.localdomain) (gcc version 4.1.1) #1 Sat Mar 29
16:42:31 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 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 in Zone order, mobility grouping on. Total pages: 8128
Kernel command line: console=ttySAC0,115200 root=/dev/nfs init=/linuxrc
nfsroot=192.168.0.104:/nano2410/root
ip=192.168.0.69:192.168.0.104:192.168.0.1:255.255.255.0:www.kevin.com:eth0:off
【Uboot
中設置的command line 參數】
irq: clearing pending ext status 00000200
irq: clearing subpending status 00000002
PID hash table entries: 128 (order: 7, 512 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 29188KB available (2840K code, 296K data, 116K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 64 bytes
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
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
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00100000 : "U-Boot"
0x00100000-0x00400000 : "Linux Kernel"
0x00400000-0x02c00000 : "Root"
0x02c00000-0x04000000 : "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 99 KHz
s3c2410-i2c s3c2410-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
IP-Config: Device `eth0' not found.【網卡驅動NG】
Looking up port of RPC 100003/2 on 192.168.0.104
rpcbind: server 192.168.0.104 not responding, timed out
Root-NFS: Unable to get nfsd port number from server, using default
Looking up port of RPC 100005/1 on 192.168.0.104
rpcbind: server 192.168.0.104 not responding, timed out
Root-NFS: Unable to get mountd port number from server, using default
mount: server 192.168.0.104 not responding, timed out
Root-NFS: Server returned error -5 while mounting /nano2410/root
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00 1024 mtdblock0 (driver?)
1f01 3072 mtdblock1 (driver?)
1f02 40960 mtdblock2 (driver?)
1f03 20480 mtdblock3 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
----------------------------------------------------------------------
從以上信息中可以看到,網卡驅動載入失敗。目標板使用的是CS8900,內核中沒有該網卡ic 的驅動,
下一步的工作:移植CS8900 驅動。



[admin via 研發互助社區 ] Linux2.6.24.4 移植到S3C2410(nano2410)已經有2232次圍觀

http://cocdig.com/docs/show-post-42111.html