Search code examples
androidlinux-kernelexecutableobjdump

objdump on android kernel


I have taken android linux kernel split it from the gzip header and decompressed it. However when I try to do an objdump from the android ndk to dump the file I am getting a File format not recognized error.

Anyone know how get a symbol table from the binary image.

On my android device I can do the following to get a symbol table: cat /proc/kallsyms


Solution

  • This is not unique to Android - it happens on most (all?) Linux systems. The bootable image of the Linux kernel (on which Android is based) is not a proper ELF binary:

    # file /boot/vmlinuz-2.6.38.7-desktop-1mnb2 
    /boot/vmlinuz-2.6.38.7-desktop-1mnb2: Linux kernel x86 boot executable bzImage, version 2.6.38.7-desktop-1mnb2 (thomas@celeste.mandriva.com) #1 SMP Sun, RO-rootFS, root_dev 0x902, swap_dev 0x3, Normal VGA
    # nm /boot/vmlinuz-2.6.38.7-desktop-1mnb2 
    nm: /boot/vmlinuz-2.6.38.7-desktop-1mnb2: File format not recognized
    

    The bootable image is created by wrapping the vmlinux kernel ELF binary in a compressed container and adding a set of boot and decompression utilities. If you need a kernel image for debugging. the vmlinux file is what you need - I don't know if/where it exists in the Android NDK though.