Linux2.4.18核心移植到s3c2410全过程(转)[@more@]一.下载核心以及相应补丁:
Linux核心:linux-2.4.18.tar.bz2
补丁:
patch-2.4.18-rmk7.gz
patch-2.4.18-rmk7-swl8.gz
patch-2.4.18-rmk7-swl8-cy2.gz
patch-2.4.18-rmk7-swl8-cy2-lc3.gz
二. 解压缩:
# tar xzvf linux-2.4.18.tar.gz
# gunzip patch-2.4.18-rmk7.gz
# gunzip patch-2.4.18-rmk7-swl8.gz
# gunzip patch-2.4.18-rmk7-swl8-cy2.gz
# gunzip patch-2.4.18-rmk7-swl8-cy2-lc3.gz
三. 打补丁:
# cd linux-2.4.18
# patch -p1 < .. patch-2.4.18-rmk7
# patch -p1 < .. patch-2.4.18-rmk7-swl8
# patch -p1 < .. patch-2.4.18-rmk7-swl8-cy2
# patch -p1 < .. patch-2.4.18-rmk7-swl8-cy2-lc3
四. 修改相关代码:
(1)修改主目录的Makefile
vi linux/Makefiel
a.指定目标平台为ARM:
#ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
ARCH := arm
b.指定交叉编译器:
CROSS_COMPILE = /usr/local/arm/2.95.3/bin/arm-linux-
(我的交叉编译工具放在/usr/local/arm文件夹下)
(2)修改arch目录中的文件
Linux的arch目录存放硬件相关的内核代码,因此,在Linux内核中增加对S3C2410的支持,最主要就是要修改arch目录中的文件。
在arch/arm/Makefile文件中加入:
ifeq ($(CONFIG_ARCH_S3C2410),y)
TEXTADDR = 0xC0008000
MACHINE = s3c2410
Endif
(3) 在arch/arm/boot/Makefile文件中加入:
ifeq ($(CONFIG_ARCH_S3C2410),y)
ZTEXTADDR = 0x30008000
ZRELADDR = 0x30008000
endif
(4) 修改arch/arm/mm/mm-armv.c文件(arch/arm/mm/目录中的文件完成与ARM相关的MMU处理):
修改:
init_maps->bufferable = 0;
为:
init_maps->bufferable = 1;
五.编译内核:
make menuconfig
一定要选上 :FILE_SYSTEM
CONFIG_DEVFS_FS=y
修改启动命令行:
CONFIG_CMDLINE="root=/dev/mtdblock2 init=/linuxrc console=ttyS0,115200 devfs=mount load_ramdisk=0"
Make dep
Make zImage
运行结果:(成功)
Uncompressing Linux..................................................... done, booting the kernel.
Linux version 2.4.18-rmk7-swl8 ( root@localhost.localdomain) (gcc version 2.95.3 20010315 (release)) #1 三 9月 6 15:05:59 CST 2006
CPU: SAMSUNG S3C2410(Arm920T)sid(wb) revision 0
Machine: CyberLab LN2410
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock2 load_ramdisk=0 init=/linuxrc console=ttyS0 mem=64M devfs=mount
Console: colour dummy device 80x30
Calibrating delay loop... 96.05 BogoMIPS
Memory: 64MB = 64MB total
Memory: 62668KB available (1402K code, 328K data, 68K init)
Dentry-cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode-cache hash table entries: 4096 (order: 3, 32768 bytes)
Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes)
Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
devfs: v1.10 (20020120) Richard Gooch ( rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS version 1.0, (C) 1999, 2000 Axis Communications AB
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
l3 S3C2410 Adapter Initialized
ttyS00 at MEM 0xe0000000 (irq = 52) is a S3C2410
ttyS01 at MEM 0xe0004000 (irq = 55) is a S3C2410
screen_cpu:c480e000 ,screen_dma:33f01000
Console: switching to colour frame buffer device 80x30
Installed LN2410X TFT 16bpp frame buffer
by redizi, CyberLab 2003
pty: 256 Unix98 ptys configured
Loading S3C2410 Touch Screen Driver
Installing S3C2410 RTC
S3C Real Time Clock driver v1.00
block: 128 slots per queue, batch=32
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
eth0: incorrect signature 0x4000
cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP
loop: loaded (max 8 devices)
S3C2410 UDA1341 / IIS initialized
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Creating 5 MTD partitions on "Samsung K9D1208V0M":
0x00000000-0x00030000 : "boot"
0x00030000-0x00200000 : "kernel"
0x00200000-0x02000000 : "rootfs"
0x02000000-0x03000000 : "ext-fs1"
0x03000000-0x04000000 : "ext-fs2"
usb.c: registered new driver hub
usb-ohci.c: USB OHCI at membase 0xd9000000, IRQ 26
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
mice: PS/2 mouse device common for all mice
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 4096)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NetWinder Floating Point Emulator V0.95 (c) 1998-1999 Rebel.com
VFS: Mounted root (cramfs filesystem).
Mounted devfs on /dev
Freeing init memory: 68K
console=/dev/console
init started: BusyBox v0.60.3 (2002.05.13-08:36+0000) multi-call binary
Starting pid 16, console /dev/console: '/etc/init.d/rcS'
exec: /usr/etc/rc.local: No such file or directory
Waiting for enter to start '/bin/sh' (pid 19, terminal /dev/console)
Please press Enter to activate this console.
Starting pid 19, console /dev/console: '/bin/sh'
BusyBox v0.60.3 (2002.05.13-08:36+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ls
bin etc linuette mnt qt tmp var
dev lib linuxrc proc sbin usr
#
Linux核心:linux-2.4.18.tar.bz2
补丁:
patch-2.4.18-rmk7.gz
patch-2.4.18-rmk7-swl8.gz
patch-2.4.18-rmk7-swl8-cy2.gz
patch-2.4.18-rmk7-swl8-cy2-lc3.gz
二. 解压缩:
# tar xzvf linux-2.4.18.tar.gz
# gunzip patch-2.4.18-rmk7.gz
# gunzip patch-2.4.18-rmk7-swl8.gz
# gunzip patch-2.4.18-rmk7-swl8-cy2.gz
# gunzip patch-2.4.18-rmk7-swl8-cy2-lc3.gz
三. 打补丁:
# cd linux-2.4.18
# patch -p1 < .. patch-2.4.18-rmk7
# patch -p1 < .. patch-2.4.18-rmk7-swl8
# patch -p1 < .. patch-2.4.18-rmk7-swl8-cy2
# patch -p1 < .. patch-2.4.18-rmk7-swl8-cy2-lc3
四. 修改相关代码:
(1)修改主目录的Makefile
vi linux/Makefiel
a.指定目标平台为ARM:
#ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
ARCH := arm
b.指定交叉编译器:
CROSS_COMPILE = /usr/local/arm/2.95.3/bin/arm-linux-
(我的交叉编译工具放在/usr/local/arm文件夹下)
(2)修改arch目录中的文件
Linux的arch目录存放硬件相关的内核代码,因此,在Linux内核中增加对S3C2410的支持,最主要就是要修改arch目录中的文件。
在arch/arm/Makefile文件中加入:
ifeq ($(CONFIG_ARCH_S3C2410),y)
TEXTADDR = 0xC0008000
MACHINE = s3c2410
Endif
(3) 在arch/arm/boot/Makefile文件中加入:
ifeq ($(CONFIG_ARCH_S3C2410),y)
ZTEXTADDR = 0x30008000
ZRELADDR = 0x30008000
endif
(4) 修改arch/arm/mm/mm-armv.c文件(arch/arm/mm/目录中的文件完成与ARM相关的MMU处理):
修改:
init_maps->bufferable = 0;
为:
init_maps->bufferable = 1;
五.编译内核:
make menuconfig
一定要选上 :FILE_SYSTEM
CONFIG_DEVFS_FS=y
修改启动命令行:
CONFIG_CMDLINE="root=/dev/mtdblock2 init=/linuxrc console=ttyS0,115200 devfs=mount load_ramdisk=0"
Make dep
Make zImage
运行结果:(成功)
Uncompressing Linux..................................................... done, booting the kernel.
Linux version 2.4.18-rmk7-swl8 ( root@localhost.localdomain) (gcc version 2.95.3 20010315 (release)) #1 三 9月 6 15:05:59 CST 2006
CPU: SAMSUNG S3C2410(Arm920T)sid(wb) revision 0
Machine: CyberLab LN2410
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock2 load_ramdisk=0 init=/linuxrc console=ttyS0 mem=64M devfs=mount
Console: colour dummy device 80x30
Calibrating delay loop... 96.05 BogoMIPS
Memory: 64MB = 64MB total
Memory: 62668KB available (1402K code, 328K data, 68K init)
Dentry-cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode-cache hash table entries: 4096 (order: 3, 32768 bytes)
Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes)
Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
devfs: v1.10 (20020120) Richard Gooch ( rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS version 1.0, (C) 1999, 2000 Axis Communications AB
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
l3 S3C2410 Adapter Initialized
ttyS00 at MEM 0xe0000000 (irq = 52) is a S3C2410
ttyS01 at MEM 0xe0004000 (irq = 55) is a S3C2410
screen_cpu:c480e000 ,screen_dma:33f01000
Console: switching to colour frame buffer device 80x30
Installed LN2410X TFT 16bpp frame buffer
by redizi, CyberLab 2003
pty: 256 Unix98 ptys configured
Loading S3C2410 Touch Screen Driver
Installing S3C2410 RTC
S3C Real Time Clock driver v1.00
block: 128 slots per queue, batch=32
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
eth0: incorrect signature 0x4000
cs89x0: no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP
loop: loaded (max 8 devices)
S3C2410 UDA1341 / IIS initialized
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Creating 5 MTD partitions on "Samsung K9D1208V0M":
0x00000000-0x00030000 : "boot"
0x00030000-0x00200000 : "kernel"
0x00200000-0x02000000 : "rootfs"
0x02000000-0x03000000 : "ext-fs1"
0x03000000-0x04000000 : "ext-fs2"
usb.c: registered new driver hub
usb-ohci.c: USB OHCI at membase 0xd9000000, IRQ 26
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
mice: PS/2 mouse device common for all mice
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 4096)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NetWinder Floating Point Emulator V0.95 (c) 1998-1999 Rebel.com
VFS: Mounted root (cramfs filesystem).
Mounted devfs on /dev
Freeing init memory: 68K
console=/dev/console
init started: BusyBox v0.60.3 (2002.05.13-08:36+0000) multi-call binary
Starting pid 16, console /dev/console: '/etc/init.d/rcS'
exec: /usr/etc/rc.local: No such file or directory
Waiting for enter to start '/bin/sh' (pid 19, terminal /dev/console)
Please press Enter to activate this console.
Starting pid 19, console /dev/console: '/bin/sh'
BusyBox v0.60.3 (2002.05.13-08:36+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ls
bin etc linuette mnt qt tmp var
dev lib linuxrc proc sbin usr
#
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10617731/viewspace-961464/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10617731/viewspace-961464/