1.下载编译工具gcc-4.9.3-64-gnu.tar.gz并解压
Index of /embedd/ls3a/toolchain (loongnix.cn)
解压命令 sudo tar -zxvf gcc-4.9.3-64-gnu.tar.gz -C /
2.下载buildroot工具并解压
Index of /embedd/ls2h/buildroot (loongnix.cn)
解压命令sudo tar -zxvf buildroot.tar.gz
创建编译脚本cmd.sh
------------------------------------------------------------------------------------
#! /bin/bash
export LANG=C
export PATH=/opt/gcc-4.9.3-64-gnu/bin/:$PATH
make ARCH=mips CROSS_COMPILE=mips64el-linux- -j8
-----------------------------------------------------------------------------------
修改权限 sudo chmod 777 -f cmd.sh
3.配置编译选项
3.1 cp ls2k_docker-systemd-gcc-4.9.3.config .config
3.2 make menuconfig
3.2.1Target options —>
配置CPU参数 小端 MIPS64
3.2.2Toolchain —>
添加默认工具链 gcc-4.9.3-64-gun
3.2.3System configuration —>
root password是登录后的密码,默认的用户名是root,添加密码root
3.2.4Run a getty (login prompt) after boot —>
配置打印串口ttyS0和波特率
3.2.5Kernel —>
这里我们不编译
3.2.6Target packages —>
选择需要的工具 ,我们添加net-tool openssh vim nano opkg
配置修改如下
4.构建./cmd.sh
构建完成:
5.编译过程中出现错误
checking size of unsigned long... 8
checking size of mp_limb_t... 8
configure: error: Oops, mp_limb_t is 64 bits, but the assembler code
in this configuration expects 32 bits.
You appear to have set $CFLAGS, perhaps you also need to tell GMP the
intended ABI, see "ABI and ISA" in the manual.
package/pkg-generic.mk:219: recipe for target '/home/ubuntu/Pictures/buildroot/output/build/gmp-6.1.2/.stamp_configured' failed
make[1]: *** [/home/ubuntu/Pictures/buildroot/output/build/gmp-6.1.2/.stamp_configured] Error 1
Makefile:84: recipe for target '_all' failed
make: *** [_all] Error 2
./configure
make
sudo make install