1、编译机环境:
Dell T30 塔式服务器
ubuntu 20.04 稳定版
交叉编译
2、编译错误
(1)make[3]: *** [scripts/Makefile.build:309:net/ipv4/netfilter/ipt_ECN.o] 错误 1
root@T30:/home/george/tx/version# /bin/bash mk.sh build uosdesktop 2>&1 >/dev/null
In file included from ./include/uapi/linux/netfilter_ipv4/ipt_ECN.h:14:0,
from net/ipv4/netfilter/ipt_ECN.c:20:
./include/uapi/linux/netfilter/xt_DSCP.h:14:10: fatal error: linux/netfilter/xt_dscp.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:309:net/ipv4/netfilter/ipt_ECN.o] 错误 1
make[2]: *** [scripts/Makefile.build:544:net/ipv4/netfilter] 错误 2
make[2]: *** 正在等待未完成的任务....
make[1]: *** [scripts/Makefile.build:544:net/ipv4] 错误 2
make: *** [Makefile:1052:net] 错误 2
make: *** 正在等待未完成的任务....
dpkg-buildpackage: 警告: 使用超级用户命令
dpkg-architecture: 警告: specified GNU system type mips64el-linux-gnuabi64 does not match CC system type mips-linux-gnu, try setting a correct CC environment variable
dpkg-source --before-build .
debian/rules build
In file included from ./include/uapi/linux/netfilter_ipv4/ipt_ECN.h:14:0,
from net/ipv4/netfilter/ipt_ECN.c:20:
./include/uapi/linux/netfilter/xt_DSCP.h:14:10: fatal error: linux/netfilter/xt_dscp.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:309:net/ipv4/netfilter/ipt_ECN.o] 错误 1
make[5]: *** [scripts/Makefile.build:544:net/ipv4/netfilter] 错误 2
make[5]: *** 正在等待未完成的任务....
make[4]: *** [scripts/Makefile.build:544:net/ipv4] 错误 2
make[3]: *** [Makefile:1052:net] 错误 2
make[3]: *** 正在等待未完成的任务....
make[2]: *** [debian/rules:4:build] 错误 2
dpkg-buildpackage: 错误: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/package/Makefile:80:bindeb-pkg] 错误 2
make: *** [Makefile:1365:bindeb-pkg] 错误 2
解决方法:
sudo cp linux-4.19.134/include/uapi/linux/netfilter/xt_dscp.h loongson_kernel/include/uapi/linux/netfilter/xt_dscp.h
sudo cp linux-4.19.134/net/netfilter/xt_dscp.c loongson_kernel/net/netfilter/xt_dscp.c
(2) make[5]: *** 没有规则可制作目标“net/netfilter/xt_hl.c”,由“net/netfilter/xt_hl.o” 需求。 停止。
/bin/bash mk.sh build uosdesktop 2>&1 >/dev/null
make[2]: *** 没有规则可制作目标“net/netfilter/xt_hl.c”,由“net/netfilter/xt_hl.o” 需求。 停止。
make[1]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[1]: *** 正在等待未完成的任务....
make: *** [Makefile:1052:net] 错误 2
dpkg-buildpackage: 警告: 使用超级用户命令
dpkg-architecture: 警告: specified GNU system type mips64el-linux-gnuabi64 does not match CC system type mips-linux-gnu, try setting a correct CC environment variable
dpkg-source --before-build .
debian/rules build
make[5]: *** 没有规则可制作目标“net/netfilter/xt_hl.c”,由“net/netfilter/xt_hl.o” 需求。 停止。
make[4]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[4]: *** 正在等待未完成的任务....
make[3]: *** [Makefile:1052:net] 错误 2
make[2]: *** [debian/rules:4:build] 错误 2
dpkg-buildpackage: 错误: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/package/Makefile:80:bindeb-pkg] 错误 2
make: *** [Makefile:1365:bindeb-pkg] 错误 2
解决方法:
sudo cp linux-4.19.134/net/netfilter/xt_hl.c loongson_kernel/net/netfilter/xt_hl.c
(3) make[5]: *** 没有规则可制作目标“net/netfilter/xt_rateest.c”,由“net/netfilter/xt_rateest.o” 需求。 停止。
sudo /bin/bash mk.sh build uosdesktop 2>&1 >/dev/null
[sudo] george 的密码:
make[2]: *** 没有规则可制作目标“net/netfilter/xt_rateest.c”,由“net/netfilter/xt_rateest.o” 需求。 停止。
make[1]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[1]: *** 正在等待未完成的任务....
make: *** [Makefile:1052:net] 错误 2
make: *** 正在等待未完成的任务....
dpkg-buildpackage: 警告: 使用超级用户命令
dpkg-architecture: 警告: specified GNU system type mips64el-linux-gnuabi64 does not match CC system type mips-linux-gnu, try setting a correct CC environment variable
dpkg-source --before-build .
debian/rules build
make[5]: *** 没有规则可制作目标“net/netfilter/xt_rateest.c”,由“net/netfilter/xt_rateest.o” 需求。 停止。
make[4]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[3]: *** [Makefile:1052:net] 错误 2
make[3]: *** 正在等待未完成的任务....
make[2]: *** [debian/rules:4:build] 错误 2
dpkg-buildpackage: 错误: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/package/Makefile:80:bindeb-pkg] 错误 2
make: *** [Makefile:1365:bindeb-pkg] 错误 2
解决方法:
sudo cp linux-4.19.134/net/netfilter/xt_rateest.c loongson_kernel/net/netfilter/xt_rateest.c
(4) make[5]: *** 没有规则可制作目标“net/netfilter/xt_tcpmss.c”,由“net/netfilter/xt_tcpmss.o” 需求。 停止。
sudo /bin/bash mk.sh build uosdesktop 2>&1 >/dev/null
make[2]: *** 没有规则可制作目标“net/netfilter/xt_tcpmss.c”,由“net/netfilter/xt_tcpmss.o” 需求。 停止。
make[1]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[1]: *** 正在等待未完成的任务....
make: *** [Makefile:1052:net] 错误 2
make: *** 正在等待未完成的任务....
dpkg-buildpackage: 警告: 使用超级用户命令
dpkg-architecture: 警告: specified GNU system type mips64el-linux-gnuabi64 does not match CC system type mips-linux-gnu, try setting a correct CC environment variable
dpkg-source --before-build .
debian/rules build
make[5]: *** 没有规则可制作目标“net/netfilter/xt_tcpmss.c”,由“net/netfilter/xt_tcpmss.o” 需求。 停止。
make[4]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[4]: *** 正在等待未完成的任务....
make[3]: *** [Makefile:1052:net] 错误 2
make[3]: *** 正在等待未完成的任务....
make[2]: *** [debian/rules:4:build] 错误 2
dpkg-buildpackage: 错误: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/package/Makefile:80:bindeb-pkg] 错误 2
make: *** [Makefile:1365:bindeb-pkg] 错误 2
解决方法:
sudo cp linux-4.19.134/net/netfilter/xt_tcpmss.c loongson_kernel/net/netfilter/xt_tcpmss.c
**(5) **
sudo /bin/bash mk.sh build uosdesktop 2>&1 >/dev/null
net/netfilter/xt_mark.c:16:10: fatal error: linux/netfilter/xt_mark.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:309:net/netfilter/xt_mark.o] 错误 1
make[2]: *** 正在等待未完成的任务....
make[1]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[1]: *** 正在等待未完成的任务....
make: *** [Makefile:1052:net] 错误 2
dpkg-buildpackage: 警告: 使用超级用户命令
dpkg-architecture: 警告: specified GNU system type mips64el-linux-gnuabi64 does not match CC system type mips-linux-gnu, try setting a correct CC environment variable
dpkg-source --before-build .
debian/rules build
net/netfilter/xt_mark.c:16:10: fatal error: linux/netfilter/xt_mark.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [scripts/Makefile.build:309:net/netfilter/xt_mark.o] 错误 1
make[4]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make[3]: *** [Makefile:1052:net] 错误 2
make[3]: *** 正在等待未完成的任务....
make[2]: *** [debian/rules:4:build] 错误 2
dpkg-buildpackage: 错误: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/package/Makefile:80:bindeb-pkg] 错误 2
make: *** [Makefile:1365:bindeb-pkg] 错误 2
解决方法:
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_mark.h loongson-kernel/include/uapi/linux/netfilter/xt_mark.h
(6)
george@T30:~/tx/version$ sudo /bin/bash mk.sh build uosdesktop 2>&1 >/dev/null
net/netfilter/xt_connmark.c:28:10: fatal error: linux/netfilter/xt_connmark.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:309:net/netfilter/xt_connmark.o] 错误 1
make[2]: *** 正在等待未完成的任务....
make[1]: *** [scripts/Makefile.build:544:net/netfilter] 错误 2
make: *** [Makefile:1052:net] 错误 2
make: *** 正在等待未完成的任务....
dpkg-buildpackage: 警告: 使用超级用户命令
dpkg-architecture: 警告: specified GNU system type mips64el-linux-gnuabi64 does not match CC system type mips-linux-gnu, try setting a correct CC environment variable
解决方法:
sudo cp ../linux-4.19.134/net/netfilter/xt_rateest.c loongson_kernel/net/netfilter/xt_rateest.c
sudo cp ../linux-4.19.134/net/netfilter/xt_tcpmss.c loongson_kernel/net/netfilter/xt_tcpmss.c
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_connmark.h loongson-kernel/include/uapi/linux/netfilter/xt_connmark.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter_ipv4/ipt_ecn.h loongson-kernel/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter_ipv4/ipt_ttl.h loongson-kernel/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter_ipv6/ip6t_hl.h loongson-kernel/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_rateest.h loongson-kernel/include/uapi/linux/netfilter/xt_rateest.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_tcpmss.h loongson-kernel/include/uapi/linux/netfilter/xt_tcpmss.h
3、总结一下
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_dscp.h loongson_kernel/include/uapi/linux/netfilter/xt_dscp.h
sudo cp ../linux_version/linux-4.19.134/net/netfilter/xt_hl.c loongson_kernel/net/netfilter/xt_hl.c
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_mark.h loongson-kernel/include/uapi/linux/netfilter/xt_mark.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_connmark.h loongson-kernel/include/uapi/linux/netfilter/xt_connmark.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter_ipv4/ipt_ecn.h loongson-kernel/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter_ipv4/ipt_ttl.h loongson-kernel/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter_ipv6/ip6t_hl.h loongson-kernel/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_rateest.h loongson-kernel/include/uapi/linux/netfilter/xt_rateest.h
sudo cp ../linux_version/linux-4.19.134/include/uapi/linux/netfilter/xt_tcpmss.h loongson-kernel/include/uapi/linux/netfilter/xt_tcpmss.h
4、最后,内核版本编译成功
root@T30:/home/george/tx/version# tree -L 1
.
├── linux-headers-4.19.0-loongson-3-desktop_4.19.90-1_mips64el.deb
├── linux-image-4.19.0-loongson-3-desktop_4.19.90-1_mips64el.deb
├── linux-image-4.19.0-loongson-3-desktop-dbg_4.19.90-1_mips64el.deb
├── linux-libc-dev_4.19.90-1_mips64el.deb
├── loongson-kernel
└── mk.sh