Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-15-2009, 03:25 AM   #1
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Rep: Reputation: 15
How to make a custom initrd.gz

How do you create a new initrd image on a linux (2.6) that does not have the mkinitrd script? I've seen that lots of distros come with this script called mkinitrd for creating a new initrd image.

Perhaps there is a generic mkinitrd package to download and install?
If yes, where can I get it?
If no, is it wise to use another mkinitrd script package that belongs to another linux distribution?
Old 01-15-2009, 05:05 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Look for a package that contains your distro's mkinitrd command. It is actually a script, and it tends to be customized for each distro.
Creating an initrd file is the last step in building a kernel, so I'm sure your distro should have it.

On my system, the initrd-<version>.gz is a compressed cpio archive. On others it is a compressed ext2 filesystem image. You can extract the files from an initrd image with "cpio -vid < /path/to/initrd". After doing that you can modify the files you want and then use cpio and then gz to recreate it.

It would be better, however, to locate the packages you need. Look for a howto on compiling a kernel. It should say which packages you need, which should include one needed to create an initrd file.
Old 01-15-2009, 06:54 AM   #3
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
This linux image of mine doesn't seem to have one. I found and downloaded one from a Slackware FTP site and I'm testing it as we speak. Seems to work fine so far, but the real test will be when I boot it. Right now I'm trying to compile some binaries for the initrd.

See ya.
Old 01-15-2009, 07:05 AM   #4
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Rep: Reputation: 23
You can actually make one yourself, but it might take a while. The initrd contains a mini-filesystem in a gzipped cpio archive, so you can extract it and look inside with cpio --extract (consult the man page, I'm not sure about exactly how to use cpio).

To make one you do the same thing in reverse. Google "initrd cpio" and you'll find stuff...YMMV


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom applications in initrd not found malo_umoran Slackware 6 02-10-2008 03:25 PM
Custom initrd for bootable cd deoren Linux - General 13 02-12-2005 11:38 AM
custom initrd not working -- INIT errors michael_util Slackware 9 11-24-2004 11:58 AM
Custom install initrd for megaide - how to make? silversail76 Debian 1 07-27-2004 05:00 AM
Custom Kernel / No INIT / initrd? azl Linux - Newbie 2 11-01-2003 09:32 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:57 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration