首页 > 系统相关 >ubuntu 下的文件系统initramfs解压缩

ubuntu 下的文件系统initramfs解压缩

时间:2023-05-20 21:11:17浏览次数:50  
标签:name no 解压缩 cpio initramfs CRC file ubuntu ASCII

ubuntu 下的文件系统initramfs解压缩_lsinitramfs_Robert_Y_Zhang的博客-CSDN博客
https://blog.csdn.net/weixin_40191420/article/details/107486888

系统: ubuntu 16.04

解压镜像:/boot/initrd.img-4.15.0-107-generic

需要额外安装的工具:sudo apt-get install binwalk -y

  1. 使用lsinitramfs工具查看initramfs的具体文件
lsinitramfs /boot/initrd.img-4.15.0-107-generic
  • 1
  1. 使用binwalk查看initramfs内包含的格式
binwalk /boot/initrd.img-4.15.0-107-generic 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             ASCII cpio archive (SVR4 with no CRC), file name: ".", file name length: "0x00000002", file size: "0x00000000"
112           0x70            ASCII cpio archive (SVR4 with no CRC), file name: "kernel", file name length: "0x00000007", file size: "0x00000000"
232           0xE8            ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86", file name length: "0x0000000B", file size: "0x00000000"
356           0x164           ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode", file name length: "0x00000015", file size: "0x00000000"
488           0x1E8           ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode/AuthenticAMD.bin", file name length: "0x00000026", file size: "0x00006B2A"
28072         0x6DA8          ASCII cpio archive (SVR4 with no CRC), file name: "TRAILER!!!", file name length: "0x0000000B", file size: "0x00000000"
28672         0x7000          ASCII cpio archive (SVR4 with no CRC), file name: "kernel", file name length: "0x00000007", file size: "0x00000000"
28792         0x7078          ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86", file name length: "0x0000000B", file size: "0x00000000"
28916         0x70F4          ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode", file name length: "0x00000015", file size: "0x00000000"
29048         0x7178          ASCII cpio archive (SVR4 with no CRC), file name: "kernel/x86/microcode/GenuineIntel.bin", file name length: "0x0000002A", file size: "0x002DD400"
3032592       0x2E4610        ASCII cpio archive (SVR4 with no CRC), file name: "TRAILER!!!", file name length: "0x0000000B", file size: "0x00000000"
3033088       0x2E4800        gzip compressed data, from Unix, last modified: 2020-07-06 05:10:31
46149573      0x2C02FC5       Cisco IOS microcode, for ""
56593448      0x35F8C28       MySQL ISAM compressed data file Version 11

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

从上面可以看出,再3033088处开始,是gzip压缩格式的数据,从这是initramfs中的文件系统。
3. 解压

dd if=/boot/initrd.img-4.15.0-107-generic bs=3033088 skip=1 | zcat | cpio -id --no-absolute-filenames -v
  • 1
bin  conf  etc  init  lib  lib64  run  sbin  scripts  usr  var
  • 1

initrd使用lzma压缩的。那么解压时候就不能用zcat命令了。应该使用如下命令:

dd if=/mnt/casper/initrd bs=1540096 skip=1 | lzcat | cpio -id --no-absolute-filenames -v

lzcat=xz --format=lzma --decompress --stdout
  • 1
  • 2
  • 3
  1. 压缩
find . | cpio --quiet --dereference -o -H newc | gzip -9 > ~/new-initrd.gz
  • 1

find . | cpio --quiet --dereference -o -H newc | lzma -7 > ~/new-initrd.lz
  • 1

参考:

https://blog.csdn.net/xiaofeng_yan/article/details/83303544
https://www.computerhope.com/unix/xz.htm
https://askubuntu.com/questions/777260/how-to-repack-initrd-img
https://wiki.ubuntu.com/CustomizeLiveInitrd


标签:name,no,解压缩,cpio,initramfs,CRC,file,ubuntu,ASCII
From: https://www.cnblogs.com/liuzhaoyzz/p/17417796.html

相关文章

  • Dockfile练习一:给ubuntu1804设置Java环境
    [root@mondoopt]#catDockerfile#BaseimageFROMubuntu:18.04#MAINTAINERMAINTAINERzhangjq<[email protected]># 将宿主机的软件包,复制到容器里的/usr/local/src目录下面去ADDjdk-8u321-linux-x64.tar.gz/usr/local/src/# 将上面的容器软件包进行解压,解压到jdk1.8.......
  • Ubuntu20.04清华版配置以及ROS的安装和rosdep的初始化
    一、配置Linux清华镜像源这里我以 Ubuntu20.04LTS 为例来配置 清华源首先进入清华大学开源软件镜像站(https://mirrors.tuna.tsinghua.edu.cn)在列表里选择自己的系统,这里我选择的是 Ubuntu,点击后面的问号图案    进入后选择自己的系统版本 20.04LTS 随即文......
  • Ubuntu桌面下Vue开发环境搭建
    Ubuntu桌面下Vue开发环境搭建node环境node安装node官网下载node安装包:node-v18.16.0-linux-x64.tar.xz#解压sudotar-xvJfnode-v18.16.0-linux-x64.tar.xz-C/usr/local/cd/usr/local/sudomvnode-v18.16.0-linux-x64/nodejs#配置环境变量cd/etc/profile.d/......
  • 安装ubuntu22.04.2后的操作
    一、更新系统指令一:sudoapt-getupdate指令二:sudoapt-get-ydist-upgrade指令三:sudoapt-getclean说明:清除更新时下载回来的软件包。指令四:sudoapt-getautoremove说明:自动清除更新后用不到的旧版本文件(例如旧的核心文件)备注:若不及时移除旧核心文件,容易造成/boot空......
  • Ubuntu 22.04 安装中文输入法
    安装命令sudoaptinstall-yfcitx5fcitx5-chinese-addonsfcitx5-frontend-gtk4sudoaptremoveibussudoaptautoremove参考链接Ubuntu22.04安装Fcitx5中文输入法(详细)......
  • ubuntu中使用vscode进行cuda c代码debug出现 no such file or directory 的问题
    {"version":"0.2.0","configurations":[{"name":"CUDAC++:Launch","type":"cuda-gdb","request":"launch","program":......
  • ubuntuSSh无法远程连接解决方案
    首先进入目录/etc/ssh中cd/etc/ssh然后编辑里面的sshd_config文件visshd_config查找PermitRootLLogin,把后面的内容改成yes,把前面的#删除,wq保存退出(一定要记得删"#"我因为这走了很多弯路)这个时候就可以了......
  • 在ubuntu 下怎么将eclipse添加到应用,同时有可以通过终端打开。
    1:将ubuntu添加到应用程序的方法:在终端中敲入:sudogedit/usr/share/applications/Eclipse.desktop在打开的GEdit中输入以下文本[DesktopEntry]Name=EclipseComment=Eclipse3.42IDEExec=/usr/java/eclipse/eclipse   <—这里改成你的eclipse的安装位置Icon=/usr/java/ecli......
  • ubuntu deb安装
    ubuntudeb安装要安装.deb套件包时dpkg-ipackage_file.deb要反安装.deb套件包时dpkg-rpackage_name 注意:使用此命令需要你自己注意依赖软件,所以这并不是安装软件的最佳方法.  dpkg的详细使用方法,网上有很多,下面简单列了几个:dpkg-ipa......
  • ubuntu flash allow camera
    ubuntuflashallowcamera:ubuntu的bug,在ubuntu下特别难点击flash的allow按钮。通过搜索,找到以下方案解决这个问题:http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html......