User:Alex Ivanov/Building the Kernel

From Linux PARISC Wiki
Jump to: navigation, search

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.

Prerequisites For Building Kernels

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 minimal set of tools
    aptitude install libncurses-dev bc
  2. Obtain kernel source and build tools: Stable kernel sources are available via aptitude install linux-source-XX (where XX is something like "2.4.25-32" or "2.6.6-32"). You may also download a tarball from the The Linux Kernel Archives or git clone from git repositories. The most interested repos should be: [1] and [2]. You may start with first, but if you need some recent PA-RISC changes hadn't yet been imported to the mainline, pick a second one (usually you would be interested in some particular branch). Note that aptitude install linux-source-<any_recent> step is a must (even if you decided to pick the sources from another place) as it will install most of required build tools. You may then opt-out linux-source-XX by issuing aptitude remove, if you don't need these sources.
    cd /usr/src
    # verify ~350MB free
    df -h .
    • Tarball
    tar -xJf linux-3.11.tar.xz
    • Git
    git clone git://
    git checkout <branch/tag/commit>
  3. Choosing toolchain version: The good practice is to leave the one being installed during #Obtain kernel source and build tools phase. But if you can't sucessfully build the kernel using current toolchain version or you have other reasons, you may set a more fresh one.
    optionally: aptitude remove gcc-XX
    aptitude install gcc-YY

    As for installing of another binutils version, it's usually easier to use aptitude frontend for this purpose.

    Important: See how to make installed toolchain versions default ones:
  4. For 64-bit kernels: Install missing build tools
    aptitude install binutils-hppa64 gcc-XX-hppa64

    Where XX usually choosen to be same version as it's 32-bit counterpart.

  5. 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 # ARCH=parisc when cross-compiling
  6. On Debian with systemd you need to use Debian stock config as basis

    cd /usrc/src
    xz -d linux-config-XX/config.hppa_none-flavor.xz
    cp config.hppa_none-flavor linux-source-XX/.config
  7. Build Kernel Executables
    make -j<N> # ARCH=parisc CROSS_COMPILE=...
    # must be root user
    make modules_install
    N is number of parallel processes there. You may add V=1 to get verbose output of build process.
  8. 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
    cd /usr/src/linux-2.6
    cp vmlinux /boot/

    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 /boot/
    cp .config /boot/config-2.6.6-pa1
Personal tools