Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1639571
  • 博文数量: 584
  • 博客积分: 13857
  • 博客等级: 上将
  • 技术积分: 11883
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-16 09:34

分类: LINUX

2010-10-14 15:10:19

移植环境:

主机:CentOS 5.1

交叉编译器:arm-linux-gcc-3.4.1

开 发板平台:S3C2440(YL-2440/YLP-2440开发板)

开始移植

1. 下载最新的busybox1.9.2,并解压缩。

下载busybox源代码:

交叉编译: 同内核

解压源码:tar -jxvf busybox-1.9.2.tar.bz2

2. 修改Makefile中的174行的 arch和编译工具链头。

ARCH ?= arm

CROSS_COMPILE ?= /usr/local/arm/3.4.1/bin/arm-linux-

3. make menuconfig. 修改编译选 项。

Busybox Setting----->

build option-->

[ ] Build BusyBox as a static binary (no shared libs)

[*] Build shared libbusybox

[*] Produce a binary for each applet linked against libbusybox

[*] Produce additional busybox binary linked against libbusybox

[ ] Build with Large File Support (for accessing files >2 GB)

installation option-->

[*] Don't use /usr

Applets links (as soft-links) --->

(./_install) BusyBox installation prefix

Busybox Library Tuning --->

MD5: Trade Bytes for Speed

[*] Faster /proc scanning code (+100 bytes)

[*] Support for /etc/networks

[*] Support for /etc/networks

[*] Additional editing keys

[*] vi-style line editing commands

[*] History saving

[*] Tab completion

[*] Username completion

[*] Fancy shell prompts

Linux Module Utilities --->

[*] Support version 2.6.x Linux kernels

[*] insmod

[*] Enable load map (-m) option

[*] Symbols in load map

[*] rmmod

[*] lsmod

[*] lsmod pretty output for 2.6.x Linux kernels

[*] modprobe

[ ] Multiple options parsing

[ ] Fancy alias parsing

--- Options common to multiple modutils

[ ] Support tainted module checking with new kernels

[ ] Support version 2.2.x to 2.4.x Linux kernels

[*] Support version 2.6.x Linux kernels

其他的用默认值

4.编译busybox

[kevin@localhost busybox-1.9.2]# make install

在busybox/_install 目录下会生成我们需要的文件。

5. 修改_install/bin/busybox的属性。为4755


chmod 4755 ./_install/bin/busybox

必须要要修改属性,否则在 busybox中很多会 受限制,比如:

$ su

su: must be suid to work properly

6.建立 root fs的文件系统所需的目录和文件。

Mkdir /nfsroot

Mkdir /nfsroot/s3c2440

在root文件夹中建立基本的目录

[root@centos s3c2440]# ls

bin dev home linuxrc proc sbin tmp var

boot etc lib mnt root sys usr

6. 以root身份建立节点文件/dev/console /dev/null

mknod -m 600 dev/console c 5 1

mknod -m 666 dev/null c 1 3

7. 建立配置文件如下:

[root@centos etc]# more profile

#!/bin/sh

#/etc/profile:system-wide .profile file for the Bourne shells

echo

echo -n "Processing /etc/profile......"

# Set search library path

export LD_LIBRARY_PATH=/lib:/usr/lib

# set user path

export PATH=/bin:/sbin:/usr/bin:/usr/sbin

#Set PS1

USER = "`id -un`"

LOGNAME=$USER

PS1='[\u@\h\W]\$'

PATH=$PATH

echo "Done!"

[root@centos etc]# more init.d/rcS

#!/bin/sh

# set hostname needed host file in /etc directory

#./etc/host

hostname `cat /etc/host`

# mount all filesystem defined in "fstab"

echo "#mount all......."

/bin/mount -a

#+yangdk

/bin/chmod 0666 /dev/null

echo "# starting mdev...."

/bin/echo /sbin/mdev >/proc/sys/kernel/hotplug

mdev -s

/usr/etc/init

echo "******************************************"

echo " yangdk linux-2.6.24.4 boot "

echo " 2008-5-9 "

echo " "

echo "******************************************"

[root@centos etc]# more

fstab host inittab passwd shadow

group init.d/ mdev.conf profile

[root@centos etc]# more fstab

proc /proc proc defaults 0 0

none /tmp ramfs defaults 0 0

none /var ramfs defaults 0 0

mdev /dev ramfs defaults 0 0

sysfs /sys sysfs defaults 0 0

[root@centos etc]# more inittab

::sysinit:/etc/init.d/rcS

::respawn:-/bin/sh

tty2::askfirst:-/bin/sh

::ctrlaltdel:/bin/umount -a -r

::shutdown:/bin umount -a -r

::shutdown:/sbin/swapoff -a

[root@centos etc]# more ../usr/etc/init

#!/bin/sh

ifconfig eth0 192.168.1.111 up

ifconfig lo 127.0.0.1

8.建立文件/etc /mdev.conf,内容为空

[root@centos etc]# vi mdev.conf

9.复制主机/etc/下 面的文件passwd group shadow文件到/etc

[root@centos etc]# cp /etc/group .

[root@centos etc]# cp /etc/passwd .

[root@centos etc]# cp /etc/shadow .

ok, 所需要的文件都已经建立ok了

[root@centos etc]# ls

fstab group host init.d inittab mdev.conf passwd profile shadow

10.复制刚刚编译的busybox到/root目录 下

[root@centos _install]# sudo cp -Rfv * /nfsroot/s3c2440

11. 因为是编译的时候使用的是动态链接。所以先看看/busybox/_install/bin/busybox使用了哪些lib,然后从glibc复制相应 的lib到/nfsroot/s3c2440/lib中。

[root@centos bin]# /usr/local/arm/3.4.1/arm-linux-gnu-readelf -d busybox

Dynamic section at offset 0xb8014 contains 22 entries:

Tag Type Name/Value

0x (NEEDED) Shared library:[libcrypt.so.1]

0x (NEEDED) Shared library: [libm.so.6]

0x (NEEDED) Shared library: [libc.so.6]

0xc (INIT) 0xc04c

0xd (FINI) 0xa26f0

0x (HASH) 0x80e8

0x (STRTAB) 0xa384

0x (SYMTAB) 0x8b24

……

……

……

复 制lib 文件到lib目录下:

[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/ld* .

[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libc-2.3.2.so .

[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libc.so.6 .

[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libm * .

[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libcrypt* .

12.使用工具mkcramfs将整个s3c2440文件夹制作成文件系统

[root@centos nfsroot]# mkcramfs s3c2440 fs_2.6.24.4_busybox.cramfs -e 2.6.24.4

下 载并烧录到nandflash中。…

Read chip id = ec76

Nand flash status = c0

Set boot params = root=/dev/mtdblock2 init=/linuxrc load_ramdisk=0 console=ttySAC1 mem=K devfs=mount

Load Kernel...

Linux version 2.6.24.4 (root@centos) (gcc version 3.4.1) #49 Wed May 7 18:57:08 CST 2008

CPU: ARM920T [] revision 0 (ARMv4T) cr=c

Machine: SMDK2410

ATAG_INITRD is deprecated; please update your bootloader.

Memory policy: ECC disabled Data cache writeback

CPU S3C2440A (id 0x)

S3C244X: core 400.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: bytes associativity 64 32 byte lines 8 sets

CPU0: D cache: bytes associativity 64 32 byte lines 8 sets

Built 1 zonelists in Zone order mobility grouping on. Total pages:

Kernel command line: root=/dev/mtdblock2 init=/linuxrc load_ramdisk=0 console=ttySAC1 mem=K devfs=mount

irq: clearing pending ext status 0005f600

irq: clearing subpending status a

irq: clearing subpending status

PID hash table entries: 256 (order: 8 1024 bytes)

timer tcon= tcnt a2c1 tcfg usec eb8

Console: colour dummy device 80x30

console [ttySAC1] enabled

Dentry cache hash table entries: 8192 (order: 3 bytes)

Inode-cache hash table entries: 4096 (order: 2 bytes)

Memory: 64MB = 64MB total

Memory: KB available (2824K code 299K data 120K 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

S3C2440: Initialising architecture

S3C2440: IRQ Support

S3C2440: Clock Support DVS off

S3C24XX DMA Driver (c) 2003-20042006 Simtec Electronics

DMA channel 0 at c irq 33

DMA channel 1 at c irq 34

DMA channel 2 at c irq 35

DMA channel 3 at cc0 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 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.

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/ driver $Revision: 1.90 $ 4 ports IRQ sharing enabled

s3c2440-uart.0: s3c2410_serial0 at MMIO 0x (irq = 70) is a S3C2440

s3c2440-uart.1: s3c2410_serial1 at MMIO 0x (irq = 73) is a S3C2440

s3c2440-uart.2: s3c2410_serial2 at MMIO 0x (irq = 76) is a S3C2440

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

loop: module loaded

Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)

+yangdk-->debug:PP_IntNum:

+yangdk-->debug2:PP_IntNum:

eth0: CS8900A rev E at 0xe irq=53 addr: 00: 0:3E:26:0A: 0

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

s3c2440-nand s3c2440-nand: Tacls=1 10ns Twrph0=4 40ns Twrph1=1 10ns

NAND device: Manufacturer ID: 0xec Chip ID: 0x76 (Samsung NAND 64MiB 33V 8-bit)

NAND_ECC_NONE selected by board driver. This is not recommended !!

Scanning device for bad blocks

Creating 4 MTD partitions on "NAND 64MiB 33V 8-bit":

0x-0x : "Bootloader"

0x-0x : "Linux kernel"

0x-0x0 : "Linux rootfs"

0x0-0x0 : "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 0x

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



s3c2440-i2c s3c2440-i2c: slave address 0x10

s3c2440-i2c s3c2440-i2c: bus frequency set to 390 KHz

s3c2440-i2c s3c2440-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.

VFS: Mounted root (cramfs filesystem) readonly.

Freeing init memory: 120K

init started: BusyBox v1.9.2 (2008-04-16 00:31:28 CST)

starting pid 766 tty '': '/e


阅读(1332) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~