View on GitHub

tool-initramfs-extract

tool-initramfs-extract

tool-initramfs-extract

Subject

Prepare

grep 'COMPRESS:' /etc/initramfs-tools/initramfs.conf

show

# COMPRESS: [ gzip | bzip2 | lz4 | lzma | lzop | xz | zstd ]

install (de)compress utils

sudo apt-get install cpio gzip bzip2 xz-utils zstd lz4 lzop

Manual Install

install curl

sudo apt-get install curl

download initramfs-extract to ~/.local/bin/initramfs-extract,

curl -fLo ~/.local/bin/initramfs-extract --create-dirs https://raw.githubusercontent.com/samwhelp/tool-initramfs-extract/main/src/asset/bin/initramfs-extract

chmod 755 ~/.local/bin/initramfs-extract

Usage

Extract /boot/initrd.img

run

initramfs-extract /boot/initrd.img initrd-root

or run

initramfs-extract "/boot/initrd.img-$(uname -r)" initrd-root

unmkinitramfs -v /boot/initrd.img initramfs

unmkinitramfs -v "/boot/initrd.img-$(uname -r)" initramfs

Extract initrd (other compress format)

create new initrd

mkinitramfs -c bzip2 -o initrd.img

then extract

initramfs-extract initrd.img initrd-root

More case

unmkinitramfs -v initrd.img initramfs