Bobcares

How to Extract Vmlinuz in 5 Steps

by | Jun 4, 2024

Learn how to extract Vmlinuz in a few easy steps. Our Server Management Support team is here to help you with your questions and concerns.

How to Extract Vmlinuz?

Did you know the Linux kernel’s compressed image, vmlinuz, is loaded and executed during boot?

How to extract Vmlinuz

In short, vmlinuz is a statically linked executable file. It contains the kernel in a file format supported by Linux.

Today, our experts are going to describe how to extract the Kernel image:

  1. First, extract the compressed kernel image via the extract-vmlinux script. This script comes with the Linux headers.
  2. Then, copy the vmlinuz file to a different location and extract it with the extract-vmlinux script.
  3. After that, the extracted kernel will be saved to a file, such as decomp-vmlinuz.

    wget -O extract-vmlinux https://raw.bobcares.com/torvalds/linux/master/scripts/extract-vmlinux

  4. Then, create a temporary directory:

    mkdir /tmp/extract-kernel
    cd extract-kernel

    We can now copy the current kernel to a new folder:

    sudo cp /boot/vmlinuz-$(uname -r) /tmp/kernel-extract/

  5. Now, run the extract-vmlinux script to extract the image.

    sudo /usr/src/linux-headers-$(uname -r)/scripts/extract-vmlinux vmlinuz-$(uname -r) > decomp-vmlinuz

How to disassemble the Kernel

  1. After we extract the kernel, we can disassemble it via the objdump command-line utility.
  2. Furthermore, the kernel code we disassembled is saved in a file.

    For example: disassembled-vmlinuz.asm.

    objdump -D decomp-vmlinuz > disassembled-vmlinuz.asm

Our experts would like to point out that the disassembled kernel file does not have symbols. Hence, we have to locate them in the System.map file.

This is done by finding the starting address of a specific symbol in the System.map file with the grep command.

cat System.map-$(uname -r) | grep start_kernel

By following the above steps, we can easily extract and disassemble the Linux kernel image (vmlinuz).

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In brief, our Support Experts demonstrated how to extract Vmlinuz, the Linux kernel image.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.