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?
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:
- First, extract the compressed kernel image via the extract-vmlinux script. This script comes with the Linux headers.
- Then, copy the vmlinuz file to a different location and extract it with the extract-vmlinux script.
- 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
- 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/
- 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
- After we extract the kernel, we can disassemble it via the objdump command-line utility.
- 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