Difference between pages "The Gentoo.org Redesign, Part 1" and "Install/BootLoader"

(Difference between pages)
 
(New School (UEFI))
 
Line 1: Line 1:
{{Article
+
<noinclude>
|Subtitle=A site reborn
+
{{InstallPart|boot loader configuration}}
|Summary=Have you ever woken up one morning and suddenly realized that your cute little personal development Web site isn't really that great? If so, you're in good company. In this series, Daniel Robbins shares his experiences as he redesigns the www.gentoo.org Web site using technologies like XML, XSLT, and Python. Along the way, you may find some excellent approaches to use for your next Web site redesign. In this article, Daniel creates a user-centric action plan and introduces pytext, an embedded Python interpreter.
+
</noinclude>
|Author=Drobbins
+
=== Installing a Bootloader ===
|Next in Series=The Gentoo.org Redesign, Part 2
+
}}
+
== An unruly horde ==
+
  
Fellow software developer, may I ask you a question? Why is it that although many of us are intimately familiar with Web technologies such as HTML, CGI, Perl, Python, Java technology, and XML, our very own Web sites -- the ones devoted to our precious development projects -- look like they were thrown together by an unruly horde of hyperactive 12-year-olds? Why, oh why, is this so?
+
These install instructions show you how to use GRUB to boot using BIOS (old-school) or UEFI (new-school).
  
Could it be because most of the time, we've left our Web site out to rot while we squander our precious time hacking away on our free software projects? The answer, at least in my case, is a most definite "Yes."
+
==== Old School (BIOS) ====
  
When I'm not writing articles for IBM developerWorks or being a new dad, I'm feverishly working on the next release of Gentoo Linux, along with my skilled team of volunteers. And, yes, Gentoo Linux has its own Web site (see Resources). As of right now (March 2001), our Web site isn't that special; that's because we don't spend much time working on it because we're generally engrossed in improving Gentoo Linux itself. Sure, our site does have several admittedly cute logos that I whipped up using Xara X (see Resources), but when you look past the eye candy, our site leaves a lot to be desired. Maybe yours does too. If so, I have one thing to say to you -- welcome to the club.
+
If you're using the BIOS to boot, setting up GRUB, the bootloader, is pretty easy.
  
==  www.gentoo.org ==
+
To use this recommended boot method, first emerge <code>boot-update</code>. This will also cause <code>grub-2</code> to be merged, since it is a dependency of <code>boot-update</code>.
  
In our case, our Web site dilemma exists because our project has been growing, and our Web site hasn't. Now that Gentoo Linux is approaching the 1.0 release (when it'll be officially ready for non-developers) and is growing in popularity, we need to start seriously looking at how our Web site can better serve its users. Here's a snapshot of www.gentoo.org:
+
<console>
 +
(chroot) # ##i##emerge boot-update
 +
</console>
  
<div style="margin: 10px;">[[File:L-redesign-01.gif|frame|class=img-responsive|The current (March 2001) state of affairs at www.gentoo.org]]</div>
+
Then, edit <code>/etc/boot.conf</code> and specify "<code>Funtoo Linux genkernel</code>" as the <code>default</code> setting at the top of the file, replacing <code>"Funtoo Linux"</code>.
  
As you can see, we have all the bare essentials -- a description of Gentoo Linux, a features list, a daily Changelog (automatically updated thanks to Python), and a bunch of important links (to the download sites, to our mailing list sign-up pages, and to cvsWeb). We also have links to three documentation resources -- the Gentoo Linux Install Guide and Development Guides, and Christian Zander's NVIDIA Troubleshooting Guide.
+
<code>/etc/boot.conf</code> should now look like this:
  
However, while the site seems O.K., we're missing a lot of things. The most obvious is documentation -- our installation and development guides need a lot of work. And then we need to add an FAQ, new links, new user information...the list is endless.
+
<pre>
 +
boot {
 +
generate grub
 +
default "Funtoo Linux genkernel"
 +
timeout 3
 +
}
  
== Content vs. display ==
+
"Funtoo Linux" {
 +
kernel bzImage[-v]
 +
}
  
And now we come to our second problem. Right now, all of our work is done in raw HTML; I hack away at the index.html file until it looks O.K. Even worse, our Web documentation is written in raw HTML. This isn't a good thing from a development perspective because our raw content (consisting of paragraphs, sections, chapters) is garbled together with a bunch of display-related HTML tags. This, of course, makes it difficult to change both the content and the look of our site. While this approach has worked so far, it is bound to cause problems as our site continues to grow.
+
"Funtoo Linux genkernel" {
 +
kernel kernel[-v]
 +
initrd initramfs[-v]
 +
params += real_root=auto
 +
}
  
Clearly, we need to be using better technologies behind the scenes. Instead of using HTML directly, we need to start using things like XML, XSLT, and Python. The goal is to automate as much as possible so that we can add and expand our site with ease. If we do our job well, even major future changes to our site should be relatively painless.
+
"Funtoo Linux better-initramfs" {
 +
kernel vmlinuz[-v]
 +
initrd /initramfs.cpio.gz
 +
}
 +
</pre>
  
== A strategy! ==
+
Please read <code>man boot.conf</code> for further details.
  
It was clear that we had a lot of work ahead of us. In fact, there was so much to be done that I didn't know where to begin. Just as I was trying to sort out everything in my head, I came across Laura Wonnacott's "Site Savvy" InfoWorld column (see Resources). In it, she explained the concept of "user-centric" design -- how to improve a Web site while keeping the needs of your target audience (in this case, Gentoo Linux users and developers) in focus. Reading the article and taking a look at the "Handbook of User-Centered Design" link from the article helped me to formulate a strategy -- an action plan -- for the redesign:
+
===== Running grub-install and boot-update =====
  
# First, clearly define the official goal of the Web site -- in writing. What's it there for, and what's it supposed to do?
+
Finally, we will need to actually install the GRUB boot loader to your disk, and also run <code>boot-update</code> which will generate your boot loader configuration file:
#  Identify the different categories of users who will be using your site -- your target audience. Rank them in order of priority: Which ones are most important to you?
+
# Set up a system for getting feedback from your target audience, so they can let you know what you're doing right and wrong.
+
# Evaluate the feedback, and use it to determine what parts of the site need to be improved or redesigned. Tackle high-priority sections first.
+
# Once you've selected the part of the site to improve, get to work! During your implementation, make sure that the content and design of the new section caters specifically to the needs of your target audience and fixes all known deficiencies.
+
# When the section redesign is complete, add it to your live site, even if it has a look that's markedly different from your current site. This way, your users can begin benefitting from the newly redesigned section immediately. If there's a problem with the redesign, you'll get user feedback more quickly. Finally, making incremental improvements to your site (rather than revamping the whole site and then rolling it out all at once -- surprise!) will help prevent your users from feeling alienated by your (possibly dramatic) site changes.
+
#  After completing step 6, jump to step 4 and repeat.
+
  
== The mission statement ==
+
<console>
 +
(chroot) # ##i##grub-install --no-floppy /dev/sda
 +
(chroot) # ##i##boot-update
 +
</console>
  
I was happy to discover that we already had step 3 in place. We had received several e-mail suggestions from visitors to the site, and our developer mailing list also served as a way of exchanging suggestions and comments. However, I had never really completed steps 1 or 2. While the answers may seem obvious, I did find it helpful to actually sit down and write out our mission statement:
+
Now you need to update your boot loader configuration file:
 +
<console>
 +
(chroot) # ##i##boot-update
 +
</console>
 +
You only need to run <code>grub-install</code> when you first install Funtoo Linux, but you need to re-run <code>boot-update</code> every time you modify your <code>/etc/boot.conf</code> file, so your changes are applied on next boot.
  
www.gentoo.org exists to assist those who use and develop for Gentoo Linux by providing relevant, up-to-date information about Gentoo Linux and Linux in general, focusing on topics related to Gentoo Linux installation, use, administration, and development. As the central hub for all things Gentoo, the site should also feature important news relevant to Gentoo Linux users and developers. In addition to catering to Gentoo Linux users and developers, www.gentoo.org has the secondary purpose of meeting the needs of potential Gentoo Linux users, providing the information they need to decide whether Gentoo Linux is right for them.
+
==== New School (UEFI) ====
  
== The target audience ==
+
If you're using UEFI to boot, setting up the boot loader is a bit more complicated for now, but this process will be improving soon. Perform the following steps.
  
So far, so good. Now for step 2 -- defining our target audience:
+
===== Emerging GRUB =====
  
www.gentoo.org has three target audiences -- Gentoo Linux developers, users, and potential users. While no one group is absolutely a higher priority than another, right now the needs of Gentoo Linux developers are our highest priority, followed by Gentoo Linux users, and then potential users. This is because Gentoo Linux is currently in a prerelease state. When Gentoo Linux reaches version 1.0, Gentoo Linux users and potential users will also become a priority.
+
You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this,  
 +
add the following line to <code>/etc/make.conf</code>:
  
== Comments and suggestions ==
+
<pre>
  
O.K., now it's time to evaluate the suggestions and comments we've collected:
+
For 64-bit systems:
  
Over the past few months, we've received a number of suggestions from Web site visitors. Overwhelmingly, people are requesting better documentation -- for both developers and users. Several developers have asked if we could create a mailing list that would be devoted exclusively to describing CVS commits.
+
GRUB_PLATFORMS="efi-64"
  
Interestingly, we've also received a couple of e-mails asking whether Gentoo Linux is a commercial or free product. I'm guessing that because our main logo is inscribed with the name "Gentoo Technologies, Inc." (our legal corporation name), people assume that we have a commercial focus. Modifying our logo so that it reads "Gentoo Linux" and adding small opening paragraph to the main page explaining that we are a free software project should help.
+
For 32-bit systems, i.e. Intel Atom devices:
  
== The improvement list ==
+
GRUB_PLATFORMS="efi-32"
  
O.K., now let's turn these suggestions into a list of possible improvements:
+
</pre>
  
* Revamp main page
+
Then, <code>emerge boot-update</code>. You will notice <code>grub</code> and <code>efibootmgr</code> getting pulled in as dependencies. This is expected and good:
** Implementation: update logo and add free software blurb
+
** Goal: to clearly state that we are a free software project
+
** Target group: potential users
+
**  Difficulty: medium
+
* Improve basic user documentation
+
**  Implementation: new XML/XSLT system, verbose documentation
+
** Goal: to make it easier for users to install Gentoo Linux
+
** Target group: new users
+
** Difficulty: medium
+
*Improve/create developer documentation
+
** Implementation: new XML/XSLT system, CVS guide, dev guide, Portage guide
+
**  Goal: to help our developers to do a great job
+
** Target group: developers
+
** Difficulty: hard
+
*Add a CVS mailing list
+
** Implementation: use our existing mailman mailing list manager
+
** Goal: to better inform our developers
+
** Target group: developers
+
** Difficulty: easy
+
  
== A selection! ==
+
<console>
 +
(chroot) # ##i##emerge boot-update
 +
</console>
  
Two things leap out from the list, for different reasons. The first is the CVS mailing list -- this one is a no-brainer because it's so easy to implement. Often, it makes sense to implement the easiest changes first so that users can benefit from them right away.
+
===== Installing GRUB =====
  
The second big thing that leaps out from the list is the need for developer documentation. This is a longer-term project that will require much more work. From my conversations with the other developers, we all appear to be in agreement that some kind of XML/XSL approach is the right solution.
+
Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to <tt>/boot</tt>. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command (for 32bit simply set it as efi-32):
  
== The XML/XSL prototype ==
+
<console>
 +
(chroot) # ##i##grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
 +
</console>
 +
This command will simply install all the stuff to <tt>/boot/EFI</tt> and <tt>/boot/grub</tt> that your system needs to boot. In particular, the <tt>/boot/EFI/grub/grubx64.efi</tt> file will be created. This is the GRUB boot image that UEFI will load and start.
  
To help start the process, I developed a prototype XML syntax to be used for all our online documentation. By using this XML syntax (called "guide"), our documentation will be clearly organized into paragraphs, sections, and chapters (using XML tags like <section>, <chapter>, etc.) while remaining free of any display-related tags. To create the HTML for display on our site, I created a prototype set of XSL transforms. By using an XSLT processor such as Sablotron, our guide XML files can be converted into HTML as follows:
+
A more detailed explanation of the flags used in the above command:
 +
* <code>--target=x86_64-efi</code>: Tells GRUB that we want to install it in a way that allows it to boot in UEFI
 +
* <code>--efi-directory=/boot</code>: All GRUB UEFI files will be installed in ''/boot''
 +
* <code>--bootloader-id="Funtoo Linux [GRUB]"</code>: This flag is not necessary for GRUB to boot. However, it allows you to change the text of the boot option in the UEFI BIOS. The stuff in the quotes can be set to anything that you would like.
 +
* <code>--recheck</code>: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed.
 +
* <code>/dev/sda</code>:The device that we are installing GRUB on.
  
devguide.xml + guide.xsl ---XSLT processor---> devguide.html
+
===== Configuring GRUB =====
  
The great thing about this XML/XSLT approach is that it separates our raw content (XML) from the display-related information contained in the guide.xsl (XSLT) file. If we ever need to update the look of our Web pages, we simply modify the guide.xsl file and run all our XML through the XSLT processor (Sablotron), creating updated HTML pages. Or, if we need to add a few chapters to the development guide, we can modify devguide.xml. Once we're done, we then run the XML through Sablotron, which then spits out a fully-formatted devguide.html file with several added chapters. Think of XML as the content and XSLT as the display-related formatting macros.
+
OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will use boot-update, but then edit our <code>/boot/grub/grub.cfg</code> to support UEFI booting.  
  
While our entire team is convinced that XML/XSLT is the way to go, we haven't yet agreed upon an official XML syntax. Achim, our development lead, suggested that we use docbook instead of rolling our own XML syntax. However, the prototype guide XML format has helped to start the decision-making process. Because we developers are going to be the ones using the XML/XSL on a daily basis, it's important to choose a solution that we're comfortable with and meets all of our needs. By my next article, I should have a working XML/XSL doc system to show off to you.
+
First, you will need to edit <code>/etc/boot.conf</code>. Format this as you would if you were booting without UEFI. If you are not sure how this should look, below is an example of what it could look like if you are booting from an unencrypted ext4 partition:
  
== Technology demo: pytext ==
+
{{file|name=/etc/boot.conf|desc=|body=
 +
boot {
 +
        generate grub
 +
        default "Funtoo Linux"
 +
        timeout 3
 +
}
  
For the most part, our current Web site isn't using any new or super-cool technologies that are worth mentioning. However, there's one notable exception -- our tiny pytext embedded Python interpreter.
+
"Funtoo Linux" {
 +
        kernel vmlinuz[-v]
 +
        params += rootfstype=ext4 root=/dev/sda2
 +
}
 +
}}
  
Like many of you, I'm a huge Python fan and much prefer it over other scripting languages, so when it came time to add some dynamic content to our Web site, I naturally wanted to use Python. And, as you probably know, when coding dynamic HTML content, it's usually much more convenient to embed the language commands inside the HTML, rather than the other way around. Thus, the need for an embedded Python interpreter that can take a document like this:
+
After you have edited your <code>/etc/boot.conf</code> file, run <code>boot-update</code>. You should now have a <code>/boot/grub/grub.cfg</code> file, which you can edit using the following command:
  
<pre>
+
<console>
<p>
+
# ##i##nano /boot/grub/grub.cfg
Yeah, sure; I got some questions:<br>
+
</console>
<!--code
+
names=["bob","jimmy","ralph"]
+
items=["socks","lunch","accordion"]
+
for x in items:
+
for y in names:
+
print "Anyone seen",y+"'s",x+"?<br>"
+
-->
+
See, told you so.
+
</pre>
+
  
....and transform it into this:
+
 
 +
To get your <code>/boot/grub/grub.cfg</code> to support booting with UEFI, make the following changes. Below the existing insmod lines, add the following lines. Both of these involve adding support for the UEFI framebuffer to GRUB.:
  
 
<pre>
 
<pre>
<p>
+
  insmod efi_gop
Yeah, sure; I got some questions:<br>
+
  insmod efi_uga
Anyone seen bob's socks?<br>
+
Anyone seen jimmy's socks?<br>
+
Anyone seen ralph's socks?<br>
+
Anyone seen bob's lunch?<br>
+
Anyone seen jimmy's lunch?<br>
+
Anyone seen ralph's lunch?<br>
+
Anyone seen bob's accordion?<br>
+
Anyone seen jimmy's accordion?<br>
+
Anyone seen ralph's accordion?<br>
+
See, told you so.
+
 
</pre>
 
</pre>
  
Here's the source code for pytext:
+
Then, change the <code>set gfxpayload</code> line to read as follows. UEFI does not support text mode, so we will keep video initialized to the current resolution.:
 
+
{{file|name=pytext|lang=python|desc=The pytext embedded Python interpreter|body=
+
#!/usr/bin/env python2
+
 
+
# pytext 2.1
+
# Copyright 1999-2001 Daniel Robbins
+
# Distributed under the GPL
+
 
+
import sys
+
 
+
def runfile(myarg):
+
  "interprets a text file with embedded elements"
+
  mylocals={}
+
  try:
+
      a=open(myarg,'r')
+
  except IOError:
+
      sys.stderr.write("!!! Error opening "+myarg+"!\n")
+
      return
+
  mylines=a.readlines()
+
  a.close()
+
  pos=0
+
  while pos<len(mylines):
+
      if mylines[pos][0:8]=="<!--code":
+
  mycode=""
+
  pos=pos+1
+
  while (pos<len(mylines)) and (mylines[pos][0:3]!="-->"):
+
      mycode=mycode+mylines[pos]
+
      pos=pos+1
+
  exec(mycode,globals(),mylocals)
+
      else:
+
  sys.stdout.write(mylines[pos])
+
      pos=pos+1
+
 
+
if len(sys.argv)>1:
+
  for x in sys.argv[1:]:
+
      runfile(x)
+
  sys.exit(0)
+
else:
+
  sys.stderr.write
+
    ("pytext 2.1 -- Copyright 1999-2001 Daniel Robbins. ")
+
  sys.stderr.write
+
    ("Distributed under the\nGNU Public License\n\n")
+
  sys.stderr.write
+
    ("Usage: "+sys.argv[0]+" file0 [file1]...\n")
+
  sys.exit(1)
+
}}
+
 
+
== How pytext works ==
+
 
+
Here's how it works. It scans each input line, and most of the time, each input line is simply echoed to stdout. However, if pytext encounters a line beginning with <!--code, then the contents of every line up to the first line beginning with --> are appended to a string called mycode. Pytext then executes the mycode string using the built-in exec() function, effectively creating an embedded Python interpreter.
+
 
+
There's something really beautiful about this particular implementation -- we call exec() in such a way that all modifications to the global and local namespaces are saved. This makes it possible to import a module or define a variable in one embedded block, and then access this previously-created object in a later block, as this example clearly demonstrates:
+
  
 
<pre>
 
<pre>
<!--code
+
  set gfxpayload=keep
import os
+
foo=23
+
-->
+
 
+
Hello
+
 
+
<!--code
+
print foo
+
if os.path.exists("/tmp/mytmpfile"):
+
print "it exists"
+
else:
+
print "I don't see it"
+
-->
+
 
</pre>
 
</pre>
  
Handy, eh? pytext serves is an excellent demonstration of the power of Python, and is an extremely useful tool for Python fans. For our current site, we call pytext from a cron job, using it to periodically generate the HTML code for our main page Changelog:
+
You can now save your changes by pressing <code>Control-X</code> and answering <code>y</code> when asked if you want to save the modified buffer. When prompted for a filename, hit Enter to use the existing filename.
 
+
<console>
+
$ ##i##pytext index.ehtml > index.html
+
</console>
+
 
+
That's it for now; I'll see you next time when we'll take a look at the first stage of the www.gentoo.org redesign!
+
{{ArticleFooter}}
+

Revision as of 07:26, January 1, 2015


Note

This is a template that is used as part of the Installation instructions which covers: boot loader configuration. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.


Installing a Bootloader

These install instructions show you how to use GRUB to boot using BIOS (old-school) or UEFI (new-school).

Old School (BIOS)

If you're using the BIOS to boot, setting up GRUB, the bootloader, is pretty easy.

To use this recommended boot method, first emerge boot-update. This will also cause grub-2 to be merged, since it is a dependency of boot-update.

(chroot) # emerge boot-update

Then, edit /etc/boot.conf and specify "Funtoo Linux genkernel" as the default setting at the top of the file, replacing "Funtoo Linux".

/etc/boot.conf should now look like this:

boot {
	generate grub
	default "Funtoo Linux genkernel" 
	timeout 3 
}

"Funtoo Linux" {
	kernel bzImage[-v]
}

"Funtoo Linux genkernel" {
	kernel kernel[-v]
	initrd initramfs[-v]
	params += real_root=auto 
} 

"Funtoo Linux better-initramfs" {
	kernel vmlinuz[-v]
	initrd /initramfs.cpio.gz
}

Please read man boot.conf for further details.

Running grub-install and boot-update

Finally, we will need to actually install the GRUB boot loader to your disk, and also run boot-update which will generate your boot loader configuration file:

(chroot) # grub-install --no-floppy /dev/sda
(chroot) # boot-update

Now you need to update your boot loader configuration file:

(chroot) # boot-update

You only need to run grub-install when you first install Funtoo Linux, but you need to re-run boot-update every time you modify your /etc/boot.conf file, so your changes are applied on next boot.

New School (UEFI)

If you're using UEFI to boot, setting up the boot loader is a bit more complicated for now, but this process will be improving soon. Perform the following steps.

Emerging GRUB

You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this, add the following line to /etc/make.conf:


For 64-bit systems:

GRUB_PLATFORMS="efi-64"

For 32-bit systems, i.e. Intel Atom devices:

GRUB_PLATFORMS="efi-32"

Then, emerge boot-update. You will notice grub and efibootmgr getting pulled in as dependencies. This is expected and good:

(chroot) # emerge boot-update
Installing GRUB

Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to /boot. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command (for 32bit simply set it as efi-32):

(chroot) # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda

This command will simply install all the stuff to /boot/EFI and /boot/grub that your system needs to boot. In particular, the /boot/EFI/grub/grubx64.efi file will be created. This is the GRUB boot image that UEFI will load and start.

A more detailed explanation of the flags used in the above command:

  • --target=x86_64-efi: Tells GRUB that we want to install it in a way that allows it to boot in UEFI
  • --efi-directory=/boot: All GRUB UEFI files will be installed in /boot
  • --bootloader-id="Funtoo Linux [GRUB]": This flag is not necessary for GRUB to boot. However, it allows you to change the text of the boot option in the UEFI BIOS. The stuff in the quotes can be set to anything that you would like.
  • --recheck: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed.
  • /dev/sda:The device that we are installing GRUB on.
Configuring GRUB

OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will use boot-update, but then edit our /boot/grub/grub.cfg to support UEFI booting.

First, you will need to edit /etc/boot.conf. Format this as you would if you were booting without UEFI. If you are not sure how this should look, below is an example of what it could look like if you are booting from an unencrypted ext4 partition:

/etc/boot.conf
boot {
        generate grub
        default "Funtoo Linux"
        timeout 3
}

"Funtoo Linux" {
        kernel vmlinuz[-v]
        params += rootfstype=ext4 root=/dev/sda2
}

After you have edited your /etc/boot.conf file, run boot-update. You should now have a /boot/grub/grub.cfg file, which you can edit using the following command:

# nano /boot/grub/grub.cfg


To get your /boot/grub/grub.cfg to support booting with UEFI, make the following changes. Below the existing insmod lines, add the following lines. Both of these involve adding support for the UEFI framebuffer to GRUB.:

  insmod efi_gop
  insmod efi_uga

Then, change the set gfxpayload line to read as follows. UEFI does not support text mode, so we will keep video initialized to the current resolution.:

  set gfxpayload=keep

You can now save your changes by pressing Control-X and answering y when asked if you want to save the modified buffer. When prompted for a filename, hit Enter to use the existing filename.