[gentoo-user] Re: modules built post kernel install (on the fly)
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
[gentoo-user] Re: modules built post kernel install (on the fly)
Peter <[EMAIL PROTECTED]> 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
[gentoo-user] Re: modules built post kernel install (on the fly)
Masood Ahmed <[EMAIL PROTECTED]> 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
[gentoo-user] Re: modules built post kernel install (on the fly)
On Sat, 04 Mar 2006 09:35:35 -0600, Harry Putnam wrote: > Peter <[EMAIL PROTECTED]> 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
[gentoo-user] Re: modules built post kernel install (on the fly)
Peter <[EMAIL PROTECTED]> 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
[gentoo-user] Re: modules built post kernel install (on the fly)
Holly Bostick <[EMAIL PROTECTED]> 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
Re: [gentoo-user] Re: modules built post kernel install (on the fly)
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 pgpKZzB9mlwwK.pgp Description: PGP signature
Re: [gentoo-user] Re: modules built post kernel install (on the fly)
Harry Putnam wrote: > Masood Ahmed <[EMAIL PROTECTED]> 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 pgpaSOYhgNMI8.pgp Description: PGP signature
Re: [gentoo-user] Re: modules built post kernel install (on the fly)
Builtin means it's built into the kernel - the * indicates that. On Saturday March 4 2006 23:03, Harry Putnam wrote: > Peter <[EMAIL PROTECTED]> 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
Re: [gentoo-user] Re: modules built post kernel install (on the fly)
Harry Putnam schreef: > Peter <[EMAIL PROTECTED]> 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/ 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
Re: [gentoo-user] Re: modules built post kernel install (on the fly)
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
Re: [gentoo-user] Re: modules built post kernel install (on the fly)
On Saturday 04 March 2006 10:07, Masood Ahmed <[EMAIL PROTECTED]> wrote about 'Re: [gentoo-user] Re: modules built post kernel install (on the fly)': > Harry Putnam wrote: > > Masood Ahmed <[EMAIL PROTECTED]> 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 sharedbuffers cached Mem: 40227043934496 88208 0 2550282858408 -/+ buffers/cache: 8210603201644 Swap: 7992312 11287991184 Total:1201501639356248079392 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