Click to See Complete Forum and Search --> : Installing kernel sources
anarcholinuxism
09-02-2003, 07:16 AM
Hi,
I'm trying to follow this how-to
http://www.ruault.com/Zaurus/ethernet-over-usb-howto.html
to get my zaurus and my Debian (2.4.18) talking.
It gives 2 options (one only implied) either apply the patch or update the kernel, neither of which I have manged to work out how to do.
1) update my kernel - with debian this is something like apt-get install kernel-image-XXXXXX but I can't work out the corect syntax cos I just keep getting package not found
2) apply the patch - in the HOWTO step 1 it says "Assuming your Linux sources are in /usr/src/linux do the following :" which of course they're not, I'm not even sure how if they're on the machine at all, or how to get them if they're not.
Any suggestions appreciated.
hard candy
09-02-2003, 07:21 AM
If there is nothing in the /usr/src directory, you need to download the kernel sources. /usr/src/linux is a symbolic link to the kernel sources. You can make or restore the link by:
1. rm /usr/src/linux
2. ln -s /usr/src/linux /usr/src/"the kernel sources".
Satanic Atheist
09-02-2003, 09:49 AM
If you can grab the kernel-source in tar.gz form and I suggest you get kernel 2.4.20 (2.4.21 has problems apparently) then do this:
> mv kernel-source...tar.gz /usr/src
> cd /usr/src
> tar -zxvf kernel-source...tar.gz
And create the symlink as hard candy suggests.
This should then stick it in the right place.
To patch the kernel, stick the patches in the /usr/src and change to the source directory (/usr/src/linux).
> patch -p1 < ../YOURPATCHNAME
Should patch your kernel. Make sure it actually works (no failed hunks), otherwise you'll have to find the right patch.
Although I rarely bother to patch the kernel, I test each patch until I know that each works. If one fails, I remove the kernel source tree and replace it with a vanilla source. This makes sure that nothing's gone astray (OK - called me paranoid, I could just reverse out the patch, but I'd rather not mess around compiling for ages because of one duff patch).
Interestingly enough, I managed to get hold of the Supermount patch for 2.4.20. It took me AGES to find it in the right format, but if you'd like to get a copy I can e-mail it to you (I don't want to post stuff like patches here).
James
GaryJones32
09-02-2003, 12:39 PM
if you want to see what kernel binaries are available for your debian
flavor use:
apt-cache search kernel
mdwatts
09-02-2003, 04:49 PM
Originally posted by hard candy
2. ln -s /usr/src/linux /usr/src/"the kernel sources".
Actually that should be the other way around.
ln -s /usr/src/linux-#.#.# /usr/src/linux
i.e.
ln -s /usr/src/linux-2.4.21 /usr/src/linux
anarcholinuxism
09-02-2003, 06:02 PM
right, trying to pull out the relevant advice (that I understand) from the above replies,
I've done the following
apt-get install kernel-source-2.4.18
I've stuck with this kernel because the howto either says to patch the kernel or upgrade to 2.4.22 which I can't find the kernel-image of with apt-cache search.
The sources downloaded fine to /usr/src/ as /kernel-source-2.4.18.tar.bz2
which I unzipped and then ran
ln -s /usr/src/linux /usr/src/kernel-source-2.4.18
which gave no errors. I would have expected the /linux dir in /usr/src to then appear though but it hasn't.
I then downloaded
usbdnet-2.4.18.patch.gz
and moved it to /usr/src and unzipped it, but when I cd to /usr/src/linux to apply the patch
as in
> patch -p1 < ../YOURPATCHNAME
I get the error message
bash: cd: linux: No such file or directory
if I run
ln -s /usr/src/linux /usr/src/kernel-source-2.4.18
a second time I get the error message
ln: `/usr/src/kernel-source-2.4.18/linux': File exists
what is going on here? Do I have to create the dir linux in /usr/src first before running the symbolic link creation?
anarcholinuxism
09-03-2003, 05:24 AM
well I seem to have worked that out, I was doing the sym link the wrong way round so my /usr/src/linux listing is now
drwxr-sr-x 3 root src 4096 Sep 3 10:09 .
drwxrwsr-x 5 root src 4096 Sep 3 10:05 ..
lrwxrwxrwx 1 root src 29 Sep 3 09:44 kernel-source-2.4.18 -> /usr/src/kernel-source-2.4.18
which I think is correct
however applying the patch is not working out well
if I use Satanic Athiests solution of
> patch -p1 < ../YOURPATCHNAME
or in this case
patch -p1 < ../usbdnet-2.4.18.patch
I get an error message of
can't find file to patch at input line 3
and am then prompted for the correct name of the file to patch. If I then enter at the prompt "kernel-source-2.4.18 I get"
patch: **** File kernel-source-2.4.18 is not a regular file -- can't patch
and I get the same behaviour from the suggested patch command in the howto from /usr/src
zcat usbdnet-2.4.18.patch.gz | patch -p0
could there be something wrong with the sym link?
anarcholinuxism
09-03-2003, 07:03 AM
I started again from scratch deleting everything except the zipped sources file and it all seems to have worked so you can safely ignore everything above :)
Now to the next step
from http://www.ruault.com/Zaurus/ethern...-usb-howto.html
Now reconfigure the kernel to support :
cd /usr/src/linux
make menuconfig
in "Code maturity level options", select "Prompt for development and/or incomplete code/drivers"
in "USB support", section "USB Network adaptors", select (as a module) "USBD Network (Encapsulated) Host-to-Host Link (EXPERIMENTAL)"
Then enter 04dd in USBD Network idVendor and 8004 in USBD Network idProduct
you'll be the first to know if I have any problems!
anarcholinuxism
09-03-2003, 07:06 AM
Make sure it actually works (no failed hunks), otherwise you'll have to find the right patch.
BTW, what is a hunk?
Satanic Atheist
09-03-2003, 07:13 AM
What is a hunk? (Apart from me, that is).
Haha, seriously, I haven't got a clue, but I guess it's a section of code in a modular scripted system that can be changed, which is what a patch does. If it fails, you get "rejects" throwing about all over the place and the kernel probably won't compile (nothing new there then).
Don't really worry about it - I really don't know and I'm not a programmer. Basically, if it says a hunk failed then you know your patch screwed up.
James
mdwatts
09-03-2003, 07:59 AM
Originally posted by anarcholinuxism
well I seem to have worked that out, I was doing the sym link the wrong way round so my /usr/src/linux listing is now
drwxr-sr-x 3 root src 4096 Sep 3 10:09 .
drwxrwsr-x 5 root src 4096 Sep 3 10:05 ..
lrwxrwxrwx 1 root src 29 Sep 3 09:44 kernel-source-2.4.18 -> /usr/src/kernel-source-2.4.18
which I think is correct
You should create the symlink as I posted above as the others were incorrect.
ln -s /usr/src/linux-2.4.18 /usr/src/linux
The ln manpage (man ln) does explain which is the TARGET and which is the LINK NAME.
Satanic Atheist
09-03-2003, 09:43 AM
Can be a little confusing, working with source and destination stuff, but am I right in assuming that the SOURCE always comes before the DESTINATION in Linux?
Also, what's the difference between hard and soft links?
James
mdwatts
09-03-2003, 04:36 PM
Originally posted by Satanic Atheist
Can be a little confusing, working with source and destination stuff, but am I right in assuming that the SOURCE always comes before the DESTINATION in Linux?
Also, what's the difference between hard and soft links?
James
Actually the ln manpage (man ln) answers both of your questions.
ln [OPTION]... TARGET [LINK_NAME]
When creating hard links, each TARGET must exist.