grub_config.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. <h3 id="example_modifications_trisquel">Trisquel GNU/Linux-libre</h3>
  37. <p>
  38. As an example, on my test system in /boot/grub/grub.cfg (on the HDD/SSD) I see for the main menu entry:
  39. </p>
  40. <ul>
  41. <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>
  42. <li><b>initrd /boot/initrd.img-3.15.1-gnu.nonpae</b></li>
  43. </ul>
  44. <p>
  45. <b>ro</b>, <b>quiet</b>, <b>splash</b>, <b>crashkernel=384M-2G:64M,2G-:128M</b> and
  46. <b>$vt_handoff</b> can be safely ignored.
  47. </p>
  48. <p>
  49. I use this to get my partition layout:<br/>
  50. $ <b>lsblk</b>
  51. </p>
  52. <p>
  53. In my case, I have no /boot partition, instead /boot is on the same partition as / on sda1.
  54. Yours might be different. In GRUB terms, sda means ahci0. 1 means msdos1, or gpt1, depending
  55. on whether I am using MBR or GPT partitioning. Thus, /dev/sda1 is GRUB is (ahci0,msdos1) or
  56. (ahci0,gpt1). In my case, I use MBR partitioning so it's (ahci0,msdos1).
  57. 'msdos' is a GRUB name simply because this partitioning type is traditionally used by MS-DOS.
  58. It doesn't mean that you have a proprietary OS.
  59. </p>
  60. <p>
  61. Trisquel doesn't keep the filenames of kernels consistent, instead it keeps old kernels and
  62. new kernel updates are provided with the version in the filename. This can make GRUB payload
  63. a bit tricky. Fortunately, there are symlinks /vmlinuz and /initrd.img
  64. so if your /boot and / are on the same partition, you can set GRUB to boot from that.
  65. These are also updated automatically when installing kernel updates from your distributions
  66. apt-get repositories.
  67. <b>
  68. Note: when using <a href="http://jxself.org/linux-libre">jxself kernel releases</a>,
  69. these are not updated at all and you have to update them manually.
  70. </b>
  71. </p>
  72. <p>
  73. For the GRUB payload grubtest.cfg (in the 'Load Operating System' menu entry), we therefore have (in this example):<br/>
  74. <b>set root='ahci0,msdos1'</b><br/>
  75. <b>linux /vmlinuz root=UUID=3a008e14-4871-497b-95e5-fb180f277951</b><br/>
  76. <b>initrd /initrd.img</b>
  77. </p>
  78. <p>
  79. Optionally, you can convert the UUID to its real device name, for example /dev/sda1 in this case.
  80. sdX naming isn't very reliable, though, which is why UUID is used for most distributions.
  81. </p>
  82. <p>
  83. Alternatively, if your /boot is on a separate partition then you cannot rely on the /vmlinuz and /initrd.img symlinks.
  84. Instead, go into /boot and create your own symlinks (update them manually when you install a new kernel update).<br/>
  85. $ <b>sudo -s</b> (or <b>su -</b>)<br/>
  86. # <b>cd /boot/</b><br/>
  87. # <b>rm -f vmlinuz initrd.img</b><br/>
  88. # <b>ln -s <u>yourkernel</u> ksym</b><br/>
  89. # <b>ln -s <u>yourinitrd</u> isym</b><br/>
  90. # <b>exit</b>
  91. </p>
  92. <p>
  93. Then your grubtest.cfg menu entry (for payload) becomes like that, for example if / was on sda2 and /boot was on sda1:<br/>
  94. <b>set root='ahci0,msdos1'</b><br/>
  95. <b>linux /ksym root=/dev/sda2</b><br/>
  96. <b>initrd /isym</b>
  97. </p>
  98. <p>
  99. There are lots of possible variations so please try to adapt.
  100. </p>
  101. </div>
  102. <div class="subsection">
  103. <h3 id="example_modifications_parabola">Parabola GNU/Linux-libre</h3>
  104. <p>
  105. You can basically adapt the above. Note however that Parabola does not keep old kernels still installed, and the file names
  106. are always consistent, so you don't need to boot from symlinks, you can just use the real thing directly.
  107. </p>
  108. </div>
  109. <p>
  110. <a href="#pagetop">Back to top of page.</a>
  111. </p>
  112. </div>
  113. <div class="section">
  114. <p>
  115. Copyright &copy; 2014, 2015 Francis Rowe &lt;info@gluglug.org.uk&gt;<br/>
  116. This document is released under the Creative Commons Attribution-ShareAlike 4.0 International Public License and all future versions.
  117. A copy of the license can be found at <a href="../cc-by-sa-4.txt">../cc-by-sa-4.txt</a>.
  118. </p>
  119. <p>
  120. This document is distributed in the hope that it will be useful,
  121. but WITHOUT ANY WARRANTY; without even the implied warranty of
  122. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See <a href="../cc-by-sa-4.txt">../cc-by-sa-4.txt</a> for more information.
  123. </p>
  124. </div>
  125. </body>
  126. </html>