Building the Kernel

From Linux PARISC Wiki
(Difference between revisions)
Jump to: navigation, search
(Import with no edits from parisc-linux.org website.)
 
(Add template message)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
If you are only interested in using Linux/PARISC then please see the [http://www.parisc-linux.org/software/index.html software] information web page.
+
<div style="padding:0; margin:0 0 0.5em 0; border-style:solid; border-width:medium">
 +
{| width="100%" align="center" style="text-align:left; "
 +
| style="padding-left:5px;" | '''IMPORTANT:''' The content of this page is outdated. Please '''[[User:Alex_Ivanov/Building_the_Kernel|check draft]]''' version instead.
 +
|}</div>
  
Pre-built 2.6 kernels are available on our [http://cvs.parisc-linux.org/download/linux-2.6/ CVS download Server] and via <tt>apt-get install kernel-image-XX</tt> (where XX is something like "2.4.25-32" or "2.6.6-32"). Most users should be pretty happy with kernels they can get from either source.
+
If you are only interested in using Linux/PARISC then please see the [http://www.parisc-linux.org/software/index.html software] information web page.
  
 
We no longer advise using the [http://www.parisc-linux.org/software/index.html#xcs pre-built cross compiler] to build a parisc kernel on an x86 linux host. Native compiler/linker tools are better maintained. The old mini-howto describes how to [http://www.parisc-linux.org/kernel/nfsroot.html cross-build kernels] for Net Boot. Please only bother with this if you have a very slow parisc machine and very fast x86 machine.
 
We no longer advise using the [http://www.parisc-linux.org/software/index.html#xcs pre-built cross compiler] to build a parisc kernel on an x86 linux host. Native compiler/linker tools are better maintained. The old mini-howto describes how to [http://www.parisc-linux.org/kernel/nfsroot.html cross-build kernels] for Net Boot. Please only bother with this if you have a very slow parisc machine and very fast x86 machine.
Line 8: Line 11:
 
* Internet connection
 
* Internet connection
 
* hppa-debian host properly configured so apt-get and ftp work
 
* hppa-debian host properly configured so apt-get and ftp work
* [http://cvs.parisc-linux.org/ parisc-linux source]
+
* http://ftp.debian-ports.org/debian and http://ftp.parisc-linux.org/debian-ports/debian apt sources
  
= Short Recipe to Build a Kernel =
+
= How To Build a Kernel =
The short recipe is for when existing kernels from [http://cvs.parisc-linux.org/download/linux-2.6/ CVS download Server] or debian package pool don't have needed config "defaults" or need a different selection of kernel modules. If you want to do more than that, read "The Old, Grotty Way" as well (below).
+
Here are details developers care about in order to '''modify, build, test''' parisc-linux kernels. Note that just because a kernel option can be select, does NOT mean it works. Trial and error is usually the only sure way to find out. Reports of such adventures are always welcome on the parisc-linux [mailto:linux-parisc@vger.kernel.org mailing list].
<pre>
+
<ol>
# get necessary tools
+
<li>'''Install tools'''
apt-get install kernel-package gcc binutils libc6-dev
+
cd /usr/src
+
# if CVS doesn't work, See "Getting Source" below.
+
cvs -d :pserver:anonymous@cvs.parisc-linux.org:/var/cvs login
+
cvs -d :pserver:anonymous@cvs.parisc-linux.org:/var/cvs co linux-2.4
+
cd linux-2.4
+
# adjust a new .config file
+
make menuconfig
+
# or do it by hand:
+
# vi .config
+
# make oldconfig
+
make-kpkg kernel_image
+
cd ..
+
dpkg -i kernel-image*.deb
+
sync
+
reboot
+
</pre>
+
= The Old, Grotty Way To Build a Kernel =
+
Here are all the ugly details developers care about in order to '''modify, build, test''' parisc-linux kernels. Note that just because a kernel option can be select, does NOT mean it works. Trial and error is usually the only sure way to find out. Reports of such adventures are always welcome on the parisc-linux [mailto:linux-parisc@vger.kernel.org mailing list].
+
# '''Install tools'''
+
 
<pre>
 
<pre>
 
apt-get install kernel-package gcc binutils lib6-dev
 
apt-get install kernel-package gcc binutils lib6-dev
</pre>
+
</pre></li>
# '''Fetch kernel source''': The 2.6.x kernel source tree is available via [http://cvs.parisc-linux.org/ CVS] and [http://cvs.parisc-linux.org/download/linux-2.6/ snapshots]. It is better to get a snapshot first and then update using CVS.
+
<li>'''Obtain kernel source''': Stable kernel sources are available via <tt>apt-get install linux-source-XX</tt> (where XX is something like "2.4.25-32" or "2.6.6-32").</li>
<pre>
+
<li>'''Configure Kernel Options'''
cd /usr/src
+
# See http://cvs.parisc-linux.org/download/linux-2.6/
+
wget http://cvs.parisc-linux.org/download/linux-2.6/linux-2.6.6-pa2.tar.bz2
+
# verify ~350MB free
+
df -h .
+
tar xjf linux-2.6.6-pa2.tar.bz2
+
</pre>
+
# '''Configure Kernel Options'''
+
 
<pre>
 
<pre>
 
cd /usr/src/linux-2.6
 
cd /usr/src/linux-2.6
Line 54: Line 29:
 
# to adjust the .config if kernel defaults don't suit you.
 
# to adjust the .config if kernel defaults don't suit you.
 
make oldconfig
 
make oldconfig
</pre>
+
</pre></li>
# '''Build Kernel Executables'''
+
<li>'''Build Kernel Executables'''
 
<pre>
 
<pre>
# 2.6.x
+
# current
 
make
 
make
  
Line 65: Line 40:
 
# must be root user
 
# must be root user
 
make modules_install
 
make modules_install
</pre>
+
</pre></li>
# '''Installing the kernel'''
+
<li>'''Installing the kernel'''
 
The resulting kernel image is <tt>/usr/src/linux-2.6/vmlinux</tt>. Normally, x86-linux will save the existing vmlinux and install the new kernel with <tt>make install</tt>. The "dpkg -i" steps above do about the same thing. Here is one way to do it manually:
 
The resulting kernel image is <tt>/usr/src/linux-2.6/vmlinux</tt>. Normally, x86-linux will save the existing vmlinux and install the new kernel with <tt>make install</tt>. The "dpkg -i" steps above do about the same thing. Here is one way to do it manually:
 
<pre>
 
<pre>
Line 87: Line 62:
 
reboot
 
reboot
 
...
 
...
</pre>
+
</pre></li>
 +
</ol>

Latest revision as of 08:49, 6 September 2013

IMPORTANT: The content of this page is outdated. Please check draft version instead.

If you are only interested in using Linux/PARISC then please see the software information web page.

We no longer advise using the pre-built cross compiler to build a parisc kernel on an x86 linux host. Native compiler/linker tools are better maintained. The old mini-howto describes how to cross-build kernels for Net Boot. Please only bother with this if you have a very slow parisc machine and very fast x86 machine.

[edit] Prerequisites For Building Kernels

[edit] How To Build a Kernel

Here are details developers care about in order to modify, build, test parisc-linux kernels. Note that just because a kernel option can be select, does NOT mean it works. Trial and error is usually the only sure way to find out. Reports of such adventures are always welcome on the parisc-linux mailing list.

  1. Install tools
    apt-get install kernel-package gcc binutils lib6-dev
    
  2. Obtain kernel source: Stable kernel sources are available via apt-get install linux-source-XX (where XX is something like "2.4.25-32" or "2.6.6-32").
  3. Configure Kernel Options
    cd /usr/src/linux-2.6
    # clone the nearest _config to start with
    cp arch/parisc/configs/b180_config .config
    # You can also "make config" or "make menuconfig" here
    # to adjust the .config if kernel defaults don't suit you.
    make oldconfig
    
  4. Build Kernel Executables
    # current
    make
    
    # 2.4.x needs several steps instead:
    #	make -j2 dep && make vmlinux && make modules
     
    # must be root user
    make modules_install
    
  5. Installing the kernel The resulting kernel image is /usr/src/linux-2.6/vmlinux. Normally, x86-linux will save the existing vmlinux and install the new kernel with make install. The "dpkg -i" steps above do about the same thing. Here is one way to do it manually:
    cd /boot
    mv vmlinux vmlinux.old
    mv System.map System.map.old
    cd /usr/src/linux-2.6
    cp System.map vmlinux /boot/
    sync
    reboot
    

    NOTE: One does not need to run palo when replacing an existing kernel.

    Another way is to rename vmlinux with revision info, reboot, interrupt autoboot and specify interactive boot, specify the new kernel via palo, and finally once the new kernel is booted, modify /etc/palo.conf to match (and run palo again). Start with something like:

    cp vmlinux /boot/vmlinux-2.6.6-pa1
    cp System.map /boot/System.map-2.6.6-pa1
    cp .config /boot/config-2.6.6-pa1
    sync
    reboot
    ...
    
Personal tools