uclinux很久前笔记11

本文介绍了一个关于Linux内核中reboot命令失败的问题及其解决方案。通过修改arch_reset函数,实现了无需手动复位即可重启系统的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实现reboot命令

在不修改时执行reboot的效果为:

/> reboot

Restarting system.

mm-armv.c 315

Reboot failed --System halted

 

在sourceinsight中搜索Reboot failed -- System halted得出的结果为:

---- Rebootfailed -- System halted Matches (1 in 1 files) ----

Process.c(linux-2.4.x\arch\armnommu\kernel):   printk("Rebootfailed -- System halted\n");

void machine_restart(char* __unused)
{
       /*Cleanand disable cache, and turn off interrupts*/
       cpu_proc_fin();
       /*Tellthe mm system that we are going to reboot -
        * we may need it to insert some 1:1 mappingsso that
        * soft boot works.*/
       setup_mm_for_reboot(reboot_mode);
       /*Now call the architecture specific reboot code.*/
       arch_reset(reboot_mode);
       /*Whoops- the architecture was unable to reboot.
        * Tell the user!*/
       mdelay(1000);
       printk("Reboot failed -- System halted\n");
       while(1);
}

搜索arch_reset:

System.h (linux-2.4.x\include\asm-armnommu\arch-s3c44b0x):extern inline void arch_reset(charmode)

extern inline void arch_reset(char mode)
{
       /*@todo: reset the hardware in some way */
}

改为:

extern inline void arch_reset(char mode)
{
       /*@todo: reset the hardware in some way */
       void (*jump)(void);
       jump=(void (*)(void))0x0;
       jump();
}
这样一来在开发调试过程中要更新linux内核是就不用手动去按复位按键了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值