Revision d5a1a059 latex/note.tex

View differences:

latex/note.tex
154 154

  
155 155
        \subsubsection{Definition}
156 156
            \textbf{SDK}
157

  
157 158
            \textbf{OpenWrt Build System} = build system for the OpenWrt Linux distribution
158
            \textbf{OpenWrt Linux distribution}
159
            \textbf{Instruction set architecture} = the translator that turns the code a machine is running into instructions a processor can understand and execute. It's an important part of a processor.
160
            \textbf{ARM} = a simpler instruction set architecture comparing to the \texttt{x86}. It has the power efficiency. It uses \texttt{Reduced Instruction Set Computing - RISC}
161
            \textbf{i386} = that chips win over ARM chips on the performance. It uses \texttt{Complex Instruction Set Computing - CISC}.
162
            \textbf{Debian on ARM}
163 159

  
164
        \subsubsection{Compile packages with OpenWrt SDK}
165
            Steps I performed
160
            \textbf{OpenWrt Linux distribution}
166 161

  
167
            \begin{itemize}
168
                \item Test building package with OpenWrt SDK BB on Linux Mint 17 (based on Ubuntu Trusty - 14)
169
                    \begin{lstlisting}
170
svn export svn://svn.openwrt.org/openwrt/packages/utils/sed package/sed
171
grep DEPENDS package/sed/Makefile
172
make package/sed/compile # GOT ERROR HERE
162
            \textbf{Instruction set architecture} = the translator that turns the code a machine is running into instructions a processor can understand and execute. It's an important part of a processor.
173 163

  
174
configure: error: in `/home/quynh/Thesis/openwrt-bb/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/sed-4.2.1':
175
configure: error: C compiler cannot create executables
176
See `config.log' for more details.
177
make[2]: *** [/home/quynh/Thesis/openwrt-bb/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/sed-4.2.1/.configured_] Error 77
178
make[2]: Leaving directory `/home/quynh/Thesis/openwrt-bb/package/sed'
179
make[1]: *** [package/sed/compile] Error 2
180
make[1]: Leaving directory `/home/quynh/Thesis/openwrt-bb'
181
make: *** [package/sed/compile] Error 2
164
            \textbf{ARM} = a simpler instruction set architecture comparing to the \texttt{x86}. It has the power efficiency. It uses \texttt{Reduced Instruction Set Computing - RISC}
182 165

  
183
# SOLUTION
184
sudo apt-get install ccache
185
                    \end{lstlisting}
166
            \textbf{i386} = that chips win over ARM chips on the performance. It uses \texttt{Complex Instruction Set Computing - CISC}.
186 167

  
187
                \item Test building package with Ubuntu 14 in VMWare. I got the same error as when running with Linux Mint 17
168
            \textbf{Debian on ARM}
188 169

  
189
            \end{itemize}
190 170

  
191
        \subsubsection{Compile OpenWRT from OpenWRT CC toolchain}
171
        \subsubsection{Compile OpenWRT CC toolchain to get OpenWrt SDK}
192 172
            Compile the \texttt{OpenWrt Chaos Calmer}. More information can be found in \href{http://wiki.openwrt.org/doc/howto/buildroot.exigence}{OpenWrt build system - Installation}.
193 173

  
194 174
            \href{http://wiki.openwrt.org/doc/howto/build}{This tutorial} shows how to build \texttt{OpenWrt SDK from source}
......
222 202
# 3rd run - NO ERROR
223 203
            \end{lstlisting}
224 204

  
225
            Got \textbf{target-arm\_cortex-a9\_uClibc-0.9.33.2\_eabi} in \texttt{build\_dir}
205
            Inside the directory \textbf{target-arm\_cortex-a9\_uClibc-0.9.33.2\_eabi} in \texttt{build\_dir}, we have \texttt{OpenWrt-SDK-bcm53xx\_gcc-4.8-linaro\_uClibc-0.9.33.2\_eabi.Linux-x86\_64}. This one is the \texttt{compiled toolchain}, or the \texttt{OpenWrt SDK, version Chaos Calmer}
206

  
207
    \subsubsection{Compile packages with OpenWrt SDK}
208
            Steps I performed
209

  
210
            \begin{itemize}
211
                \item Test building package with OpenWrt SDK BB on Linux Mint 17 (based on Ubuntu Trusty - 14)
212
                    \begin{lstlisting}
213
svn export svn://svn.openwrt.org/openwrt/packages/utils/sed package/sed
214
grep DEPENDS package/sed/Makefile
215
make package/sed/compile # GOT ERROR HERE
216

  
217
configure: error: in `/home/quynh/Thesis/openwrt-bb/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/sed-4.2.1':
218
configure: error: C compiler cannot create executables
219
See `config.log' for more details.
220
make[2]: *** [/home/quynh/Thesis/openwrt-bb/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/sed-4.2.1/.configured_] Error 77
221
make[2]: Leaving directory `/home/quynh/Thesis/openwrt-bb/package/sed'
222
make[1]: *** [package/sed/compile] Error 2
223
make[1]: Leaving directory `/home/quynh/Thesis/openwrt-bb'
224
make: *** [package/sed/compile] Error 2
225

  
226
# SOLUTION
227
sudo apt-get install ccache
228
                    \end{lstlisting}
229

  
230
                \item Test building package with Ubuntu 14 in VMWare. I got the same error as when running with Linux Mint 17
231

  
232
                \item Install the library \texttt{ccache} manually would solve the problem
233

  
234
                \item After successfully compile the package, you will find *.ipk in the folder [./bin/bcm53xx/packages/base/]. Where \texttt{bcm53xx} is the code of the target device. It can also be \texttt{ar71xx} or something else.
235
            \end{itemize}
226 236

  
227 237
        \subsubsection{Install QEMU}
228 238
            Check out \href{http://wiki.qemu.rg/Download}{Wiki} for instruction. It will took a while to install, since QEMU required several packages that are not present on my system.
229 239

  
230 240
            After installation, I have a bunch of binary file \texttt{quem-*} in \texttt{/usr/local/bin}
231 241

  
242
        \subsubsection{Generate OpenWrt Image with QEMU}
243
            This \href{http://wiki.openwrt.org/doc/howto/obtain.firmware}{Obtaining Firmware} page summarizes different ways to obtain \texttt{OpenWrt Firmware Image (OFI)} file. After having the OFI, then we can feed it into QEMU.
244

  
245
            This \href{http://wiki.openwrt.org/doc/howto/obtain.firmware.generate}{Image Generator tutorial} has instruction on how to generate Image Builder firmware.
246

  
247
            Since when compiling OpenWrt toolchain, I didn't modify anything in \texttt{menuconfig}, so the target system of the SDK are bcm53xx.
248

  
249
            The profile for bcm53xx can be found \href{https://dev.openwrt.org/browser/trunk/target/linux/bcm53xx/profiles/100-Generic.mk?rev=42143}{here}. I (randomly) pick \texttt{BCM53010}
250

  
251
            \begin{lstlisting}
252
cd openwrt
253
wget https://downloads.openwrt.org/chaos_calmer/15.05/bcm53xx/generic/OpenWrt-ImageBuilder-15.05-bcm53xx.Linux-x86_64.tar.bz2
254
tar -xvjf OpenWrt-ImageBuilder-15.05-bcm53xx.Linux-x86_64.tar
255
cd OpenWrt-ImageBuilder-15.05-bcm53xx.Linux-x86_64
256
mv OpenWrt-ImageBuilder-15.05-bcm53xx.Linux-x86_64 ImageBuilder-15.05-bcm53xx.Linux-x86_64
257

  
258
# If you want to modify 'profiles', then:
259
vim ./ImageBuilder-15.05-bcm53xx.Linux-x86_64/target/linux/bcm53xx/profiles/100-Generic.mk
260
make image PROFILE=Generic
261

  
262
# The image is in ./bin directory
263
# ERROR: Can't find any *.bin file
264
            \end{lstlisting}
265

  
266
            I then tried to generate OpenWrt Firmware Image for \texttt{ar71xx} just like the original tutorial. This time I got all the *.bin file.
267

  
268
        \subsubsection{Run OpenWrt Firmware Image with QEMU}
269
            \begin{lstlisting}
270
qemu-system-x86_64 -kernel openwrt-15.05-ar71xx-generic-vmlinux.elf
271
            \end{lstlisting}
272

  
232 273
    \subsection{Questions}
233 274
        What is \emph{buildroot-compatible package directory}?
234 275

  
......
265 306
    \subsection{Misc}
266 307
        [11:10 - 11:30] I'm doing shitty things now. Removing gcc-base, and as a result most packages are being removed: chrome, mozilla, gedit,  tortoise, skype, python, libqt4, networkmanager. Now I don't have the internet connection anymore.
267 308

  
309
    \include{note_w03}
310

  
268 311
\end{document}

Also available in: Unified diff