| 1 |
\section{Target Compilation} |
|---|
| 2 |
|
|---|
| 3 |
The following section will discuss how kernel and root filesystem are being |
|---|
| 4 |
created and packed into appropriate formats for use with each target device. |
|---|
| 5 |
|
|---|
| 6 |
\subsection{Kernel Compilation} |
|---|
| 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} |
|---|
| 35 |
|
|---|
| 36 |
\begin{itemize} |
|---|
| 37 |
\item destined kernel version via makefile include from inside \file{target/linux/\$\{BOARD\}-2.\{4,6\}/Makefile} |
|---|
| 38 |
\item kernel .config creation: \file{target/Makefile} |
|---|
| 39 |
\item howto update the static kernel config |
|---|
| 40 |
\item kernel compilation (output of files, etc.) |
|---|
| 41 |
\end{itemize} |
|---|
| 42 |
|
|---|
| 43 |
\subsection{Image Creation} |
|---|
| 44 |
|
|---|
| 45 |
\begin{itemize} |
|---|
| 46 |
\item different image formats |
|---|
| 47 |
\item image creation process for each format |
|---|
| 48 |
\item kernel vs. nokernel targets |
|---|
| 49 |
\end{itemize} |
|---|
| 50 |
|
|---|
| 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 |
|
|---|
| 69 |
\end{enumerate} |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|