在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!) 创芯人才网--重磅上线啦!
查看: 7929|回复: 7

linux内核移植过程

[复制链接]
发表于 2007-5-13 11:45:24 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
一.下载核心以及相应补丁:

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

#
发表于 2007-5-13 12:34:37 | 显示全部楼层
不错。讲得很详细。谢谢!
发表于 2007-5-13 20:51:44 | 显示全部楼层
讲得很好,楼主想必在这方面有很多的经验,希望楼主能分享更多的好东西
发表于 2008-2-29 14:43:30 | 显示全部楼层
不错,谢谢了
发表于 2008-3-8 18:14:56 | 显示全部楼层
很好,顶一下^○^
发表于 2008-3-12 22:02:44 | 显示全部楼层
啊啊啊啊啊
发表于 2008-3-13 17:28:38 | 显示全部楼层
发表于 2008-4-10 16:13:44 | 显示全部楼层
谢谢了,辛苦了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条


小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-1-10 14:29 , Processed in 0.020732 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表