All of lore.kernel.org
 help / color / mirror / Atom feed
* GRUB 1.99~rc2 released
@ 2011-04-20 14:37 Vladimir 'φ-coder/phcoder' Serbinenko
  2011-04-21  7:48 ` Treutwein Bernhard
  0 siblings, 1 reply; 17+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-04-20 14:37 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 5842 bytes --]

Hello, all

I'm proud to announce the release of GNU GRUB version 1.99~rc2.

This time we include the ability of GRUB to be firmware on Yeeloong.

This is also the first time we officially include ZFS and BtrFS support.

This is a prerelease. I was able to personaly verify that following
ports are functional: i386-pc, mipsel-yeeloong (including as firwmare),
sparc64-ieee1275, powerpc-ieee1275. Additionaly automated tests were
done with qemu.
However I can't verify everything myself. So please give it a good test,
especially if you have a particular hardware, configuraton or requirements.

The release file is bigger than it should be because of autogeneration
issues. Other than the size these issues have no impact but their fixing
is scheduled for next release.

GRUB, also known as the GRand Unified Bootloader, is a modular, portable
bootloader that supports a number of platforms, including standard
BIOS-based
PCs, IEEE-1275 platforms (such as the OLPC and some PowerPC/Sparc64
hardware), coreboot, the free (as in freedom) pre-boot initialization
framework, and Yeeloong, free (as in freedom)
Loongson-2F-based (MIPS compliant CPU) laptop.

Other major improvements include (extract from NEWS file):

* Keyboard layouts support.

* Parser for GRUB Legacy configuration files.

* Extend `vbeinfo' and `vbetest' commands to non-VBE graphics, as
  `videoinfo' and `videotest'.

* New `lsefisystab', `lssal', and `lsefimmap' commands on EFI platforms.

* Support explicit user claim that a device is BIOS-visible.  Devices
  listed in device.map will be assumed to be readable using only BIOS
  facilities, rather than anything more complex such as LVM or RAID.

* New bash-completion script for GRUB utilities.

* Use ACPI to shut down if possible.

* New `lsacpi' command.

* New `--boot-directory' option to `grub-install', `grub-reboot', and
  `grub-set-default', with clearer semantics than the previous
  `--root-directory' option.

* Rename CD-ROM device to "cd" on BIOS platforms.

* Transparent decompression filters.

* Simpler PXE image generation.  New `grub-mknetdir' utility to generate
  netboot directory trees.

* New relocator.  Allows for more kernel support and more
  straightforward loader writing.

* Handle USB pendrives exposed as floppies.

* New Automake-based build system.

* Add `sendkey' command (i386-pc only).

* Support 1.x versions of mdadm metadata.

* Fix corruption when reading Reiserfs directory entries.

* Bidirectional text and diacritics support.

* Change grub-mkdevicemap to emit /dev/disk/by-id/ names where possible
  on GNU/Linux.

* Add `grub-mkconfig' support for Xen with Linux.

* Add `grub-mkconfig' support for initrd images on Fedora 13.

* Support >3GiB and <16MiB RAM in i386-qemu.

* Add support for Cirrus 5446 and Bochs video cards.

* Load more appropriate video drivers automatically in `grub-mkconfig'.

* USB improvements, including hotplugging/hotunplugging, hub support,
  and USB serial support.

* AMD Geode CS5536 support.

* Extensive updates to the Texinfo documentation.

* Add `grub-probe' support for the btrfs filesystem, permitting / to
  reside on btrfs as long as /boot is on a filesystem natively supported
  by GRUB.

* Handle symbolic links under /dev/mapper on GNU/Linux.

* Handle installation across multiple partition table types.

* Add `cmostest' command (i386/x86_64 only).

* Add support for DM-RAID disk devices on GNU/Linux.

* Remove `grub-mkisofs'.  `grub-mkrescue' now uses GNU xorriso to build
  CD images.

* `grub-mkrescue' support for EFI, coreboot, and QEMU platforms.

* Unify `grub-mkimage', `grub-setup', and `grub-install' source code
  across platforms.

* Fix VGA (as opposed to VBE) video driver, formerly a terminal driver.

* Add menu hotkey support.

* Add support for the nilfs2 filesystem.

* `grub-probe' and `grub-mkconfig' support for NetBSD.

* Support setting a background image in `grub-mkconfig'.

* Support multiple terminals in `grub-mkconfig'.

* Regexp support.

* MIPS multiboot2 support.

* Multiboot2 tag support.

* sunpc partition table support.

* Add a number of new language features to GRUB script: `for', `while',
  `until', `elif', function parameters, `break', `continue', `shift',
  multi-line quoted strings, positional parameters with `setparams',
  `return', filename wildcard expansion, and `!'.

* Support nested partition tables.  GRUB now prefers to name partitions
  in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'.

* Speed up consecutive hostdisk operations on the same device.


  <http://www.gnu.org/software/grub/>

A source tarball for the new release can be found at:

  http://alpha.gnu.org/gnu/grub/grub-1.99~rc2.tar.gz

and its GPG detached signature [*]:

  http://alpha.gnu.org/gnu/grub/grub-1.99~rc2.tar.gz.sig

[*] You can use either of the above signature files to verify that
the corresponding file (without the .sig suffix) is intact.  First,
be sure to download both the .sig file and the corresponding tarball.
Then, run a command like this:

  gpg --verify grub-1.99~rc2.tar.gz.sig

If that command fails because you don't have the required public key,
then run this command to import it:

  gpg --keyserver keys.gnupg.net --recv-keys E82E4209

and rerun the `gpg --verify' command.

This release was bootstrapped with the following tools:
  Autoconf 2.68
  Automake 1.11.1

GCC 4.4 is the recommended version for building it, although any version
starting with 4.1.3 is supported in this release.

I hope you enjoy using GRUB as much as we enjoyed developing it.

-- Regards Vladimir 'φ-coder/phcoder' Serbinenko

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko






[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: GRUB 1.99~rc2 released
  2011-04-20 14:37 GRUB 1.99~rc2 released Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-04-21  7:48 ` Treutwein Bernhard
       [not found]   ` <BANLkTimQzFVfZ+ah=0EBm_mQWiXFcr2nwA@mail.gmail.com>
  2011-04-22 22:34   ` Keyboard layouts (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 17+ messages in thread
From: Treutwein Bernhard @ 2011-04-21  7:48 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi Vladimir,

congratulations for the new release candidate. 

The announcement reads really impressive.

[...]
> * Keyboard layouts support.
> 

I have been really waiting for this, how do I use it?

regards & thanks in advance
--
  Bernhard 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: RE: GRUB 1.99~rc2 released
       [not found]   ` <BANLkTimQzFVfZ+ah=0EBm_mQWiXFcr2nwA@mail.gmail.com>
@ 2011-04-21 15:29     ` Craig Sparks
  2011-04-22 22:30       ` Luks inclusion (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 17+ messages in thread
From: Craig Sparks @ 2011-04-21 15:29 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

When is luks going to be added so we can encrypt the boot partition also?

On Apr 21, 2011 3:48 AM, "Treutwein Bernhard" <
Bernhard.Treutwein@verwaltung.uni-muenchen.de> wrote:

Hi Vladimir,

congratulations for the new release candidate.

The announcement reads really impressive.

[...]
> * Keyboard layouts support.
>

I have been really waiting for this, how do I use it?

regards & thanks in advance
--
 Bernhard

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

[-- Attachment #2: Type: text/html, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Luks inclusion (was Re: GRUB 1.99~rc2 released)
  2011-04-21 15:29     ` Craig Sparks
@ 2011-04-22 22:30       ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-04-25 13:21         ` [RFT] LUKS and GELI (was Re: Luks inclusion) Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 17+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-04-22 22:30 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

On 21.04.2011 17:29, Craig Sparks wrote:
>
> When is luks going to be added so we can encrypt the boot partition also?
>
I've cleaned the patch (took a lot of time), not because I believe it's
a useful feature but since it has become an often requested one.
The branch is available at
http://bzr.savannah.gnu.org/r/grub/branches/luks/ .
You need to set GRUB_LUKS_ENABLE=y. Beware that:
a) Crypto in GRUB is much less performant than in kernel due to
inavailability of many accelerated instructions. So prepare for key
recovery taking considerable time or decrease key strengthening.
b) You'll need to enter passphrase twice. Once for GRUB, once for OS.
c) Encrypting doesn't guarantee integrity. Your /boot can be tempered
with even if it's encrypted and GRUB has no way of finding it out.
Encryption is about secrecy and /boot doesn't contain anything secret.
d) core is unencrypted (since BIOS has no encryption support)
e) core needs a much bigger embedding zone
f) no writing to luks as of now.
But even regardless of all that criticism which puts this as
low-priority, I'm fed up with feature requests and since unless it's
activated manually LUKS in GRUB doesn't kick in, I've done the cleanup.
Now you do the tests and report the results back

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Keyboard layouts (was Re: GRUB 1.99~rc2 released)
  2011-04-21  7:48 ` Treutwein Bernhard
       [not found]   ` <BANLkTimQzFVfZ+ah=0EBm_mQWiXFcr2nwA@mail.gmail.com>
@ 2011-04-22 22:34   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2011-05-03  9:04     ` grub-mklayout - Unknown key KP_Comma (was: Keyboard layouts & previously: " Treutwein Bernhard
  2011-05-23 13:22     ` Keyboard layouts Treutwein Bernhard
  1 sibling, 2 replies; 17+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-04-22 22:34 UTC (permalink / raw)
  Cc: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]


> I have been really waiting for this, how do I use it?
>
 ckbcomp /usr/share/X11/xkb/symbols/ch | grub-mklayout -o /boot/ch.gkb
in grub.cfg:
keymap /boot/ch.gkb
terminal_input at_keyboard



-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [RFT] LUKS and GELI (was Re: Luks inclusion)
  2011-04-22 22:30       ` Luks inclusion (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-04-25 13:21         ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 17+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-04-25 13:21 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]

Hello all. I've added both LUKS and GELI (except version-0, big-endian
volumes, keyfiles and HMAC) to my luks branch

> I've cleaned the patch (took a lot of time), not because I believe it's
> a useful feature but since it has become an often requested one.
> The branch is available at
> http://bzr.savannah.gnu.org/r/grub/branches/luks/ .
> You need to set GRUB_LUKS_ENABLE=y. Beware that:
It was renamed to GRUB_CRYPTODISK_ENABLE=y
> a) Crypto in GRUB is much less performant than in kernel due to
> inavailability of many accelerated instructions. So prepare for key
> recovery taking considerable time or decrease key strengthening.
> b) You'll need to enter passphrase twice. Once for GRUB, once for OS.
> c) Encrypting doesn't guarantee integrity. Your /boot can be tempered
> with even if it's encrypted and GRUB has no way of finding it out.
> Encryption is about secrecy and /boot doesn't contain anything secret.
> d) core is unencrypted (since BIOS has no encryption support)
> e) core needs a much bigger embedding zone
> f) no writing to luks as of now.
> But even regardless of all that criticism which puts this as
> low-priority, I'm fed up with feature requests and since unless it's
> activated manually LUKS in GRUB doesn't kick in, I've done the cleanup.
> Now you do the tests and report the results back
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* grub-mklayout - Unknown key KP_Comma (was: Keyboard layouts & previously: Re: GRUB 1.99~rc2 released)
  2011-04-22 22:34   ` Keyboard layouts (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-05-03  9:04     ` Treutwein Bernhard
  2011-05-03  9:19       ` grub-mklayout - Unknown key KP_Comma Vladimir 'φ-coder/phcoder' Serbinenko
  2011-05-23 13:22     ` Keyboard layouts Treutwein Bernhard
  1 sibling, 1 reply; 17+ messages in thread
From: Treutwein Bernhard @ 2011-05-03  9:04 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: bug-grub

Dear Vladimir,

thanks for your quick reply and sorry for my late answer (I've been off for
Easter vacations) ...

[...]
> >
>  ckbcomp /usr/share/X11/xkb/symbols/ch | grub-mklayout -o /boot/ch.gkb

I'm getting (after fetching, ./configure && make) when I'm trying to use it:

ckbcomp /usr/share/X11/xkb/symbols/de | ./grub-mklayout -o de.gkb
Unknown key KP_Comma
Unknown key KP_Comma
Unknown key KP_Comma
Unknown key KP_Comma

These error messages appear to come from grub-mklayout, since 
ckbcomp /usr/share/X11/xkb/symbols/de > /dev/null
doesn't produce them.

May I ignore these messages?

BTW: I tried the whole with a HD installed grml (Hello Wien, 
see http://www.grml.org, kernel 2.6.31 glibc 2.9).
-- 
 Regards
      Bernhard
 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: grub-mklayout - Unknown key KP_Comma
  2011-05-03  9:04     ` grub-mklayout - Unknown key KP_Comma (was: Keyboard layouts & previously: " Treutwein Bernhard
@ 2011-05-03  9:19       ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 17+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-05-03  9:19 UTC (permalink / raw)
  To: Treutwein Bernhard; +Cc: The development of GNU GRUB, bug-grub

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

On 03.05.2011 11:04, Treutwein Bernhard wrote:
> ckbcomp /usr/share/X11/xkb/symbols/de | ./grub-mklayout -o de.gkb
> Unknown key KP_Comma
> Unknown key KP_Comma
> Unknown key KP_Comma
> Unknown key KP_Comma
>
> These error messages appear to come from grub-mklayout, since 
> ckbcomp /usr/share/X11/xkb/symbols/de > /dev/null
> doesn't produce them.
>
> May I ignore these messages?
yes

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: Keyboard layouts
  2011-04-22 22:34   ` Keyboard layouts (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
  2011-05-03  9:04     ` grub-mklayout - Unknown key KP_Comma (was: Keyboard layouts & previously: " Treutwein Bernhard
@ 2011-05-23 13:22     ` Treutwein Bernhard
  1 sibling, 0 replies; 17+ messages in thread
From: Treutwein Bernhard @ 2011-05-23 13:22 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi Vladimir,

now I had success in using

>  ckbcomp /usr/share/X11/xkb/symbols/de | grub-mklayout -o /boot/de.gkb

and 

> in grub.cfg:
> keymap /boot/ch.gkb
> terminal_input at_keyboard

but I had to boot grml (a Debian sid based recovery distro) to create
the de.gkb file. Normally I'm using TinyCore for testing Grub-2, but 
TinyCore only has the BusyBox kmap file format. There are hints (see:
http://forum.tinycorelinux.net/index.php?topic=9730.msg52949#msg52949)
that the kmap format is essentially the loadkeys format in a more 
compact form. 

Do you know a way to convert the kmap format used by BusyBox to the 
format expected by Grub-2? 

regards
--
  Bernhard 



^ permalink raw reply	[flat|nested] 17+ messages in thread

* keyboard layouts
@ 2010-03-19 23:45 Carles Pina i Estany
  0 siblings, 0 replies; 17+ messages in thread
From: Carles Pina i Estany @ 2010-03-19 23:45 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]


Hello,

I have been one month and something without doing lot of Grub things. I
think that last time that I did something was going/coming from Fosdem
:-/

Hopefully soon I can finish the keyboard layouts. See my branch:
sftp://cpina@bzr.savannah.gnu.org/srv/bzr/grub/people/cpina/keyboard_layouts/

Or my attached patch.

Right now (and this needs a change) the modules at_keyboard and
usb_keyboard doesn't need the at_keyboard_layouts and
usb_keyboard_layouts (they have the default layout hardcoded).

If the user loads usb_keyboard_layouts, usb_keyboard gets loaded (same
with AT).

Vladimir suggested, to simplify (usb_keyboard_layouts and
at_keyboard_layouts are mainly the same with some defines) that
usb_keyboard should depend on keyboard_layouts (generic) and at_keyboard
should depen on keyboard_layouts (generic as well).
Vladimir: is it what you suggested? Was some time ago...

I didn't like a lot because in some circumstancies maybe we don't want
layouts at all (some users, environments, etc.)

Vladimir liked (if I remember correctly) to avoid having two modules
(instead of only one).

I have the feeling that I'm biased and I've ate some vladimir reason :-/

I'll do the changes when we will agree.

Cheers,

-- 
Carles Pina i Estany
	http://pinux.info

[-- Attachment #2: keyboard_layouts.patch --]
[-- Type: text/x-diff, Size: 28296 bytes --]

=== added file 'ChangeLog.keyboard_layouts'
--- ChangeLog.keyboard_layouts	1970-01-01 00:00:00 +0000
+++ ChangeLog.keyboard_layouts	2010-02-13 23:49:34 +0000
@@ -0,0 +1,31 @@
+2010-01-18  Carles Pina i Estany  <carles@pina.cat>
+
+	Adds keyboard layouts support (AT and USB)
+
+	* conf/common.rmk (bin_UTILITIES): Add grub-mklayouts rules.
+	(pkglib_MODULES): Add module `at_keyboard_layouts.mod' and
+	`usb_keyboard_layouts.mod'.
+	* include/grub/at_keyboard.h: Include `"keyboard.h"'. New EXPORT_VAR
+	`grub_keyboard_map'.
+	* include/grub/keyboard.h: New file.
+	* include/grub/keyboard_layouts.h: New file.
+	* include/grub/term.h: Move macros from here ...
+	* include/grub/keys.h: ... to here. New file.
+	* include/grub/usb_keyboard.h: New file.
+	* keyboard_layouts/keyboard_layouts.c: New file.
+	* keyboard_layouts/at_keyboard_layouts.c: New file.
+	* keyboard_layouts/usb_keyboard_layouts.c: New file.
+	* term/at_keyboard.c: Include `<grub/mm.h>'.
+	(grub_at_keyboard_map): Declare.
+	(keyboard_map_normal): Renamed from keyboard_map.
+	(grub_at_keyboard_getkey_noblock): Use `grub_keyboard_map' instead of
+	`keyboard_map' and `keyboard_map_shift'.
+	(GRUB_MOD_INIT): Initialise `grub_at_keyboard_map'.
+	* term/usb_keyboard.c: Include `<grub/mm.h>' and
+	`<grub/usb_keyboard.h>'.
+	(grub_usb_keyboard_map): Declare.
+	(keyboard_map_normal): Renamed from keyboard_map.
+	(grub_usb_keyboard_checkkey): Use `keyboard_map_normal' instead of
+	`keyboard_map'.
+	(GRUB_MOD_INIT): Initialise `grub_usb_keyboard_map'.
+	* util/grub-mklayouts.c: New file.

=== modified file 'conf/common.rmk'
--- conf/common.rmk	2010-03-14 16:50:55 +0000
+++ conf/common.rmk	2010-03-19 23:20:58 +0000
@@ -91,6 +91,10 @@ endif
 bin_UTILITIES += grub-mkrelpath
 grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
 
+# For grub-mklayouts.
+bin_UTILITIES += grub-mklayouts
+grub_mklayouts_SOURCES = gnulib/progname.c util/grub-mklayouts.c util/misc.c
+
 bin_UTILITIES += grub-bin2h
 grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
 
@@ -131,6 +135,18 @@ grub_script.tab.c grub_script.tab.h: scr
 	$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
 DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
 
+# For at_keyboard_layouts.mod
+pkglib_MODULES += at_keyboard_layouts.mod
+at_keyboard_layouts_mod_SOURCES = keyboard_layouts/at_keyboard_layouts.c 
+at_keyboard_layouts_mod_CFLAGS = $(COMMON_CFLAGS)
+at_keyboard_layouts_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For usb_keyboard_layouts.mod
+pkglib_MODULES += usb_keyboard_layouts.mod
+usb_keyboard_layouts_mod_SOURCES = keyboard_layouts/usb_keyboard_layouts.c 
+usb_keyboard_layouts_mod_CFLAGS = $(COMMON_CFLAGS)
+usb_keyboard_layouts_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For grub-script-check.
 grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
 	rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@

=== modified file 'include/grub/at_keyboard.h'
--- include/grub/at_keyboard.h	2009-12-25 22:29:47 +0000
+++ include/grub/at_keyboard.h	2010-02-13 23:05:39 +0000
@@ -19,6 +19,10 @@
 #ifndef GRUB_AT_KEYBOARD_HEADER
 #define GRUB_AT_KEYBOARD_HEADER	1
 
+#include "keyboard.h"
+
+extern struct grub_keyboard_map_s *EXPORT_VAR(grub_at_keyboard_map);
+
 #define SHIFT_L		0x2a
 #define SHIFT_R		0x36
 #define CTRL		0x1d

=== added file 'include/grub/keyboard.h'
--- include/grub/keyboard.h	1970-01-01 00:00:00 +0000
+++ include/grub/keyboard.h	2010-02-13 23:29:48 +0000
@@ -0,0 +1,28 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_KEYBOARD_HEADER
+#define GRUB_KEYBOARD_HEADER 1
+
+struct grub_keyboard_map_s
+{
+  char *normal;
+  char *shift;
+};
+
+#endif

=== added file 'include/grub/keyboard_layouts.h'
--- include/grub/keyboard_layouts.h	1970-01-01 00:00:00 +0000
+++ include/grub/keyboard_layouts.h	2010-02-05 18:58:05 +0000
@@ -0,0 +1,25 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_KEYBOARD_LAYOUTS_H
+#define GRUB_KEYBOARD_LAYOUTS_H 1
+
+#define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC "GRUBLAYO"
+#define GRUB_KEYBOARD_LAYOUTS_VERSION 1
+
+#endif /* GRUB_KEYBOARD_LAYOUTS  */

=== added file 'include/grub/keys.h'
--- include/grub/keys.h	1970-01-01 00:00:00 +0000
+++ include/grub/keys.h	2010-01-17 18:21:42 +0000
@@ -0,0 +1,36 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_KEYS_HEADER
+#define GRUB_KEYS_HEADER	1
+
+/* Internal codes used by GRUB to represent terminal input.  */
+#define GRUB_TERM_LEFT          2
+#define GRUB_TERM_RIGHT         6
+#define GRUB_TERM_UP            16
+#define GRUB_TERM_DOWN          14
+#define GRUB_TERM_HOME          1
+#define GRUB_TERM_END           5
+#define GRUB_TERM_DC            4
+#define GRUB_TERM_PPAGE         7
+#define GRUB_TERM_NPAGE         3
+#define GRUB_TERM_ESC           '\e'
+#define GRUB_TERM_TAB           '\t'
+#define GRUB_TERM_BACKSPACE     8
+
+#endif /* ! GRUB_KEYS_HEADER */

=== modified file 'include/grub/term.h'
--- include/grub/term.h	2010-02-03 00:24:07 +0000
+++ include/grub/term.h	2010-01-29 23:31:29 +0000
@@ -19,19 +19,7 @@
 #ifndef GRUB_TERM_HEADER
 #define GRUB_TERM_HEADER	1
 
-/* Internal codes used by GRUB to represent terminal input.  */
-#define GRUB_TERM_LEFT		2
-#define GRUB_TERM_RIGHT		6
-#define GRUB_TERM_UP		16
-#define GRUB_TERM_DOWN		14
-#define GRUB_TERM_HOME		1
-#define GRUB_TERM_END		5
-#define GRUB_TERM_DC		4
-#define GRUB_TERM_PPAGE		7
-#define GRUB_TERM_NPAGE		3
-#define GRUB_TERM_ESC		'\e'
-#define GRUB_TERM_TAB		'\t'
-#define GRUB_TERM_BACKSPACE	8
+#include <grub/keys.h>
 
 #ifndef ASM_FILE
 

=== added file 'include/grub/usb_keyboard.h'
--- include/grub/usb_keyboard.h	1970-01-01 00:00:00 +0000
+++ include/grub/usb_keyboard.h	2010-02-13 23:29:58 +0000
@@ -0,0 +1,26 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_USB_KEYBOARD_HEADER
+#define GRUB_USB_KEYBOARD_HEADER	1
+
+#include "keyboard.h"
+
+extern struct grub_keyboard_map_s *EXPORT_VAR(grub_usb_keyboard_map);
+
+#endif

=== added directory 'keyboard_layouts'
=== added file 'keyboard_layouts/at_keyboard_layouts.c'
--- keyboard_layouts/at_keyboard_layouts.c	1970-01-01 00:00:00 +0000
+++ keyboard_layouts/at_keyboard_layouts.c	2010-02-13 23:22:51 +0000
@@ -0,0 +1,6 @@
+#define DO_AT_KEYBOARD_LAYOUT 1
+#define COMMAND_NAME_LOAD "at_load_layout"
+#define COMMAND_NAME_SHOW "at_show_layout"
+#define COMMAND_NAME_RESTORE "at**"
+#define FILE_SUFFIX ".at"
+#include "keyboard_layouts.c"

=== added file 'keyboard_layouts/keyboard_layouts.c'
--- keyboard_layouts/keyboard_layouts.c	1970-01-01 00:00:00 +0000
+++ keyboard_layouts/keyboard_layouts.c	2010-02-13 23:24:16 +0000
@@ -0,0 +1,213 @@
+/* at_keyboard_layouts.c - at_keyboard_layouts module */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/normal.h>
+#include <grub/file.h>
+#include <grub/kernel.h>
+#include <grub/i18n.h>
+
+#ifdef DO_AT_KEYBOARD_LAYOUT
+  #include <grub/at_keyboard.h>
+#else
+  #include <grub/usb_keyboard.h>
+#endif
+
+#include <grub/keyboard_layouts.h>
+
+#include <grub/term.h>
+
+static char original_keyboard_layout_normal[128];
+static char original_keyboard_layout_shift[128];
+
+static char *active_layout;
+
+static struct grub_keyboard_map_s *keyboard_map;
+
+static grub_err_t
+grub_cmd_load_layout(grub_command_t cmd __attribute__ ((unused)),
+			      int argc, char **args)
+{
+  char magic[8];
+  int check;
+  char *filename;
+  char *prefix;
+  int filename_length;
+
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "usage: load_layout LAYOUT");
+
+  prefix = grub_env_get ("keymaps_dir");
+  if (!prefix)
+    return grub_error (GRUB_ERR_READ_ERROR,
+		       "`keymaps_dir' variable not set up");
+
+  filename_length = grub_strlen (prefix) + grub_strlen ("/") +
+                    grub_strlen (args[0]) + grub_strlen(FILE_SUFFIX) + 1;
+
+  filename =
+    grub_malloc (filename_length);
+  
+  if (! filename)
+    return grub_errno;
+
+  grub_snprintf (filename, filename_length, "%s/%s%s", prefix, args[0],
+  						       FILE_SUFFIX);
+
+  grub_file_t keyboard_file;
+  keyboard_file = grub_file_open (filename);
+
+  if (!keyboard_file)
+    {
+      return grub_error (GRUB_ERR_READ_ERROR, "cannot open file `%s'",
+			 filename);
+      return 0;
+    }
+
+  check =
+    grub_file_read (keyboard_file, magic,
+		    sizeof (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1);
+
+  if (check != sizeof (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1)
+    {
+      return grub_error (GRUB_ERR_READ_ERROR,
+			 "cannot read the file header from `%s'", filename);
+    }
+
+  if (grub_memcmp
+      (magic, GRUB_KEYBOARD_LAYOUTS_FILEMAGIC,
+       sizeof (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1) != 0)
+    {
+      grub_file_close (keyboard_file);
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE, "file not recognised (`%s')",
+			 filename);
+    }
+  grub_uint32_t version;
+  check = grub_file_read (keyboard_file, &version, 4);
+
+  if (check != 4)
+    {
+      grub_file_close (keyboard_file);
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE,
+			 "cannot check file version (`%s')", filename);
+    }
+
+  version = grub_be_to_cpu32 (version);
+  if (version != GRUB_KEYBOARD_LAYOUTS_VERSION)
+    {
+      grub_file_close (keyboard_file);
+      return grub_error (GRUB_ERR_BAD_FILE_TYPE,
+			 "invalid file version: %d (`%s')", version,
+			 filename);
+    }
+
+
+
+  check = grub_file_read (keyboard_file, keyboard_map->normal, 128);
+  if (check != 128)
+    {
+      grub_file_close (keyboard_file);
+      return grub_error (GRUB_ERR_READ_ERROR,
+			 "problem reading normal keyboard from `%s'",
+			 filename);
+    }
+
+  check = grub_file_read (keyboard_file, keyboard_map->shift, 128);
+  if (check != 128)
+    {
+      grub_file_close (keyboard_file);
+      return grub_error (GRUB_ERR_READ_ERROR,
+			 "problem reading shift keyboard from `%s'",
+			 filename);
+    }
+
+  grub_free (active_layout);
+  active_layout = grub_strdup (args[0]);
+
+  grub_file_close (keyboard_file);
+  return 0;
+}
+
+static grub_err_t
+grub_cmd_show_active_keyboardlayout (grub_command_t cmd
+				     __attribute__ ((unused)), int argc
+				     __attribute__ ((unused)), char **args
+				     __attribute__ ((unused)))
+{
+  grub_printf ("Active layout: `%s'.\n", active_layout);
+  return 0;
+}
+
+static void
+set_default_keyboard(void)
+{
+  grub_free (active_layout);
+  active_layout = grub_strdup("default");
+  grub_memcpy (keyboard_map->normal, original_keyboard_layout_normal,
+	       128);
+  grub_memcpy (keyboard_map->shift, original_keyboard_layout_shift, 128);
+}
+
+static grub_err_t
+grub_cmd_set_default_keyboard (grub_command_t cmd __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
+{
+  set_default_keyboard();
+  grub_printf_ (N_("Reverted to default keymap layout.\n"));
+  return 0;
+}
+
+#ifdef DO_AT_KEYBOARD_LAYOUT
+GRUB_MOD_INIT (at_keyboard_layouts)
+#else
+GRUB_MOD_INIT (usb_keyboard_layouts)
+#endif
+{
+#ifdef DO_AT_KEYBOARD_LAYOUT
+  keyboard_map = grub_at_keyboard_map;
+#else
+  keyboard_map = grub_usb_keyboard_map;
+#endif
+
+  grub_memcpy (original_keyboard_layout_normal, keyboard_map->normal,
+	       128);
+  grub_memcpy (original_keyboard_layout_shift, keyboard_map->shift, 128);
+
+  active_layout = grub_strdup("default");
+
+  grub_register_command_p1 (COMMAND_NAME_LOAD, grub_cmd_load_layout,
+			    N_("LAYOUT"), N_("Set up the new layout."));
+
+  grub_register_command_p1 (COMMAND_NAME_SHOW,
+			    grub_cmd_show_active_keyboardlayout, 0,
+			    N_("Show the active layout."));
+
+  grub_register_command_p1 (COMMAND_NAME_RESTORE,
+  			    grub_cmd_set_default_keyboard, 0,
+			    N_("Set up the default keyboard."));
+
+}
+
+GRUB_MOD_FINI (at_keyboard_layouts)
+{
+  set_default_keyboard();
+}

=== added file 'keyboard_layouts/usb_keyboard_layouts.c'
--- keyboard_layouts/usb_keyboard_layouts.c	1970-01-01 00:00:00 +0000
+++ keyboard_layouts/usb_keyboard_layouts.c	2010-02-13 23:22:53 +0000
@@ -0,0 +1,6 @@
+#define DO_USB_KEYBOARD_LAYOUT 1
+#define COMMAND_NAME_LOAD "usb_load_layout"
+#define COMMAND_NAME_SHOW "usb_show_layout"
+#define COMMAND_NAME_RESTORE "usb**"
+#define FILE_SUFFIX ".usb"
+#include "keyboard_layouts.c"

=== modified file 'term/at_keyboard.c'
--- term/at_keyboard.c	2010-01-10 12:34:48 +0000
+++ term/at_keyboard.c	2010-02-13 23:05:51 +0000
@@ -22,6 +22,9 @@
 #include <grub/cpu/io.h>
 #include <grub/misc.h>
 #include <grub/term.h>
+#include <grub/mm.h>
+
+struct grub_keyboard_map_s *grub_at_keyboard_map = NULL;
 
 static short at_keyboard_status = 0;
 static int pending_key = -1;
@@ -41,7 +44,7 @@ static grub_uint8_t led_status;
 #define KEYBOARD_LED_NUM		(1 << 1)
 #define KEYBOARD_LED_CAPS		(1 << 2)
 
-static char keyboard_map[128] =
+static char keyboard_map_normal[128] =
 {
   '\0', GRUB_TERM_ESC, '1', '2', '3', '4', '5', '6',
   '7', '8', '9', '0', '-', '=', GRUB_TERM_BACKSPACE, GRUB_TERM_TAB,
@@ -214,12 +217,12 @@ grub_at_keyboard_getkey_noblock (void)
 	break;
       default:
 	if (at_keyboard_status & (KEYBOARD_STATUS_CTRL_L | KEYBOARD_STATUS_CTRL_R))
-	  key = keyboard_map[code] - 'a' + 1;
+	  key = grub_at_keyboard_map->normal[code] - 'a' + 1;
 	else if ((at_keyboard_status & (KEYBOARD_STATUS_SHIFT_L | KEYBOARD_STATUS_SHIFT_R))
-	    && keyboard_map_shift[code])
-	  key = keyboard_map_shift[code];
+	    && grub_at_keyboard_map->shift[code])
+	  key = grub_at_keyboard_map->shift[code];
 	else
-	  key = keyboard_map[code];
+	  key = grub_at_keyboard_map->normal[code];
 
 	if (key == 0)
 	  grub_dprintf ("atkeyb", "Unknown key 0x%x detected\n", code);
@@ -295,6 +298,9 @@ static struct grub_term_input grub_at_ke
 GRUB_MOD_INIT(at_keyboard)
 {
   grub_term_register_input ("at_keyboard", &grub_at_keyboard_term);
+
+  grub_at_keyboard_map->normal = keyboard_map_normal;
+  grub_at_keyboard_map->shift = keyboard_map_shift;
 }
 
 GRUB_MOD_FINI(at_keyboard)

=== modified file 'term/usb_keyboard.c'
--- term/usb_keyboard.c	2009-12-02 09:00:54 +0000
+++ term/usb_keyboard.c	2010-02-13 23:05:58 +0000
@@ -26,9 +26,14 @@
 #include <grub/usb.h>
 #include <grub/dl.h>
 #include <grub/time.h>
+#include <grub/mm.h>
+#include <grub/usb_keyboard.h>
 
 \f
-static char keyboard_map[128] =
+
+struct grub_keyboard_map_s *grub_usb_keyboard_map = NULL;
+
+static char keyboard_map_normal[128] =
   {
     '\0', '\0', '\0', '\0', 'a', 'b', 'c', 'd',
     'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
@@ -152,11 +157,11 @@ grub_usb_keyboard_checkkey (void)
 
   /* Check if the Control or Shift key was pressed.  */
   if (data[0] & 0x01 || data[0] & 0x10)
-    key = keyboard_map[data[2]] - 'a' + 1;
+    key = keyboard_map_normal[data[2]] - 'a' + 1;
   else if (data[0] & 0x02 || data[0] & 0x20)
     key = keyboard_map_shift[data[2]];
   else
-    key = keyboard_map[data[2]];
+    key = keyboard_map_normal[data[2]];
 
   if (key == 0)
     grub_printf ("Unknown key 0x%x detected\n", data[2]);
@@ -321,6 +326,9 @@ GRUB_MOD_INIT(usb_keyboard)
 {
   grub_usb_hid ();
   grub_term_register_input ("usb_keyboard", &grub_usb_keyboard_term);
+
+  grub_usb_keyboard_map->normal = keyboard_map_normal;
+  grub_usb_keyboard_map->shift = keyboard_map_shift;
 }
 
 GRUB_MOD_FINI(usb_keyboard)

=== added file 'util/grub-mklayouts.c'
--- util/grub-mklayouts.c	1970-01-01 00:00:00 +0000
+++ util/grub-mklayouts.c	2010-01-31 18:08:14 +0000
@@ -0,0 +1,396 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/util/misc.h>
+#include <grub/keys.h>
+#include <grub/i18n.h>
+#include <grub/keyboard_layouts.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <unistd.h>
+
+#include "progname.h"
+
+#define CKBCOMP "ckbcomp"
+
+static int at_to_usb_map_normal[128] =
+{
+  0, 41, 30, 31, 32, 33, 34, 35, 
+  36, 37, 38, 39, 45, 46, 42, 43, 
+  20, 26, 8, 21, 23, 28, 24, 12, 
+  18, 19, 47, 48, 40, 0, 4, 22, 
+  7, 9, 10, 11, 13, 14, 15, 51, 
+  52, 53, 0, 49, 29, 27, 6, 25, 
+  5, 17, 16, 54, 55, 56, 0, 0, 
+  0, 44, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 74, 
+  82, 78, 45, 80, 0, 79, 0, 77, 
+  81, 75, 0, 76, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static int at_to_usb_map_shift[128] =
+{
+  0, 0, 30, 31, 32, 33, 34, 35, 
+  36, 37, 38, 39, 45, 46, 0, 0, 
+  20, 26, 8, 21, 23, 28, 24, 12, 
+  18, 19, 47, 48, 40, 0, 4, 22, 
+  7, 9, 10, 11, 13, 14, 15, 51, 
+  52, 0, 0, 49, 29, 27, 6, 25, 
+  5, 17, 16, 54, 55, 56,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static struct option options[] = {
+  {"output", required_argument, 0, 'o'},
+  {"help", no_argument, 0, 'h'},
+  {"version", no_argument, 0, 'V'},
+  {"verbose", no_argument, 0, 'v'},
+  {0, 0, 0, 0}
+};
+
+struct console_grub_equivalence
+{
+  char *layout;
+  char grub;
+};
+
+static struct console_grub_equivalence console_grub_equivalences[] = {
+  {"Escape", GRUB_TERM_ESC},
+  {"Tab", GRUB_TERM_TAB},
+  {"Delete", GRUB_TERM_BACKSPACE},
+
+  {"KP_1", '1'},
+  {"KP_2", '2'},
+  {"KP_3", '3'},
+  {"KP_4", '4'},
+  {"KP_5", '5'},
+  {"KP_6", '6'},
+  {"KP_7", '7'},
+  {"KP_8", '8'},
+  {"KP_9", '9'},
+
+  {"KP_Multiply", '*'},
+  {"KP_Substract", '-'},
+  {"KP_Add", '+'},
+  {"KP_Divide", '/'},
+
+  {"KP_Enter", '\n'},
+  {"Return", '\n'},
+  {"", '\0'}
+};
+
+static void
+usage (int status)
+{
+  if (status)
+    fprintf (stderr, "Try `%s --help' for more information.\n", program_name);
+  else
+    printf ("\
+Usage: %s [OPTIONS] LAYOUT\n\
+  -o, --output		set output base name file. Default is LAYOUT\n\
+  			.at or .usb suffixes will be automatically added.\n\
+  -h, --help		display this message and exit.\n\
+  -V, --version		print version information and exit.\n\
+  -v, --verbose		print verbose messages.\n\
+\n\
+Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
+
+  exit (status);
+}
+
+void
+add_special_keys (char keyboard_map[128])
+{
+  keyboard_map[71] = GRUB_TERM_HOME;
+  keyboard_map[72] = GRUB_TERM_UP;
+  keyboard_map[73] = GRUB_TERM_NPAGE;
+  keyboard_map[75] = GRUB_TERM_LEFT;
+  keyboard_map[77] = GRUB_TERM_RIGHT;
+  keyboard_map[79] = GRUB_TERM_END;
+  keyboard_map[80] = GRUB_TERM_DOWN;
+  keyboard_map[81] = GRUB_TERM_PPAGE;
+  keyboard_map[83] = GRUB_TERM_DC;
+
+/*
+ * TODO: defined in include/grub/i386/at_keyboard.h
+  keyboard_map[101] = OLPC_UP;
+  keyboard_map[102] = OLPC_DOWN;
+  keyboard_map[103] = OLPC_LEFT;
+  keyboard_map[104] = OLPC_RIGHT;
+*/
+
+}
+
+char
+lookup (char *code)
+{
+  int i;
+
+  for (i = 0; console_grub_equivalences[i].grub != '\0'; i++)
+    {
+      if (strcmp (code, console_grub_equivalences[i].layout) == 0)
+	{
+	  return console_grub_equivalences[i].grub;
+	}
+    }
+
+  return '\0';
+}
+
+unsigned int
+get_grub_code (char *layout_code)
+{
+  unsigned int code;
+
+  if (strncmp (layout_code, "U+", sizeof ("U+") - 1) == 0)
+    {
+      sscanf (layout_code, "U+%x", &code);
+    }
+  else if (strncmp (layout_code, "+U+", sizeof ("+U+") - 1) == 0)
+    {
+      sscanf (layout_code, "+U+%x", &code);
+    }
+  else
+    {
+      code = lookup (layout_code);
+    }
+  return code;
+}
+
+void
+write_file (char* filename, char keyboard_map_normal[128],
+	    char keyboard_map_shift[128])
+{
+  FILE *fp_output;
+  int version;
+  int i;
+
+  fp_output = fopen (filename, "w");
+  
+  if (!fp_output)
+    {
+      grub_util_error ("cannot open `%s'", filename);
+      exit (1);
+    }
+  
+  version = GRUB_KEYBOARD_LAYOUTS_VERSION;
+  version = grub_cpu_to_be32 (version);
+
+  grub_util_write_image (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC,
+			 sizeof (GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1,
+			 fp_output);
+
+  grub_util_write_image ((char *) &version, 4, fp_output);
+
+  for (i = 0; i < 128; i++)
+    {
+      fprintf (fp_output, "%c", keyboard_map_normal[i]);
+    }
+
+  for (i = 0; i < 128; i++)
+    {
+      fprintf (fp_output, "%c", keyboard_map_shift[i]);
+    }
+  fclose (fp_output);
+
+}
+
+void
+write_files_at_usb (char* base_filename, char at_keyboard_map_normal[128],
+		  char at_keyboard_map_shift[128])
+{
+  char *at_file;
+  char *usb_file;
+  int i;
+  char usb_keyboard_map_normal[128];
+  char usb_keyboard_map_shift[128];
+
+  /* AT layout.  */
+  at_file = (char*) xmalloc (strlen(base_filename) + strlen(".at") + 1);
+  sprintf (at_file, "%s.at", base_filename);
+
+  write_file (at_file, at_keyboard_map_normal, at_keyboard_map_shift);
+  free (at_file);
+
+  /* Convert and write USB layout.  */
+  memset (usb_keyboard_map_normal, 0, 128);
+  memset (usb_keyboard_map_shift, 0, 128);
+
+  usb_file = (char*) xmalloc (strlen(base_filename) + strlen(".usb") + 1); 
+  sprintf (usb_file, "%s.usb", base_filename);
+
+  for (i=0; i<128; i++)
+    {
+      usb_keyboard_map_normal[at_to_usb_map_normal[i] ] = 
+      				at_keyboard_map_normal[i];
+
+      usb_keyboard_map_shift[at_to_usb_map_shift[i] ] =
+      				at_keyboard_map_shift[i];
+    }
+
+  write_file (usb_file, usb_keyboard_map_normal, usb_keyboard_map_shift);
+  free (usb_file);
+}
+
+void
+write_keymaps (char *keymap, char *file_basename)
+{
+  char at_keyboard_map_normal[128];
+  char at_keyboard_map_shift[128];
+
+  char line[2048];
+  char normal[64];
+  char shift[64];
+  int key_code;
+  pid_t pid;
+  int pipe_communication[2];
+  int ok;
+
+  FILE *fp_pipe;
+
+  if (pipe (pipe_communication) == -1)
+    {
+      grub_util_error ("cannot prepare the pipe");
+      exit (2);
+    }
+
+  pid = fork ();
+  if (pid < 0)
+    {
+      grub_util_error ("cannot fork");
+      exit (2);
+    }
+  else if (pid == 0)
+    {
+      close (1);
+      dup (pipe_communication[1]);
+      close (pipe_communication[0]);
+      execlp (CKBCOMP, CKBCOMP, keymap, NULL);
+      grub_util_error ("%s %s cannot be executed", CKBCOMP, keymap);
+      exit (3);
+    }
+  close (pipe_communication[1]);
+  fp_pipe = fdopen (pipe_communication[0], "r");
+
+  memset (at_keyboard_map_normal, 0, 128);
+  memset (at_keyboard_map_shift, 0, 128);
+
+  /* Process the ckbcomp output and prepare the layouts.  */
+  ok = 0;
+  while (fgets (line, sizeof (line), fp_pipe))
+    {
+      if (strncmp (line, "keycode", sizeof ("keycode") - 1) == 0)
+	{
+	  sscanf (line, "keycode %d = %s %s", &key_code, normal, shift);
+	  if (key_code < 128)
+	    {
+	      at_keyboard_map_normal[key_code] = (char) get_grub_code (normal);
+	      at_keyboard_map_shift[key_code] = (char) get_grub_code (shift);
+	      ok = 1;
+	    }
+	}
+    }
+
+  add_special_keys (at_keyboard_map_normal);
+
+  if (ok == 0)
+    {
+      fprintf (stderr, "ERROR: no keycodes found. Check output of %s %s.\n",
+	       CKBCOMP, keymap);
+      exit (1);
+    }
+
+  write_files_at_usb (file_basename, at_keyboard_map_normal,
+  		      at_keyboard_map_shift);
+}
+
+int
+main (int argc, char *argv[])
+{
+  int verbosity;
+  char *file_basename = NULL;
+
+  set_program_name (argv[0]);
+
+  verbosity = 0;
+
+  /* Check for options.  */
+  while (1)
+    {
+      int c = getopt_long (argc, argv, "o:hVv", options, 0);
+
+      if (c == -1)
+	break;
+      else
+	switch (c)
+	  {
+	  case 'h':
+	    usage (0);
+	    break;
+
+	  case 'o':
+	    file_basename = optarg;
+	    break;
+
+	  case 'V':
+	    printf ("%s (%s) %s\n", program_name, PACKAGE_NAME,
+		    PACKAGE_VERSION);
+	    return 0;
+
+	  case 'v':
+	    verbosity++;
+	    break;
+
+	  default:
+	    usage (1);
+	    break;
+	  }
+    }
+
+  /* Obtain LAYOUT.  */
+  if (optind >= argc)
+    {
+      fprintf (stderr, "No layout is specified.\n");
+      usage (1);
+    }
+
+  if (file_basename == NULL)
+    {
+      file_basename = argv[optind];
+    }
+
+  write_keymaps (argv[optind], file_basename);
+
+  return 0;
+}


^ permalink raw reply	[flat|nested] 17+ messages in thread

* keyboard layouts
@ 2010-02-09 23:23 Carles Pina i Estany
  0 siblings, 0 replies; 17+ messages in thread
From: Carles Pina i Estany @ 2010-02-09 23:23 UTC (permalink / raw)
  To: grub-devel


Hi,

There is pending to review the keyboard layout patch. Please don't do
:-) on Friday I started a generalisation with USB. Currently I have the
generalisation (not committed) and some problem with the USB that I need
to investigate.

During the weekend should be ready and I'll ping you again.

Cheers,

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: keyboard layouts
  2010-01-13  9:24 ` Yves Blusseau
@ 2010-01-13 16:23   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 17+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-01-13 16:23 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

Yves Blusseau wrote:
> Hi
>
> Le 12/01/2010 22:47, Carles Pina i Estany a écrit :
>> Plan:
>> - Use the X11 layouts that usually are in /usr/share/X11/xkb/symbols .
>> - Create a new module that reads the layout from an environtment
>> variable.
>>
>> * Approach 1
>> The module will load the layout from /usr/share/X11/xkb/symbols/XX
>> replacing the array map that currently exists in
>> term/i386/pc/at_keyboard.c
>>
>>    
> But where are this X11 keyboard layouts in non linux platform
> (windows, Mac OSX, etc...) ?
X11 is freely distribuable so there is no reason not to rely on them.
Even if some platforms use other formats (XML-like OSX' .keylayout, or
"ultra-portable" and "readable" windows' .dll) there shouldn't be any
problem installing XKB layouts as optional GRUB2 prerequisite.
On another note we support windows and OSX as long as they don't force
us taking bad decisions or slow thedeveloppement
>> * Approach 2
>> Small program (I guess that you prefer C, Python would be nice too) that
>> when Grub is installed would process the /usr/share/X11/xkb/symbols
>> files and generates the files that Grub will read. Code to read this
>> files would be much easier than before.
>>
>>    
> Same thing.
>
> Regards,
> Yves Blusseau
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: keyboard layouts
  2010-01-12 21:47 Carles Pina i Estany
  2010-01-12 22:53 ` Colin Watson
@ 2010-01-13  9:24 ` Yves Blusseau
  2010-01-13 16:23   ` Vladimir 'φ-coder/phcoder' Serbinenko
  1 sibling, 1 reply; 17+ messages in thread
From: Yves Blusseau @ 2010-01-13  9:24 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

Hi

Le 12/01/2010 22:47, Carles Pina i Estany a écrit :
> Plan:
> - Use the X11 layouts that usually are in /usr/share/X11/xkb/symbols .
> - Create a new module that reads the layout from an environtment variable.
>
> * Approach 1
> The module will load the layout from /usr/share/X11/xkb/symbols/XX
> replacing the array map that currently exists in
> term/i386/pc/at_keyboard.c
>
>    
But where are this X11 keyboard layouts in non linux platform (windows, 
Mac OSX, etc...) ?
> * Approach 2
> Small program (I guess that you prefer C, Python would be nice too) that
> when Grub is installed would process the /usr/share/X11/xkb/symbols
> files and generates the files that Grub will read. Code to read this
> files would be much easier than before.
>
>    
Same thing.

Regards,
Yves Blusseau


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3326 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: keyboard layouts
  2010-01-12 23:29   ` Carles Pina i Estany
@ 2010-01-12 23:51     ` Colin Watson
  0 siblings, 0 replies; 17+ messages in thread
From: Colin Watson @ 2010-01-12 23:51 UTC (permalink / raw)
  To: The development of GNU GRUB

On Tue, Jan 12, 2010 at 11:29:59PM +0000, Carles Pina i Estany wrote:
> On Jan/12/2010, Colin Watson wrote:
> > the gfxboot-theme-ubuntu package in Ubuntu, specifically the
> > scrape-console-setup script.  It makes use of console-setup to process
> > XKB keymaps into a form that can then be run through loadkeys and
> > reformatted so that gfxboot can use them.  A similar approach might be
> > feasible in GRUB.
> 
> Legal question: gfxboot-theme-ubuntu is licensed under GPL 2. I
> understand that this means that we cannot share code. In the other hand,
> I think that you are the author, so you could give the copyright of this
> code to the FSF if needed. Is it possible?

GPL 2 or later, actually, so we could share it.  But yes, I'd be willing
to assign for the purposes of a GRUB derivative of scrape-console-setup,
if you chose to use that source.  I did not write all of
gfxboot-theme-ubuntu by any means, but I wrote both the scrape-* scripts
there from scratch.

console-setup is also GPL 2 or later, but you'd have to ask Anton
Zinoviev if you chose to copy it.

> Integration question: some of that code is done using Perl. Actually are
> quite small scripts (373 lines the longer one). I don't know if we want
> to add Perl as a Grub dependency :-/, or if it's worth. We can redo the
> script in C.

scrape-console-setup is really only incidentally in Perl; it's not that
complicated and could be done in any reasonable language.  You'd need to
rewrite much of it for GRUB's keymaps anyway.

ckbcomp, though, is very complicated and difficult to reimplement.  If
you were going to reimplement it, then it might be worth looking at
something like embedding a partial XKB parser in GRUB after all ...

To my knowledge, there is no serious alternative to XKB as a source of
keymaps.  The old-style Linux keymaps (console-data et al) are long
since moribund, and XKB is what nearly everyone will be using on their
running systems anyway so it's good to be consistent with those keymaps
as far as possible.

> Ok, the process of scrape-console-setup (I have not been able to test it
> yet) is to use ckbcomp to convert from XKB keymaps to the "loadkeys"
> keymaps, and then does some process on this second keymaps.

Yes.  The reason is, as you say, that the loadkeys format is a lot
closer to what a boot loader tends to want.  Processing XKB is fairly
hard (although GRUB is more sophisticated than gfxboot, so who knows).

> Can you write in two lines the format of the layout that gfxboot use?
> (else I will try to generate it soon...)

You can look at gfxboot-theme-ubuntu/keytables.inc for the generated
version.  It's a series of arrays of [ level1 level2 level3 level4 ]
keycodes.

(Not quite two lines but I hope you don't mind ...)

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: keyboard layouts
  2010-01-12 22:53 ` Colin Watson
@ 2010-01-12 23:29   ` Carles Pina i Estany
  2010-01-12 23:51     ` Colin Watson
  0 siblings, 1 reply; 17+ messages in thread
From: Carles Pina i Estany @ 2010-01-12 23:29 UTC (permalink / raw)
  To: The development of GNU GRUB


Hi,

On Jan/12/2010, Colin Watson wrote:
> On Tue, Jan 12, 2010 at 09:47:43PM +0000, Carles Pina i Estany wrote:
> > Plan:

> > * Approach 2
> > Small program (I guess that you prefer C, Python would be nice too) that
> > when Grub is installed would process the /usr/share/X11/xkb/symbols
> > files and generates the files that Grub will read. Code to read this
> > files would be much easier than before.
> > 
> > This way, the layout tables could stay in /boot/grub/layouts . These
> > files would look like keycode - symbol pairs. Everything already in
> > binary, and only for the things that differ from English.
> > 
> > So, if a layout has 40 different keycode-symbol pairs compared with
> > English, this would be 80 bytes per layout. Probably will be more, but
> > it should be of this order of magnitude.
> 
> I can't remember whether I mentioned this before, but have a look at

I haven't read about it previously.

> the gfxboot-theme-ubuntu package in Ubuntu, specifically the
> scrape-console-setup script.  It makes use of console-setup to process
> XKB keymaps into a form that can then be run through loadkeys and
> reformatted so that gfxboot can use them.  A similar approach might be
> feasible in GRUB.

Legal question: gfxboot-theme-ubuntu is licensed under GPL 2. I
understand that this means that we cannot share code. In the other hand,
I think that you are the author, so you could give the copyright of this
code to the FSF if needed. Is it possible?

Integration question: some of that code is done using Perl. Actually are
quite small scripts (373 lines the longer one). I don't know if we want
to add Perl as a Grub dependency :-/, or if it's worth. We can redo the
script in C.

Ok, the process of scrape-console-setup (I have not been able to test it
yet) is to use ckbcomp to convert from XKB keymaps to the "loadkeys"
keymaps, and then does some process on this second keymaps.

My approach was avoiding ckbcomp (actually I didn't know it :-) ). The
loadkeys keymaps are easier to parse, so for me looks fine to use. In
the other hand adds a new dependency, only for the laziness of
processing the XKB layouts.

Can you write in two lines the format of the layout that gfxboot use?
(else I will try to generate it soon...)

Thanks,

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: keyboard layouts
  2010-01-12 21:47 Carles Pina i Estany
@ 2010-01-12 22:53 ` Colin Watson
  2010-01-12 23:29   ` Carles Pina i Estany
  2010-01-13  9:24 ` Yves Blusseau
  1 sibling, 1 reply; 17+ messages in thread
From: Colin Watson @ 2010-01-12 22:53 UTC (permalink / raw)
  To: The development of GNU GRUB

On Tue, Jan 12, 2010 at 09:47:43PM +0000, Carles Pina i Estany wrote:
> Plan:
> - Use the X11 layouts that usually are in /usr/share/X11/xkb/symbols .
> - Create a new module that reads the layout from an environtment variable.
> 
> * Approach 1
> The module will load the layout from /usr/share/X11/xkb/symbols/XX
> replacing the array map that currently exists in
> term/i386/pc/at_keyboard.c
> 
> Negative points:
> -Grub needs acces to /usr/share/X11/xkb/symbols to load the
> layout
> -xkb files doesn't look specially nice to parse (I think that I prefer
> the .mo files :-) ). They are text files easy to understand for humans
> 
> * Approach 2
> Small program (I guess that you prefer C, Python would be nice too) that
> when Grub is installed would process the /usr/share/X11/xkb/symbols
> files and generates the files that Grub will read. Code to read this
> files would be much easier than before.
> 
> This way, the layout tables could stay in /boot/grub/layouts . These
> files would look like keycode - symbol pairs. Everything already in
> binary, and only for the things that differ from English.
> 
> So, if a layout has 40 different keycode-symbol pairs compared with
> English, this would be 80 bytes per layout. Probably will be more, but
> it should be of this order of magnitude.

I can't remember whether I mentioned this before, but have a look at the
gfxboot-theme-ubuntu package in Ubuntu, specifically the
scrape-console-setup script.  It makes use of console-setup to process
XKB keymaps into a form that can then be run through loadkeys and
reformatted so that gfxboot can use them.  A similar approach might be
feasible in GRUB.

(console-setup is Debian-specific, but perhaps we could incorporate the
relevant bits of it in grub-extras, or do something else creative ...)

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* keyboard layouts
@ 2010-01-12 21:47 Carles Pina i Estany
  2010-01-12 22:53 ` Colin Watson
  2010-01-13  9:24 ` Yves Blusseau
  0 siblings, 2 replies; 17+ messages in thread
From: Carles Pina i Estany @ 2010-01-12 21:47 UTC (permalink / raw)
  To: grub-devel


Hi,

I'm looking again to the keyboard layouts task.

Plan:
- Use the X11 layouts that usually are in /usr/share/X11/xkb/symbols .
- Create a new module that reads the layout from an environtment variable.

* Approach 1
The module will load the layout from /usr/share/X11/xkb/symbols/XX
replacing the array map that currently exists in
term/i386/pc/at_keyboard.c

Negative points:
-Grub needs acces to /usr/share/X11/xkb/symbols to load the
layout
-xkb files doesn't look specially nice to parse (I think that I prefer
the .mo files :-) ). They are text files easy to understand for humans

* Approach 2
Small program (I guess that you prefer C, Python would be nice too) that
when Grub is installed would process the /usr/share/X11/xkb/symbols
files and generates the files that Grub will read. Code to read this
files would be much easier than before.

This way, the layout tables could stay in /boot/grub/layouts . These
files would look like keycode - symbol pairs. Everything already in
binary, and only for the things that differ from English.

So, if a layout has 40 different keycode-symbol pairs compared with
English, this would be 80 bytes per layout. Probably will be more, but
it should be of this order of magnitude.

* End of Approach 2

Opinions? What I'm forgetting?

Here appeared some suggestions:
http://www.mail-archive.com/grub-devel@gnu.org/msg08301.html

Like Shift+Caps Lock could write special symbols, or the very advanced
(combo, dead-keys) things. I will consider it, now I'm mainly thinking
about the basic layout.

-- 
Carles Pina i Estany
	http://pinux.info



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-05-23 13:22 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 14:37 GRUB 1.99~rc2 released Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-21  7:48 ` Treutwein Bernhard
     [not found]   ` <BANLkTimQzFVfZ+ah=0EBm_mQWiXFcr2nwA@mail.gmail.com>
2011-04-21 15:29     ` Craig Sparks
2011-04-22 22:30       ` Luks inclusion (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-25 13:21         ` [RFT] LUKS and GELI (was Re: Luks inclusion) Vladimir 'φ-coder/phcoder' Serbinenko
2011-04-22 22:34   ` Keyboard layouts (was Re: GRUB 1.99~rc2 released) Vladimir 'φ-coder/phcoder' Serbinenko
2011-05-03  9:04     ` grub-mklayout - Unknown key KP_Comma (was: Keyboard layouts & previously: " Treutwein Bernhard
2011-05-03  9:19       ` grub-mklayout - Unknown key KP_Comma Vladimir 'φ-coder/phcoder' Serbinenko
2011-05-23 13:22     ` Keyboard layouts Treutwein Bernhard
  -- strict thread matches above, loose matches on Subject: below --
2010-03-19 23:45 keyboard layouts Carles Pina i Estany
2010-02-09 23:23 Carles Pina i Estany
2010-01-12 21:47 Carles Pina i Estany
2010-01-12 22:53 ` Colin Watson
2010-01-12 23:29   ` Carles Pina i Estany
2010-01-12 23:51     ` Colin Watson
2010-01-13  9:24 ` Yves Blusseau
2010-01-13 16:23   ` Vladimir 'φ-coder/phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.