blob: 5c54f0a62c7247e6fd689dddda9f60ad82f98b75 [file] [log] [blame] [view]
Nico Huberfb4f8ce2017-03-13 13:37:56 +01001libgfxinit
2==========
3
4*libgfxinit* is a graphics initialization (aka modesetting) library
5for embedded environments. It currently supports only Intel hardware,
6more specifically the Intel Core processor line.
7
8It can query and set up most kinds of displays based on their EDID
9information. You can, however, also specify particular mode lines.
10
11*libgfxinit* is written in SPARK, an Ada subset with formal verifica-
12tion aspects. Absence of runtime errors can be proved automatically
13with SPARK GPL 2016.
14
15
16Building on Linux
17=================
18
19Prerequisites
20-------------
21
22For compilation, the GNAT Ada compiler is required. Usual package
23names in Linux distributions are `gcc-ada` and `gnat`.
24
25Grab the Sources
26----------------
27
28You'll need *libhwbase* and *libgfxinit*. Best is to clone the reposi-
29tories into a common parent directory (this way *libgfxinit* will know
30where to find *libhwbase*).
31
32 $ mkdir gfxfun && cd gfxfun
33 $ git clone https://review.coreboot.org/p/libhwbase.git
34 $ git clone https://review.coreboot.org/p/libgfxinit.git
35
36Configure and Install libhwbase
37-------------------------------
38
39Both libraries are currently configured by hand-written config files.
40You can either write your own `.config`, link one of the shipped files
41in `configs/`, e.g.:
42
Nico Huberfda2d6e2017-07-09 16:47:52 +020043 $ ln -s configs/linux libhwbase/.config
Nico Huberfb4f8ce2017-03-13 13:37:56 +010044
45or overwrite the config filename by specifying `cnf=<configfile>` on
46the make command line.
47
Nico Huber3b654a02017-07-15 22:27:14 +020048By default most debug messages won't be compiled into the binary. To
49include them into the build, set `DEBUG=1` on the command line or in
50your `.config`.
51
Nico Huberfda2d6e2017-07-09 16:47:52 +020052Let's install *libhwbase*. We'll need `configs/linux` to build regular
Nico Huberfb4f8ce2017-03-13 13:37:56 +010053Linux executables:
54
55 $ cd libhwbase
Nico Huber3b654a02017-07-15 22:27:14 +020056 $ make DEBUG=1 cnf=configs/linux install
Nico Huberfb4f8ce2017-03-13 13:37:56 +010057
58By default this installs into a new subdirectory `dest`. You can however
59overwrite this decision by specifying `DESTDIR=`.
60
61Build libgfxinit/`gfx_test`
62---------------------------
63
64*libgfxinit* is configured and installed in the same manner as de-
65scribed above. You will have to select a configuration matching your
66hardware.
67
68The makefile knows an additional target `gfx_test` to build a small
69Linux test application:
70
71 $ cd ../libgfxinit
Nico Huber3b654a02017-07-15 22:27:14 +020072 $ make DEBUG=1 cnf=configs/sandybridge gfx_test
Nico Huberfb4f8ce2017-03-13 13:37:56 +010073
74The resulting binary is `build/gfx_test`.
75
76
77Testing libgfxinit on Linux
78===========================
79
Nico Huber3b654a02017-07-15 22:27:14 +020080`gfx_test` sets up its own framebuffer in the *stolen memory*. It
81backs any current framebuffer mapping and contents up first and re-
82stores it before exiting. This works somehow even while the *i915*
83driver is running. A wrapper script `gfxtest/gfx_test.sh` is pro-
84vided to help with the setup. It switches to a text console first
85and tries to unload the *i915* driver. But ignores failures to do
86so (it won't work if you still have any application running that
87uses the gfx driver, e.g. an X server).
Nico Huberfb4f8ce2017-03-13 13:37:56 +010088
Nico Huber3b654a02017-07-15 22:27:14 +020089 # gfxtest/gfx_test.sh
Nico Huberfb4f8ce2017-03-13 13:37:56 +010090
91If you chose the right config above, you should be presented with a
Nico Huber3b654a02017-07-15 22:27:14 +020092nice test image. But please be prepared that your console might be
93stuck in that state afterwards. You can try to run it with *i915*
94deactivated then (e.g. when booting with `nomodeset` in the kernel
95command line or with *i915* blacklisted) and loading it afterwards.