Compiling kernels... Go look at www.kernel.org; if you scroll right down to the bottom, you'll find a "the most recent kernel is...." kinda thing... of course, it's not really much use to you if you're using kernel 2.2.X rather than 2.4.X, but still... For reference, I now consider 2.4 mature enough that it's a safe bet even if it's your first time compiling a kernel. Just don't bother with 2.5,anything, ok? Hmmm. Mirror sites are of the form ftp://ftp.XX.kernel.org/pub/linux/kernel/vY.Y/linux-Y.Y.ZZ.tar.gz Where XX is your coutry name [ie, uk] Y.Y is the kernel major an minor versions, and Y.Y.ZZ is the major, minor, and patchlevel numbers. You can find out what you're using with the uname command. The easiest way to find out what the most recent one is to either 1) Look at www.kernel.org 2) Just type in "finger @kernel.org" You want the stable one. And yes, there are many other ways, but those are the only two I ever use. Right. Now for the structure of what we're aiming at: basically, in /boot, all your stuff is of the format vmlinuz-2.2.16 vmlinuz-2.2.19 etc etc vmlinuz -> most-recent-vmlinuz and System.map-2.2.16 System.map-2.2.19 etc etc System.map -> most-recent-System.map [ "->" means symlink, by the way] Slack is nice and simple. don't bother looking at RedHat's equivalents, they do lots more things that aren't necessary, but provide kind of a failsafe fallback. If we're sensible, we won't need them (= At this point, if your system /doesn't/ look like that, make it look like that. eg, if your system currently has /vmlinuz, /boot/System.map, and that's it: mv /vmlinuz /boot/vmlinuz-2.4.18-dist ln -s /boot/vmlinuz-2.4.18-dist /boot/vmlinuz mv /boot/System.map /boot/System.map-2.4.18-dist ln -s /boot/System.map-2.4.18-dist /boot/System.map etc, etc. The "-dist" is to clarify that it's the one in the box. Edit /etc/lilo.conf to make sure that this is clear there, too; the relevant section [it's obvious which this relates to] should say: image = /boot/vmlinuz-2.4.18 root = /dev/hda1 label = linux-2418 read-only And set "default = linux-2418" in the global section. None of these rules, by the way, are hard-and-fast; call it whatever you want. This is just what /I/ call it. OK. cd /usr/src in there, you'll find stuff of the format: linux-2.2.16 linux-2.2.19 linux -> latest-linux-version. understand that that symlink is one of the most important ones on your system. You've no idea how many different things actually use it just to make sure they're not doing anything dumb. Anyway. having got a kernel [remember than tarball you got from the mirror, called "linux-Y.Y.ZZ.tar.gz" ?], do all this as root: cd /usr/src rm linux tar -xzvf linux-Y.Y.ZZ.tar.gz You'll now have a directory called "linux". move it to linux-kernel-version, and then symlink that new dir to "linux" Doing that, you'll always have all you old kernel sources, and /usr/src/linux will always be the most up-to-date thingy. Right. The official thing to do here is go into /usr/src/linux and "make mrproper" this is not always necessary, but I'd recommend you do it anyway. It's a "make this like it was before I even looked at it". You'll even lose any configs you've set up. Anyway. now run "make menuconfig". Keyboard shortcuts include m [for module], y [yes], and n [no]. Read the help by pushing ?. Do this lots, often. Mostly, if it says "this is safe to include", then do so - once you've got a better idea, you can ignore things you don't want, but for the moment, well, you know how it is. A lot of them say "blah-blah-blah-blah. If you don't know what I just said, then you can say "n" ". Which is fair enough; the answer is "n" (= Anyway. Having done that, get out, saving as you go, and "make dep && make clean". dep is short for dependencies, and clean gets rid of things from previous compiles that probably aren't valid anymore. Anyway. if that succeeds [and I've never know it to fail (=], then you can do a "make bzImage modules modules_install". "bzImage" is the kernel itself, "modules" makes the modules [duh] and "modules_install" puts them in /lib/modules/kernel-version Once all that has been done [under a minute on a dual 933, by the way (=] copy the System.map in the current dir to a suitable place [explained at the start]. /usr/src/linux/arch/i386/boot/bzImage is the kernel itself, otherwise known as "that thing we'll find in /boot/vmlinuz" If you're running linux on a non-x86, I don't know why you're reading this. And if you don't understand what I just said, it wasn't for you. edit /etc/lilo.conf, and copy one of the sections that's there now, editing it to suit the new kernel. Just remember to leave old things in there... take a wild stab in the dark as to why (= run /sbin/lilo Looking back over that, I kinda got more "you work it out" towards the end. If you do need help , feel free to ask, but you're not an incompetent,so you should be able to work it out. "Oh, yeah. Don't forget. /usr/src/linux/Documentation exists for a VERY FUCKING GOOD REASON. have I made my point? It's actually worth reading when you've got a few minutes, anyway. And I assume you have done a little bit of programming in the past. The source isn't actually as scary as people seem to think, and a lot of the time is worth reading. Examples include: /usr/src/linux/drivers/char/random.c where they explain how random number generation works [which turns out to be really good, and cryptographically safe, and stuff], and, and, and... READ THE DOCUMENTATION READ THE DOCUMENTATION READ THE DOCUMENTATION Have I made my point on that one yet? Hmmm. For completeness, here are a few other things you may or may not like to know: make oldconfig lets you copy your old config [file /usr/src/linux/.config] into the newer source and take a stab at using the old config, and asking you about any newer options. I don't do this, and I'd urge you not to either. It's usually safe, but I wouldn't recommend it. There's another target called "xconfig", ie "make xconfig". Try it. If you like it, use it. If not, don't. I don't care. Some people like it, but I don't. If you're a deb user, you also probably don't need to be reading this, but I'm told that "cd /usr/src/linux; make-kpkg kernel-image; cd ..; dpkg -i kernel-image" is your friend. If it's not your friend, you're on your own. And today's last lesson on kernel-y things: how to patch it. If you look in ftp://ftp.uk.kernel.org/pub/linux/kernel/v2.2, or 2.4, or whatever, you'll find things of the form linux-Z.Z.ZZ, and things of the form patch-Z.Z.ZZ Patches are always incrememtnal. In order to go from 2.2.16 to 2.2.18, you _MUST_ do the 2.2.17 one before the 2.2.18 one. If not, you are responsible for your own system. Remember that. Anyway. to patch, gzip -cd patch-X.X.XX.gz | patch -p1 when you're in /usr/src/linux. Your kernel directory naming structure may not be complete. If you want to fix this [which I urge you to do], go ahead. I very much urge you to patch by removing the old linux symlink [hence, leaving your previous kernel source intact], and starting again. You work it out. You'll also see some .tar.bz2 files on your kernel mirror, which are smaller. This is because there's another compression system that's in common use called bzip2. It's better than gzip, but not as widely popular. To decompress it, you need to do something like bzcat linux-2.2.19.tar.bz2 | tar -xvf - note that on anything that's not using GNU tar, you don't get the -z option, so you actually need to decompress tarballs with gzip -cd tarball.tar.gz | tar -xf - Which is how I do it all the time, anyway, since I've been using solaris waaay too much. Hmmm. Non-kernel-related things. Whenever you want to download an application, a good place to look is freshmeat.net What you do is get it, untarball it, cd into the directory and run "./configure;make;make install" officially. Don't do that. Actually, you want to run "./configure --help" and install it with the options you want. For example, say you're setting up a DVD player, a good example of what you might like to do is "./configure --prefix=/usr/local/DVDthings;make;make install" just an example, there. A more likely one is where you pass SDL's configure the --enable-video-aalib option. If you don't know what I just said, it's not for you (= On unix-y systems, eg linux, startup script, runlevel-changing scripts, etc, can be found in /etc/rc.d and sometimes /etc/init.d If you're using RH, you're looking at essentially systemV-alike things, ie, there's a directory for each runlevel. If you're using slack, then you're looking at WAAAAY easier to run and setup scripts. Read them. Say you'd like some hardware set up explicitly every time? Break out a new script, and just copy'n'paste some stuff that already exists in one of the other suitable scripts. You're not an invalid, take a stab at it. If you still have problems, feel free to contact me. If you have any questions at all, feel free to e-mail me. Gary (-; PS 200 lines of e-mail. shit, I'm verbose this morning.