* [gentoo-user] modules built post kernel install (on the fly) @ 2006-03-04 15:15 Harry Putnam 2006-03-04 15:23 ` [gentoo-user] " Peter 2006-03-04 15:28 ` [gentoo-user] " Masood Ahmed 0 siblings, 2 replies; 14+ messages in thread From: Harry Putnam @ 2006-03-04 15:15 UTC (permalink / raw To: gentoo-user Is this possible: Compile a module by itself (not during kernel compile) and insert that module into a running kernel. I'm pretty sure this is possible but have no idea how to do it. Pawing thru google. `site:gentoo.org modules "on the fly" ' and similar strings .... even just `kernel module' Turns up scads of stuff but none of it is hitting this head on.. or I didn't paw far enough.... so asking here for pointers to documentation that will cover this. -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 15:15 [gentoo-user] modules built post kernel install (on the fly) Harry Putnam @ 2006-03-04 15:23 ` Peter 2006-03-04 15:35 ` Harry Putnam 2006-03-04 15:40 ` Masood Ahmed 2006-03-04 15:28 ` [gentoo-user] " Masood Ahmed 1 sibling, 2 replies; 14+ messages in thread From: Peter @ 2006-03-04 15:23 UTC (permalink / raw To: gentoo-user On Sat, 04 Mar 2006 09:15:04 -0600, Harry Putnam wrote: > Is this possible: > > Compile a module by itself (not during kernel compile) and insert that > module into a running kernel. > > I'm pretty sure this is possible but have no idea how to do it. Pawing > thru google. `site:gentoo.org modules "on the fly" ' and similar strings > .... even just `kernel module' > > Turns up scads of stuff but none of it is hitting this head on.. or I > didn't paw far enough.... so asking here for pointers to documentation > that will cover this. Yes. cd /usr/src/linux make menuconfig or make xconfig choose the module option you wish to enable Select whether to build into the kernel or as a module. exit and save make make modules_install You should not have to copy bzImage unless you built your new modules into the kernel. Then edit your /etc/autoload directory to include the module you want to modprobe into the system. easy! -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 15:23 ` [gentoo-user] " Peter @ 2006-03-04 15:35 ` Harry Putnam 2006-03-04 16:16 ` Peter 2006-03-04 15:40 ` Masood Ahmed 1 sibling, 1 reply; 14+ messages in thread From: Harry Putnam @ 2006-03-04 15:35 UTC (permalink / raw To: gentoo-user Peter <pete4abw@comcast.net> writes: > Yes. > > cd /usr/src/linux > make menuconfig or make xconfig > choose the module option you wish to enable > Select whether to build into the kernel or as a module. > exit and save > make > make modules_install > > You should not have to copy bzImage unless you built your new modules into > the kernel. Haa... thanks for the step thru... and I'm guessing if you don't want to reboot you can insmod this module into running kernel? -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 15:35 ` Harry Putnam @ 2006-03-04 16:16 ` Peter 2006-03-05 4:03 ` Harry Putnam 0 siblings, 1 reply; 14+ messages in thread From: Peter @ 2006-03-04 16:16 UTC (permalink / raw To: gentoo-user On Sat, 04 Mar 2006 09:35:35 -0600, Harry Putnam wrote: > Peter <pete4abw@comcast.net> writes: > >> Yes. >> >> cd /usr/src/linux >> make menuconfig or make xconfig >> choose the module option you wish to enable >> Select whether to build into the kernel or as a module. >> exit and save >> make >> make modules_install >> >> You should not have to copy bzImage unless you built your new modules into >> the kernel. > > Haa... thanks for the step thru... and I'm guessing if you don't want > to reboot you can insmod this module into running kernel? That is correct. Unless you alter bzImage, modprobe newmodule should work just fine. If your new module is built in, you will need to reload the kernel (reboot). Good luck! -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 16:16 ` Peter @ 2006-03-05 4:03 ` Harry Putnam 2006-03-05 4:08 ` Brett I. Holcomb 2006-03-05 4:34 ` Holly Bostick 0 siblings, 2 replies; 14+ messages in thread From: Harry Putnam @ 2006-03-05 4:03 UTC (permalink / raw To: gentoo-user Peter <pete4abw@comcast.net> writes: > That is correct. Unless you alter bzImage, modprobe newmodule should work > just fine. If your new module is built in, you will need to reload the > kernel (reboot). Ok, this is confusing to me... What do you mean by `built in'. I'm thinking the very nature of a module is that it isn't built in. Or do you just mean I'd chose `*' instead of `m' and move bzImage into place in /boot? -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-05 4:03 ` Harry Putnam @ 2006-03-05 4:08 ` Brett I. Holcomb 2006-03-05 4:34 ` Holly Bostick 1 sibling, 0 replies; 14+ messages in thread From: Brett I. Holcomb @ 2006-03-05 4:08 UTC (permalink / raw To: gentoo-user Builtin means it's built into the kernel - the * indicates that. On Saturday March 4 2006 23:03, Harry Putnam wrote: > Peter <pete4abw@comcast.net> writes: > > That is correct. Unless you alter bzImage, modprobe newmodule should work > > just fine. If your new module is built in, you will need to reload the > > kernel (reboot). > > Ok, this is confusing to me... What do you mean by `built in'. I'm > thinking the very nature of a module is that it isn't built in. > > Or do you just mean I'd chose `*' instead of `m' and move bzImage into > place in /boot? -- Brett I. Holcomb -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-05 4:03 ` Harry Putnam 2006-03-05 4:08 ` Brett I. Holcomb @ 2006-03-05 4:34 ` Holly Bostick 2006-03-05 5:11 ` Harry Putnam 1 sibling, 1 reply; 14+ messages in thread From: Holly Bostick @ 2006-03-05 4:34 UTC (permalink / raw To: gentoo-user Harry Putnam schreef: > Peter <pete4abw@comcast.net> writes: > >> That is correct. Unless you alter bzImage, modprobe newmodule >> should work just fine. If your new module is built in, you will >> need to reload the kernel (reboot). > > Ok, this is confusing to me... What do you mean by `built in'. I'm > thinking the very nature of a module is that it isn't built in. > > Or do you just mean I'd chose `*' instead of `m' and move bzImage > into place in /boot? > (Most) kernel modules can be either built into the kernel, or separately from the kernel. Only a very few can only be builtin or only loadable. But whichever they are, they're really all modules-- the kernel is a modular framework, after all, which is why you have to configure it-- to say which kernel modules you want to build, and how you want them built (as builtin to the kernel, or as separate loadable modules). If they're built into the kernel "body" ("*"), they're called "built-in", in which case they are an integral part of the bzImage, and increase the size of the kernel. Builtins will also always be loaded by the kernel just because they're part of the kernel; this is why you must build certain modules (like for filesystems) as builtins and not as modules, so the kernel has them loaded before it needs them to read the relevant filesystem. If the modules built as dynamically loadable modules ("M". which produces little chunks of code-- *.ko files, I think-- in /usr/lib/modules/<kernel_version> when you run make modules_install), they are called "modules" (or loadable modules, or dynamic modules). In this case, they 1) do not increase the size of the kernel (because they're not in the bzImage that is the kernel), 2) they are dynamically loadable (modprobe) and removeable (modprobe -r), and may or may not exist at all (because you have the ability to pick and choose which loadable modules you actually want to build in your kernel config). So what Peter meant was that if you add the modules as loadable modules (by choosing "M"), you wouldn't have to do anything other than make and make modules_install to install the new module (you need to do a make so that the kernel config knows that there's a new module *to* make), but because the body of the kernel has not actually changed (since loadable modules are not compiled into the bzImage like the builtin * modules are), you don't actually have to install the new bzImage, because it's exactly the same as the one you had previously installed. You should be able to modprobe the new module and go right on without rebooting. However, if you compiled the new modules directly into the kernel (by choosing "*", or compiling a module that has a sub-function that requires a *), then you would have to install the new bzImage and reboot, because the bzImage (the kernel) has actually changed. Hope this helps explain things, Holly -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-05 4:34 ` Holly Bostick @ 2006-03-05 5:11 ` Harry Putnam 2006-03-05 7:19 ` Ryan Tandy 0 siblings, 1 reply; 14+ messages in thread From: Harry Putnam @ 2006-03-05 5:11 UTC (permalink / raw To: gentoo-user Holly Bostick <motub@planet.nl> writes: > So what Peter meant was ....] [...] Yeah thats what I suggested it meant. I added some unnecessary confusion by saying `the very nature of module is that it is not built in'... sorry. Just sloppy thinking here thanks for clearing that up very well. But since my original question was: [How to -ed HP] "Compile a module by itself (not during kernel compile) and insert that module into a running kernel." That would rule out `*' so that's why it confused me. > However, if you compiled the new modules directly into the kernel (by > choosing "*", or compiling a module that has a sub-function that > requires a *), then you would have to install the new bzImage and > reboot, because the bzImage (the kernel) has actually changed. Nothing different really than just compiling a kernel.... In fact it sounds like the whole process is required for adding a new `loadable' module too, just leaving out the moving of bzImage. And no reboot required. I guess I sort of thought there was some trick way to just compile a module and not do all the linking and grinding of `make' against the whole tree. -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-05 5:11 ` Harry Putnam @ 2006-03-05 7:19 ` Ryan Tandy 0 siblings, 0 replies; 14+ messages in thread From: Ryan Tandy @ 2006-03-05 7:19 UTC (permalink / raw To: gentoo-user Harry Putnam wrote: > I guess I sort of thought there was some trick way to just compile a > module and not do all the linking and grinding of `make' against the > whole tree. > Unless you've done 'make clean' previously, 'make' will only compile required files based on changes you've made to your config. My laptop runs a monolithic kernel with very few modules (PCMCIA and USB hotplugged stuff), but as long as I'm not changing versions, adding or removing features usually only involves compiling a few source files and linking the bzImage. If you just want to build new modules and haven't made any changes to the actual kernel, 'make' can be left out since the bzImage doesn't need rebuilding - 'make modules modules_install' will be sufficient to build and install your newly selected modules. If you've run 'make clean', which removes all previously compiled objects, a monolithic kernel will have to be rebuilt from scratch - but once again, running only 'make modules modules_install' will rebuild all your modules but leave the kernel itself alone. HTH. -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 15:23 ` [gentoo-user] " Peter 2006-03-04 15:35 ` Harry Putnam @ 2006-03-04 15:40 ` Masood Ahmed 1 sibling, 0 replies; 14+ messages in thread From: Masood Ahmed @ 2006-03-04 15:40 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 1335 bytes --] Peter wrote: > On Sat, 04 Mar 2006 09:15:04 -0600, Harry Putnam wrote: > > > Is this possible: > > > > Compile a module by itself (not during kernel compile) and insert that > > module into a running kernel. > > > > Yes. > > cd /usr/src/linux > make menuconfig or make xconfig > choose the module option you wish to enable > Select whether to build into the kernel or as a module. > exit and save > make > make modules_install > > You should not have to copy bzImage unless you built your new modules into > the kernel. > > Then edit your /etc/autoload directory to include the module you want to > modprobe into the system. > This sounds simpler than what i had thought. I suggest giving this a try. My earlier suggestion to read the Makefiles has been taken back now.. :) -- Linux Kernel : 2.6.15-gentoo-r7 GCC version : 4.0.2 (Gentoo 4.0.2-r3, pie-8.7.8) Processor : AMD Athlon XP 2600+ RAM : 1 GB DDR 333 SDRAM CFLAGS USED : -march=athlon-xp -O3 -m3dnow -msse -mmmx -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -ftracer -fno-crossjumping -falign-functions=16 -falign-loops=16 -falign-jumps=16 -fno-align-labels -mfpmath=387,sse -maccumulate-outgoing-args CXXFLAGS USED : $(CFLAGS) -fvisibility-inlines-hidden [-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] modules built post kernel install (on the fly) 2006-03-04 15:15 [gentoo-user] modules built post kernel install (on the fly) Harry Putnam 2006-03-04 15:23 ` [gentoo-user] " Peter @ 2006-03-04 15:28 ` Masood Ahmed 2006-03-04 15:41 ` [gentoo-user] " Harry Putnam 1 sibling, 1 reply; 14+ messages in thread From: Masood Ahmed @ 2006-03-04 15:28 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 1170 bytes --] Harry Putnam wrote: > Is this possible: > > Compile a module by itself (not during kernel compile) and insert > that module into a running kernel. It can be done, the best example of it being done is the NVidia kernel module. Although it seems, you want to compile a module inside a kernel tree. I think it'll be lot complex. I dont have any hands on experience in this, but i suggest take a look at the Makefiles of other kernel modules available outside the kernel tree. Sorry cant give you specifics on how to do it. PS: Also ALSA-driver package are nothing but kernel modules, you may want to check thier makefiles as well. -- Linux Kernel : 2.6.15-gentoo-r7 GCC version : 4.0.2 (Gentoo 4.0.2-r3, pie-8.7.8) Processor : AMD Athlon XP 2600+ RAM : 1 GB DDR 333 SDRAM CFLAGS USED : -march=athlon-xp -O3 -m3dnow -msse -mmmx -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -ftracer -fno-crossjumping -falign-functions=16 -falign-loops=16 -falign-jumps=16 -fno-align-labels -mfpmath=387,sse -maccumulate-outgoing-args CXXFLAGS USED : $(CFLAGS) -fvisibility-inlines-hidden [-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 15:28 ` [gentoo-user] " Masood Ahmed @ 2006-03-04 15:41 ` Harry Putnam 2006-03-04 16:07 ` Masood Ahmed 0 siblings, 1 reply; 14+ messages in thread From: Harry Putnam @ 2006-03-04 15:41 UTC (permalink / raw To: gentoo-user Masood Ahmed <coolmasood@gmail.com> writes: [...] Thanks Masood, for the pointers.. I have a question about your sig. > -- > Linux Kernel : 2.6.15-gentoo-r7 > GCC version : 4.0.2 (Gentoo 4.0.2-r3, pie-8.7.8) > Processor : AMD Athlon XP 2600+ > RAM : 1 GB DDR 333 SDRAM > CFLAGS USED : -march=athlon-xp -O3 -m3dnow -msse -mmmx -pipe > -fomit-frame-pointer -momit-leaf-frame-pointer -ftracer > -fno-crossjumping -falign-functions=16 -falign-loops=16 > -falign-jumps=16 -fno-align-labels -mfpmath=387,sse > -maccumulate-outgoing-args > CXXFLAGS USED : $(CFLAGS) -fvisibility-inlines-hidden Do you get that info from a single command or several? -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 15:41 ` [gentoo-user] " Harry Putnam @ 2006-03-04 16:07 ` Masood Ahmed 2006-03-05 22:18 ` Boyd Stephen Smith Jr. 0 siblings, 1 reply; 14+ messages in thread From: Masood Ahmed @ 2006-03-04 16:07 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 1275 bytes --] Harry Putnam wrote: > Masood Ahmed <coolmasood@gmail.com> writes: > [...] > Thanks Masood, for the pointers.. I have a question about your sig. > > (....) > > Do you get that info from a single command or several? > The answer is several, for kernel version i did 'uname -r' for gcc-version i did 'gcc -v' for processor i did 'cat /proc/cpuinfo' for ram 'free -t' for CFLAGS 'cat /etc/make.conf | grep CFLAGS' for CXXFLAGS 'cat /etc/make.conf | grep CXXFLAGS' I think this is not what you expected. I dont have enough sed and grep knowledge to automate the process, but i'm learning it. I'd like to write a script that would output only the required contents from the output of the commands above. Got any idea's anyone? -- Linux Kernel : 2.6.15-gentoo-r7 GCC version : 4.0.2 (Gentoo 4.0.2-r3, pie-8.7.8) Processor : AMD Athlon XP 2600+ RAM : 1 GB DDR 333 SDRAM CFLAGS USED : -march=athlon-xp -O3 -m3dnow -msse -mmmx -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -ftracer -fno-crossjumping -falign-functions=16 -falign-loops=16 -falign-jumps=16 -fno-align-labels -mfpmath=387,sse -maccumulate-outgoing-args CXXFLAGS USED : $(CFLAGS) -fvisibility-inlines-hidden [-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-user] Re: modules built post kernel install (on the fly) 2006-03-04 16:07 ` Masood Ahmed @ 2006-03-05 22:18 ` Boyd Stephen Smith Jr. 0 siblings, 0 replies; 14+ messages in thread From: Boyd Stephen Smith Jr. @ 2006-03-05 22:18 UTC (permalink / raw To: gentoo-user On Saturday 04 March 2006 10:07, Masood Ahmed <coolmasood@gmail.com> wrote about 'Re: [gentoo-user] Re: modules built post kernel install (on the fly)': > Harry Putnam wrote: > > Masood Ahmed <coolmasood@gmail.com> writes: > > Thanks Masood, for the pointers.. I have a question about your sig. > > Do you get that info from a single command or several? > > The answer is several, > for kernel version i did 'uname -r' > for gcc-version i did 'gcc -v' > for processor i did 'cat /proc/cpuinfo' > for ram 'free -t' > for CFLAGS 'cat /etc/make.conf | grep CFLAGS' > for CXXFLAGS 'cat /etc/make.conf | grep CXXFLAGS' > > I think this is not what you expected. I dont have enough sed and grep > knowledge to automate the process, but i'm learning it. I'd like to > write a script that would output only the required contents from the > output of the commands above. > > Got any idea's anyone? Starting from what you gave me, here's what I have: echo -n "Linux Kernel : "; uname -r; echo -n "GCC version : "; gcc -v 2>&1 | tail -n 1 | cut -d' ' -f3-; PROCS="$(grep "model name" /proc/cpuinfo)"; PROC_CNT=$(echo "$PROCS" | wc -l); echo -n "Processor : "; if [ "$PROC_CNT" -gt 1 ]; then echo -n "${PROC_CNT}x "; fi; echo "$PROCS" | head -n 1 | sed -e 's/^model name[[:space:]]*: //'; echo -n "CFLAGS USED : "; grep CFLAGS /etc/make.conf | grep -v '^[[:space:]]*#' | grep -v CXXFLAGS | sed -e 's/CFLAGS="//' -e 's/"[[:space:]]*$//'; echo -n "CXXFLAGS USED : "; grep CXXFLAGS /etc/make.conf | sed -e 's/CXXFLAGS="//' -e 's/"[[:space:]]*$//' Which, on my system, gives: Linux Kernel : 2.6.16-rc4-mm2 GCC version : 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9) Processor : 4x Dual Core AMD Opteron(tm) Processor 275 CFLAGS USED : -O2 -pipe CXXFLAGS USED : ${CFLAGS} I highly doubt you got your ram line from 'free -t', on my system it gives: total used free shared buffers cached Mem: 4022704 3934496 88208 0 255028 2858408 -/+ buffers/cache: 821060 3201644 Swap: 7992312 1128 7991184 Total: 12015016 3935624 8079392 Which doesn't tell me it'd DDR or SDRAM, nor if I'm using one stick or many. Modifying my script to break long CFLAGS and also accent CFLAGS that span multiple physical lines in make.conf is left as an excersize for the reader. -- "If there's one thing we've established over the years, it's that the vast majority of our users don't have the slightest clue what's best for them in terms of package stability." -- Gentoo Developer Ciaran McCreesh -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2006-03-05 22:25 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-03-04 15:15 [gentoo-user] modules built post kernel install (on the fly) Harry Putnam 2006-03-04 15:23 ` [gentoo-user] " Peter 2006-03-04 15:35 ` Harry Putnam 2006-03-04 16:16 ` Peter 2006-03-05 4:03 ` Harry Putnam 2006-03-05 4:08 ` Brett I. Holcomb 2006-03-05 4:34 ` Holly Bostick 2006-03-05 5:11 ` Harry Putnam 2006-03-05 7:19 ` Ryan Tandy 2006-03-04 15:40 ` Masood Ahmed 2006-03-04 15:28 ` [gentoo-user] " Masood Ahmed 2006-03-04 15:41 ` [gentoo-user] " Harry Putnam 2006-03-04 16:07 ` Masood Ahmed 2006-03-05 22:18 ` Boyd Stephen Smith Jr.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox