Hello! please find enclosed a patch to enable grub to work with any kind of serial console, not just vt100. This is realized by a new builtin command called "terminfo" which could be used to set the 6 different escape sequences used by grub to their correct value. E.g. you would say for a ibm3161 terminal:
terminfo --name=ibm3161 --cursor_left=\ED --cursor_right=\EC --cursor_address=\EY%p1%{32}%+%c%p2%{32}%+%c --clear_screen=\EH\EJ --enter_standout_mode=\E4A --exit_standout_mode=\E4@\E<@ Then I changed a few lines of grub, so that the hard coded escape sequences of vt100 are replaced by the given variables. The default of grub is still vt100, so if the user will not use the new builtin command, then grub will behave as before. The user can get the above terminfo command line by using the infocmp(1) command under linux or by using the shell skript util/make-terminfo-command which is also included in this patch. This shell skript will print out the correct command line for a given terminal by asking ncurses for the right escape sequences. The above command line is generated by "make-terminfo-command". The most complicated thing of this terminal emulation was the "cursor_address" command, because every terminal uses its own way to specify the X/Y position of the cursor. Therefore I decided to include the file "tparm.c" from ncurses-5.2 and modify it slightly, so that it can be used within grub. The main thing was to change the memory allocation from dynamic to static. Ncurses-5.2 is (C) by FSF and inclusion should be no problem. The license is more "weak" than GPL, its basically BSD-like. I also attached a second file "read_terminfo.c" which is a small standalone program to show how a binary terminfo database file could be read. It follows the description of term(5) about the terminfo file format, which is mainly portable between most unixes. If you like the idea, then I could send you a seconds patch of grub, which would take the escape sequences from a terminfo file. Then the user must not deal with complicated escape sequences but will simply copy the needed terminfo file to /boot/grub/... and let grub read it. This should be no problem and would be easier for the user. However, as many on the list has suggested I started with a "simple" patch to define the needed escape sequences instead of reading the terminfo file. This "read_terminfo" is just an idea. What do you think? So please tell me what you think about this patch and if you are willing to apply it or if you would like me to change something... I'm at your command! :-) Till -- +-------+-------------------------------------------------------------+ | | dr. tilmann bubeck reinform medien- und | | rein | informationstechnologie AG | | form | cell.: +49 (172) 8 84 29 72 koenigstrasse 80 | | AG | fax : +49 (711) 7 22 77 34 70173 stuttgart / germany | | | email: [EMAIL PROTECTED] http://www.reinform.de | +-------+----------------------------------------------(in gruendung)-+
grub-terminal-emulation.patch
Description: Binary data
read_terminfo.c
Description: Binary data