Reprint please indicate the source: http://writeblog.csdn.net/PostEdit.aspx? Entryid = 5826373
1. System Version Selection
Cross-compiler version 4.4.0
Kernel version 2.6.30.8
Busybox version 1.16.2
Ii. kernel Compilation
Modify makefile, arch = arm, cross_compile = arm-Eabi -.
Make mrproper
Make versatile_defconfig
Add Eabi support: [*] use the arm Eabi to compile the kernel
Added support for the Virtual File System tmpfs.
Make
Iii. busybox compilation and cropping
1. Make arch = arm cross_compile = arm-None-Linux-gnueabi-defconfig
2. Make arch = arm cross_compile = arm-None-Linux-gnueabi-menuconfig
A. Select static compilation.
B. busybox library tuning --->
[*] Username completion
[*] Fancy shell prompts
These two items must be selected. Otherwise, busybox will not be able to identify the parameters in the environment variable ps1.
3. Make arch = arm cross_compile = arm-None-Linux-gnueabi-install
4. Create a root file system
Mkdir-V {Dev, Proc, sys, etc, Lib, TMP, bin, sbin, USR}
Mkdir-V usr/include
Mkdir-V usr/lib
Chmod 1777 TMP
Add two necessary nodes
Sudo mknod-m 600 DEV/console C 5 1
Sudo mknod-M 666 DEV/null C 1 3
Create files under ETC/: Hostname, init. d/RCs, inittab, Profile
Copy the _ install directory in busybox to the root directory.
/Etc/inittab
# System initialization.
#/Etc/inittab
: Sysinit:/etc/init. d/RCS
: Askfirst:-/bin/sh
: Ctrlaltdel:/sbin/reboot
: Shutdown:/bin/umount-a-r
5. Add mdev support
Add:
Mount-T sysfs/sys
Mount-T proc NONE/proc
Sysctl-W kernel. hotplug =/sbin/mdev
Mdev-S
6. Add NFS support under UT
Add/etc/exports:
/Home/XXXXX/root * (RW, sync, no_root_squash)
Restart NFS:
Sudo/etc/init. d/nfs-kernel-server restart
VII. qemu start the arm-Linux System
1. Add the qemu Startup Script: qemu-IFUP
#! /Bin/sh
Echo "executing/etc/qemu-IFUP"
# Echo "bringing up $1 for bridged mode ..."
Sudo ifconfig $1 10.0.0.1
# Echo "adding $1 to br0.0 ..."
# Sudo/usr/sbin/brctl addif br0 $1
# Sleep 2
2. Run qemu:
Sudo qemu-system-arm-M versatilepb-kernel zimage/
-Append root = "/dev/nfs nfsroot = 10.0.0.1:/home/XXXXX/root RW/
IP = 10.0.0.2: 10.0.0.1: 10.0.0.1: 255.255.255.0 "-net Nic, VLAN = 0/
-Net tap, VLAN = 0, ifname = tap0, script =./qemu-IFUP
8. Enable arm-Linux to access the Internet through NAT
1. Set iptables on the host:
Echo 1>/proc/sys/NET/IPv4/ip_forward
Iptables-T Nat-A postrouting-O eth1-s 10.0.0.1/24-J Masquerade
2. Add the file/etc/resolv. conf in the arm-Linux system to specify the DNS server:
Nameserver 192.168.1.1
9. Create an initrd image file when ramdisk is started.
# Mkdir initrd
# Dd If =/dev/Zero of = initrd. img bs = 1 k count = 4096
#/Sbin/mke2fs-F-v-M0 initrd. img
# Mount-o loop initrd. IMG initrd
# Cp-AV rootfs/* initrd
# Umount
# Gzip-9 initrd. img
Start command: qemu-system-arm-M versatilepb-kernel Linux-source/Linux/ARCH/ARM/boot/zimage-initrd initrd.img.gz-append root = "/dev/ram0 RW"