I.MX6 android shutdown 内核崩溃

时间:2022-01-06 09:24:16
/****************************************************************************
 *                  I.MX6 android shutdown 内核崩溃
 * 说明:
 *     本文主要是记录解决I.MX6的关机会进入halt模式,导致内核崩溃。
 *
 *                                        2016-3-24 深圳 南山平山村 曾剑锋
 ***************************************************************************/

一、参考文章:
    android 关机 流程分析 
        http://blog.chinaunix.net/uid-24227137-id-3248111.html

二、 现象:
    SysRq : Emergency Remount R/O
    EXT4-fs (mmcblk0p4): re-mounted. Opts: (null)
    EXT4-fs (mmcblk0p6): re-mounted. Opts: (null)
    Emergency Remount complete
    System halted.
    BUG: soft lockup - CPU#1 stuck for 23s! [Thread-88:3327]
    Modules linked in:
    
    Pid: 3327, comm:            Thread-88
    CPU: 1    Not tainted  (3.0.35 #617)
    PC is at machine_halt+0x8/0xc
    LR is at smp_send_stop+0x9c/0xc4
    pc : [<c004d7dc>]    lr : [<c0052f98>]    psr: 60000013
    sp : d0e53e88  ip : 00000000  fp : 78393c6c
    r10: 00000000  r9 : d0e52000  r8 : c004ca84
    r7 : 00000000  r6 : 4321fedc  r5 : 28121969  r4 : 4321fedc
    r3 : 00000001  r2 : 00000001  r1 : 00000000  r0 : 00000001
    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    Control: 10c53c7d  Table: 24fa804a  DAC: 00000015
    
    PC: 0xc004d75c:
    d75c  e5843004 eaffffda eb01b99d e3500000 1affffed e5973004 e12fff33 e10f3000
    d77c  e3130080 1a000003 f1080080 eaffffd4 eb19c101 eaffffe0 e59f0018 e3a010fa
    d79c  eb0101fd f1080080 eaffffcd c06dccf4 c0a0ce64 c09886b4 c085477c e1a0200d

三、 解决方法:
    cat kernel/sys.c
    /*
     * Reboot system call: for obvious reasons only root may call it,
     * and even root needs to set up some magic numbers in the registers
     * so that some mistake won't make this reboot the whole machine.
     * You can also set the meaning of the ctrl-alt-del-key here.
     *
     * reboot doesn't sync: do that yourself before calling this.
     */
    SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
            void __user *, arg)
    {
        ......
        //if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
        //    cmd = LINUX_REBOOT_CMD_HALT;
        ......
    }