-
Notifications
You must be signed in to change notification settings - Fork 2
kexec speed reboot
A: Generally 2 reasons. One is to reduce the tearing of power/vol button on minor crash, and preserve ramoops content without hard reboot; in addition preserve crash info by doing kdump.
to enable kexec, kernel should support below:
- CONFIG_KEXEC_CORE=y
- CONFIG_KEXEC=y
- CONFIG_KEXEC_FILE=y
to simplify, below is not enabled
# CONFIG_KEXEC_SIG is not set
Normal case under generic Linux env, nothing to add. Use tools like pmbootstrap to include kexec and done.
For Android alike env, static kexec is needed. A working copy of kexec tools is at: https://github.com/99degree/kexec-tools and checkout this repo or https://github.com/horms/kexec-tools
Compile ad arm64 binary refer to https://gist.github.com/Gnurou/7191098
Steps:
./bootstrap
LDFLAGS=-static ./configure --host=aarch64-linux-gnu --without-zlib --without-lzma
make
Lineageos miatoll ramdisk is a good choice at https://download.lineageos.org/devices/miatoll/builds
Unpack it by kitchen tool or https://github.com/cfig/Android_boot_image_editor is working fine.
Add 2 file into the ramdisk/system/bin and make sure they are "chmod 777"
- https://github.com/99degree/linux/blob/default/shutdown
- above compiled kexec binary
OR by method below
adb push shutdown /system/bin/
Additionally modify boot script and add cmdline with crashkernel=Y@X param, detail refer to https://github.com/99degree/linux/blob/default/boot_los and search keyword crash
To make sure reserved memory success, a new optional entry of reserved-memory device-tree node might be a good practice.
&reserved_memory { crash_kernel@f3c00000 { //compatible = "shared-dma-pool"; reg = <0x0 0xf3c00000 0x0 0x8000000>; }; };
Modify kboot.sh and use it to invoke kexec reboot. https://github.com/99degree/linux/blob/default/kboot.sh
Done!