summaryrefslogtreecommitdiff
path: root/PowerPCKernelBuilding.mdwn
blob: a4a54d9aaddca90739d0793924e81d9306056f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Building a Kernel for PowerPC

In order to build a kernel for PowerPC while on a non-PowerPC machine, you will need a [[cross-compilation toolchain|DebianCrossCompilerHowto]] installed. Then, each time you invoke `make` to perform part of the kernel build process, you need to supply the arguments `CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc`; if you are using `make-kpkg`, you need to supply the arguments `--cross-compile powerpc-linux-gnu- --arch ppc --subarch powerpc`.

## Obtaining the kernel source package

On a Debian system, install the latest `linux-source-2.6.NN` package, as well as `make-kpkg`, `build-essential`, and `libncurses5-dev`. Create a working directory and extract the source there.

    PKG=`dpkg -l 'linux-source-*' | tail -n +6 | sort -nk 3 | tail -n 1 | awk '{print $2}'`
    sudo aptitude install $PKG make-kpkg build-essential libncurses5-dev
    mkdir -p ~/src/kernel/powerpc
    cd ~/src/kernel/powerpc
    tar xvvjf /usr/src/$PKG.tar.bz2
    cd $PKG

## Configuring the kernel

Since the kernel's .config contains an x86 configuration by default, you need to replace it with the default PowerPC configuration before configuring the kernel. Note that the defconfig for PowerPC is not in arch/ppc/defconfig as expected; as of 2.6.11 it is located at arch/ppc/configs/common\_defconfig.

    cp arch/ppc/configs/common_defconfig .config
    make CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc menuconfig

This will open the kernel configuration program, allowing you to choose which features you want to include in the kernel.

## Building a kernel package

Use `make-kpkg` to build a Debian package of the kernel.

    make-kpkg --revision 1 --cross-compile powerpc-linux-gnu- --arch ppc --subarch powerpc kernel_image

## Building a kernel image by hand

To build a kernel image without using `make-kpkg`, use the "zImage" target.

    make CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc zImage

This will create kernel images in various formats and place them in arch/ppc/boot/images/

## PP01-specific notes

FIXME: integrate this into the above.

To build a PPCBoot image, which the PP01 board might actually boot, use the "uImage" target.

    make CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc uImage

The 2.6.9 kernel they use doesn't appear to build with GCC 4.0

## Disheveled Notes from Darrick

Run this (on Darrick's not-so-weird ppc boxes, anyway) on the denx linuxppc-2.4-devel.git tree:

    (make CROSS_COMPILE= mrproper TQM5200_config ; cp arch/ppc/defconfig .config ; make CROSS_COMPILE= oldconfig dep ; make CROSS_COMPILE= -j2 uImage) 2>&1 | tee BUILDLOG

Non ppc machines need to set CROSS\_COMPILE= to something useful. Also see the .config file I put in the Attachments section.

----
Attachments:

- [[uImage-2.4.25-works-ok]]
- [[uImage-2.6.22-does-not-work]]