一、设置环境变量:
1、永久设置修改PATH:
book@book-desktop:/work/other_board/gcc-3.4.5-glibc-2.3.6/bin$ sudo vi /etc/environment
2、修改必须是下次重启系统之后才起作用,立即生效使用如下两种方式:
方式一:
book@book-desktop:/$ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/work/other_board/gcc-3.4.5-glibc-2.3.6/bin
方式二:
book@book-desktop:/$ export PATH=$PATH:/work/other_board/gcc-3.4.5-glibc-2.3.6/bin
3、查看设置PATH是否设置:
book@book-desktop:/$ echo $PATH
4、查看是否编译环境安装是否成功:
book@book-desktop:/$ arm-linux-gcc-v
二、find和grep
find命令是一个无处不在命令,是linux中最有用的命令之一。find命令用于:在一个目录(及子目录)中搜索文件,你可以指定一些匹配条件,如按文件名、文件类型、用户甚至是时间戳查找文件。下面就通过实例来体验下find命令的强大。
grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。
find /dir -name filename 在/dir目录及其子目录下面查找名字为filename的文件
find . -name “*.c” 在当前目录及其子目录(用“.”表示)中查找任何扩展名为“c”的文件
find -name “defconfig” 查找默认配置可以发现默认配置在././arch/arm/configs/下
grep “CONFIG_DM9000” * -nwR
grep ““Boot\ Agent”” * -nR
arch/arm/mach-s3c24xx/common-smdk.c:113: .name = “Boot Agent”,
三、制作补丁和使用补丁
1、举例说明
制作内核补丁:
book@book-desktop:/work/system/linux-3.4.2$ cp .config config_ok
book@book-desktop:/work/system/linux-3.4.2$ make distclean
book@book-desktop:/work/system/linux-3.4.2$ cd …
book@book-desktop:/work/system$ mv linux-3.4.2 linux-3.4.2_100ask
book@book-desktop:/work/system$ tar xjf linux-3.4.2.tar.bz2
book@book-desktop:/work/system$ diff -urN linux-3.4.2 linux-3.4.2_100ask > linux-3.4.2_100ask.patch
使用内核补丁:
book@book-desktop:/work/system$ cd linux-3.4.2
book@book-desktop:/work/system/linux-3.4.2$ patch -p1 < …/linux-3.4.2_100ask.patch
book@book-desktop:/work/system/linux-3.4.2$ cp config_ok .config
book@book-desktop:/work/system/linux-3.4.2$ make uImage
四、nfs使用
NFS,文件系统是放在服务器上的
1、配置开发板IP
ifconfig eth0 up
ifconfig
ifconfig eth0 192.168.1.11
ping 192.168.1.51
PING 192.168.1.51 (192.168.1.51): 56 data bytes
64 bytes from 192.168.1.51: seq=0 ttl=64 time=5.073 ms
2、手工挂接
a、从flash上启动根文件系统,再用命令挂接NFS
挂接NFS条件:①服务器“允许”那个目录可被挂接
②单板去挂接
book@book-desktop:/work/nfs_root/first_fs$ sudo vi /etc/exports
/work/nfs_root/first_fs *(rw,sync,no_root_squash)
重启
book@book-desktop:/work/nfs_root/first_fs$ sudo /etc/init.d/nfs-kernel-server restart
实验自己挂接自己:
book@book-desktop:/work/nfs_root/first_fs$ sudo mount -t nfs 192.168.1.51:/work/nfs_root/first_fs /mnt
单板挂接:
mkdir /mnt
mount -t nfs -o nolock 192.168.1.51:/work/nfs_root/first_fs /mnt
ls /mnt
bin etc linuxrc sbin usr
dev lib proc sys
比如我们在/work/nfs_root/first_fs下创建一个文件,在单板上能够立刻看到这个文件:
book@book-desktop:/work/nfs_root/first_fs$ echo hello > test.txt
book@book-desktop:/work/nfs_root/first_fs$ ls
bin dev etc lib linuxrc proc sbin sys test.txt usr
ls /mnt
bin etc linuxrc sbin test.txt
dev lib proc sys usr
cat /mnt/test.txt
hello
b、直接从NFS启动:
NFS启动参数:①服务器IP,目录。 ②
重启可以看到启动参数:
bootargs=noinitrd root=/dev/mtdblock3 rootfstype=jffs2 init=/linuxrc console=ttySAC0
修改启动参数:在linux-2.6.22.6\Documentation的nfsroot.txt里面有参数的说明
nfsroot=[:][,]
ip=::::::
bootargs noinitrd root=/dev/nfs nfsroot=192.168.1.51:/work/nfs_root/first_fs ip=192.168.1.11:192.168.1.51:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0
OpenJTAG> set bootargs noinitrd root=/dev/nfs nfsroot=192.168.1.51:/work/nfs_root/first_fs ip=192.168.1.11:192.168.1.51:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0
OpenJTAG> save
OpenJTAG> boot
到这里网络文件系统已经搭建好了,这样你可以在服务器上面编辑代码,编译,然后在单板上面运行了。
20170418:
nfs错误问题
nfs:server is not responding, still trying
原因:具有较高的传送速率的NFS主机网卡和较低速率的目标机网卡之间不匹配,要解决此问题需要在挂载文件系统时添加额外的参数
解决方法:
mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.3.106:/home/book/nfs /mnt
参数解释:
intr – 当服务器宕机或者无法到达时,允许中断NFS请求。 nolock–禁用文件锁。 rsize = 8192 和 wsize=8192 – 通过设定大的同时传输的数据块大小(bytes),以提高NFS读写的速度。改变这些值时要当心,一些旧的linux内核和网卡在大的块大小不能正常工作。
作者:kuangdoushi
来源:CSDN
原文:https://blog.csdn.net/kuangdoushi/article/details/55094706
版权声明:本文为博主原创文章,转载请附上博文链接!