LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-12-2023, 01:52 PM   #1
audiotore341
Member
 
Registered: Jan 2023
Posts: 42

Rep: Reputation: 0
Question A way to link modules to bzImage?


Hey there! Im working on a little project of mine. I'm having a little trouble linking modules into the linux source code. (I got the code from kernel.org) but at the same time I can't tell if i'm suppose to be linking my modules into the source code itself or the compiled bzImage..

I was reading some documentation and it all talks about to compile modules into our already installed linux system's kernel rather then linking it too bzImage or the code itself. Help would be appreciated thanks!
 
Old 01-13-2023, 03:33 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
No, you don't link modules into source code; you link them to the compiled image. Or rather the udev daemon links them in as and when they are needed.

Many parts of the kernel such as hardware drivers can be treated in three different ways:
1) Compile them right in. Then they are available immediately. If you are compiling your own kernel, you can compile in the drivers for your hard drive and filesystem controllers so that the kernel can access them without needing an initrd.

2) Compile them as separate modules. These are like miniature libraries which the kernel can link to and then access at need. In a modern Linux system, this is done by udev.

3) Don't compile them at all. If you are making your own kernel, make it lean and mean.

Your bzImage becomes the core of your kernel. Rename it to something sensible and copy it to where the bootloader can find it. The modules that you have compiled end up in /lib/modules/x.y.z where the system expects them to be.
 
Old 01-13-2023, 11:26 AM   #3
audiotore341
Member
 
Registered: Jan 2023
Posts: 42

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by hazel View Post
No, you don't link modules into source code; you link them to the compiled image. Or rather the udev daemon links them in as and when they are needed.

Many parts of the kernel such as hardware drivers can be treated in three different ways:
1) Compile them right in. Then they are available immediately. If you are compiling your own kernel, you can compile in the drivers for your hard drive and filesystem controllers so that the kernel can access them without needing an initrd.

2) Compile them as separate modules. These are like miniature libraries which the kernel can link to and then access at need. In a modern Linux system, this is done by udev.

3) Don't compile them at all. If you are making your own kernel, make it lean and mean.

Your bzImage becomes the core of your kernel. Rename it to something sensible and copy it to where the bootloader can find it. The modules that you have compiled end up in /lib/modules/x.y.z where the system expects them to be.
Thank you!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling the modern 4.x kernel (bzImage, initrd.img, /lib/modules/x) on Debian without a ROOT access? patrick295767 Debian 2 01-11-2017 01:54 PM
didnt compile as modules, a way to get modules? android6011 Linux - General 6 09-06-2006 08:38 PM
Look the output of: make dep && make clean bzImage modules modules_install Hell-Shooter Linux - General 2 06-05-2004 05:05 AM
Re: modprobe: Note: /etc/modules.conf is more recent than lib/modules/2.4.9/modules.d Andy.M Linux - General 1 01-24-2002 01:50 AM
Re: modprobe: Note: /etc/modules.conf is more recent than lib/modules/2.4.9/modules.d Andy.M Linux - Newbie 2 01-24-2002 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration