Reprint Please specify source: http://blog.csdn.net/ruoyunliufeng/article/details/44995039
Development Board Software Environment: Uboot (with the official, follow-up I will consider the analysis transplant)
Kernel (originally wanted to use the official to reduce the difficulty, but the given does not support NFS, simple change the next, consider the migration of thin new kernel)
File system (porting minimal file system)
1. Modify the Development Board official Kernel support NFS
A. Copy the kernel from the host to the virtual machine using the FTP tool, then unzip
b.copy official profile. config (different board configuration files, my operation is cp config_for_linux. config)
C.make Menuconfig
Error: I have met two, the first error is that the terminal is too small to install the configuration of the shape.
The second is the lack of ncurses libraries , solutions $sudo apt-get Install Libncu Rses5-dev
D. Modifying configuration options
Check Ip:kernel level Autoconfiguration
Save after changes, and make
E. Burning the generated kernel into the development Board
F. Testing NFS Features
mount-t nfs-o nolock 192.168.6.2:/work/mnt
If the/mnt of the Development Board file system hangs on the/work of the virtual machine, it proves successful.
2. Making minimal Network File system
A. Download busybox (direct Baidu, then enter the official website, I download is the latest stable version 1.23.2) and then unzip
B.make Menuconfig
1. Modify the system where, what is the name, and this is my configuration:
2. What compiler to use
C.make then make install and your system should have been generated.
d. Copy the library files from the cross-compiler into our minimal network file system (Note-D option)
cp/usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/libc/lib/*/work/nfs_sys/mini_sys
E. Next need to create a few files, if lazy to create, I follow up my file system, you can copy under the
Create three files under/etc Etc/initab Etc/init.d/rcs etc/fstab Three files The contents are as follows:
Etc/fstab
:: Sysinit:/etc/init.d/rcsttysac2::askfirst:-/bin/sh::ctrlaltdel:/sbin/reboot::shutdown:/bin/umount-a-R
Etc/init.d/rcs
#!/bin/shifconfig eth0 192.168.6.4mount-amkdir/dev/ptsmount-t devpts devpts/dev/ptsecho/sbin/mdev >/proc/sys/ker Nel/hotplug<p>echo 0 >/proc/sys/kernel/hung_task_timeout_secs</p> mdev-s
Etc/initab
# dev mount type options dump fsck orderproc /proc proc defaults 0 0TMPFS /tmp tmpfs defaults 0 0sysfs /sys sysfs defaults 0 0TMPFS / Dev tmpfs defaults 0 0
In addition, you need to create a/dev folder. Then create the two device files below
Mknod Consol C 5 1
Mknod NULL C 1 3
F. Start the Development Board Uboot modify the startup parameters as follows:
Set Bootargs console=ttysac2,115200 init=/linuxrc rootfstype=ext4 root=/dev/nfs rw nfsroot=192.168.6.2:/work/nfs_sys/ Mini_sys Ip=192.168.6.4:192.168.6.2:192.168.6.1:255.255.255.0:ruoyun:eth0:off
If OK, you can save the environment variables, each boot can be directly linked to the file system.
G. Creating the remaining directories
mkdir proc MNT tmp sys root
H. If you can enter the system smoothly, see this sentence please press Enter to activate the this console. So congratulations on your success. Test to create a file, see whether the virtual machine and the Development Board is synchronized (note do not create under the TMP folder, I found in this folder, the data can not be synchronized, do not know what reason)
3. Write the first driver
A. Writing driver files
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h>static int hello_init ( void) {PRINTK (kern_alert "Hello world.\n"); return 0;} static void Hello_exit (void) {PRINTK (kern_alert "Exit Hello world.\n");} Module_init (Hello_init); Module_exit (Hello_exit); Module_license ("GPL");
B. Writing makefile
Kern_dir =/work/kernel/itop/itop4412_kernel_3.0all:make-c $ (kern_dir) m= ' pwd ' modules clean:make-c $ (KERN_DIR) M= ' pwd ' Modules Cleanrm-rf modules.orderobj-m+= HELLO_DRV.O
C. Testing
Make the. ko file on the virtual machine first. Then place the. ko file in the network file system launched by the board and Insmod
If Hello world appears. Then it proves that you have succeeded.
And then Rmmod, there was a mistake when I was doing it. As follows:
Rmmod:can ' t change directory to '/lib/modules ': No such file or directory
The solution is mkdir/lib/modules/3.0.15 (the last one is your kernel version number)
If Rmmod appears, exit Hello World. Well, congratulations on your success.
Here the environment has been set up, we can continue to the next drive to learn, follow-up I will continue to write some drive-related articles.
Development Board software Environment of embedded environment construction