LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 837|回复: 4

Slackware kernel compile HOWTO

[复制链接]
发表于 2004-7-6 20:09:23 | 显示全部楼层 |阅读模式
Having numerous problems compiling Slackware? When I finally figured it out I decided to write a HOWTO to help those who come after me, in the great spirit of the HOWTO.

This kernel was compiled in Slackware 9.1 with kernel 2.4.22. If you plan on using ALSA you will need to grab the newest sources. Note, the new 2.6 kernel has ALSA included, this step would not be needed. Here we go.

Open up '/etc/lilo.conf' in a text editor such as 'vim' or 'pico' (pico tends to be the more "basic" of the two) edit the line:
image = /boot/vmlinuz
To read:

image = /boot/vmlinuz.old
And:
label = MyLabel
To read:

label = MyLabel.old

Next open up '/usr/src/linux/Makefile'
Uncomment the line...
#export INSTALL_PATH=/boot
To read:

export INSTALL_PATH=/boot

Next its time to choose your modifications:

make menuconfig

This will bring up an ncurses based menu were you can choose to have modifications "included" (pressing 'y' on your selection) into the kernel, or as a "module" (pressing 'm' to modularize) or to exclude completely (pressing 'n'). Choosing to have alot of modules instead of everything included in the kernel results in a faster running system depending on what you add.
Next:

make dep
make clean


Build the image:

make bzImage

Make your new image:

make

Install:

make install

Make your modules:

make modules

Install modules:

make modules_install

At this point, reboot into your newly created kernel, so we can move on to compiling ALSA, rebooting ensures './configure'(see below) knows whats new/changed with the new setup.

(reboot intermission...sleep 3m)

Next we will compile and install ALSA, assuming you have gotton the appropriate sources from the link above (I hope you have!;))

Unpack the sources:

bunzip2 alsa-driver* && tar -xvf alsa-driver*

Move into the newly created directory:

cd alsa*

Next, time to configure:

./configure

If everything went we'll, lets compile:

make

Then install:

make install

If your card is supported, run 'alsaconf' and follow the directions:

alsaconf

Then, to configure the sound options/volume to taste, run:

alsamixer

You are now running a modified Slackware Linux!

Links:
www.Slackware.com
www.alsa-project.org
www.kernel.org
发表于 2004-7-6 20:35:03 | 显示全部楼层
2.6内核不需要这么麻烦,只要make ;make modules_install ;make install。make就把make modules都包括了
 楼主| 发表于 2004-7-6 20:56:21 | 显示全部楼层
I think the following must be the complete guide:
-------------------------------------------------------
**"Go get the kernel source"**

cd /usr/src
**"Change Directory To /usr/src"**

ls -alc
**"check for symlink (ex. /usr/src/linux->/usr/src/linux-2.4.18)"**
**"also note since its being ask recently, that if there is no symlink"**
**"then move on to the untarring of the kernel"**

file linux
**"double check with this command (output ex.) linux: symbolic link to linux-2.4.18-14"**

rm linux
**"remove symlink"**

tar -zxvf linux-x.x.x.tar.gz
**"unpack the tarball (new kernel)"**

ln -s /usr/src/linux-x.x.x /usr/src/linux
**"make a new link to the new kernel"**

cd linux
**"type this to change to the directory"**

----------------------------
Now Comes The Fun Part~!
----------------------------
make mrproper
**"this removes the current .config and other files"**

cp /usr/src/linux-2.4.x/.config /usr/src/linux
***this is if you want to use your old config***

<-->Your Choice<-->
make config
**"basic config from terminal"**
make menuconfig
**"for ncurses GUI in the terminal"**
make xconfig
**"for X-based GUI with modular explanations"** (QT Based)
make gconfig
**"same as above, but for 2.6.x kernel only"** (GTK Based, and might be still buggy)

/**********
Note:
Don't forget to add module support and kernel support for future hardware.
Do not compile your harddrive and filesystem type as a module.
The configure program enables you to specify an enormous number of features. It is advisable to skim through all the sections to get a feel for the different things you can do. Most options are about specifying whether you want a feature
  • compiled into the kernel image, [M] compiled as a module, or [ ] not compiled at all. You can also turn off module support altogether from Loadable module support -->. The kernel configuration is one LINUX program that offers lots of help--select < Help > on any feature. The raw help file is /usr/src/linux/Documentation/Configure.help can be also worth reading.
    When your done the config click exit and save current configuration. Your file is now known as .config .
    **********/
    SKIP THE FOLLOWING IF DOING A 2.6.x KERNEL
    make dep
    **"ensures dependancies such as include files are in place"**

    (vi, pico, emacs) Makefile
    **"Want A Unique Kernel Name? Edit /usr/src/linux/Makefile and change EXTRAVERSION"

    make clean
    **"to clean your sources for they compile correctly"**

    START HERE IF COMPILING A 2.6.x KERNEL

    make bzImage
    **"to make the kernel image (compile and creates compressed image of kernel)"**

    make modules
    **"compile your selected modules"**

    make modules_install
    **"to install newly compile modules (installs to /lib/modules/linux.x.x.x)"**


    --------------------------------------------
    Now Its Time To Install Your New Kernel~!
    --------------------------------------------

    Remove the following links:
    rm -rf /boot/System.map
    rm -rf /boot/vmlinuz

    Then copy the newly created kernel and system.map to /boot
    cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-x.x.x
    cp /usr/src/linux/System.map /boot/System.map-x.x.x

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

    <-> NOTE: <->
    Before doing the next step, read this [1] and this [2] about the initrd.img and see if you even need to do this step ... there is alot of posts
    about this step, so i am adding this section ...
    <-> END NOTE <->

    Next remove existing initrd.img file:
    rm -rf /boot/initrd.x.x.x.img

    ..And create the new one:
    /sbin/mkinitrd /boot/initrd-x.x.x.img x.x.x
    (Note: )
    The last set of x.x.x is the eqivalent to your new kernel version and it looks to /lib/modules for that version.

    --------------------------------------------------------------------
    Use The Steps That Pertain To You
    If You Use Grub Then Edit grub.conf
    If You Use Lilo Then Edit lilo.conf
    --------------------------------------------------------------------
    remember to leave the entry to your old kernel image just in case,
    so modify what is in the config originally to point to the old image
    and make a new entry for you new image you just made ....
    --------------------------------------------------------------------

    <-> And Finally Edit Your /etc/grub.conf file <->
    <-> Note some distros now use menu.lst, so if you can't find grub or lilo, then you know what to look for <->

    title New Kernel
    kernel /vmlinuz-x.x.x ro root=LABEL=/
    initrd /initrd-x.x.x.img
    (Note: )
    look at the previous parameters in the grub.conf file and note what "root=" and use what is existing.

    Exit and Save grub.conf
    type "/sbin/grub-install"

    AND REBOOT!!!

    <-> And Finally Edit Your /etc/lilo.conf file <->
    image = /boot/vmlinuz-x.x.x
    label = New Kernel
    root = /dev/hdx
    read-only

    (Note: )
    look at the previous parameters in the lilo.conf file and note what "root =" and use what is existing.

    Exit and Save lilo.conf
    type "/sbin/lilo"

    AND REBOOT!!!



    /******EDIT*******
    as requested there was wanting the instructions on how to apply patches to your kernel.
    ****END EDIT*****/

    read this or look below ..

    This step comes after untaring your kernel source.
    When you download the patch place it in the folder that you untarred you new kernel.
    Then type:
    patch -E -p1 < sound_patch
    Purely an example and you would type whatever the file name is in replace of sound_patch.


    As of having alternative boot options, well this is no problem.. The stuff above that i tell you to add to your lilo or grub file above could just append the file, and just add ".old" to the title of your oringinal kernel name for you will know the difference. and whether its grub or lilo add "read-only", to the end of the oringinal entries in the lilo.conf, or grub.conf file.
  • 发表于 2004-7-6 22:12:24 | 显示全部楼层
    发表于 2004-7-7 15:12:00 | 显示全部楼层
    好像make xconfig或make gconfig会出现错误的slack10
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    快速回复 返回顶部 返回列表