# Will genkernel build a local initrd?

## fpemud

dracut, mkinitcpio all have an option to build a local initrd.

dracut uses "-H" option, mkinitcpio uses "autodetect" hook.

But genkernel only builds generic initrd.

The initrd is big (4.3M), and loads many unneccessary modules.

So I wonder is there a plan for genkernel to generate local initrd  :Question: 

Why I don't use dracut/mkinitcpio is they all use devtmpfs and udev. 

I can't quite understand devtmpfs, and i think udev is too big/complicate for initrd.

Also I think the only function of initrd should be mounting.

I always wonder why dracut/mkinitcpio have keymap and consolefont function.

In fact I like the method used by the old mkinitrd, in which initrd directly load kernel modules and mount root or usr.

But mkinitrd has no function of auto selecting which module to include.

I'm having the thought of grabing the old mkinitrd code and add the auto select function.

Will it be a good project? I'm in fear that my thought is behind the times and can only be laughed at.   :Rolling Eyes: 

----------

## NeddySeagoon

fpemud,

Unless you have a general purpose boot anaywhere kernel, like all binary distros must have, there is no need to load modules before root is mounted.

This means you either don't need an initrd at all, or it only need house userpace tools to do the things needed to get root mounted and optionally, /usr and /var if you have them on their own partitions an want to use udev.

This sort of initrd is simple enough to roll by hand and as it contains no kernel code, does not need to be updated with every kernel update.

My initrds run mdadm to assemble the raid sets because I have root on raid5, start LVM because root, usr and var are separate logical volumes, check and mount /usr and /var, then hand over to the real initscript.

Notice that the initrd does not load any kernel modules.  All the hardware drivers needed to boot are set as <*> in the kernel.

You can still build a Gentoo system entirely without an initrd.  root must contain /var and /usr and none of those filesystems must be on kernel raid or LVM. 

Is your project worthwhile?

Whatever scratches your itch.

----------

## fpemud

Thank you neddyseagoon for replying.

My workstation uses LVM only and have one root LV for every thing, so I could use your solution.

I want to have a initrd with kernel mod because I am obsessed by a concept:

  kernel should be generic, initrd should be specific.

I build my kernel with nearly every hardware driver selected, all of them is selected as module.

Then I think this kernel is generic, no reconfig needed when:

  1. hardware changes

  2. root fstype changes

  3. move to other PC   (yes, I have PCs and I want to maintain only one .config file) 

  4. someone brings a USB-disk with a rare chip

Of course everytime when I update the kernel to a new version, I need to "generalize" it again.  :Mad: 

(have a website supplying the "generalized .config" would be good, ha.  :Very Happy:  )

If I can make specific initrd for each PC to load only the kernel module needed without maintaining many seperate config, then every PC boots fast and my brain is saved.

In fact every PC needs 2 initrd, one local, one generic. When hardware changes, I must boot with generic initrd and generate another local initrd and reboot using that from then on.

You reminds me compiling all the fstype/SATA-driver into the kernel can also achieve my goal...

But I think I don't like that.

So maybe my requirement is not behind of times but just special. Thanks again.

----------

## NeddySeagoon

fpemud,

And you use -march-i686 so your install runs on a PentiumPro and no multimedis USE flags like mmx or 3dnow so everything works on Intel or AMP cpus?

The kernel has a make target to do what you want with the kernel configuration

```
make allmodconfig
```

but do dave your existing .config before you test.

genkernel blindly copies all the modules into the initrd but you could unpack it and remove the modules you don't want.

----------

## fpemud

This post is my envrionment description, it's long and can be ignored.

I have a fpemud-workstation, a fpemud-htpc, a fpemud-notebook, and another PC in my parent's home. 

The hardware of them is different, but I'm lucky the arch are all Generic-x86-64.

In Feb 2012, I decide to delete windows and install gentoo on all of them. 

From then on, I have been seeking solution to manage these 4 PCs with min effort and gets max performance.

I want this solution:

  1. can apply to any hardware update.

  2. be generic, can apply to any gentoo multi-site env.

  3. can apply to embed-system like smart-phone or pda running gentoo

This solution don't need to apply to OS other than gentoo. (its difficult to reach this capability)

First, I established some concept.

1. min effort: use default cfg whenever possible, use one cfg whenever possible

2. max performance: simple structure, max hdd footprint, minor mem footprint, minor daemon number.

I think the rationale behind is clear.

make.conf:

  1. make.conf contains all the possible LINGUAS

  2. VIDEO_CARDS INPUT_DEVICES etc contains all regular hardware type

  3. USE flag are different. Different role of PC needs different USE.

so make.conf must be seperate because "3".

kernel .config:

  1. unselect all deprecated option

  2. unselect all experimental option

  3. unselect all rare and unplugable driver (like CALGARY_IOMMU, X86_REROUTE_FOR_BROKEN_BOOT_IRQS,

                                                                   AMD_NUMA, NUMA_EMU)

  4. select all others to module

each arch can have only one .config, my PCs shares one arch, so one .config is enough for me.  

initrd:

  1. each PC have one generic and one local initrd

  2. a command gen-initrd can auto-build a generic and a local initrd for a PC

  3. use local initrd mostly, use generic initrd when hardware changes

so no cfg and boot speed / mem footprint guaranteed.

services in rc-update:

  1. each PC have it own service list

so daemon number is minor.

users and groups:

  1. all the PC has the same users and groups

Ok, I think things above is enough to save my brain.

Why I don't use binary distro like ubuntu?

  Yes, what I want is to have a gentoo similar to ubuntu.

  I don't want a highly customized system for one specific PC. when PC number increase it is hard to maintain. 

  I want a generic system.

  But there's some key points of binary distro are bad or complicate in my view, so I can't use them.

  At last I want to have a gentoo similar to ubuntu. I think gentoo has this capability.

Here, thanks for reading.   :Smile: 

----------

## fpemud

And you use -march-i686 so your install runs on a PentiumPro and no multimedis USE flags like mmx or 3dnow so everything works on Intel or AMP cpus? 

There's no way of maintaining one set of USE flags. I have seperate make.conf for each PC. This effort can't be saved.

And it's lucky all my computers have arch Generic-x86-64,  so I think I'm able to maintain only one .config

If I have 10 PCs with 2 archs, then I must maintain two .config 

But I will never need to maintain 10 .config file

make allmodconfig

I can't use it, I have some other rules, like unselect all the deprecate and experimental option.

Now I must do it manual every kernel updating.

genkernel blindly copies all the modules into the initrd but you could unpack it and remove the modules you don't want.

Yeah, it's simple solution, perhaps I don't have the ability to do more.

----------

## NeddySeagoon

fpemud,

You can set up a BINHOST and point your machines there for packages.

The most powerful one can run emerge and save packages to the BINHOST.

On the others, you use emerge -k....  This tells emerge to use binary packages whenever possible but build packages that are not in the BINHOST or do not have matching USE flags.  You can even set up distcc, as long as you do noy use -march=native and you keep the gcc versions identical.

You can set up several BINHOSTS so you can run a different set of USE flafs on each BINHOST.  They may be physically loated on the same machine if you wish.

The combination of BINHOST(s) and distcc minimises your build workload and makes it easy to share binary packages.

----------

## fpemud

I am using distcc. But I don't want to use BINHOST.

BINHOST is complicate, compiling time is not that important to me.

Nothing is simpler than reading a book beside the monitor, isn't it.   :Wink: 

I have discussed the idea of building multiple copy of one package using different USE/CFLAG/etc on BINHOST on a forum or somewhere several years ago.

The idea is great, but is very hard to implement.

Ok, thanks. I will share any progress here.

----------

## wcg

Just out of curiousity, why disable this (instead of simply leaving it built-in

on all kernels): X86_REROUTE_FOR_BROKEN_BOOT_IRQS

If a system does not have broken boot irqs, it is simply going to use

a few bytes of memory for some unneeded functions. If you boot a board

that does have broken boot irqs (broken in a way that the functions enabled

by that option can work around) and you did not know that beforehand,

the system is still going to boot.

It seems like a rarely needed but low-cost config option at first glance.

----------

## fpemud

hi, wcg.

I want my system be as simple as possible.

I think simple is the source of all performance, quality, convinence, easy-learning, etc.

I can't describe it clearly.

I think simple is direct, consistent, generic, automatic, let computer know more.

it's not about using small mem and hdd, installing less package, using lightweight program.

So I remove all the workaround of this kind unless my hardware has this problem.

And If unluckly it do have, then of course the workaround is neccessary, I will record it as a flaw and seek a chance to replace this hardware.

I admit it's not very neccessary, only a hobby...

And this is one reason I use gentoo.

----------

