海运的博客

编译ubuntu/centos内核bbrplus

发布时间:December 14, 2019 // 分类: // 2 Comments

安装编译环境

yum install -y ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel rpm-build
yum install -y dpkg-dev #生成deb包依赖

ubuntu下:

apt install build-essential libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf

下载4.14版内核:

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.158.tar.xz
tar xf linux-4.14.158.tar.xz

patch:

diff -urN aa/include/net/inet_connection_sock.h bb/include/net/inet_connection_sock.h
--- aa/include/net/inet_connection_sock.h       2019-12-14 17:07:48.190502969 +0800
+++ bb/include/net/inet_connection_sock.h       2019-12-14 17:08:06.373215456 +0800
@@ -136,8 +136,8 @@
        } icsk_mtup;
        u32                       icsk_user_timeout;
 
-       u64                       icsk_ca_priv[88 / sizeof(u64)];
-#define ICSK_CA_PRIV_SIZE      (11 * sizeof(u64))
+       u64                       icsk_ca_priv[112 / sizeof(u64)];
+#define ICSK_CA_PRIV_SIZE      (14 * sizeof(u64))
 };
 
 #define ICSK_TIME_RETRANS      1       /* Retransmit timer */
diff -urN aa/net/ipv4/Makefile bb/net/ipv4/Makefile
--- aa/net/ipv4/Makefile        2019-12-14 17:09:40.204731772 +0800
+++ bb/net/ipv4/Makefile        2019-12-14 17:09:47.147621995 +0800
@@ -44,7 +44,7 @@
 obj-$(CONFIG_INET_UDP_DIAG) += udp_diag.o
 obj-$(CONFIG_INET_RAW_DIAG) += raw_diag.o
 obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o
-obj-$(CONFIG_TCP_CONG_BBR) += tcp_bbr.o
+obj-$(CONFIG_TCP_CONG_BBR) += tcp_bbrplus.o
 obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
 obj-$(CONFIG_TCP_CONG_CDG) += tcp_cdg.o
 obj-$(CONFIG_TCP_CONG_CUBIC) += tcp_cubic.o
diff -urN aa/net/ipv4/tcp_output.c bb/net/ipv4/tcp_output.c
--- aa/net/ipv4/tcp_output.c    2019-12-14 17:08:48.488549518 +0800
+++ bb/net/ipv4/tcp_output.c    2019-12-14 17:08:55.061445594 +0800
@@ -1834,6 +1834,7 @@
 
        return !after(end_seq, tcp_wnd_end(tp));
 }
+EXPORT_SYMBOL(tcp_snd_wnd_test);
 
 /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet
  * which is put after SKB on the list.  It is very much like

下载tcp_bbrplus源码:

wget -P net/ipv4/ https://raw.githubusercontent.com/cx9208/bbrplus/master/tcp_bbrplus.c

打开编译选项并开启编译bbr为模块:

make menuconfig

禁用签名调试:

scripts/config --disable MODULE_SIG
scripts/config --disable DEBUG_INFO

编译内核生成centos rpm或ubuntu deb包,注意如果使用make rpm-pkg则每次编译前会先clean,如果重复编译会很慢!

make binrpm-pkg -j4
make bindeb-pkg -j4 

开启bbrplus:

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbrplus" >> /etc/sysctl.conf
sysctl -p

ubuntu系统禁止更新内核:

for pkg in $(dpkg -l|awk '/linux-(generic|headers|image|libc|modules)/{print $2}');do 
echo $pkg; 
apt-mark hold $pkg;
done

https://github.com/cx9208/bbrplus
https://blog.csdn.net/dog250/article/details/80629551

标签:none

有 2 条 关于" 编译ubuntu/centos内核bbrplus "的评论

  1. bbr bbr

    大佬,请问debian9编译错误怎么解决? github有人提问,没人解答,只好来这里看看.

    prefix ## suffix(); \
    ^~~~~~
    ./include/linux/compiler.h:331:2: note: in expansion of macro ‘_compiletime_assert’
    _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
    ^~~~~~~~~~~~~~~~~~~
    ./include/linux/build_bug.h:47:37: note: in expansion of macro ‘compiletime_assert’
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
    ^~~~~~~~~~~~~~~~~~
    ./include/linux/build_bug.h:71:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
    BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
    ^~~~~~~~~~~~~~~~
    net/ipv4/tcp_bbrplus.c:1155:5: note: in expansion of macro ‘BUILD_BUG_ON’
    BUILD_BUG_ON(sizeof(struct bbr) > ICSK_CA_PRIV_SIZE);

    1. 海运 海运

      不清楚,可尝试使用ubuntu18.04系统按本文方法编译试试。

发表评论

分类
最新文章
最近回复
  • mingyu wen: 写的让我豁然开朗,但请问这句什么意思:有状态的+无状态的,使用dhcpv6有状态分配地址,同时...
  • alex heryy: Androidblue
  • 海运: 不清楚,可尝试使用ubuntu18.04系统按本文方法编译试试。
  • bbr: 大佬,请问debian9编译错误怎么解决? github有人提问,没人解答,只好来这里看看.p...
  • 田博: 如果dts中没有USB信息,这样也能装上?
  • 海运: 正常情况下编译整个内核执行make menuconfig后就不会出现此提示,当单独编译单个模块...
  • oijq: 就是用的armbian的配置文件哈,按你的教程做的,在执行make LOCALVERSION=...
  • 海运: 使用armbian的配置文件,其它添加或修改自己懂的部分,不懂的就不要碰了。
  • oijq: 编译时这些选项全部选Y吗? Actions Semi Platforms (ARCH_ACTI...
  • 海运: n1编译bbr内核模块参考这个:https://www.haiyun.me/archives/...