WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Compiling kernel and modules on TC  (Read 46098 times)

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Compiling kernel and modules on TC
« on: January 28, 2009, 09:09:42 AM »
This post was taken from another thread dealing with kernel modules and may be helpful for building kernel module extensions.

For those new to kernel building on TC, here is a simple and convenient example way of dealing with the kernel source.  You can create a directory on one of your hard drive partitions, say /mnt/hda5, and call it src or a name of your liking.  Then download the kernel source linux-2.6.26.tar.{gz,bz2} and place it in that directory. Have the compile extension loaded and do something like this:

# mkdir /mnt/hda5/src
# cp linux-2.6.26.tar.gz /mnt/hda5/src/
# cd /mnt/hda5/src
# tar xzvf linux-2.6.26.tar.gz
# ln -s linux-2.6.26 linux    #personal preference
# mkdir /usr/src
# mount --bind /mnt/hda5/src /usr/src
# cd /usr/src/linux
# make mrproper    # a recommended step even for a newly untarred source,
# cp /path/to/config-2.6.26-tinycore /usr/src/linux/.config   # do this after any running of 'make mrproper' as 'make mrproper' will wipe your .config
# make menuconfig     # Make your kernel config choices here
# make all  # or "make modules" for just building modules
# make modules_install  # or make modules_install INSTALL_MOD_PATH=/somewhere to install them elsewhere

If you want the kernel image itself, it resides in /usr/src/linux/arch/i386/boot/bzImage.  You can copy it from there.  Make modules_install installs the modules to /lib/modules/...  .  Find the modules in /lib/modules being sure to also get their dependencies.  Be sure to run "depmod -a" before you try to use the modules on the currently running system or on later reboot unless they are part of a .tcem extension.  Hope this may help those who have not built a TC kernel but would like to.

I have not applied the boot image patch slnce it does not affect modules.

After a reboot, you can make the source directory on /mnt/hda5/src part of your system again by just doing this:

# mkdir /usr/src
# mount --bind /mnt/hda5/src /usr/src
« Last Edit: February 16, 2009, 08:43:59 AM by Jason W »

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: Compiling kernel and modules on TC
« Reply #1 on: January 29, 2009, 02:55:55 PM »
I'd like to see this linked to the main tc wiki page.   

Offline kerpob

  • Jr. Member
  • **
  • Posts: 83
Re: Compiling kernel and modules on TC
« Reply #2 on: February 18, 2009, 05:54:36 AM »
I might have a go at building an eee specific version of the kernel (did one some time ago for Debian and it worked out OK). However, what extensions will I need in order for make and all the other commands to work?
« Last Edit: February 18, 2009, 12:55:51 PM by kerpob »
eee user. From Xandros to Debian via Breeezy to TCL.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: Compiling kernel and modules on TC
« Reply #3 on: February 18, 2009, 08:49:04 AM »
Compiletc.tce or compiletc.tcz is the main one.  I normally have perl_xml loaded too when compiling, but I don't think it is necessary for the kernel.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Compiling kernel and modules on TC
« Reply #4 on: February 18, 2009, 07:36:56 PM »
In fact you'll need perl_xml (or perl5) to compile the kernel as well.

Offline kerpob

  • Jr. Member
  • **
  • Posts: 83
Re: Compiling kernel and modules on TC
« Reply #5 on: February 19, 2009, 12:34:38 AM »
In fact you'll need perl_xml (or perl5) to compile the kernel as well.
Yes - found that out last night when just about to leave the eee to compile overnight after a merry couple of hours with menuconfig.

Will try again tonight, probably.
eee user. From Xandros to Debian via Breeezy to TCL.

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: Compiling kernel and modules on TC
« Reply #6 on: February 19, 2009, 01:01:44 AM »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Compiling kernel and modules on TC
« Reply #7 on: February 19, 2009, 02:17:13 AM »
I definitely agree with Rob Landley. Perl should not be needed here, as was not needed before 2.6.25. But, I think it's still in .28. Hopefully they'll come to the better conclusion of just using shell scripts instead of perl, python, lua, insert interpreted language few people use here.
The only barriers that can stop you are the ones you create yourself.

Offline kerpob

  • Jr. Member
  • **
  • Posts: 83
Re: Compiling kernel and modules on TC
« Reply #8 on: February 19, 2009, 04:21:13 AM »
I definitely agree with Rob Landley. Perl should not be needed here, as was not needed before 2.6.25. But, I think it's still in .28. Hopefully they'll come to the better conclusion of just using shell scripts instead of perl, python, lua, insert interpreted language few people use here.
It was the 2.6.28.6 that I was compiling & crashed fairly quickly through lack of perl.

Are there any unusual kernel configs set that are required by tinycore that I should know about? For example, CONFIG_CRAMFS is not set by default in menuconfig - and I think the TCZs use it.
eee user. From Xandros to Debian via Breeezy to TCL.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Compiling kernel and modules on TC
« Reply #9 on: February 19, 2009, 04:30:34 AM »
Our .config is available at a mirror near you - look for release/src/config-2.6.26-tinycore :)

Cramfs yeah, I think zisofs is disabled by default too (transparent compression of iso9660) (currently tcz are one of these two formats)
The only barriers that can stop you are the ones you create yourself.

Offline kerpob

  • Jr. Member
  • **
  • Posts: 83
Re: Compiling kernel and modules on TC
« Reply #10 on: February 19, 2009, 07:05:39 AM »
Our .config is available at a mirror near you - look for release/src/config-2.6.26-tinycore :)

Cramfs yeah, I think zisofs is disabled by default too (transparent compression of iso9660) (currently tcz are one of these two formats)
CONFIG_ZISOFS - listed under CD/DVD file systems!
eee user. From Xandros to Debian via Breeezy to TCL.

Offline kerpob

  • Jr. Member
  • **
  • Posts: 83
Re: Compiling kernel and modules on TC
« Reply #11 on: February 20, 2009, 01:34:11 AM »
I used perl5 from tce and it compiled fine... only 3 modules - bit annoying as I was aiming for none.

Now - do I need to create a new initrd (& how on tcl), or can I use the one already there for the old kernel?
« Last Edit: February 20, 2009, 01:39:49 AM by kerpob »
eee user. From Xandros to Debian via Breeezy to TCL.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Compiling kernel and modules on TC
« Reply #12 on: February 20, 2009, 01:41:32 AM »
Since on TC the initramfs is the OS :)

If you don't need the new modules, you can use the old initramfs.
If you do, you'd just add the modules there, and remove the old ones. On how to do this see the wiki page "Remastering"
The only barriers that can stop you are the ones you create yourself.

Offline kerpob

  • Jr. Member
  • **
  • Posts: 83
Re: Compiling kernel and modules on TC
« Reply #13 on: February 20, 2009, 08:34:48 AM »
Since on TC the initramfs is the OS :)

If you don't need the new modules, you can use the old initramfs.
If you do, you'd just add the modules there, and remove the old ones. On how to do this see the wiki page "Remastering"
Tried it with the old initrd and it booted to jwm ok, but no keys or the mouse (touchpad on the eee) worked.

So, following the remastering instructions I put my 3 modules into lib/modules and rebuilt  a new initrd.

This time only 1 module failed (hid_dummy, which is apparently an unused relic) but still jwm won't allow mouse or keys - although i can do ctrl-alt-backspace and drop to a root prompt which I can type away merrily into.

I think I might be missing other important things from my kernel, but not sure what they are!
eee user. From Xandros to Debian via Breeezy to TCL.

Offline softwaregurl

  • Suspended
  • Full Member
  • ***
  • Posts: 109
Re: Compiling kernel and modules on TC
« Reply #14 on: February 21, 2009, 02:45:25 PM »
I failed so many times trying to get the multimedia modules right I finaly just put it all in a few scripts.

this all happens from a root terminal and in the same directory as the kernel source and .config.  Theres also the src directory and symlink already
Code: [Select]
rm -rv ./src/linux-2.6.26
cd src
tar xzvf linux-2.6.26.tar.bz2
mkdir -p /usr/src
mount --bind /mnt/sda1/src /usr/src
cd /usr/src/linux
make mrproper
cp /mnt/sda1/config-2.6.26-tinycore /usr/src/linux/.config
make menuconfig
I split it up here so I could save the new .config elsewhere or load an old one (or just to check things out).
Code: [Select]
cd /usr/src/linux
make all
mkdir -pv /tmp/usr/local
make modules_install INSTALL_MOD_PATH=/tmp/usr/local/
#rm -v /tmp/usr/local/lib/modules/2.6.26-tinycore/source
cd /tmp/
find usr/ -not -type d >new-modules.lst
This makes and installs for a PPI compatible extension.  Now edit out everything that doesn't belong from new-modules.lst. The commented out line, I may well have done something wrong.  Somehow I ended up with a symlink to the entire source.  It was getting late (thats my excuse and I'm sticking with it).  Theres other modules I want so I'll find out soon.
Then just
Code: [Select]
tar -zcvf new-modules.tcem -T new-modules.lstrename and cp it to the tce directory (I use optional) and convert to tczm with tce2tcz.sh

Old wounds that have never healed need to be re-exposed before the cure can be applied.  The cure must be available before the wound is re-exposed.