init进程启动失败调查

在做新版本kernel bring up的时候,由于我们没有使用到网络的功能,因此一上来就将内核的CONFIG_NET配置disable掉。
kernel启动后在去启动init进程的时候总是启动失败,报panic重启,每次启动都这样,panic log如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
[   22.476539] (EE) init: /init.rc: 193: invalid option 'seclabel'
[ 22.482520] (EE) init: /init.rc: 194: invalid option 'seclabel'
[ 22.490153] init (1): /proc/1/oom_adj is deprecated, please use /proc/1/oom_score_adj instead.
[ 22.498841] (!!) init: starting 'ueventd'
[ 27.222598] (EE) init: Wait for file /dev/block/mmcblk0p1 timeout
[ 27.228916] (EE) init: command 'mount ext4 /dev/block/mmcblk0p1 /system wait ro journal_checksum', r=-1
[ 27.238347] (!!) init: processing action 0x2be0ca50 (wait_for_coldboot_done)
[ 32.227859] (EE) init: Timed out waiting for /dev/.coldboot_done
[ 32.233901] (EE) init: command 'wait_for_coldboot_done', r=-1
[ 32.241095] (!!) init: processing action 0x2be0cae0 (property_init)
[ 32.247753] (!!) init: processing action 0x2be0cb70 (keychord_init)
[ 32.254054] (!!) init: processing action 0x2be0cc00 (console_init)
[ 32.260292] (!!) init: processing action 0x2be0cc90 (set_init_properties)
[ 32.267130] (!!) init: processing action 0x2be091f0 (init)
[ 32.273313] (EE) init: command 'write /proc/sys/kernel/hung_task_timeout_secs 0', r=-2
[ 32.281666] (EE) init: command 'write /dev/cpuctl/cpu.shares 1024', r=-22
[ 37.247949] (EE) init: command 'chown root root /data/lost+found', r=-2
[ 37.254615] (EE) init: command 'chmod 0770 /data/lost+found', r=-2
[ 37.261054] (!!) init: processing action 0x2be0cd20 (property_service_init)
[ 37.268206] (EE) init: Failed to open socket 'property_service': Function not implemented
[ 37.276412] (!!) init: processing action 0x2be0cdb0 (signal_init)
[ 37.282541] (!!) init: processing action 0x2be0ce40 (check_startup)
[ 37.288831] (EE) init: init startup failure
[ 37.293454] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[ 37.293454]
[ 37.302597] CPU: 0 PID: 1 Comm: init Not tainted 4.14.62-ge4e3cbe-dirty #3
[ 37.309472] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 37.314613] Call trace:
[ 37.317069] [<ffff0000080899e8>] dump_backtrace+0x0/0x3f8
[ 37.322472] [<ffff000008089df4>] show_stack+0x14/0x20
[ 37.327528] [<ffff0000089e5338>] dump_stack+0x98/0xb8
[ 37.332584] [<ffff0000080cacc0>] panic+0x114/0x27c
[ 37.337378] [<ffff0000080cec38>] complete_and_exit+0x0/0x20
[ 37.342955] [<ffff0000080cec9c>] do_group_exit+0x34/0x98
[ 37.348272] [<ffff0000080ced10>] __wake_up_parent+0x0/0x28
[ 37.353763] Exception stack(0xffff000008043ec0 to 0xffff000008044000)
[ 37.360212] 3ec0: 0000000000000001 0000000000000000 0000000000000001 000000002bdf26f0
[ 37.368046] 3ee0: 0000000000000048 0000000000000000 0000000000000001 7f7f7f7f7f7f7f7f
[ 37.375883] 3f00: 000000000000005e 756c696166207075 696e692029454528 2074696e69203a74
[ 37.383719] 3f20: 2070757472617473 0a6572756c696166 0000000000000022 0000000000000000
[ 37.391554] 3f40: 0000000000000000 0000000000000003 0000000000000000 0000000000000001
[ 37.399391] 3f60: 0000000000000001 0000000000000001 00000000004efe68 0000000000522200
[ 37.407227] 3f80: 00000000004d5000 0000000000000000 0000000000000000 0000000000000000
[ 37.415063] 3fa0: 0000000000000000 0000fffff4b35680 0000000000468a78 0000fffff4b35680
[ 37.422899] 3fc0: 0000000000490e14 0000000060000000 0000000000000001 000000000000005e
[ 37.430735] 3fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 37.438572] [<ffff000008083ac0>] el0_svc_naked+0x34/0x38
[ 37.443890] SMP: stopping secondary CPUs
[ 37.447815] Kernel Offset: disabled
[ 37.451304] CPU features: 0x0802008
[ 37.454787] Memory Limit: none
[ 37.457841] Rebooting in 1 seconds..

受到Android系统启动-Init篇的启发,在启动init进程的时候会进行socket通信。而socket通信又是基于网络的功能。所以,我们将CONFIG_NET整个网络功能关掉了,肯定要出问题的。
net/socket.ceffectively the top level interface to the BSD socket paradigm,因此,需要将CONFIG_NET打开。