说明:gcc 4.3.3 TQ制作的编译工具
linux2.6.30.4源码: tar.bz2
主机:ubuntu10.10
开发板:TQ2440 256MB 2009年版 东华LCD-3.5寸
uboot:u-boot_W35_20091031.bin
文件系统:root_qtopia_2.2.0_2.6.30.4_256MB_20100601.bin
内核文件:通过源码自己建立
参考资料:天嵌科技出品-Linux移植之Step By Step_V4.0_20091028.pdf step1~step9
天嵌科技出品-Linux移植之Step By Step_V4.5_20100605.pdf 内核配置单
http://blog.chinaunix.net/space.php?uid=22666248&do=blog&id=1953621.在linux2.6.30.4 内核中,有关s3c2440的头文件
- arch/arm/mach-s3c2410/include/
-
arch/arm/plat-s3c/include/
-
arch/arm/plat-s3c24xx/include
2.解压源码
- #tar jxfv linux-2.6.30.4.tar.bz2 -C /opt/me_linux/
- 注意是root权限 -C 表示 改变目录
3.添加ARM 支持,在内核源码下
- #cd linux-2.6.30.4
- #vim Makefile
- 在193 行
- ARCH ?=(SUBARCH) 修改为 ARCH =arm
- CROSS_COMPILE?= CROSS_COMPILE=arm-linux-
4.修改平台输入时钟,以满足TQ2440的工作频率12000000,
- #vim arch/arm/mach-s3c2440/mach-smdk2440.c
- //set nu
- //:/1693440 查找
- //修改 1693440 为12000000
5.修改机器码
在TQ2440使用的机器码是168,这里需要修改机器码,否则会出现不能启动的情况。机器码保存在内核源码的“arch/arm/tools/mach-types”文件中,在大概379行,把原来的362 改为168即可。
为什么要给379 这行呢?因为:在内核的“arm/arm/mach-s3c2440/mach-smdk2440.c”文件
“MACHINE_START(S3C2440,"SMDK2440")”这行中的S3C2440,这个就是关键了。
在TQ自己制作的内核中,arm/arm/mach-s3c2440/mach-smdk2440.c 显示的是MACHINE_START(S3C2440,"TQ2440")
6.把镜像存放到指定位置
- #vim arch/arm/boot/Makefile
- $(obj)/zImage:$(obj)/compressed/vmlinux FORCE
- $(call if_changed,objcopy)
- @cp -f arch/arm/boot/zImage zImage.bin 这行是添加的
- @ECHO 'Kernel:$@ is ready'
## 在 vim 中,使用 :/ 或者 :? 来查找指定的字符串,n 表示继续上一次查询
- 修改同文件下
-type -f print| xargs rm -f rm -f zImage.bin
7.nand flash 移植
修改内核源码下的“arch/arm/plat-s3c2400/common-smdk.c”
- static struct mtd_partition smdk_default_nand_part[] = {
-
#if defined (CONFIG_256MB_NAND)
-
[0] = {
-
.name = "ywx-uboot",
-
.size = 0x00040000, ##256KB
-
.offset = 0x0,
-
},
-
[1] = {
-
.name = "ywx-kernel",
-
.offset = 0x00200000,
-
.size = 0x00200000, ##2MB
-
},
-
[2] = {
-
.name = "ywx-yaffs2",
-
.offset = 0x00400000,
-
.size = 0x0fb80000, ##251.5MB
-
}
-
#endif
-
};
修改 nand flash 的读写匹配时间,修改 commmon-smdk.c的文件大概140 行的
smdk_nand_info 结构体
- static struct s3c2410_platform_nand smdk_nand_info = {
-
.tacls = 10,
-
.twrph0 = 25,
-
.twrph1 = 10,
-
.nr_sets = ARRAY_SIZE(smdk_nand_sets),
-
.sets = smdk_nand_sets,
-
};
修改内核源码 “drivers/mtd/nand/Kconfig”,添加 nand flash
- config MTD_NAND_S3C2410_HWECC
-
bool "S3C2410 NAND Hardware ECC"
-
depends on MTD_NAND_S3C2410
-
help
-
Enable the use of the S3C2410's internal ECC generator when
-
using NAND. Early versions of the chip have had problems with
-
incorrect ECC generation, and if using these, the default of
-
software ECC is preferable.
-
#################
-
-
choice
-
prompt "nand capacity select"
-
depends on MTD
-
help
-
nand capacity select
-
-
config 256MB_NAND
-
boolean "256MB nand for tq-board"
-
depends on MTD
-
help
-
set 256MB nand parts
-
endchoice
-
-
#################
-
-
config MTD_NAND_NDFC
-
tristate "NDFC NanD Flash Controller"
-
depends on 4xx
-
select MTD_NAND_ECC_SMC
-
help
-
NDFC Nand Flash Controllers are integrated in IBM/AMCC's 4xx SoCs
8.移植yaffs2文件系统
yaffs2下载
得到补丁后,解压补丁,然后打上 yaffs2的补丁
- #tar zxfz cvs-root.tar.gz
-
#cd cvs/yaffs2/
-
./patch-ker.sh c /opt/me_linux/linux-2.6.30.4/
9.保存配置单
默认的s3c2410 配置单
- arch/arm/configs/s3c2410_defconfig
10.修改配置单
10.1 添加自己的信息
- general setup->
- [-EmbedSky]local version.......
- 这里,如果修改为 yuweixian 会出错,出错在下面介绍
10.2 支持 EABI gcc是4.3.3 需要EABI
- kernel->features
- [*]use the EABI to compile
-
[*]allow old eabi binailes
10.3 nand flash 支持
- device features->
-
nand device support ->
-
nand flash support s3c2410/2440 soc
- [*]s3c2410 nand hardware ecc 选上,由于tq板上是256MB nand,
- ecc:error checking code 错误检查纠正
10.4板子支持
- system type ->
- s3c2440 machines->
- [] SMDK2440 只选择这个
10.5 boot 选项
可能根据个人板子的设置会不一样,TQ2440是从Nand Flash中加载文件系统,其中mtdblock2是存放Linux文件系统的分区。
- noinitrd root=/dev/mtdblock2 init=/linuxrc/ console=ttySAC0
10.6 real time clock
- device drivers->
-
< >real time clock 这个去掉
10.7 yaffs2文件系统支持
- File systems----->
-
Miscellaneous filesystems --->
-
<*>YAFFS2 file system support
11 出错信息
- <3>uncorrectable error : <3>uncorrectable error : <3>uncorrectable error : <3>uncorrectable error : <3>input_polldev: version magic '2.6.30.4-EmbedSky mod_unload ARMv4 ' should be '2.6.30.4-yuweixian mod_unload ARMv4 '
-
insmod: can't insert '/lib/input-polldev.ko': invalid module format
-
mac80211: version magic '2.6.30.4-EmbedSky mod_unload ARMv4 ' should be '2.6.30.4-yuweixian mod_unload ARMv4 '
-
uncorrectable error : <3>uncorrectable error : <3>uncorrectable error : <3>uncorrectable error : insmod: can't insert '/lib/mac80211.ko': invalid module format
-
<3>rt2x00lib: version magic '2.6.30.4-EmbedSky mod_unload ARMv4 ' should be '2.6.30.4-yuweixian mod_unload ARMv4 '
-
-
-
这里出错:general setup-> 添加自己的信息
-
-
(-yuweixian)local version -append to kernel release 出错了
-
-
可能在uboot中 指定了 EmbedSky 了,不能添加自己的信息了。
12.最后 make zImage 下载板子,实验
- 说明:使用默认的 s3c2410_defconfig
-
只 修改了 板子 cpu 部分
-
-
-
-
##### EmbedSky BIOS for SKY2440/TQ2440 #####
-
Press Space key to Download Mode !
-
Booting Linux ...
-
Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00200000 ...
-
-
Copy Kernel to SDRAM done,NOW, Booting Linux......
-
Uncompressing
-
-
Linux....................................................................
-
-
....................................... done, booting the kernel.
-
Linux version 2.6.30.4-EmbedSky (root@ywx) (gcc version 4.3.3 (Sourcery
-
-
G++ Lite 2009q1-176) ) #7 Tue Mar 29 11:54:12 CST 2011
-
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
-
CPU: VIVT data cache, VIVT instruction cache
-
Machine: SMDK2440
-
ATAG_INITRD is deprecated; please update your bootloader.
-
Memory policy: ECC disabled, Data cache writeback
-
CPU S3C2440A (id 0x32440001)
-
S3C24XX Clocks, (c) 2004 Simtec Electronics
-
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
-
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
-
Built 1 zonelists in Zone order, mobility grouping on. Total pages:
-
-
16256
-
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc
-
-
console=ttySAC0
-
NR_IRQS:85
-
irq: clearing pending ext status 00080000
-
irq: clearing subpending status 00000002
-
PID hash table entries: 256 (order: 8, 1024 bytes)
-
Console: colour dummy device 80x30
-
console [ttySAC0] enabled
-
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
-
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
-
Memory: 64MB = 64MB total
-
Memory: 61364KB available (3008K code, 285K data, 112K init, 0K highmem)
-
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
-
Mount-cache hash table entries: 512
-
CPU: Testing write buffer coherency: ok
-
net_namespace: 936 bytes
-
NET: Registered protocol family 16
-
S3C Power Management, Copyright 2004 Simtec Electronics
-
S3C2440: Initialising architecture
-
S3C2440: IRQ Support
-
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
-
DMA channel 0 at c4808000, irq 33
-
DMA channel 1 at c4808040, irq 34
-
DMA channel 2 at c4808080, irq 35
-
DMA channel 3 at c48080c0, irq 36
-
S3C244X: Clock Support, DVS off
-
bio: create slab <bio-0> at 0
-
SCSI subsystem initialized
-
usbcore: registered new interface driver usbfs
-
usbcore: registered new interface driver hub
-
usbcore: registered new device driver usb
-
s3c2440-i2c s3c2440-i2c: slave address 0x10
-
s3c2440-i2c s3c2440-i2c: bus frequency set to 97 KHz
-
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
-
NET: Registered protocol family 2
-
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
-
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
-
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
-
TCP: Hash tables configured (established 2048 bind 2048)
-
TCP reno registered
-
NET: Registered protocol family 1
-
NetWinder Floating Point Emulator V0.97 (extended precision)
-
JFFS2 version 2.2. (NAND) (SUMMARY) 漏 2001-2006 Red Hat, Inc.
-
ROMFS MTD (C) 2007 Red Hat, Inc.
-
yaffs Mar 29 2011 11:34:55 Installing.
-
msgmni has been set to 119
-
io scheduler noop registered
-
io scheduler anticipatory registered (default)
-
io scheduler deadline registered
-
io scheduler cfq registered
-
Console: switching to colour frame buffer device 30x40
-
fb0: s3c2410fb frame buffer device
-
lp: driver loaded but no devices found
-
ppdev: user-space parallel port driver
-
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
-
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a
-
-
S3C2440
-
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a
-
-
S3C2440
-
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a
-
-
S3C2440
-
brd: module loaded
-
loop: module loaded
-
Uniform Multi-Platform E-IDE driver
-
ide-gd driver 1.18
-
ide-cd driver 5.00
-
Driver 'sd' needs updating - please use bus_type methods
-
dm9000 Ethernet Driver, V1.31
-
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
-
s3c2440-nand s3c2440-nand: Tacls=2, 20ns Twrph0=3 30ns, Twrph1=2 20ns
-
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB
-
-
3,3V 8-bit)
-
Scanning device for bad blocks
-
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
-
0x000000000000-0x000000040000 : "ywx-uboot"
-
0x000000200000-0x000000400000 : "ywx-kernel"
-
0x000000400000-0x00000ff80000 : "ywx-yaffs2"
-
usbmon: debugfs is not available
-
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
-
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
-
usbcore: registered new interface driver libusual
-
usbcore: registered new interface driver usbserial
-
USB Serial support registered for generic
-
usbcore: registered new interface driver usbserial_generic
-
usbserial: USB Serial Driver core
-
USB Serial support registered for FTDI USB Serial Device
-
usbcore: registered new interface driver ftdi_sio
-
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
-
USB Serial support registered for pl2303
-
usbcore: registered new interface driver pl2303
-
pl2303: Prolific PL2303 USB to serial adaptor driver
-
mice: PS/2 mouse device common for all mice
-
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
-
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
-
Advanced Linux Sound Architecture Driver Version 1.0.20.
-
ALSA device list:
-
No soundcards found.
-
TCP cubic registered
-
NET: Registered protocol family 17
-
yaffs: dev is 32505858 name is "mtdblock2"
-
yaffs: passed flags ""
-
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
-
yaffs: auto selecting yaffs2
-
Partially written block 476 detected
-
Partially written block 476 detected
-
Partially written block 476 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 474 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
Partially written block 398 detected
-
yaffs_read_super: isCheckpointed 0
-
VFS: Mounted root (yaffs filesystem) on device 31:2.
-
Freeing init memory: 112K
-
hwclock: can't open '/dev/misc/rtc': No such file or directory
-
input_polldev: Unknown symbol kmalloc_caches
-
insmod: can't insert '/lib/input-polldev.ko': unknown symbol in module,
-
-
or unknown parameter
-
mac80211: Unknown symbol cfg80211_scan_done
-
mac80211: Unknown symbol regulatory_hint_11d
-
mac80211: Unknown symbol cfg80211_wext_giwscan
-
mac80211: Unknown symbol cfg80211_wext_giwname
-
mac80211: Unknown symbol cfg80211_wext_giwmode
-
mac80211: Unknown symbol cfg80211_wext_giwrange
-
mac80211: Unknown symbol wiphy_register
-
mac80211: Unknown symbol wiphy_new
-
mac80211: Unknown symbol cfg80211_put_bss
-
mac80211: Unknown symbol cfg80211_hold_bss
-
mac80211: Unknown symbol cfg80211_send_rx_auth
-
mac80211: Unknown symbol cfg80211_send_rx_disassoc
-
mac80211: Unknown symbol wiphy_unregister
-
mac80211: Unknown symbol ieee80211_radiotap_iterator_init
-
mac80211: Unknown symbol cfg80211_get_bss
-
mac80211: Unknown symbol __ieee80211_get_channel
-
mac80211: Unknown symbol cfg80211_wext_siwmode
-
mac80211: Unknown symbol cfg80211_send_rx_assoc
-
mac80211: Unknown symbol ieee80211_radiotap_iterator_next
-
mac80211: Unknown symbol ieee80211_channel_to_frequency
-
mac80211: Unknown symbol cfg80211_wext_siwscan
-
mac80211: Unknown symbol cfg80211_inform_bss_frame
-
mac80211: Unknown symbol ieee80211_frequency_to_channel
-
mac80211: Unknown symbol cfg80211_send_rx_deauth
-
mac80211: Unknown symbol cfg80211_unhold_bss
-
mac80211: Unknown symbol cfg80211_unlink_bss
-
mac80211: Unknown symbol wiphy_free
-
mac80211: Unknown symbol kmalloc_caches
-
insmod: can't insert '/lib/mac80211.ko': unknown symbol in module, or
-
-
unknown parameter
-
rt2x00lib: Unknown symbol ieee80211_register_hw
-
rt2x00lib: Unknown symbol ieee80211_get_hdrlen_from_skb
-
rt2x00lib: Unknown symbol ieee80211_wake_queue
-
rt2x00lib: Unknown symbol input_allocate_polled_device
-
rt2x00lib: Unknown symbol ieee80211_tx_status_irqsafe
-
rt2x00lib: Unknown symbol input_free_polled_device
-
rt2x00lib: Unknown symbol ieee80211_ctstoself_get
-
rt2x00lib: Unknown symbol ieee80211_wake_queues
-
rt2x00lib: Unknown symbol ieee80211_iterate_active_interfaces
-
rt2x00lib: Unknown symbol ieee80211_stop_queue
-
rt2x00lib: Unknown symbol ieee80211_stop_queues
-
rt2x00lib: Unknown symbol ieee80211_iterate_active_interfaces_atomic
-
rt2x00lib: Unknown symbol ieee80211_channel_to_frequency
-
rt2x00lib: Unknown symbol ieee80211_unregister_hw
-
rt2x00lib: Unknown symbol input_register_polled_device
-
rt2x00lib: Unknown symbol ieee80211_rts_get
-
rt2x00lib: Unknown symbol ieee80211_beacon_get
-
rt2x00lib: Unknown symbol input_unregister_polled_device
-
rt2x00lib: Unknown symbol ieee80211_rx_irqsafe
-
insmod: can't insert '/lib/rt2x00lib.ko': unknown symbol in module, or
-
-
unknown parameter
-
rt2x00usb: Unknown symbol rt2x00lib_probe_dev
-
rt2x00usb: Unknown symbol ieee80211_free_hw
-
rt2x00usb: Unknown symbol ieee80211_alloc_hw
-
rt2x00usb: Unknown symbol rt2x00lib_rxdone
-
rt2x00usb: Unknown symbol rt2x00lib_remove_dev
-
rt2x00usb: Unknown symbol rt2x00lib_txdone
-
rt2x00usb: Unknown symbol rt2x00queue_get_queue
-
rt2x00usb: Unknown symbol kmalloc_caches
-
insmod: can't insert '/lib/rt2x00usb.ko': unknown symbol in module, or
-
-
unknown parameter
-
rt73usb: Unknown symbol rt2x00mac_add_interface
-
rt73usb: Unknown symbol crc_itu_t_table
-
rt73usb: Unknown symbol rt2x00mac_get_stats
-
rt73usb: Unknown symbol rt2x00usb_disable_radio
-
rt73usb: Unknown symbol rt2x00mac_set_key
-
rt73usb: Unknown symbol rt2x00usb_vendor_request_buff
-
rt73usb: Unknown symbol rt2x00usb_vendor_request_large_buff
-
rt73usb: Unknown symbol rt2x00usb_kick_tx_queue
-
rt73usb: Unknown symbol rt2x00usb_write_tx_data
-
rt73usb: Unknown symbol rt2x00mac_config_interface
-
rt73usb: Unknown symbol rt2x00mac_remove_interface
-
rt73usb: Unknown symbol rt2x00usb_vendor_request
-
rt73usb: Unknown symbol rt2x00usb_probe
-
rt73usb: Unknown symbol rt2x00mac_config
-
rt73usb: Unknown symbol rt2x00queue_get_queue
-
rt73usb: Unknown symbol rt2x00usb_clear_entry
-
rt73usb: Unknown symbol rt2x00mac_conf_tx
-
rt73usb: Unknown symbol rt2x00mac_start
-
rt73usb: Unknown symbol rt2x00mac_stop
-
rt73usb: Unknown symbol rt2x00mac_configure_filter
-
rt73usb: Unknown symbol rt2x00usb_disconnect
-
rt73usb: Unknown symbol rt2x00mac_tx
-
rt73usb: Unknown symbol rt2x00usb_vendor_req_buff_lock
-
rt73usb: Unknown symbol rt2x00mac_get_tx_stats
-
rt73usb: Unknown symbol rt2x00usb_regbusy_read
-
rt73usb: Unknown symbol rt2x00usb_kill_tx_queue
-
rt73usb: Unknown symbol crc_itu_t
-
rt73usb: Unknown symbol rt2x00usb_uninitialize
-
rt73usb: Unknown symbol rt2x00usb_initialize
-
rt73usb: Unknown symbol rt2x00mac_bss_info_changed
-
insmod: can't insert '/lib/rt73usb.ko': unknown symbol in module, or
-
-
unknown parameter
-
zd1211rw: Unknown symbol ieee80211_free_hw
-
zd1211rw: Unknown symbol ieee80211_alloc_hw
-
zd1211rw: Unknown symbol regulatory_hint
-
zd1211rw: Unknown symbol ieee80211_register_hw
-
zd1211rw: Unknown symbol ieee80211_tx_status_irqsafe
-
zd1211rw: Unknown symbol ieee80211_wake_queues
-
zd1211rw: Unknown symbol ieee80211_stop_queues
-
zd1211rw: Unknown symbol ieee80211_unregister_hw
-
zd1211rw: Unknown symbol ieee80211_beacon_get
-
zd1211rw: Unknown symbol kmalloc_caches
-
zd1211rw: Unknown symbol ieee80211_rx_irqsafe
-
insmod: can't insert '/lib/zd1211rw.ko': unknown symbol in module, or
-
-
unknown parameter
-
ov9650: Unknown symbol kmalloc_caches
-
insmod: can't insert '/lib/ov9650.ko': unknown symbol in module, or
-
-
unknown parameter
-
ifconfig: SIOCGIFFLAGS: No such device
-
ifconfig: SIOCSIFHWADDR: No such device
-
ifconfig: SIOCSIFADDR: No such device
-
open device leds: No such file or directory
-
route: SIOCADDRT: Network is unreachable
-
[01/Jan/1970:00:00:12 +0000] boa: server version Boa/0.94.13
-
[01/Jan/1970:00:00:12 +0000] boa: server built Jul 29 2009 at 14:27:34.
-
[01/Jan/1970:00:00:12 +0000] boa: starting server pid=913, port 80
-
-
Please press Enter to activate this console.
-
[root@EmbedSky /]# ls
-
bin linuxrc root tq2440_serial0
-
dev lost+found sbin udisk
-
etc mnt sddisk usr
-
home opt sys var
-
lib proc tmp web
-
[root@EmbedSky /]#
-
-
-
问题:这里 的tq2440_serial0 是 怎么生成的?
阅读(2351) | 评论(0) | 转发(0) |