LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Newbie Guide To Compiling A Kernel! (https://www.linuxquestions.org/questions/linux-general-1/newbie-guide-to-compiling-a-kernel-73436/)

marlor 08-09-2004 03:10 AM

hmm, dunno maybe there is another solution to solve this, but i say go for recompile, don't be scared of it :D
it's just couple of commands and some moving around of files with cp command. it doesn't bite

good luck :)

svar 08-09-2004 03:38 AM

So, no fear of destroying the installation(especially the /home)?

marlor 08-09-2004 03:45 AM

no,

if you follow the instructions properly, and just add the scsi support, there will be no problem

RedHatMasta 08-09-2004 11:52 PM

I think with 2.6 now, after make config/x/g/etc all you have to do is make && make modules_install and it does bzImage etc. make install also will do some stuff for you, don't member just what tho.

svar 08-10-2004 07:41 AM

Well, it just bit me!
 
I followed all the steps as outlined and ended up with
a VFS kernel panic on reboot! The only odd message I
got after menuconfig was cp /usr/src/linux-2.4.22/.config /usr/src/linux

tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage
Root device is (3, 67)
Boot sector 512 bytes.
Setup is 2520 bytes.
System is 1213 kB
warning: kernel is too big for standalone boot from floppy
make[1]: Leaving directory `/usr/src/linux-2.4.22/arch/i386/boot'



Here are the steps:(remember the only reason I am recompiling is to add SCSI support, not upgrading in any sense)
$ cd /usr/src
me@darkstar:/usr/src$ ls -alc
total 10
drwxr-xr-x 5 root root 192 Nov 24 2003 ./
drwxr-xr-x 44 root root 2216 Jun 26 02:30 ../
-rw-r--r-- 1 root root 567 Nov 24 2003 2.4.22.nat.diff
lrwxrwxrwx 1 root root 12 Nov 24 2003 linux -> linux-2.4.22/
drwxr-xr-x 15 root root 584 Nov 24 2003 linux-2.4.22/
drwxr-xr-x 7 root root 168 Nov 24 2003 rpm/
drwxr-xr-x 2 root root 432 Nov 24 2003 xfs-2.4.22/
me@darkstar:/usr/src$ file linux
linux: symbolic link to linux-2.4.22
me@darkstar:/usr/src$ ls
2.4.22.nat.diff linux@ linux-2.4.22/ rpm/ xfs-2.4.22/
me@darkstar:/usr/src$ su
Password:
root@darkstar:/usr/src# rm linux


ln -s /usr/src/linux-x.x.x /usr/src/linux
cd linux
make mrproper
cp /usr/src/linux-2.4.22/.config /usr/src/linux
make menuconfig
make dep

make clean
make bzImage
make modules

make modules_install
rm -rf /boot/System.map
rm -rf /boot/vmlinuz

cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.22
cp /usr/src/linux/System.map /boot/System.map-2.4.22

Make the new links:
ln -s /boot/vmlinuz-2.4.22 /boot/vmlinuz
ln -s /boot/System.map-2.4.22 /boot/System.map

There was no initrd.img

No change was really needed in lilo.conf. All I did is change the line
label = Linux
with
label=Linux2.4.22


/sbin/lilo


and then I got the kernel panic

Now, what do I do?
I booted a Knoppix CD

cd /mnt/hdb3/usr/src
root@ttyp0[src]# ls
2.4.22.nat.diff linux linux-2.4.22 rpm xfs-2.4.22
root@ttyp0[src]# ls -l
total 7
-rw-r--r-- 1 root root 567 2003-09-03 02:12 2.4.22.nat.diff
lrwxrwxrwx 1 root root 21 2004-08-09 22:03 linux -> /usr/src/linux-2.4.22
drwxr-xr-x 15 root root 712 2004-08-09 22:54 linux-2.4.22
drwxr-xr-x 7 root root 168 2002-12-12 21:23 rpm
drwxr-xr-x 2 root root 432 2003-09-05 00:03 xfs-2.4.22
root@ttyp0[src]#

ls -alc
total 10
drwxr-xr-x 5 root root 192 2004-08-09 22:03 .
drwxr-xr-x 44 root root 2216 2004-06-26 01:30 ..
-rw-r--r-- 1 root root 567 2003-11-24 00:47 2.4.22.nat.diff
lrwxrwxrwx 1 root root 21 2004-08-09 22:03 linux -> /usr/src/linux-2.4.22
drwxr-xr-x 15 root root 712 2004-08-09 22:54 linux-2.4.22
drwxr-xr-x 7 root root 168 2003-11-24 00:44 rpm
drwxr-xr-x 2 root root 432 2003-11-24 00:47 xfs-2.4.22

I guess I must either go through the kernel configuration again, making sure to add /dev/hdb3 infornt of everything,
e.g. /usr/src->/dev/hdb3/usr/src

and hope for better luck

or use the Slack CD to reinstall(I am afraid it might screw my partitions though), i.e. format the /home
partition

Any tips?

svar 08-11-2004 05:21 PM

Ok, I had made a boot floppy and was able to boot
and fix things(I believe I did nothing different, but I obviously must have, thoug hthe first time I did not use script to have a log of what I did), but three questions remain:
1) I get a strange message abou the kernel being too big for a floppy
....
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o tools/build tools/buil
d.c -I/usr/src/linux-2.4.22/include^M
objcopy -O binary -R .note -R .comment -S compressed/bvmlinux compressed/bvmlinu
x.out^M
tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage^M
Root device is (3, 67)^M
Boot sector 512 bytes.^M
Setup is 2521 bytes.^M
System is 1381 kB^M
warning: kernel is too big for standalone boot from floppy^M
make[1]: Leaving directory `/usr/src/linux-2.4.22/arch/i386/boot'^M
root@darkstar:/usr/src/linux# ^M
root@darkstar:/usr/src/linux# WHY KERNER TOO BIG FIR STANDALONE BOOT FROM FLOPPY
^M???^M
bash: WHY: command not found^M
root@darkstar:/usr/src/linux# make modules^M


2) In menuconfig I kept all defaults except
SCSI CD-ROM support,
Joliet CDROM
Reiser and Ext3 diagnostics
Creative SB Live

, but modprobe Scsi_hostadpter erro=2 once again
[This was my original reason for recompiling!!
so I cannot use my CD-R]

3) furthermore, I cannot mount the floppy(asks for type)
even though I did not change fstab, mtab or lilo

Any tips on what I need to do to get my CD-R recognized
and also fix the /floppy thing?
Also, what does it mean kernel too big for standalone boot floppy?

Thanks in advance

svar 08-12-2004 07:59 AM

Oops, forgot to answer that PPPsupport was also gone

Khang 08-12-2004 11:38 PM

Hi there. I was advised to re-post here about a problem I'm having, in case somebody knows what the matter is. I'll copy and paste my original post to save a little bit of time :).

---------

Hi there. I've just been trying to compile a kernel (first time I might add), and I'm running into errors when I run 'make xconfig', or 'make menuconfig' etc.. To be honest, I have no idea what the problems is. I'm hoping that the error actually means something to somebody around here, and that somebody can tell me what my problem is... Because I'm damned if I know.

Quote:

root@jez64:/usr/src/linux# make xconfig
HOSTCC scripts/basic/fixdep
In file included from /usr/include/sys/socket.h:35,
from /usr/include/netinet/in.h:24,
from scripts/basic/fixdep.c:107:
/usr/include/bits/socket.h:305:24: asm/socket.h: No such file or directory
make[1]: *** [scripts/basic/fixdep] Error 1
make: *** [scripts_basic] Error 2
What should I have done before getting to the stage of running make? All I've done is extracted the new kernel to /usr/src/linux-2.6.7 and recreated the link 'linux' to point to that directory. Then (as an article I was going through advised) I put the Knoppix .config file in /usr/src/linux and ran 'make xconfig'. Now, that all sounds a bit too easy to be true, to me... So I wouldn't be surprised if I'm missing something vitally important out. As I say, I've merely been following a little guide.

I'm new to this, so go easy on me. Hope you can help. Thanks ;)

---------

I don't know how relevent it is what distro I'm running, but just in case it makes a big difference, I'm running Debian. There's one additional catch to make things a bit more awkward - my wireless network adapter is currently not working in Linux and thus I have no internet. I have to boot into Windows in order to download stuff. That means no downloading with apt-get etc. :/

So... *fingers crossed*, anybody care to point me in the right direction?

JZL240I-U 08-13-2004 02:13 AM

Did you read the guide of DrOzz at the root of this thread?

Khang 08-13-2004 08:01 AM

Indeed I did.

Khang 08-17-2004 06:53 PM

No suggestions then? I'm guessing it's just a stupid mistake I'm making, but I don't know what it is...

JZL240I-U 08-18-2004 04:36 AM

No such file or directory

One or more (all) files named in this this error is/are missing on your system. Search for them (possibly installed in another path?) put them where they belong and rerun...

svar 08-18-2004 04:50 AM

Anyone know what I need for PPP to work? I recompiled the same kernel
to support the SCSI CD-R(which now works), but lost PPP even though
I added PPP support in menuconfig
I now get:
"Couldn't set tty to PPP discipline: Invalid argument"
This is Slack 9.1
I did a google search and the suggestion is upgrade to the latest and greatest ppp. Makes no sense, sinc eI had ppp working with that kernel
for a long time.

Khang 09-04-2004 02:44 PM

Ugh, I've had no time to try and sort this out lately. I do now though. I gave it another shot just now but I'm still having trouble. I've got a bit further than last time, but not much... So I'm afraid I'm back again. Sorry :o

I found that my problem when running make xconfig could be solved easily:

cd /usr/src/linux/include
ln -s asm-i386 asm

That did the trick... So xconfig ran fine after that. I configured everything to the best of my limited ability, saved the settings, and exited. Alas, this is where my success ends. If I run 'make-kpkg buildpackage -rev Custom.1 kernel_image', I get a bunch of errors. Actually I think the errors are a result of the link I just made ('ln -s asm-i386 asm', see above) being removed/changed in some way. I say this because after this, if I try to run 'make xconfig' again, I get the same errors I was getting before I made the link.

Anyway, I figured maybe I should be doing the following first and see what happens:

cd /usr/src
make

Aside from a few warnings (not errors) every now and again, that command executes fine for several minutes until:

Quote:

CC [M] drivers/scsi/cpqfcTScontrol.o
drivers/scsi/cpqfcTScontrol.c:610:2: #error This is too much stack
drivers/scsi/cpqfcTScontrol.c:722:2: #error This is too much stack
make[4]: *** [drivers/scsi/cpqfcTScontrol.o] Error 1
make[3]: *** [drivers/scsi] Error 2
make[2]: *** [drivers] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.7'
make[1]: *** [stamp-build] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.7'
make: *** [all] Error 2
Uh oh :(

So it seems that didn't work either...

Am I doing something really stupid here? I feel like I probably am, but I just have no clue where to go from here. If anybody can set me straight I'd appreciate the help. Thanks :)

DrOzz 09-04-2004 06:08 PM

there seems to be a patch :
http://www.linuxhq.com/kernel/v2.6/7...qfcTScontrol.c

also you may not even need that module, here is what it is :
Code:

/* Copyright 2000, Compaq Computer Corporation
 * Fibre Channel Host Bus Adapter
 * 64-bit, 66MHz PCI
 * Originally developed and tested on:
 * (front): [chip] Tachyon TS HPFC-5166A/1.2  L2C1090 ...
 *          SP# P225CXCBFIEL6T, Rev XC
 *          SP# 161290-001, Rev XD
 * (back): Board No. 010008-001 A/W Rev X5, FAB REV X5



All times are GMT -5. The time now is 12:07 AM.