文件系统的制作(ubuntu系统和天嵌TQ2440板子)
1、制作脚本
在目录 /home/zxj/ENV/zxj_nfs 的目录下面创建脚本文件, sudo gedit helprootfs.sh
在helprootfs.sh的文件下面添加以下代码
#!/bin/sh
echo "-----Create rootfs directors...."
mkdir my_fs
cd my_fs
echo "------Create root,dev....."
mkdir root dev etc mnt sys proc lib home tmp var usr
mkdir mnt/usb mnt/nfs mnt/jffs2 mnt/yaffs mnt/temp
mkdir usr/sbin usr/bin usr/lib usr/modules etc/init.d
mkdir lib/modules
chmod 1777 tmp
cd ../
echo "--------make directors done-------"
再设置权限
chmod +x helprootfs.sh
然后运行脚本<pre name="code" class="html">./helprootfs.sh
然后进入到my_fs文件夹
cd my_fs
sudo mknod -m 600 dev/console c 5 1
sudo mknod -m 660 dev/null c 3 1
进入到busybox 源码根目录 /home/zxj/tools/opt/EmbedSky/busybox-1.16.0
执行make menuconfig
Busybox Settings --->Build Options --->[*] Build BusyBox as a static binary (no shared libs)
将路径改为
/home/zxj/tools/opt/EmbedSky/crosstools_3.4.5_softfloat/gcc-3.4.5-glibc-2.3.6/arm-linux/bin/arm-linux-
Busybox Settings ---> Busybox Library Tuning [*]Username completion [*]Fancy shell prompts
Miscellaneous Utilities --->[ ] ionice
make CONFIG_PREFIX=/home/zxj/ENV/zxj_nfs/my_fs install
将/2440/Linux资源/Linux源码包/2.6.30.4/root_TQ2440_PDA_20121214.tar解压 tar vxf root_TQ2440_PDA_20121214.tar
将/home/zxj/tools/opt/EmbedSky/root_TQ2440_PDA/etc中的所有文件复制到/home/zxj/ENV/zxj_nfs/my_fs/etc下面
<pre name="code" class="html"><span style="white-space:pre"> </span>cd /home/zxj/ENV/zxj_nfs/my_fs/lib
<span style="white-space:pre"> </span>cp -r /home/zxj/tools/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/libc/lib/*.so* ./
因为系统默认的目录fs-base需要把自己的文件my_fs夹改名字成fs-base,
/home/zxj/ENV/zxj_nfs/my_fs
或者 sudo gedit /etc/exports
在最后一行加上 /home/zxj/ENV/zxj_nfs/my_fs *(rw,sync,no_root_squash)
然后执行重启NFS 命令
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart
NFS文件系统的挂载
##### Boot for Nor Flash Main Menu #####
##### EmbedSky USB download mode #####
[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash
[2] Download Eboot (eboot.nb0) to Nand Flash
[3] Download Linux Kernel (zImage.bin) to Nand Flash
[5] Download CRAMFS image to Nand Flash
[6] Download YAFFS image (root.bin) to Nand Flash
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it
[8] Boot the system
[9] Format the Nand Flash
[0] Set the boot parameters
[a] Download User Program (eg: uCOS-II or TQ2440_Test)
[b] Download LOGO Picture (.bin) to Nand Flash
[l] Set LCD Parameters
[n] Enter TFTP download mode menu
[o] Download u-boot to Nor Flash
[r] Reboot u-boot
[t] Test Linux Image (zImage)
[q] quit from menu
Enter your selection: 0
##### Parameter Menu #####
[1] Set NFS boot parameter
[2] Set Yaffs boot parameter
[3] Set parameter
[4] View the parameters
[d] Delete parameter
[s] Save the parameters to Nand Flash
[q] Return main Menu
Enter your selection: 1
Enter the PC IP address:(xxx.xxx.xxx.xxx) ------------- 虚拟机IP
172,.24.123.16
Enter the SKY2440/TQ2440 IP address:(xxx.xxx.xxx.xxx)
172.24.123.18
Enter the Mask IP address:(xxx.xxx.xxx.xxx)
255.255.0.0
Enter NFS directory:(eg: /opt/EmbedSky/root_nfs)
/home/zxj/ENV/zxj_nfs/my_fs
##### Parameter Menu #####
[1] Set NFS boot parameter
[2] Set Yaffs boot parameter
[3] Set parameter
[4] View the parameters
[d] Delete parameter
[s] Save the parameters to Nand Flash
[q] Return main Menu
Enter your selection: s
Saving Environment to NAND...
Erasing Nand...Writing to Nand... Done
[1] Set NFS boot parameter
[2] Set Yaffs boot parameter
[3] Set parameter
[4] View the parameters
[d] Delete parameter
[s] Save the parameters to Nand Flash
[q] Return main Menu
Enter your selection: q
##### Boot for Nand Flash Main Menu #####
##### EmbedSky USB download mode #####
[1] Download u-boot or STEPLDR.nb1 or other bootloader to Nand Flash
[2] Download Eboot (eboot.nb0) to Nand Flash
[3] Download Linux Kernel (zImage.bin) to Nand Flash
[5] Download CRAMFS image to Nand Flash
[6] Download YAFFS image (root.bin) to Nand Flash
[7] Download Program (uCOS-II or TQ2440_Test) to SDRAM and Run it
[8] Boot the system
[9] Format the Nand Flash
[0] Set the boot parameters
[a] Download User Program (eg: uCOS-II or TQ2440_Test)
[b] Download LOGO Picture (.bin) to Nand Flash
[l] Set LCD Parameters
[n] Enter TFTP download mode menu
[r] Reboot u-boot
[t] Test Linux Image (zImage)
[q] quit from menu
Enter your selection: 8
Start Linux ...
重启系统。。。
IP-Config: Complete:
device=eth0, addr=172.24.123.18, mask=255.255.0.0, gw=172.24.123.18,
host=SKY2440, domain=, nis-domain=embedsky.net,
bootserver=172.24.123.16, rootserver=172.24.123.16, rootpath=
Looking up port of RPC 100003/2 on 172.24.123.16
eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
Looking up port of RPC 100005/1 on 172.24.123.16
VFS: Mounted root (nfs filesystem) on device 0:11.
Freeing init memory: 240K
Warning: unable to open an initial console.
Please press Enter to activate this console.
[root@EmbedSky /]# ls
1111 dev home mnt root sys usr
bin etc lib proc sbin tmp var
说明文件系统已经搭载完毕。
测试交叉编写简单app
1.编写一个hello every one!的测试程序。
2.编译光盘资料里的app。
在虚拟机里的新建的文件系统里放一个测试程序,并且交叉编译。
然后./xx 运行。
碰到不断重启文件系统,需要在内核里把看门狗关掉,或者编译一个看门狗喂狗程序。
1.关闭内核里的看门狗
make menuconfig
Device Drivers --->
[*] Watchdog Timer Support --->
< > S3C2410 Watchdog
2.把光盘里的看门狗代码(2440\Linux资源\Linux源码包\apps_20121214.tar.bz2)进行交叉编译,再增加到开机启动文件里
cd EmbedSky_wdg/
ls
gedit Makefile
make clean
make
cp EmbedSky_wdg ../sbin/
gedit ../etc/init.d/rcS
编辑增加 EmbedSky_wdg &