1.下载arm-linux-gcc-4.3.2.tar.gz交叉编译环境,并安装。
2.移植u-boot-1.1.6,参照网上的帖子,添加u-boot的nand read和write功能。
3.编译linux-2.6.24.4内核
arch ?= arm
cross_complie ?= /usr/local/arm/4.3.2/bin/arm-linux-
kbuild_flags 添加 “-fno-tree-scev-cprop”,解决__udivdi3的reference找不到的问题
内核需要支持EABI
make zImage 之后需要通过mkImage命令将zImage转换成uboot可以引导的uImage.命令如下:
mkImage -n "linux-2.6.24.4-safeman-arm" -A arm -O linux -T kernel -C none -a 0x30007fc0 -e 30008000 -d zImage uImage
这里解释一下参数的意义:
-A == set architecture to 'arch'
-O == set operating system to 'os'
-T == set image type to 'type'
-C == set compression type 'comp'
-a == set load address to 'addr' (hex)
-e == set entry point to 'ep' (hex)
-n == set image name to 'name'
-d == use image data from 'datafile'
-x == set XIP (execute in place)
4.设置uboot的tftp参数
setenv serverip 192.168.0.235
setenv ethaddr 00:12:13:14:15:16
setenv ipaddr 192.168.0.75
setenv netmask 255.255.255.0
saveenv
5.烧录uImage到nand flash
nand erase 0x100000 0x200000;tftp 0x30008000 uImage;nand write 0x30008000 0x100000 0x18274c
nand erase 起始地址 大小
tftp 下载地址 下载文件名
nand write 文件存储地址 文件要写入的起始地址 文件大小
6.制作根文件系统jffs2类型
编译busybox-1.16.1
选择动态编译
arch ?= arm
cross_complie ?= /usr/local/arm/4.3.2/bin/arm-linux-
制作rootfs目录项,将相应的文件copy过来。
通过arm-linux-readelf -d filename查看文件需要的动态链接库,对应s3c2410平台来说,需要 armv4t/lib/下的链接库
制作jffs2的image
/extend/src/mtd-utils-v1.4.6-baafd8a/mkfs.jffs2 -r rootfs -o jffs2.img -e 0x4000 --pad=0x400000 -n
# --pad size must be equal the size of mtdblock.
#such as: root=/dev/mtdblock7, /dev/mtdblock7 size is 0x1000000,
# then generate command should is
# mkfs.jffs2 -r rootfs -o jffs2.img -e 0x4000 --pad=0x1000000 -n
#-e means the erase block size. Deferent nand flashes have deferent erase block size.
7.烧录jffs2.img到mtdblock2分区
nand flash的分区情况:
0x00000000-0x00004000 : "Boot Agent"
0x00000000-0x00200000 : "S3C2410 flash partition 1"
0x00400000-0x00800000 : "S3C2410 flash partition 2"
0x00800000-0x00a00000 : "S3C2410 flash partition 3"
0x00a00000-0x00e00000 : "S3C2410 flash partition 4"
0x00e00000-0x01800000 : "S3C2410 flash partition 5"
0x01800000-0x03000000 : "S3C2410 flash partition 6"
0x03000000-0x04000000 : "S3C2410 flash partition 7"
tftp 0x30008000 jffs2.img;nand erase 0x400000 0x400000;nand write 0x30008000 0x400000 0x400000
8.设置启动参数
set bootcmd nand read 0x30007fc0 0x100000 0x18274c\;bootm 0x30007fc0;saveenv
setenv bootargs root=/dev/mtdblock2 rootfstype=jffs2 rw init=/linuxrc noinitrd console=ttySAC0,115200;saveenv
10.启动过程:
U-Boot 1.1.6-dirty (Feb 14 2012 - 17:01:22)
DRAM: 64 MB
Flash: 512 kB
NAND: 64 MB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
NAND read: device 0 offset 1048576, size 1582924 ...
1582924 bytes read: OK
## Booting image at 30207fc0 ...
Image Name: linux-2.6.24.4-safeman-arm
Created: 2012-02-15 2:56:03 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1582860 Bytes = 1.5 MB
Load Address: 30207fc0
Entry Point: 30208000
Verifying Checksum ... OK
XIP Kernel Image ... OK
Starting kernel ...
Uncompressing Linux....................................................................................................... done, booting the kernel.
Linux version 2.6.24.4-arm-dirty () (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #9 Tue Feb 14 11:20:09 CST 2012
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 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: 16256
Kernel command line: root=/dev/mtdblock2 rootfstype=jffs2 rw init=/linuxrc noinitrd console=ttySAC0,115200
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
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: 61568KB available (2920K code, 314K data, 128K 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 c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, 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: 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
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
yaffs Feb 14 2012 11:17:49 Installing.
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
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 8 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00004000 : "Boot Agent"
0x00000000-0x00200000 : "S3C2410 flash partition 1"
0x00400000-0x00800000 : "S3C2410 flash partition 2"
0x00800000-0x00a00000 : "S3C2410 flash partition 3"
0x00a00000-0x00e00000 : "S3C2410 flash partition 4"
0x00e00000-0x01800000 : "S3C2410 flash partition 5"
0x01800000-0x03000000 : "S3C2410 flash partition 6"
0x03000000-0x04000000 : "S3C2410 flash partition 7"
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 390 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)
jffs2_scan_inode_node(): CRC failed on node at 0x003807c0: Read 0xffffffff, calculated 0xe0fb70ef
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 128K
LTW ^^^^maker
Best wishes to you
Born to try,born to win
System power on
Please press Enter to activate this console.
阅读(779) | 评论(0) | 转发(0) |