# Is there a script for creating initramfs?

## Consystor

Hello!

On SuSE I used mkinitrd to create a initrd for a custom kernel.

Under gentoo I use the genkernel tool after an emerge of the "gentoo-sources" or "vanilla-sources" I want to use.

Now I would like to test a vanilla kernel which I can't emerge.

So I would like to build it "manually" with "make menuconfig", "make bzImage", ...

But is there a tool like mkinitrd under SuSE for creating the initramfs for my new kernel?

Or is there a way to use the genkernel tool for a custom kernel which I download by myself (and not by emerge)?

Thanks for your help!

----------

## Consystor

Oh!    :Idea: 

I've downloaded and unpacked the kernel I want to test (linux-3.0-rc7) in /usr/src .

And it is shown by "eselect kernel list". So I can select it and maybe the genkernel tool can build it.

That's really nice!   :Smile: 

----------

## John R. Graham

Yep. genkernel will use any kernel that is pointed to by your /usr/src/linux symlink. Just edit the /etc/genkernel.conf to keep the old config from being overwritten each time, like so:

```
# Run 'make clean' before compilation?

# If set to NO, implies MRPROPER WILL NOT be run

# Also, if clean is NO, it won't copy over any configuration

# file, it will use what's there.

CLEAN="no"

# Run 'make mrproper' before configuration/compilation?

MRPROPER="no"
```

Then, if you want to make any additional changes to your kernel .config file, just invoke genkernel with the --menuconfig command line option:

```
genkernel --menuconfig all
```

Hope this helps.

- John

----------

## Consystor

Hello!

That's really cool (I mean genkernel and the smart evaluation of the /usr/src directory).   :Smile: 

I thought that would be managed by 100 config files like in some other distributions.

Many thanks for your confirmation and the hint!

Until now I always used "genkernel --no-clean --no-mrproper --menuconfig all" and sometimes I've forgotten it...

Editing the genkernel.conf is a good idea!   :Wink: 

----------

## John R. Graham

Yeah, I put all my defaults in genkernel.conf and I don't use genkernel to build a bloated, bazillion module, run on anything kernel. My genkernel kernels are lean, mean, and custom configured.   :Very Happy: 

- John

----------

## Hu

If you want to build the initramfs into the kernel, then you can use the functionality of the kernel build system to do this.  This is independent of genkernel, though you could allow genkernel to run make menuconfig on your behalf and still use the kernel's native ability to create an initramfs.  The kernel's native ability is limited to building an initramfs containing the files and directories you specify.  It does not have shortcuts such as a knob to include LVM support, DM-Crypt support, etc.

----------

## salahx

You may want to look into sys-kernel/dracut as well, which is a replacement for the old mkinitrd program.

----------

