| | 7 | |
|---|
| | 8 | \subsubsection{General Kernel Cross Compiling Guide} |
|---|
| | 9 | |
|---|
| | 10 | The Linux kernel supports being cross compiled for various architectures. For a |
|---|
| | 11 | list of currently supported machine types, see the \file{arch/} subdirectory of |
|---|
| | 12 | the kernel sources. |
|---|
| | 13 | |
|---|
| | 14 | There are some prerequisites that need to be fulfilled: |
|---|
| | 15 | \begin{itemize} |
|---|
| | 16 | \item the directory containing the cross-toolchain must be contained in |
|---|
| | 17 | your \$\{PATH\} environment variable (best choice is at last position) |
|---|
| | 18 | \item \command{make} needs to be called with \code{ARCH=MYARCH} as |
|---|
| | 19 | parameter, while \code{MYARCH} must be substituted with the |
|---|
| | 20 | destined architecture |
|---|
| | 21 | \item if necessary, one can also specify \code{CROSS\_COMPILE=PFX} as |
|---|
| | 22 | additional argument to \command{make}, where \code{PFX} is |
|---|
| | 23 | something like \code{mipsel-linux-} (defaults to |
|---|
| | 24 | \code{\$\{ARCH\}-linux-}) |
|---|
| | 25 | \end{itemize} |
|---|
| | 26 | |
|---|
| | 27 | Then configuring and compiling is straight forward: |
|---|
| | 28 | \begin{Verbatim}[label=kernel cross compiling] |
|---|
| | 29 | $ make ARCH=mips menuconfig |
|---|
| | 30 | [...] |
|---|
| | 31 | $ make ARCH=mips |
|---|
| | 32 | \end{Verbatim} |
|---|
| | 33 | |
|---|
| | 34 | \subsubsection{How The ADK Builds A Kernel} |
|---|
| | 51 | \subsection{Adding A New Kernel Version} |
|---|
| | 52 | |
|---|
| | 53 | FreeWRT supports using a different kernel version for each target device. This |
|---|
| | 54 | way it is possible to update the kernel used for one's favourite device without |
|---|
| | 55 | (possibly) breaking all others using the same kernel major. |
|---|
| | 56 | |
|---|
| | 57 | \begin{enumerate} |
|---|
| | 58 | \item create a new subdirectory |
|---|
| | 59 | \file{target/linux/generic-\$\{KERNEL\_VERSION\}} |
|---|
| | 60 | \item copy over and adapt a \file{Makefile} from one of the existing |
|---|
| | 61 | subdirectories, basically updating the MD5 sum (the ADK fetches |
|---|
| | 62 | the \file{tar.bz2} version) |
|---|
| | 63 | \item update \$\{UNAME\_R\} for your device in \file{rules.mk} |
|---|
| | 64 | \item make sure |
|---|
| | 65 | \file{target/linux/\$\{BOARD\}-\$\{KERNEL\_MAJOR\}/Makefile} |
|---|
| | 66 | includes the right files |
|---|
| | 67 | \item update the static kernel config provided for your device |
|---|
| | 68 | %TODO: hint to the docs about it in this file, using \ref |
|---|
| | 69 | \end{enumerate} |
|---|
| | 70 | |
|---|
| | 71 | %\subsection{Updating The Static Kernel Config For A Device} |
|---|
| | 72 | |
|---|
| | 73 | %\subsection{Adding A New Target Device} |
|---|
| | 74 | |
|---|
| | 75 | % - target/linux/bla-2.X/{Config.in,Makefile} erstellen |
|---|
| | 76 | % - target/linux/bla-2.X/patches befuellen (meistens) |
|---|
| | 77 | % - target/linux/bla-2.X/kernelconfig erstellen (\ref) |
|---|
| | 78 | % - target/Config.in erweitern |
|---|
| | 79 | % - mk/targets.mk erweitern |
|---|
| | 80 | % - target_template |
|---|
| | 81 | % - arch-definition (optional) |
|---|
| | 82 | % - target/image/bla erstellen |
|---|
| | 83 | % - Makefile aus target/image/rb/Makefile (oder so), anpassen |
|---|
| | 84 | |
|---|