从vmlinuz的或bzImage的vmlinux的提取 [英] Extract vmlinux from vmlinuz or bzImage
问题描述
我想从vmlinuz的产生的System.map,导致大部分机器没有文件System.map.In事实上,vmlinuz的是COM pressed至vmlinuz或bzImage的。
这是任何工具或脚本可以做到这一点?
我试过:
DD如果=的/ boot / vmlinuz的跳跃=`grep的-a -b -o -m 1 -e $'\\ X1F \\ x8b \\ X08 \\ X00'的/ boot / vmlinuz的|切-d:-f 1` BS = 1 | ZCAT>的/ tmp / vmlinux的
据失败:
ZCAT:标准输入:不是gzip格式
32769 + 0记录
32768 + 0记录了
要提取内核映像pssed内核uncom $ P $,你可以使用提取物的vmlinux
在内核树从脚本脚本
目录(可至少在内核版本3.5)(如果你得到像
mktemp的:无法创建临时文件/ tmp / vmlinux的-XXX:无效的参数
块引用>您需要更换
。$(mktemp的/ tmp目录/ vmlinux的-XXX)
按$(mktemp的/ tmp目录/ vmlinux的-XXXXXX)
脚本)。该命令是/路径/要/内核/树/脚本/提取物的vmlinux<内核映像> >的vmlinux
如果提取的内核二进制文件包含符号信息,您should¹能够创建使用
的System.map
文件中的mksysmap
从同一个子目录下的脚本。这里的命令是NM =纳米/路径/要/内核/树/脚本/ mksysmap的vmlinux的System.map
。¹随我的分布的内核映像似乎被剥离,所以剧本是不是能够得到的符号。
I want to generate System.map from vmlinuz,cause most of machines don't have the file System.map.In fact,vmlinuz are compressed to vmlinuz or bzImage.
It's any tool or script can do this?
I tried:
dd if=/boot/vmlinuz skip=`grep -a -b -o -m 1 -e $'\x1f\x8b\x08\x00' /boot/vmlinuz | cut -d: -f 1` bs=1 | zcat > /tmp/vmlinux
It was failed:
zcat: stdin: not in gzip format 32769+0 records in 32768+0 records out
解决方案To extract the uncompressed kernel from the kernel image, you can use the
extract-vmlinux
script from thescripts
directory in the kernel tree (available at least in kernel version 3.5) (if you get an error likemktemp: Cannot create temp file /tmp/vmlinux-XXX: Invalid argument
you need to replace
$(mktemp /tmp/vmlinux-XXX)
by$(mktemp /tmp/vmlinux-XXXXXX)
in the script). The command is/path/to/kernel/tree/scripts/extract-vmlinux <kernel image> >vmlinux
.If the extracted kernel binary contains symbol information, you should¹ be able to create the
System.map
file using themksysmap
script from the same subdirectory. The command here isNM=nm /path/to/kernel/tree/scripts/mksysmap vmlinux System.map
.¹ The kernel images shipped with my distribution seem to be stripped, so the script was not able to get the symbols.
这篇关于从vmlinuz的或bzImage的vmlinux的提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!