概述
ubuntu12.10下编译Android4.0内核源代码
1.问题:
kernel/power/consoleearlysuspend.c:28:2: error: implicit declaration of function 'acquire_console_sem'
2.解决方法:
修改源代码根目录下kernel/power/consoleearlysuspend.c文件,将acquire_console_sem()与release_console_sem()函数分别换为console_lock()与console_unlock()函数
3.分析:
函数acquire_console_sem()与release_console_sem()用来获得和释放互斥锁console_sem;新内核下这两个函数变成console_lock()与console_unlock(),故替换之便OK.
4.附:console_lock()与console_unlock()函数位置:内核源代码根目录下kernel/printk.c文件1222行
/**
* console_lock - lock the console system for exclusive use.
*
* Acquires a lock which guarantees that the caller has
* exclusive access to the console system and the console_drivers list.
*
* Can sleep, returns nothing.
*/
void console_lock(void)
{
BUG_ON(in_interrupt());
down(&console_sem);
if (console_suspended)
return;
console_locked = 1;
console_may_schedule = 1;
}
EXPORT_SYMBOL(console_lock);
/**
* console_unlock - unlock the console system
*
* Releases the console_lock which the caller holds on the console system
* and the console driver list.
*
* While the console_lock was held, console output may have been buffered
* by printk(). If this is the case, console_unlock(); emits
* the output prior to releasing the lock.
*
* If there is output waiting for klogd, we wake it up.
*
* console_unlock(); may be called from any context.
*/
void console_unlock(void)
{
unsigned long flags;
unsigned _con_start, _log_end;
unsigned wake_klogd = 0;
if (console_suspended) {
up(&console_sem);
return;
}
console_may_schedule = 0;
for ( ; ; ) {
spin_lock_irqsave(&logbuf_lock, flags);
wake_klogd |= log_start - log_end;
if (con_start == log_end)
break; /* Nothing to print */
_con_start = con_start;
_log_end = log_end;
con_start = log_end; /* Flush */
spin_unlock(&logbuf_lock);
stop_critical_timings(); /* don't trace print latency */
call_console_drivers(_con_start, _log_end);
start_critical_timings();
local_irq_restore(flags);
}
console_locked = 0;
/* Release the exclusive_console once it is used */
if (unlikely(exclusive_console))
exclusive_console = NULL;
up(&console_sem);
spin_unlock_irqrestore(&logbuf_lock, flags);
if (wake_klogd)
wake_up_klogd();
}
EXPORT_SYMBOL(console_unlock);
最后
以上就是昏睡鸵鸟为你收集整理的error: implicit declaration of function 'acquire_console_sem'错误解决方法的全部内容,希望文章能够帮你解决error: implicit declaration of function 'acquire_console_sem'错误解决方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复