No Modules After Compiling Kernels

I posted this before, but it never got solved. I figured I should not necro-post, so I'm opening this. I've tried building kernels many different ways only to come back to the same results, no modules. If anyone could help me I would greatly appreciate it.

Thanks

Hi Azrael,

I've read this thread and the previous one that you pointed to. Also, looked at the guides that you have followed.

What do you mean exactly by "No Modules"?

You create a kernel file that you boot but many other dependancies e.g. runtime libraries, are compiled completely separately and inserted into the distro. As someone who has been involved with bespoke kernels for some years I can see that you are having trouble getting to grips with it all. Personally I would not recommend starting with the source code of a prominent distro as it will contain idiosyncrasies which will make it difficult to follow.

To (re)start your learning from ground-zero go to:

linuxfromscratch.org

and get your hands on a copy of the book (pdf).
https://linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-10.1.pdf

Read that steadily to get into understanding how a complete distro is built. You can download the lfs (Linux from Scratch) source code and compile it yourself. (You will need to initially install a running known distro in order to 'seed' your development/compilation because "you cannot compile a compiler without a compiler". Once you have compiled your own first set of tools you can dispense with the seeding operating system and just use your own. Then compile new stuff with the compiler that you compiled yourself.)

Be warned that building your own distro will take a good number of days running with 100% CPU. It ain't easy.

Good luck.

2 Likes

Did you only execute 'make' or also 'make modules'?
The command 'make' only builds the kernel.
'make modules' builds the kernel modules.

2 Likes

The general phases are:

  • unpack the source code (using git clone is probably easiest),
  • configure the kernel (I generally suggest make olddefconfig to get a basic config, then make localmodconfig to preserve existing modules as modules in the new kernel,
  • make menuconfig to tweak any settings you want to change),
  • make -j# where # is 2 times the number of cpu cores you have,
  • sudo make modules_install, and
  • sudo make install

Most of the complications come from the configuring step, because new drivers are added or old ones removed and that tends to cause a lot of prompts asking whether you want something compiled into the kernel or not. The steps above try to minimize that but won't be ideal for every situation.

Oh, and be sure to check Documentation/Changes to ensure your build tools are at least the necessary versions.

Good luck! It's much more robust than it was back in the early days, but there are still sometimes minor inconveniences.

2 Likes

@hicksd8 - I didn't think I'd be good enough to do LFS until I had building the kernel down. Perhaps I'm wrong. I will use that book later. Thank you.

@Azhrei @Toon - I've done ' make modules_install', but I have no modules when booting back into the new kernel and running lsmod. There might be 3 there instead of 20. Do the modules get installed somewhere and require insmod to manually install them?

1 Like

(Sorry for typos or autocorrect errors; I'm on my phone.)

Unfortunately, there's not enough information to help you. You don't say specifically what commands you executed so we don't know how the config file was created (for example, all modules could've been turned off so that everything is being built into the kernel). That's why I laid out the commands I would use to build a kernel that uses modules.

When you run your "modules_install" target, read the output and it'll tell you what directory is being used. Make sure that directory actually has stuff in it. In fact, look for files with th4 same name as the modules that were previously loaded using the stock kernel.

Also, many modules are demand-loaded, meaning they aren't loaded until they're needed. You could always try forcing one to be loaded by running "modprobe".

Normally when we run these module-related commands we get a log of logging information in the terminal.

Perhaps you should capture this logging information and review the entire process log and look for errors and other clues in the log?

The default location where kernel modules are installed is /lib/modules.

1 Like

Well, I must say, this time was better, but still a lot of modules are missing:

2,17d1
< ufs                    90112  0
< qnx4                   16384  0
< hfsplus               122880  0
< hfs                    65536  0
< minix                  45056  0
< ntfs                  229376  0
< vfat                   24576  0
< msdos                  20480  0
< fat                    86016  2 msdos,vfat
< jfs                   217088  0
< xfs                  2068480  0
< ext4                  950272  0
< crc16                  16384  1 ext4
< mbcache                16384  1 ext4
< jbd2                  151552  1 ext4
< dm_mod                155648  0
19c3
< drm_vram_helper        28672  1 vboxvideo
---
> drm_vram_helper        24576  1 vboxvideo
21,22c5
< af_packet              57344  4
< vmwgfx                397312  1
---
> af_packet              53248  2
24,26c7
< intel_rapl_common      28672  1 intel_rapl_msr
< ttm                    90112  3 vmwgfx,drm_vram_helper,drm_ttm_helper
< drm_kms_helper        307200  3 vmwgfx,drm_vram_helper,vboxvideo
---
> intel_rapl_common      24576  1 intel_rapl_msr
27a9
> crc32_pclmul           16384  0
29c11,15
< cec                    86016  1 drm_kms_helper
---
> vmwgfx                360448  1
> joydev                 24576  0
> mousedev               24576  0
> serio_raw              16384  0
> pcspkr                 16384  0
31,35c17
< rc_core                53248  1 cec
< snd_ac97_codec        180224  1 snd_intel8x0
< syscopyarea            16384  1 drm_kms_helper
< aesni_intel           376832  0
< sysfillrect            16384  1 drm_kms_helper
---
> snd_ac97_codec        167936  1 snd_intel8x0
37,38c19,22
< joydev                 24576  0
< sg                     45056  0
---
> snd_pcm               118784  2 snd_intel8x0,snd_ac97_codec
> snd_timer              36864  1 snd_pcm
> video                  49152  0
> aesni_intel           376832  0
39a24,28
> sg                     40960  0
> drm_kms_helper        282624  3 vmwgfx,drm_vram_helper,vboxvideo
> syscopyarea            16384  1 drm_kms_helper
> sysfillrect            16384  1 drm_kms_helper
> cryptd                 24576  2 crypto_simd,ghash_clmulni_intel
41,42d29
< snd_pcm               143360  2 snd_intel8x0,snd_ac97_codec
< cryptd                 28672  2 crypto_simd,ghash_clmulni_intel
44,46c31,33
< mousedev               24576  0
< serio_raw              16384  0
< pcspkr                 16384  0
---
> cec                    49152  1 drm_kms_helper
> rc_core                49152  1 cec
> snd                    94208  4 snd_intel8x0,snd_timer,snd_ac97_codec,snd_pcm
47a35,36
> ttm                    81920  3 vmwgfx,drm_vram_helper,drm_ttm_helper
> vboxguest             364544  1
49,50d37
< snd_timer              40960  1 snd_pcm
< snd                    98304  4 snd_intel8x0,snd_timer,snd_ac97_codec,snd_pcm
52,53c39,40
< vboxguest             409600  0
< drm                   622592  7 vmwgfx,drm_kms_helper,drm_vram_helper,vboxvideo,drm_ttm_helper,ttm
---
> drm                   540672  7 vmwgfx,drm_kms_helper,drm_vram_helper,vboxvideo,drm_ttm_helper,ttm
> fuse                  135168  1
55,59c42,45
< sunrpc                614400  1
< fuse                  155648  1
< ip_tables              32768  0
< x_tables               49152  1 ip_tables
< btrfs                1662976  1
---
> sunrpc                585728  1
> ip_tables              28672  0
> x_tables               45056  1 ip_tables
> btrfs                1572864  1
60a47,48
> libcrc32c              16384  1 btrfs
> crc32c_generic         16384  0
63,65c51
< libcrc32c              16384  2 btrfs,xfs
< crc32c_generic         16384  0
< usbhid                 57344  0
---
> usbhid                 53248  0
67c53
< cdrom                  45056  3 hfsplus,hfs,sr_mod
---
> cdrom                  40960  1 sr_mod
70,71d55
< crc32_pclmul           16384  0
< psmouse               176128  0
72a57,58
> psmouse               163840  0
> e1000                 126976  0
74d59
< e1000                 135168  0
76d60
< video                  49152  0

The only error I got was one about bzImage not being found. I ran 'make bzImage' and was able to complete. I checked the new /lib/modules/5.12.8 directory, but it seems these missing modules are not found:

$ find /lib/modules/5.12.8 -name "ufs" | wc -l
0

Any advice for this?
Thank you @Neo, @Toon and @Azhrei . I appreciate it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.