How to extract kernel symbols from uImage (arm)?
-
25-05-2021 - |
Pergunta
I want to extract kernel symbols from a u-boot image
The final goal is to debug syscalls with gdb
The kernel is compiled with CONFIG_DEBUG_INFO=y
and gcc is using -g option (I checked)
After make uImage
, I've :
# file arch/arm/boot/*
arch/arm/boot/bootp: directory
arch/arm/boot/compressed: directory
arch/arm/boot/Image: data
arch/arm/boot/install.sh: POSIX shell script text executable
arch/arm/boot/Makefile: ASCII English text
arch/arm/boot/uImage: u-boot legacy uImage, Linux-3.0.6, Linux/ARM, OS Kernel Image (Not compressed), 3044476 bytes, Thu Mar 22 18:13:40 2012, Load Address: 0x00008000, Entry Point: 0x00008000, Header CRC: 0xF689B805, Data CRC: 0x6BFE76DF
arch/arm/boot/zImage: data
gdb cannot load uImage directly
I tried this script http://forum.xda-developers.com/showthread.php?t=901152.
# file arch/arm/boot/zImage_unpacked/*
arch/arm/boot/zImage_unpacked/decompression_code: data
arch/arm/boot/zImage_unpacked/initramfs.cpio+part3: data
arch/arm/boot/zImage_unpacked/kernel.img: data
arch/arm/boot/zImage_unpacked/padding_piggy: data
arch/arm/boot/zImage_unpacked/piggy: data
arch/arm/boot/zImage_unpacked/piggy.gz: gzip compressed data, from Unix, max compression
arch/arm/boot/zImage_unpacked/piggy.gz+piggy_trailer: gzip compressed data, from Unix, max compression
arch/arm/boot/zImage_unpacked/piggy_trailer: data
arch/arm/boot/zImage_unpacked/sizes: ASCII text
kernel.img is not loadable by gdb
Solução
Do make vmlinux
. I believe GDB can read that, but it's a long time and a lot of kernel versions since I tried.
EDIT: Oh, I should say, both vmlinux and uImage should be the same but packaged differently. If that's not the case, then this won't work.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow