# Gentoo include external kernel module in module-less kernel

## alestark

I've built a custom completely non modular kernel (version 4.1.5) on my gentoo.

After this, I recognized that for make my wifi adapter working, I need to build the rtl8188eu module.

I was wondering if there is the possibility to "include" it in the kernel not building it as external module (that I've to load with insmod).

Is there any possibility to do and how can I do it?

Special thanks in advice

----------

## Roman_Gruber

there was a kernel option to include binaries, modules or initramfs. you may check that out, its in the upper half of the kernel makemenuconfig options when you browse that.

its a generic advise you may check it out yourself and read the description / check the net when you find something which may work.

i think you may get it to work wiht an initramfs and when you implement that in the kernel. 

I have build in the microcode stuff in my kernel (maybe thats a module too)... too lazy to look it up and can t be done in a reasonable time now.

----------

## NeddySeagoon

alestark,

Welcome to Gentoo.

The strict answer to your question in no.  External kernel modules cannot be built into the kernel. Often there would be licencing issues.

With a monolithic kernel, even with the module in an initrd, you would still need module loading support in the kernel and I guess that's what you want to avoid. 

Migrate to a testing kernel. That will be 4.7.x

Under Staging Drivers, you will find  

```
< >   Realtek RTL8188EU Wireless LAN NIC driver
```

Staging Drivers are things in the process of being added and are ready for limited exposure to users.  They may or may not work properly

You can build that into the kernel, along wint any firmware it needs.

Make it work as a module first, so you know it works, then rebuild the kernel with it built in once you have completed your testing.  

It might even be in your 4.1.5 but that's about 6 months old now.  A lot can happen in 6 months.

----------

## Logicien

Hello,

when you compile a support in hard (=y) in the kernel image and it do not work as expected, there are several possible reasons:

- you have not pass the needed Linux parameters for this support via the kernel option for it or via the boot loader.

- the firmware files needed by that support are not available in the kernel image or in an initramfs.

- other possibilities

If you are force to build a support as a module (=m), unless it is need or you want it for the early boot process, you can wait the moment when the real root filesystem is mounted for this support to show up and not include it in an initramfs.

In any case, the needed parameters must be pass to the kernel and the firmware files be available when the support raise up, otherwise, it can fail to do what it must, even if later everything it need will be available.

So, if you must compile rtl8188e as a module, it is because it need a firmware who is not available in the kernel image or in an initramfs at the moment it probe your wireless card. It work as a module because this firmware file is available in the root filesystem at the moment the module probe the hardware, after the real root partition is mounted.

----------

## alestark

 *NeddySeagoon wrote:*   

> alestark,
> 
> Welcome to Gentoo.
> 
> The strict answer to your question in no.  External kernel modules cannot be built into the kernel. Often there would be licencing issues.
> ...

 

Hi and thanks for your help, I'll try with this approach. 

One more thing: I've launched 

```
emerge --ask sys-kernel/gentoo-sources
```

for having the sources of the 4.1.5, how can I download the sources of the new testing 4.7.x kernel?

Is there a method through emerge, or I have to download the vanilla's one, apply all the patches required and recompile?

Thanks, however, to anyone that answered.

----------

## NeddySeagoon

alestark,

Gentoo supports at least two branches. Known as stable and testing.

Unless you deliberately choose testing packages you will have stable.

Portage provides a way to mix and match at the package level.  See the Gentoo Handbook.

You need to be aware of that entire section but the important details start at the heading Mixing stable with testing

Once you get that set up

```
emerge --ask sys-kernel/gentoo-sources
```

will offer to install a newer kernel.

Exactly which one depends on the content of your copy of the portage tree.  You may want to update it with 

```
emerge --sync
```

before you emerge your new kernel.

----------

