Tiny Core Linux
Tiny Core Extensions => TCE Tips & Tricks => Topic started by: Jason W 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
-
I'd like to see this linked to the main tc wiki page.
-
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?
-
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.
-
In fact you'll need perl_xml (or perl5) to compile the kernel as well.
-
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.
-
on perl dependency: http://lkml.org/lkml/2009/1/2/20
-
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.
-
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.
-
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)
-
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!
-
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?
-
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"
-
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!
-
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 alreadyrm -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).
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
tar -zcvf new-modules.tcem -T new-modules.lst
rename and cp it to the tce directory (I use optional) and convert to tczm with tce2tcz.sh
-
Well on my 4th attempt I have succeeded! I am posting this from tcl 2.6.28.6 on the eee. Only the wireless is called wlan0 instead of ath0 now for some reason.
My first 3 attempts got as far as a frozen jwm, although I could drop to cli and connect to the internet there. Only succeeded when I just copied the existing tcl .config file and then got rid of non eee stuff and enabled the atheros wireless driver.
EDIT: Still need the wireless tools tce to get wireless up.
-
Couple of problems I'm having. Hope someone can help.
1. I have modified bootlocal.sh with 3 lines to get the wireless working (ifconfig wlan0 up then iwconfig wlan0 essid any then udhcpc -i wlan0). Doesn't seem to work at boot, but does if I run it after boot (by simply clicking on it in Rox file manager.
2. No sound. Have installed oss and also tried alsa, but soundon and alsaconf commands aren't recognised. Now my new kernel doesn't allow modules - does that matter or is it something else?
Actually - while typing this I've realised that I ran the boot command home=sda2 but forgot to add it permanently in grub, so local copies going missing may solve either or both of the above. Will edit this with a, possibly, shamefaced update in a few moments... :-[
-
1. It probably needs to wait some secs to allow the wireless to initialize. For example "sleep 5" right before the ifconfig
2. Both the OSS and ALSA extensions have the support in modules; if your kernel doesn't support modules, the relevant driver can't be loaded.
To get over this you'd need to compile the relevant module into the kernel, which is only currently possible for ALSA.
-
1. It probably needs to wait some secs to allow the wireless to initialize. For example "sleep 5" right before the ifconfig
2. Both the OSS and ALSA extensions have the support in modules; if your kernel doesn't support modules, the relevant driver can't be loaded.
To get over this you'd need to compile the relevant module into the kernel, which is only currently possible for ALSA.
1. No joy - put sleep before and after. Must be something else. Is there a way to run the commands after jwm is active?
2. Thanks - I can't remember if I had the drivers compiled into the kernel or not. Just have to wade through menuconfig to find out
-
2. Thanks - I can't remember if I had the drivers compiled into the kernel or not. Just have to wade through menuconfig to find out
If I remember correctly, the "soundcore" module is not enabled in the default tc config - this is required for alsa to work.
-
Wireless commands need full path when run from /opt/bootlocal.sh
Add the path for your iwconfig and you should be fine.
-
@Juanito - Yes, I've looked at my kernel .config and I didn't do sound, but unfortunately for me I can't rebuild the kernel yet as I made a fresh install of tcl and then installed the compiletc having forgotten to add home=sda2 to grub boot, so it is not installed properly & won't recognise "make".
This is actually a bit of a fundamental problem with home=sda2 option. Closing down always prompts for backup, and if you do this once then you are stuck with a slowed down boot as there is an attempted restore each boot. It also means that changes to other directories (e.g. opt for background images and the bootlocal script) are not saved if you don't do the backup. Is there a way around this - e.g. cor home=sda2 to also include opt?
@roberts - thanks! Will give it a try, but as opt is not saved at exit might be a bit pointless.
-
recompiled the kernel with both alsa and oss, but still no sound.
soundon has the messages:
warning cannot locate the linux kernel development package for linux kernel version 2.6.28.6-tinycore
...
error: kernel directory lib/modules/2.6.28.6-tinycore does not exist
alsaconf when I type it, says:
unable to execute /usr/local/sbin/alsaconf no such file or directory
Help appreciated!
-
alsaconf is in the alsa.tcel (most likely) or alsa_modules.tcem (possibly) extension
-
alsaconf is in the alsa.tcel (most likely) or alsa_modules.tcem (possibly) extension
Yes - the former installs the latter as a dependency. But didn't work for me.
-
If you try the two or three commands listed in alsa.tcel.info, do you get any error messages?
-
If you try the two or three commands listed in alsa.tcel.info, do you get any error messages?
sudo alsaconf gives:
unable to execute /usr/local/sbin/alsaconf no such file or directory
but alsaconf is in that directory, as is alsactl. Same result even if I run same command from /usr/local/sbin/
sudo udevtrigger --subsystem-match=sound
no response, but no error message either. just straight to next command.
speaker-test seems to be working... apart from no sound!
-
sudo alsaconf gives:
unable to execute /usr/local/sbin/alsaconf no such file or directory
This sounds like you need the bash extension loaded - if you look at alsaconf with a text editor, does the first line contain "bash"?
-
sudo alsaconf gives:
unable to execute /usr/local/sbin/alsaconf no such file or directory
This sounds like you need the bash extension loaded - if you look at alsaconf with a text editor, does the first line contain "bash"?
Bash loads as a dependancy... It also doesn't work on the normal tinycore kernel, with the same error message, which suggests to me that either alsa tce isn't working or my eee doesn't accept alsa.
-
Regarding bash:
It sounds like bash did not create the /bin/bash symlink. I have had that happen for reasons I didn't investigate as it normally works fine. Try recreating /bin/bash:
ln -s /usr/local/bin/bash /bin/bash
and see if that helps.
-
error: kernel directory lib/modules/2.6.28.6-tinycore does not exist
Make sure your TC remaster also has the newly built modules, if applicable.
-
Thanks for your summary. Marked and practice later.
thanks again.
-
Hi,
I need to patch my kernel with condecor patch, allowing a kernel to output background image in console mode.
I have got these files:
1. condecor patch
2. TC kernel config file
3. Well well well where is it ahh, linux-3.16.6-patched.txz from there: http://tinycorelinux.net/6.x/x86/release/src/kernel/, or somewhere.
4. Also I've downloaded Module.symvers-3.16.6-tinycore. I don't know what is this for, but just in case...
So, do I need to reproduce all steps described? Do I need to rebuild initrd? The core version is the same I'm using now. Why does this kernel source weigh about 70 mbs, and the result core image weigh only about 5; I got used to the fact that a source package is usually much lighter than a binary one. How can I build only kernel , with no modules I already have and so on; or I can not?
-
Wiki is your friend. (:
http://wiki.tinycorelinux.net/wiki:custom_kernel
In my understanding, it's the opposite - Binary is usually smaller.
-
Wiki is your friend. (:
http://wiki.tinycorelinux.net/wiki:custom_kernel
In my understanding, it's the opposite - Binary is usually smaller.
I found a reference to this thread on the Wiki page. It also describes the whole process including non-relevant parts of obtaining non-TC kernel, patching it with TC patches, building modules, replacing initrd... I can't be sure if I have to do it all at once or not. And it's quite old. Maybe is somewhat outdated.
I mean, not binary executable but a whole binary package with all shared libraries and service files. Hmmm... I'll check it out later. I thought so.
-
Also I've downloaded Module.symvers-3.16.6-tinycore. I don't know what is this for, but just in case...
You only need this if you're going to prepare the kernel source in order to compile an out of tree module or just one or a few of the kernel modules.
-
The very first step making mrproper was aborted because no space on my TC drive left; the kernel source folder at the moment weighed about 600 MB. Is it okay? :o
I believe it's okay, but how could it be, over 600 MB to build a 4 MB kernel...
-
I didn't check, but a 77mb tar.xz file could expand to +/- 600mb when uncompressed.
..and yes, that is what is required to compile the tinycore vmlinuz (3.2mb) and modules.gz (4.1mb) - remember that there are more kernel modules in the various *-3.16.6-tinycore extensions.
-
I've got it I think, there are more kernel resources and modules and drivers that are not compile usually but can be used for special purposes. For example I've included Cyrillic keymap or something in config, so new kernel would be possible to type Cyrillic characters (for now it can't type them, it only can output them), right? And many more features are included in source package but not in result kernel. Got it.
-
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/...
I have 'made' the source; I've also found bzImage in linux/arch/x86/boot/. Now what I am to do? Replace grub entry with "linux /path/to/new/bzImage" and boot?
And where is the new initrd image? I mean... If it were a regular Linux distribution I would know that after "make install" or something, they would be in some relevant system places, mmmaybe... But in TC, I'm not sure. Sorry, I think it's my first core compilation. Especially in TC.
-
You could rename it to vmlinuz or something else, and edit your boot loader's config file.
--
In my understanding, building the kernel from source, will create a binary file. Features that are not used often can be separated by creating modules to be loaded only if needed. Though, separated modules need to be available for the kernel early in the boot process. That's why you need to store kernel modules in an initrd (initial ram drive?). However, core.gz could be updated manually, if needed. But by building the kernel, you dont create the initrd file.
-
I tried to boot from the new bzImage with old initrd (editing my grub entry) but it crashed to something like "can't change directory to 3.16.6 blah blah". Then, I somehow managed to login as tc but no disk were mounted and no extensions installed. I think maybe the old initrd is not suitable. But I found no new initrd in the kernel-build folder...
I read README in source folder, but there were not any clues... So weren't they on the wiki page.
-
Please read the wiki articles on compiling a kernel and rebuilding the initrd.
Your initrd must hold the modules for your new kernel.
-
Please read the wiki articles on compiling a kernel and rebuilding the initrd.
Your initrd must hold the modules for your new kernel.
Erm. Okay. Maybe I read it not very attentively.
-
That occured after I did
make INSTALL_MOD_PATH=/path modules_install firmware_install
from the wiki page.
-
See the infinite directory loops... You are lucky that it was stopped instead of creating infinite levels of directories :)
-
It did not stop. I pressed Ctrl+C. And then I removed the whole folder and tried again, and again it was in vain. Hm. I know little of such nuts as infinite loops; I don't even want to know more of them, goddamit. I want to know why did it happen, hmmm.
I did as I've read in the Wiki. And (sh)it happened. Why? ???
Hmmm.
-
Now, now, I must calm down and stroke the problem. Sorry. I'm a bit frustrated.
-
The process to create a custom kernel could in short be described as:
Get the sources for the version of the standard Linux kernel that you are going to base your kernel on
Get the patches you intend to apply - both TC kernel patches and possibly others (in my case the RT-patches)
Unpack the linux sources and cd into the top level directory of the source package
Apply the patches using (in most cases) “patch -p1 < patchfile” for each patch file
Move the kernel config file from the standard TC kernel into the same directory and rename it to ”.config”
Do “make oldconfig” and answer all questions, in case you have no clue on the answer just provide the default ones (i.e. just hit Return)
Do “make menuconfig” and make any changes you need to the configuration
Do “make bzImage” to build the kernel itself
Do “make modules” to build the loadable modules
Do “make INSTALL_MOD_PATH=/path modules_install firmware_install” where /path is a path to a directory where you expect to find the modules.
Get the sources for the version of the standard Linux kernel that you are going to base your kernel on
config-3.16.6-tinycore, linux-3.16.6-patched.txz
Get the patches you intend to apply - both TC kernel patches and possibly others (in my case the RT-patches)
fbcondecor.patch
Unpack the linux sources and cd into the top level directory of the source package
cd Codez/kernel/ ;tar -xJ -f linux-3.16.6.txz
Apply the patches using (in most cases) “patch -p1 < patchfile” for each patch file
cd linux-3.16.6 ;patch -p1 < ../fbcondecor.patch
Move the kernel config file from the standard TC kernel into the same directory and rename it to ”.config”
cp ../config-3.16.6-tinycore ./.config
Do “make oldconfig” and answer all questions, in case you have no clue on the answer just provide the default ones (i.e. just hit Return)
I had been doing this step, but in an another TC kernel manual on the forum I've read I can do the next step directly
Do “make menuconfig” and make any changes you need to the configuration
make menuconfig
Do “make bzImage” to build the kernel itself
Do “make modules” to build the loadable modules
Hm... I did both "make" or "make all" as was said in that forum manual also; last time it was
make -j2 all
Do “make INSTALL_MOD_PATH=/path modules_install firmware_install” where /path is a path to a directory where you expect to find the modules.
http://cs622929.vk.me/v622929788/2462e/WcaBla3ixVY.jpg (http://cs622929.vk.me/v622929788/2462e/WcaBla3ixVY.jpg)
http://cs622929.vk.me/v622929788/24640/v-U-qwcqr7g.jpg (http://cs622929.vk.me/v622929788/24640/v-U-qwcqr7g.jpg)
Am I doing wrong, really? (http://www.harrypotter.com.ua/html/emoticons/unsure.gif)
-
You are just telling stories instead sharing what you are doing really. Without knowing commands and scripts you are using do not expect answer.
Your issue is not related to Tiny Core but a generic how to build kernel. Internet is full with docs, blogs and forums with the proper answer. Please do not spam here.
-
You are just telling stories instead sharing what you are doing really. Without knowing commands and scripts you are using do not expect answer.
Your issue is not related to Tiny Core but a generic how to build kernel. Internet is full with docs, blogs and forums with the proper answer. Please do not spam here.
I thought my last post was all about what I am doing ??? including exact commands. There aren't many of them. Let me see, these are listed exactly
cd kernel
tar -xJ -f linux-3.16.6.txz
cd linux-3.16.6
patch -p1 < ../fbcondecor.patch
cp ../config-3.16.6-tinycore ./.config
[make oldconfig] (one time I did it one time not)
make menuconfig
make -j2 all
mkdir initrd
make INSTALL_MOD_PATH=/home/tc/Codez/kernel/linux-3.16.6/initrd modules_install firmware_install
...
PROFIT! Oh... I mean...
If you name THIS "telling stories", then... um... I can't imagine what you consider as "sharing what I am doing". Maybe... I had a tea when making this? :o I didn't spill it onto my keyboard, really!
But, yeah. You're right. It's a generic issue. All but one. It's a TC patched kernel I am building and it's a TC Wiki manual I am reading. So, I'll do the simplest. I'll build a regular linux-3.16.6 kernel taking look into some else manual and look is the problem still there :) cheers
-
I just tried:
$ tce-load -i compiletc bash perl5 ncurses-dev bc
$ make mrproper
$ cp config-3.16.6-tinycore .config
$ patch -Np1 -i ../fbcondecor-3.15.patch
$ make oldconfig
$ make menuconfig
set Enable Tile Blitting Support disabled
set Support for the Framebuffer Console Decoration enabled
$ make bzImage
..and it compiles
Once done, you rename arch/x86/boot/bzImage to vmlinuz, replace the tinycore vmlinuz and try it out.
See here for more details:
http://www.mepiscommunity.org/fbcondecor
-
I've also tried to build a non-TC kernel and succeeded without any trouble. I have no clues; all steps (wiki and mine) correspond exactly. I'll make just another attempt with TC.
-
Well, it's clear the kernel doesn't like your chosen module install path. Try putting a path outside the kernel directory.
-
In this particular case, I don't believe any modules need to be compiled?
-
Well, it's clear the kernel doesn't like your chosen module install path. Try putting a path outside the kernel directory.
Quite so! I came to the same conclusion yesterday... hmm... early this morning. I gave it another path and it worked. Now it's not booting properly, but I will handle it on my own.
In this particular case, I don't believe any modules need to be compiled?
What exactly are you talking about, sir?
-
As far as I can see (I may be wrong), the patch does not affect any kernel modules.
If you're compiling linux-3.16.6-patched.txz after applying the framebuffer patch, then you only need the recompiled bzImage as mentioned above.
-
As far as I can see (I may be wrong), the patch does not affect any kernel modules.
If you're compiling linux-3.16.6-patched.txz after applying the framebuffer patch, then you only need the recompiled bzImage as mentioned above.
I thought so, but the very first successfully built bzImage went into kernel panic complaining of some improper path (somewhere inside it). I thought it was because I built it as 3.16.6 and core.gz contained /lib/modules/3.16.6-tinycore. I rebuilt it as 3.16.6-tinycore and... went into some more error. I'll check one more time, just now I'm in hurry :-\