grub_config.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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>Writing a GRUB configuration file</title>
  10. </head>
  11. <body>
  12. <div class="section">
  13. <h1 id="pagetop">Writing a GRUB configuration file</h1>
  14. <p>
  15. This section is for those systems which use the GRUB payload.
  16. <b>If your system uses the depthcharge payload, ignore this section.</b>
  17. </p>
  18. <p>
  19. <a href="index.html">Back to index</a>
  20. </p>
  21. </div>
  22. <div class="section">
  23. <h1>Table of Contents</h1>
  24. <ul>
  25. <li>
  26. <a href="#example_modifications">Example modifications for <i>grubtest.cfg</i></a>
  27. <ul>
  28. <li><a href="#example_modifications_trisquel">Trisquel GNU/Linux-libre</a></li>
  29. <li><a href="#example_modifications_parabola">Parabola GNU/Linux-libre</a></li>
  30. </ul>
  31. </li>
  32. </ul>
  33. </div>
  34. <div class="section">
  35. <h2 id="example_modifications">Example modifications for <i>grubtest.cfg</i></h2>
  36. <p>
  37. These are some common examples of ways in which the grubtest.cfg file can be modified.
  38. </p>
  39. <div class="subsection">
  40. <h2>Obvious option: don't even modify the built-in grub.cfg</h2>
  41. <p>
  42. Use the menuentry that says something like <i>Search for GRUB outside CBFS</i>. Assuming that you
  43. have a grub.cfg file at /boot/grub/ in your installed distro, this will generate a new menuentry in
  44. the GRUB menu. Use that to boot.
  45. </p>
  46. <p>
  47. Then do this as root:<br/>
  48. $ <b>cd /boot/grub/</b><br/>
  49. $ <b>ln -s grub.cfg libreboot_grub.cfg</b>
  50. </p>
  51. <p>
  52. After that, your system should then boot automatically.
  53. </p>
  54. </div>
  55. <div class="subsection">
  56. <h2>Trisquel with full disk encryption, custom partition layout</h2>
  57. <p>
  58. GRUB can boot from a symlink (or symlinks) pointing to your kernel/initramfs, whether from an unencrypted or encrypted /boot/. You
  59. can create your own custom symlink(s) but you have to manually update them when updating your kernel. This guide (not maintained by
  60. the libreboot project) shows how to configure Trisquel to automatically update that symlink on every kernel update.
  61. <a href="http://www.rel4tion.org/people/fr33domlover/libreboot-fix/">http://www.rel4tion.org/people/fr33domlover/libreboot-fix/</a>
  62. </p>
  63. <p>
  64. TODO: adapt those notes and put them here. The author said that it was CC-0, so re-licensing under GFDL shouldn't be a problem.
  65. </p>
  66. </div>
  67. <div class="subsection">
  68. <h3 id="example_modifications_trisquel">Trisquel GNU/Linux-libre</h3>
  69. <p>
  70. As an example, on my test system in /boot/grub/grub.cfg (on the HDD/SSD) I see for the main menu entry:
  71. </p>
  72. <ul>
  73. <li><b>linux /boot/vmlinuz-3.15.1-gnu.nonpae root=UUID=3a008e14-4871-497b-95e5-fb180f277951 ro crashkernel=384M-2G:64M,2G-:128M quiet splash $vt_handoff</b></li>
  74. <li><b>initrd /boot/initrd.img-3.15.1-gnu.nonpae</b></li>
  75. </ul>
  76. <p>
  77. <b>ro</b>, <b>quiet</b>, <b>splash</b>, <b>crashkernel=384M-2G:64M,2G-:128M</b> and
  78. <b>$vt_handoff</b> can be safely ignored.
  79. </p>
  80. <p>
  81. I use this to get my partition layout:<br/>
  82. $ <b>lsblk</b>
  83. </p>
  84. <p>
  85. In my case, I have no /boot partition, instead /boot is on the same partition as / on sda1.
  86. Yours might be different. In GRUB terms, sda means ahci0. 1 means msdos1, or gpt1, depending
  87. on whether I am using MBR or GPT partitioning. Thus, /dev/sda1 is GRUB is (ahci0,msdos1) or
  88. (ahci0,gpt1). In my case, I use MBR partitioning so it's (ahci0,msdos1).
  89. 'msdos' is a GRUB name simply because this partitioning type is traditionally used by MS-DOS.
  90. It doesn't mean that you have a proprietary OS.
  91. </p>
  92. <p>
  93. Trisquel doesn't keep the filenames of kernels consistent, instead it keeps old kernels and
  94. new kernel updates are provided with the version in the filename. This can make GRUB payload
  95. a bit tricky. Fortunately, there are symlinks /vmlinuz and /initrd.img
  96. so if your /boot and / are on the same partition, you can set GRUB to boot from that.
  97. These are also updated automatically when installing kernel updates from your distributions
  98. apt-get repositories.
  99. <b>
  100. Note: when using <a href="http://jxself.org/linux-libre">jxself kernel releases</a>,
  101. these are not updated at all and you have to update them manually.
  102. </b>
  103. </p>
  104. <p>
  105. For the GRUB payload grubtest.cfg (in the 'Load Operating System' menu entry), we therefore have (in this example):<br/>
  106. <b>set root='ahci0,msdos1'</b><br/>
  107. <b>linux /vmlinuz root=UUID=3a008e14-4871-497b-95e5-fb180f277951</b><br/>
  108. <b>initrd /initrd.img</b>
  109. </p>
  110. <p>
  111. Optionally, you can convert the UUID to its real device name, for example /dev/sda1 in this case.
  112. sdX naming isn't very reliable, though, which is why UUID is used for most distributions.
  113. </p>
  114. <p>
  115. Alternatively, if your /boot is on a separate partition then you cannot rely on the /vmlinuz and /initrd.img symlinks.
  116. Instead, go into /boot and create your own symlinks (update them manually when you install a new kernel update).<br/>
  117. $ <b>sudo -s</b> (or <b>su -</b>)<br/>
  118. # <b>cd /boot/</b><br/>
  119. # <b>rm -f vmlinuz initrd.img</b><br/>
  120. # <b>ln -s <u>yourkernel</u> ksym</b><br/>
  121. # <b>ln -s <u>yourinitrd</u> isym</b><br/>
  122. # <b>exit</b>
  123. </p>
  124. <p>
  125. Then your grubtest.cfg menu entry (for payload) becomes like that, for example if / was on sda2 and /boot was on sda1:<br/>
  126. <b>set root='ahci0,msdos1'</b><br/>
  127. <b>linux /ksym root=/dev/sda2</b><br/>
  128. <b>initrd /isym</b>
  129. </p>
  130. <p>
  131. There are lots of possible variations so please try to adapt.
  132. </p>
  133. </div>
  134. <div class="subsection">
  135. <h3 id="example_modifications_parabola">Parabola GNU/Linux-libre</h3>
  136. <p>
  137. You can basically adapt the above. Note however that Parabola does not keep old kernels still installed, and the file names
  138. are always consistent, so you don't need to boot from symlinks, you can just use the real thing directly.
  139. </p>
  140. </div>
  141. <p>
  142. <a href="#pagetop">Back to top of page.</a>
  143. </p>
  144. </div>
  145. <div class="section">
  146. <p>
  147. Copyright &copy; 2014, 2015 Leah Rowe &lt;info@minifree.org&gt;<br/>
  148. Permission is granted to copy, distribute and/or modify this document
  149. under the terms of the GNU Free Documentation License, Version 1.3
  150. or any later version published by the Free Software Foundation;
  151. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  152. A copy of the license can be found at <a href="../gfdl-1.3.txt">../gfdl-1.3.txt</a>
  153. </p>
  154. <p>
  155. Updated versions of the license (when available) can be found at
  156. <a href="https://www.gnu.org/licenses/licenses.html">https://www.gnu.org/licenses/licenses.html</a>
  157. </p>
  158. <p>
  159. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
  160. EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
  161. AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
  162. ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
  163. IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
  164. WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
  165. PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
  166. ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
  167. KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
  168. ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
  169. </p>
  170. <p>
  171. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
  172. TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
  173. NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
  174. INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
  175. COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
  176. USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
  177. ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
  178. DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
  179. IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
  180. </p>
  181. <p>
  182. The disclaimer of warranties and limitation of liability provided
  183. above shall be interpreted in a manner that, to the extent
  184. possible, most closely approximates an absolute disclaimer and
  185. waiver of all liability.
  186. </p>
  187. </div>
  188. </body>
  189. </html>