aboutsummaryrefslogtreecommitdiffstats
path: root/docs/working.tex
blob: 3d3fc42e2d7cd793e7a607b3d80e19da206b062c (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
The following section gives some tips and tricks on how to use efficiently
OpenWrt on a regular basis and for daily work.

\subsection{Compiling/recompiling components}

The buildroot allows you to recompile the full environment or only parts of it
like the toolchain, the kernel modules, the kernel or some packages.

For instance if you want to recompile the toolchain after you made any change to it
issue the following command:

\begin{Verbatim}
make toolchain/{clean,compile,install}
\end{Verbatim}

Which will clean, compile and install the toolchain. The command actually expands to the
following:

\begin{Verbatim}
make[1] toolchain/clean
make[2] -C toolchain/kernel-headers clean
make[2] -C toolchain/binutils clean
make[2] -C toolchain/gcc clean
make[2] -C toolchain/uClibc clean	(glibc or eglibc when chosen)
\end{Verbatim}

Of course, you could only choose to recompile one or several of the toolchain components
(binutils, kernel-headers gcc, C library) individually.

The exact same idea works for packages:

\begin{Verbatim}
make package/busybox/{clean,compile,install}
\end{Verbatim}

will clean, compile and install buysbox (if selected to be installed on the final rootfs).

Supposing that you made changes to the Linux kernel, but do not want to recompile everything,
you can recompile only the kernel modules by issuing:

\begin{Verbatim}
make target/linux/compile
\end{Verbatim}

To recompile the static part of the kernel use the following command:

\begin{Verbatim}
make target/linux/install
\end{Verbatim}

\subsection{Using quilt inside OpenWrt}

OpenWrt integrates quilt in order to ease the package, kernel and toolchain
patches maintenance when migrating over new versions of the software.

Quilt intends to replace an old workflow, where you would download the new
source file, create an original copy of it, an a working copy, then try to
apply by hand old patches and resolve conflicts manually. Additionnaly, using
quilt allows you to update and fold patches into other patches easily.

Quilt is used by default to apply Linux kernel patches, but not for the other
components (toolchain and packages).

\subsubsection{Using quilt with kernel patches}

Assuming that you have everything setup for your new kernel version:
\begin{itemize}
\item \texttt{LINUX\_VERSION} set in the target Makefile
\item config-2.6.x.y existing
\item patches-2.6.x.y containing the previous patches
\end{itemize}

Some patches are likely to fail since the vanilla kernel we are patching
received modifications so some hunks of the patches are no longer applying.
We will use quilt to get them applying cleanly again. Follow this procedure
whenever you want to upgrade the kernel using previous patches:

\begin{enumerate}
\item make target/linux/clean (removes the old version)
\item make target/linux/compile (uncompress the kernel and try to apply patches)
\item if patches failed to apply:
\item cd build\_dir/linux-target/linux-2.6.x.y
\item quilt push -a (to apply patches where quilt stopped)
\item quilt push -f (to force applying patches)
\item edit .rej files, apply the necessary changes to the files
\item remove .rej files
\item quilt refresh
\item repeat operation 3 and following until all patches have been applied
\item when all patches did apply cleanly: make target/linux/refresh
\end{enumerate}

Note that generic (target/linux/generic-2.6/linux-2.6.x/) patches can be found in 
\texttt{build\_dir/linux-target/linux-2.6.x.y/patches/generic} and platform specific
patches in \texttt{build\_dir/linux-target/linux-2.6.x.y/patches/platform}.

\subsubsection{Using quilt with packages}

As we mentionned earlier, quilt is enabled by default for kernel patches, but not for
packages. If you want to use quilt in the same way, you should set the QUILT environment
variable to 1, e.g:

\begin{Verbatim}
make package/buysbox/{clean,compile} QUILT=1
\end{Verbatim}

Will generate the patch series file and allow you to update patches just like we described
before in the kernel case. Note that once all patches apply cleanly you should refresh them
as well using the following command:

\begin{Verbatim}
make package/buysbox/refresh QUILT=1
\end{Verbatim}