kernel – passing module parameters

With normal programs that allow you pass parameters on there command line, for example

printoutmyname genux

where the program is called printoutmyname and the first parameter is genux (it is normal that the first parameter [0] is actually the program name and the second parameter [1] is the parameter that is passed)

Well in Linux kernel (where here is a example on how to compile the kernel for a ubuntu based setup) you can pass parameters to the modules that are getting loaded. One module would be your graphics card, in my case a nvidia graphics card.

To find out what parameters can be passed to the graphics card you will have to find the kernel module file (filename.ko, where the ko is the kernel object file), so to search for the nvidia.ko in my case I did

locate nvidia.ko

and then changed to that directory and did a module information on it

cd /lib/modules/2.6.31-17-generic/updates/dkms/
nvidia.ko  vboxdrv.ko  vboxnetadp.ko  vboxnetflt.ko

and doing a module information on it you call the modinfo on the kernel object file as

modinfo nvidia.ko
filename: nvidia.ko license: NVIDIA alias: char-major-195-* alias: pci:v000010DEd*sv*sd*bc03sc02i00* alias: pci:v000010DEd*sv*sd*bc03sc00i00* depends: vermagic: 2.6.31-17-generic SMP mod_unload modversions parm: NVreg_EnableVia4x:int parm: NVreg_EnableALiAGP:int parm: NVreg_ReqAGPRate:int parm: NVreg_EnableAGPSBA:int parm: NVreg_EnableAGPFW:int parm: NVreg_Mobile:int parm: NVreg_ResmanDebugLevel:int parm: NVreg_RmLogonRC:int parm: NVreg_ModifyDeviceFiles:int parm: NVreg_DeviceFileUID:int parm: NVreg_DeviceFileGID:int parm: NVreg_DeviceFileMode:int parm: NVreg_RemapLimit:int parm: NVreg_UpdateMemoryTypes:int parm: NVreg_UseVBios:int parm: NVreg_RMEdgeIntrCheck:int parm: NVreg_UsePageAttributeTable:int parm: NVreg_EnableMSI:int parm: NVreg_MapRegistersEarly:int parm: NVreg_RmNvclkIdleGraphics:int parm: NVreg_RegistryDwords:charp parm: NVreg_NvAGP:int

where the parm: is a parameter to pass to the module on load (insmod, or loaded via the kernel at boot time which you can force to load via the /etc/modules file and the parameters can be placed in the /etc/modprobe.d directory).

for example to load the nvidia module with a parameter NVreg_NvAGP you would do something like

insmod nvidia.ko NVreg_NvAGP=1

and the passing value is 1 to the NVreg_NvAGP parameter

root password reset

Within the standard ubuntu or the derviertives (kubuntu/edubuntu etc) the root password is not set and the way to gain access to the root commands is via the command line

sudo command here

I personally prefer to have root password set because then I can use the root admin rights on the desktop without having to constantly type in sudo all of the time, so to set the root password to something that I will use you can use this

sudo set password root

this will set the password to something that you can remember and thus any time that you want to have a console open as root just type in


and then the password and you are in the root console 🙂

Compile a k/ubuntu kernel

Because of the issues that I have had with a 4GB of RAM and the nvidia onboard graphics trying to grab memory where the system RAM was placed. The nvidia onboard graphics was told to grab the memory from 0xb0000000 – 0xbfffffff because that was where the ACER BIOS was telling it where to go!!. (Here for more details)

Anyway, because of this, I am having to compile up the linux kernel ubuntu style. I am using 9.10 kubuntu at present.

I have used this ubuntu guide on how to compile up a linux kernel from this ubuntu website, kernel/compile.

The main parts that I have run are, (I am not using sudo because I setup the root password so that I do not have to type in sudo all of the time, I setup the root password by sudo passwd root)

cd /usr/src/
apt-get install fakeroot kernel-wedge build-essential makedumpfile

apt-get build-dep linux

apt-get build-dep linux-image-$(uname -r)
apt-get source linux-image-$(uname -r)

debian/rules updateconfigs

cd debian.master/scripts/misc 
chmod a+x *
cd -
debian/rules updateconfigs

I go into the /usr/src, because when you get the apt-get source of a the latest linux-image it places the files within the present directory that you are using and usually the linux kernel source files are placed in /usr/src.

The reason for the chmod a+x * is because some of the debian(.master)/scripts/misc need to be updated to have there execute permissions granted.

Make some changes to the kernel files, in my case the arch/x86/pci/i386.c file. Then to compile up the kernel

fakeroot debian/rules clean
CONCURRENCY_LEVEL=2 AUTOBUILD=1 NOEXTRAS=1 fakeroot debian/rules binary-generic

4GB – 32bit northbridge BAR1 error

With the Laptop that I have, it appears to have a 32 bit northbridge with a 64 bit cpu’s, I have logged this error with the PCI kernel group because hopefully they will be able to give some advice and also I am giving data back to the Linux group on the whole.

Shall put any advice on the kernel PCI group list back on this page regarding the error, if anyone wants to look over the 2GB/4GB dmesg + /proc/iomem files just say.

“I have a acer aspire 9815 with from what I have read a 32bit Northbridge and when you add 4GB of RAM with a nVidia 256 of “virtual
ram” causes a base address registers (BAR1), but works fine with 2GB because there is a problem with the way that Linux kernel is
allocating the memory associated with the devices and places then out of range.

Here is my lspci for the PCI host bridge

Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and
945GT Express Memory Controller Hub (rev 03)
PCI bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and
945GT Express PCI Express Root Port (rev 03)

From this website it appears that some one was trying to update the PCI IOMEM part of the kernl

but says that it will be in the .30 / .31 kernel but I am not able to still use the 4GB of ram and I am using the 2.6.31-10-generic
#35-Ubuntu SMP Tue Sep 22 17:33:42 UTC 2009 i686 GNU/Linux from a kubuntu 9.10 setup and was hoping to have the fix already applied.

Was wondering since I am using the k/ubuntu kernel does the “real” kernel have the PCI IOMEM Upgrade ? or do I have pass some kernel
parameters on grub to allow for this to work correctly ? or has there been another upgrade to the PCI structure that will come in a later
release ?

Also there was some advice to update the BIOS for some laptops and set the upper memory limit, does this make the PC memory have a virtual
head to it and thus the OS will not see the rest of RAM ? or is it just for the PCI setup aspects that look at the upper memory limit and
the rest of the OS can see the and use the rest of the RAM ?

Any advice would be great.”


The only advice was that how about trying out the 64bit kernel, which is what I am using.

Linux – memory and where is it

To find out what memory you have onboard and also where it is, here is a neat command

lshw -class memory

Here is my output

       description: BIOS
       vendor: Acer
       physical id: 0
       version: V2.04 (01/15/07)
       size: 103KiB
       capabilities: isa pci pcmcia pnp apm upgrade shadowing escd cdboot acpi usb agp biosbootspecification
       description: L1 cache
       physical id: 5
       slot: L1 Cache
       size: 16KiB
       capacity: 16KiB
       capabilities: asynchronous internal write-back
       description: L2 cache
       physical id: 6
       slot: L2 Cache
       size: 4MiB
       capabilities: burst external write-back
       description: System Memory
       physical id: 12
       slot: System board or motherboard
       size: 2GiB
          description: SODIMM Synchronous
          physical id: 0
          slot: M1
          size: 1GiB
          width: 32 bits
          description: SODIMM Synchronous
          physical id: 1
          slot: M2
          size: 1GiB
          width: 32 bits

I basically have 2GiB of memory and also L1 cache (on die cache on the cpu) of 16KiB and 4MiB L2 Cache.

Here is a wiki page that details what L1 and L2 cache are CPU cache, basically L1 means on CPU die, and L2 means slightly further away from the L1 cache. If there is a memory call L1 is the first hit, then L2 and then the memory and then swap space (harddrive), the lower down the line means slower result time.

Virtual Box

After looking over the virtualization with different setups, KVM and VirtualBox I decided to use the virtualbox method because it just appeared to be nicer and with a nice GUI per machine just felt nice.

With the additions of the Guest Additions to allow for sharing of folders from the host machine to the virtual one and also the mouse was no longer taken within the virtual machine, I just liked it and to setup a bridge for the virtual machine to use for the networking I created a small script that does the job of deleting the KVM inserting modules into K/Ubuntu.

Here it is


# to remove any kernel modules for kvm and then bring up the bridge for eth0
TMP=`lsmod | grep kvm`
RESULT=`echo $TMP | cut -d \  -f 1,4`

if [ -n "$RESULT" ]; then

        for i in 1 2
                rmmod `echo $RESULT | cut -d \  -f $i`
        echo "No kernel modules"

# setup the eth0 for working with the bridge
ifconfig eth0
#ifconfig br0 down

#setup the bridge and bring it up
brctl addbr br0
brctl addif br0 eth0

ifconfig br0 up