本文介绍了从压缩的内核映像获取一致信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有很好的方法可以从压缩的内核映像中提取uname所做的相同信息?我希望它能够检查位于嵌入式Linux系统上处于休眠状态mtd的内核的狗标签,并将其与当前正在运行的内核进行比较.

Is there a good way to extract the same information that uname does from a compressed kernel image? I want this to be able to check the dog tags of kernel sitting in dormant mtd's on an Embedded Linux system and compare it to the currently running kernel.

推荐答案

对于使用gzip压缩的Linux映像,请使用以下命令:

For Linux image compressed with gzip, use this:

dd if=arch/arm/boot/zImage bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' arch/arm/boot/zImage | head -n 1 | cut -d ':' -f 1) | zcat | grep -a 'Linux version'

对于使用xz压缩的Linux映像,请使用以下命令:

For Linux image compressed with xz, use this:

dd if=arch/arm/boot/zImage bs=1 skip=$(LC_ALL=C grep -a -b -o $'\xFD\x37\x7A\x58\x5A\x00' arch/arm/boot/zImage | head -n 1 | cut -d ':' -f 1) | xzcat | grep -a 'Linux version'

由于图像文件在压缩流结束后包含数据,因此会出现一个可以忽略的错误.

Because the image file contains data after the end of the compressed stream, you'll get an error you can ignore.

字符串常量似乎是冻结的用户空间可见内核API的一部分:

The string constant appears to be part of the frozen userspace visible kernel API:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=init/version.c;hb=HEAD#l40

这篇关于从压缩的内核映像获取一致信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 18:02