Graphical user interface for real-time embedded systems-MiniGUI compilation, installation, and Configuration

Source: Internet
Author: User
Tags superuser permission automake

1. software maintenance and creation tools in Linux
For Open-Source Free Software, programmers usually get the source code. Many tools and libraries are often involved in the process of compiling the source code and correctly installing and configuring the source code. Therefore, the process is often complicated. MiniGUI is no exception. To demonstrate the correct compilation and Installation Process of MiniGUI, we need to first understand the tools used for software maintenance and establishment in Linux.

1.1 make and makefile

Make is the most common binary program and function library creation and generation tool in Linux. During the make operation, you must determine the type of binary file to be generated and the corresponding commands Based on the MAKEFILE file in the current directory (generally makefile. We can also establish the dependency between the target and the source code in the MAKEFILE file, so that the make tool can automatically determine whether to generate the final target through the intermediate process based on the time. Although makefile can be used to organize a large project, it is not easy to manually compile a MAKEFILE file. In addition, when you need to maintain a directory tree of the source code, the maintenance of makefile files will be greatly increased. Therefore, GNU has developed the autoconfi/automake tool to automatically generate makefile files and check system configuration information to help provide source code portability.
1.2 Autoconf/automake
The GNU Autoconf and automake software are actually composed of several shell scripts, which can help programmers easily generate makefile files. Currently, various free software, such as Apache and MySQL, are automatically configured and compiled using Autoconf and automake. MiniGUI also uses the Autoconf/automake interface. You only need to use "./configure", "make", and "make install" to compile and install the program into the system.
To better understand Autoconf and automake, we need to make a simple review of makefile. Makefile is basically a series of rules composed of "target", "dependency", and "action. Make decides how to compile (compile) and connect (Link) programs or other actions according to the rules of makefile files. Of course, make can not only compile and connect programs. For example, in the FreeBSD port collection, makefile can also automatically download remote programs, extract (extract), patch (patch ), then compile and install it to the system.
Although the basic structure of makefile is very simple, using these rules can transform many different patterns. Because of this, many people will feel that there are no rules to follow when they first learn to write makefiles. The makefiles written by each person are not the same, and they do not know where to start, in addition, it is often restricted by the development environment. As long as the environment parameters are different or the path is changed, makefile may have to be modified. Although GNU makefile conventions (GNU makefile Convention) has developed some standards and specifications for compiling makefile during GNU program design, its content is very long and complex, in addition, we often make some adjustments. In order to reduce the burden on program developers to maintain makefiles, automake emerged.
With automake, programmers only need to write some predefined macros (macro) and submit them to automake for processing. A makefile. In file that can be used by Autoconf will be generated. Then, use the automatic configuration file configure generated by Autoconf to generate a makeifle that complies with the GNU makefile convention.
Before using automake, make sure that your system has the following software installed:

  • GNU automake
  • GNU Autoconf
  • GNU M4
  • Perl
  • GNU libtool (if you need to generate a shared library)

It is best to use the gnu c/C ++ compiler, GNU make, and other GNU tool programs as the development environment. These tools are all GPL free software, not only free but also powerful. If you are using Red Hat Linux, you can find all the RPM files of the above software.
The makefile generated by configure has several preset targets for use. Here, we will briefly describe the following.

  • Make all generates the set targets. You can only press make. At this time, the source code will be compiled, connected, and the execution file will be generated.
  • Make clean clears the previously compiled executable files and target files (*. O ).
  • Make distclean clears the makefile generated by configure in addition to the executable and target files. This command is usually executed before the software is released.
  • Make install the program to the system. If the source code is compiled successfully and the execution result is correct, you can install the program to the pre-set execution file storage path of the system, if the bin_programs macro is used, the program will be installed under/usr/local/bin.
  • Make Dist packs programs and related documents into a compressed document for release. After the execution is complete, a file named package-version.tar.gz will be created under the directory. Package and version are defined according to am_init_automake (package, Version) in Configure. In.
  • Make distcheck is similar to make Dist, but check whether the compressed file after packaging is normal. In addition to packaging the program and related documents into a tar.gz file, the compressed file is automatically unlocked, configure is executed, and make all is executed. After the compilation is confirmed to be correct, the tar.gz file is ready for release.

It should be noted that the software kits generated by using Autoconf and automake can be used in environments where Autoconf and automake are not installed, because configure is a shell script, it has been designed to be executed in the shell of a Common Unix Sh. However, if you want to modify the configure. In And makefile. Am files to generate new configure and makefile. In files, you must have Autoconf and automake.
1.3 LDD and ldconfig
LDD is the shared library used to check executable files. For example:

$ ldd /bin/ls        libtermcap.so.2 => /lib/libtermcap.so.2 (0x4001c000)        libc.so.6 => /lib/libc.so.6 (0x40020000)        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)        

Run the LDD command on the/bin/ls program to check the shared libraries used by the program. Note that in the result printed by the LDD command, "=>" indicates the so name of the shared library to be connected by the Program on the left, the right side shows the specific location of the shared library found by the Linux shared library system in the file system. By default, the/etc/lD. So. conf file contains the default shared library search path, for example:

/usr/X11R6/lib        /usr/lib        /usr/i486-linux-libc5/lib        /usr/lib/qt-2.0.1/lib        /usr/lib/qt-1.44/lib        /usr/lib/qt-2.1.0/lib        /usr/kerberos/lib        /usr/lib/qt-1.45/lib        

If LDD does not find the specific location of the corresponding shared library file, there may be two possible causes:

  1. The shared library is not installed in the system;
  2. The shared library is stored outside the search path listed in the/etc/lD. So. conf file.

Generally, many open-source programs or function libraries will install themselves to the corresponding location (/usr/local/bin or/usr/local/LIB) in the/usr/local directory by default ), in order to be different from the system's own programs or function libraries. In many Linux systems, the/etc/lD. So. conf file does not contain/usr/local/lib by default. Therefore, shared libraries are often installed but cannot be found. In this case, check the/etc/lD. So. conf file. If the/usr/local/lib directory is missing, add it.
After modifying the/etc/lD. So. conf file or installing a new function library in the system, run the command ldconfig. This command is used to refresh the system's shared library cache, that is, the/etc/lD. So. cache file. To reduce the database search time of the shared library system, the shared library system maintains a cache file with the shared library so name. Therefore, after installing a new shared library, you must run ldconfig to refresh the cache.

2. Dependent libraries of MiniGUI
To correctly install MiniGUI, you need to know which function libraries are required for normal running of MiniGUI, that is, the dependent libraries of MiniGUI. Before compiling MiniGUI, ensure that the required dependent libraries are correctly installed.

2.1 libggi or svgalib
These two function libraries provide underlying graphics support for MiniGUI, which is called the "graphics engine ". Svgalib is an old function library that only supports the Linux console. libggi is a new function library that supports the Linux console and X Window, and the interface is relatively simple. To use MiniGUI correctly, you must install the libggi or svgalib revision. I suggest installing libggi because it provides support for the Linux console and X. In Linux, programs built on libggi can run on both the Linux console and X Window, thus improving program portability. In addition, for MiniGUI, if it can run on X Window, it can greatly facilitate program debugging. Another advantage of libggi is that on the Linux console, it can run on the framebuffer driver provided by the Linux 2.2 kernel, without the need for direct hardware programming on the display chip, therefore, you do not need the superuser permission to run the program. Unlike svgalib, svgalib does not support framebuffer and requires the superuser permission.
If you are using the Linux kernel 2.0.xx, you must use svgalib. This function library is actually composed of two libraries, VGA and vgagl. MiniGUI uses vgagl. This function library runs on VGA and provides good graphic functions. However, we cannot use the standard svgalib function library, this function library conflicts with the pthread function library on Linux-both use the SIGUSR1 and sigusr2 signals reserved by the operating system for the application, leading to unexpected results. To this end, we have modified svgalib. Readers should use our modified svgalib function library, which also provides a function for processing the gb2312 font display. Note that the standard svgalib vgagl library does not support the standard VGA 16-color mode. Therefore, to run MiniGUI in VGA 16-color mode, you need to download the vgagl4 function library.
The function library mentioned above can be downloaded from the following URL:

ftp://ftp.minigui.org/pub/dep-libs/libggi-2.1beta2.0-20000316.tgz        ftp://ftp.minigui.org/pub/dep-libs/ svgalib-1.4.0-hz.tar.gz        ftp://ftp.minigui.org/pub/dep-libs/ vgagl4-0.1.0.tar.gz        

You can also visit the sites of the above two free software projects:

http://www.ggi-project.orghttp://www.svgalib.org        

2.2 libttf and libt1
These two function libraries provide support for TrueType fonts and Adobe type1 fonts respectively. For MiniGUI, these two function libraries are optional. To support TrueType and Adobe type1 fonts, you must first install these two libraries. Otherwise, you do not have to install them. The configure script of MiniGUI can automatically check whether these two function libraries are installed in the system. If they are not installed, the support for TrueType and Adobe type1 fonts will be canceled.
Libttf (FreeType Library) is installed by default in the current Linux release ). However, note that the libttf version used by MiniGUI is 1.3.xx. If the installed libttf version is different, the MiniGUI cannot be compiled correctly due to compatibility issues. Therefore, you must confirm the libttf version in advance.

$ ls -l /usr/lib/libttf*        

Command to check the version number of the installed libttf library. The file name of the shared library contains the version number of the library.
The function library mentioned above can be downloaded from the following URL:

ftp://ftp.minigui.org/pub/minigui/freetype-1.3.1.tar.gz        ftp://ftp.minigui.org/pub/minigui/t1lib-1.0.1.tar.gz        

2.3 other function libraries
Other MiniGUI dependent function libraries include libjpeg, linuxthreads supporting POSIX-compatible threads, and popt libraries used to analyze command parameters. Generally, Linux releases contain these function libraries.

3. Install the dependent library of MiniGUI
In addition to svgalib, the dependent libraries of MiniGUI mentioned above provide the automake/Autoconf interface, which allows you to easily compile and install these dependent libraries. Among them, libggi has some exceptions. This function library already provides a batch processing script that can help you compile and install all libggi function libraries, including for processing input (keyboard, mouse, etc) libgii, used to process the libggi of the graphic output. For MiniGUI, you only need to install libgii and libggi. After you download the libggi-2.1beta2.0-20000316.tgz file, run


$ tar zxf libggi-2.1beta2.0-20000316.tgz        

You can unbind the tgz package and create a Degas subdirectory in the current directory. Go to the Degas/lib/directory and run the./buildall script to compile and install libraries such as libgii and libggi. Note that the buildall script should be run as root. If you want to compile a function library separately, you can enter the corresponding directory and compile it according to the normal compilation process. For example, to re-compile libggi, run the following command:

$ cd libggi        $ ./autogen.sh        $ ./configure        $ make        $ su -c  make install        

Note that before compiling libggi, you must first compile and install the libgii library.
For svgalib, you only need to unbind the software package and run make to compile and install the function library.
Note: After installing each function library, run the ldconfig command to update the search cache of the shared library and ensure that the/usr/local/lib directory is added to the/etc/LD directory. so. CONF file.

4. Compile and install MiniGUI
After the preceding dependent libraries of MiniGUI are installed, You can compile and install MiniGUI. First download the three tgz packages of MiniGUI:


ftp://ftp.minigui.org/pub/minigui/0.9.92/libminigui-0.9.92.tar.gz        ftp://ftp.minigui.org/pub/minigui/0.9.92/miniguiapps-0.9.92.tar.gz        ftp://ftp.minigui.org/pub/minigui/0.9.92/miniguiexec-0.9.92.tar.gz        ftp://ftp.minigui.org/pub/minigui/0.9.92/miniguires-0.9.92.tar.gz        

Among them, libminigui-x.xx.tar.gz is the MiniGUI function library itself. It contains three function libraries: libminigui, libmywins, and libvcongui. Miniguiapps-x.x.xx.tar.gz is a MiniGUI-based application package that currently contains two games, bomb (mine clearance) and Russia (Tetris), and a MiniGUI-based Linux console simulation program, vcongui, note that these programs can run properly after they are installed on the system. The miniguiexec-0.9.92.tar.gz is a demo program based on the MiniGUI and does not need to be installed into the system. Miniguires-0.9.92.tar.gz is a resource to be used by the MiniGUI program. Before running any MiniGUI-based program, you must first install the resource, including bitmap, icon, mouse, and so on. 4.1 compile and install libminigui.
Run the following command to open the libminigui-x.x.xx.tar.gz package ):

$ tar zxf libminigui-0.9.92.tar.gz        

The command creates a libminigui-0.9.92 directory in the current directory. Enter the directory and run the following command:

$ cd libminigui-0.9.92        $ ./autogen.sh        

Autogen. Sh is a simple script program that runs automake and Autoconf and generates the configure script in the current directory.
Run the./configure -- help script to display the following list of available command line parameters. Note the following:

$ ./configure -help        ......        --enable-debug          build with run-time debugging        --enable-tracemsg       trace messages of MiniGUI        --disable-svgalib       don't build the svgalib graphics engine        --disable-libggi        don't build the libggi graphics engine        --enable-allegro        build the allegro graphics engine        --enable-microwin       build the microwindows graphics engine        --enable-ep7211         build the ep7211 graphics engine        --enable-ads            build the ads graphics engine        --enable-gifjpg         build old GIF & JPG image support        --enable-fileid         include fileid in binary        --disable-rbfsupport    exclude raw bitmap font support        --disable-vbfsupport    exclude var bitmap font support        --disable-fontsansserif exclude incore font sansserif        --disable-fontcourier   exclude incore font courier        --disable-fontsymbol    exclude incore font symbol        --disable-fontvgas      exclude incore font vgas        --disable-ttfsupport    exclude truetype font support        --disable-type1support  exclude type1 font support        --disable-gbsupport     exclude GB2312-1980.0 charset (EUC) support        --disable-big5support   exclude Big5 charset (Big5) support        --enable-jissupport     include JIS charset support, not implemented        --disable-pcxsupport    exclude PCX file support        --disable-lbmsupport    exclude LBM/PBM file support        --disable-tgasupport    exclude TGA file support        --disable-gifsupport    exclude GIF file support        --disable-jpgsupport    exclude JPG file support        --enable-pngsupport     include PNG file support, not implemented        

The above are the command line parameters we set in the configure script, which can control the Code contained in the compiled MiniGUI. For example, run

$ ./configure --disable-svgalib --disable-gifsupport --disable-ttfsupport        

MiniGUI supports svgalib, GIF, and TrueType fonts. Conversely, if you run

$ ./configure --enable-svgalib        

You can enable MiniGUI to support svgalib. The makefile is generated by default when the./configure command is executed without any parameters.
After determining the features to be included in the MiniGUI library based on your needs, you can run commands similar to the above to generate custom makefile files. If you do not know the meaning of some options, you can simply run the./configure command.
If no problem occurs when running the./configure command, you can continue to run the make and make install commands to compile and install libminigui. Note that you must have the root permission to install the function library in the system:

$ make        $ su -c make install        

If a function library check error occurs when running the./configure command, which is usually the libggi or svgalib function library check error, it means you may have forgotten to install the dependent function library mentioned in section 2nd. You only need to install one in libggi and svgalib.
After everything is normal, run the ldconfig command to refresh the system's shared library search cache:

$ su -c ldconfig        

4.2 install miniguires
The installation of MiniGUI resources is relatively simple. You only need to unbind the software package and run the make command as root, as shown below:

$ tar zxf miniguires-0.9.92.tar.gz        $ cd miniguires-0.9.92        $ su -c make        

4.3 compile and install miniguiapps.
The process of compiling and installing miniguiapps is similar to that of libminigui. The command is as follows:

$ cd miniguiapps-0.9.92        $ tar zxf miniguiapps-0.9.92.tar.gz        $ ./autogen.sh        $ ./configure        $ make        $ su -c make install        

After correctly executing the preceding command, go to the bomb directory and run the bomb sample program. If an error occurs during running, run the LDD bomb command to check whether the shared library required by the bomb program is correctly found in Linux. If not, check whether the shared library search path is set correctly and run the ldconfig command. For other problems, see section 5th "MiniGUI configuration ". 4.4 compile miniguiexec
The process of compiling miniguiexec is similar to that of libminigui, but this package does not need to be installed in the system. The command is as follows:

$ tar zxf miniguiexec-0.9.92.tar.gz        $ cd miniguiexec-0.9.92        $ ./autogen.sh        $ ./configure        $ make        

After the correct compilation, enter the demos directory to run the demo programs, such as dlgtesst, edittest, and fontest.
If an error occurs during running, run the LDD command to check whether Linux correctly finds the shared library required by the demo program. If not, check whether the shared library search path is set correctly and run the ldconfig command. For other problems, see section 5th "MiniGUI configuration ".

5. MiniGUI Configuration
In addition to compilation and installation errors, the reason why the MiniGUI application cannot be correctly run is another common cause: configuration. The configuration is also related to the underlying graphics engine library of MiniGUI. If you use svgalib as the graphics engine, you need to edit/etc/VGA/libvga. config file. If you use libggi as the graphics engine and run MiniGUI on the Linux console, make sure that the Linux kernel contains the framebuffer driver.

5.1 settings related to svgalib
The configurations of svgalib are stored in the/etc/VGA/libvga. conf file. You need to check the file and set the following parameters correctly:

  1. Mouse type. Set the correct mouse type. The default mouse type of svgalib is Microsoft. If your mouse is PS/2, set the mouse to PS2.
  2. Deselect the mouse acceleration option of svgalib. Set mouse_accel_type to off.
  3. Mouse port. Set mdev to the correct mouse device. For example, for the PS/2 mouse, you need to set mdev to/dev/psaux.
  4. Set the display chip correctly. The chipset in/etc/VGA/libvga. conf specifies the display chip type and model. If your display chip is not listed in it, try setting the chipset to Vesa. VESA is a VESA-compatible display chip. svgalib operates the display card through the vesa bios interface. Because most display cards are vesa bios 2.0 compatible, you can set the chipset to VESA for better color depth and resolution.

After setting up the above program, try to run MiniGUI. If there is still a problem, please send a mail to our mail list minigui-devel@egroups.com to illustrate your problem. 5.2 how to set framebuffer
If you use libggi as the MiniGUI graphics engine and run it on the Linux console, you must first include the framebuffer driver in the Linux kernel. After the installation of many release versions, they run under the support of framebuffer by default, that is, in graphic mode, such as bluepoint Linux and turbolinux 6.x. However, it is possible that the display mode of framebuffer is not suitable for running MiniGUI. Therefore, you can use the fbset command to modify the display mode. However, some framebuffer does not support modification of the display mode, such as VESA framebuffer. If you use VESA framebuffer, You can edit the Linux kernel boot parameters to set the correct display mode. For the VESA framebuffer driver, you can edit the/etc/Lilo. conf file as follows:
The installation of MiniGUI resources is relatively simple. You only need to unbind the software package and run the make command as root, as shown below:

boot=/dev/hda        map=/boot/map        install=/boot/boot.b        prompt        timeout=10        default=linux        image=/boot/vmlinuz-2.2.14-5.0        label=linux        read-only        vga=0x0317        root=/dev/hda1        

Note that a VGA = 0x0317 line is added. The number displayed in hexadecimal format on the right of the row is the VESA display mode number. The following table shows the available VESA mode numbers:

 Colours   640x400 640x480 800x600 1024x768 1280x1024 1600x1200        --------+-----------------------------------------------------        4 bits |    ?       ?     0x302      ?        ?         ?        8 bits |  0x300   0x301   0x303    0x305    0x307     0x31C        15 bits |    ?     0x310   0x313    0x316    0x319     0x31D        16 bits |    ?     0x311   0x314    0x317    0x31A     0x31E        24 bits |    ?     0x312   0x315    0x318    0x31B     0x31F        32 bits |    ?       ?       ?        ?        ?         ?        

You should determine the display mode based on your display card and display.
Run Lilo and restart the computer after setting/etc/Lilo. conf correctly. If everything works, a cute little penguin is displayed in the upper-left corner of the screen during Linux boot.
For more information about Linux framebuffer, see the framebuffer-howto document. 5.3/etc/MiniGUI. cfg
/Etc/MiniGUI. cfg is the configuration file of MiniGUI. It does not need to be modified when it is installed by default. Because the configuration file adopts a very brief format, it is easy to modify. The format is as follows:

[section-name1]        key-name1=key-value1        key-name2=key-value2        [section-name2]        key-name3=key-value3        key-name4=key-value4        

The parameters in this configuration file are grouped by section, and then the parameters and their values are specified in the form of key = value. The following describes some important sections ). 5.3.1 System
The system section specifies the graphics engine used by MiniGUI, the mouse device, and the type, which are specified by the engine, mdev, and mtype keys respectively. Because the MiniGUI library can contain multiple graphics engines at the same time, the engine can be used to specify which graphics engine to use. Mdev and mtype are used to specify the mouse device and mouse type respectively. 5.3.2 svgalib and libggi
These two sections are used to set configurations related to svgalib and libggi respectively. Currently, only the ultmode in the svgalib segment is used to define the graphic mode used by svgalib, And the libggi segment has no parameters. 5.3.2 systemfont
The systemfont segment defines the system font of the MiniGUI and should not be changed by default. Font_number specifies the number of system fonts to be loaded. Then, name and fontfile are used to indicate the font names numbered NR and the path of the font files. The format of the body name is as follows:

<type>-<name>-<style>-<width>-

For system fonts, you can modify the number of loads, but at least you need to load the character set as the ISO8859-1 font. You can also modify the size of the system font, for example, the following systemfont specifies that the MiniGUI uses a 16-dot-matrix system font and only loads the font used to display the ISO8859-1 and GB2312-80 character sets:

[systemfont]        font_number=2        name0=rbf-song-rrncnn-8-16-ISO8859-1        fontfile0=/usr/local/lib/minigui/fonts/8x16.bin        name1=rbf-song-rrncnn-16-16-GB2312.1980-0        fontfile1=/usr/local/lib/minigui/fonts/gb16song.bin        

5.3.3 rawbitmapfonts, varbitmapfonts, truetypefonts, and t1fonts
These segments are used to specify other font information to be loaded. The meaning of the CIDR block is the same as that of system. When a certain font support is required, you can modify these segments to specify the appropriate font. 5.3.4 bitmapinfo and bgpicture
The bitmapinfo segment is used to specify the bitmap used by the MiniGUI. Two keys may need to be modified: bgpicture and logo. The former specifies the background image of the MiniGUI, and the latter specifies the logo of the MiniGUI. In addition, the two groups of key values, including arrowup and arrowupd, are repeatedly defined in this section, which are used to retrieve 12-dot-matrix and 16-dot-matrix in the system font respectively. When the system font is 16-dot-matrix, move the subsequent settings to the front.
Bgpicture is used to specify the position of the MiniGUI background. You can select one of the settings.
Except for the preceding sections, you do not need to modify them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.