# initrd,initramfs how to build?

## praka123

Hi,

I have enabled initramfs in kernel.now how to build the initrd/initramfs file.

what is the package used?

----------

## maverick256

I assume you want to use the gensplash stuff? If so, follow this link: http://www.gentoo-wiki.com/HOWTO_gensplash

If you want to use it for something else then I have no clue.

----------

## praka123

well,I want it as I made ext3 etc as modules,which should be loaded via initramfs.(as debian etc does)

----------

## praka123

I found a page which explains the lack of mkinitramfs tool in gentoo a pita  :Embarassed: 

 :Wink: 

 *Quote:*   

> So, 3 months in from purchasing my laptop, and I finally decided that i would have another shot at trying to fix ACPI problems with it. This being the fact the battery always reports dead by default, while this statement is conclusively not true (the laptop itself tells me it is full 
> 
> So, to resolve this, it requires a custom DSDT file to be read in, and used instead of the vendor supplied one. To do this, required some gentoo patching, with the DSDT initrd patch. Basically this allows you to put a custom DSDT that is read on boot, from the initrd (or more so, the initramfs).
> 
> The kernel patching, and recompiling part wasn't overly hard, as the patch for my kernel applied cleanly to gentoo-sources. Recompiling to simply enable support for RAM disk and DSDT from initramfs was painless.
> ...

 

furthur on this link:

http://www.nullis.net/blog/category/gentoo/

----------

## monsm

I don't bother trying to patch kernels myself.

Just stick to gentoo-sources and genkernel.  Leave the patching to the good people who update portage   :Very Happy: 

There are howto's on the wiki for all sorts of setups (even for my raid-0 using dmraid). Genkernel is a great little tool, handles splashes and all sort of other options. If I remember correctly, genkernel look for kernel configs on /etc/kernels.  I usually end up preparing the config and saving it there prior to running genkernel (with make menuconfig), although genkernel can run menuconfig too.

----------

## praka123

yes,found an article on gentoo-wiki.com which is hard to be done  :Sad: 

http://old.pt-br.gentoo-wiki.com/HOWTO_Custom_Initramfs_From_Scratch

http://gentoo-wiki.com/HOWTO_Initramfs

But,I thought mkinitramfs was already available in gentoo,until I installed it.

I believe initramfs is superior to initrd.

also I believe gentoo is freedom,but all are not geniuses to compile initramfs from scratch  :Rolling Eyes:  So,please please bundle mkinitramfs.there are many who are searching for this,

I really dont understand what genkernel does is!can I compile a custom kernel using genkernel?can I customize modular options?  :Crying or Very sad: 

----------

## jcat

 *praka123 wrote:*   

> 
> 
> I really dont understand what genkernel does is!can I compile a custom kernel using genkernel?can I customize modular options? 

 

Yes!

Install genkernel...

```
emerge -av genkernel
```

...then copy your current running kernel config and use modify as needed with menuconfig before compile kernel, modules and initrd image...

```
zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-config-2.6

genkernel --menuconfig all
```

...and rebuild any third party kernel modules (you can use modules-rebuild tool for this) and edit grub accordingly (all relevant files will already be copied to /boot/)

That's it.  Reboot!   :Wink: 

Cheers,

jcat

----------

## praka123

Thank you again!

well,I am installing from system rescue cd.shall I copy the config from that livecd's /boot?

It is gentoo based and uses 2.6.24-xx kernel  :Very Happy: 

also,please explain how to generate initramfs using genkernel

Thank you

----------

## Veldrin

assumptions: /usr/src/linux points to your wanted kernel and the kernel is configured.

then just run

```
# genkernel --no-clean --log-level=3 all 
```

and the kernel + initramfs get build. the new files can be found in /boot 

--no-clean stops genkernel form removing the .config, and --log-level=3 give you some nice output about the progess - I hate flying blind

----------

## praka123

Thanks   :Very Happy: 

Can I customize my kernel using genkernel(ie,can I run make menuconfig using genkernel).

Also,please some one can upload their kernel .config options file for intel pentium4++ systems?

----------

## jcat

Yes, as I said you can use --menuconfig option with Genkernel to configure it to taste.  And you can certainly copy the kernel config from a Gentoo Live CD if you want a fool proof and "one stop shop" kernel config.

Cheers,

jcat

----------

## praka123

whereis the  "man genkernel"   :Confused:   :Confused: 

It isnt showing up  :Sad: 

will someone list here the options for compiling a kernel with genkernel(using menuconfig) .

Thanks !

----------

## jcat

 *praka123 wrote:*   

> whereis the  "man genkernel"   
> 
> It isnt showing up 
> 
> will someone list here the options for compiling a kernel with genkernel(using menuconfig) .
> ...

 

 :Laughing: 

I've already put it in two posts in this thread!   :Shocked: 

Here it is again with explanation:

```
zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-config-2.6

genkernel --menuconfig all
```

That will copy your current running kernel config as a base config, allow you to configure it with menuconfig, make a kernel, the modules, and an initrd image.

Don't forget to check your /usr/src/linux link before you compile, it's easy with

```
eselect kernel list
```

 and 

```
eselect kernel set x
```

 where "x" is the number as listed by eselect.

Hope that's cleared it up   :Smile: 

Please note the above example assumes you're using x86 not x86_64

Cheers,

jcat

----------

## praka123

Thank you very much yaar!  :Very Happy:  .yeah I am on a 32-bit system only  :Wink: 

----------

