├── documents ├── Lite200Guide.pdf ├── Lite200GuideLatex │ ├── .gitignore │ ├── License │ ├── README.md │ ├── chapter1 │ │ └── chapter1.tex │ ├── chapter2 │ │ ├── chapter2.tex │ │ └── img │ │ │ ├── 1.pdf │ │ │ ├── arm-linux-gcc.png │ │ │ ├── bootargs.png │ │ │ ├── bootargssave.png │ │ │ ├── bootcmd.png │ │ │ ├── bootcmdsave.png │ │ │ ├── bootcmdvlaue.png │ │ │ ├── bootpartedpng.png │ │ │ ├── bootpri.png │ │ │ ├── buildarch.png │ │ │ ├── buildoptions.png │ │ │ ├── buildroothttppng.png │ │ │ ├── buildrootmakemenuconfig.png │ │ │ ├── buildtoolschains.png │ │ │ ├── builrsystem.png │ │ │ ├── chapter2-2-1.png │ │ │ ├── chapter2-2-3.png │ │ │ ├── chapter2-2-4.png │ │ │ ├── chapter2-2-5.png │ │ │ ├── chapter2-2-6.png │ │ │ ├── configs.png │ │ │ ├── dd.png │ │ │ ├── gparted.png │ │ │ ├── gpartedpng.png │ │ │ ├── linuxkernel.png │ │ │ ├── linuxmakefile.png │ │ │ ├── linuxmakepng.png │ │ │ ├── linuxmenuconfig.png │ │ │ ├── linuxsatrtfinish.png │ │ │ ├── partedfinish.png │ │ │ ├── partedsave.png │ │ │ ├── rootfspartedpng.png │ │ │ ├── rootfssatrt.png │ │ │ ├── ubootmake.png │ │ │ ├── ubootstart.png │ │ │ ├── ubootsunxispl.png │ │ │ └── zImagepng.png │ ├── chapter3 │ │ ├── chapter3.tex │ │ └── img │ │ │ ├── DTS.png │ │ │ └── DTSstream.png │ ├── chapter4 │ │ └── chapter4.tex │ ├── chapter5 │ │ └── chapter5.tex │ ├── chapter6 │ │ └── chapter6.tex │ ├── elegantbook-cn.tex │ ├── elegantbook-en.tex │ ├── elegantbook.cls │ ├── end │ │ └── end.tex │ ├── figure │ │ ├── cover.jpg │ │ ├── logo-blue.png │ │ └── logo.png │ ├── image │ │ ├── cert.pdf │ │ ├── donate.jpg │ │ ├── founder.png │ │ ├── scatter.pdf │ │ ├── scatter.py │ │ └── tlshell.png │ └── reference.bib └── README.MD ├── hardware ├── gerber │ ├── Gerber_Lite200.zip │ ├── Gerber_MelonPI_MINI.zip │ └── readme.txt ├── lceda_projcet │ ├── Project_Lite200.zip │ └── Project_PeanutPI-Mini.zip └── readme.txt └── software ├── linux ├── linux-licheepi_nano_defconfig ├── suniv-f1c100s-licheepi-nano.dtb ├── suniv-f1c100s-licheepi-nano.dts ├── suniv-f1c100s.dtsi └── zImage ├── rootfs └── rootfs.tar ├── uboot └── u-boot-sunxi-with-spl.bin └── 打包镜像.txt /documents/Lite200Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200Guide.pdf -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | .*.lb 14 | clean.bat 15 | elegant*-cn.pdf 16 | elegant*-en.pdf 17 | *.dates 18 | 19 | ## Intermediate documents: 20 | *.dvi 21 | *.xdv 22 | *-converted-to.* 23 | # these rules might exclude image files for figures etc. 24 | # *.ps 25 | # *.eps 26 | # *.pdf 27 | 28 | ## Generated if empty string is given at "Please type another file name for output:" 29 | .pdf 30 | 31 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 32 | *.bbl 33 | *.bcf 34 | *.blg 35 | *-blx.aux 36 | *-blx.bib 37 | *.run.xml 38 | 39 | ## Build tool auxiliary files: 40 | *.fdb_latexmk 41 | *.synctex 42 | *.synctex(busy) 43 | *.synctex.gz 44 | *.synctex.gz(busy) 45 | *.pdfsync 46 | 47 | ## Auxiliary and intermediate files from other packages: 48 | # algorithms 49 | *.alg 50 | *.loa 51 | 52 | # achemso 53 | acs-*.bib 54 | 55 | # amsthm 56 | *.thm 57 | 58 | # beamer 59 | *.nav 60 | *.pre 61 | *.snm 62 | *.vrb 63 | 64 | # changes 65 | *.soc 66 | 67 | # cprotect 68 | *.cpt 69 | 70 | # elsarticle (documentclass of Elsevier journals) 71 | *.spl 72 | 73 | # endnotes 74 | *.ent 75 | 76 | # fixme 77 | *.lox 78 | 79 | # feynmf/feynmp 80 | *.mf 81 | *.mp 82 | *.t[1-9] 83 | *.t[1-9][0-9] 84 | *.tfm 85 | 86 | #(r)(e)ledmac/(r)(e)ledpar 87 | *.end 88 | *.?end 89 | *.[1-9] 90 | *.[1-9][0-9] 91 | *.[1-9][0-9][0-9] 92 | *.[1-9]R 93 | *.[1-9][0-9]R 94 | *.[1-9][0-9][0-9]R 95 | *.eledsec[1-9] 96 | *.eledsec[1-9]R 97 | *.eledsec[1-9][0-9] 98 | *.eledsec[1-9][0-9]R 99 | *.eledsec[1-9][0-9][0-9] 100 | *.eledsec[1-9][0-9][0-9]R 101 | 102 | # glossaries 103 | *.acn 104 | *.acr 105 | *.glg 106 | *.glo 107 | *.gls 108 | *.glsdefs 109 | 110 | # gnuplottex 111 | *-gnuplottex-* 112 | 113 | # gregoriotex 114 | *.gaux 115 | *.gtex 116 | 117 | # htlatex 118 | *.4ct 119 | *.4tc 120 | *.idv 121 | *.lg 122 | *.trc 123 | *.xref 124 | 125 | # hyperref 126 | *.brf 127 | 128 | # knitr 129 | *-concordance.tex 130 | # TODO Comment the next line if you want to keep your tikz graphics files 131 | *.tikz 132 | *-tikzDictionary 133 | 134 | # listings 135 | *.lol 136 | 137 | # makeidx 138 | *.idx 139 | *.ilg 140 | *.ind 141 | *.ist 142 | 143 | # minitoc 144 | *.maf 145 | *.mlf 146 | *.mlt 147 | *.mtc[0-9]* 148 | *.slf[0-9]* 149 | *.slt[0-9]* 150 | *.stc[0-9]* 151 | 152 | # minted 153 | _minted* 154 | *.pyg 155 | 156 | # morewrites 157 | *.mw 158 | 159 | # nomencl 160 | *.nlg 161 | *.nlo 162 | *.nls 163 | 164 | # pax 165 | *.pax 166 | 167 | # pdfpcnotes 168 | *.pdfpc 169 | 170 | # sagetex 171 | *.sagetex.sage 172 | *.sagetex.py 173 | *.sagetex.scmd 174 | 175 | # scrwfile 176 | *.wrt 177 | 178 | # sympy 179 | *.sout 180 | *.sympy 181 | sympy-plots-for-*.tex/ 182 | 183 | # pdfcomment 184 | *.upa 185 | *.upb 186 | 187 | # pythontex 188 | *.pytxcode 189 | pythontex-files-*/ 190 | 191 | # thmtools 192 | *.loe 193 | 194 | # TikZ & PGF 195 | *.dpth 196 | *.md5 197 | *.auxlock 198 | 199 | # todonotes 200 | *.tdo 201 | 202 | # easy-todo 203 | *.lod 204 | 205 | # xmpincl 206 | *.xmpi 207 | 208 | # xindy 209 | *.xdy 210 | 211 | # xypic precompiled matrices 212 | *.xyc 213 | 214 | # endfloat 215 | *.ttt 216 | *.fff 217 | 218 | # Latexian 219 | TSWLatexianTemp* 220 | 221 | ## Editors: 222 | # WinEdt 223 | *.bak 224 | *.sav 225 | 226 | # Texpad 227 | .texpadtmp 228 | 229 | # Kile 230 | *.backup 231 | 232 | # KBibTeX 233 | *~[0-9]* 234 | 235 | # auto folder when using emacs and auctex 236 | ./auto/* 237 | *.el 238 | 239 | # expex forward references with \gathertags 240 | *-tags.tex 241 | 242 | # standalone packages 243 | *.sta 244 | 245 | # generated if using elsarticle.cls 246 | *.spl 247 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/License: -------------------------------------------------------------------------------- 1 | The LaTeX Project Public License 2 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 3 | 4 | LPPL Version 1.3c 2008-05-04 5 | 6 | Copyright 1999 2002-2008 LaTeX3 Project 7 | Everyone is allowed to distribute verbatim copies of this 8 | license document, but modification of it is not allowed. 9 | 10 | 11 | PREAMBLE 12 | ======== 13 | 14 | The LaTeX Project Public License (LPPL) is the primary license under 15 | which the LaTeX kernel and the base LaTeX packages are distributed. 16 | 17 | You may use this license for any work of which you hold the copyright 18 | and which you wish to distribute. This license may be particularly 19 | suitable if your work is TeX-related (such as a LaTeX package), but 20 | it is written in such a way that you can use it even if your work is 21 | unrelated to TeX. 22 | 23 | The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', 24 | below, gives instructions, examples, and recommendations for authors 25 | who are considering distributing their works under this license. 26 | 27 | This license gives conditions under which a work may be distributed 28 | and modified, as well as conditions under which modified versions of 29 | that work may be distributed. 30 | 31 | We, the LaTeX3 Project, believe that the conditions below give you 32 | the freedom to make and distribute modified versions of your work 33 | that conform with whatever technical specifications you wish while 34 | maintaining the availability, integrity, and reliability of 35 | that work. If you do not see how to achieve your goal while 36 | meeting these conditions, then read the document `cfgguide.tex' 37 | and `modguide.tex' in the base LaTeX distribution for suggestions. 38 | 39 | 40 | DEFINITIONS 41 | =========== 42 | 43 | In this license document the following terms are used: 44 | 45 | `Work' 46 | Any work being distributed under this License. 47 | 48 | `Derived Work' 49 | Any work that under any applicable law is derived from the Work. 50 | 51 | `Modification' 52 | Any procedure that produces a Derived Work under any applicable 53 | law -- for example, the production of a file containing an 54 | original file associated with the Work or a significant portion of 55 | such a file, either verbatim or with modifications and/or 56 | translated into another language. 57 | 58 | `Modify' 59 | To apply any procedure that produces a Derived Work under any 60 | applicable law. 61 | 62 | `Distribution' 63 | Making copies of the Work available from one person to another, in 64 | whole or in part. Distribution includes (but is not limited to) 65 | making any electronic components of the Work accessible by 66 | file transfer protocols such as FTP or HTTP or by shared file 67 | systems such as Sun's Network File System (NFS). 68 | 69 | `Compiled Work' 70 | A version of the Work that has been processed into a form where it 71 | is directly usable on a computer system. This processing may 72 | include using installation facilities provided by the Work, 73 | transformations of the Work, copying of components of the Work, or 74 | other activities. Note that modification of any installation 75 | facilities provided by the Work constitutes modification of the Work. 76 | 77 | `Current Maintainer' 78 | A person or persons nominated as such within the Work. If there is 79 | no such explicit nomination then it is the `Copyright Holder' under 80 | any applicable law. 81 | 82 | `Base Interpreter' 83 | A program or process that is normally needed for running or 84 | interpreting a part or the whole of the Work. 85 | 86 | A Base Interpreter may depend on external components but these 87 | are not considered part of the Base Interpreter provided that each 88 | external component clearly identifies itself whenever it is used 89 | interactively. Unless explicitly specified when applying the 90 | license to the Work, the only applicable Base Interpreter is a 91 | `LaTeX-Format' or in the case of files belonging to the 92 | `LaTeX-format' a program implementing the `TeX language'. 93 | 94 | 95 | 96 | CONDITIONS ON DISTRIBUTION AND MODIFICATION 97 | =========================================== 98 | 99 | 1. Activities other than distribution and/or modification of the Work 100 | are not covered by this license; they are outside its scope. In 101 | particular, the act of running the Work is not restricted and no 102 | requirements are made concerning any offers of support for the Work. 103 | 104 | 2. You may distribute a complete, unmodified copy of the Work as you 105 | received it. Distribution of only part of the Work is considered 106 | modification of the Work, and no right to distribute such a Derived 107 | Work may be assumed under the terms of this clause. 108 | 109 | 3. You may distribute a Compiled Work that has been generated from a 110 | complete, unmodified copy of the Work as distributed under Clause 2 111 | above, as long as that Compiled Work is distributed in such a way that 112 | the recipients may install the Compiled Work on their system exactly 113 | as it would have been installed if they generated a Compiled Work 114 | directly from the Work. 115 | 116 | 4. If you are the Current Maintainer of the Work, you may, without 117 | restriction, modify the Work, thus creating a Derived Work. You may 118 | also distribute the Derived Work without restriction, including 119 | Compiled Works generated from the Derived Work. Derived Works 120 | distributed in this manner by the Current Maintainer are considered to 121 | be updated versions of the Work. 122 | 123 | 5. If you are not the Current Maintainer of the Work, you may modify 124 | your copy of the Work, thus creating a Derived Work based on the Work, 125 | and compile this Derived Work, thus creating a Compiled Work based on 126 | the Derived Work. 127 | 128 | 6. If you are not the Current Maintainer of the Work, you may 129 | distribute a Derived Work provided the following conditions are met 130 | for every component of the Work unless that component clearly states 131 | in the copyright notice that it is exempt from that condition. Only 132 | the Current Maintainer is allowed to add such statements of exemption 133 | to a component of the Work. 134 | 135 | a. If a component of this Derived Work can be a direct replacement 136 | for a component of the Work when that component is used with the 137 | Base Interpreter, then, wherever this component of the Work 138 | identifies itself to the user when used interactively with that 139 | Base Interpreter, the replacement component of this Derived Work 140 | clearly and unambiguously identifies itself as a modified version 141 | of this component to the user when used interactively with that 142 | Base Interpreter. 143 | 144 | b. Every component of the Derived Work contains prominent notices 145 | detailing the nature of the changes to that component, or a 146 | prominent reference to another file that is distributed as part 147 | of the Derived Work and that contains a complete and accurate log 148 | of the changes. 149 | 150 | c. No information in the Derived Work implies that any persons, 151 | including (but not limited to) the authors of the original version 152 | of the Work, provide any support, including (but not limited to) 153 | the reporting and handling of errors, to recipients of the 154 | Derived Work unless those persons have stated explicitly that 155 | they do provide such support for the Derived Work. 156 | 157 | d. You distribute at least one of the following with the Derived Work: 158 | 159 | 1. A complete, unmodified copy of the Work; 160 | if your distribution of a modified component is made by 161 | offering access to copy the modified component from a 162 | designated place, then offering equivalent access to copy 163 | the Work from the same or some similar place meets this 164 | condition, even though third parties are not compelled to 165 | copy the Work along with the modified component; 166 | 167 | 2. Information that is sufficient to obtain a complete, 168 | unmodified copy of the Work. 169 | 170 | 7. If you are not the Current Maintainer of the Work, you may 171 | distribute a Compiled Work generated from a Derived Work, as long as 172 | the Derived Work is distributed to all recipients of the Compiled 173 | Work, and as long as the conditions of Clause 6, above, are met with 174 | regard to the Derived Work. 175 | 176 | 8. The conditions above are not intended to prohibit, and hence do not 177 | apply to, the modification, by any method, of any component so that it 178 | becomes identical to an updated version of that component of the Work as 179 | it is distributed by the Current Maintainer under Clause 4, above. 180 | 181 | 9. Distribution of the Work or any Derived Work in an alternative 182 | format, where the Work or that Derived Work (in whole or in part) is 183 | then produced by applying some process to that format, does not relax or 184 | nullify any sections of this license as they pertain to the results of 185 | applying that process. 186 | 187 | 10. a. A Derived Work may be distributed under a different license 188 | provided that license itself honors the conditions listed in 189 | Clause 6 above, in regard to the Work, though it does not have 190 | to honor the rest of the conditions in this license. 191 | 192 | b. If a Derived Work is distributed under a different license, that 193 | Derived Work must provide sufficient documentation as part of 194 | itself to allow each recipient of that Derived Work to honor the 195 | restrictions in Clause 6 above, concerning changes from the Work. 196 | 197 | 11. This license places no restrictions on works that are unrelated to 198 | the Work, nor does this license place any restrictions on aggregating 199 | such works with the Work by any means. 200 | 201 | 12. Nothing in this license is intended to, or may be used to, prevent 202 | complete compliance by all parties with all applicable laws. 203 | 204 | 205 | NO WARRANTY 206 | =========== 207 | 208 | There is no warranty for the Work. Except when otherwise stated in 209 | writing, the Copyright Holder provides the Work `as is', without 210 | warranty of any kind, either expressed or implied, including, but not 211 | limited to, the implied warranties of merchantability and fitness for a 212 | particular purpose. The entire risk as to the quality and performance 213 | of the Work is with you. Should the Work prove defective, you assume 214 | the cost of all necessary servicing, repair, or correction. 215 | 216 | In no event unless required by applicable law or agreed to in writing 217 | will The Copyright Holder, or any author named in the components of the 218 | Work, or any other party who may distribute and/or modify the Work as 219 | permitted above, be liable to you for damages, including any general, 220 | special, incidental or consequential damages arising out of any use of 221 | the Work or out of inability to use the Work (including, but not limited 222 | to, loss of data, data being rendered inaccurate, or losses sustained by 223 | anyone as a result of any failure of the Work to operate with any other 224 | programs), even if the Copyright Holder or said author or said other 225 | party has been advised of the possibility of such damages. 226 | 227 | 228 | MAINTENANCE OF THE WORK 229 | ======================= 230 | 231 | The Work has the status `author-maintained' if the Copyright Holder 232 | explicitly and prominently states near the primary copyright notice in 233 | the Work that the Work can only be maintained by the Copyright Holder 234 | or simply that it is `author-maintained'. 235 | 236 | The Work has the status `maintained' if there is a Current Maintainer 237 | who has indicated in the Work that they are willing to receive error 238 | reports for the Work (for example, by supplying a valid e-mail 239 | address). It is not required for the Current Maintainer to acknowledge 240 | or act upon these error reports. 241 | 242 | The Work changes from status `maintained' to `unmaintained' if there 243 | is no Current Maintainer, or the person stated to be Current 244 | Maintainer of the work cannot be reached through the indicated means 245 | of communication for a period of six months, and there are no other 246 | significant signs of active maintenance. 247 | 248 | You can become the Current Maintainer of the Work by agreement with 249 | any existing Current Maintainer to take over this role. 250 | 251 | If the Work is unmaintained, you can become the Current Maintainer of 252 | the Work through the following steps: 253 | 254 | 1. Make a reasonable attempt to trace the Current Maintainer (and 255 | the Copyright Holder, if the two differ) through the means of 256 | an Internet or similar search. 257 | 258 | 2. If this search is successful, then enquire whether the Work 259 | is still maintained. 260 | 261 | a. If it is being maintained, then ask the Current Maintainer 262 | to update their communication data within one month. 263 | 264 | b. If the search is unsuccessful or no action to resume active 265 | maintenance is taken by the Current Maintainer, then announce 266 | within the pertinent community your intention to take over 267 | maintenance. (If the Work is a LaTeX work, this could be 268 | done, for example, by posting to comp.text.tex.) 269 | 270 | 3a. If the Current Maintainer is reachable and agrees to pass 271 | maintenance of the Work to you, then this takes effect 272 | immediately upon announcement. 273 | 274 | b. If the Current Maintainer is not reachable and the Copyright 275 | Holder agrees that maintenance of the Work be passed to you, 276 | then this takes effect immediately upon announcement. 277 | 278 | 4. If you make an `intention announcement' as described in 2b. above 279 | and after three months your intention is challenged neither by 280 | the Current Maintainer nor by the Copyright Holder nor by other 281 | people, then you may arrange for the Work to be changed so as 282 | to name you as the (new) Current Maintainer. 283 | 284 | 5. If the previously unreachable Current Maintainer becomes 285 | reachable once more within three months of a change completed 286 | under the terms of 3b) or 4), then that Current Maintainer must 287 | become or remain the Current Maintainer upon request provided 288 | they then update their communication data within one month. 289 | 290 | A change in the Current Maintainer does not, of itself, alter the fact 291 | that the Work is distributed under the LPPL license. 292 | 293 | If you become the Current Maintainer of the Work, you should 294 | immediately provide, within the Work, a prominent and unambiguous 295 | statement of your status as Current Maintainer. You should also 296 | announce your new status to the same pertinent community as 297 | in 2b) above. 298 | 299 | 300 | WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE 301 | ====================================================== 302 | 303 | This section contains important instructions, examples, and 304 | recommendations for authors who are considering distributing their 305 | works under this license. These authors are addressed as `you' in 306 | this section. 307 | 308 | Choosing This License or Another License 309 | ---------------------------------------- 310 | 311 | If for any part of your work you want or need to use *distribution* 312 | conditions that differ significantly from those in this license, then 313 | do not refer to this license anywhere in your work but, instead, 314 | distribute your work under a different license. You may use the text 315 | of this license as a model for your own license, but your license 316 | should not refer to the LPPL or otherwise give the impression that 317 | your work is distributed under the LPPL. 318 | 319 | The document `modguide.tex' in the base LaTeX distribution explains 320 | the motivation behind the conditions of this license. It explains, 321 | for example, why distributing LaTeX under the GNU General Public 322 | License (GPL) was considered inappropriate. Even if your work is 323 | unrelated to LaTeX, the discussion in `modguide.tex' may still be 324 | relevant, and authors intending to distribute their works under any 325 | license are encouraged to read it. 326 | 327 | A Recommendation on Modification Without Distribution 328 | ----------------------------------------------------- 329 | 330 | It is wise never to modify a component of the Work, even for your own 331 | personal use, without also meeting the above conditions for 332 | distributing the modified component. While you might intend that such 333 | modifications will never be distributed, often this will happen by 334 | accident -- you may forget that you have modified that component; or 335 | it may not occur to you when allowing others to access the modified 336 | version that you are thus distributing it and violating the conditions 337 | of this license in ways that could have legal implications and, worse, 338 | cause problems for the community. It is therefore usually in your 339 | best interest to keep your copy of the Work identical with the public 340 | one. Many works provide ways to control the behavior of that work 341 | without altering any of its licensed components. 342 | 343 | How to Use This License 344 | ----------------------- 345 | 346 | To use this license, place in each of the components of your work both 347 | an explicit copyright notice including your name and the year the work 348 | was authored and/or last substantially modified. Include also a 349 | statement that the distribution and/or modification of that 350 | component is constrained by the conditions in this license. 351 | 352 | Here is an example of such a notice and statement: 353 | 354 | %% pig.dtx 355 | %% Copyright 2005 M. Y. Name 356 | % 357 | % This work may be distributed and/or modified under the 358 | % conditions of the LaTeX Project Public License, either version 1.3 359 | % of this license or (at your option) any later version. 360 | % The latest version of this license is in 361 | % http://www.latex-project.org/lppl.txt 362 | % and version 1.3 or later is part of all distributions of LaTeX 363 | % version 2005/12/01 or later. 364 | % 365 | % This work has the LPPL maintenance status `maintained'. 366 | % 367 | % The Current Maintainer of this work is M. Y. Name. 368 | % 369 | % This work consists of the files pig.dtx and pig.ins 370 | % and the derived file pig.sty. 371 | 372 | Given such a notice and statement in a file, the conditions 373 | given in this license document would apply, with the `Work' referring 374 | to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being 375 | generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' 376 | referring to any `LaTeX-Format', and both `Copyright Holder' and 377 | `Current Maintainer' referring to the person `M. Y. Name'. 378 | 379 | If you do not want the Maintenance section of LPPL to apply to your 380 | Work, change `maintained' above into `author-maintained'. 381 | However, we recommend that you use `maintained', as the Maintenance 382 | section was added in order to ensure that your Work remains useful to 383 | the community even when you can no longer maintain and support it 384 | yourself. 385 | 386 | Derived Works That Are Not Replacements 387 | --------------------------------------- 388 | 389 | Several clauses of the LPPL specify means to provide reliability and 390 | stability for the user community. They therefore concern themselves 391 | with the case that a Derived Work is intended to be used as a 392 | (compatible or incompatible) replacement of the original Work. If 393 | this is not the case (e.g., if a few lines of code are reused for a 394 | completely different task), then clauses 6b and 6d shall not apply. 395 | 396 | 397 | Important Recommendations 398 | ------------------------- 399 | 400 | Defining What Constitutes the Work 401 | 402 | The LPPL requires that distributions of the Work contain all the 403 | files of the Work. It is therefore important that you provide a 404 | way for the licensee to determine which files constitute the Work. 405 | This could, for example, be achieved by explicitly listing all the 406 | files of the Work near the copyright notice of each file or by 407 | using a line such as: 408 | 409 | % This work consists of all files listed in manifest.txt. 410 | 411 | in that place. In the absence of an unequivocal list it might be 412 | impossible for the licensee to determine what is considered by you 413 | to comprise the Work and, in such a case, the licensee would be 414 | entitled to make reasonable conjectures as to which files comprise 415 | the Work. 416 | 417 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [Homepage](https://elegantlatex.org/) | [Github](https://github.com/ElegantLaTeX/ElegantBook) | [CTAN](https://ctan.org/pkg/elegantbook) | [Download](https://github.com/ElegantLaTeX/ElegantBook/releases) | [Wiki](https://github.com/ElegantLaTeX/ElegantBook/wiki) | [Weibo](https://weibo.com/elegantlatex) 5 | 6 | ![License](https://img.shields.io/ctan/l/elegantbook.svg) ![CTAN Version](https://img.shields.io/ctan/v/elegantbook.svg) ![Github Version](https://img.shields.io/github/release/ElegantLaTeX/ElegantBook.svg) ![Repo Size](https://img.shields.io/github/repo-size/ElegantLaTeX/ElegantBook.svg) 7 | 8 | --- 9 | 10 | # ElegantBook 优美的 LaTeX 书籍模板 11 | 12 | ElegantBook 是为 LaTeX 书籍写作而设计的模板,由 [Dongsheng Deng](https://ddswhu.me/) 和 [Liam Huang](https://liam.page/) 创立,模板创立的初衷是方便我们自己做笔记 :smile:。如果你有其他问题、建议或者报告 bug,可以提交 issues 或者给我们发邮件:elegantlatex2e@gmail.com。QQ 用户交流群:692108391,欢迎加入。 13 | 14 | ## 重要提示 15 | 16 | **版本提醒:** 由于新版本进行了重构,并且 3.06 版本对于封面进行了改版,3.06 以后的版本并不兼容之前版本,如果你想把之前版本的文件转为 3.06 以后的版本,请查看[跨版本转换](https://github.com/ElegantLaTeX/ElegantBook/wiki/convert)。我们强烈建议你使用最新版。 17 | 18 | **重要提示**:ElegantLaTeX 项目 **不接受** 任何非作者预约提交(pull requests)! 19 | 20 | ## 致谢 21 | 22 | 2019 年 5 月 20 日,ElegantBook 模板在 Github 上的 Star 数达到了 100,这对于 ElegantLaTeX 系列模板是一个非常重要的里程碑!在此特别感谢 ChinaTeX 以及 [LaTeX 工作室](http://www.latexstudio.net/)对于本系列模板的大力宣传与推广。LaTeX 工作室网站上有很多精彩的帖子和精致的模板,欢迎大家去挖掘里面的宝藏。这也是我所见到的国内最全面的 LaTeX 相关的网站。 23 | 24 | 如果你喜欢我们的模板,你可以在 Github 上收藏我们的模板。 25 | 26 | ## 捐赠 27 | 28 | 如果您非常喜爱我们的模板或者我,你还可以选择捐赠以表达您对我们模板和我的支持。本模板自 3.08 版本发布了捐赠信息之后,收到了超过千元的捐赠(四舍五入就是一个亿),非常感谢! 29 | 30 | ![](https://github.com/ElegantLaTeX/ElegantBook/wiki/donate.jpg) 31 | 32 | **赞赏费用的使用解释权归 ElegantLaTeX 所有,并且不接受监督,请自愿理性打赏**。10 元以上的赞赏,我们将列入捐赠榜,谢谢各位金主!(如果有遗漏,请务必联系我们,这对我们很重要) 33 | 34 | 35 | | 捐赠者 | 金额 | 时间 | 渠道 | 36 | | :------: | :----: | :----: | :------: | 37 | | Lerh | 10 RMB | 2019/05/15 | 微信 | 38 | | 越过地平线 | 10 RMB | 2019/05/15 | 微信 | 39 | | 银桑 | 20 RMB | 2019/05/27 | 微信 | 40 | | *空 | 10 RMB | 2019/05/30 | 微信 | 41 | | [latexstudio.net](http://www.latexstudio.net) | 666 RMB | 2019/06/05 | 支付宝 | 42 | | Cassis | 11 RMB | 2019/06/30 | 微信 | 43 | | *君 | 10 RMB | 2019/07/23 | 微信 | 44 | | P*u | 50 RMB | 2019/07/30 | 微信 | 45 | | *萌 | 19 RMB | 2019/08/28 | 微信 | 46 | | 曲豆豆 | 10 RMB | 2019/08/28 | 微信 | 47 | | 李博 | 100 RMB | 2019/10/06 | 微信 | 48 | | Njustsll | 10 RMB | 2019/10/11 | 微信 | 49 | | 刘志阔 | 99.99 RMB | 2019/10/15 | 支付宝 | 50 | | *涛 | 16 RMB | 2019/10/17 | 微信 | 51 | | 赤霓 | 12 RMB | 2019/10/17 | 支付宝 | 52 | | 追寻原风景 | 10 RMB | 2019/10/28 | 微信 | 53 | | 郭德良 | 88 RMB | 2019/11/03 | 微信 | 54 | | 自强不息 | 20 RMB | 2019/11/04 | 支付宝 | 55 | | 读书之虫 | 20 RMB | 2019/11/18 | 微信 | 56 | | *等 | 10 RMB | 2019/11/18 | 微信 | 57 | | *哲 | 20 RMB | 2019/11/18 | 微信 | 58 | | 佚名 | 10 RMB | 2019/11/24 | 微信 | 59 | | Jiye Qian | 66 RMB | 2019/12/04 | 微信 | 60 | | * 阳 | 20 RMB | 2019/12/05 | 微信 | 61 | | Catcher | 11 RMB | 2019/12/08 | 支付宝 | 62 | | 希尔波特门徒 | 10 RMB | 2019/12/09 | 支付宝 | 63 | | * 伟 | 10 RMB | 2019/12/09 | 微信 | 64 | | Simon | 20 RMB | 2019/12/11 | 支付宝 | 65 | | 流殇丶浅忆 | 66.60 RMB | 2019/12/18 | 支付宝 | 66 | | 羽 | 10 RMB | 2019/12/20 | 支付宝 | 67 | | * 琛 | 15 RMB | 2019/12/20 | 微信 | 68 | | 随风 | 20 RMB | 2019/12/27 | 支付宝 | 69 | | Ws | 23.30 RMB | 2019/12/28 | 微信 | 70 | 71 | 72 | 再次感谢大家对于模板的喜爱! 73 | 74 | ## 协议 75 | 76 | 本模板发布遵循 LaTeX 项目公共许可证 1.3 c 或更高版本。如果是衍生作品,请务必加入协议声明和模板信息(github、CTAN 地址)。 77 | 78 | ## 衍生作 79 | 80 | + [ElegantBookdown](https://github.com/XiangyunHuang/ElegantBookdown):[XiangyunHuang](https://github.com/XiangyunHuang) 开发并维护的基于 ElegantBook 的 Bookdown 模板。 81 | + [bookdownplus](https://github.com/pzhaonet/bookdownplus):应网友要求,[pzhaonet](https://github.com/pzhaonet) 在 bookdownplus 收录了 ElegantPaper 模板,并为 Mac 做了字体适配。 82 | + [PanBook](https://github.com/annProg/PanBook):[annProg](https://github.com/annProg) 开发并维护的基于 Markdown 写作的工作流,收录了 ElegantBook 和 ElegantPaper 模板。 83 | 84 | ------- 85 | 86 | # ElegantBook: An Elegant LaTeX Template for Books 87 | 88 | ElegantBook is designed for writing books, created by [Dongsheng Deng](https://ddswhu.me/) and [Liam Huang](https://liam.page/). Just enjoy it! If you have any questions, suggestions or bug reports, you can create issues or contact us at elegantlatex2e@gmail.com. 89 | 90 | ## Important Notes 91 | 92 | **Version Note**: Users for 2.x, please refer to [Version Convert](https://github.com/ElegantLaTeX/ElegantBook/wiki/convert). We strongly recommend that you use the latest version. 93 | 94 | **Important Info**: For some reasons, __unauthorial__ pull requests are **UNACCEPTABLE** since May 20, 2019. For those who want to help revise the templates, submit issues or clone to your own repository to modify under the LPPL-1.3c. 95 | 96 | ## Acknowledgement 97 | 98 | _News_: _The number of stars on Github for ElegantBook reached 100 on May 20, 2019_. 99 | 100 | Thank ChinaTeX and [LaTeX Studio](http://www.latexstudio.net/) for their promotion. LaTeX studio offers tons of valuable posts and templates for discovery. It is the most comprehensive website on LaTeX in China. If you like our template, star on Github for supporting us. 101 | 102 | ## Donation 103 | 104 | To express your love for our templates and/or our developers, please do not hesitate to tip us. Since last release of 3.08, we have received about a thousand RMB! (The emergence of a millionaire is on the way. Loading... ) 105 | 106 | ![](https://github.com/ElegantLaTeX/ElegantBook/wiki/donate.jpg) 107 | 108 | The explanation right of the tip usage belongs to ElegantLaTeX with no supervision. Feel free to tip us. Those who donate more than 10 RMB will be recorded in the Donation List. Thank all the tippers! Thank you all. 109 | 110 | 111 | | Tipper | Amount | Date | Channel | 112 | | :--------------: | :----: | :-------: | :-----: | 113 | | Lerh | 10 RMB | 2019/5/15 | Wechat | 114 | | YueGuoDiPingXian | 10 RMB | 2019/5/15 | Wechat | 115 | | YinSang | 20 RMB | 2019/5/27 | Wechat | 116 | | * Kong | 10 RMB | 2019/05/30 | Wechat | 117 | | [latexstudio.net](http://www.latexstudio.net) | 666 RMB | 2019/06/05 | Alipay | 118 | | Cassis | 11 RMB | 2019/06/30 | Wechat | 119 | | * Jun | 10 RMB | 2019/07/23 | Wechat | 120 | | P*u | 50 RMB | 2019/07/30 | Wechat | 121 | | * Meng | 19 RMB | 2019/08/28 | Wechat | 122 | | QuDouDou | 10 RMB | 2019/08/28 | Wechat | 123 | | LI Bo | 100 RMB | 2019/10/06 | Wechat | 124 | | Njustsll | 10 RMB | 2019/10/11 | Wechat | 125 | | LIU ZhiKuo | 99.99 RMB | 2019/10/15 | Alipay | 126 | | * Tao | 16 RMB | 2019/10/17 | Wechat | 127 | | ChiHong | 12 RMB | 2019/10/17 | Alipay | 128 | | YuanFengJing | 10 RMB | 2019/10/28 | Wechat | 129 | | GUO DeLiang | 88 RMB | 2019/11/03 | Wechat | 130 | | ZiQiangBuXi | 20 RMB | 2019/11/03 | Alipay | 131 | | DuShuZhiChong | 20 RMB | 2019/11/18 | Wechat | 132 | | * Deng | 10 RMB | 2019/11/18 | Wechat | 133 | | * Zhe | 20 RMB | 2019/11/18 | Wechat | 134 | 135 | 136 | ## License 137 | 138 | This work is released under the LaTeX Project Public License, v1.3c or later. 139 | 140 | 141 | ## Derivative Works 142 | 143 | + [ElegantBookdown](https://github.com/XiangyunHuang/ElegantBookdown):[XiangyunHuang](https://github.com/XiangyunHuang) developed a Bookdown template based on ElegantBook. 144 | + [bookdownplus](https://github.com/pzhaonet/bookdownplus): maintained by [pzhaonet](https://github.com/pzhaonet). 145 | + [PanBook](https://github.com/annProg/PanBook):a markdown-based writing workflow Developed by [annProg](https://github.com/annProg). 146 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter1/chapter1.tex: -------------------------------------------------------------------------------- 1 | \chapter{Linux基础知识} 2 | \section{Linux思想:一切皆文件} 3 | 4 | 5 | \section{虚拟机使用} 6 | 7 | 8 | \section{常用命令} 9 | 10 | 11 | 12 | \section{FTP服务} 13 | 14 | 15 | 16 | 17 | \section{shell} 18 | 19 | 20 | 21 | 22 | 23 | \section{Makefile} 24 | 25 | 26 | 27 | 28 | \section{vim使用} 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/chapter2.tex: -------------------------------------------------------------------------------- 1 | \chapter{系统移植} 2 | \begin{introduction} 3 | \item 环境搭建 4 | \item u-boot移植 5 | \item linux移植 6 | \item rootfs移植 7 | \item 深入探究 8 | \end{introduction} 9 | 本章分三个部分来介绍Linux操作系统的移植,分别是bootloader,kernel,rootfs。其中bootloader使用最多的是u-boot, 10 | 本书将使用u-boot来移植。kernel是Linux内核部分,rootfs是根文件系统。如图\ref{fig:struction}是这三者的结 11 | 构图, 12 | \begin{figure}[htbp] 13 | \centering 14 | \includegraphics[width=0.8\linewidth]{chapter2/img/1} 15 | \caption{} 16 | \label{fig:struction} 17 | \end{figure} 18 | bootloader是SoC芯片最开始执行的代码,这个部分的主要工作是进行硬件初始化,例如时钟初始化,SRAM 19 | 初始化等,同时也为后面运行C语言建立环境(初始化堆栈)。kernel在存放在bootloader之后,对于SoC来说,代码都需 20 | 要在RAM中运行,这里与MCU不一样的地方就是引入了MMU(内存管理单元)。对于MCU而言,由于其执行速度低,因此运行 21 | 代码都在ROM中直接运行,而对于Flash而言,其读取速度远不及RAM的速度,因此对于运行速度非常快的SoC而言,所有 22 | 的代码都需要在RAM中运行。但是这里有一个问题,RAM掉电数据将会丢失,故代码保存不可能放在RAM中,当前所有的嵌 23 | 入式设备而言,代码保存都是放在ROM中,因此在SoC中运行代码需要将代码搬运到RAM中然后再执行。对于bootloader来 24 | 说。其代码较少,很多开发者认为再将bootloader搬到RAM中实际意义不大,除非bootloader的体积很大。实际上在u-boot 25 | 中,全志公司提供的代码是直接在ROM中运行的,当u-boot运行完大部分后会将kernel搬运到指定的RAM位置,之后将启 26 | 动内核,这个启动过程后面会详细说明。对于根文件系统(rootfs)而言,由于其执行过程需要对ROM进行读写操作,因此 27 | 可以不用搬运到RAM中,但是实际过程中内核启动后会产生一个虚拟的文件系统,该文件系统是挂在根文件系统的关键所 28 | 在,这里不详细讲解。整体来说,大致的过程为,嵌入式设备上电后将执行bootloader,对硬件进行硬件和堆栈初始化, 29 | 然后搬运内核到RAM中并启动内核,紧接着挂载根文件系统。 30 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 31 | \faWarning \ 32 | 现在绝大多数SoC内部有一段固化的代码,该代码放在bootloader之前,也就是IROM,故实际上最开始执行的也并不 33 | 是bootloader,而是芯片内部的IROM。IROM的主要目的是方便芯片的操作,例如通过USB对Flash芯片进行烧写程序 34 | 。 35 | \end{tcolorbox} 36 | 37 | \section{环境搭建} 38 | \subsection{交叉工具链安装} 39 | 所有的嵌入式设备开发都会用到各种工具,由于每个嵌入式SoC的芯片架构不同,其开发工具也不尽相同。当前用的最多 40 | 的是ARM,本书中使用的Lite200主芯片的内核为ARM9,其架构使用的是ARMv5架构。最主要的工具为交叉工具链,对于F1C200S, 41 | 使用的交叉工具链必须高于6.0版本,本书编译u-boot和\\ 42 | kernel使用7.2.1版本,连接:\faChain \ 43 | \href{https://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabi/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz}{arm-linux-gnueabi-7.2} 44 | \quad 点击即可下载。 45 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 46 | \faBellO \ 下载速度慢可以使用迅雷等下载软件进行下载。 47 | \end{tcolorbox} 48 | \noindent 49 | 下载完成后解压文件:\\ 50 | \textbf{tar -vxjf } gcc-linaro-7.2.1-2017.11-x86\_64\_arm-linux-gnueabi.tar.xz \\ 51 | 然后在/usr/local目录下新建arm-linux-gcc目录 \\ 52 | \textbf{sudo mkdir } /usr/local/arm-linux-gcc \\ 53 | 进入解压目录下:\\ 54 | \textbf{cd } gcc-linaro-7.2.1-2017.11-x86\_64\_arm-linux-gnueabi/ \\ 55 | 将该目录下的所有文件复制到新建的目录下 \\ 56 | \textbf{sudo cp -rd} * \ /usr/local/arm-linux-gcc/ \\ 57 | 最后需要添加该工具链的环境变量使其可以在任何目录下执行,打开/etc/profile文件\\ 58 | \textbf{sudo vim } /etc/profile \\ 59 | 在文件末尾 添加以下内容\\ 60 | PATH=\$PATH:/usr/local/arm-linux-gcc/bin \\ 61 | 添加完毕,使路径生效 \\ 62 | \textbf{source } /etc/profile 63 | 64 | \begin{note} 65 | arm-linux-gnueabi与arm-linux-gnueabihf的区别在于前者可以编译无浮点运算单元的SoC芯片,而后者只能只能编译 66 | 带浮点运算单元的芯片,由于全志F1C200S内部没有浮点运算单元,因此这里必须安装前者。对于全志V3s或者H3芯片, 67 | 其内部有浮点运算单元,故应该安装后者。 68 | \end{note} 69 | 70 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 71 | \faHandORight \ 上述也可以修改/etc/environment文件,在PATH值追加:\\ 72 | :/usr/local/arm-linux-gcc/bin" 73 | \end{tcolorbox} 74 | \noindent 75 | 下面验证交叉工具链是否成功安装:\\ 76 | 在任何目录中输入arm-linux-,然后连按两次Tab键,如果出现补全交叉工具链名称,则说明安装成功,如\ref{fig:arm-linux-gcc} 77 | \begin{figure}[htbp] 78 | \centering 79 | \includegraphics[width=1\linewidth]{chapter2/img/arm-linux-gcc} 80 | \caption{} 81 | \label{fig:arm-linux-gcc} 82 | \end{figure} 83 | 84 | \noindent 85 | 如果没有出现,则进行下面操作:\\ 86 | 安装必要的动态链接库\\ 87 | \textbf{sudo apt-get install} lib32ncurses5 lib32z1 \\ 88 | 上面安装的动态链接库主要是因为ubuntu是64位的操作系统,而交叉工具链是32位的,因此我们需要安装 89 | 32位必须的一些动态链接库。 90 | 91 | 92 | \subsection{安装下载工具 (sunxi-tools)} 93 | \noindent 94 | \faWarning \quad \textcolor{red}{该部分只针对SPI\_FLASH方式启动的用户而言,使用TF卡启动可以忽略此小结} 95 | 96 | 因为后面会使用git工具,所以我们先要安装git工具,这个工具的目的就是从github上下载或者称之为克隆代码用的。 97 | 使用如下命令安装git工具:\\ 98 | \textbf{sudo apt-get} install git \\ 99 | \noindent 100 | 然后我们下载我们需要使用的下载工具(sunxi-tools):\\ 101 | \textbf{git} clone https://github.com/linux-sunxi/sunxi-tools.git -b f1c100s-spiflash \\ 102 | 克隆下来的工具将保存在当前目录下,进入该目录后,执行:\\ 103 | \textbf{make} \\ 104 | 然后安装即可:\\ 105 | \textbf{make install} 106 | 107 | 108 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 109 | \faWarning \ 110 | 如果出现错误,这是因为有些必要的依赖库没有安装,执行如下命令即可安装:\\ 111 | \textbf{sudo apt-get} install libusb-1.0-0-dev zlib1g-dev \\ 112 | 若出现无法下载的情况,请先下载该库,然后手动安装即可,步骤如下:\\ 113 | \textbf{wget } 114 | http://packages.deepin.com/deepin/pool/main/libu/libusb-1.0/libusb-1.0-0-dev\_1.0.21-1\_amd64.deb 115 | \\ 116 | 下载完毕后使用如下指令安装该库:\\ 117 | \textbf{sudo dpkg} -i libusb-1.0-0-dev\_1.0.21-1\_amd64.deb 118 | \end{tcolorbox} 119 | 120 | \noindent 121 | 安装完毕后需要验证是否安装成功,在终端输入: 122 | \textbf{sunxi-fel} \\ 123 | 如果有如下输出则说明安装成功。 124 | \begin{figure}[htbp] 125 | \centering 126 | \includegraphics[width=1\linewidth]{chapter2/img/chapter2-2-1} 127 | \caption{} 128 | \label{fig:chapter1-2-1} 129 | \end{figure} 130 | 131 | 132 | \section{u-boot移植(TF卡启动)} 133 | 一般来说u-boot是启动内核的关键所在,当前大部分使用的嵌入式设备都是u-boot,最新版本的u-boot几乎包含当前主 134 | 流的SoC芯片,Lite200使用的芯片和licheePI 135 | nano相同,大部分硬件也是兼容的,为了快速移植该部分,这里采用licheePI 136 | nano的u-boot来进行移植。在终端输入如下命令克隆u-boot:\\ 137 | \textbf{git clone} https://github.com/Lichee-Pi/u-boot.git -b nano-v2018.01 \\ 138 | 克隆完毕文件会保存在当前目录下,进入该目录,\\ 139 | \textbf{cd u-boot} \\ 140 | 在该文件夹下有很多分支,我们可以查看所有分支,使用如下命令:\\ 141 | \textbf{git} branch -a \\ 142 | 现在我们使用的是nano开发板,所以将当前分支切换到nano分支,命令如下:\\ 143 | \textbf{git} checkout nano-v2018.01 \\ 144 | u-boot默认的没有指定交叉工具链和架构,因此在编译之前需要指定交叉工具链和芯片架构,u-boot的交叉编译器在u-boot 145 | 的根目录下中的Makefile文件中定义了。打开Makefile文件:\\ 146 | \textbf{vim} Makefile \\ 147 | 找到CROSS\_COMPILE变量,将其改为如下:\\ 148 | ARCH=arm \\ 149 | CROSS\_COMPILE=arm-linux-gnueabi- \\ 150 | 如\ref{fig:chapter1-2-4}所示。 151 | \begin{figure}[htbp] 152 | \centering 153 | \includegraphics[width=1 \linewidth]{chapter2/img/chapter2-2-3} 154 | \caption{} 155 | \label{fig:chapter1-2-3} 156 | \end{figure} 157 | config目录下是板级配置文件,由于每个板子的外设不同,因此编译之前必须要对u-boot进行配置。然而 158 | 配置是一件比较繁琐的事情,特别是像u-boot这种比较复杂的项目而言,初学者几乎无法完成。幸运的是对于大部分开发 159 | 板而言,config目录下有其配置好的默认配置文件。 进入config目录中,然后执行ls查看当前所有的配置文件\\ 160 | \textbf{cd} config \\ 161 | \textbf{ls} \\ 162 | 找到licheepi\_nano\_defconfig和licheepi\_nano\_spiflash\_defconfig,前者表示为TF卡启动,后者表示从SPI 163 | 设备启动,这里有前者即可,如图\ref{fig:chapter1-2-4}所示。 164 | \begin{figure}[htbp] 165 | \centering 166 | \includegraphics[width=1 \linewidth]{chapter2/img/chapter2-2-4} 167 | \caption{} 168 | \label{fig:chapter1-2-4} 169 | \end{figure} 170 | 现在回到上级目录,然后执行make licheepi\_nano\_defconfig \\ 171 | \textbf{cd }.. \\ 172 | \textbf{make} make licheepi\_nano\_defconfig \\ 173 | \begin{figure}[htbp] 174 | \centering 175 | \includegraphics[width=1 \linewidth]{chapter2/img/chapter2-2-5} 176 | \caption{} 177 | \label{fig:chapter1-2-5} 178 | \end{figure} 179 | 配置完成后就可以进入图形界面进行配置了,执行make menuconfig命令:\\ 180 | \textbf{make} menuconfig \\ 181 | 此时出现图形配置选项,如图\ref{fig:chapter2-2-6} 182 | \begin{figure}[htbp] 183 | \centering 184 | \includegraphics[width=1\linewidth]{chapter2/img/chapter2-2-6} 185 | \caption{} 186 | \label{fig:chapter2-2-6} 187 | \end{figure} 188 | 图形配置选项中有两个非常重要的参数配置--传参,下小结重点讲解该部分。 189 | \subsection{传参} 190 | 如图\ref{fig:struction}所示,其中parameter就是传参需要的参数地址。这里不得不提bootargs和bootcmd,这两个 191 | 环境变量可以说是所有环境变量中最重要的变量,读者看完之后就会有体会。 192 | 193 | \subsubsection{bootcmd} 194 | 在最开始提到过,内核一般不在flash中运行,这样就需要将内核搬运到内存中,这个过程需要u-boot来完成。对于mmc 195 | (TF卡)而言,在u-boot有专门的命令load 196 | mmc,该命令可以将mmc中的代码从flash搬运到指定的地址处。当环境变量bootdelay计数到0时,此时uboot就会开始执 197 | 行bootcmd中的命令。 198 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 199 | \faBellO\ 200 | bootdelay这个环境变量是一个计数器,当u-boot主体运行完毕后,此时bootdelay该变量的值将会开始递减,递减 201 | 时间为1s,当递减到0时,此时u-boot将会跳转到bootcmd处开始执行bootcmd命令。 202 | \end{tcolorbox} 203 | load mmc命令的使用比较简单,这里以F1C200S例子来讲解\\ 204 | \textbf{load mmc} 0:1 0x80008000 zImage \\ 205 | load 206 | mmc有三个参数,第一个参数是mmc分区,第二个参数是目标地址,第三个参数是源文件。即上面了命令意思是将mmc的0:1 207 | 分区中的zImage复制到内存中的0x80008000地址处。\\ 208 | \textcolor{red}{\faCaretSquareORight \ TF卡属于mmc存储器的一种} 209 | 210 | 211 | 上面完成了zImage的搬运任务,但是当前大部分的驱动都是基于设备树写的,关于设备树的知识,后面将单独一章节讲解, 212 | 这种基于设备树(dts)的驱动使得代码重复率降低,但是内核就需要对其设备进行解析,否则设备将无法确定是哪一个驱 213 | 动。这里将引入dtb文件,所谓dtb文件就是dts文件通过dtc编译器编译成的目标文件即二进制文件。内核通过加载并解 214 | 析并解析该文件从而获取驱动相关的配置信息。下面给出F1C200S中使用的\\ 215 | \textbf{load mmc} 0:1 0x80c08000 suniv-f1c100s-licheepi-nano.dtb \\ 216 | 上面的命令意思是将mmc的0:1分区中的suniv-f1c100s-licheepi-nano.dtb文件加载到内存中的0x80c08000地址处。关 217 | 于0x80008000和0x80c08000这两个地址是如何确定的后面会详细讲到。 218 | 将zImage(也就是内核镜像文件)和dtb(设备树文件)搬运到了指定内存处,此时u-boot的任务完全结束了,剩下的工作就 219 | 是启动内核了,这个就需要bootm或者bootz命令。这里以bootz命令为例,如下:\\ 220 | \textbf{bootz} 0x80008000 - 0x80c08000 \\ 221 | 上面的意思是告诉内核镜像的起始地址为0x80008000,加载的设备树地址为0x80c08000。 222 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 223 | \faWarning \ \\ 224 | $1.$ bootz命令的格式是:bootz空格0x80008000空格-空格0x80c08000,注意-左右有空格\\ 225 | $2.$ bootm命令是对没有使用设备树内核的镜像启动命令,早期版本的内核没有引入设备树,因此对于早期的内 226 | 核一般使用的是bootm,其命令格式为bootm 内核地址,比如bootm x0x30008000,意思是从0x30008000开始启动 227 | 内核,启动内核的过程其实是将pc指针指向该地址,这样处理器就会从该地址处运行代码。 228 | \end{tcolorbox} 229 | 上面详细讲解了bootcmd环境变量,该环境变量若要执行多条命令,则每个命令之间用;隔开,例如\\ 230 | F1C200S常用的bootcmd为:\\ 231 | load mmc 0:1 0x80008000 zImage;load mmc 0:1 0x80c08000 suniv-f1c100s-licheepi-nano.dtb;bootz 232 | 0x80008000 - 0x80c08000;\\ 233 | 在图形配置界面中(图\ref{fig:chapter2-2-6}),图\ref{fig:bootcmd}所示中默认开启了bootcmd,其中变量值为run 234 | 235 | distro\_bootcmd,这个值的意思是执行一个名为distro\_bootcmd的一个脚本文件。 236 | \begin{figure}[htbp] 237 | \centering 238 | \includegraphics[width=1\linewidth]{chapter2/img/bootcmd} 239 | \caption{} 240 | \label{fig:bootcmd} 241 | \end{figure} 242 | 对于一般的内核,可以直接上面的命令填写到bootcmd中,将光标移动到bootcmd value处,然后按回车键,进入编 243 | 辑界面,如图\ref{fig:bootcmdvlaue}:\\ 244 | \begin{figure}[htbp] 245 | \centering 246 | \includegraphics[width=1\linewidth]{chapter2/img/bootcmdvlaue} 247 | \caption{} 248 | \label{fig:bootcmdvlaue} 249 | \end{figure} 250 | 选择【Ok】后按回车键即可保存该变量值。如图\ref{fig:bootcmdsave} 251 | \begin{figure}[htbp] 252 | \centering 253 | \includegraphics[width=1\linewidth]{chapter2/img/bootcmdsave} 254 | \caption{} 255 | \label{fig:bootcmdsave} 256 | \end{figure} 257 | 258 | 259 | 260 | \subsubsection{bootargs} 261 | bootargs也是u-boot环境变量中一个非常重要的变量,上面已经讲解了内核的启动可以通过bootcmd来完成,那接下来内 262 | 核启动完毕后必须挂在根文件系统(rootfs)。但是内核并不知道根文件系统的具体位置,我们必须要告诉根文件的位置 263 | 后内核才能将其挂载,这时就需要有bootargs变量。该变量的作用是告诉内核根文件系统的位置和属性以及必要的配置, 264 | 这个就是图\ref{fig:struction}中parameter的部分,u-boot会将bootargs的值(其实就是字符串)保存到事先规定好 265 | 的地址处,当内核启动成功后就会获取该地址处的字符串值,然后对其进行解析并做相关的内核配置。这个过程看起来比 266 | 较复杂,这里可以不用去了解细节,只需要知道bootargs是告诉内核根文件系统的位置属性以及一些配置参数。对于mmc 267 | 而言,一般采用分区来划分内存区域,下面以F1C200S常用的bootargs来讲解。\\ 268 | console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw \\ 269 | 上面console=ttyS0,115200表示终端为ttyS0即串口0,波特率为115200。panic=5字面意思是恐慌,即linux内核恐慌, 270 | 其实就是linux不知道怎么执行了,此时内核就需要做一些相关的处理,这里的5表示超时时间,当Linux卡住5秒后仍未 271 | 成功就会执行Linux恐慌异常的一些操作。rootwait该参数是告诉内核挂在文件系统之前需要先加载相关驱动,这样做的 272 | 目的是防止因mmc驱动还未加载就开始挂载驱动而导致文件系统挂载失败,所以一般bootargs中都要加上这个参数。root=/dev/mmcblk0p2 273 | 表示根文件系统的位置在mmc的0:2分区处,/dev是设备文件夹,内核在加载mmc中的时候就会在根文件系统中生成mmcblk0p2 274 | 设备文件,该设备文件其实就是mmc的0:2分区,这样内核对文件系统的读写操作方式本质上就是读写/dev/mmcblk0p2该 275 | 设备文件。earlyprintk参数是指在内核加载的过程中打印输出信息,这样内核在加载的时候终端就会输出相应的启动信 276 | 息。rw表示文件系统的操作属性,此处rw表示可读可写。\\ 277 | 设置bootargs参数时将光标移动到Enable boot, 278 | arguments处,点击键盘'Y'按键使其参数开启,如图\ref{fig:bootargs} 279 | \begin{figure}[htbp] 280 | \centering 281 | \includegraphics[width=1\linewidth]{chapter2/img/bootargs} 282 | \caption{} 283 | \label{fig:bootargs} 284 | \end{figure} 285 | 然后将光标移动到下一个选项即Boot arguments (NEW)选项,然后按回车键对该环境变量进行编辑,将上面的bootargs 286 | 字符串填写进入,然后按【Ok】键保存,如图\ref{fig:bootargssave} 287 | \begin{figure}[htbp] 288 | \centering 289 | \includegraphics[width=1\linewidth]{chapter2/img/bootargssave} 290 | \caption{} 291 | \label{fig:bootargssave} 292 | \end{figure} 293 | 294 | \subsection{编译} 295 | 先保存图形配置界面后推出界面,在终端执行make -j4即可对整个u-boot进行编译。\\ 296 | \textbf{make} -j4 \\ 297 | 如图\ref{fig:ubootmake} 298 | \begin{figure}[htbp] 299 | \centering 300 | \includegraphics[width=1\linewidth]{chapter2/img/ubootmake} 301 | \caption{} 302 | \label{fig:ubootmake} 303 | \end{figure} 304 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 305 | \faBellO \ 306 | make -j4后面的-j4表示4个核心进行编译,若电脑的处理器是2核心,请使用make -j2进行编译。 307 | \end{tcolorbox} 308 | 编译完成后会在当前目录生成u-boot-sunxi-with-spl.bin烧录文件。如图\ref{fig:ubootsunxispl},该文件就是我 309 | 们最终要烧录的二进制文件。 310 | \begin{figure}[htbp] 311 | \centering 312 | \includegraphics[width=1\linewidth]{chapter2/img/ubootsunxispl} 313 | \caption{} 314 | \label{fig:ubootsunxispl} 315 | \end{figure} 316 | 在当前目录下会有一个隐藏的文件.config,该文件是u-boot编译后根据各个选项产生的配置文件,这个配置文件记录了 317 | 所有配置选项的宏开关,编译的时候是根据最终的.config文件来进行编译的,当然编译前是需要有脚本解析.config文 318 | 件然后进行相应的编译。 319 | \begin{note} 320 | \textcolor{blue}{ 321 | 关于u-boot的配置过程这里简单说明下,其文件结构的和linux内核结构大致相同,对于当前而言,其配置方式有三 322 | 种,分别是\\ 323 | 1.\ make menuconfig \\ 324 | 2.\ make xxx\_defconfig \\ 325 | 3.\ .config \\ 326 | 这三种方式都可以对内核进行配置,三者之间的关系比作去饭店吃饭,make 327 | menuconfig可以看作菜单,.config和make xxx\_defconfig是客人点的菜,但是其三个文件之间可能因为存在依赖 328 | 关系,如果直接修改.config可能会导致配置失效。 329 | } 330 | \end{note} 331 | 只要将u-boot-sunxi-with-spl.bin烧录到tf卡的8k偏移处地址就可以了,烧录步骤如下: 332 | 使用dd命令进行块搬移:\\ 333 | sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8 \\ 334 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 335 | \faBellO \ 336 | if指的是输入文件,of指的是输出文件,这里的输出文件为主机电脑的/dev/sdb文件,也就是TF卡,这个可以用gparted 337 | 软件查看,该软件可以直接用命令安装即可:sudo apt-get install 338 | gparted,安装好后打开该软件,如图\ref{fig:gparted}在右上角可以看到两个硬盘sda,其中一个是主机的本地 339 | 硬盘,另一个是TF,即sdb这里可以看到TF卡的卷标名为sdb,因此这里的of=/dev/sdb 340 | 烧录到8k偏移地址处是指绝对地址,这个绝对地址指的是TF卡的物理地址。这里为何是8k处而不是其他地址是由于F1C200S 341 | 内部的IROM中的一小段代码决定的。 342 | \end{tcolorbox} 343 | \begin{figure}[htbp] 344 | \centering 345 | \includegraphics[width=1\linewidth]{chapter2/img/gparted} 346 | \caption{} 347 | \label{fig:gparted} 348 | \end{figure} 349 | 烧录完毕后如图\ref*{fig:dd} 350 | \begin{figure}[htbp] 351 | \centering 352 | \includegraphics[width=1\linewidth]{chapter2/img/dd} 353 | \caption{} 354 | \label{fig:dd} 355 | \end{figure} 356 | 现在这个TF卡内的u-boot可以启动内核了。将TF卡插入到开发板上,然后通过USB连接到电脑端,打开串口工具,可以看 357 | 到按下开发板上的复位按钮,可以看到此时串口终端有信息输出,如图\ref{fig:ubootstart},由于没有烧录内核,因 358 | 此加载内核失败,停止在了u-boot命令终端处。 359 | \begin{figure}[htbp] 360 | \centering 361 | \includegraphics[width=1\linewidth]{chapter2/img/ubootstart} 362 | \caption{} 363 | \label{fig:ubootstart} 364 | \end{figure} 365 | 可以在终端输入pri命令打印环境变量的所有值,如图\ref{fig:bootpri}所示,可以看到bootcmd和bootargs是正确的 366 | 。 367 | \begin{figure}[htbp] 368 | \centering 369 | \includegraphics[width=1\linewidth]{chapter2/img/bootpri} 370 | \caption{} 371 | \label{fig:bootpri} 372 | \end{figure} 373 | 374 | 375 | 也许到这里读者可能会认为u-boot内容结束了,其实不然,u-boot还有很多需要分析,由于有些部分过于复杂,对初学 376 | 者不友好,因此u-boot的进阶内容将放到后面详细讲解。 377 | 378 | 379 | \section{内核移植} 380 | 内核移植相对与u-boot移植复杂些,对于F1C200S而言,Linux官方源码已经对licheepi nano进行了支持,因此本次移 381 | 植采用licheepi nano的配置文件,下面以linux5.7版本内核来讲解kernel移植步骤。 382 | 进入linux内核官网(\href{https://www.kernel.org/}{https://www.kernel.org/}),点击https://www.kernel.org/pub/ 383 | 进入下载界面,如图\ref{fig:linuxkernel},下载连接为 384 | \href{https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.7.1.tar.gz}{https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.7.1.tar.gz} 385 | \begin{figure}[htbp] 386 | \centering 387 | \includegraphics[width=1\linewidth]{chapter2/img/linuxkernel} 388 | \caption{} 389 | \label{fig:linuxkernel} 390 | \end{figure} 391 | ,可以使用下载工具进行下载,下载后的源码包通过FTP传输到虚拟机。上传完毕后进入虚拟机解压源码,和u-boot步骤 392 | 一样,在编译前必须对源码进行配置。进入该源码中的arch/arm/configs目录中,可以看到有很多开发板的配置文件, 393 | 其中sunxi\_defconfig是全志的配置文件,但是该配置文件非常不全,需要额外配置大量的选项,一般选项多大上千个, 394 | 这里先使用licheepi\_nano的配置文件。https://github.com/LiShanwenGit/MelonPI-MINI/tree/master/software 395 | 该目录下有一个linux-licheepi\_nano\_defconfig文件,这个文件是针对licheepi\_nano的配置文件。这个配置文件 396 | 与Lite200完全兼容,后面会详细分析该文件以及一些配置,这里为了快速启动内核就不做过多阐述。下载该文件,然后 397 | 将其放到arch/arm/configs/目录下,如图\ref{fig:configs},然后回到主目录,和u-boot一样,在编译时必须指定交 398 | 叉编译器。 399 | \begin{figure}[htbp] 400 | \centering 401 | \includegraphics[width=1\linewidth]{chapter2/img/configs} 402 | \caption{} 403 | \label{fig:configs} 404 | \end{figure} 405 | 打开主目录下的Makefile文件,然后找到CROSS\_COMPILE变量,将其修改为读者使用的交叉工具链前缀,同时指定架构 406 | 即ARCH变量,这里使用arm-linux-gnueabi-为例,如图 407 | \begin{figure}[htbp] 408 | \centering 409 | \includegraphics[width=1\linewidth]{chapter2/img/linuxmakefile} 410 | \caption{} 411 | \label{fig:linuxmakefile} 412 | \end{figure} 413 | 保存退出,然后在终端处执行\\ 414 | \textbf{make} menuconfig \\ 415 | 进入图形配置界面,如图\ref{fig:linuxmenuconfig}所示。 416 | \begin{figure}[htbp] 417 | \centering 418 | \includegraphics[width=1\linewidth]{chapter2/img/linuxmenuconfig} 419 | \caption{} 420 | \label{fig:linuxmenuconfig} 421 | \end{figure} 422 | 可以看到其配置模式和u-boot近似相同,也是通过上下键左右来操作和[Y][N]键来选择是否编译进内核。这里简单的先 423 | 让linux内核跑起来,因此使用默认配置,不做任何修改。选择[Save]然后退出,在终端下输入\\ 424 | \textbf{make} -j4 \\ 425 | 如图\ref{fig:linuxmakepng}所示。 426 | \begin{figure}[htbp] 427 | \centering 428 | \includegraphics[width=1\linewidth]{chapter2/img/linuxmakepng} 429 | \caption{} 430 | \label{fig:linuxmakepng} 431 | \end{figure} 432 | 编译完毕后在就会生成zImage文件和dtb文件,zImage在arch/arm/boot目录下,dtb在arch/arm/boot/dts目录下。 433 | \begin{figure}[htbp] 434 | \centering 435 | \includegraphics[width=1\linewidth]{chapter2/img/zImagepng} 436 | \caption{} 437 | \label{fig:zimagepng} 438 | \end{figure} 439 | 如图\ref{fig:zimagepng}。镜像编译完毕后就需要将其烧录到TF卡中,从上面的u-boot中bootcmd中可以看到需要将zImage 440 | 和dtb文件复制到TF卡的0:1分区中,这样u-boot在执行bootcmd中的load mmc命令时就可以找到zImage和dtb文件。下面 441 | 来对TF卡进行分区。分区工具最常用的是gparted软件,该软件可以直接在终端中安装即可。\\ 442 | sudo apt-get install gparted\\ 443 | 然后插入TF卡到电脑的USB上,打开该软件,可以看到此时有两个硬盘,一个是sda另一个是sdb,其中sdb就是TF卡。如 444 | \begin{figure}[htbp] 445 | \centering 446 | \includegraphics[width=1\linewidth]{chapter2/img/gpartedpng} 447 | \caption{} 448 | \label{fig:gpartedpng} 449 | \end{figure} 450 | 图\ref{fig:gpartedpng}所示,选中sdb,可以看到有一个未分配的空间,一般对于嵌入式系统而言需要将其分两个区, 451 | 一个是存放zImage和dtb文件,另一个区存放根文件系统。对于第一个分区,一般格式为fat16格式,对于第二个区,一 452 | 般为ext4格式。下面开始分区操作。 453 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 454 | \faWarning\ 455 | 这里第一分区格式只能是fat16格式,原因在于在u-boot中对mmc的操作命令load只支持fat16格式,不支持ext2、 456 | 3或者4格式,因此第一分区只能是fat16,对于第二分区,一般分区为ext4格式,原因在于一般Linux操作系统默认 457 | 挂载的文件系统格式是ext类型的。 458 | \end{tcolorbox} 459 | 460 | 461 | 选中未分配空间并右击鼠标,点击[新建],然后填写相关属性,如图\ref{fig:bootpartedpng},然后点击[添加],所示 462 | 。 463 | \begin{figure}[htbp] 464 | \centering 465 | \includegraphics[width=1\linewidth]{chapter2/img/bootpartedpng} 466 | \caption{} 467 | \label{fig:bootpartedpng} 468 | \end{figure} 469 | ,以相同的方式新建第二分区,如图\ref{fig:rootfspartedpng}所示,最后点击[对勾]完成分区操作,如图\ref{fig:partedsave} 470 | \begin{figure}[htbp] 471 | \centering 472 | \begin{minipage}[c]{0.5\textwidth} 473 | \centering 474 | \includegraphics[width=0.98\linewidth]{chapter2/img/rootfspartedpng} 475 | \caption{} 476 | \label{fig:rootfspartedpng} 477 | \end{minipage}% 478 | \begin{minipage}[c]{0.5\textwidth} 479 | \centering 480 | \includegraphics[width=0.98\linewidth]{chapter2/img/partedsave} 481 | \caption{} 482 | \label{fig:partedsave} 483 | \end{minipage} 484 | \end{figure} 485 | ,最终分区如图\ref{fig:partedfinish} 486 | \begin{figure}[htbp] 487 | \centering 488 | \begin{minipage}[c]{0.5\textwidth} 489 | \centering 490 | \includegraphics[width=0.98\linewidth]{chapter2/img/partedfinish} 491 | \caption{} 492 | \label{fig:partedfinish} 493 | \end{minipage}% 494 | \begin{minipage}[c]{0.5\textwidth} 495 | \centering 496 | \vspace{0.6cm} 497 | \includegraphics[width=0.98\linewidth]{chapter2/img/linuxsatrtfinish} 498 | \vspace{0.6cm} 499 | \caption{} 500 | \label{fig:linuxsatrtfinish} 501 | \end{minipage} 502 | \end{figure} 503 | 分区完毕后剩下的就是将zImage和dtb文件复制到TF卡的BOOT分区中。此时复制可以直接通过图形操作即可,也可以通过 504 | 命令复制。将复制好内核的TF卡插到Lite200上接上USB和串口即可看到终端有信息输出,如图\ref{fig:linuxsatrtfinish} 505 | 506 | 所示,可以看到内核已经成功启动,不过最终内核卡住了,其原因在于没有根文件系统,下节开始移植根文件系统。 507 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 508 | \faWarning\ 509 | 上面仅仅是简单的启动了Linux内核,实际还有很多文件需要分析,但这里作为简单的了解大致的过程,故不做深入 510 | 讲解,后面分析驱动的时候将会详细讲解内核的文件结构和设备树相关的驱动以及如何添加和修改驱动。 511 | \end{tcolorbox} 512 | 513 | 514 | \section{根文件系统移植} 515 | 根文件系统是内核启动后挂载的第一个文件系统,如果没有根文件系统,内核将无法开启shell以及其他进程,下面来开 516 | 始移植根文件系统。 517 | \begin{note} 518 | 实际上内核启动后会先挂载一个虚拟的文件系统,这个虚拟文件系统是在内存中运行的,其主要运行核心进程,虚拟 519 | 文件系统挂载之后才挂载硬盘(TF卡或者emmc)上的根文件系统。 520 | \end{note} 521 | 制作根文件系统的工具最有名的莫过于busyBox,该工具体积非常小,非常适合制作根文件系统。但是笔者尝试过使用busyBox 522 | 制作,然而体积较大,这主要原因在于文件系统需要有动态库和静态库,而对于7.2版本的交叉编译器而言,其动态和静 523 | 态链接库实在太大,因此本文将使用另一个非常强悍的工具--Buildroot,该工具集成了非常多的其他应用,制作过程相 524 | 对简单,不会像busyBox那样出现硬件架构不兼容情况。 525 | 526 | 由于根文件系统制作比较简单,这里就完全从头开始。进入buildroot官网({https://buildroot.org/downloads/}{https://buildroot.org/downloads/}) 527 | 下面以buildroot2018.2.11版本作为移植示例。将下载的源码包上传到虚拟机上,然后解压进入该源码目录中。 528 | 进入源码目录后在终端输入\\ 529 | \textbf{make} clean \\ 530 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 531 | \faWarning \ 532 | 在开始编译之前必须执行make clean以清楚一些预设配置,即使是第一次编译也是一样。 533 | \end{tcolorbox} 534 | 然后执行\\ 535 | \textbf{make} menuconfig \\ 536 | 此时会进入图形配置界面,如图\ref{fig:buildrootmakemenuconfig}。进入第一个Target 537 | options选项,配置如图\ref{fig:buildarch} 538 | \begin{figure}[htbp] 539 | \centering 540 | \begin{minipage}[c]{0.5\textwidth} 541 | \centering 542 | \includegraphics[width=0.98\linewidth]{chapter2/img/buildrootmakemenuconfig} 543 | \caption{} 544 | \label{fig:buildrootmakemenuconfig} 545 | \end{minipage}% 546 | \begin{minipage}[c]{0.5\textwidth} 547 | \centering 548 | \includegraphics[width=0.98\linewidth]{chapter2/img/buildarch} 549 | \caption{} 550 | \label{fig:buildarch} 551 | \end{minipage} 552 | \end{figure} 553 | 第一个选项为架构选择,这里选择ARM架构小端模式,第二个为输出的二进制文件格式,这里选择EFL格式,第三个为架构 554 | 体系,这里选择arm926t,因为F1C100S的架构就是这个架构,第四个为矢量浮点处理器,这里不勾选,因为对于F1C100S 555 | 而言,其内部没有浮点运算单元,只能进行软浮点运算,也就是模拟浮点预运算。 556 | 第五个为应用程序二进制接口,这里选择EABI,原因是该格式支持软件浮点和硬件实现浮点功能混用。 557 | 第六个为浮点运算规则,这里使用软件浮点,第七个选择指令集,这里选择ARM指令集,因为thumb主要针对Cortex M系 558 | 列而言的,对于运行操作系统的A系列以及ARM9和ARM11而言,使用的都是32位的ARM指令集。 559 | 560 | 561 | 保存后,回到上一级配置界面,然后进入第二个Build options选项,配置如图\ref{fig:buildoptions}。 562 | \begin{figure}[htbp] 563 | \centering 564 | \includegraphics[width=1\linewidth]{chapter2/img/buildoptions} 565 | \caption{} 566 | \label{fig:buildoptions} 567 | \end{figure} 568 | 保存后,回到上一级配置界面,然后进入第三个Toolchain选项,配置如图\ref{fig:buildtoolschains}。 569 | \begin{figure}[htbp] 570 | \centering 571 | \includegraphics[width=1\linewidth]{chapter2/img/buildtoolschains} 572 | \caption{} 573 | \label{fig:buildtoolschains} 574 | \end{figure} 575 | 这里是选择交叉工具链,对于初学者而言,最好选择buildroot指定的默认交叉工具链,因为这里涉及到C库问题,如果 576 | 使用自己安装的交叉工具链,编译很可能会报错,因为使用的C库不匹配。黄色框中的选项尽可能勾选,因为后面移植QT5 577 | 的时候需要用到C++相关库,如果这里没有勾选,QT5选项将无法勾选。 578 | 579 | 保存后回到上一级配置界面,然后进入第四个System configuration选项,配置如图\ref{fig:builrsystem}。 580 | \begin{figure}[htbp] 581 | \centering 582 | \includegraphics[width=1\linewidth]{chapter2/img/builrsystem} 583 | \caption{} 584 | \label{fig:builrsystem} 585 | \end{figure} 586 | 第一个红色框中表示启动根文件系统后输出的信息(横幅),这里默认,当然你也可以修改此值,比如改为Welcome to 587 | Lite200,第二个红色框中表示开启登录密码,可以看到默认密码为空,这里就默认了,读者也可以根据自己情况修改即 588 | 可。 589 | 590 | 591 | 保存后回到上一级配置界面,可以看到后面还有部分选项没有配置,由于剩下的选项也可以不用配置,因此这里为了简便, 592 | 直接保持推出,然后执行\\ 593 | \textbf{make} 594 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 595 | \faWarning\ 596 | 这里最好不要用多核编译,一般来说,首次编译过程非常慢,因为要下载很多必要的文件和交叉工具链。 597 | \end{tcolorbox} 598 | 编译完毕后可以在output/images目录下有一个rootfs.tar,该文件就是最终生成的根文件系统镜像,现在只需要将该镜 599 | 像解压到TF卡的第二分区即可。插入TF卡到电脑端,进入out/images目录,然后输入\\ 600 | sudo tar -xvf rootfs.tar -C /media/lsw/rootfs/ \\ 601 | 此时可以看到TF卡的rootfs分区中有文件系统了,现在将TF卡弹出,插入到Lite200上,连接好串口,打开串口助手或者 602 | 其他串口终端软件,可以看到根文件系统成功挂载,同时进入shell交互,如图\ref{fig:rootfssatrt}。 603 | \begin{figure}[htbp] 604 | \centering 605 | \includegraphics[width=1\linewidth]{chapter2/img/rootfssatrt} 606 | \caption{} 607 | \label{fig:rootfssatrt} 608 | \end{figure} 609 | 用户名默认为root,无密码,进入root账号后,在终端输出\\ 610 | \textbf{cd} /\\ 611 | \textbf{ls} \\ 612 | 可以看到文件系统中的linux的根目录情况,到此根文件系统的移植完成。 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/1.pdf -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/arm-linux-gcc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/arm-linux-gcc.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootargs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootargs.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootargssave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootargssave.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootcmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootcmd.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootcmdsave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootcmdsave.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootcmdvlaue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootcmdvlaue.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootpartedpng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootpartedpng.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/bootpri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/bootpri.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/buildarch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/buildarch.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/buildoptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/buildoptions.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/buildroothttppng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/buildroothttppng.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/buildrootmakemenuconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/buildrootmakemenuconfig.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/buildtoolschains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/buildtoolschains.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/builrsystem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/builrsystem.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/chapter2-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/chapter2-2-1.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/chapter2-2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/chapter2-2-3.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/chapter2-2-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/chapter2-2-4.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/chapter2-2-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/chapter2-2-5.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/chapter2-2-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/chapter2-2-6.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/configs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/configs.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/dd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/dd.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/gparted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/gparted.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/gpartedpng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/gpartedpng.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/linuxkernel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/linuxkernel.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/linuxmakefile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/linuxmakefile.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/linuxmakepng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/linuxmakepng.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/linuxmenuconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/linuxmenuconfig.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/linuxsatrtfinish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/linuxsatrtfinish.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/partedfinish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/partedfinish.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/partedsave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/partedsave.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/rootfspartedpng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/rootfspartedpng.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/rootfssatrt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/rootfssatrt.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/ubootmake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/ubootmake.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/ubootstart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/ubootstart.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/ubootsunxispl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/ubootsunxispl.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter2/img/zImagepng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter2/img/zImagepng.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter3/chapter3.tex: -------------------------------------------------------------------------------- 1 | \chapter{设备树(DTS)} 2 | 设备树是什么?又为何要引入设备树呢?这个需要追溯到2011年3月17日。这天 3 | Linus Torvalds对ARM Linux邮件列表宣称“this whole ARM thing is a fucking pain in the 4 | ass”,ARM Linux社区对此作出了回应,由此引入设备树。在未引入设备树之前,Linux源码中充斥这非常多的驱动 5 | 代码,这些驱动代码虽然完整的适应很多处理器架构,但是由于处理器种类太多,而且每种处理器又分了非常多不同型号 6 | 的处理器,这使得相应的驱动文件异常的多,Linus称其为垃圾代码。其后,Linux源码开始引入设备树,将不同型号的 7 | 处理器驱动尽可能放在一起,为了方便管理,他们将所有的设备都描述成一棵树,Linux内核启动之后就会遍历这颗树, 8 | 然后初始化相应的硬件。在设备树引入之前,Platform总线也是非常好的一个设备驱动框架,读者有兴趣可以深入了解, 9 | 这种框架当前任然还保留在,而且当前几乎大部分驱动都是Platform总线结合设备树一起管理驱动设备。 10 | 11 | 12 | 在Linux发展过程中总共经历了三种设备驱动管理框架,第一种是最原始的基于简单的注册,这种方式比较容易理解,需 13 | 要什么设备驱动就将相应的驱动写在内核中,然后编译即可载入内核。这种方法缺陷很明显,当设备越来越多时,驱动文 14 | 件将变得很大。最后PowerPC使用了一种基于Platform Bus的框架,这种框架改善的上面的情况,它将处理器虚与设备之 15 | 间的交互虚拟成一根总线,相同类型的驱动使用同一根总线,比如IIC,IIS,SPI,USB等等,所有的设备都是这些总线上的 16 | 子设备。第三种就是现在的基于设备树的驱动框架,这种驱动框架结合了Platform 17 | Bus的优点,同时引入了设备树概念,其核心思想是将处理器看作是一个数的主干,主干上有很多分支,分支上挂载着不 18 | 同的设备。 19 | 20 | 21 | 需要说明的是设备树并不是驱动文件,它指示一个描述设备的表格,而真是的驱动代码会根据设备树选择的设备对相应的 22 | 设备进行初始化,设备树上没有的设备不会初始化。这举个简单的例子:现在我们需要对两个数进行四则运算,但是我们 23 | 暂时不知道具体是哪一种运算,那我们就可以这样写 24 | \begin{lstlisting}[language={[ANSI]C},numbers=left,numberstyle=\tiny,frame=shadowbox, 25 | rulesepcolor=\color{red!20!green!20!blue!20}, 26 | keywordstyle=\color{blue!70!black}, 27 | commentstyle=\color{blue!90!}, 28 | basicstyle=\ttfamily] 29 | int fun(int style,int x,int y) 30 | { 31 | switch(style) 32 | { 33 | case 0:return x+y; 34 | case 1:return x-y; 35 | case 2:return x*y; 36 | case 3:return x/y; 37 | default:return -1; 38 | } 39 | } 40 | \end{lstlisting} 41 | 如果要进行四则运算,dts可以看作是选择其中一个运算方式。 42 | \begin{figure}[h] 43 | \centering 44 | \includegraphics[width=1\linewidth]{chapter3/img/DTS} 45 | \caption{} 46 | \label{fig:dts} 47 | \end{figure} 48 | 图\ref{fig:dts}所示是dts的示意图,可以看到每个设备都是通过总线的方式描述的。 49 | \begin{figure}[htbp] 50 | \centering 51 | \includegraphics[width=0.6\linewidth]{chapter3/img/DTSstream} 52 | \caption{} 53 | \label{fig:dtsstream} 54 | \end{figure} 55 | 图\ref{fig:dtsstream},dts文件需要被dtc编译器编译为dtb的二进制文件,当内核获取dtb文件后会对文件进行解析, 56 | 然后根据dtb文件的内容对相应的设备进行初始化以及注册。 57 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 58 | \faWarning\ 59 | 一般而言,dts会分为两个文件,一个是dtsi文件,另一个是dts文件。dtsi文件类似于.h文件一样,dts文件一般包 60 | 含dtsi文件,然后根据需要来配置设备节点。 61 | \end{tcolorbox} 62 | 63 | \section{dts文件结构} 64 | 先来看下suniv-f1c100s的dtsi文件,打开Linux5.7源码中的arch/arm/boot/dts/suniv-f1c100s.dtsi文件 65 | 66 | \begin{lstlisting}[language={[ANSI]C},numbers=left,numberstyle=\tiny,frame=shadowbox, 67 | rulesepcolor=\color{red!20!green!20!blue!20}, 68 | keywordstyle=\color{blue!70!black}, 69 | commentstyle=\color{blue!90!}, 70 | basicstyle=\ttfamily] 71 | #include 72 | #include 73 | / { 74 | #address-cells = <1>; 75 | #size-cells = <1>; 76 | interrupt-parent = <&intc>; 77 | clocks { 78 | osc24M: clk-24M { 79 | #clock-cells = <0>; 80 | compatible = "fixed-clock"; 81 | clock-frequency = <24000000>; 82 | clock-output-names = "osc24M"; 83 | }; 84 | 85 | osc32k: clk-32k { 86 | #clock-cells = <0>; 87 | compatible = "fixed-clock"; 88 | clock-frequency = <32768>; 89 | clock-output-names = "osc32k"; 90 | }; 91 | }; 92 | 93 | cpus { 94 | cpu { 95 | compatible = "arm,arm926ej-s"; 96 | device_type = "cpu"; 97 | }; 98 | }; 99 | 100 | soc { 101 | compatible = "simple-bus"; 102 | #address-cells = <1>; 103 | #size-cells = <1>; 104 | ranges; 105 | 106 | sram-controller@1c00000 { 107 | compatible = "allwinner,suniv-f1c100s-system-control", 108 | "allwinner,sun4i-a10-system-control"; 109 | reg = <0x01c00000 0x30>; 110 | #address-cells = <1>; 111 | #size-cells = <1>; 112 | ranges; 113 | 114 | sram_d: sram@10000 { 115 | compatible = "mmio-sram"; 116 | reg = <0x00010000 0x1000>; 117 | #address-cells = <1>; 118 | #size-cells = <1>; 119 | ranges = <0 0x00010000 0x1000>; 120 | 121 | otg_sram: sram-section@0 { 122 | compatible = "allwinner,suniv-f1c100s-sram-d", 123 | "allwinner,sun4i-a10-sram-d"; 124 | reg = <0x0000 0x1000>; 125 | status = "disabled"; 126 | }; 127 | }; 128 | }; 129 | 130 | ccu: clock@1c20000 { 131 | compatible = "allwinner,suniv-f1c100s-ccu"; 132 | reg = <0x01c20000 0x400>; 133 | clocks = <&osc24M>, <&osc32k>; 134 | clock-names = "hosc", "losc"; 135 | #clock-cells = <1>; 136 | #reset-cells = <1>; 137 | }; 138 | }; 139 | }; 140 | \end{lstlisting} 141 | 由于文件太大,上面的dtsi文件只放一部分,可以看到里面有很多关于设备的描述信息,下面将重点讲解其意义。 142 | 1-2行是包含的头文件,该头文件中定义了时钟宏和复位相关的宏,这些宏可以在dtsi和dts文件中看到,例如osc24M等, 143 | 这两个头文件在include/dt-bindings/clock和include/dt-bindings/reset目录里面。 144 | 145 | 一般默认规定,dtsi文件放一个系列芯片的公共部分,然后dts文件对其节点进行配置。F1C200S的dtsi文件中说明了几 146 | 乎所有的硬件描述,dts文件中对各个硬件节点进行配置。这样对于不同开发板而言,只需要编写dts文件即可完成配置, 147 | 当然,前提是dtsi文件中的硬件描述是完整的。 148 | \subsection{节点} 149 | 所谓节点是针对总线而言的,将根节点作为一个树的根,然后在根节点上添加其他的节点。上述给的dtsi文件中/就是根 150 | 节点,根节点里面会添加各个其他的不同节点,对于一个dts文件而言,有且只有一个根节点。 151 | 从上面可以看到有些节点前面有:,例如clock节点: 152 | \begin{lstlisting}[language={[ANSI]C},numbers=left,numberstyle=\tiny,frame=shadowbox, 153 | rulesepcolor=\color{red!20!green!20!blue!20}, 154 | keywordstyle=\color{blue!70!black}, 155 | commentstyle=\color{blue!90!}, 156 | basicstyle=\ttfamily] 157 | ccu: clock@1c20000 { 158 | compatible = "allwinner,suniv-f1c100s-ccu"; 159 | reg = <0x01c20000 0x400>; 160 | clocks = <&osc24M>, <&osc32k>; 161 | clock-names = "hosc", "losc"; 162 | #clock-cells = <1>; 163 | #reset-cells = <1>; 164 | }; 165 | \end{lstlisting} 166 | 该节点的节点名为clock,地址为0x1c20000,因此,节点的表示为:节点名\&地址。 167 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 168 | \faWarning\ 169 | 这里的节点名@后面的地址并不是真实的地址,可以随便写一个,但是为了不发生重复,一般默认规定其值为该寄存 170 | 器的地址。只有reg属性中的地址才是真实描述寄存器的地址。 171 | \end{tcolorbox} 172 | 这里的ccu是一个节点标号,所谓节点标号可以看作是该节点的一个别名,这样做的好处是当需要修改节点的属性时,只 173 | 需要在dts文件中引用该标号,然后添加修改的属性即可,而不需要重复将该节点完整的写一遍。例如现在需要将ccu节点 174 | 中的属性clocks修改为<\&osc32M>, <\&osc32.768>;,此时只需要在dts文件中这样写即可: 175 | \begin{lstlisting}[language={[ANSI]C},numbers=left,numberstyle=\tiny,frame=shadowbox, 176 | rulesepcolor=\color{red!20!green!20!blue!20}, 177 | keywordstyle=\color{blue!70!black}, 178 | commentstyle=\color{blue!90!}, 179 | basicstyle=\ttfamily] 180 | &ccu{ 181 | clocks = <&osc32M>, <&osc32.768k>; 182 | }; 183 | \end{lstlisting} 184 | \begin{note} 185 | 一般需要修改节点的status属性以及引脚属性。 186 | \end{note} 187 | \subsection{属性} 188 | 每个节点必须要有属性,所谓属性就是添加一些节点的必要信息,比如寄存器地址,时钟等,这些属性是为驱动程序提供 189 | 具体的相关信息的,下面来简单讲解下一般接触到的节点属性。 190 | 191 | 192 | \subsubsection{compatible} 193 | "compatible"表示“兼容”,对于某个LED,内核中可能有A、B、C三个驱动都支持它,那可以这样写:\\ 194 | led\{compatible = "A", "B", "C";\}; \\ 195 | 内核启动时,就会为这个LED按这样的优先顺序为它找到驱动程序:A、B、C。 196 | 也可以从上面的clock节点可以看到其兼容属性为\\ 197 | compatible = "allwinner,suniv-f1c100s-ccu";\\ 198 | 内核会通过of\_match\_table(也有通过of\_find\_compatible\_node)来匹配对应的节点,一旦匹配到就加载该驱动 199 | 。因此当前大部分的驱动都需要使用compatible 200 | 节点来加载驱动程序,以降低不必要的代码量。有这么一个默认的规定,compatible后面一般格式为“厂家,驱动名称”, 201 | 这只是一个约定俗称的规定,不一定非要这样写,只要驱动程序能够与dts文件中的节点属性对应起来就可以。对于有些 202 | 节点可以兼容多个设备时,可以写在一起,例如:\\ 203 | compatible = "allwinner,suniv-f1c100s-ccu","allwinner,suniv-f1c200s-ccu"; 204 | 205 | \subsubsection{model} 206 | "model"字面意思是模型,主要来说明该设备的具体名称,例如上面我们可以添加一个model属性:\\ 207 | \begin{lstlisting}[language={[ANSI]C},numbers=left,numberstyle=\tiny,frame=shadowbox, 208 | rulesepcolor=\color{red!20!green!20!blue!20}, 209 | keywordstyle=\color{blue!70!black}, 210 | commentstyle=\color{blue!90!}, 211 | basicstyle=\ttfamily] 212 | ccu: clock@1c20000 { 213 | compatible = "allwinner,suniv-f1c100s-ccu"; 214 | model = "lite200"; 215 | reg = <0x01c20000 0x400>; 216 | clocks = <&osc24M>, <&osc32k>; 217 | clock-names = "hosc", "losc"; 218 | #clock-cells = <1>; 219 | #reset-cells = <1>; 220 | }; 221 | \end{lstlisting} 222 | 上面添加了一个model = "lite200";属性来说明此设备是lite200,一般而言,此驱动会被加载打印出来,不过并不是 223 | 必须的,也可以没有此属性。 224 | 225 | \subsubsection{status} 226 | "status"可以看出这个属性是状态的意思,在dts节点中表示此节点是否有效,其属性有 227 | \begin{table}[htbp] 228 | \centering 229 | \caption{status属性值} 230 | \begin{tabular}{ccccccc} 231 | \hline 232 | okay & 表示设备可操作 \\ 233 | \hline 234 | disabled & 表示设备不可操作 \\ 235 | \hline 236 | fail & 表示设备不可操作,同时检测到设备错误 \\ 237 | \hline 238 | fail-sss & 表示设备不可操作,同时检测到sss错误 \\ 239 | \hline 240 | \end{tabular} 241 | \end{table} 242 | 大多数情况下接触的只有okay和disable这两个属性。 243 | 244 | \subsubsection{ \#address-cells \ \#size-cells} 245 | address-cells表示该节点的地址要用多少个32位数来表示,size-cells表示该节点的大小要用多少个32位数来表示。 246 | 这两个属性与后面的reg属性比较密切,因为reg属性需要用这两个属性来说明其寄存器所占用的空间大小。例如: 247 | \begin{lstlisting}[language={[ANSI]C},numbers=left,numberstyle=\tiny,frame=shadowbox, 248 | rulesepcolor=\color{red!20!green!20!blue!20}, 249 | keywordstyle=\color{blue!70!black}, 250 | commentstyle=\color{blue!90!}, 251 | basicstyle=\ttfamily] 252 | sram_d: sram@10000 { 253 | compatible = "mmio-sram"; 254 | reg = <0x00010000 0x1000>; 255 | #address-cells = <1>; 256 | #size-cells = <1>; 257 | ranges = <0 0x00010000 0x1000>; 258 | 259 | otg_sram: sram-section@0 { 260 | compatible = "allwinner,suniv-f1c100s-sram-d", 261 | "allwinner,sun4i-a10-sram-d"; 262 | reg = <0x0000 0x1000>; 263 | status = "disabled"; 264 | }; 265 | }; 266 | \end{lstlisting} 267 | 上面的\\ 268 | \#address-cells = <1>;\\ 269 | \#size-cells = <1>;\\ 270 | 这两个表示reg的地址占一个32位数,即4个字节,大小占一个32位数,即4个字节。这样就可以清楚的知道reg = 271 | <0x00010000 0x1000>;的意思是寄存器的地址位0x00010000,大小为0x1000。 272 | 273 | \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black] 274 | \faWarning\ 275 | \#address-cells和\#size-cells属性不是从devicetree的祖先继承的。它们需要明确定义,如果未定义,对于设 276 | 备树则默认按照地址cell为2个,长度cell为1个去解析reg的值。 277 | \end{tcolorbox} 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | \subsubsection{reg} 286 | 这个属性表示寄存器的地址,这个属性非常重要,因为设备驱动最重操作的是寄存器的值。在加载内核驱动后,内核首先 287 | 要做的是解析DTB文件,通过获取DTB文件就可以获取设备相应的寄存器地址。在设备树中,reg属性是描述一段内存的, 288 | 这段内存的大小由\#address-cells和\#size-cells决定,其中\#address-cells表示设备树总线宽度需要用多少个cell 289 | 表示(默认一个cell为32位,即四个字节),\#size-cells表示设备树总线上设备挂载的地址空间大小需要多少个cell表 290 | 示。 291 | 292 | 293 | 294 | 295 | 296 | 297 | \subsubsection{ranges} 298 | 该属性一般为空,如果不为空,则表示一个地址映射表或者叫地址转换表,其一般 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | \section{设备树与驱动关系} 308 | 309 | 310 | 311 | 312 | 313 | 314 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter3/img/DTS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter3/img/DTS.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter3/img/DTSstream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiShanwenGit/MelonPI-MINI/376f231fe42ff8fa47bb7aee3b7df607b6baba58/documents/Lite200GuideLatex/chapter3/img/DTSstream.png -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter4/chapter4.tex: -------------------------------------------------------------------------------- 1 | \chapter{常用驱动移植} 2 | 本章主要讲解常用的驱动移植。 3 | 4 | 5 | \section{屏幕驱动移植} 6 | 7 | 8 | 9 | \section{USB驱动移植} 10 | 11 | 12 | 13 | \section{音频解码驱动移植} 14 | 15 | 16 | 17 | 18 | \section{视频解码驱动移植} 19 | 20 | 21 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter5/chapter5.tex: -------------------------------------------------------------------------------- 1 | \chapter{常用应用移植} 2 | 3 | \section{QT5移植} 4 | 5 | 6 | \section{图片浏览器移植} 7 | 8 | 9 | 10 | \section{NES模拟器移植} 11 | 12 | 13 | \section{视频播放器mplayer移植} 14 | 15 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/chapter6/chapter6.tex: -------------------------------------------------------------------------------- 1 | \chapter{驱动开发} 2 | 3 | \section{linux驱动框架} 4 | 5 | 6 | 7 | \section{字符设备驱动} 8 | 9 | 10 | 11 | 12 | \section{块设备驱动} 13 | 14 | 15 | 16 | \section{网络设备驱动} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/elegantbook-cn.tex: -------------------------------------------------------------------------------- 1 | \documentclass[cn,11pt,chinese]{elegantbook} 2 | 3 | \title{Lite200开发指南} 4 | \subtitle{Lite200 Development Guide } 5 | 6 | \author{leesans\ (LiShanwen)} 7 | %\institute{野生技术协会} 8 | \date{2021年2月5日} 9 | \version{3.1} 10 | \bioinfo{协议}{GPL2.0} 11 | 12 | \extrainfo{温柔正确的人总是难以生存,因为这世界既不温柔,也不正确。—— 比企谷八幡} 13 | 14 | \logo{logo-blue.png} 15 | \cover{cover.jpg} 16 | 17 | % 本文档命令 18 | \usepackage{array} 19 | \newcommand{\ccr}[1]{\makecell{{\color{#1}\rule{1cm}{1cm}}}} 20 | 21 | \usepackage{mathrsfs} 22 | \usepackage{warning} 23 | \usepackage{soul} 24 | \usepackage{alertmessage} 25 | \usepackage{caption} 26 | \usepackage{graphicx, subfig} 27 | \usepackage{svg} 28 | \usepackage{fontawesome} 29 | \usepackage{tcolorbox} 30 | 31 | \usepackage[tikz]{bclogo} 32 | 33 | \usepackage{listings} 34 | \usepackage{xcolor} 35 | 36 | \setcounter{tocdepth}{3} 37 | \setcounter{secnumdepth}{3} 38 | \usepackage{amssymb} 39 | \usepackage{wrapfig} 40 | \usepackage{graphicx} 41 | \usepackage{subfig}%多个子图 42 | 43 | 44 | \usepackage{listings} 45 | \usepackage{ctex} 46 | \usepackage{geometry} 47 | \geometry{a4paper,left=2cm,right=1.5cm,top=2cm,bottom=2cm} 48 | 49 | 50 | \begin{document} 51 | 52 | 53 | 54 | \maketitle 55 | \frontmatter 56 | 57 | \chapter*{特别声明} 58 | \markboth{Introduction}{前言} 59 | 60 | 回首过去几年,有种莫名的失败感, 61 | 62 | \vskip 1.5cm 63 | 64 | \begin{flushright} 65 | Ethan Deng\\ 66 | February 10, 2020 67 | \end{flushright} 68 | 69 | \tableofcontents 70 | %\listofchanges 71 | \mainmatter 72 | 73 | \input{./chapter1/chapter1} 74 | \input{./chapter2/chapter2} 75 | \input{./chapter3/chapter3} 76 | \input{./chapter4/chapter4} 77 | \input{./chapter5/chapter5} 78 | \input{./chapter6/chapter6} 79 | 80 | \input{./end/end} 81 | 82 | 83 | 84 | \end{document} 85 | -------------------------------------------------------------------------------- /documents/Lite200GuideLatex/elegantbook-en.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt,fancy,authoryear]{elegantbook} 2 | 3 | \title{An Elegant \LaTeX{} Template for Books} 4 | \subtitle{Classic Elegant\LaTeX{} Template} 5 | 6 | \author{Ethan Deng \& Liam Huang} 7 | \institute{Elegant\LaTeX{} Program} 8 | \date{April 12, 2020} 9 | \version{3.11} 10 | \bioinfo{Bio}{Information} 11 | 12 | \extrainfo{Victory won\rq t come to us unless we go to it. } 13 | 14 | \logo{logo-blue.png} 15 | \cover{cover.jpg} 16 | 17 | 18 | \begin{document} 19 | 20 | \maketitle 21 | 22 | \frontmatter 23 | \tableofcontents 24 | 25 | \mainmatter 26 | \chapter{Elegant\LaTeX{} Templates} 27 | Elegant\LaTeX{} Program developers are intended to provide you beautiful, elegant, user-friendly templates. Currently, the Elegant\LaTeX{} is composed of \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote}, \href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook}, \href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper}, designed for typesetting notes, books, and working papers respectively. Latest releases are strongly recommended! This guide is aimed at briefly introducing the 101 of this template. For any other question, suggestion or comment, feel free to contact us on GitHub \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} or email us at \email{elegantlatex2e@gmail.com}. 28 | 29 | Contact Infos: 30 | \begin{itemize} 31 | \item Homepage: \href{https://elegantlatex.org/}{https://elegantlatex.org/} 32 | \item GitHub: \href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/} 33 | \item CTAN: \href{https://ctan.org/pkg/elegantbook}{https://ctan.org/pkg/elegantbook} 34 | \item Wiki: \href{https://github.com/ElegantLaTeX/ElegantBook/wiki}{https://github.com/ElegantLaTeX/ElegantBook/wiki} 35 | \item Download: \href{https://github.com/ElegantLaTeX/ElegantBook/releases}{release}, \href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{latest version} 36 | \item Weibo: Elegant\LaTeX{} 37 | \item Wechat: Elegant\LaTeX{} 38 | \item QQ: 692108391 39 | \item Email: \email{elegantlatex2e@gmail.com} 40 | \end{itemize} 41 | 42 | 43 | \section{ElegantBook Updates} 44 | 45 | Version 3.11 is the last version of 3.x, it's base upon 3.10, mainly to resolve \TeX{} Live 2020 compilation errors caused by \lstinline{gbt7714} compatibility issues. What\rq s new in this version: 46 | 47 | \begin{enumerate} 48 | \item \textbf{Fix}: Fix \lstinline{natbib option clash} problems caused by \lstinline{gbt7714} updates; 49 | \item Remove \lstinline{base} decorations and its options since \lstinline{pgfornament} package is not included in \TeX{} Live 2020; 50 | \item Fix spacing problem in some environments; 51 | \item Add Italian language option, \lstinline{lang=it}. 52 | \end{enumerate} 53 | 54 | 55 | \begin{figure}[h] 56 | \centering 57 | \includegraphics[width=0.9\linewidth]{../../../Pictures/1} 58 | \caption{} 59 | \label{fig:1} 60 | \end{figure} 61 | 62 | \begin{note} 63 | If you are using previous version, please delete \lstinline|\hypersetup{pageanchor=true}| and add \lstinline{\frontmatter} after \lstinline{\maketitle} and before \lstinline{\tableofcontents}. Users for 2.x, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/wiki/convert}{conversion}. 64 | \end{note} 65 | 66 | \section{Installation and Update} 67 | Both portable version and installation package are available for this template, online usage is optional as well. 68 | 69 | \subsection{To Use Templates Online} 70 | Visit \href{https://www.overleaf.com/}{Overleaf} to use our template online anywhere and anytime without local installation. To find our template, search \lstinline{elegantlatex} in the \lstinline{templates} or simply visit \href{https://www.overleaf.com/latex/templates?addsearch=elegantlatex}{search result}, choose the template you prefer and \lstinline{Open as Template} to own a copy yourself to edit freely. To learn more about Overleaf, please refer to \href{https://www.overleaf.com/learn}{Documentation}. 71 | 72 | \begin{remark} 73 | On Overleaf, please use \hologo{XeLaTeX} to compile articles in Chinese and \hologo{pdfLaTeX} to compile articles in English. 74 | \end{remark} 75 | 76 | \subsection{To Use Portable Version} 77 | For portable version, simply download lastest ElegantBook-master from GitHub or CTAN (to be more accurate, download \lstinline{elegantbook.cls}) and save the file(s) under your working directory. This way of installation is simple and convenient, but you have to manually update \lstinline{cls} now and then. 78 | 79 | \subsection{To Use Local Installation Version} 80 | If you are a \TeX{} Live 2019 user, using the \lstinline{tlshell}\footnote{namely, \TeX{} Live Manager} of \TeX{} Live 2019 direct installation package is strongly recommended. Simply search and open \lstinline{tlshell}, click on \lstinline{File -> Load Default Repository} or customize repository by \lstinline{Options}. Wait till the repository loads successfully, search \lstinline{elegantbook} by name, installation and update is just a click away. 81 | 82 | \begin{figure}[htbp] 83 | \centering 84 | \includegraphics[width=0.7\textwidth]{tlshell.png} 85 | \caption{Use \TeX{} Live Shell to Install ElegantBook Template} 86 | \end{figure} 87 | 88 | \subsection{Update Templates} 89 | If you fail to update templates using \lstinline{tlshell}, please use cmd to update all the packages or switch to portable version instead. 90 | 91 | Use the following commands(administrator privileges) to update: 92 | \begin{lstlisting} 93 | tlmgr update --self 94 | tlmgr update --all 95 | \end{lstlisting} 96 | 97 | To learn more, please refer to \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX{} distribution?} 98 | 99 | \subsection{Other Release Versions} 100 | If you are a \TeX{} Live 2018 user and would like to update to \TeX{} Live 2019, the official solution is to uninstall 2018. If you want to save the bother of uninstallation and installation, please copy \lstinline{elegantbook.cls} to the installation directory of \TeX{} Live 2018 (default: \lstinline|C:\texlive\2018\texmf-dist\tex\latex\elegantbook| ), run \lstinline{texhash} in cmd. 101 | 102 | Excuse me? You are a C\TeX{} user? Sorry, this template is incompatible with C\TeX{}. 103 | 104 | For more details about the installation and usage of \TeX{} Live 2019, the compatibility of C\TeX{} and \TeX{} Live, please refer to OG (Official Guide) and/or \href{https://github.com/OsbertWang/install_latex/releases}{Install LaTeX v5.1} by OsbertWang. 105 | 106 | \section{User\rq s Selected Works Plan} 107 | Eight years have passed since the found of Elegant\LaTeX{} Program. It\rq s an honor that our templates are preferred by a lot of users. Hence, in order to promote more interactions among our users and know more about what you need, we are planning to provide a platform to display selected works of our users on GitHub or our homepage. If you want to show us your work(s), contact us via Email or other ways. Or if you have upload your work(s) on GitHub or Gitee etc., share the URL(s) with us. You can visit current available works \href{https://github.com/ElegantLaTeX/Archive/tree/master/Collections}{here}. 108 | 109 | \section{About Pull Request} 110 | For some reasons, pull requests will NOT by accepted since May 20, 2019. For those who want to help improve the templates, submit issues or clone to your own repository to modify under LPPL-1.3c. 111 | 112 | \section{Recruit Support Members} 113 | Recruit support members for Elegant\LaTeX{} to translate template OGs, maintain wiki entries using Markdown, update Wechat articles. No deadline for this recruitment. 114 | 115 | So far, Elegant\LaTeX{} has four Support Members: 116 | \begin{itemize} 117 | \item OG Translator: \href{https://github.com/peggy2006xzyz}{YPY}; 118 | \item Wiki Maintainer: \href{https://github.com/izinngo}{Ingo Zinngo}, \href{https://github.com/xiaohao890809}{Xiaohao890809}; 119 | \item QQ Group Manager \& FAQ Maintainer: \href{https://github.com/sikouhjw}{Sikouhjw}. 120 | \end{itemize} 121 | 122 | BTW, thank \href{https://github.com/stone-zeng}{Xiangdong Zeng}, \href{https://github.com/latexers}{Zhuluren}, etc. for their help. 123 | 124 | \section{Acknowledgement} 125 | The number of stars on GitHub for ElegantBook reached 100 on May 20, 2019\footnote{372 stars by February 8, 2020!}.Thank China\TeX{} and \href{http://www.latexstudio.net/}{\LaTeX{} studio} for their promotion. \LaTeX{} studio offers tons of valuable posts and templates for discovery. It is the most comprehensive website on \LaTeX{} in China. 126 | 127 | If you like our template, star on GitHub. 128 | 129 | \section{Donation} 130 | To express your love for our templates and/or our developers, please do not hesitate to tip us. Since last release of 3.08, we have received about 1,500 RMB! (The emergence of a millionaire is on the way. Loading... ) 131 | \begin{figure}[!htb] 132 | \centering 133 | \includegraphics[width=0.45\textwidth]{donate.jpg} 134 | \end{figure} 135 | 136 | The explanation right of the tip usage belongs to Elegant\LaTeX{} with no supervision. Feel free to tip us. Those who donate more than 10 RMB will be recorded in the Donation List. Thank all the tippers! 137 | 138 | \begin{table}[!htb] 139 | \centering 140 | \caption{Donation List} 141 | \begin{tabular}{*{4}{>{\scriptsize}c}|*{4}{>{\scriptsize}c}} 142 | \toprule 143 | \textbf{Tipper} & \textbf{Amount} & \textbf{Date} & \textbf{Channel} & \textbf{Tipper} & \textbf{Amount} & \textbf{Date} & \textbf{Channel} \\ 144 | \midrule 145 | Lerh & 10 RMB & 2019/05/15 & Wechat & yueguodipingxian & 10 RMB & 2019/05/15 & Wechat \\ 146 | yinsang & 20 RMB & 2019/05/27 & Wechat & *kong & 10 RMB & 2019/05/30 & Wechat \\ 147 | latexstudio.net & 666 RMB & 2019/06/05 & Alipay & A*n & 40 RMB & 2019/06/15 & Wechat \\ 148 | * xia & 22 RMB & 2019/06/15 & Wechat & * qian & 21 RMB & 2019/06/15 & Wechat \\ 149 | Cassis & 11 RMB & 2019/06/30 & Wechat & * jun & 10 RMB & 2019/07/23 & Wechat \\ 150 | P*u & 50 RMB & 2019/07/30 & Wechat & * meng & 19 RMB & 2019/08/28 & Wechat \\ 151 | Qu Doudou & 10 RMB & 2019/08/28 & Wechat & Li Bo & 100 RMB & 2019/10/06 & Wechat \\ 152 | Njustsll & 10 RMB & 2019/10/11 & Wechat & Liu Zhikuo & 99.99 RMB & 2019/10/15 & Alipay \\ 153 | * tao & 16 RMB & 2019/10/17 & Wechat & Chini & 12 RMB & 2019/10/17 & Alipay \\ 154 | yuanfengjing & 10 RMB & 2019/10/28 & Wechat & Guo Deliang & 88 RMB & 2019/11/03 & Wechat \\ 155 | ziqiangbuxi & 20 RMB & 2019/11/04 & Alipay & dushuzhichong & 20 RMB & 2019/11/18 & Wechat \\ 156 | * deng & 10 RMB & 2019/11/18 & Wechat & * zhe & 20 RMB & 2019/11/18 & Wechat \\ 157 | anonymous & 10 RMB & 2019/11/24 & Wechat & Jiye Qian & 66 RMB & 2019/12/04 & Wechat \\ 158 | * yang & 20 RMB & 2019/12/05 & Wechat & Catcher & 11 RMB & 2019/12/08 & Alipay \\ 159 | xierbotementu & 10 RMB & 2019/12/09 & Alipay & * wei & 10 RMB & 2019/12/09 & Wechat \\ 160 | Simon & 20 RMB & 2019/12/11 & Alipay & liushangqianyi & 66.60 RMB & 2019/12/18 & Alipay \\ 161 | yu & 10 RMB & 2019/12/20 & Alipay & *chen & 15 RMB & 2019/12/20 & Wechat \\ 162 | suifeng & 20 RMB & 2019/12/27 & Alipay & Ws & 23.30 RMB & 2019/12/28 & Wechat \\ 163 | chuba & 100 RMB & 2020/01/02 & Alipay & p*e & 20 RMB & 2020/01/03 & Wechat \\ 164 | Shunmx & 100 RMB & 2020/01/03 & Wechat & hj & 10 RMB & 2020/01/03 & Wechat \\ 165 | F*5 & 10 RMB & 2020/01/03 & Wechat & S*m & 20.20 RMB & 2020/01/03 & Wechat \\ 166 | erdaiqingzhi & 13 RMB & 2020/01/14 & Alipay & *? & 66 RMB & 2020/01/15 & Wechat \\ 167 | Mr. Xiong & 20 RMB & 2020/01/17 & Wechat & *bo & 15 RMB & 2020/01/18 & Wechat \\ 168 | *Zhe & 10 RMB & 2020/02/02 & Wechat & Jackie & 88.80 RMB & 2020/02/09 & Wechat \\ 169 | Henry\_Sun & 50 RMB & 2020/02/14 & Alipay & * Qiao & 50 RMB & 2020/02/21 & Wechat \\ 170 | YunLian & 10 RMB & 2020/03/02 & Alipay & S*y & 10 RMB & 2020/03/15 & Wechat \\ 171 | * Ge & 66.66 RMB & 2020/03/17 & Wechat & K*e & 30 RMB & 2020/03/30 & Wechat\\ 172 | * Yang & 20 RMB & 2020/04/02 & Wechat & Shi*n & 30 RMB & 2020/04/11 & Wechat \\ 173 | \bottomrule 174 | \end{tabular}% 175 | \label{tab:donation}% 176 | \end{table}% 177 | 178 | BTW, we provide Certificate of Donation for those who donated, tippers please leave your name(nickname) and email address for us to send the certificates. 179 | 180 | \begin{figure}[!htb] 181 | \centering 182 | \includegraphics[width=0.7\textwidth]{cert.pdf} 183 | \end{figure} 184 | 185 | \chapter{ElegantBook Settings} 186 | 187 | This template is based on the Standard \LaTeX{} book class, so the options of book class work as well (Note that the option of papersize has no effect due to \lstinline{device} option). The default encoding is UTF-8 while \TeX{} Live is recommended. The test environment is Win10 + \TeX{} Live 2019, either \hologo{pdfLaTeX} or \lstinline{XeLaTeX} works fine. \lstinline{XeLaTeX} is preferred for Chinese articles. 188 | 189 | \section{Languages} 190 | We defined one option named \lstinline{lang} which has three alternative values, \lstinline{lang=en} (default) , \lstinline{lang=cn} and \lstinline{lang=it}\footnote{Provided by \href{https://github.com/VincentMVV}{VincentMVV}, detail in \href{https://github.com/ElegantLaTeX/ElegantBook/issues/85}{GitHub: Italian translation}.}. Different values will alter the captions of figure/table, abstract name, refname, etc. You can use this option as 191 | \begin{lstlisting} 192 | \documentclass[en]{elegantbook} 193 | \documentclass[lang=en]{elegantbook} 194 | \end{lstlisting} 195 | 196 | \begin{remark} 197 | Chinese Characters are acceptable \textbf{ONLY} in \lstinline{lang=cn}. If you would like to include Chinese characters under (\lstinline{lstlisting}) environment, please use \hologo{XeLaTeX} to compile. 198 | \end{remark} 199 | 200 | \section{Device Mode Option} 201 | The option for device (\lstinline{device}) was originally used in ElegantNote, now we include this option in ElegantBook\footnote{Pictures have to be modified accordingly.} as well. Activate iPad mode in the following way\footnote{Default size: normal, A4 paper.}: 202 | \begin{lstlisting} 203 | \documentclass[pad]{elegantbook} %or 204 | \documentclass[device=pad]{elegantbook} 205 | \end{lstlisting} 206 | 207 | \section{Color Themes} 208 | This template contains 5 color themes, i.e. \textcolor{structure1}{\lstinline{green}}\footnote{Original default theme.}, \textcolor{structure2}{\lstinline{cyan}}, \textcolor{structure3}{\lstinline{blue}}(default), \textcolor{structure4}{\lstinline{gray}}, \textcolor{structure5}{\lstinline{black}}. You can choose \lstinline{green} with 209 | \begin{lstlisting} 210 | \documentclass[green]{elegantbook} %or 211 | \documentclass[color=green]{elegantbook} 212 | \end{lstlisting} 213 | 214 | 215 | \begin{table}[htbp] 216 | \caption{ElegantBook Themes\label{tab:color thm}} 217 | \centering 218 | \begin{tabular}{ccccccc} 219 | \toprule 220 | & \textcolor{structure1}{green} 221 | & \textcolor{structure2}{cyan} 222 | & \textcolor{structure3}{blue} 223 | & \textcolor{structure4}{gray} 224 | & \textcolor{structure5}{black} 225 | & Main Environments\\ 226 | \midrule 227 | structure & \makecell{{\color{structure1}\rule{1cm}{1cm}}} 228 | & \makecell{{\color{structure2}\rule{1cm}{1cm}}} 229 | & \makecell{{\color{structure3}\rule{1cm}{1cm}}} 230 | & \makecell{{\color{structure4}\rule{1cm}{1cm}}} 231 | & \makecell{{\color{structure5}\rule{1cm}{1cm}}} 232 | & chapter section subsection \\ 233 | main & \makecell{{\color{main1}\rule{1cm}{1cm}}} 234 | & \makecell{{\color{main2}\rule{1cm}{1cm}}} 235 | & \makecell{{\color{main3}\rule{1cm}{1cm}}} 236 | & \makecell{{\color{main4}\rule{1cm}{1cm}}} 237 | & \makecell{{\color{main5}\rule{1cm}{1cm}}} 238 | & definition exercise problem \\ 239 | second & \makecell{{\color{second1}\rule{1cm}{1cm}}} 240 | & \makecell{{\color{second2}\rule{1cm}{1cm}}} 241 | & \makecell{{\color{second3}\rule{1cm}{1cm}}} 242 | & \makecell{{\color{second4}\rule{1cm}{1cm}}} 243 | & \makecell{{\color{second5}\rule{1cm}{1cm}}} 244 | & theorem lemma corollary\\ 245 | third & \makecell{{\color{third1}\rule{1cm}{1cm}}} 246 | & \makecell{{\color{third2}\rule{1cm}{1cm}}} 247 | & \makecell{{\color{third3}\rule{1cm}{1cm}}} 248 | & \makecell{{\color{third4}\rule{1cm}{1cm}}} 249 | & \makecell{{\color{third5}\rule{1cm}{1cm}}} 250 | & proposition\\ 251 | \bottomrule 252 | \end{tabular} 253 | \end{table} 254 | 255 | If you want to customize the colors, please select \lstinline{nocolor} or use \lstinline{color=none} and declare the main, second, and third colors in the preamble section as follows: 256 | \begin{lstlisting}[frame=single] 257 | \definecolor{structurecolor}{RGB}{60,113,183} 258 | \definecolor{main}{RGB}{0,166,82}% 259 | \definecolor{second}{RGB}{255,134,24}% 260 | \definecolor{third}{RGB}{0,174,247}% 261 | \end{lstlisting} 262 | 263 | \section{Cover} 264 | \subsection{Customized Cover} 265 | From v3.10, customized cover is allowed, you can choose or hide any element as you prefer. Current optional elements are: 266 | \begin{itemize} 267 | \item title: \lstinline{\title} 268 | \item subtitle: \lstinline{\subtitle} 269 | \item author: \lstinline{\author} 270 | \item institute: \lstinline{\institute} 271 | \item date: \lstinline{\date} 272 | \item version: \lstinline{\version} 273 | \item extra information: \lstinline{\extrainfo} 274 | \item cover image: \lstinline{\cover} 275 | \item logo: \lstinline{\logo} 276 | \end{itemize} 277 | 278 | Besides, an extra command \lstinline{\bioinfo} is provided with two options--caption and content. For instance, if you want to display \lstinline{Username: 111520}, just type in 279 | 280 | \begin{lstlisting} 281 | \bioinfo{Username}{115520} 282 | \end{lstlisting} 283 | 284 | \subsection{Cover Image} 285 | The cover image used in this template is from \href{https://pixabay.com/en/tea-time-poetry-coffee-reading-3240766/}{pixabay.com}. The image is completely free and can be used under any circumstance. The cover image size is $1280 \times 1024$. If you would like to change the cover, please crop it according to the size of the cover picture strictly. One free online image clipping site: \href{https://www.fotor.com/cn}{fotor.com}. Feel free to join our QQ Group to get more elegant covers. 286 | 287 | \subsection{Logo} 288 | Aspect ratio of the logo is 1:1 in this guide, i.e. a square picture. To replace the logo, do remember to choose the appropriate picture. 289 | 290 | \subsection{Stylized Cover} 291 | Want to use stylized cover?(For instance, A4-sized PDF designed by Adobe Illustrator) Please comment out \lstinline{\maketitle} and use \lstinline{pdfpages} to insert the cover. Similar for using \lstinline{titlepage}. If you would like to use the cover in version 2.x, please refer to \href{https://github.com/EthanDeng/etitlepage}{etitlepage}. 292 | 293 | \section{Chapter Title Display Styles} 294 | 295 | This template contains 2 sets of \textit{title display styles},\lstinline{hang}(default) and \lstinline{display} style. For the former, chapter title is displayed on a single line (\lstinline{hang}). For the latter, chapter title is displayed on a double line (\lstinline{display}).In this guide, we use \lstinline{hang} . To change display style, use: 296 | \begin{lstlisting} 297 | \documentclass[hang]{elegantbook} %or 298 | \documentclass[titlestyle=hang]{elegantbook} 299 | \end{lstlisting} 300 | 301 | 302 | \section{Introduction of Math Environments} 303 | We defined two sets of theorem modes, \lstinline{simple} style and \lstinline{fancy} style (default). You may change to \lstinline{simple} mode by 304 | 305 | \begin{lstlisting} 306 | \documentclass[simple]{elegantbook} %or 307 | \documentclass[mode=simple]{elegantbook} 308 | \end{lstlisting} 309 | 310 | In this template, we defined four different theorem class environments 311 | 312 | \begin{itemize} 313 | \item \textit{Theorem Environment}, including title and content, numbering corresponding to chapter. Three types depending on the format: 314 | \begin{itemize} 315 | \item \textcolor{main}{\textbf{definition}} environment, the color is \textcolor{main}{main}; 316 | \item \textcolor{second}{\textbf{theorem, lemma, corollary}} environment, the color is \textcolor{second} {second}; 317 | \item \textcolor{third}{\textbf{proposition}} environment, the color is \textcolor{third}{third}. 318 | \end{itemize} 319 | \item \textit{Example Environments}, including \textbf{example, exercise, problem} environment, auto numbering corresponding to chapter. 320 | \item \textit{Proof Environment}, including \textbf{proof, note} environment containing introductory symbol (\textbf{note} environment) or ending symbol (\textbf{proof} environment). 321 | \item \textit{Conclusion Environments}, including \textbf{conclusion, assumption, property, remark and solution}\footnote{We also define an option \lstinline{result}, which can hide the \lstinline{solution} and \lstinline{proof} environments. You can switch between \lstinline{result=answer} and \lstinline{result=noanswer}.} environments, all of which begin with boldfaced words, with format consistent with normal paragraphs. 322 | \end{itemize} 323 | 324 | \subsection{Theorem Class Environments} 325 | Since the template uses the \lstinline{tcolorbox} package to customize the theorem class environments, it is slightly different from the normal theorem environments. The usage is as follows: 326 | \begin{lstlisting} 327 | \begin{theorem}{}{