grub_config.html 8.2 KB

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