index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <style type="text/css">
  7. @import url('../css/main.css');
  8. </style>
  9. <title>Maintaining libreboot</title>
  10. </head>
  11. <body>
  12. <div class="section">
  13. <h1 id="pagetop">Maintaining libreboot</h1>
  14. <p>
  15. This section relates to maintaining libreboot.
  16. </p>
  17. <p>
  18. Do not follow anything here to the letter; is it only a rough guide
  19. representing how libreboot is maintained (for reference).
  20. </p>
  21. <p>
  22. This section of the documentation applies mainly to the
  23. development version of libreboot, which is hosted in a git
  24. repository. It is not intended for the release versions of
  25. libreboot.
  26. </p>
  27. <ul>
  28. <li><a href="#overview">Overview</a></li>
  29. <li>
  30. <a href="#updating_coreboot">Updating coreboot-libre</a>
  31. <ul>
  32. <li><a href="#newboard_libreboot">Adding a new board to libreboot</a></li>
  33. <li><a href="#newpatch_libreboot">Add/remove/modify patches in coreboot-libre</a></li>
  34. </ul>
  35. </li>
  36. <li>
  37. <a href="#updating_grub">Updating GRUB</a>
  38. <ul>
  39. <li><a href="#altbuild_grub_payload">Change how the GRUB payload (grub.elf) is built (utility: grub-assemble)</a></li>
  40. <li><a href="#newconfig_grub">Modify the configuration used in GRUB</a></li>
  41. <li><a href="../grub/index.html">Other maintenance-related tasks in GRUB</a></li>
  42. </ul>
  43. </li>
  44. <li>
  45. <a href="#updating_flashrom">Updating flashrom</a>
  46. </li>
  47. <li>
  48. <a href="#updating_bucts">Updating bucts</a>
  49. </li>
  50. <li>
  51. <a href="#updating_memtest86plus">Updating MemTest86+</a>
  52. </li>
  53. </ul>
  54. <p>
  55. Or <a href="../index.html">Back to main index</a>.
  56. </p>
  57. </div>
  58. <div class="section">
  59. <h1 id="overview">Overview</h1>
  60. <p>
  61. The way the libreboot project is run is very similar to how
  62. a GNU/Linux distribution project is run (but for the boot
  63. firmware, not your operating system).
  64. </p>
  65. <p>
  66. This page demonstrates on a high level how
  67. libreboot is maintained, how the project is run, how everything
  68. goes together, etc. For a more detailed guide, refer to each
  69. subsection for the various components/modules used in libreboot.
  70. </p>
  71. <p>
  72. <a href="#pagetop">Back to top of page</a>.
  73. </p>
  74. </div>
  75. <div class="section">
  76. <h1 id="updating_coreboot">Updating coreboot-libre</h1>
  77. <p>
  78. NOTE: it helps to own all libreboot-compatible systems here,
  79. or have reliable (and fast) access to a team of testers.
  80. </p>
  81. <p>
  82. Coreboot-libre is the name of the deblobbed coreboot sources
  83. used in libreboot. It is also the name of the collection
  84. of scripts used for deblobbing coreboot, on each new update.
  85. </p>
  86. <p>
  87. This section shows an example of how to update (re-base) to
  88. the latest version of coreboot, how to update the deblobbing
  89. scripts, and so on. <b>This does not teach you how to
  90. change what custom patches are used, nor does it tell
  91. you how to add new boards to libreboot. It assumes that you
  92. simply want to re-base to the latest version (for instance,
  93. there could be bug fixes that you want). For those things
  94. not listed in this section, you can refer to other sections
  95. on this page instead.</b>
  96. </p>
  97. <p>
  98. Open these files in your editor (you will most likely be editing them):
  99. </p>
  100. <ul>
  101. <li>resources/scripts/helpers/download/coreboot</li>
  102. <li>resources/scripts/helpers/build/module/coreboot</li>
  103. <li>resources/utilities/coreboot-libre/deblob</li>
  104. <li>resources/utilities/coreboot-libre/nonblobs</li>
  105. <li>resources/utilities/coreboot-libre/nonblobs_notes</li>
  106. <li>resources/scripts/helpers/build/roms/helper</li>
  107. <li>resources/scripts/helpers/build/roms/withgrub</li>
  108. </ul>
  109. <p>
  110. If you already had a coreboot/ directory in your libreboot
  111. tree, delete it:<br/>
  112. $ <b>rm -Rf coreboot/</b>
  113. </p>
  114. <p>
  115. Firstly, download coreboot. Do <b>not</b> use <b>./download coreboot</b>
  116. for this, just clone coreboot, as it does in that script, like so:<br/>
  117. $ <b>git clone http://review.coreboot.org/coreboot</b>
  118. </p>
  119. <p>
  120. $ <b>cd coreboot/</b><br/>
  121. Get the ID of the latest commit in this clone, by reading the commit ID using
  122. e.g.:<br/>
  123. $ <b>git log</b><br/>
  124. In <i>resources/scripts/helpers/download/coreboot</i> you will
  125. find a line that says <i><b>git reset --hard</b></i> and then
  126. a commit ID next to it. Replace this with the commit ID of the latest
  127. commit from the coreboot version that you just downloaded.
  128. </p>
  129. <p>
  130. Delete the .git* resources. For example:<br/>
  131. $ <b>rm -Rf .git*</b><br/>
  132. ...this is to avoid the deblobbing script from picking up files
  133. in there as blobs, which would be only false positives and
  134. increase the amount of time taken. Now come out of coreboot:<br/>
  135. $ <b>cd ../</b>
  136. </p>
  137. <p>
  138. Check all coreboot file names/paths in <i>deblob</i>; if any
  139. of them no longer exist at that name/path in the coreboot tree that you downloaded,
  140. delete the reference(s) in <i>deblob</i>.
  141. </p>
  142. <p>
  143. Check all coreboot file names/paths in <i>nonblobs</i>; if
  144. any of them no longer exist at that name/path in the coreboot tree that you downloaded,
  145. delete the reference in <i>nonblobs</i>.
  146. </p>
  147. <p>
  148. Now, back in the main root directory of libreboot (git repository),
  149. run the deblob script. This is to prevent the <i>findblobs</i>
  150. scripts from finding the blobs that are already deleted
  151. when running the <i>deblob</i> script. Like so:<br/>
  152. $ <b>./resources/utilities/coreboot-libre/deblob</b>
  153. </p>
  154. <p>
  155. Now search for new blobs:<br/>
  156. $ <b>cd resources/utilities/coreboot-libre/</b><br/>
  157. $ <b>./findblobs</b><br/>
  158. WARNING: this will take a <b>*long*</b> time. Be patient!
  159. What this will do is look through the coreboot source directory,
  160. looking for blobs. It will not find the blobs that you deleted
  161. before (because they no longer exist), and it will ignore any
  162. files listed in <i>nonblobs</i>.
  163. </p>
  164. <p>
  165. Once the <i>findblobs</i> script has finished, check the file
  166. <i>tocheck</i> (from the root, this will be <i>resources/utilities/coreboot-libre/tocheck</i>).
  167. These are the files detected as blobs; some might be blobs, some not.
  168. The <i>findblobs</i> script doesn't know how to determine between blobs
  169. and non-blobs, it only knows patterns. Distinguishing between blobs and
  170. non-blobs must be performed by you, the human being.
  171. </p>
  172. <ul>
  173. <li>
  174. Files in <i>tocheck</i> that you identify as blobs,
  175. should be added appropriately to <i>resources/utilities/coreboot-libre/deblob</i>
  176. </li>
  177. <li>
  178. Files in <i>tocheck</i> that you identify as non-blobs,
  179. should be added appropriately to <i>resources/utilities/coreboot-libre/nonblobs</i> -
  180. also, if you feel it necessary, add an explanation of it in
  181. <i>resources/utilities/coreboot-libre/nonblobs_notes</i>
  182. </li>
  183. </ul>
  184. <p>
  185. Now come back to the main libreboot root directory (root
  186. of the git clone). If you are still in resources/utilities/coreboot-libre/
  187. for instance, you would do something like:<br/>
  188. $ <b>cd ../../../</b>
  189. </p>
  190. <p>
  191. Now delete the coreboot directory:<br/>
  192. $ <b>rm -Rf coreboot/</b>
  193. </p>
  194. <p>
  195. Download coreboot again, only this time, using the download
  196. script. The download script also applies custom patches
  197. to coreboot (see resources/scripts/helpers/download/coreboot);
  198. if they do not apply anymore, you will have to re-base them
  199. and then update <i>resources/scripts/helpers/download/coreboot</i>
  200. accordingly. Anyway, download coreboot like so:<br/>
  201. $ <b>./download coreboot</b>
  202. </p>
  203. <p>
  204. If the custom patches no longer apply, and you have to re-base
  205. (or replace?) some patches, please do this in coreboot upstream,
  206. not in libreboot. Then re-include new patches from upstream,
  207. into libreboot. Here is coreboot's guide for contributing
  208. patches:<br/>
  209. <a href="http://www.coreboot.org/Git">http://www.coreboot.org/Git</a>.
  210. </p>
  211. <p>
  212. Update all configs:<br/>
  213. $ <b>./build config corebootupdate</b><br/>
  214. This simply takes all of the coreboot <b>.config</b> files from
  215. <i>resources/libreboot/config/</i> and does <b>make oldconfig</b>
  216. on them. It usually works. If it doesn't, you'll need to recreate
  217. those configs from scratch using <b>./build config corebootreplace</b> (optionally
  218. add a config name), or <b>./build config corebootmodify</b> (ditto)
  219. (see <a href="../git/index.html#config">../git/index.html#config</a>)
  220. </p>
  221. <p>
  222. Finally, build *all* ROM images using the instructions at
  223. <a href="../git/index.html">../git/index.html</a>, to verify
  224. that everything still builds.
  225. </p>
  226. <p>
  227. Once you've verified that building isn't broken, test *all*
  228. boards (you don't need to test all ROM images, only one
  229. vesafb and one txtmode image for each configuration). If you
  230. do not have all systems supported in libreboot, then you will
  231. need to get other testers for those boards.
  232. </p>
  233. <p>
  234. If you have established a build issue, or a board no longer
  235. works (booting issues, bugs during/after boot, etc), you'll
  236. need to fix it upstream:
  237. <a href="http://www.coreboot.org/Git">http://www.coreboot.org/Git</a>
  238. and then re-update coreboot (or apply patches from upstream).
  239. </p>
  240. <p>
  241. You should also make sure to update
  242. <i>resources/scripts/helpers/build/trim/coreboot</i>
  243. which purges unused parts of coreboot. Basically, if it's
  244. purging parts that you now need, then that's a bug and you
  245. should fix it.
  246. </p>
  247. <p>
  248. You should also test the resulting ROM images from building
  249. with the new or modified coreboot revision.
  250. </p>
  251. <p>
  252. <a href="#pagetop">Back to top of page</a>.
  253. </p>
  254. </div>
  255. <div class="section">
  256. <h1 id="newboard_libreboot">Adding a new board to libreboot</h1>
  257. <p>
  258. Make sure that the board is supported, and that the patches
  259. are included (if there are custom patches that you need).
  260. Add configs for it like so:<br/>
  261. $ <b>./build config corebootreplace <u><i>new_board_name_here</i></u></b>
  262. </p>
  263. <p>
  264. This can also be used for replacing an existing config.
  265. </p>
  266. <p>
  267. Configure the board. Make sure to add the steps to the config section
  268. in <a href="../git/index.html">../git/index.html</a>.
  269. </p>
  270. <p>
  271. When you're done, the config will be stored in <i>resources/libreboot/config/</i>.
  272. Now build-test it and then check that it actually works.
  273. </p>
  274. <p>
  275. The following scripts may also need to be modified before building:
  276. <i>resources/scripts/helpers/build/roms/withgrub</i> and
  277. <i>resources/scripts/helpers/build/roms/helper</i>
  278. </p>
  279. <p>
  280. The following can be used when updating coreboot-libre:<br/>
  281. $ <b>./build config corebootupdate</b> (adding a board name on the end is optional)
  282. </p>
  283. <p>
  284. The following can be used if you want to modify an existing
  285. configuration:<br/>
  286. $ <b>./build config corebootmodify</b> (adding a board name on the end is optional)
  287. </p>
  288. <p>
  289. You should also make sure to update the whitelist in
  290. <i>resources/scripts/helpers/build/trim/coreboot</i>
  291. which purges unused parts of coreboot (including boards).
  292. Basically, if it's
  293. purging parts that you now need, then that's a bug and you
  294. should fix it.
  295. </p>
  296. <p>
  297. <a href="#pagetop">Back to top of page</a>.
  298. </p>
  299. </div>
  300. <div class="section">
  301. <h1 id="newpatch_libreboot">Add/remove/modify patches in coreboot-libre</h1>
  302. <p>
  303. Under <b>resources/scripts/helpers/download/coreboot</b> you can find
  304. the instructions used for patching coreboot.
  305. </p>
  306. <p>
  307. Modify the commit ID on the <i>git reset --hard</i> line accordingly,
  308. and update the list of patches used accordingly. Do not cherry-pick
  309. from review.coreboot.org directly; instead, include the diff in
  310. resources/libreboot/patch/ and use <i>git am</i>
  311. (you can get the diff by using git-format-patch).
  312. </p>
  313. <p>
  314. When you're done, simply download coreboot again:<br/>
  315. $ <b>./download coreboot</b>
  316. </p>
  317. <p>
  318. Finally, re-build the parts from coreboot that are used
  319. by the build system:<br/>
  320. $ <b>./build module coreboot</b>
  321. </p>
  322. <p>
  323. Instead of running the above command, you can save time
  324. by copying out the crossgcc that you compiled before
  325. (from coreboot/util/crossgcc/) and then putting it back.
  326. After you've done that, run everything in
  327. <i>resources/scripts/helpers/build/module/coreboot</i>
  328. except for the part that builds GCC.
  329. </p>
  330. <p>
  331. You should also test the resulting ROM images from building
  332. with the new or modified coreboot revision.
  333. </p>
  334. <p>
  335. <a href="#pagetop">Back to top of page</a>.
  336. </p>
  337. </div>
  338. <div class="section">
  339. <h1 id="updating_grub">Updating GRUB</h1>
  340. <p>
  341. $ <b>rm -Rf grub/</b><br/>
  342. $ <b>git clone git://git.savannah.gnu.org/grub.git</b><br/>
  343. $ <b>cd grub/</b><br/>
  344. $ <b>git log</b>
  345. </p>
  346. <p>
  347. Open the file <i>resources/scripts/helpers/download/grub</i> and
  348. replace the commit ID on the line that performs <i>git reset --hard</i>
  349. with the commit ID of the GRUB revision that you just downloaded.
  350. </p>
  351. <p>
  352. $ <b>cd ../</b><br/>
  353. $ <b>./download grub</b>
  354. </p>
  355. <p>
  356. If it fails because of merge conflicts, you'll need to re-base
  357. or (as appropriate) remove the offending patch(es) in
  358. <i>resources/scripts/helpers/download/grub</i>.
  359. </p>
  360. <p>
  361. Finally, verify that it will build:<br/>
  362. $ <b>./build module grub</b>
  363. </p>
  364. <p>
  365. Since GRUB is the payload in libreboot, you should also
  366. build the ROM images and test them, with this different
  367. GRUB version that you have prepared.
  368. </p>
  369. <p>
  370. <a href="#pagetop">Back to top of page</a>.
  371. </p>
  372. </div>
  373. <div class="section">
  374. <h1 id="altbuild_grub_payload">Change how the GRUB payload (grub.elf) is built (utility: grub-assemble)</h1>
  375. <p>
  376. Look in <i>resources/utilities/grub-assemble/</i>.
  377. </p>
  378. <p>
  379. <i>gen.sh</i> creates ELF executables of GRUB with different configurations:
  380. text-mode or framebuffer mode in coreboot. Essentially,
  381. the text-mode version has no background nor any custom fonts,
  382. and contains MemTest86+. You probably don't need to modify these
  383. files at all.
  384. </p>
  385. <p>
  386. <i>grub_memdisk_keymap</i> simply adds all the keyboard layout
  387. files. The keymap files are in <i>keymap/</i>, and
  388. can be added to using the instructions at
  389. <a href="../grub/index.html#grub_custom_keyboard">../grub/index.html#grub_custom_keyboard</a>.
  390. </p>
  391. <p>
  392. <i>modules.conf</i> defines which modules will be included in the GRUB
  393. ELF executable.
  394. </p>
  395. <p>
  396. Since GRUB is the payload in libreboot, you should also
  397. build the ROM images and test them, with this different
  398. GRUB version that you have prepared.
  399. </p>
  400. <p>
  401. <a href="#pagetop">Back to top of page</a>.
  402. </p>
  403. </div>
  404. <div class="section">
  405. <h1 id="newconfig_grub">Modify the configuration used in GRUB</h1>
  406. <p>
  407. Look in <i>resources/scripts/helpers/build/roms/withgrub</i> to
  408. see how the GRUB configuration files are generated.
  409. </p>
  410. <p>
  411. You might need to modify this. You can also modify the
  412. default configuration by making changes to the files
  413. under <i>resources/grub/config/</i>
  414. </p>
  415. <p>
  416. Since GRUB is the payload in libreboot, you should also
  417. build the ROM images and test them, with this different
  418. GRUB version that you have prepared.
  419. </p>
  420. <p>
  421. <a href="#pagetop">Back to top of page</a>.
  422. </p>
  423. </div>
  424. <div class="section">
  425. <h1 id="updating_flashrom">Updating flashrom</h1>
  426. <p>
  427. Modify these files: <i>resources/scripts/helpers/download/flashrom</i>
  428. and <i>resources/scripts/helpers/build/module/flashrom</i>.
  429. </p>
  430. <p>
  431. Patches are in <i>resources/flashrom/patch/</i>
  432. </p>
  433. <p>
  434. <a href="#pagetop">Back to top of page</a>.
  435. </p>
  436. </div>
  437. <div class="section">
  438. <h1 id="updating_bucts">Updating bucts</h1>
  439. <p>
  440. bucts doesn't really need updating, but the patches are
  441. in <i>resources/bucts/patch</i>, the download script
  442. is <i>resources/scripts/helpers/download/bucts</i> and
  443. the build script is <i>resources/scripts/helpers/build/module/bucts</i>.
  444. </p>
  445. <p>
  446. <a href="#pagetop">Back to top of page</a>.
  447. </p>
  448. </div>
  449. <div class="section">
  450. <h1 id="updating_memtest86plus">Updating MemTest86+</h1>
  451. <p>
  452. MemTest86+ doesn't really need updating, but the patches are
  453. in <i>resources/memtest86/patch</i>, the download script
  454. is <i>resources/scripts/helpers/download/memtest86plus</i> and
  455. the build script is <i>resources/scripts/helpers/build/module/memtest86plus</i>.
  456. </p>
  457. <p>
  458. <a href="#pagetop">Back to top of page</a>.
  459. </p>
  460. </div>
  461. <div class="section">
  462. <p>
  463. Copyright &copy; 2015 Francis Rowe &lt;info@gluglug.org.uk&gt;<br/>
  464. This document is released under the Creative Commons Attribution-ShareAlike 4.0 International Public License and all future versions.
  465. A copy of the license can be found at <a href="../cc-by-sa-4.txt">../cc-by-sa-4.txt</a>.
  466. </p>
  467. <p>
  468. This document is distributed in the hope that it will be useful,
  469. but WITHOUT ANY WARRANTY; without even the implied warranty of
  470. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See <a href="../cc-by-sa-4.txt">../cc-by-sa-4.txt</a> for more information.
  471. </p>
  472. </div>
  473. </body>
  474. </html>