LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How to make kernel package??? (http://www.linuxquestions.org/questions/slackware-14/how-to-make-kernel-package-369142/)

komuthan 10-02-2005 04:36 PM

How to make kernel package???
 
I tried to compile 2.6 kernel several times but anyone success
Then I install the 2.6 serieskernel package in test direction it was very easy but Im using a centrino laptop and that kernel does not support acpid and intel speedstep so these features are so important then I decided to make a kernel package that includes ipw2200 driver speedstep support and acpi support.The important point is here...
HOW CAN I DO THİS OR CAN ANYONE DO THİS FOR ME AND ANYOTHERS LİKE ME

btmiller 10-02-2005 05:02 PM

The first thing to do is to compile the kernel to your specifications. Then you'll need to copy all the binaries and other stuff (don't forget the modules) to an out of the way directory, write the install, configuration, and onlyonce scripts, and then run makepkg to bundle it up. You can read the makepkg man page for more details.

jong357 10-02-2005 09:06 PM

Well, you probably should learn how to make build scripts if your going to use Slackware. They come in handy. I make my own kernel packages as well and I guess I could post mine. I group kernel-ide and kernel-modules into one package (kernel+)... It's not the true Slackware way of making kernel packages.. I just prefer it this way.

Don't prematurely kill the script with the if/then's still there. It will leave your system non-bootable unless you rename those directories... You'll need your .config in the same directory only named config-$VERSION. I'm not going to break it down any further. This is just meant as an example of how you COULD do it...

Code:

#!/bin/sh

CWD=`pwd`
TMP=/tmp
BUILDDIR=/usr/src
PKGKERNEL=$TMP/package-kernel+
PKGSOURCE=$TMP/package-source
VERSION=2.6.13.2
SOURCEBUILD=1
KERNELBUILD=1
SOURCEARCH=noarch
KERNELARCH=i486
# This is where we retrieve our bzImage from
# $BUILDDIR/linux-$VERSION/arch/$KERNELPLATFORM/boot
KERNELPLATFORM=i386

rm -rf $PKGKERNEL
rm -rf $PKGSOURCE
mkdir -p $PKGKERNEL/{boot,install,lib/modules}
mkdir -p $PKGSOURCE/{install,usr/src}


if [ -d /usr/src/linux-$VERSION ]; then
  mv $BUILDDIR/linux-$VERSION $BUILDDIR/linux-$VERSION.orig
fi

if [ -d /lib/modules/$VERSION ]; then
  mv /lib/modules/$VERSION /lib/modules/$VERSION.orig
fi

# I also like to hide /boot from the kernel (config reasons):
mv /boot /boot.tmp

cd $BUILDDIR
echo
echo "linux-$VERSION.tar.bz2 is now extracting..."
echo
tar -xjf $CWD/linux-$VERSION.tar.bz2
cd linux-$VERSION
make distclean
# Only root users should be messing with the kernel
chown -R root.root .

echo "Making the kernel source package..."
echo
sleep 2
install -m 644 $CWD/config-$VERSION        $BUILDDIR/linux-$VERSION/.config
make oldconfig > /dev/null
make bzImage
make clean
rm -f .version
echo
echo "Moving source into package..."
echo
cd $PKGSOURCE/usr/src
cp -Ra $BUILDDIR/linux-$VERSION $PKGSOURCE/usr/src
# This is said to no longer be required. Until somebody points out
# that it actually hurts anything, It'll stay here.
ln -sf linux-$VERSION linux

cat << EOF > $PKGSOURCE/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in.  You must make
# exactly 11 lines for the formatting to be correct.  It's also customary to
# leave one space after the ':'.

            |-----handy-ruler------------------------------------------------------|
kernel-source: linux-$VERSION (kernel source)
kernel-source:
kernel-source: Source code for Linus Torvalds' Linux kernel.
kernel-source:
kernel-source: This is the complete source code for the Linux kernel.
kernel-source:
kernel-source:
kernel-source:
kernel-source:
kernel-source:
kernel-source:
EOF

cd $PKGSOURCE
makepkg -l y -c n $TMP/kernel-source-$VERSION-$SOURCEARCH-$SOURCEBUILD.tgz

echo
echo "Making the kernel+ package..."
echo
sleep 2

cd $BUILDDIR/linux-$VERSION
make bzImage
make modules
make modules_install
rm -rf /lib/modules/$VERSION/{build,source}
mv /lib/modules/$VERSION $PKGKERNEL/lib/modules/$VERSION
cat System.map > $PKGKERNEL/boot/System.map.$VERSION
cat arch/$KERNELPLATFORM/boot/bzImage > $PKGKERNEL/boot/vmlinuz-$VERSION
cat .config > $PKGKERNEL/boot/config-$VERSION
( cd $PKGKERNEL/boot
  ln -sf System.map.$VERSION System.map
  ln -sf vmlinuz-$VERSION vmlinuz )
cat << EOF > $PKGKERNEL/install/doinst.sh
( cd lib/modules/$VERSION ; rm -rf build )
( cd lib/modules/$VERSION ; ln -sf ../../../usr/src/linux-$VERSION build )
( cd lib/modules/$VERSION ; rm -rf source )
( cd lib/modules/$VERSION ; ln -sf ../../../usr/src/linux-$VERSION source )
# A good idea whenever kernel modules are added or changed:
if [ -x sbin/depmod ]; then
  chroot . /sbin/depmod -a 1> /dev/null 2> /dev/null
fi
EOF

cat << EOF > $PKGKERNEL/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

      |-----handy-ruler------------------------------------------------------|
kernel+: kernel+ (kernel and modules)
kernel+:
kernel+: A kernel module is a piece of object code that can be dynamically
kernel+: loaded into the Linux kernel to provide new kernel functions.
kernel+: Most of these modules provide support for devices such as CD-ROM
kernel+: drives, tape drives, and ethernet cards.
kernel+:
kernel+: This package also contains the built kernel or bzImage that is
kernel+: used to boot your system.
kernel+:
kernel+:
EOF

cd $PKGKERNEL
makepkg -l y -c n $TMP/kernel+-$VERSION-$KERNELARCH-$KERNELBUILD.tgz

echo
echo "Cleaning up..."

# Restore the original directories
rm -rf $BUILDDIR/linux-$VERSION
if [ -d $BUILDDIR/linux-$VERSION.orig ]; then
  mv $BUILDDIR/linux-$VERSION.orig $BUILDDIR/linux-$VERSION
fi
if [ -d /lib/modules/$VERSION.orig ]; then
  mv /lib/modules/$VERSION.orig /lib/modules/$VERSION
fi

mv /boot.tmp /boot

cd $TMP
rm -rf $PKGKERNEL
rm -rf $PKGSOURCE

echo
echo "All Done!"
echo "Your packages are in $TMP"
echo


SqdnGuns 10-02-2005 09:07 PM

Here is a good how-to, I use it myself:

http://xushi.co.uk/guides/kernel.php

komuthan 10-02-2005 11:23 PM

@SqdnGuns
The link is broken
@jong357
I thing it's so comlicated and cant do this and have a question :)
Is There Anybody To Do This Job For Me and Others like me (PLEASEee)?
Last question : When boot my freshly compiled kernel it stops and the last line is "mac adress A0 B2 bla blaa" where am wrong
How did I build my kernel
1. copy the kernelsource to usr/src
2.extract it
3.ln -s linux2.6.. /linux
4.cd linux
5.make mrproper
6.copy the existing config file to source dir
7.make menuconfig (add speedstep and acpi support)
8.make -j5 bzImage
9.make -j5 modules
10. make modules install
11.
/usr/src/linux# cp System.map /boot/System.map-2.6.13
/usr/src/linux# cp .config /boot/config-2.6.13
/usr/src/linux# cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.6.13
12.
/boot# rm System.map
/boot# rm config
/boot# rm vmlinuz
13.
/boot# ln -s System.map-2.6.13 System.map
/boot# ln -s config-2.6.13 config
/boot# ln -s vmlinuz-2.6.13 vmlinuz
and last boot# generate-modprobe.conf /etc/modprobe.conf

ofcourse I chanced my liloconf and then run lilo
where is the problem did all of theese steps but....

heltreko 10-03-2005 01:15 AM

I think you should do

Code:

make oldconfig
after copying config to your source directory (i.e. between 6 and 7 in your list).

SqdnGuns 10-03-2005 11:23 AM

Quote:

Originally posted by komuthan
@SqdnGuns
The link is broken
Weird, just cleared my cache to be sure and I get right into it............

jong357 10-03-2005 02:04 PM

Seems you have to copy/paste that link into your address bar...

Quote:

I thing it's so comlicated and cant do this and have a question :)
Is There Anybody To Do This Job For Me and Others like me (PLEASEee)?
I had a feeling you were going to say that. That script isn't complicated at all. They are just regular commands that one might type into a terminal. Your probably looking at the entire thing instead of reading it line by line. Variables tend to confuse people who are new to bash as well. So... I did just do it for you. All you have to do is copy/paste all of that into gedit or kwrite and then save it as "kernel.SlackBuild". Copy/paste your config in the same directory with the name of "config-2.6.13.12" and make sure the kernel source is in the same directory as well. Then "sh kernel.SlackBuild". Doesn't get much easier than that. I'll even edit it so it will work for you...

After this, you aught to browse thru some Slackware build scripts and try to understand them... It will help you in the long run.

jong357 10-03-2005 02:18 PM

Also...

Quote:

When boot my freshly compiled kernel it stops and the last line is "mac adress A0 B2 bla blaa" where am wrong
That happens when you don't have your network setup properly. It didn't freeze. Give it some time. You need patience my man... Patience... It takes up to a minute sometimes before dhcpd will give up on trying to find an IP address...

komuthan 10-03-2005 06:02 PM

Quote:

Originally posted by jong357

That happens when you don't have your network setup properly. It didn't freeze. Give it some time. You need patience my man... Patience... It takes up to a minute sometimes before dhcpd will give up on trying to find an IP address...

I thjing you mean Iam a patienceness man but I wait 3 or 4 minutes and ctrl+c didnot work so I tought it was freeze
and one more thing ; I installed ipw2200 driver before compiling the new kernel and edited initrd to use dhcp
you mean the problem was becouse of this

Iam sory about the link it's working
And thanks for the link

komuthan 10-03-2005 06:13 PM

I decide to compile the kernel last time by the link and i need a good .config file for my hardware
my hardware is MSI M510A notebook
centrino 1.6
ipw2200 wireless
rodeon 9700 64mb ram
..
...

gnashley 10-04-2005 11:46 AM

Use the standard kernel config file and just add in the support you need, instead of starting from scratch.

komuthan 10-05-2005 01:53 AM

today I tried to compile the kernel(by the guide of xushi) again
I used default .config file and add ssome features like centrino support,ntfs support acpi support pcmci and mmccard support......
but again and again the same problem what is it???

fatal modul agpgart not found
fatal modul psmouse not found
last line:mac adress a0 b3 ....

komuthan 10-06-2005 01:37 AM

Quote:

Originally posted by jong357
Seems you have to copy/paste that link into your address bar...



I had a feeling you were going to say that. That script isn't complicated at all. They are just regular commands that one might type into a terminal. Your probably looking at the entire thing instead of reading it line by line. Variables tend to confuse people who are new to bash as well. So... I did just do it for you. All you have to do is copy/paste all of that into gedit or kwrite and then save it as "kernel.SlackBuild". Copy/paste your config in the same directory with the name of "config-2.6.13.12" and make sure the kernel source is in the same directory as well. Then "sh kernel.SlackBuild". Doesn't get much easier than that. I'll even edit it so it will work for you...

After this, you aught to browse thru some Slackware build scripts and try to understand them... It will help you in the long run.

I made the package by using your slackbuild script
and i installed it
but the problem is same :confused: :confused: :confused:
I thing its abaut .config file
i need a config file :eek: :eek: :eek:

jong357 10-06-2005 10:36 AM

I would say there is nothing wrong with your config except that you should probably build the PS2 mouse module into the kernel. I have to do that as well or my mouse won't work as a module.

It sounds to me as if this is an ipw issue. I don't have one of those cards so I can't help you out. Do you need firmware or anything to go along with the driver? Is the driver in the kernel or are you using the sourceforge version? It has to be with that if it's stopping on your MAC address. Can't be anything else... Diasable your network from coming up on boot and it will probably start up fine. Then try working on your problem from within the new kernel.


All times are GMT -5. The time now is 01:38 PM.