WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)  (Read 8094 times)

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
hello,
according the syslinux wiki, a keyboard can be loaded at boot time, with following data in syslinux.cfg

...
label DE-Latin1
menu label DE-Latin1
kernel kbdmap.c32
append DE.ktl

...
label FR-AZERTY
menu label FR-AZERTY
kernel kbdmap.c32
append FR.ktl
..

Question: how DE.ktl and FR.ktl can be created with TCL?


There are hints for solutions
here http://syslinux.zytor.com/wiki/index.php/Doc/keytab-lilo
or here http://syslinux.zytor.com/archives/2006-March/006706.html
but I could not find any /usr/lib/kbd.. in TCL in order to progress
« Last Edit: May 28, 2011, 06:04:02 PM by floppy »
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11038
If you need the console keymaps in their original formats, grab the kbd source tarball.
The only barriers that can stop you are the ones you create yourself.

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
If you need the console keymaps in their original formats, grab the kbd source tarball.
Thanks for the advice. I found it. This is a tar.xz file. How to untar it? Different tries did not work.
tar ?? kbd-1.15.2.tar.xz
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14785
tar xvf, no?

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
tar xvf kbd-1.15.2.tar.xz
tar: xz: Kann exec nicht ausführen: No such file or directory
tar: Nicht behebbarer Fehler: Programmabbruch.
tar: Child returned status 2
tar: Beende mit Fehlerstatus aufgrund vorheriger Fehler
(on ubuntu 10.04)
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11038
Either Ubuntu's tar is too old, or you don't have xz installed on the ubuntu box. Unpack on TC ;)
The only barriers that can stop you are the ones you create yourself.

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
Either Ubuntu's tar is too old, or you don't have xz installed on the ubuntu box. Unpack on TC ;)
Latest status:
yes!. done.
now I am searching for the keytab-lilo.pl
Seems to be in the lilo extension: so, I downloaded + loaded the extension.
But I am still searching for keytab-lilo.pl
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
@floppy: Sometimes documentation and actual file names are not in sync with each other: I for one can "see" a 'utils/keytab-lilo' in the v4.03 sources. Is this what you are after?


EDIT: Correction of the directory name.
« Last Edit: May 30, 2011, 06:43:34 PM by maro »

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
@floppy: Sometimes documentation and actual file names are not in sync with each other: I for one can "see" a 'lilo/keytab-lilo' in the v4.03 sources. Is this what you are after?
I look after keytab-lilo.pl (a program). v4.03 sources of what? where?
I cannot find the sources of lilo-static in the TCL sources.
I will look now in the official lilo repos.
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
OK, I don't know what went wrong as I usually use copy/paste to avoid this class of mistakes, but the directory name was incorrect. So to spell it out more slowly: The v4.03 sources of syslinux contains a directory called 'utils' in which one can find a file called 'keytab-lilo'. This file is a Perl script I assume that is the one that somewhere else might be called 'keytab-lilo.pl'.

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
The v4.03 sources of syslinux contains a directory called 'utils' in which one can find a file called 'keytab-lilo'. This file is a Perl script I assume that is the one that somewhere else might be called 'keytab-lilo.pl'.
Good advice. It seems to be the correct file.
I made "sudo keytab-lilo pathtothefilede-latin1.map > de.ktl"
The execution show "unable to execute.. no such file or directory".. curious. I am using the syslinux 3.83 and the kbd-1.15.2. I must further dig in the topic.
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
I made "sudo keytab-lilo pathtothefilede-latin1.map > de.ktl"
The execution show "unable to execute.. no such file or directory".. curious. I am using the syslinux 3.83 and the kbd-1.15.2. I must further dig in the topic.
The obvious question: Do you have the 'perl5.tcz' extension installed?

It appeared to me to be such a trivial precondition for running a Perl script that I did not bother to mention it explicitly.

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
perl5 was not installed. Now, I loaded the perl5 extension.
With the command "perl keytab-lilo" uk.map > uk.ktl", the error
"loadkeys -m us.kmap: No such file or directory" is coming.

keytab-lilo is hereunder.
On my PC, the bootcode was kmap=qwertz/de-latin1.

I tried to change the extension .kmap in .map in this script because the file us.map was in the directory of "keytab-lilo". the file uk.map was in the directory too. A file uk.ktl with 0kb was created. Then the new error "loadkeys -m us.map: No such file or directory" is coming. So, I am still thinking about what to do (I have no perl experience).
Any advice is welcome.


#!/usr/bin/perl

eval { use bytes; };
eval { binmode STDOUT; };

$DEFAULT_MAP = "us";
$DEFAULT_EXT = ".kmap";

sub usage
{
    print STDERR
      "usage: $0 [ -p old_code=new_code ] ...\n".
      (" "x(8+length $0))."[path]default_layout[.kmap] ] ".
      "[path]kbd_layout[.kmap]\n";
}

while ($ARGV[0] eq "-p") {
    shift(@ARGV);
    &usage unless $ARGV[0] =~ /=/;
    $table[eval($`)] = eval($');
    shift(@ARGV);
}
&usage unless defined $ARGV[0];
load_map("def",defined $ARGV[1] ? $ARGV[0] : undef);
load_map("kbd",defined $ARGV[1] ? $ARGV[1] : $ARGV[0]);
&build_table("plain","shift","ctrl","altgr","shift_ctrl",
  "altgr_ctrl","alt","shift_alt","ctrl_alt");
for ($i = 0; $i < 256; $i++) {
    printf("%c",$table[$i] ? $table[$i] : $i) || die "print: $!";
}
close STDOUT || die "close: $!";


sub load_map
{
    local ($pfx,$map) = @_;
    local ($empty,$current);

    $map = $DEFAULT_MAP unless defined $map;
    $map .= $DEFAULT_EXT unless $map =~ m|/[^/]+\.[^/]+$|;
    if (!open(FILE,"loadkeys -m $map |")) {
   print STDERR "loadkeys -m $map: $!\n";
   exit 1;
    }
    undef $current;
    $empty = 1;
    while (<FILE>) {
   chop;
   if (/^(static\s+)?u_short\s+(\S+)_map\[\S*\]\s+=\s+{\s*$/) {
       die "active at beginning of map" if defined $current;
       $current = $pfx.":".$2;
       next;
   }
   undef $current if /^};\s*$/;
   next unless defined $current;
   s/\s//g;
   $map{$current} .= $_;
   $empty = 0;
    }
    close FILE;
    return unless $empty;
    print STDERR "Keymap is empty\n";
    exit 1;
}


sub build_table
{
    local (@maps) = @_;
    local (@tmp);

    $set = 0;
    for $map (@maps) {
   $code = $set;
   for (split(",",$map{"def:".$map})) {
       die "bad map entry $_ (def, map $map)" unless /^0x\S\S(\S\S)$/;
       $tmp[$code] = hex $1 unless $tmp[$code];
       $code++;
   }
   $set += 256;
    }
    $set = 0;
    for $map (@maps) {
   $code = $set;
   for (split(",",$map{"kbd:".$map})) {
       die "bad map entry $_ (kbd, map $map)" unless /^0x\S\S(\S\S)$/;
       $table[$tmp[$code]] = hex $1 unless $table[$tmp[$code]];
       $code++;
   }
   $set += 256;
    }
    $table[0] = 0;
}
« Last Edit: June 05, 2011, 11:27:11 AM by floppy »
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
OK, having Perl installed is not enough when this script depends on 'loadkeys'. Apparently the sources for this tool are included in 'kbd' and an earlier post indicates to me that two years ago it might have been part of the 'kmaps' extension, but not any longer.

So one could just download (what I assume to be the latest version of) those sources, compile the lot and copy the tool into the $PATH to satisfy 'keytab-lilo':
    wget http://ftp.kernel.org/pub/linux/utils/kbd/kbd-1.15.3.tar.bz2
    tce-load -wil compiletc
    tar xf kbd-1.15.3.tar.bz2
    cd kbd-1.15.3
    ./configure && make ; sudo cp -p src/loadkeys /usr/local/bin && cd ..

Note: There are some slightly strange things happening (e.g. 'configure' is re-run by 'make' and then 'make' bails out in the 'po' directory), but as far as 'loadkeys' is concerned you should be OK.

With the 'loadkeys' tool in place (and the extracted *.map files still present) I proceeded with the download of the other required extensions. I then managed to execute 'keytab-lilo' which produced a keyboard layout file:
    tce-load -wil syslinux perl5
    ( cd kbd-1.15.3/data/keymaps/i386 ; keytab-lilo qwerty/us.map qwerty/uk.map > ~/uk.ktl )
Note: The directory in which to execute 'keytab-lilo' appeared to be significant for the success of the operation. Furthermore I need to state that I have not tested the resulting file at all since I have no use for such a file.

And finally I wonder whether 'loadkeys' might be worth to be included in an extension (like 'kmaps.tcz'). OTOH as TC uses IIRC a "special" keymaps format from BusyBox it's use for the Core might be rather limited.

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
Thanks Maro.
By installing the "rescuecd" on my CF, I found a lot of ktl files in the iso. So, I will try your method if the already available ktl files are not working.
« Last Edit: June 12, 2011, 06:05:21 PM by floppy »
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed