working.tex 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. The following section gives some tips and tricks on how to use efficiently
  2. OpenWrt on a regular basis and for daily work.
  3. \subsection{Compiling/recompiling components}
  4. The buildroot allows you to recompile the full environment or only parts of it
  5. like the toolchain, the kernel modules, the kernel or some packages.
  6. For instance if you want to recompile the toolchain after you made any change to it
  7. issue the following command:
  8. \begin{Verbatim}
  9. make toolchain/{clean,compile,install}
  10. \end{Verbatim}
  11. Which will clean, compile and install the toolchain. The command actually expands to the
  12. following:
  13. \begin{Verbatim}
  14. make[1] toolchain/clean
  15. make[2] -C toolchain/kernel-headers clean
  16. make[2] -C toolchain/binutils clean
  17. make[2] -C toolchain/gcc clean
  18. make[2] -C toolchain/uClibc clean (glibc or eglibc when chosen)
  19. \end{Verbatim}
  20. Of course, you could only choose to recompile one or several of the toolchain components
  21. (binutils, kernel-headers gcc, C library) individually.
  22. The exact same idea works for packages:
  23. \begin{Verbatim}
  24. make package/busybox/{clean,compile,install}
  25. \end{Verbatim}
  26. will clean, compile and install busybox (if selected to be installed on the final rootfs).
  27. Supposing that you made changes to the Linux kernel, but do not want to recompile everything,
  28. you can recompile only the kernel modules by issuing:
  29. \begin{Verbatim}
  30. make target/linux/compile
  31. \end{Verbatim}
  32. To recompile the static part of the kernel use the following command:
  33. \begin{Verbatim}
  34. make target/linux/install
  35. \end{Verbatim}
  36. \subsection{Using quilt inside OpenWrt}
  37. OpenWrt integrates quilt in order to ease the package, kernel and toolchain
  38. patches maintenance when migrating over new versions of the software.
  39. Quilt intends to replace an old workflow, where you would download the new
  40. source file, create an original copy of it, an a working copy, then try to
  41. apply by hand old patches and resolve conflicts manually. Additionally, using
  42. quilt allows you to update and fold patches into other patches easily.
  43. Quilt is used by default to apply Linux kernel patches, but not for the other
  44. components (toolchain and packages).
  45. \subsubsection{Using quilt with kernel patches}
  46. Assuming that you have everything setup for your new kernel version:
  47. \begin{itemize}
  48. \item \texttt{LINUX\_VERSION} set in the target Makefile
  49. \item config-2.6.x.y existing
  50. \item patches-2.6.x.y containing the previous patches
  51. \end{itemize}
  52. Some patches are likely to fail since the vanilla kernel we are patching
  53. received modifications so some hunks of the patches are no longer applying.
  54. We will use quilt to get them applying cleanly again. Follow this procedure
  55. whenever you want to upgrade the kernel using previous patches:
  56. \begin{enumerate}
  57. \item make target/linux/clean (removes the old version)
  58. \item make target/linux/compile (uncompress the kernel and try to apply patches)
  59. \item if patches failed to apply:
  60. \item cd build\_dir/linux-target/linux-2.6.x.y
  61. \item quilt push -a (to apply patches where quilt stopped)
  62. \item quilt push -f (to force applying patches)
  63. \item edit .rej files, apply the necessary changes to the files
  64. \item remove .rej files
  65. \item quilt refresh
  66. \item repeat operation 3 and following until all patches have been applied
  67. \item when all patches did apply cleanly: make target/linux/refresh
  68. \end{enumerate}
  69. Note that generic (target/linux/generic-2.6/linux-2.6.x/) patches can be found in
  70. \texttt{build\_dir/linux-target/linux-2.6.x.y/patches/generic} and platform specific
  71. patches in \texttt{build\_dir/linux-target/linux-2.6.x.y/patches/platform}.
  72. \subsubsection{Using quilt with packages}
  73. As we mentioned earlier, quilt is enabled by default for kernel patches, but not for
  74. packages. If you want to use quilt in the same way, you should set the QUILT environment
  75. variable to 1, e.g:
  76. \begin{Verbatim}
  77. make package/busybox/{clean,compile} QUILT=1
  78. \end{Verbatim}
  79. Will generate the patch series file and allow you to update patches just like we described
  80. before in the kernel case. Note that once all patches apply cleanly you should refresh them
  81. as well using the following command:
  82. \begin{Verbatim}
  83. make package/busybox/refresh QUILT=1
  84. \end{Verbatim}