尝试编译 Android 内核时出现以下错误,我不确定如何更改这部分代码来解决该错误。
CC net/netfilter/xt_IDLETIMER.o
net/netfilter/xt_IDLETIMER.c: In function ‘reset_timer’:
net/netfilter/xt_IDLETIMER.c:360:16: error: incompatible types when assigning to type ‘uid_t’ from type ‘kuid_t’
timer->uid = sk->sk_socket->file->f_cred->uid;
^
scripts/Makefile.build:257: recipe for target 'net/netfilter/xt_IDLETIMER.o' failed
make[2]: *** [net/netfilter/xt_IDLETIMER.o] Error 1
scripts/Makefile.build:402: recipe for target 'net/netfilter' failed
make[1]: *** [net/netfilter] Error 2
Makefile:937: recipe for target 'net' failed
make: *** [net] Error 2
我正在使用来自https://android.googlesource.com/kernel/common.git/+/android-3.18的 3.18 内核。我使用 make menuconfig 生成了一个默认的 .config,然后我合并了 Android 基础和 android/configs 文件夹中包含的推荐配置。执行 make bzImage 后,出现上述错误。
我正在运行 Ubuntu 14.10 和 gcc 4.9.1 的 ARM 机器(用于 ARM)上构建。
封闭函数的代码是:
static void reset_timer(const struct idletimer_tg_info *info,
struct sk_buff *skb)
{
unsigned long now = jiffies;
struct idletimer_tg *timer = info->timer;
bool timer_prev;
spin_lock_bh(×tamp_lock);
timer_prev = timer->active;
timer->active = true;
/* timer_prev is used to guard overflow problem in time_before*/
if (!timer_prev || time_before(timer->timer.expires, now)) {
pr_debug("Starting Checkentry timer (Expired, Jiffies): %lu, %lu\n",
timer->timer.expires, now);
/* Stores the uid resposible for waking up the radio */
if (skb && (skb->sk)) {
struct sock *sk = skb->sk;
read_lock_bh(&sk->sk_callback_lock);
if ((sk->sk_socket) && (sk->sk_socket->file) &&
(sk->sk_socket->file->f_cred))
timer->uid = sk->sk_socket->file->f_cred->uid;
read_unlock_bh(&sk->sk_callback_lock);
}
/* checks if there is a pending inactive notification*/
if (timer->work_pending)
timer->delayed_timer_trigger = timer->last_modified_timer;
else {
timer->work_pending = true;
schedule_work(&timer->work);
}
}
get_monotonic_boottime(&timer->last_modified_timer);
mod_timer(&timer->timer,
msecs_to_jiffies(info->timeout * 1000) + now);
spin_unlock_bh(×tamp_lock);
}