[File] [PATCH] Magdir/linux for GRUB keyboard *.GKB

Christos Zoulas christos at zoulas.com
Thu Sep 1 11:09:09 UTC 2022


Committed, thanks!

christos

> On Aug 31, 2022, at 11:19 PM, Jörg Jenderek <joerg.jen.der.ek at gmx.net> wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> some days ago i installed a new Linux system on my PC.
> For security reasons i wanted some complicated password with special
> characters. Unfortunately this does not work out of the box for my
> system with German keyboard. After a nightmare session i find that i
> myself must create keyboard modules (*.GKB) for GRUB bootloader and
> insert instruction inside configuration grub.cfg to use this.
> 
> When running file command (version 5.42) on such GRUB keyboard
> examples i get an output like:
> 
> de.gkb: data
> fr.gkb: data
> it.gkb: data
> nl.gkb: data
> us.gkb: data
> 
> With --extension option only ??? is displayed. Furthermore with -i
> option for my samples only generic application/octet-stream is shown.
> 
> GRUB is the GRand Unified Bootloader of/for GNU found on their
> website. In source of GRUB there exist header file keyboard_layouts.h
> and c-source keylayouts.c with needed information about file format.
> That is expressed by comment lines inside Magdir/linux like:
> # URL:		https://www.gnu.org/software/grub
> # Reference:	https://ftp.gnu.org/gnu/grub/grub-2.06.tar.gz
> #		grub-2.06/include/grub/keyboard_layouts.h
> #		grub-2.06/grub-core/commands/keylayouts.c
> 
> According to that documentation samples start with 8 byte magic
> string named GRUB_KEYBOARD_LAYOUTS_FILEMAGIC. Afterward the version
> is stored as 4 byte integer, which is in current version value 10.
> So show that version by lines like:
> 0	string		GRUBLAYO		GRUB Keyboard
> !:mime			application/x-grub-keyboard
> !:ext			gkb
>> 8	ulelong		!10			\b, version %u
> Instead of generic mime type application/octet-stream show an user
> defined one.
> 
> I am not a c programmer, but if i under stand source right afterwards
> comes four keyboard layout with 160 elements, where every element has
> a size of 32 bit. First comes the normal keyboard. This is followed
> by the "shift" variant and so on. So i looked in variant for USA
> us.gkb where low letters q and y are located. In "normal" French
> keyboard at "q" position low letter a is stored. In "normal" German
> keyboard at "y" position low letter z is stored. So show that non
> English variants by additional lines like:
>> 92	ubyte		!0x71
>>> 92	ubyte		>0x40			\b, english q is %c
>> 124	ubyte		!0x79
>> 124	ubyte		>0x40			\b, english y is %c
> 
> After applying the above mentioned modifications by patch
> file-5.42-linux-gkb.diff then all inspected GRUB examples are
> described like:
> 
> de.gkb: GRUB Keyboard, english y is z
> fr.gkb: GRUB Keyboard, english q is a
> it.gkb: GRUB Keyboard
> nl.gkb: GRUB Keyboard
> us.gkb: GRUB Keyboard
> 
> I hope my diff file can be applied in future version of file utility.
> 
> With best wishes
> Jörg Jenderek
> - --
> Jörg Jenderek
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
> 
> iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCYw/CPwAKCRCv8rHJQhrU
> 1mS4AJ93RxPTc5mfadxL+UBtR8b6IAsA4ACeM9DADGg05P4XZxf0idYHn3nt1Ck=
> =xG3R
> -----END PGP SIGNATURE-----
> <file-5_42-linux-gkb_diff.DEFANGED-18><file-5_42-linux-gkb_diff_sig.DEFANGED-19>--
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20220901/9f9b0e1b/attachment.asc>


More information about the File mailing list