免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 997 | 回复: 0
打印 上一主题 下一主题

Inspecting the content of an initrd file [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-27 21:13 |只看该作者 |倒序浏览

                               
If you want to look what is inside of an initrd file (don’t ask me why I needed this

), here you can find some information on how you can do that. Depending
on what kernel you are using you might encounter various initrd type of
files.
Uncompressed initrd/cramfs type of file
Older kernels will use a initrd/cramfs type of file. If we want to
look inside this file all we have to do is to mount it (as a loop
device). Example showing how to mount a file called
initrd.img-2.6.8-2-686 (from a default Debian Sarge kernel):
# All work is done in a temporary directory
mkdir /tmp/initrdmount
# Mount the image file directly
mount -o loop /boot/initrd.img-2.6.8-2-686 /tmp/initrdmount
#Investigate its content, etc.
cd /tmp/initrdmount
#Once done un-mount it:
umount /tmp/initrdmount
Seen on: Debian Sarge, kernel 2.6.8
Compressed initrd/cramfs type of file
This is the same as above just that the file is compressed (with
gzip). If we want to look inside this file we need to uncompress it
first and then mount it (as a loop device). Example showing how to
mount a file called initrd-2.4.21-40.EL.img (from a default RHEL3
kernel):
# All work is done in a temporary directory
mkdir /tmp/initrdmount
# Copy the image, uncompress it
cp /boot/initrd-2.4.21-40.EL.img /tmp/initrd.img.gz
gunzip -v /tmp/initrd.img.gz
# Mount the image file
mount -o loop /tmp/initrd.img /tmp/initrdmount
#Investigate its content, etc.
cd /tmp/initrdmount
#Once done un-mount it:
umount /tmp/initrdmount
Seen on: RHEL3, Centos3, kernels 2.4.21
initramfs type of file
Newer kernels will use this type of file. The initramfs is an cpio
archive so all we have to do is to uncompress it to a temporary
directory. The example from bellow uses the file
initrd.img-2.6.15-1-686-smp (from a default Debian Etch kernel):
# All work is done in a temporary directory
mkdir /tmp/initrdmount
# Copy the image, uncompress it
cp /boot/initrd.img-2.6.15-1-686-smp /tmp/initrd.img.gz
gunzip -v /tmp/initrd.img.gz
# Extract the content of the cpio archive
cd /tmp/initrdmount
cpio -i
Seen on: Debian Etch, kernel 2.6.15; RHEL4, Centos4, kernel 2.6.9.
               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/18103/showart_133495.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP