Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: floppy on May 28, 2011, 11:02:06 AM

Title: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on May 28, 2011, 11:02:06 AM
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
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: curaga on May 29, 2011, 02:06:25 AM
If you need the console keymaps in their original formats, grab the kbd source tarball.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on May 29, 2011, 07:23:00 AM
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
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: Juanito on May 29, 2011, 07:38:39 AM
tar xvf, no?
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on May 29, 2011, 10:24:45 AM
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)
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: curaga on May 29, 2011, 11:02:32 AM
Either Ubuntu's tar is too old, or you don't have xz installed on the ubuntu box. Unpack on TC ;)
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on May 29, 2011, 04:49:36 PM
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
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: maro on May 29, 2011, 10:52:29 PM
@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.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on May 30, 2011, 04:48:59 PM
@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.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: maro on May 30, 2011, 06:42:41 PM
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'.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on May 31, 2011, 05:09:40 PM
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.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: maro on May 31, 2011, 11:44:33 PM
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.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on June 05, 2011, 08:54:21 AM
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;
}
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: maro on June 08, 2011, 01:06:07 AM
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 (http://forum.tinycorelinux.net/index.php?topic=2098.msg11269#msg11269) 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.
Title: Re: syslinux: how to make setup files for a keyboard menu choice? (UK, DE, FR)
Post by: floppy on June 12, 2011, 06:01:50 PM
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.