1 This is grub-dev.info, produced by makeinfo version 5.1 from
4 This developer manual is for GNU GRUB (version 2.02~beta2, 1 February
7 Copyright (C) 1999,2000,2001,2002,2004,2005,2006,2008,2009,2010,2011
8 Free Software Foundation, Inc.
10 Permission is granted to copy, distribute and/or modify this
11 document under the terms of the GNU Free Documentation License,
12 Version 1.2 or any later version published by the Free Software
13 Foundation; with no Invariant Sections.
14 INFO-DIR-SECTION Kernel
16 * grub-dev: (grub-dev). The GRand Unified Bootloader Dev
20 File: grub-dev.info, Node: Top, Next: Getting the source code, Up: (dir)
22 GNU GRUB developer manual
23 *************************
25 This is the developer documentation of GNU GRUB, the GRand Unified
26 Bootloader, a flexible and powerful boot loader program for a wide range
29 This edition documents version 2.02~beta2.
31 This developer manual is for GNU GRUB (version 2.02~beta2, 1 February
34 Copyright (C) 1999,2000,2001,2002,2004,2005,2006,2008,2009,2010,2011
35 Free Software Foundation, Inc.
37 Permission is granted to copy, distribute and/or modify this
38 document under the terms of the GNU Free Documentation License,
39 Version 1.2 or any later version published by the Free Software
40 Foundation; with no Invariant Sections.
44 * Getting the source code::
46 * Finding your way around::
47 * Contributing Changes::
50 * Stack and heap size::
51 * BIOS port memory map::
53 * PFF2 Font File Format::
54 * Graphical Menu Software Design::
55 * Copying This Manual:: Copying This Manual
59 File: grub-dev.info, Node: Getting the source code, Next: Coding style, Prev: Top, Up: Top
61 1 Getting the source code
62 *************************
64 GRUB is maintained using the <GIT revision control system>. To fetch:
66 git clone git://git.sv.gnu.org/grub.git
68 Web access is available under
69 http://git.savannah.gnu.org/cgit/grub.git/
71 The branches available are:
74 Main development branch.
76 GRUB 0.97 codebase. Kept for reference and legal reasons
78 Multiboot specfication
80 Multiboot2 specfication
82 Prefixed with developer name. Every developer of a team manages
83 his own branches. Developer branches do not need changelog
86 Once you have used 'git clone' to fetch an initial copy of a branch,
87 you can use 'git pull' to keep it up to date. If you have modified your
88 local version, you may need to resolve conflicts when pulling.
91 File: grub-dev.info, Node: Coding style, Next: Finding your way around, Prev: Getting the source code, Up: Top
96 Basically we follow the GNU Coding Standards
97 (http://www.gnu.org/prep/standards_toc.html). We define additional
98 conventions for GRUB here.
102 * Naming Conventions::
108 * Multi-Line Comments::
111 File: grub-dev.info, Node: Naming Conventions, Next: Functions, Up: Coding style
113 2.1 Naming Conventions
114 ======================
116 All global symbols (i.e. functions, variables, types, and macros) must
117 have the prefix grub_ or GRUB_. The all capital form is used only by
121 File: grub-dev.info, Node: Functions, Next: Variables, Prev: Naming Conventions, Up: Coding style
126 If a function is global, its name must be prefixed with grub_ and must
127 consist of only small letters. If the function belongs to a specific
128 function module, the name must also be prefixed with the module name.
129 For example, if a function is for file systems, its name is prefixed
130 with grub_fs_. If a function is for FAT file system but not for all
131 file systems, its name is prefixed with grub_fs_fat_. The hierarchy is
134 After a prefix, a function name must start with a verb (such as get
135 or is). It must not be a noun. Some kind of abbreviation is permitted,
136 as long as it wouldn't make code less readable (e.g. init).
138 If a function is local, its name may not start with any prefix. It
139 must start with a verb.
142 File: grub-dev.info, Node: Variables, Next: Types, Prev: Functions, Up: Coding style
147 The rule is mostly the same as functions, as noted above. If a variable
148 is global, its name must be prefixed with grub_ and must consist of only
149 small letters. If the variable belongs to a specific function module,
150 the name must also be prefixed with the module name. For example, if a
151 function is for dynamic loading, its name is prefixed with grub_dl_. If
152 a variable is for ELF but not for all dynamic loading systems, its name
153 is prefixed with grub_dl_elf_.
155 After a prefix, a variable name must start with a noun or an
156 adjective (such as name or long) and it should end with a noun. Some
157 kind of abbreviation is permitted, as long as it wouldn't make code less
158 readable (e.g. i18n).
160 If a variable is global in the scope of a single file (i.e. it is
161 declared with static), its name may not start with any prefix. It must
162 start with a noun or an adjective.
164 If a variable is local, you may choose any shorter name, as long as
165 it wouldn't make code less readable (e.g. i).
168 File: grub-dev.info, Node: Types, Next: Macros, Prev: Variables, Up: Coding style
173 The name of a type must be prefixed with grub_ and must consist of only
174 small letters. If the type belongs to a specific function module, the
175 name must also be prefixed with the module name. For example, if a type
176 is for OS loaders, its name is prefixed with grub_loader_. If a type is
177 for Multiboot but not for all OS loaders, its name is prefixed with
180 The name must be suffixed with _t, to emphasize the fact that it is a
181 type but not a variable or a function.
184 File: grub-dev.info, Node: Macros, Next: Comments, Prev: Types, Up: Coding style
189 If a macro is global, its name must be prefixed with GRUB_ and must
190 consist of only large letters. Other rules are the same as functions or
191 variables, depending on whether a macro is used like a function or a
195 File: grub-dev.info, Node: Comments, Next: Multi-Line Comments, Prev: Macros, Up: Coding style
200 All comments shall be C-style comments, of the form '/* ... */'.
202 Comments shall be placed only on a line by themselves. They shall
203 not be placed together with code, variable declarations, or other
204 non-comment entities. A comment should be placed immediately preceding
205 the entity it describes.
208 /* The page # that is the front buffer. */
210 /* The page # that is the back buffer. */
214 int displayed_page; /* The page # that is the front buffer. */
215 int render_page; /* The page # that is the back buffer. */
218 File: grub-dev.info, Node: Multi-Line Comments, Prev: Comments, Up: Coding style
220 2.7 Multi-Line Comments
221 =======================
223 Comments spanning multiple lines shall be formatted with all lines after
224 the first aligned with the first line.
226 Asterisk characters should not be repeated a the start of each
231 which spans multiple lines.
237 * which spans multiple lines.
240 The opening '/*' and closing '*/' should be placed together on a line
244 File: grub-dev.info, Node: Finding your way around, Next: Contributing Changes, Prev: Coding style, Up: Top
246 3 Finding your way around
247 *************************
249 Here is a brief map of the GRUB code base.
251 GRUB uses Autoconf and Automake, with most of the Automake input
252 generated by a Python script. The top-level build rules are in
253 'configure.ac', 'grub-core/Makefile.core.def', and 'Makefile.util.def'.
254 Each block in a '*.def' file represents a build target, and specifies
255 the source files used to build it on various platforms. The '*.def'
256 files are processed into Automake input by 'gentpl.py' (which you only
257 need to look at if you are extending the build system). If you are
258 adding a new module which follows an existing pattern, such as a new
259 command or a new filesystem implementation, it is usually easiest to
260 grep 'grub-core/Makefile.core.def' and 'Makefile.util.def' for an
261 existing example of that pattern to find out where it should be added.
263 In general, code that may be run at boot time is in a subdirectory of
264 'grub-core', while code that is only run from within a full operating
265 system is in a subdirectory of the top level.
267 Low-level boot code, such as the MBR implementation on PC BIOS
268 systems, is in the 'grub-core/boot/' directory.
270 The GRUB kernel is in 'grub-core/kern/'. This contains core
271 facilities such as the device, disk, and file frameworks, environment
272 variable handling, list processing, and so on. The kernel should
273 contain enough to get up to a rescue prompt. Header files for kernel
274 facilities, among others, are in 'include/'.
276 Terminal implementations are in 'grub-core/term/'.
278 Disk access code is spread across 'grub-core/disk/' (for accessing
279 the disk devices themselves), 'grub-core/partmap/' (for interpreting
280 partition table data), and 'grub-core/fs/' (for accessing filesystems).
281 Note that, with the odd specialised exception, GRUB only contains code
282 to _read_ from filesystems and tries to avoid containing any code to
283 _write_ to filesystems; this lets us confidently assure users that GRUB
284 cannot be responsible for filesystem corruption.
286 PCI and USB bus handling is in 'grub-core/bus/'.
288 Video handling code is in 'grub-core/video/'. The graphical menu
289 system uses this heavily, but is in a separate directory,
290 'grub-core/gfxmenu/'.
292 Most commands are implemented by files in 'grub-core/commands/', with
293 the following exceptions:
295 * A few core commands live in 'grub-core/kern/corecmd.c'.
297 * Commands related to normal mode live under 'grub-core/normal/'.
299 * Commands that load and boot kernels live under 'grub-core/loader/'.
301 * The 'loopback' command is really a disk device, and so lives in
302 'grub-core/disk/loopback.c'.
304 * The 'gettext' command lives under 'grub-core/gettext/'.
306 * The 'loadfont' and 'lsfonts' commands live under 'grub-core/font/'.
308 * The 'serial', 'terminfo', and 'background_image' commands live
309 under 'grub-core/term/'.
311 * The 'efiemu_*' commands live under 'grub-core/efiemu/'.
313 * OS-dependent code should be under 'grub-core/osdep/'
315 * Utility programs meant to be run from a full operating system
316 (except OS-dependent code mentioned previously) are in 'util/'.
318 There are a few other special-purpose exceptions; grep for them if
322 File: grub-dev.info, Node: Contributing Changes, Next: Porting, Prev: Finding your way around, Up: Top
324 4 Contributing changes
325 **********************
327 Contributing changes to GRUB 2 is welcomed activity. However we have a
328 bit of control what kind of changes will be accepted to GRUB 2.
329 Therefore it is important to discuss your changes on grub-devel mailing
330 list (see MailingLists). On this page there are some basic details on
331 the development process and activities.
333 First of all you should come up with the idea yourself what you want
334 to contribute. If you do not have that beforehand you are advised to
335 study this manual and try GRUB 2 out to see what you think is missing
338 Here are additional pointers:
339 * <https://savannah.gnu.org/task/?group=grub GRUB's Task Tracker>
340 * <https://savannah.gnu.org/bugs/?group=grub GRUB's Bug Tracker>
342 If you intended to make changes to GRUB Legacy (<=0.97) those are not
348 * Typical Developer Experience::
349 * When you are approved for write access to project's files::
352 File: grub-dev.info, Node: Getting started, Next: Typical Developer Experience, Up: Contributing Changes
357 * Always use latest GRUB 2 source code. So get that first.
359 For developers it is recommended always to use the newest
360 development version of GRUB 2. If development takes a long period
361 of time, please remember to keep in sync with newest developments
362 regularly so it is much easier to integrate your change in the
363 future. GRUB 2 is being developed in a GIT repository.
365 Please check Savannah's GRUB project page for details how to get
366 newest git: GRUB 2 git Repository
367 (https://savannah.gnu.org/git/?group=grub)
369 * Compile it and try it out.
371 It is always good idea to first see that things work somehow and
372 after that to start to implement new features or develop fixes to
377 There are sometimes odd ways to do things in GRUB 2 code base.
378 This is mainly related to limited environment where GRUB 2 is being
379 executed. You usually do not need to understand it all so it is
380 better to only try to look at places that relates to your work.
381 Please do not hesitate to ask for help if there is something that
382 you do not understand.
384 * Develop a new feature.
386 Now that you know what to do and how it should work in GRUB 2 code
387 base, please be free to develop it. If you have not so far
388 announced your idea on grub-devel mailing list, please do it now.
389 This is to make sure you are not wasting your time working on the
390 solution that will not be integrated to GRUB 2 code base.
392 You might want to study our coding style before starting
393 development so you do not need to change much of the code when your
394 patch is being reviewed. (see *note Coding style::)
396 For every accepted patch there has to exist a ChangeLog entry. Our
397 ChangeLog consist of changes within source code and are not
398 describing about what the change logically does. Please see
399 examples from previous entries.
401 Also remember that GRUB 2 is licensed under GPLv3 license and that
402 usually means that you are not allowed to copy pieces of code from
403 other projects. Even if the source project's license would be
404 compatible with GPLv3, please discuss it beforehand on grub-devel
409 Test that your change works properly. Try it out a couple of
410 times, preferably on different systems, and try to find problems
413 * Publish your change.
415 When you are happy with your change, first make sure it is
416 compilable with latest development version of GRUB 2. After that
417 please send a patch to grub-devel for review. Please describe in
418 your email why you made the change, what it changes and so on.
419 Please be prepared to receive even discouraging comments about your
420 patch. There is usually at least something that needs to be
421 improved in every patch.
423 Please use unified diff to make your patch (good match of arguments
424 for diff is '-pruN').
426 * Respond to received feedback.
428 If you are asked to modify your patch, please do that and resubmit
429 it for review. If your change is large you are required to submit
430 a copyright agreement to FSF. Please keep in mind that if you are
431 asked to submit for copyright agreement, process can take some time
432 and is mandatory in order to get your changes integrated.
434 If you are not on grub-devel to respond to questions, most likely
435 your patch will not be accepted. Also if problems arise from your
436 changes later on, it would be preferable that you also fix the
437 problem. So stay around for a while.
439 * Your patch is accepted.
441 Good job! Your patch will now be integrated into GRUB 2 mainline,
442 and if it didn't break anything it will be publicly available in
445 Now you are welcome to do further improvements :)
448 File: grub-dev.info, Node: Typical Developer Experience, Next: When you are approved for write access to project's files, Prev: Getting started, Up: Contributing Changes
450 4.2 Typical Developer Experience
451 ================================
453 The typical experience for a developer in this project is the following:
455 1. You find yourself wanting to do something (e.g. fixing a bug).
456 2. You show some result in the mailing list or the IRC.
457 3. You are getting to be known to other developers.
458 4. You accumulate significant amount of contribution, so copyright
459 assignment is processed.
460 5. You are free to check in your changes on your own, legally
463 At this point, it is rather annoying that you ought to ask somebody
464 else every change to be checked in. For efficiency, it is far better,
465 if you can commit it yourself. Therefore, our policy is to give you the
466 write permission to our official repository, once you have shown your
467 skill and will, and the FSF clerks have dealt with your copyright
471 File: grub-dev.info, Node: When you are approved for write access to project's files, Prev: Typical Developer Experience, Up: Contributing Changes
473 4.3 When you are approved for write access to project's files
474 =============================================================
476 As you might know, GRUB is hosted on
477 <https://savannah.gnu.org/projects/grub Savannah>, thus the membership
478 is managed by Savannah. This means that, if you want to be a member of
481 1. You need to create your own account on Savannah.
482 2. You can submit "Request for Inclusion" from "My Groups" on
485 Then, one of the admins can approve your request, and you will be a
486 member. If you don't want to use the Savannah interface to submit a
487 request, you can simply notify the admins by email or something else,
488 alternatively. But you still need to create an account beforehand.
490 NOTE: we sometimes receive a "Request for Inclusion" from an unknown
491 person. In this case, the request would be just discarded, since it is
492 too dangerous to allow a stranger to be a member, which automatically
493 gives him a commit right to the repository, both for a legal reason and
494 for a technical reason.
496 If your intention is to just get started, please do not submit a
497 inclusion request. Instead, please subscribe to the mailing list, and
498 communicate first (e.g. sending a patch, asking a question, commenting
499 on another message...).
502 File: grub-dev.info, Node: Porting, Next: Error Handling, Prev: Contributing Changes, Up: Top
507 GRUB2 is designed to be easily portable accross platforms. But because
508 of the nature of bootloader every new port must be done separately.
509 Here is how I did MIPS (loongson and ARC) and Xen ports. Note than this
510 is more of suggestions, not absolute truth.
512 First of all grab any architecture specifications you can find in
513 public (please avoid NDA).
515 First stage is "Hello world". I've done it outside of GRUB for
516 simplicity. Your task is to have a small program which is loadable as
517 bootloader and clearly shows its presence to you. If you have easily
518 accessible console you can just print a message. If you have a mapped
519 framebuffer you know address of, you can draw a square. If you have a
520 debug facility, just hanging without crashing might be enough. For the
521 first stage you can choose to load the bootloader across the network
522 since format for network image is often easier than for local boot and
523 it skips the need of small intermediary stages and nvram handling.
524 Additionally you can often have a good idea of the needed format by
525 running "file" on any netbootable executable for given platform.
527 This program should probably have 2 parts: an assembler and C one.
528 Assembler one handles BSS cleaning and other needed setup (on some
529 platforms you may need to switch modes or copy the executable to its
530 definitive position). So your code may look like (x86 assembly for
531 illustration purposes)
535 movl $_bss_start, %edi
545 static const char msg[] = "Hello, world";
556 const char *ptr = msg;
562 Sometimes you need a third file: assembly stubs for
565 Once this file is functional it's time to move it into GRUB2. The
566 startup assembly file goes to grub-core/kern/$cpu/$platform/startup.S.
567 You should also include grub/symbol.h and replace call to entry point
568 with call to EXT_C(grub_main). The C file goes to
569 grub-core/kern/$cpu/$platform/init.c and its entry point is renamed to
570 void grub_machine_init (void). Keep final infinite loop for now. Stubs
571 file if any goes to grub-core/kern/$cpu/$platform/callwrap.S. Sometimes
572 either $cpu or $platform is dropped if file is used on several cpus
573 respectivelyplatforms. Check those locations if they already have what
576 Then modify in configure.ac the following parts:
580 case "$target_cpu" in
581 i[[3456]]86) target_cpu=i386 ;;
582 amd64) target_cpu=x86_64 ;;
583 sparc) target_cpu=sparc64 ;;
584 s390x) target_cpu=s390 ;;
588 Sometimes CPU have additional architecture names which don't
589 influence booting. You might want to have some canonical name to avoid
590 having bunch of identical platforms with different names.
592 NOTE: it doesn't influence compile optimisations which depend solely
593 on chosen compiler and compile options.
595 if test "x$with_platform" = x; then
596 case "$target_cpu"-"$target_vendor" in
597 i386-apple) platform=efi ;;
598 i386-*) platform=pc ;;
599 x86_64-apple) platform=efi ;;
600 x86_64-*) platform=pc ;;
601 powerpc-*) platform=ieee1275 ;;
608 This part deals with guessing the platform from CPU and vendor.
609 Sometimes you need to use 32-bit mode for booting even if OS runs in
610 64-bit one. If so add your platform to:
612 case "$target_cpu"-"$platform" in
615 x86_64-*) target_cpu=i386 ;;
616 powerpc64-ieee1275) target_cpu=powerpc ;;
619 Add your platform to the list of supported ones:
621 case "$target_cpu"-"$platform" in
630 If explicit -m32 or -m64 is needed add it to:
632 case "$target_cpu" in
633 i386 | powerpc) target_m32=1 ;;
634 x86_64 | sparc64) target_m64=1 ;;
637 Finally you need to add a conditional to the following block:
639 AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
640 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
641 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
643 Next stop is gentpl.py. You need to add your platform to the list of
644 supported ones (sorry that this list is duplicated):
646 GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
647 "i386_multiboot", "i386_ieee1275", "x86_64_efi",
648 "mips_loongson", "sparc64_ieee1275",
649 "powerpc_ieee1275", "mips_arc", "ia64_efi",
650 "mips_qemu_mips", "s390_mainframe" ]
652 You may also want already to add new platform to one or several of
653 available groups. In particular we always have a group for each CPU
654 even when only one platform for given CPU is available.
656 Then comes grub-core/Makefile.core.def. In the block "kernel" you'll
657 need to define ldflags for your platform ($cpu_$platform_ldflags). You
658 also need to declare startup asm file ($cpu_$platform_startup) as well
659 as any other files (e.g. init.c and callwrap.S) (e.g. $cpu_$platform =
660 kern/$cpu/$platform/init.c). At this stage you will also need to add
661 dummy dl.c and cache.S with functions grub_err_t
662 grub_arch_dl_check_header (void *ehdr), grub_err_t
663 grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) (dl.c) and
664 void grub_arch_sync_caches (void *address, grub_size_t len) (cache.S).
665 They won't be used for now.
667 You will need to create directory include/$cpu/$platform and a file
668 include/$cpu/types.h. The later folowing this template:
670 #ifndef GRUB_TYPES_CPU_HEADER
671 #define GRUB_TYPES_CPU_HEADER 1
673 /* The size of void *. */
674 #define GRUB_TARGET_SIZEOF_VOID_P 4
676 /* The size of long. */
677 #define GRUB_TARGET_SIZEOF_LONG 4
679 /* mycpu is big-endian. */
680 #define GRUB_TARGET_WORDS_BIGENDIAN 1
681 /* Alternatively: mycpu is little-endian. */
682 #undef GRUB_TARGET_WORDS_BIGENDIAN
684 #endif /* ! GRUB_TYPES_CPU_HEADER */
686 You will also need to add a dummy file to datetime and setjmp modules
687 to avoid any of it having no files. It can be just completely empty at
690 You'll need to make grub-mkimage.c (util/grub_mkimage.c) aware of the
691 needed format. For most commonly used formats like ELF, PE, aout or raw
692 the support is already present and you'll need to make it follow the
693 existant code paths for your platform adding adjustments if necessary.
697 ./configure --target=$cpu --with-platform=$platform TARGET_CC=.. OBJCOPY=... STRIP=...
702 ./grub-mkimage -d grub-core -O $format_id -o test.img
704 And it's time to test your test.img.
706 If it works next stage is to have heap, console and timer.
708 To have the heap working you need to determine which regions are
709 suitable for heap usage, allocate them from firmware and map (if
710 applicable). Then call grub_mm_init_region (vois *start, grub_size_t s)
711 for every of this region. As a shortcut for early port you can allocate
712 right after _end or have a big static array for heap. If you do you'll
713 probably need to come back to this later. As for output console you
714 should distinguish between an array of text, terminfo or graphics-based
715 console. Many of real-world examples don't fit perfectly into any of
716 these categories but one of the models is easier to be used as base. In
717 second and third case you should add your platform to terminfokernel
718 respectively videoinkernel group. A good example of array of text is
719 i386-pc (kern/i386/pc/init.c and term/i386/pc/console.c). Of terminfo
720 is ieee1275 (kern/ieee1275/init.c and term/ieee1275/console.c). Of
721 video is loongson (kern/mips/loongson/init.c). Note that terminfo has
722 to be inited in 2 stages: one before (to get at least rudimentary
723 console as early as possible) and another after the heap (to get
724 full-featured console). For the input there are string of keys,
725 terminfo and direct hardware. For string of keys look at i386-pc (same
726 files), for termino ieee1275 (same files) and for hardware loongson
727 (kern/mips/loongson/init.c and term/at_keyboard.c).
729 For the timer you'll need to call grub_install_get_time_ms (...)
730 with as sole argument a function returning a grub_uint64_t of a number
731 of milliseconds elapsed since arbitrary point in the past.
733 Once these steps accomplished you can remove the inifinite loop and
734 you should be able to get to the minimal console. Next step is to have
735 module loading working. For this you'll need to fill kern/$cpu/dl.c and
736 kern/$cpu/cache.S with real handling of relocations and respectively the
737 real sync of I and D caches. Also you'll need to decide where in the
738 image to store the modules. Usual way is to have it concatenated at the
739 end. In this case you'll need to modify startup.S to copy modules out
740 of bss to let's say ALIGN_UP (_end, 8) before cleaning out bss. You'll
741 probably find useful to add total_module_size field to startup.S. In
742 init.c you need to set grub_modbase to the address where modules can be
743 found. You may need grub_modules_get_end () to avoid declaring the
744 space occupied by modules as usable for heap. You can test modules
747 ./grub-mkimage -d grub-core -O $format_id -o test.img hello
749 and then running "hello" in the shell.
751 Once this works, you should think of implementing disk access. Look
752 around disk/ for examples.
754 Then, very importantly, you probably need to implement the actual
755 loader (examples available in loader/)
757 Last step to have minimally usable port is to add support to
758 grub-install to put GRUB in a place where firmware or platform will pick
761 Next steps are: filling datetime.c, setjmp.S, network (net/drivers),
762 video (video/), halt (lib/), reboot (lib/).
764 Please add your platform to Platform limitations and Supported
765 kernels chapter in user documentation and mention any steps you skipped
766 which result in reduced features or performance. Here is the quick
767 checklist of features. Some of them are less important than others and
768 skipping them is completely ok, just needs to be mentioned in user
772 * Is heap big enough?
773 * Which charset is supported by console?
774 * Does platform have disk driver?
775 * Do you have network card support?
776 * Are you able to retrieve datetime (with date)?
777 * Are you able to set datetime (with date)?
778 * Is serial supported?
779 * Do you have direct disk support?
780 * Do you have direct keyboard support?
781 * Do you have USB support?
782 * Do you support loading through network?
783 * Do you support loading from disk?
784 * Do you support chainloading?
785 * Do you support network chainloading?
786 * Does cpuid command supports checking all CPU features that the user
787 might want conditionalise on (64-bit mode, hypervisor,...)
788 * Do you support hints? How reliable are they?
789 * Does platform have ACPI? If so do "acpi" and "lsacpi" modules work?
790 * Do any of platform-specific operations mentioned in the relevant
791 section of user manual makes sense on your platform?
792 * Does your platform support PCI? If so is there an appropriate
794 * Do you support badram?
797 File: grub-dev.info, Node: Error Handling, Next: Stack and heap size, Prev: Porting, Up: Top
802 Error handling in GRUB 2 is based on exception handling model. As C
803 language doesn't directly support exceptions, exception handling
804 behavior is emulated in software.
806 When exception is raised, function must return to calling function.
807 If calling function does not provide handling of the exception it must
808 return back to its calling function and so on, until exception is
809 handled. If exception is not handled before prompt is displayed, error
810 message will be shown to user.
812 Exception information is stored on 'grub_errno' global variable. If
813 'grub_errno' variable contains value 'GRUB_ERR_NONE', there is no active
814 exception and application can continue normal processing. When
815 'grub_errno' has other value, it is required that application code
816 either handles this error or returns instantly to caller. If function
817 is with return type 'grub_err_t' is about to return 'GRUB_ERR_NONE', it
818 should not set 'grub_errno' to that value. Only set 'grub_errno' in
819 cases where there is error situation.
821 Simple exception forwarder.
823 forwarding_example (void)
825 /* Call function that might cause exception. */
828 /* No special exception handler, just forward possible exceptions. */
829 if (grub_errno != GRUB_ERR_NONE)
834 /* All is OK, do more processing. */
836 /* Return OK signal, to caller. */
837 return GRUB_ERR_NONE;
840 Error reporting has two components, the actual error code (of type
841 'grub_err_t') and textual message that will be displayed to user. List
842 of valid error codes is listed in header file 'include/grub/err.h'.
843 Textual error message can contain any textual data. At time of writing,
844 error message can contain up to 256 characters (including terminating
845 NUL). To ease error reporting there is a helper function 'grub_error'
846 that allows easier formatting of error messages and should be used
847 instead of writing directly to global variables.
849 Example of error reporting.
853 return grub_error (GRUB_ERR_FILE_NOT_FOUND,
854 "Failed to read %s, tried %d times.",
859 If there is a special reason that error code does not need to be
860 taken account, 'grub_errno' can be zeroed back to 'GRUB_ERR_NONE'. In
861 cases like this all previous error codes should have been handled
862 correctly. This makes sure that there are no unhandled exceptions.
864 Example of zeroing 'grub_errno'.
868 /* Try to probe device type 1. */
870 if (grub_errno == GRUB_ERR_NONE)
872 /* Device type 1 was found on system. */
874 return GRUB_ERR_NONE;
876 /* Zero out error code. */
877 grub_errno = GRUB_ERR_NONE;
879 /* No device type 1 found, try to probe device type 2. */
880 probe_for_device2 ();
881 if (grub_errno == GRUB_ERR_NONE)
883 /* Device type 2 was found on system. */
885 return GRUB_ERR_NONE;
887 /* Zero out error code. */
888 grub_errno = GRUB_ERR_NONE;
890 /* Return custom error message. */
891 return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No device type 1 or 2 found.");
894 Some times there is a need to continue processing even if there is a
895 error state in application. In situations like this, there is a needed
896 to save old error state and then call other functions that might fail.
897 To aid in this, there is a error stack implemented. Error state can be
898 pushed to error stack by calling function 'grub_error_push ()'. When
899 processing has been completed, 'grub_error_pop ()' can be used to pop
900 error state from stack. Error stack contains predefined amount of error
901 stack items. Error stack is protected for overflow and marks these
902 situations so overflow error does not get unseen. If there is no space
903 available to store error message, it is simply discarded and overflow
904 will be marked as happened. When overflow happens, it most likely will
905 corrupt error stack consistency as for pushed error there is no matching
906 pop, but overflow message will be shown to inform user about the
907 situation. Overflow message will be shown at time when prompt is about
910 Example usage of error stack.
911 /* Save possible old error message. */
914 /* Do your stuff here. */
915 call_possibly_failing_function ();
917 if (grub_errno != GRUB_ERR_NONE)
919 /* Inform rest of the code that there is error (grub_errno
920 is set). There is no pop here as we want both error states
925 /* Restore old error state by popping previous item from stack. */
929 File: grub-dev.info, Node: Stack and heap size, Next: BIOS port memory map, Prev: Error Handling, Up: Top
931 7 Stack and heap size
932 *********************
934 On emu stack and heap are just normal host OS stack and heap. Stack is
935 typically 8 MiB although it's OS-dependent.
937 On i386-pc, i386-coreboot, i386-qemu and i386-multiboot the stack is
938 60KiB. All available space between 1MiB and 4GiB marks is part of heap.
940 On *-xen stack is 4MiB. If compiled for x86-64 with GCC 4.4 or later
941 adressable space is unlimited. When compiled for x86-64 with older GCC
942 version adressable space is limited to 2GiB. When compiling for i386
943 adressable space is limited to 4GiB. All adressable pages except the
944 ones for stack, GRUB binary, special pages and page table are in the
947 On *-efi GRUB uses same stack as EFI. If compiled for x86-64 with GCC
948 4.4 or later adressable space is unlimited. When compiled for x86-64
949 with older GCC version adressable space is limited to 2GiB. For all
950 other platforms adressable space is limited to 4GiB. GRUB allocates
951 pages from EFI for its heap, at most 1.6 GiB.
953 On i386-ieee1275 and powerpc-ieee1275 GRUB uses same stack as
954 IEEE1275. It allocates at most 32MiB for its heap.
956 On sparc64-ieee1275 stack is 256KiB and heap is 2MiB.
958 On mips(el)-qemu_mips and mipsel-loongson stack is 2MiB (everything
959 below GRUB image) and everything above GRUB image (from 2MiB + kernel
960 size) until 256MiB is part of heap.
962 On mips-arc stack is 2MiB (everything below GRUB image) and
963 everything above GRUB image(from 2MiB + kernel size) until 128MiB is
966 On mipsel-arc stack is 2MiB (everything below GRUB image which is not
967 part of ARC) and everything above GRUB image (from 7MiB + kernel size)
968 until 256MiB is part of heap.
970 On arm-uboot stack is 256KiB and heap is 2MiB.
975 --------------------------------------------------------------------
977 i386-pc 60 KiB < 4 GiB
978 i386-coreboot60 KiB < 4 GiB
979 i386-multiboot60 KiB < 4 GiB
980 i386-qemu 60 KiB < 4 GiB
982 i386-ieee1275? < 32 MiB
983 powerpc-ieee1275? < 32 MiB
984 sparc64-ieee1275256KiB 2 MiB
985 arm-uboot 256KiB 2 MiB
986 mips(el)-qemu_mips2MiB 253 MiB
987 mipsel-loongson2MiB 253 MiB
988 mips-arc 2MiB 125 MiB
989 mipsel-arc 2MiB 248 MiB
990 x86_64-xen 4MiB unlimited
993 x86_64-xen 4MiB < 2GiB
999 File: grub-dev.info, Node: BIOS port memory map, Next: Video Subsystem, Prev: Stack and heap size, Up: Top
1001 8 BIOS port memory map
1002 **********************
1005 --------------------------------------------------------------------
1006 0 0x1000 - 1 BIOS and real mode interrupts
1007 0x07BE 0x07FF Partition table passed to another
1009 ? 0x2000 - 1 Real mode stack
1010 0x7C00 0x7D00 - 1 Boot sector
1011 0x8000 ? GRUB kernel
1012 0x68000 0x71000 - 1 Disk buffer
1013 ? 0x80000 - 1 Protected mode stack
1014 ? 0xA0000 - 1 Extended BIOS Data Area
1015 0xA0000 0xC0000 - 1 Video RAM
1016 0xC0000 0x100000 - 1 BIOS
1017 0x100000 ? Heap and module code
1020 File: grub-dev.info, Node: Video Subsystem, Next: PFF2 Font File Format, Prev: BIOS port memory map, Up: Top
1025 This document contains specification for Video Subsystem for GRUB2.
1026 Currently only the usage interface is described in this document.
1027 Internal structure of how video drivers are registering and how video
1028 driver manager works are not included here.
1033 * Example usage of Video API::
1037 File: grub-dev.info, Node: Video API, Next: Example usage of Video API, Up: Video Subsystem
1042 9.1.1 grub_video_setup
1043 ----------------------
1047 grub_video_setup (unsigned int width, unsigned int height, unsigned int mode_type);
1050 Driver will use information provided to it to select best possible
1051 video mode and switch to it. Supported values for 'mode_type' are
1052 'GRUB_VIDEO_MODE_TYPE_INDEX_COLOR' for index color modes,
1053 'GRUB_VIDEO_MODE_TYPE_RGB' for direct RGB color modes and
1054 'GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED' for double buffering. When
1055 requesting RGB mode, highest bits per pixel mode will be selected.
1056 When requesting Index color mode, mode with highest number of
1057 colors will be selected. If all parameters are specified as zero,
1058 video adapter will try to figure out best possible mode and
1059 initialize it, platform specific differences are allowed here. If
1060 there is no mode matching request, error X will be returned. If
1061 there are no problems, function returns 'GRUB_ERR_NONE'.
1063 This function also performs following task upon succesful mode
1064 switch. Active rendering target is changed to screen and viewport
1065 is maximized to allow whole screen to be used when performing
1066 graphics operations. In RGB modes, emulated palette gets 16
1067 entries containing default values for VGA palette, other colors are
1068 defined as black. When switching to Indexed Color mode, driver may
1069 set default VGA palette to screen if the video card allows the
1072 9.1.2 grub_video_restore
1073 ------------------------
1078 grub_video_restore (void);
1081 Video subsystem will deinitialize activated video driver to restore
1082 old state of video device. This can be used to switch back to text
1085 9.1.3 grub_video_get_info
1086 -------------------------
1091 grub_video_get_info (struct grub_video_mode_info *mode_info);
1092 struct grub_video_mode_info
1094 /* Width of the screen. */
1096 /* Height of the screen. */
1097 unsigned int height;
1098 /* Mode type bitmask. Contains information like is it Index color or
1100 unsigned int mode_type;
1101 /* Bits per pixel. */
1103 /* Bytes per pixel. */
1104 unsigned int bytes_per_pixel;
1105 /* Pitch of one scanline. How many bytes there are for scanline. */
1107 /* In index color mode, number of colors. In RGB mode this is 256. */
1108 unsigned int number_of_colors;
1109 /* Optimization hint how binary data is coded. */
1110 enum grub_video_blit_format blit_format;
1111 /* How many bits are reserved for red color. */
1112 unsigned int red_mask_size;
1113 /* What is location of red color bits. In Index Color mode, this is 0. */
1114 unsigned int red_field_pos;
1115 /* How many bits are reserved for green color. */
1116 unsigned int green_mask_size;
1117 /* What is location of green color bits. In Index Color mode, this is 0. */
1118 unsigned int green_field_pos;
1119 /* How many bits are reserved for blue color. */
1120 unsigned int blue_mask_size;
1121 /* What is location of blue color bits. In Index Color mode, this is 0. */
1122 unsigned int blue_field_pos;
1123 /* How many bits are reserved in color. */
1124 unsigned int reserved_mask_size;
1125 /* What is location of reserved color bits. In Index Color mode,
1127 unsigned int reserved_field_pos;
1131 Software developer can use this function to query properties of
1132 active rendering taget. Information provided here can be used by
1133 other parts of GRUB, like image loaders to convert loaded images to
1134 correct screen format to allow more optimized blitters to be used.
1135 If there there is no configured video driver with active screen,
1136 error 'GRUB_ERR_BAD_DEVICE' is returned, otherwise 'mode_info' is
1137 filled with valid information and 'GRUB_ERR_NONE' is returned.
1139 9.1.4 grub_video_get_blit_format
1140 --------------------------------
1144 enum grub_video_blit_format
1145 grub_video_get_blit_format (struct grub_video_mode_info *mode_info);
1146 enum grub_video_blit_format
1148 /* Follow exactly field & mask information. */
1149 GRUB_VIDEO_BLIT_FORMAT_RGBA,
1150 /* Make optimization assumption. */
1151 GRUB_VIDEO_BLIT_FORMAT_R8G8B8A8,
1152 /* Follow exactly field & mask information. */
1153 GRUB_VIDEO_BLIT_FORMAT_RGB,
1154 /* Make optimization assumption. */
1155 GRUB_VIDEO_BLIT_FORMAT_R8G8B8,
1156 /* When needed, decode color or just use value as is. */
1157 GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR
1161 Used to query how data could be optimized to suit specified video
1162 mode. Returns exact video format type, or a generic one if there
1163 is no definition for the type. For generic formats, use
1164 'grub_video_get_info' to query video color coding settings.
1166 9.1.5 grub_video_set_palette
1167 ----------------------------
1172 grub_video_set_palette (unsigned int start, unsigned int count, struct grub_video_palette_data *palette_data);
1173 struct grub_video_palette_data
1175 grub_uint8_t r; /* Red color value (0-255). */
1176 grub_uint8_t g; /* Green color value (0-255). */
1177 grub_uint8_t b; /* Blue color value (0-255). */
1178 grub_uint8_t a; /* Reserved bits value (0-255). */
1182 Used to setup indexed color palettes. If mode is RGB mode, colors
1183 will be set to emulated palette data. In Indexed Color modes,
1184 palettes will be set to hardware. Color values will be converted
1185 to suit requirements of the video mode. 'start' will tell what
1186 hardware color index (or emulated color index) will be set to
1187 according information in first indice of 'palette_data', after that
1188 both hardware color index and 'palette_data' index will be
1189 incremented until 'count' number of colors have been set.
1191 9.1.6 grub_video_get_palette
1192 ----------------------------
1197 grub_video_get_palette (unsigned int start, unsigned int count, struct grub_video_palette_data *palette_data);
1198 struct grub_video_palette_data
1200 grub_uint8_t r; /* Red color value (0-255). */
1201 grub_uint8_t g; /* Green color value (0-255). */
1202 grub_uint8_t b; /* Blue color value (0-255). */
1203 grub_uint8_t a; /* Reserved bits value (0-255). */
1207 Used to query indexed color palettes. If mode is RGB mode, colors
1208 will be copied from emulated palette data. In Indexed Color modes,
1209 palettes will be read from hardware. Color values will be
1210 converted to suit structure format. 'start' will tell what
1211 hardware color index (or emulated color index) will be used as a
1212 source for first indice of 'palette_data', after that both hardware
1213 color index and 'palette_data' index will be incremented until
1214 'count' number of colors have been read.
1216 9.1.7 grub_video_set_area_status
1217 --------------------------------
1221 grub_video_set_area_status (grub_video_area_status_t area_status);
1222 enum grub_video_area_status_t
1224 GRUB_VIDEO_AREA_DISABLED,
1225 GRUB_VIDEO_AREA_ENABLED
1230 Used to set area drawing mode for redrawing the specified region.
1231 Draw commands are performed in the intersection of the viewport and
1232 the region called area. Coordinates remain related to the
1233 viewport. If draw commands try to draw over the area, they are
1234 clipped. Set status to DISABLED if you need to draw everything.
1235 Set status to ENABLED and region to the desired rectangle to redraw
1236 everything inside the region leaving everything else intact.
1237 Should be used for redrawing of active elements.
1239 9.1.8 grub_video_get_area_status
1240 --------------------------------
1244 grub_video_get_area_status (grub_video_area_status_t *area_status);
1246 * Description: Used to query the area status.
1248 9.1.9 grub_video_set_viewport
1249 -----------------------------
1254 grub_video_set_viewport (unsigned int x, unsigned int y, unsigned int width, unsigned int height);
1257 Used to specify viewport where draw commands are performed. When
1258 viewport is set, all draw commands coordinates relate to those
1259 specified by 'x' and 'y'. If draw commands try to draw over
1260 viewport, they are clipped. If developer requests larger than
1261 possible viewport, width and height will be clamped to fit screen.
1262 If 'x' and 'y' are out of bounds, all functions drawing to screen
1263 will not be displayed. In order to maximize viewport, use
1264 'grub_video_get_info' to query actual screen dimensions and provide
1265 that information to this function.
1267 9.1.10 grub_video_get_viewport
1268 ------------------------------
1273 grub_video_get_viewport (unsigned int *x, unsigned int *y, unsigned int *width, unsigned int *height);
1276 Used to query current viewport dimensions. Software developer can
1277 use this to choose best way to render contents of the viewport.
1279 9.1.11 grub_video_set_region
1280 ----------------------------
1285 grub_video_set_region (unsigned int x, unsigned int y, unsigned int width, unsigned int height);
1288 Used to specify the region of the screen which should be redrawn.
1289 Use absolute values. When the region is set and area status is
1290 ENABLE all draw commands will be performed inside the interseption
1291 of region and viewport named area. If draw commands try to draw
1292 over viewport, they are clipped. If developer requests larger than
1293 possible region, width and height will be clamped to fit screen.
1294 Should be used for redrawing of active elements.
1296 9.1.12 grub_video_get_region
1297 ----------------------------
1302 grub_video_get_region (unsigned int *x, unsigned int *y, unsigned int *width, unsigned int *height);
1305 Used to query current region dimensions.
1307 9.1.13 grub_video_map_color
1308 ---------------------------
1313 grub_video_map_color (grub_uint32_t color_name);
1316 Map color can be used to support color themes in GRUB. There will
1317 be collection of color names that can be used to query actual
1318 screen mapped color data. Examples could be
1319 'GRUB_COLOR_CONSOLE_BACKGROUND', 'GRUB_COLOR_CONSOLE_TEXT'. The
1320 actual color defines are not specified at this point.
1322 9.1.14 grub_video_map_rgb
1323 -------------------------
1328 grub_video_map_rgb (grub_uint8_t red, grub_uint8_t green, grub_uint8_t blue);
1331 Map RGB values to compatible screen color data. Values are
1332 expected to be in range 0-255 and in RGB modes they will be
1333 converted to screen color data. In index color modes, index color
1334 palette will be searched for specified color and then index is
1337 9.1.15 grub_video_map_rgba
1338 --------------------------
1343 grub_video_map_rgba (grub_uint8_t red, grub_uint8_t green, grub_uint8_t blue, grub_uint8_t alpha);
1346 Map RGBA values to compatible screen color data. Values are
1347 expected to be in range 0-255. In RGBA modes they will be
1348 converted to screen color data. In index color modes, index color
1349 palette will be searched for best matching color and its index is
1352 9.1.16 grub_video_unmap_color
1353 -----------------------------
1358 grub_video_unmap_color (grub_video_color_t color, grub_uint8_t *red, grub_uint8_t *green, grub_uint8_t *blue, grub_uint8_t *alpha);
1361 Unmap color value from 'color' to color channels in 'red', 'green',
1362 'blue' and 'alpha'. Values will be in range 0-255. Active
1363 rendering target will be used for color domain. In case alpha
1364 information is not available in rendering target, it is assumed to
1365 be opaque (having value 255).
1367 9.1.17 grub_video_fill_rect
1368 ---------------------------
1373 grub_video_fill_rect (grub_video_color_t color, int x, int y, unsigned int width, unsigned int height);
1376 Fill specified area limited by given coordinates within specified
1377 viewport. Negative coordinates are accepted in order to allow easy
1378 moving of rectangle within viewport. If coordinates are negative,
1379 area of the rectangle will be shrinken to follow size limits of the
1382 Software developer should use either 'grub_video_map_color',
1383 'grub_video_map_rgb' or 'grub_video_map_rgba' to map requested
1384 color to 'color' parameter.
1386 9.1.18 grub_video_blit_glyph
1387 ----------------------------
1392 grub_video_blit_glyph (struct grub_font_glyph *glyph, grub_video_color_t color, int x, int y);
1393 struct grub_font_glyph {
1398 Used to blit glyph to viewport in specified coodinates. If glyph
1399 is at edge of viewport, pixels outside of viewport will be clipped
1400 out. Software developer should use either 'grub_video_map_rgb' or
1401 'grub_video_map_rgba' to map requested color to 'color' parameter.
1403 9.1.19 grub_video_blit_bitmap
1404 -----------------------------
1409 grub_video_blit_bitmap (struct grub_video_bitmap *bitmap, enum grub_video_blit_operators oper, int x, int y, int offset_x, int offset_y, unsigned int width, unsigned int height);
1410 struct grub_video_bitmap
1415 enum grub_video_blit_operators
1417 GRUB_VIDEO_BLIT_REPLACE,
1418 GRUB_VIDEO_BLIT_BLEND
1422 Used to blit bitmap to viewport in specified coordinates. If part
1423 of bitmap is outside of viewport region, it will be clipped out.
1424 Offsets affect bitmap position where data will be copied from.
1425 Negative values for both viewport coordinates and bitmap offset
1426 coordinates are allowed. If data is looked out of bounds of
1427 bitmap, color value will be assumed to be transparent. If viewport
1428 coordinates are negative, area of the blitted rectangle will be
1429 shrinken to follow size limits of the viewport and bitmap.
1430 Blitting operator 'oper' specifies should source pixel replace data
1431 in screen or blend with pixel alpha value.
1433 Software developer should use 'grub_video_bitmap_create' or
1434 'grub_video_bitmap_load' to create or load bitmap data.
1436 9.1.20 grub_video_blit_render_target
1437 ------------------------------------
1442 grub_video_blit_render_target (struct grub_video_render_target *source, enum grub_video_blit_operators oper, int x, int y, int offset_x, int offset_y, unsigned int width, unsigned int height);
1443 struct grub_video_render_target {
1444 /* This is private data for video driver. Should not be accessed from elsewhere directly. */
1447 enum grub_video_blit_operators
1449 GRUB_VIDEO_BLIT_REPLACE,
1450 GRUB_VIDEO_BLIT_BLEND
1454 Used to blit source render target to viewport in specified
1455 coordinates. If part of source render target is outside of
1456 viewport region, it will be clipped out. If blitting operator is
1457 specified and source contains alpha values, resulting pixel color
1458 components will be calculated using formula ((src_color *
1459 src_alpha) + (dst_color * (255 - src_alpha)) / 255, if target
1460 buffer has alpha, it will be set to src_alpha. Offsets affect
1461 render target position where data will be copied from. If data is
1462 looked out of bounds of render target, color value will be assumed
1463 to be transparent. Blitting operator 'oper' specifies should
1464 source pixel replace data in screen or blend with pixel alpha
1467 9.1.21 grub_video_scroll
1468 ------------------------
1473 grub_video_scroll (grub_video_color_t color, int dx, int dy);
1476 Used to scroll viewport to specified direction. New areas are
1477 filled with specified color. This function is used when screen is
1478 scroller up in video terminal.
1480 9.1.22 grub_video_swap_buffers
1481 ------------------------------
1486 grub_video_swap_buffers (void);
1489 If double buffering is enabled, this swaps frontbuffer and
1490 backbuffer, in order to show values drawn to back buffer. Video
1491 driver is free to choose how this operation is techincally done.
1493 9.1.23 grub_video_create_render_target
1494 --------------------------------------
1499 grub_video_create_render_target (struct grub_video_render_target **result, unsigned int width, unsigned int height, unsigned int mode_type);
1500 struct grub_video_render_target {
1501 /* This is private data for video driver. Should not be accessed from elsewhere directly. */
1505 Driver will use information provided to it to create best fitting
1506 render target. 'mode_type' will be used to guide on selecting what
1507 features are wanted for render target. Supported values for
1508 'mode_type' are 'GRUB_VIDEO_MODE_TYPE_INDEX_COLOR' for index color
1509 modes, 'GRUB_VIDEO_MODE_TYPE_RGB' for direct RGB color modes and
1510 'GRUB_VIDEO_MODE_TYPE_ALPHA' for alpha component.
1512 9.1.24 grub_video_delete_render_target
1513 --------------------------------------
1518 grub_video_delete_render_target (struct grub_video_render_target *target);
1521 Used to delete previously created render target. If 'target'
1522 contains 'NULL' pointer, nothing will be done. If render target is
1523 correctly destroyed, GRUB_ERR_NONE is returned.
1525 9.1.25 grub_video_set_active_render_target
1526 ------------------------------------------
1531 grub_video_set_active_render_target (struct grub_video_render_target *target);
1534 Sets active render target. If this comand is successful all
1535 drawing commands will be done to specified 'target'. There is also
1536 special values for target, 'GRUB_VIDEO_RENDER_TARGET_DISPLAY' used
1537 to reference screen's front buffer,
1538 'GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER' used to reference screen's
1539 front buffer (alias for 'GRUB_VIDEO_RENDER_TARGET_DISPLAY') and
1540 'GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER' used to reference back
1541 buffer (if double buffering is enabled). If render target is
1542 correclty switched GRUB_ERR_NONE is returned. In no any event
1543 shall there be non drawable active render target.
1545 9.1.26 grub_video_get_active_render_target
1546 ------------------------------------------
1551 grub_video_get_active_render_target (struct grub_video_render_target **target);
1554 Returns currently active render target. It returns value in
1555 'target' that can be subsequently issued back to
1556 'grub_video_set_active_render_target'.
1559 File: grub-dev.info, Node: Example usage of Video API, Next: Bitmap API, Prev: Video API, Up: Video Subsystem
1561 9.2 Example usage of Video API
1562 ==============================
1564 9.2.1 Example of screen setup
1565 -----------------------------
1568 /* Try to initialize video mode 1024 x 768 with direct RGB. */
1569 rc = grub_video_setup (1024, 768, GRUB_VIDEO_MODE_TYPE_RGB);
1570 if (rc != GRUB_ERR_NONE)
1572 /* Fall back to standard VGA Index Color mode. */
1573 rc = grub_video_setup (640, 480, GRUB_VIDEO_MODE_TYPE_INDEX);
1574 if (rc != GRUB_ERR_NONE)
1580 9.2.2 Example of setting up console viewport
1581 --------------------------------------------
1583 grub_uint32_t x, y, width, height;
1584 grub_video_color_t color;
1585 struct grub_font_glyph glyph;
1587 /* Query existing viewport. */
1588 grub_video_get_viewport (&x, &y, &width, &height);
1589 /* Fill background. */
1590 color = grub_video_map_color (GRUB_COLOR_BACKGROUND);
1591 grub_video_fill_rect (color, 0, 0, width, height);
1592 /* Setup console viewport. */
1593 grub_video_set_viewport (x + 10, y + 10, width - 20, height - 20);
1594 grub_video_get_viewport (&x, &y, &width, &height);
1595 color = grub_video_map_color (GRUB_COLOR_CONSOLE_BACKGROUND);
1596 grub_video_fill_rect (color, 0, 0, width, height);
1597 /* Draw text to viewport. */
1598 color = grub_video_map_color (GRUB_COLOR_CONSOLE_TEXT);
1599 grub_font_get_glyph ('X', &glyph);
1600 grub_video_blit_glyph (&glyph, color, 0, 0);
1603 File: grub-dev.info, Node: Bitmap API, Prev: Example usage of Video API, Up: Video Subsystem
1608 9.3.1 grub_video_bitmap_create
1609 ------------------------------
1612 grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, unsigned int width, unsigned int height, enum grub_video_blit_format blit_format)
1616 Creates a new bitmap with given dimensions and blitting format.
1617 Allocated bitmap data can then be modified freely and finally
1618 blitted with 'grub_video_blit_bitmap' to rendering target.
1620 9.3.2 grub_video_bitmap_destroy
1621 -------------------------------
1624 grub_err_t grub_video_bitmap_destroy (struct grub_video_bitmap *bitmap);
1628 When bitmap is no longer needed, it can be freed from memory using
1629 this command. 'bitmap' is previously allocated bitmap with
1630 'grub_video_bitmap_create' or loaded with 'grub_video_bitmap_load'.
1632 9.3.3 grub_video_bitmap_load
1633 ----------------------------
1636 grub_err_t grub_video_bitmap_load (struct grub_video_bitmap **bitmap, const char *filename);
1640 Tries to load given bitmap ('filename') using registered bitmap
1641 loaders. In case bitmap format is not recognized or supported
1642 error 'GRUB_ERR_BAD_FILE_TYPE' is returned.
1644 9.3.4 grub_video_bitmap_get_width
1645 ---------------------------------
1648 unsigned int grub_video_bitmap_get_width (struct grub_video_bitmap *bitmap);
1652 Returns bitmap width.
1654 9.3.5 grub_video_bitmap_get_height
1655 ----------------------------------
1658 unsigned int grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap);
1662 Return bitmap height.
1664 9.3.6 grub_video_bitmap_get_mode_info
1665 -------------------------------------
1668 void grub_video_bitmap_get_mode_info (struct grub_video_bitmap *bitmap, struct grub_video_mode_info *mode_info);
1672 Returns bitmap format details in form of 'grub_video_mode_info'.
1674 9.3.7 grub_video_bitmap_get_data
1675 --------------------------------
1678 void *grub_video_bitmap_get_data (struct grub_video_bitmap *bitmap);
1682 Return pointer to bitmap data. Contents of the pointed data can be
1683 freely modified. There is no extra protection against going off
1684 the bounds so you have to be carefull how to access the data.
1687 File: grub-dev.info, Node: PFF2 Font File Format, Next: Graphical Menu Software Design, Prev: Video Subsystem, Up: Top
1689 10 PFF2 Font File Format
1690 ************************
1699 File: grub-dev.info, Node: Introduction, Next: File Structure, Up: PFF2 Font File Format
1704 The goal of this format is to provide a bitmap font format that is
1705 simple to use, compact, and cleanly supports Unicode.
1707 10.1.1 Goals of the GRUB Font Format
1708 ------------------------------------
1710 * Simple to read and use. Since GRUB will only be reading the font
1711 files, we are more concerned with making the code to read the font
1712 simple than we are with writing the font.
1714 * Compact storage. The fonts will generally be stored in a small
1715 boot partition where GRUB is located, and this may be on a
1716 removable storage device such as a CD or USB flash drive where
1717 space is more limited than it is on most hard drives.
1719 * Unicode. GRUB should not have to deal with multiple character
1720 encodings. The font should always use Unicode character codes for
1721 simple internationalization.
1723 10.1.2 Why Another Font Format?
1724 -------------------------------
1726 There are many existing bitmap font formats that GRUB could use.
1727 However, there are aspects of these formats that may make them less than
1728 suitable for use in GRUB at this time:
1731 Inefficient storage; uses ASCII to describe properties and
1732 hexadecimal numbers in ASCII for the bitmap rows.
1734 Many format variations such as byte order and bitmap padding (rows
1735 padded to byte, word, etc.) would result in more complex code to
1736 handle the font format.
1739 File: grub-dev.info, Node: File Structure, Next: Font Metrics, Prev: Introduction, Up: PFF2 Font File Format
1744 A file *section* consists of a 4-byte name, a 32-bit big-endian length
1745 (not including the name or length), and then LENGTH more
1746 section-type-specific bytes.
1748 The standard file extension for PFF2 font files is '.pf2'.
1750 10.2.1 Section Types
1751 --------------------
1754 *File type ID* (ASCII string). This must be the first section in
1755 the file. It has length 4 and the contents are the four bytes of
1756 the ASCII string 'PFF2'.
1759 *Font name* (ASCII string). This is the full font name including
1760 family, weight, style, and point size. For instance, "Helvetica
1764 *Font family name* (ASCII string). For instance, "Helvetica".
1765 This should be included so that intelligent font substitution can
1769 *Font weight* (ASCII string). Valid values are 'bold' and
1770 'normal'. This should be included so that intelligent font
1771 substitution can take place.
1774 *Font slant* (ASCII string). Valid values are 'italic' and
1775 'normal'. This should be included so that intelligent font
1776 substitution can take place.
1779 *Font point size* (uint16be).
1782 *Maximum character width in pixels* (uint16be).
1785 *Maximum character height in pixels* (uint16be).
1788 *Ascent in pixels* (uint16be). *Note Font Metrics::, for details.
1791 *Descent in pixels* (uint16be). *Note Font Metrics::, for details.
1794 *Character index.* The character index begins with a 32-bit
1795 big-endian unsigned integer indicating the total size of the
1796 section, not including this size value. For each character, there
1797 is an instance of the following entry structure:
1799 * *Unicode code point.* (32-bit big-endian integer.)
1801 * *Storage flags.* (byte.)
1805 If equal to 000 binary, then the character data is stored
1806 uncompressed beginning at the offset indicated by the
1807 character's *offset* value.
1809 If equal to 001 binary, then the character data is stored
1810 within a compressed character definition block that
1811 begins at the offset within the file indicated by the
1812 character's *offset* value.
1814 * *Offset.* (32-bit big-endian integer.)
1816 A marker that indicates the remainder of the file is data
1817 accessed via the character index (CHIX) section. When reading
1818 this font file, the rest of the file can be ignored when
1819 scanning the sections. The length should be set to -1
1822 Supported data structures:
1824 Character definition Each character definition consists of:
1826 * *Width.* Width of the bitmap in pixels. The bitmap's
1827 extents represent the glyph's bounding box. 'uint16be'.
1829 * *Height.* Height of the bitmap in pixels. The bitmap's
1830 extents represent the glyph's bounding box. 'uint16be'.
1832 * *X offset.* The number of pixels to shift the bitmap by
1833 horizontally before drawing the character. 'int16be'.
1835 * *Y offset.* The number of pixels to shift the bitmap by
1836 vertically before drawing the character. 'int16be'.
1838 * *Device width.* The number of pixels to advance
1839 horizontally from this character's origin to the origin
1840 of the next character. 'int16be'.
1842 * *Bitmap data.* This is encoded as a string of bits. It
1843 is organized as a row-major, top-down, left-to-right
1844 bitmap. The most significant bit of each byte is taken
1845 to be the leftmost or uppermost bit in the byte. For the
1846 sake of compact storage, rows are not padded to byte
1847 boundaries (i.e., a single byte may contain bits
1848 belonging to multiple rows). The last byte of the bitmap
1849 *is* padded with zero bits in the bits positions to the
1850 right of the last used bit if the bitmap data does not
1853 The length of the *bitmap data* field is (WIDTH * HEIGHT
1854 + 7) / 8 using integer arithmetic, which is equivalent to
1855 ceil(WIDTH * HEIGHT / 8) using real number arithmetic.
1857 It remains to be determined whether bitmap fonts usually
1858 make all glyph bitmaps the same height, or if smaller
1859 glyphs are stored with bitmaps having a lesser height.
1860 In the latter case, the baseline would have to be used to
1861 calculate the location the bitmap should be anchored at
1865 File: grub-dev.info, Node: Font Metrics, Prev: File Structure, Up: PFF2 Font File Format
1870 * Ascent. The distance from the baseline to the top of most
1871 characters. Note that in some cases characters may extend above
1874 * Descent. The distance from the baseline to the bottom of most
1875 characters. Note that in some cases characters may extend below
1878 * Leading. The amount of space, in pixels, to leave between the
1879 descent of one line of text and the ascent of the next line. This
1880 metrics is not specified in the current file format; instead, the
1881 font rendering engine calculates a reasonable leading value based
1882 on the other font metrics.
1884 * Horizonal leading. The amount of space, in pixels, to leave
1885 horizontally between the left and right edges of two adjacent
1886 glyphs. The *device width* field determines the effective leading
1887 value that is used to render the font.
1889 \0\b[image src="font_char_metrics.png" text="Please fill this in."
\0\b]
1891 An illustration of how the various font metrics apply to characters.
1894 File: grub-dev.info, Node: Graphical Menu Software Design, Next: Copying This Manual, Prev: PFF2 Font File Format, Up: Top
1896 11 Graphical Menu Software Design
1897 *********************************
1902 * Startup Sequence::
1904 * Command Line Window::
1907 File: grub-dev.info, Node: Introduction_2, Next: Startup Sequence, Up: Graphical Menu Software Design
1912 The 'gfxmenu' module provides a graphical menu interface for GRUB 2. It
1913 functions as an alternative to the menu interface provided by the
1914 'normal' module, which uses the grub terminal interface to display a
1915 menu on a character-oriented terminal.
1917 The graphical menu uses the GRUB video API, which is currently for
1918 the VESA BIOS extensions (VBE) 2.0+. This is supported on the i386-pc
1919 platform. However, the graphical menu itself does not depend on using
1920 VBE, so if another GRUB video driver were implemented, the 'gfxmenu'
1921 graphical menu would work on the new video driver as well.
1924 File: grub-dev.info, Node: Startup Sequence, Next: GUI Components, Prev: Introduction_2, Up: Graphical Menu Software Design
1926 11.2 Startup Sequence
1927 =====================
1929 * grub_enter_normal_mode [normal/main.c]
1930 * grub_normal_execute [normal/main.c]
1931 * read_config_file [normal/main.c]
1932 * (When 'gfxmenu.mod' is loaded with 'insmod', it will call
1933 'grub_menu_viewer_register()' to register itself.)
1934 * GRUB_MOD_INIT (gfxmenu) [gfxmenu/gfxmenu.c]
1935 * grub_menu_viewer_register [kern/menu_viewer.c]
1936 * grub_menu_viewer_show_menu [kern/menu_viewer.c]
1937 * get_current_menu_viewer() [kern/menu_viewer.c]
1938 * show_menu() [gfxmenu/gfxmenu.c]
1939 * grub_gfxmenu_model_new [gfxmenu/model.c]
1940 * grub_gfxmenu_view_new [gfxmenu/view.c]
1941 * set_graphics_mode [gfxmenu/view.c]
1942 * grub_gfxmenu_view_load_theme [gfxmenu/theme_loader.c]
1945 File: grub-dev.info, Node: GUI Components, Next: Command Line Window, Prev: Startup Sequence, Up: Graphical Menu Software Design
1950 The graphical menu implements a GUI component system that supports a
1951 container-based layout system. Components can be added to containers,
1952 and containers (which are a type of component) can then be added to
1953 other containers, to form a tree of components. Currently, the root
1954 component of this tree is a 'canvas' component, which allows manual
1955 layout of its child components.
1957 Components (non-container):
1963 * list (currently hard coded to be a boot menu list)
1971 The GUI component instances are created by the theme loader in
1972 'gfxmenu/theme_loader.c' when a theme is loaded. Theme files specify
1973 statements such as '+vbox{ +label { text="Hello" } +label{ text="World"
1974 } }' to add components to the component tree root. By nesting the
1975 component creation statements in the theme file, the instantiated
1976 components are nested the same way.
1978 When a component is added to a container, that new child is
1979 considered *owned* by the container. Great care should be taken if the
1980 caller retains a reference to the child component, since it will be
1981 destroyed if its parent container is destroyed. A better choice instead
1982 of storing a pointer to the child component is to use the component ID
1983 to find the desired component. Component IDs do not have to be unique
1984 (it is often useful to have multiple components with an ID of
1985 "__timeout__", for instance).
1987 In order to access and use components in the component tree, there
1988 are two functions (defined in 'gfxmenu/gui_util.c') that are
1989 particularly useful:
1991 * 'grub_gui_find_by_id (root, id, callback, userdata)':
1993 This function ecursively traverses the component tree rooted at
1994 ROOT, and for every component that has an ID equal to ID, calls the
1995 function pointed to by CALLBACK with the matching component and the
1996 void pointer USERDATA as arguments. The callback function can do
1997 whatever is desired to use the component passed in.
1999 * 'grub_gui_iterate_recursively (root, callback, userdata)':
2001 This function calls the function pointed to by CALLBACK for every
2002 component that is a descendant of ROOT in the component tree. When
2003 the callback function is called, the component and the void pointer
2004 USERDATA as arguments. The callback function can do whatever is
2005 desired to use the component passed in.
2008 File: grub-dev.info, Node: Command Line Window, Prev: GUI Components, Up: Graphical Menu Software Design
2010 11.4 Command Line Window
2011 ========================
2013 The terminal window used to provide command line access within the
2014 graphical menu is managed by 'gfxmenu/view.c'. The 'gfxterm' terminal
2015 is used, and it has been modified to allow rendering to an offscreen
2016 render target to allow it to be composed into the double buffering
2017 system that the graphical menu view uses. This is bad for performance,
2018 however, so it would probably be a good idea to make it possible to
2019 temporarily disable double buffering as long as the terminal window is
2020 visible. There are still unresolved problems that occur when commands
2021 are executed from the terminal window that change the graphics mode.
2022 It's possible that making 'grub_video_restore()' return to the graphics
2023 mode that was in use before 'grub_video_setup()' was called might fix
2024 some of the problems.
2027 File: grub-dev.info, Node: Copying This Manual, Next: Index, Prev: Graphical Menu Software Design, Up: Top
2029 Appendix A Copying This Manual
2030 ******************************
2034 * GNU Free Documentation License:: License for copying this manual.
2037 File: grub-dev.info, Node: GNU Free Documentation License, Up: Copying This Manual
2039 A.1 GNU Free Documentation License
2040 ==================================
2042 Version 1.2, November 2002
2044 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
2045 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
2047 Everyone is permitted to copy and distribute verbatim copies
2048 of this license document, but changing it is not allowed.
2052 The purpose of this License is to make a manual, textbook, or other
2053 functional and useful document "free" in the sense of freedom: to
2054 assure everyone the effective freedom to copy and redistribute it,
2055 with or without modifying it, either commercially or
2056 noncommercially. Secondarily, this License preserves for the
2057 author and publisher a way to get credit for their work, while not
2058 being considered responsible for modifications made by others.
2060 This License is a kind of "copyleft", which means that derivative
2061 works of the document must themselves be free in the same sense.
2062 It complements the GNU General Public License, which is a copyleft
2063 license designed for free software.
2065 We have designed this License in order to use it for manuals for
2066 free software, because free software needs free documentation: a
2067 free program should come with manuals providing the same freedoms
2068 that the software does. But this License is not limited to
2069 software manuals; it can be used for any textual work, regardless
2070 of subject matter or whether it is published as a printed book. We
2071 recommend this License principally for works whose purpose is
2072 instruction or reference.
2074 1. APPLICABILITY AND DEFINITIONS
2076 This License applies to any manual or other work, in any medium,
2077 that contains a notice placed by the copyright holder saying it can
2078 be distributed under the terms of this License. Such a notice
2079 grants a world-wide, royalty-free license, unlimited in duration,
2080 to use that work under the conditions stated herein. The
2081 "Document", below, refers to any such manual or work. Any member
2082 of the public is a licensee, and is addressed as "you". You accept
2083 the license if you copy, modify or distribute the work in a way
2084 requiring permission under copyright law.
2086 A "Modified Version" of the Document means any work containing the
2087 Document or a portion of it, either copied verbatim, or with
2088 modifications and/or translated into another language.
2090 A "Secondary Section" is a named appendix or a front-matter section
2091 of the Document that deals exclusively with the relationship of the
2092 publishers or authors of the Document to the Document's overall
2093 subject (or to related matters) and contains nothing that could
2094 fall directly within that overall subject. (Thus, if the Document
2095 is in part a textbook of mathematics, a Secondary Section may not
2096 explain any mathematics.) The relationship could be a matter of
2097 historical connection with the subject or with related matters, or
2098 of legal, commercial, philosophical, ethical or political position
2101 The "Invariant Sections" are certain Secondary Sections whose
2102 titles are designated, as being those of Invariant Sections, in the
2103 notice that says that the Document is released under this License.
2104 If a section does not fit the above definition of Secondary then it
2105 is not allowed to be designated as Invariant. The Document may
2106 contain zero Invariant Sections. If the Document does not identify
2107 any Invariant Sections then there are none.
2109 The "Cover Texts" are certain short passages of text that are
2110 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
2111 that says that the Document is released under this License. A
2112 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
2113 be at most 25 words.
2115 A "Transparent" copy of the Document means a machine-readable copy,
2116 represented in a format whose specification is available to the
2117 general public, that is suitable for revising the document
2118 straightforwardly with generic text editors or (for images composed
2119 of pixels) generic paint programs or (for drawings) some widely
2120 available drawing editor, and that is suitable for input to text
2121 formatters or for automatic translation to a variety of formats
2122 suitable for input to text formatters. A copy made in an otherwise
2123 Transparent file format whose markup, or absence of markup, has
2124 been arranged to thwart or discourage subsequent modification by
2125 readers is not Transparent. An image format is not Transparent if
2126 used for any substantial amount of text. A copy that is not
2127 "Transparent" is called "Opaque".
2129 Examples of suitable formats for Transparent copies include plain
2130 ASCII without markup, Texinfo input format, LaTeX input format,
2131 SGML or XML using a publicly available DTD, and standard-conforming
2132 simple HTML, PostScript or PDF designed for human modification.
2133 Examples of transparent image formats include PNG, XCF and JPG.
2134 Opaque formats include proprietary formats that can be read and
2135 edited only by proprietary word processors, SGML or XML for which
2136 the DTD and/or processing tools are not generally available, and
2137 the machine-generated HTML, PostScript or PDF produced by some word
2138 processors for output purposes only.
2140 The "Title Page" means, for a printed book, the title page itself,
2141 plus such following pages as are needed to hold, legibly, the
2142 material this License requires to appear in the title page. For
2143 works in formats which do not have any title page as such, "Title
2144 Page" means the text near the most prominent appearance of the
2145 work's title, preceding the beginning of the body of the text.
2147 A section "Entitled XYZ" means a named subunit of the Document
2148 whose title either is precisely XYZ or contains XYZ in parentheses
2149 following text that translates XYZ in another language. (Here XYZ
2150 stands for a specific section name mentioned below, such as
2151 "Acknowledgements", "Dedications", "Endorsements", or "History".)
2152 To "Preserve the Title" of such a section when you modify the
2153 Document means that it remains a section "Entitled XYZ" according
2156 The Document may include Warranty Disclaimers next to the notice
2157 which states that this License applies to the Document. These
2158 Warranty Disclaimers are considered to be included by reference in
2159 this License, but only as regards disclaiming warranties: any other
2160 implication that these Warranty Disclaimers may have is void and
2161 has no effect on the meaning of this License.
2165 You may copy and distribute the Document in any medium, either
2166 commercially or noncommercially, provided that this License, the
2167 copyright notices, and the license notice saying this License
2168 applies to the Document are reproduced in all copies, and that you
2169 add no other conditions whatsoever to those of this License. You
2170 may not use technical measures to obstruct or control the reading
2171 or further copying of the copies you make or distribute. However,
2172 you may accept compensation in exchange for copies. If you
2173 distribute a large enough number of copies you must also follow the
2174 conditions in section 3.
2176 You may also lend copies, under the same conditions stated above,
2177 and you may publicly display copies.
2179 3. COPYING IN QUANTITY
2181 If you publish printed copies (or copies in media that commonly
2182 have printed covers) of the Document, numbering more than 100, and
2183 the Document's license notice requires Cover Texts, you must
2184 enclose the copies in covers that carry, clearly and legibly, all
2185 these Cover Texts: Front-Cover Texts on the front cover, and
2186 Back-Cover Texts on the back cover. Both covers must also clearly
2187 and legibly identify you as the publisher of these copies. The
2188 front cover must present the full title with all words of the title
2189 equally prominent and visible. You may add other material on the
2190 covers in addition. Copying with changes limited to the covers, as
2191 long as they preserve the title of the Document and satisfy these
2192 conditions, can be treated as verbatim copying in other respects.
2194 If the required texts for either cover are too voluminous to fit
2195 legibly, you should put the first ones listed (as many as fit
2196 reasonably) on the actual cover, and continue the rest onto
2199 If you publish or distribute Opaque copies of the Document
2200 numbering more than 100, you must either include a machine-readable
2201 Transparent copy along with each Opaque copy, or state in or with
2202 each Opaque copy a computer-network location from which the general
2203 network-using public has access to download using public-standard
2204 network protocols a complete Transparent copy of the Document, free
2205 of added material. If you use the latter option, you must take
2206 reasonably prudent steps, when you begin distribution of Opaque
2207 copies in quantity, to ensure that this Transparent copy will
2208 remain thus accessible at the stated location until at least one
2209 year after the last time you distribute an Opaque copy (directly or
2210 through your agents or retailers) of that edition to the public.
2212 It is requested, but not required, that you contact the authors of
2213 the Document well before redistributing any large number of copies,
2214 to give them a chance to provide you with an updated version of the
2219 You may copy and distribute a Modified Version of the Document
2220 under the conditions of sections 2 and 3 above, provided that you
2221 release the Modified Version under precisely this License, with the
2222 Modified Version filling the role of the Document, thus licensing
2223 distribution and modification of the Modified Version to whoever
2224 possesses a copy of it. In addition, you must do these things in
2225 the Modified Version:
2227 A. Use in the Title Page (and on the covers, if any) a title
2228 distinct from that of the Document, and from those of previous
2229 versions (which should, if there were any, be listed in the
2230 History section of the Document). You may use the same title
2231 as a previous version if the original publisher of that
2232 version gives permission.
2234 B. List on the Title Page, as authors, one or more persons or
2235 entities responsible for authorship of the modifications in
2236 the Modified Version, together with at least five of the
2237 principal authors of the Document (all of its principal
2238 authors, if it has fewer than five), unless they release you
2239 from this requirement.
2241 C. State on the Title page the name of the publisher of the
2242 Modified Version, as the publisher.
2244 D. Preserve all the copyright notices of the Document.
2246 E. Add an appropriate copyright notice for your modifications
2247 adjacent to the other copyright notices.
2249 F. Include, immediately after the copyright notices, a license
2250 notice giving the public permission to use the Modified
2251 Version under the terms of this License, in the form shown in
2254 G. Preserve in that license notice the full lists of Invariant
2255 Sections and required Cover Texts given in the Document's
2258 H. Include an unaltered copy of this License.
2260 I. Preserve the section Entitled "History", Preserve its Title,
2261 and add to it an item stating at least the title, year, new
2262 authors, and publisher of the Modified Version as given on the
2263 Title Page. If there is no section Entitled "History" in the
2264 Document, create one stating the title, year, authors, and
2265 publisher of the Document as given on its Title Page, then add
2266 an item describing the Modified Version as stated in the
2269 J. Preserve the network location, if any, given in the Document
2270 for public access to a Transparent copy of the Document, and
2271 likewise the network locations given in the Document for
2272 previous versions it was based on. These may be placed in the
2273 "History" section. You may omit a network location for a work
2274 that was published at least four years before the Document
2275 itself, or if the original publisher of the version it refers
2276 to gives permission.
2278 K. For any section Entitled "Acknowledgements" or "Dedications",
2279 Preserve the Title of the section, and preserve in the section
2280 all the substance and tone of each of the contributor
2281 acknowledgements and/or dedications given therein.
2283 L. Preserve all the Invariant Sections of the Document, unaltered
2284 in their text and in their titles. Section numbers or the
2285 equivalent are not considered part of the section titles.
2287 M. Delete any section Entitled "Endorsements". Such a section
2288 may not be included in the Modified Version.
2290 N. Do not retitle any existing section to be Entitled
2291 "Endorsements" or to conflict in title with any Invariant
2294 O. Preserve any Warranty Disclaimers.
2296 If the Modified Version includes new front-matter sections or
2297 appendices that qualify as Secondary Sections and contain no
2298 material copied from the Document, you may at your option designate
2299 some or all of these sections as invariant. To do this, add their
2300 titles to the list of Invariant Sections in the Modified Version's
2301 license notice. These titles must be distinct from any other
2304 You may add a section Entitled "Endorsements", provided it contains
2305 nothing but endorsements of your Modified Version by various
2306 parties--for example, statements of peer review or that the text
2307 has been approved by an organization as the authoritative
2308 definition of a standard.
2310 You may add a passage of up to five words as a Front-Cover Text,
2311 and a passage of up to 25 words as a Back-Cover Text, to the end of
2312 the list of Cover Texts in the Modified Version. Only one passage
2313 of Front-Cover Text and one of Back-Cover Text may be added by (or
2314 through arrangements made by) any one entity. If the Document
2315 already includes a cover text for the same cover, previously added
2316 by you or by arrangement made by the same entity you are acting on
2317 behalf of, you may not add another; but you may replace the old
2318 one, on explicit permission from the previous publisher that added
2321 The author(s) and publisher(s) of the Document do not by this
2322 License give permission to use their names for publicity for or to
2323 assert or imply endorsement of any Modified Version.
2325 5. COMBINING DOCUMENTS
2327 You may combine the Document with other documents released under
2328 this License, under the terms defined in section 4 above for
2329 modified versions, provided that you include in the combination all
2330 of the Invariant Sections of all of the original documents,
2331 unmodified, and list them all as Invariant Sections of your
2332 combined work in its license notice, and that you preserve all
2333 their Warranty Disclaimers.
2335 The combined work need only contain one copy of this License, and
2336 multiple identical Invariant Sections may be replaced with a single
2337 copy. If there are multiple Invariant Sections with the same name
2338 but different contents, make the title of each such section unique
2339 by adding at the end of it, in parentheses, the name of the
2340 original author or publisher of that section if known, or else a
2341 unique number. Make the same adjustment to the section titles in
2342 the list of Invariant Sections in the license notice of the
2345 In the combination, you must combine any sections Entitled
2346 "History" in the various original documents, forming one section
2347 Entitled "History"; likewise combine any sections Entitled
2348 "Acknowledgements", and any sections Entitled "Dedications". You
2349 must delete all sections Entitled "Endorsements."
2351 6. COLLECTIONS OF DOCUMENTS
2353 You may make a collection consisting of the Document and other
2354 documents released under this License, and replace the individual
2355 copies of this License in the various documents with a single copy
2356 that is included in the collection, provided that you follow the
2357 rules of this License for verbatim copying of each of the documents
2358 in all other respects.
2360 You may extract a single document from such a collection, and
2361 distribute it individually under this License, provided you insert
2362 a copy of this License into the extracted document, and follow this
2363 License in all other respects regarding verbatim copying of that
2366 7. AGGREGATION WITH INDEPENDENT WORKS
2368 A compilation of the Document or its derivatives with other
2369 separate and independent documents or works, in or on a volume of a
2370 storage or distribution medium, is called an "aggregate" if the
2371 copyright resulting from the compilation is not used to limit the
2372 legal rights of the compilation's users beyond what the individual
2373 works permit. When the Document is included in an aggregate, this
2374 License does not apply to the other works in the aggregate which
2375 are not themselves derivative works of the Document.
2377 If the Cover Text requirement of section 3 is applicable to these
2378 copies of the Document, then if the Document is less than one half
2379 of the entire aggregate, the Document's Cover Texts may be placed
2380 on covers that bracket the Document within the aggregate, or the
2381 electronic equivalent of covers if the Document is in electronic
2382 form. Otherwise they must appear on printed covers that bracket
2383 the whole aggregate.
2387 Translation is considered a kind of modification, so you may
2388 distribute translations of the Document under the terms of section
2389 4. Replacing Invariant Sections with translations requires special
2390 permission from their copyright holders, but you may include
2391 translations of some or all Invariant Sections in addition to the
2392 original versions of these Invariant Sections. You may include a
2393 translation of this License, and all the license notices in the
2394 Document, and any Warranty Disclaimers, provided that you also
2395 include the original English version of this License and the
2396 original versions of those notices and disclaimers. In case of a
2397 disagreement between the translation and the original version of
2398 this License or a notice or disclaimer, the original version will
2401 If a section in the Document is Entitled "Acknowledgements",
2402 "Dedications", or "History", the requirement (section 4) to
2403 Preserve its Title (section 1) will typically require changing the
2408 You may not copy, modify, sublicense, or distribute the Document
2409 except as expressly provided for under this License. Any other
2410 attempt to copy, modify, sublicense or distribute the Document is
2411 void, and will automatically terminate your rights under this
2412 License. However, parties who have received copies, or rights,
2413 from you under this License will not have their licenses terminated
2414 so long as such parties remain in full compliance.
2416 10. FUTURE REVISIONS OF THIS LICENSE
2418 The Free Software Foundation may publish new, revised versions of
2419 the GNU Free Documentation License from time to time. Such new
2420 versions will be similar in spirit to the present version, but may
2421 differ in detail to address new problems or concerns. See
2422 <http://www.gnu.org/copyleft/>.
2424 Each version of the License is given a distinguishing version
2425 number. If the Document specifies that a particular numbered
2426 version of this License "or any later version" applies to it, you
2427 have the option of following the terms and conditions either of
2428 that specified version or of any later version that has been
2429 published (not as a draft) by the Free Software Foundation. If the
2430 Document does not specify a version number of this License, you may
2431 choose any version ever published (not as a draft) by the Free
2432 Software Foundation.
2434 A.1.1 ADDENDUM: How to use this License for your documents
2435 ----------------------------------------------------------
2437 To use this License in a document you have written, include a copy of
2438 the License in the document and put the following copyright and license
2439 notices just after the title page:
2441 Copyright (C) YEAR YOUR NAME.
2442 Permission is granted to copy, distribute and/or modify this document
2443 under the terms of the GNU Free Documentation License, Version 1.2
2444 or any later version published by the Free Software Foundation;
2445 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2446 Texts. A copy of the license is included in the section entitled ``GNU
2447 Free Documentation License''.
2449 If you have Invariant Sections, Front-Cover Texts and Back-Cover
2450 Texts, replace the "with...Texts." line with this:
2452 with the Invariant Sections being LIST THEIR TITLES, with
2453 the Front-Cover Texts being LIST, and with the Back-Cover Texts
2456 If you have Invariant Sections without Cover Texts, or some other
2457 combination of the three, merge those two alternatives to suit the
2460 If your document contains nontrivial examples of program code, we
2461 recommend releasing these examples in parallel under your choice of free
2462 software license, such as the GNU General Public License, to permit
2463 their use in free software.
2466 File: grub-dev.info, Node: Index, Prev: Copying This Manual, Up: Top
2474 * FDL, GNU Free Documentation License: GNU Free Documentation License.
2481 Node: Getting the source code
\x7f1750
2482 Node: Coding style
\x7f2711
2483 Node: Naming Conventions
\x7f3120
2484 Node: Functions
\x7f3405
2485 Node: Variables
\x7f4279
2487 Node: Macros
\x7f5995
2488 Node: Comments
\x7f6327
2489 Node: Multi-Line Comments
\x7f7089
2490 Node: Finding your way around
\x7f7720
2491 Node: Contributing Changes
\x7f11036
2492 Node: Getting started
\x7f12126
2493 Node: Typical Developer Experience
\x7f16178
2494 Node: When you are approved for write access to project's files
\x7f17220
2495 Node: Porting
\x7f18653
2496 Node: Error Handling
\x7f30416
2497 Node: Stack and heap size
\x7f35508
2498 Node: BIOS port memory map
\x7f38141
2499 Node: Video Subsystem
\x7f38990
2500 Node: Video API
\x7f39462
2501 Node: Example usage of Video API
\x7f59857
2502 Node: Bitmap API
\x7f61431
2503 Node: PFF2 Font File Format
\x7f63948
2504 Node: Introduction
\x7f64188
2505 Node: File Structure
\x7f65691
2506 Node: Font Metrics
\x7f70609
2507 Node: Graphical Menu Software Design
\x7f71757
2508 Node: Introduction_2
\x7f72049
2509 Node: Startup Sequence
\x7f72783
2510 Node: GUI Components
\x7f73634
2511 Node: Command Line Window
\x7f76234
2512 Node: Copying This Manual
\x7f77186
2513 Node: GNU Free Documentation License
\x7f77442
2514 Node: Index
\x7f99834