Created
January 2, 2026 11:48
-
-
Save schorschii/447fb47850bf38ddae1b08d024c42ea5 to your computer and use it in GitHub Desktop.
Rebuild an existing Ubuntu initrd/initramfs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| # 1. extract initrd with: unmkinitramfs initrd.img...-generic extracted | |
| # 2. cd extracted | |
| # 3. make changes | |
| # 4. then execute this script to repack | |
| if [ "$1" == "" ]; then | |
| echo "Enter target file name as first parameter!" | |
| exit 1 | |
| fi | |
| cd early | |
| find . -print0 | cpio --null --create --format=newc > "../$1" | |
| cd ../early2 | |
| find . -print0 | cpio --null --create --format=newc >> "../$1" | |
| cd ../early3 | |
| find . -print0 | cpio --null --create --format=newc >> "../$1" | |
| cd ../main | |
| find . -print0 | cpio --null --create --format=newc >> "../$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment