提供一个32bit(arm)系统下的安装经验供参考
Mumumu4 opened this issue · comments
手上有一个运行32bit debian的 arm 旧板子,尝试安装的时候报错:
ERROR: modpost: "__aeabi_uldivmod" [/123/tcp-brutal/brutal.ko] undefined!
ERROR: modpost: "__aeabi_ldivmod" [/123/tcp-brutal/brutal.ko] undefined!
google后参考了以下链接(1, 2)修改后可以正常编译通过
diff --git a/brutal.c b/brutal.c
index 98eebf1..7f56cfa 100644
--- a/brutal.c
+++ b/brutal.c
@@ -1,6 +1,7 @@
#include <linux/module.h>
#include <linux/version.h>
#include <net/tcp.h>
+#include <linux/math64.h>
#if IS_ENABLED(CONFIG_IPV6) && LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
#include <net/transp_v6.h>
@@ -36,19 +37,19 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
u64 tcp_sock_get_sec(const struct tcp_sock *tp)
{
- return tp->tcp_mstamp / USEC_PER_SEC;
+ return div_u64(tp->tcp_mstamp, USEC_PER_SEC);
}
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
// see https://github.com/torvalds/linux/commit/9a568de4818dea9a05af141046bd3e589245ab83
u64 tcp_sock_get_sec(const struct tcp_sock *tp)
{
- return tp->tcp_mstamp.stamp_us / USEC_PER_SEC;
+ return div_u64(tp->tcp_mstamp.stamp_us, USEC_PER_SEC);
}
#else
#include <linux/jiffies.h>
u64 tcp_sock_get_sec(const struct tcp_sock *tp)
{
- return jiffies_to_usecs(tcp_time_stamp) / USEC_PER_SEC;
+ return div_u64(jiffies_to_usecs(tcp_time_stamp), USEC_PER_SEC);
}
#endif
@@ -214,10 +215,10 @@ static void brutal_update_rate(struct sock *sk)
}
rate *= 100;
- rate /= ack_rate;
+ rate = div_u64(rate, ack_rate);
// The order here is chosen carefully to avoid overflow as much as possible
- cwnd = rate / MSEC_PER_SEC;
+ cwnd = div_u64(rate, MSEC_PER_SEC);
cwnd *= rtt_ms;
cwnd /= mss;
cwnd *= brutal->cwnd_gain;
本地修改后的文件安装成 dkms 模块:
make dkms-tarball
./scripts/install_dkms.sh -l dkms.tar.gz
可以正常加载,还不知道之后会不会炸
折腾过程记录在这,也许能帮到遇到相同问题的后来者,虽然现在32位的设备似乎越来越少了
我认为这个 patch 可以合入主分支, 能否发个 Pull Request?