LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Help compiling and running new kernel please (https://www.linuxquestions.org/questions/linux-general-1/help-compiling-and-running-new-kernel-please-7919/)

phil1076 10-25-2001 07:40 AM

Help compiling and running new kernel please
 
My mind is boggled. I'm playing with Linux at work and yesterday I compiled my first kernel (I am using RH 7.1). I copied the kernel to the /boot directory and edited /etc/lilo.conf to point to the new kernel. When I rebooted, it just loads the old kernel still. I DELETED the old kernel, moved the new one to /vmlinuz/ and edited lilo.conf to reflect this, and when I rebooted it STILL loaded the old kernel even though I deleted it. Can anyone tell me, step by step, how to compile a new kernel and install it? Basically I want to install iptables 1.2.4. Thanks in advance

Thymox 10-25-2001 08:26 AM

You edited the lilo.conf file, but did you run lilo to install the new details?

I was lead to believe (and I still do things in this fashion):

make xconfig (or menuconfig, or config - whichever you prefer)
make dep
make clean
make bzImage
make modules
make modules_install

-I edit my lilo.conf file before this last step
make bzlilo

The last step basically (AFAIK) checks that all is OK and then runs lilo to ensure that the lilo.conf file is correct. When I reboot, the appropriate entries are in the menu (I use graphical lilo - I'm quite shallow and I like fancy GUI stuff :D) and I can boot from the new kernel.

phil1076 10-25-2001 08:28 AM

x
 
When I tried to run lilo, it said the image files was too large...it's 2.4 megs

WindozBytes 10-25-2001 08:38 AM

Thymox is correct; you have to run lilo once you edit lilo.conf

/sbin/lilo

or is it

/bin/lilo

one of those should get you there

Thymox 10-25-2001 08:56 AM

As long as you're not trying to install the kernel image onto a floppy, then make bzImage should do the trick. When booting from an image on the HDD, it shouldn't really make much difference on how large the file is. If you're really stuck, and you want to make the image smaller, then when you make xconfig, instead of clicking [Y] to certain things (like sound 'drivers'), you could click [M] (if present) to make them loadable modules. This is a bit of a tricky concept for very recent converts from Windows, but it's very useful:

Once the kernel is loaded, the loadable modules (like sound) can be inserted so that you can use them, and removed so that you can't. If, for example, you have one of those weird HAM-Radio modem things (there's some documentation on it under the documentation directory of your kernel source, which I suppose is the most obvious place to put documentation), and you're not likely to be using it very much, then there's not a lot of point in building it into the kernel, you should build it as a module and then insert it later when you want to use it. I believe that the NT family of windows has similar options, but I'm not entirely sure.

As I said above though, if booting from an image on the HDD, it really shouldn't matter that the image is 2.4Mb.

If you can, could you post exactly what the error message is.

phil1076 10-25-2001 09:25 AM

doh
 
I could post the exact error, but I just finished destroying the upgrade and now it won't boot :(...Hehehe it's ok, as it's just a play machine and I'll re-install. Essentially, here is my process:

1. I get the latest kernel from kernel.org
2. unzip it to /usr/src/linux
3. make xconfig and leave everything at the defaults and save config
4. then I perform every step listed above (make dep, etc etc)
5. I copy the kernel and the System.dat file to /boot
6. edit lilo.conf to point to new kernel
7. Then I run lilo and it tells me the image is too large.
8. Instead I run make bzlilo and it appears to be working, but then gives me a fatal error: image too big.
9. I rebooted and now it says loading Linux................. and sits there...reinstall time.

BTW The machine is a P3-1000 with 384MB RAM and a 30 gig drive.

The image size is 2.7 megs.

phil1076 10-25-2001 09:30 AM

a
 
I'm now re-installing Redhat 7.1 on the machine. I chose "full" install and will post the steps I take, step-by-step, when it's done and hopefully I can get a hand :/

Thymox 10-25-2001 09:36 AM

I always do this:
  • untar to /usr/src/linux-2.x.x

    symlink /usr/src/linux-2.x.x to /usr/src/linux (just coz I do)

    make xconfig

    save config-file to somewhere on my windows partition, so should I have to re-install, at least I've got a copy to change.

    save and exit

    make (everything that I said above)

    leave the new kernel image under / and simply edit the lilo.conf file to look there (I have the original under /boot, so I don't want to confuse the two)

    run lilo

    reboot

If you're not dualbooting, may I suggest that you save a copy of the config data to a floppy as it will be easier to sort things if you have a refernce file to go back to.

phil1076 10-25-2001 10:42 AM

ok
 
Ok here is what i did exactly:

Fresh install of RH 7.1. *Full Install*

1. login as root --> startx --> netscape --> download kernel from kernel.org into /root
2. gzip -dv linux-2.4.13.tar.gz
3. tar -xvf linux-2.4.13.tar -C /usr/src/
4. renamed /usr/src/linux to /usr/src/linux-2.4.13
5. cd /usr/src/linux-2.4.13
6. make xconfig
7. i took the defaults and saved configuration without any changes
8. make dep
* At this point I logged out of gnome
9. make clean
10. make bzImage
11. Warning: Kernel is too big for stand alone floppy..checked size, it's 2.7 megs
12. make modules
13. make modules_install
14. mkdir /boot2
15. cp vmlinux /boot2/
16. cp System.dat /boot2/
17. edit lilo.conf
* point to new kernel location (image=/boot2/vmlinux), save, exit
18. lilo
Fatal: Kernel /boot2/vmlinux is too big
19. cd /usr/src/linux-2.4.13
20. make bzlilo
Fatal: Kernel /boot2/vmlinux is too big


When I reboot, it successfully boots the OLD kernel

phil1076 10-25-2001 11:54 AM

g
 
I re-compiled the kernel and it's the same size. this time when i run lilo it just says "Skipping /usr/src/newimage"

isajera 10-25-2001 02:06 PM

that's one heck of a big kernel... i've never even seen one over a meg before. are you sure you're not compiling too many modules? i'd go through the config and get rid of anything you don't really need... like nls codes... arbitrary sound drivers... ect.

phil1076 10-25-2001 02:09 PM

aa
 
Interestingly enough, when I pointed the vmlinuz symbolic link BACK to the OLD kernel, lilo told me that's its too big....go figure, as the original kernel is 2.4 megs. God I hate Linux, but I want to run it./

acid_kewpie 10-25-2001 02:15 PM

i know nothing about compiling kernels.. never needed to, but the one time i did try, i had a file abuot that size, and tried to bot it, but found out that it wasn't the kernel, but some other file, vmlinux / vmlinuz .. think i got those two confused. one was 2.5mb is the other, the actually kernel image, was only 800kb ish.

oh yeah.. look, you're trying to use vmlinux as the kernel, which it isn't, you need vmlinuz.

i guess.

right, i'm definitely gonna compile 2.4.15 definitely...

that'll be in.. 3 days?

----------------------
at teh risk of making this thread stupid, does anyone else like or dislike numbers?

2.4.x sounds nice, 2.2.x was ok, 2.0.x sounds really... skinny(?). and 2.6 sounds fat and ugly to me, think 2.8 will sound nice tho.

paavaka 10-25-2001 02:46 PM

Your kernel image will be located at /usr/src/linux/arch/i386/boot/bzImage. As long as your kernel didn't have any errors during compilation, copying this file and editing lilo.conf by hand should do the trick.

phil1076 10-25-2001 03:25 PM

!
 
Well thank you Paavaka! Kernel 2.4.13 successfully installed. I'm shocked that all those newbie HOW-TO's and RedHat documents are incorrect. Now I need to figure out how to install iptables 1.2.4...thanks again!


All times are GMT -5. The time now is 12:26 PM.