本文共 3497 字,大约阅读时间需要 11 分钟。
地址:
将下载的bash压缩包解压,命令:
$ mkdir /home/hui.zhang/w/tmp/shell/ # 创建bash工作目录$ cp bash-4.3.tar.gz /home/hui.zhang/w/tmp/shell/ # 复制安装包$ cd /home/hui.zhang/w/tmp/shell/ # 进入/home/veryarm/bash目录$ tar zxvf bash-4.3.tar.gz # 解压
编译之前,要进行配置,命令:
$ mkdir install # 创建安装目录$ cd bash-4.3# 进入目录$ export PATH=$PATH:/opt/gcc-linaro-arm-linux-gnueabihf/bin# 添加交叉编译器路径到PATH环境变量中,最好用与编译内核用的交叉编译器版本一致$ ./configure CC=arm-linux-gnueabihf-gcc --prefix=/home/hui.zhang/w/tmp/shell/install --host=arm-linux --target=arm-linux-gnueabihf --enable-static-link --enable-history --without-bash-malloc --cache-file=arm-linux.cache
编译并安装:
$ make & make install
安装成功后在安装路径/home/hui.zhang/w/tmp/shell/istall下生成两个目录 bin 和 share,将bin中的 bash 可执行文件复制至开发板 /bin 中,并修改执行权限:
root@k200:/ #cp bash /bin root@k200:/ #chmod +x /bin/bash
在开发板中运行bash
root@k200:/ #bash bash-4.3#
在开发版中运行相关脚本(hello world):
root@k200:/ # cat /data/test.sh #!/system/bin/bashecho hello world!root@k200:/ # chmod 755 /data/test.sh root@k200:/ # /data/test.sh hello world!root@k200:/ #
恭喜,移植成功!
$ ./configure CC=arm-linux-gnueabihf-gcc --prefix=/home/hui.zhang/w/tmp/shell/install --host=arm-linux --target=arm-linux-gnueabihf --enable-static-link --enable-history --without-bash-malloc
$ ./configure CC=arm-linux-gnueabihf-gcc --prefix=/home/hui.zhang/w/tmp/shell/install --host=arm-linux --target=arm-linux-gnueabihf --enable-static-link --enable-history --without-bash-malloc --cache-file=arm-linux.cache
root@k200:/ #bash segment fault
转载地址:http://nwcoi.baihongyu.com/