1. Cross-compile busybox
Version: busybox-1.22.0.tar.bz2
Modify makefile to add a cross-compiler path
Arch? = Arm
Cross_compile? =/Opt/arm-2009q1/bin/ARM-None-Linux-gnueabi-
Configure busybox
Build options --->
[*] Build busybox as a static binary (no shared libs)
General configuration --->
[*] Don't use/usr
Linux system utilities --->
[*] Mount
[*] Support mounting NFS file systems on Linux <2.6.23
Make
Make install
The generated file is in the new directory _ install.
2. Create the filesys directory.
CD filesys
Create the directory bin boot Dev etc home lib media MNT opt proc root sbin SRV sys tmp usr VaR
3. Copy the compiled content in busybox _ install to filesys.
Copy the linked file
CP-RF "src" "DEST"
4 Configure/etc
4.1 Add a file
/Etc/group/etc/passwd/etc/mdev. conf
Content:
/Etc/group
Root: *: 0:
/Etc/passwd
Root: 0: 0: Root:/home/root:/bin/sh
/Etc/mdev. conf
Null
4.2 create a file
/Etc/fstab
Content:
Proc/proc defaults 0 0
Tmpfs/tmp tmpfs defaults, size = 5 M 0 0
# Automatic mounting when the Mount-a command is executed
4.3 create a file
/Etc/inittab
Content:
: Sysinit:/etc/init. d/RCS
: Askfirst:/bin/sh
# Ttys0: 2345: respawn:/sbin/Getty 115200 ttys0 # I haven't figured it out yet
: Ctrlaltdel:/sbin/reboot
: Shutdown:/bin/umount-a-r
: Restart:/sbin/init
# INIT process execution
4.4 create a file
/Etc/init. d/RCS
Content:
#! /Bin/sh
Path =/bin:/sbin:/usr/bin:/usr/sbin
Runlevel = s
Prevlevel = N
Umask 022
Export path runlevel prevlevel
Echo "--------------- mount all --------------"
Mount-
Echo 'mount nand flash file system ...'
Mount-T jffs2/dev/mtdblock4/mnt/Nand
# Mount devpts in order to use telnetd
######################################## ###################################
########## Telnet Server ######################
Echo "--------------- Mount devpts ------------"
CP-RF/dev/*/tmp
Mount-T tmpfs/dev
CP-RF/tmp/*/dev
Rm-RF/tmp /*
Echo "--------------- start mdev -------------"
Mount-T sysfs/sys
Echo/sbin/mdev>/proc/sys/kernel/hotplug
Mdev-S
Echo "...... start Telnetd Server ........."
./Etc/init. d/telnetd start
Mount-T devpts/dev/PTS
Sleep 1
########## Telnet Server ######################
######################################## ###################################
Echo "**************************************"
Echo "kernel version: linux-2.6.24"
Echo "dm6467t rootfs"
Echo "Date: 2010.12.22"
Echo "**************************************"
Ifconfig eth0 192.168.1.7
Add executable permissions
Chomd + x/etc/init. d/RCS
4.5 create a file/etc/init. d/telnetd
Content:
#! /Bin/sh
Telnetd =/sbin/telnetd
Test-X "$ telnetd" | exit 0
Case "$1" in
Start)
Echo-n "Starting telnet daemon"
Start-stop-daemon -- start -- quiet -- exec $ telnetd
Echo "."
;;
Stop)
Echo-n "Stopping telnet daemon"
Start-stop-daemon -- stop -- quiet -- pidfile/var/run/telnetd. PID
Echo "."
;;
*)
Echo "Usage:/etc/init. d/telnetd {START | stop }"
Exit 1
Esac
Exit 0
Add executable permissions
Chomd + x/etc/init. d/telnetd
5. Telnet Service
./Etc/init. d/telnetd start
Mount-T devpts/dev/PTS
Configuration method 1:
Add:
CP-RF/dev/*/tmp
Mount-T tmpfs/dev
CP-RF/tmp/*/dev
Rm-RF/tmp /*
Mount-T sysfs/sys
Echo/bin/mdev>/proc/sys/kernel/hotplug
Mdev-s # map the device nodes created by the system driver (relatively complete)
Configuration method 2:
Manually create a node directory
Mkdir/dev/PTS
Mknod ptmx C 5 2
Mknod tty C 5 0
Mknod tty0 C 4 0
Mknod tty1 C 4 1
Mknod tty2 C 4 2
Mknod tty3 C 4 3
Mknod tty4 C 4 4
6. Configure/dev
Create a node
Mknod console C 5 1
Mknod null C 1 3
Mknod mtdblock4 B 31 4
......
......
7. Add a dynamic link library
Copy dynamic libraries in the Cross-compilation chain
/Opt/arm-2009q1/ARM-None-Linux-gnueabi/libc/lib/... filesys/lib
/Opt/arm-2009q1/ARM-None-Linux-gnueabi/libc/usr/lib/.../. filesys/usr/lib
Otherwise, error while loading shared libraries: libstdc ++. so.6: cannot open shared object file: no such file or directory is reported during the execution of the program.
The file system content has been created.
Package cramfs
The tool mkcramfs is not a cross-compilation tool.
Packaging:
/Opt/cramfs-1.1/mkcramfs/home/zhujinju/workspace/myrootfs/filesys cramfsimage_my6467t
Unpack:
CD/root/workspace/myfilefs
Mkdir filesys
Mkdir rdmnt2
Mount-T cramfs-o loop cramfsimage_my6467t rdmnt2/
CD rdmnt2
Tar-CF-. | tar-C ../filesys/-xpf-
CD/root/workspace/dm6467t_root_fs
Chown-r root filesys/
Chmod-r a + rwx filesys/
Umount rdmnt2/
Run the following command:
Tftpboot 0x82000000 cramfsimage_my6467t # upload the file to the memory address 0x82000000
Nand erase 0x560000 0x1000000 # erase the NAND flash Address 0x560000 (16 m = 0x1000000)
Nand write 0x82000000 0x560000 0x1000000 # Write the content of the memory address 0x82000000 16 m to the NAND flash Address 0x560000 (16 m = 0x1000000)
Arm root file system creation