Skip to content

wfeldt/gfxboot2

Repository files navigation

gfxboot2

A graphical interface to bootloaders.

This is still in a very early stage.

It’s essentially a rework of gfxboot but written in C.

The implemented scripting language is again a stack-based language - similar to what gfxboot uses but with integrated memory management and a hash data type.

Status

The code is not yet ready to be used.

The scripting language is basically implemented, including the graphics primitves.

The connection to grub is still a bit awkward. The patches extend grub to expose a link to the graphics framebuffer.

This is not strictly needed. gfxboot does never read the video memory. An`update` function that can update a rectangular screen area would suffice.

AFAICS grub does not exactly have that. There is doublebuf_blit_update_screen in grub-core/video/fb/video_fb.c, though. But this updates continuous memory ranges, not rectangular areas.

A first look

A cat
Figure 1. A cat
The source code
/cfont getconsole getfont def
/foo "foo.fnt" readfile newfont def
/bar "bar.fnt" readfile newfont def

/text "ABC 12345 xyz # * % & § öäüß €" def

/image "katze_800.jpg" readfile unpackimage def

getcanvas image blt
0x90000000 setcolor
image dim fillrect

0xffff00 setcolor

getcanvas cfont setfont
50 50 setpos "Some font samples" show

0x00ffffff setcolor

getcanvas cfont setfont
50 100 setpos text show

getcanvas bar setfont
50 130 setpos text show

getcanvas foo setfont
50 180 setpos text show
The compiled source code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# code: 67 entries (67 - 0)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# line i index  offset   type   hex                      word
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
             0  0x00000  comm   75 51 12 a9 42 7a ad 60  # gfxboot magic
     1       1  0x00008  ref    59 63 66 6f 6e 74        /cfont
             2  0x0000e  prim   83 4b                    getconsole
             3  0x00010  prim   83 3f                    getfont
             4  0x00012  prim   63                       def
     2       5  0x00013  ref    39 66 6f 6f              /foo
             6  0x00017  str    77 66 6f 6f 2e 66 6e 74  "foo.fnt"
             7  0x0001f  prim   83 50                    readfile
             8  0x00021  prim   83 41                    newfont
             9  0x00023  prim   63                       def
     3      10  0x00024  ref    39 62 61 72              /bar
            11  0x00028  str    77 62 61 72 2e 66 6e 74  "bar.fnt"
            12  0x00030  prim   83 50                    readfile
            13  0x00032  prim   83 41                    newfont
            14  0x00034  prim   63                       def
     5      15  0x00035  ref    49 74 65 78 74           /text
            16  0x0003a  str    c7 25 41 42 43 20 31 32  "ABC 12345 xyz # * % & § öäüß €"
                                33 34 35 20 78 79 7a 20
                                23 20 2a 20 25 20 26 20
                                c2 a7 20 c3 b6 c3 a4 c3
                                bc c3 9f 20 e2 82 ac
            17  0x00061  prim   63                       def
     7      18  0x00062  ref    59 69 6d 61 67 65        /image
            19  0x00068  str    c7 0d 6b 61 74 7a 65 5f  "katze_800.jpg"
                                38 30 30 2e 6a 70 67
            20  0x00077  prim   83 50                    readfile
            21  0x00079  prim   83 51                    unpackimage
            22  0x0007b  prim   63                       def
     9      23  0x0007c  prim   83 49                    getcanvas
            24  0x0007e  word   58 69 6d 61 67 65        image
            25  0x00084  prim   83 52                    blt
    10      26  0x00086  int    c1 00 00 00 90 00        0x90000000
            27  0x0008c  prim   83 3a                    setcolor
    11      28  0x0008e  xref   84 10                    image
            29  0x00090  prim   83 4e                    dim
            30  0x00092  prim   83 57                    fillrect
    13      31  0x00094  int    b1 00 ff ff 00           0xffff00
            32  0x00099  prim   83 3a                    setcolor
    15      33  0x0009b  prim   83 49                    getcanvas
            34  0x0009d  word   58 63 66 6f 6e 74        cfont
            35  0x000a3  prim   83 40                    setfont
    16      36  0x000a5  int    81 32                    50
            37  0x000a7  int    81 32                    50
            38  0x000a9  prim   83 3e                    setpos
            39  0x000ab  str    c7 11 53 6f 6d 65 20 66  "Some font samples"
                                6f 6e 74 20 73 61 6d 70
                                6c 65 73
            40  0x000be  prim   83 4d                    show
    18      41  0x000c0  int    b1 ff ff ff 00           0x00ffffff
            42  0x000c5  prim   83 3a                    setcolor
    20      43  0x000c7  prim   83 49                    getcanvas
            44  0x000c9  xref   84 2c                    cfont
            45  0x000cb  prim   83 40                    setfont
    21      46  0x000cd  int    81 32                    50
            47  0x000cf  int    81 64                    100
            48  0x000d1  prim   83 3e                    setpos
            49  0x000d3  word   48 74 65 78 74           text
            50  0x000d8  prim   83 4d                    show
    23      51  0x000da  prim   83 49                    getcanvas
            52  0x000dc  word   38 62 61 72              bar
            53  0x000e0  prim   83 40                    setfont
    24      54  0x000e2  int    81 32                    50
            55  0x000e4  int    91 82 00                 130
            56  0x000e7  prim   83 3e                    setpos
            57  0x000e9  xref   84 16                    text
            58  0x000eb  prim   83 4d                    show
    26      59  0x000ed  prim   83 49                    getcanvas
            60  0x000ef  word   38 66 6f 6f              foo
            61  0x000f3  prim   83 40                    setfont
    27      62  0x000f5  int    81 32                    50
            63  0x000f7  int    91 b4 00                 180
            64  0x000fa  prim   83 3e                    setpos
            65  0x000fc  xref   84 29                    text
            66  0x000fe  prim   83 4d                    show

The prompt in the lower part of the screen is the debug console.

Next steps

  • get a basic boot menu working

  • fine-tune language definition

  • more systematic debug console

  • add de-fragmentation to memory management

  • check out syslinux integration

  • work on documentation

Some documentation

For details check out the language reference.

To get started, read the build instructions.

The code is covered by a test suite.

The binary format is also documented.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published