카테고리 없음

[리눅스커널] kdump 관련 추가 정보 !

AustinKim 2023. 4. 18. 11:22
<Kexec tool 설치 방법> 
 
1. 욕토 프로젝트 
 
Poky에 kexec_tools 라는 package를 설치 
 
recipes-kernel/kexec/kexec-tools_2.0.14.bb
 
kdump.conf는 다음과 같이 정의
 
kdump.conf
#this will be passed to the kdump kernel as kdump kernel command line
KDUMP_CMDLINE="init=/sbin/init root=/dev/ram0 rootwait ip=off rw console=ttyS0,115200n8 no_console_suspend=1 tegra_keep_boot_clocks rootfstype=ext4 gpt gpt_sector=0x40001 sdhci_tegra.en_boot_part_access=1 1 maxcpus=1 reset_devices panic=1 loglevel=2"
 
#the kernel image for kdump
KDUMP_KIMAGE="/boot/kdump_KImage"
 
#the kernel dtb image for kdump
KDUMP_DTBIMAGE="/boot/kdump_dtbImage"
 
#the ramdisk image for kdump
KDUMP_RAMDISKIMAGE="/boot/kdump_ramdiskImage"
 
2. 직접 설치 
 
아래 경로의 git repository에 직접 접근해 source code를 download 받아
build 후에 설치해도 된다.
 
git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
 
cf) Kernel Documentation 중 kdump.txt 참고
 
 
<추가 정보>
 
dump-capture kernel config options
 
덤프 캡처 커널 컨피그 
 
CONFIG_CRASH_DUMP=y
CONFIG_PROC_VMCORE=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=/home/austindh.kim/busybox/_install
 
부트 아규먼트 지정 
 
CONFIG_CMDLINE="crashkernel=64M@0xa0000000 crash_kexec_post_notifiers"
 
crash_kexec_post_notifiers(kdump가 실행되기 전에 panic notifier와 kmsg dumper가 실행될 수 있도록 하는 옵션)는 
반드시 지정 
 
kexec-tools (static) 
: version - 2.0.11-rc1
: kexec
: kdump
: vmcore-dmesg
 
commands
 
: KEXEC
 
kexec -d -l /boot/Image --append="vmalloc=1288M console=ttyAMA0,115200n81 rootwait 1 maxcpus=1 reset_devices rdinit=/sbin/init"
 
kexec -e  
 
: KDUMP
 
kexec -d -p /boot/Image4 --append="root=/dev/ram0 rw rdinit=/sbin/init vmalloc=1288M console=ttyAMA0,115200n81 1 irqpoll maxcpus=1 reset_devices"
 
echo c > /proc/sysrq-trigger
 
 
kexec은 시스템 부팅 시에 캡쳐 커널 (second kernel) 을 현재 커널의 메모리에 로드한다. (kexec -l <kernel_image>)
 
이후 kexec -e 명령어를 통해 로드된 커널로 부팅 
kdump는 시스템 부팅 시에 kexec -p 명령어를 통해 현재 커널의 메모리에 캡쳐 커널을 로드하며, 이는 시스템 크래시 발생 시 자동으로 실행됨 
 
캡쳐 커널이 부팅되면 kdump.conf에 설정되어 있는 값으로 kdump 프로세스가 진행