git: cc820887ab0e - stable/13 - Append Keyboard Layout specified option for using VNC. Part two: Append bhyve -K option for specified keyboard layout with layout setting files every languages. Since the cmd option '-k' was used in the meantime it was changed to '-K'

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Wed, 23 Nov 2022 09:44:07 UTC
The branch stable/13 has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=cc820887ab0ea05c5dcad6d99d9a0d996eb3e19e

commit cc820887ab0ea05c5dcad6d99d9a0d996eb3e19e
Author:     Michael Reifenberger <mr@FreeBSD.org>
AuthorDate: 2022-01-20 22:44:04 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-11-23 09:11:56 +0000

    Append Keyboard Layout specified option for using VNC.
    Part two: Append bhyve -K option for specified keyboard layout
    with layout setting files every languages.
    Since the cmd option '-k' was used in the meantime
    it was changed to '-K'
    
    PR:             246121
    Submitted by:   koinec@yahoo.co.jp
    Reviewed by:    grehan@
    Differential Revision:  https://reviews.freebsd.org/D29473
    
    MFC after:      4 weeks
    
    (cherry picked from commit 19eaa01beaba68ed4c70c44127955f5c9b331cb9)
---
 etc/mtree/BSD.usr.dist                     |   4 +
 usr.sbin/bhyve/Makefile                    |   1 +
 usr.sbin/bhyve/bhyve.8                     |   8 +
 usr.sbin/bhyve/bhyve_config.5              |   6 +
 usr.sbin/bhyve/bhyverun.c                  |   8 +-
 usr.sbin/bhyve/kbdlayout/Makefile          |  40 +++++
 usr.sbin/bhyve/kbdlayout/Makefile.depend   |  11 ++
 usr.sbin/bhyve/kbdlayout/am                |  10 ++
 usr.sbin/bhyve/kbdlayout/be                |  45 ++++++
 usr.sbin/bhyve/kbdlayout/be_acc            |  42 +++++
 usr.sbin/bhyve/kbdlayout/bg_bds            |  10 ++
 usr.sbin/bhyve/kbdlayout/bg_phonetic       |   9 ++
 usr.sbin/bhyve/kbdlayout/br                |  19 +++
 usr.sbin/bhyve/kbdlayout/br_noacc          |  22 +++
 usr.sbin/bhyve/kbdlayout/centraleuropean   |  12 ++
 usr.sbin/bhyve/kbdlayout/ch                |  36 +++++
 usr.sbin/bhyve/kbdlayout/ch-fr             |  36 +++++
 usr.sbin/bhyve/kbdlayout/ch-fr_acc         |  33 ++++
 usr.sbin/bhyve/kbdlayout/ch_acc            |  33 ++++
 usr.sbin/bhyve/kbdlayout/ch_macbook_acc    |  37 +++++
 usr.sbin/bhyve/kbdlayout/cz                |  11 ++
 usr.sbin/bhyve/kbdlayout/de                |  37 +++++
 usr.sbin/bhyve/kbdlayout/de_acc            |  36 +++++
 usr.sbin/bhyve/kbdlayout/de_noacc          |  38 +++++
 usr.sbin/bhyve/kbdlayout/default           | 248 +++++++++++++++++++++++++++++
 usr.sbin/bhyve/kbdlayout/dk                |  32 ++++
 usr.sbin/bhyve/kbdlayout/dk_macbook        |  35 ++++
 usr.sbin/bhyve/kbdlayout/ee                |  31 ++++
 usr.sbin/bhyve/kbdlayout/es                |  28 ++++
 usr.sbin/bhyve/kbdlayout/es_acc            |  28 ++++
 usr.sbin/bhyve/kbdlayout/es_dvorak         |  78 +++++++++
 usr.sbin/bhyve/kbdlayout/fi                |  32 ++++
 usr.sbin/bhyve/kbdlayout/fr                |  46 ++++++
 usr.sbin/bhyve/kbdlayout/fr_acc            |  46 ++++++
 usr.sbin/bhyve/kbdlayout/fr_dvorak         |  87 ++++++++++
 usr.sbin/bhyve/kbdlayout/fr_dvorak_acc     |  86 ++++++++++
 usr.sbin/bhyve/kbdlayout/fr_macbook        |  49 ++++++
 usr.sbin/bhyve/kbdlayout/gr                |   9 ++
 usr.sbin/bhyve/kbdlayout/gr_101_acc        |   9 ++
 usr.sbin/bhyve/kbdlayout/gr_elot_acc       |  17 ++
 usr.sbin/bhyve/kbdlayout/hr                |  36 +++++
 usr.sbin/bhyve/kbdlayout/hu_101            |   9 ++
 usr.sbin/bhyve/kbdlayout/hu_102            |  41 +++++
 usr.sbin/bhyve/kbdlayout/is                |  33 ++++
 usr.sbin/bhyve/kbdlayout/is_acc            |  32 ++++
 usr.sbin/bhyve/kbdlayout/it                |  34 ++++
 usr.sbin/bhyve/kbdlayout/jp                |  36 +++++
 usr.sbin/bhyve/kbdlayout/jp_capsctrl       |  37 +++++
 usr.sbin/bhyve/kbdlayout/kz_io             |  11 ++
 usr.sbin/bhyve/kbdlayout/kz_kst            |  11 ++
 usr.sbin/bhyve/kbdlayout/latinamerican     |  33 ++++
 usr.sbin/bhyve/kbdlayout/latinamerican_acc |  31 ++++
 usr.sbin/bhyve/kbdlayout/lt                |  10 ++
 usr.sbin/bhyve/kbdlayout/nl                |  31 ++++
 usr.sbin/bhyve/kbdlayout/no                |  32 ++++
 usr.sbin/bhyve/kbdlayout/no_dvorak         |  81 ++++++++++
 usr.sbin/bhyve/kbdlayout/nordic_asus-eee   |  32 ++++
 usr.sbin/bhyve/kbdlayout/pl_dvorak         |  74 +++++++++
 usr.sbin/bhyve/kbdlayout/pt                |  31 ++++
 usr.sbin/bhyve/kbdlayout/pt_acc            |  28 ++++
 usr.sbin/bhyve/kbdlayout/ru                |  14 ++
 usr.sbin/bhyve/kbdlayout/ru_shift          |   9 ++
 usr.sbin/bhyve/kbdlayout/ru_win            |   9 ++
 usr.sbin/bhyve/kbdlayout/se                |  32 ++++
 usr.sbin/bhyve/kbdlayout/si                |  36 +++++
 usr.sbin/bhyve/kbdlayout/tr                |  36 +++++
 usr.sbin/bhyve/kbdlayout/tr_f              |  81 ++++++++++
 usr.sbin/bhyve/kbdlayout/ua                |   9 ++
 usr.sbin/bhyve/kbdlayout/ua_shift_alt      |  10 ++
 usr.sbin/bhyve/kbdlayout/uk                |  14 ++
 usr.sbin/bhyve/kbdlayout/uk_capsctrl       |  14 ++
 usr.sbin/bhyve/kbdlayout/uk_dvorak         |  78 +++++++++
 usr.sbin/bhyve/kbdlayout/uk_macbook        |  10 ++
 usr.sbin/bhyve/kbdlayout/us_dvorak         |  74 +++++++++
 usr.sbin/bhyve/kbdlayout/us_dvorakl        |  88 ++++++++++
 usr.sbin/bhyve/kbdlayout/us_dvorakp        |  95 +++++++++++
 usr.sbin/bhyve/kbdlayout/us_dvorakr        |  86 ++++++++++
 usr.sbin/bhyve/kbdlayout/us_dvorakx        |  80 ++++++++++
 usr.sbin/bhyve/kbdlayout/us_emacs          |   9 ++
 usr.sbin/bhyve/kbdlayout/us_unix           |  14 ++
 usr.sbin/bhyve/ps2kbd.c                    |  95 ++++++++++-
 81 files changed, 2956 insertions(+), 5 deletions(-)

diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist
index 46a975178595..fcaf5c72cef8 100644
--- a/etc/mtree/BSD.usr.dist
+++ b/etc/mtree/BSD.usr.dist
@@ -170,6 +170,10 @@
     share
         atf             tags=package=tests
         ..
+        bhyve
+            kbdlayout
+            ..
+        ..
         bsdconfig
             media
             ..
diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile
index e35d528ab605..d55022d05f18 100644
--- a/usr.sbin/bhyve/Makefile
+++ b/usr.sbin/bhyve/Makefile
@@ -132,4 +132,5 @@ CFLAGS+=-DGDB_LOG
 
 WARNS?=	2
 
+SUBDIR=	kbdlayout
 .include <bsd.prog.mk>
diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8
index ddd74cc819f1..f56f4e771b70 100644
--- a/usr.sbin/bhyve/bhyve.8
+++ b/usr.sbin/bhyve/bhyve.8
@@ -53,6 +53,7 @@
 .Sm on
 .Oc
 .Op Fl k Ar config_file
+.Op Fl K Ar layout
 .Oo Fl l
 .Sm off
 .Ar lpcdev Op Cm \&, Ar conf
@@ -171,6 +172,13 @@ Print help message and exit.
 Set configuration variables from a simple, key-value config file.
 Each line of the config file is expected to consist of a config variable
 name, an equals sign
+.It Fl K Ar layout
+Specify the keyboard layout.
+The value that can be specified sets the file name in
+.Ar /usr/share/bhyve/kbdlayout .
+This specification only works when loaded with UEFI mode for VNC.
+When using a VNC client that supports QEMU Extended Key Event Message (e.g. TigerVNC), this option isn't needed.
+When using a VNC client that doesn't support QEMU Extended Key Event Message (e.g. tightVNC), the layout defaults to the US keyboard unless specified otherwise.
 .Pq Sq = ,
 and a value.
 No spaces are permitted between the variable name, equals sign, or
diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5
index 488dfb21bab7..882479bf7b00 100644
--- a/usr.sbin/bhyve/bhyve_config.5
+++ b/usr.sbin/bhyve/bhyve_config.5
@@ -133,6 +133,12 @@ will listen for connections on this port.
 .It Va gdb.wait Ta bool Ta false Ta
 If the debug server is enabled, wait for a debugger to connect
 before starting the guest.
+.It Va keyboard.layout Ta string Ta Ta
+Specify the keyboard layout name with the file name in
+.Ar /usr/share/bhyve/kbdlayout .
+This value only works when loaded with UEFI mode for VNC, and
+used a VNC client that don't support QEMU Extended Key Event
+Message (e.g. TightVNC).
 .It Va rtc.use_localtime Ta bool Ta true Ta
 The real time clock uses the local time of the host.
 If this is set to false, the real time clock uses UTC.
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
index e9fc3c98ddeb..27166d9046e5 100644
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -236,6 +236,7 @@ usage(int code)
 		"       -H: vmexit from the guest on HLT\n"
 		"       -h: help\n"
 		"       -k: key=value flat config file\n"
+		"       -K: PS2 keyboard layout\n"
 		"       -l: LPC device configuration\n"
 		"       -m: memory size\n"
 		"       -o: set config 'var' to 'value'\n"
@@ -1242,9 +1243,9 @@ main(int argc, char *argv[])
 	progname = basename(argv[0]);
 
 #ifdef BHYVE_SNAPSHOT
-	optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:r:";
+	optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:r:";
 #else
-	optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:";
+	optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:";
 #endif
 	while ((c = getopt(argc, argv, optstr)) != -1) {
 		switch (c) {
@@ -1278,6 +1279,9 @@ main(int argc, char *argv[])
 		case 'k':
 			parse_simple_config_file(optarg);
 			break;
+		case 'K':
+			set_config_value("keyboard.layout", optarg);
+			break;
 		case 'l':
 			if (strncmp(optarg, "help", strlen(optarg)) == 0) {
 				lpc_print_supported_devices();
diff --git a/usr.sbin/bhyve/kbdlayout/Makefile b/usr.sbin/bhyve/kbdlayout/Makefile
new file mode 100644
index 000000000000..dc608508f67e
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+FILESDIR=	${SHAREDIR}/bhyve/kbdlayout
+FILES=		default \
+		am \
+		be be_acc \
+		bg_bds bg_phonetic \
+		br br_noacc \
+		centraleuropean \
+		ch ch_acc ch_macbook_acc ch-fr ch-fr_acc \
+		cz \
+		de de_acc de_noacc \
+		dk dk_macbook \
+		ee \
+		es es_acc es_dvorak \
+		fi \
+		fr fr_acc fr_dvorak fr_dvorak_acc fr_macbook \
+		gr gr_101_acc gr_elot_acc \
+		hr \
+		hu_101 hu_102 \
+		is is_acc \
+		it \
+		jp jp_capsctrl \
+		kz_io kz_kst \
+		latinamerican latinamerican_acc \
+		lt \
+		nl \
+		no no_dvorak nordic_asus-eee \
+		pl_dvorak \
+		pt pt_acc \
+		ru ru_shift ru_win \
+		se \
+		si \
+		tr tr_f \
+		ua ua_shift_alt \
+		uk uk_capsctrl uk_dvorak uk_macbook \
+		us_dvorak us_dvorakl us_dvorakp us_dvorakr us_dvorakx \
+		us_emacs us_unix
+
+.include <bsd.prog.mk>
diff --git a/usr.sbin/bhyve/kbdlayout/Makefile.depend b/usr.sbin/bhyve/kbdlayout/Makefile.depend
new file mode 100644
index 000000000000..f80275d86ab1
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.sbin/bhyve/kbdlayout/am b/usr.sbin/bhyve/kbdlayout/am
new file mode 100644
index 000000000000..c102fb10801a
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/am
@@ -0,0 +1,10 @@
+# bhyve ps2kbd keyboard layout file
+#   (am : Armenian phonetic layout)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+')',0x87;	)  (0x29)
+'+',0xce;	+  (0x2b)
+
diff --git a/usr.sbin/bhyve/kbdlayout/be b/usr.sbin/bhyve/kbdlayout/be
new file mode 100644
index 000000000000..26f8cdc3acbc
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/be
@@ -0,0 +1,45 @@
+# bhyve ps2kbd keyboard layout file
+#   (be : Belgian)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x3e;	!  (0x21)
+'"',0x26;	"  (0x22)
+'$',0x5b;	$  (0x24)
+'%',0x52;	%  (0x25)
+'&',0x16;	&  (0x26)
+''',0x25;	'  (0x27)
+'(',0x2e;	(  (0x28)
+')',0x4e;	)  (0x29)
+'*',0x5b;	*  (0x2a)
+'+',0x4a;	+  (0x2b)
+',',0x3a;	,  (0x2c)
+'-',0x55;	-  (0x2d)
+'.',0x41;	.  (0x2e)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x4a;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x3a;	?  (0x3f)
+'A',0x15;	A  (0x41)
+'M',0x4c;	M  (0x4d)
+'Q',0x1c;	Q  (0x51)
+'W',0x1a;	W  (0x57)
+'Z',0x1d;	Z  (0x5a)
+'\',0x61;	\  (0x5c)
+'^',0x54;	^  (0x5e)
+'_',0x55;	_  (0x5f)
+'`',0x5d;	`  (0x60)
+'a',0x15;	a  (0x61)
+'m',0x4c;	m  (0x6d)
+'q',0x1c;	q  (0x71)
+'w',0x1a;	w  (0x77)
+'z',0x1d;	z  (0x7a)
+'{',0x46;	{  (0x7b)
+'|',0x16;	|  (0x7c)
+'}',0x45;	}  (0x7d)
+'~',0x4a;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/be_acc b/usr.sbin/bhyve/kbdlayout/be_acc
new file mode 100644
index 000000000000..adf136634eb2
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/be_acc
@@ -0,0 +1,42 @@
+# bhyve ps2kbd keyboard layout file
+#   (be_acc : Belgian (accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x3e;	!  (0x21)
+'"',0x26;	"  (0x22)
+'$',0x5b;	$  (0x24)
+'%',0x52;	%  (0x25)
+'&',0x16;	&  (0x26)
+''',0x25;	'  (0x27)
+'(',0x2e;	(  (0x28)
+')',0x4e;	)  (0x29)
+'*',0x5b;	*  (0x2a)
+'+',0x4a;	+  (0x2b)
+',',0x3a;	,  (0x2c)
+'-',0x55;	-  (0x2d)
+'.',0x41;	.  (0x2e)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x4a;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x3a;	?  (0x3f)
+'A',0x15;	A  (0x41)
+'M',0x4c;	M  (0x4d)
+'Q',0x1c;	Q  (0x51)
+'W',0x1a;	W  (0x57)
+'Z',0x1d;	Z  (0x5a)
+'\',0x61;	\  (0x5c)
+'_',0x55;	_  (0x5f)
+'a',0x15;	a  (0x61)
+'m',0x4c;	m  (0x6d)
+'q',0x1c;	q  (0x71)
+'w',0x1a;	w  (0x77)
+'z',0x1d;	z  (0x7a)
+'{',0x46;	{  (0x7b)
+'|',0x16;	|  (0x7c)
+'}',0x45;	}  (0x7d)
+
diff --git a/usr.sbin/bhyve/kbdlayout/bg_bds b/usr.sbin/bhyve/kbdlayout/bg_bds
new file mode 100644
index 000000000000..9c25ed4640d3
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/bg_bds
@@ -0,0 +1,10 @@
+# bhyve ps2kbd keyboard layout file
+#   (bg_bds : Bulgarian (BDS))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'(',0xa9;	(  (0x28)
+'*',0xb7;	*  (0x2a)
+
diff --git a/usr.sbin/bhyve/kbdlayout/bg_phonetic b/usr.sbin/bhyve/kbdlayout/bg_phonetic
new file mode 100644
index 000000000000..dfe972db5b5b
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/bg_phonetic
@@ -0,0 +1,9 @@
+# bhyve ps2kbd keyboard layout file
+#   (bg_phonetic : Bulgarian (Phonetic))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'*',0xb7;	*  (0x2a)
+
diff --git a/usr.sbin/bhyve/kbdlayout/br b/usr.sbin/bhyve/kbdlayout/br
new file mode 100644
index 000000000000..b4605e1748c3
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/br
@@ -0,0 +1,19 @@
+# bhyve ps2kbd keyboard layout file
+#   (br : Brazilian (accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'"',0x0e;	"  (0x22)
+''',0x0e;	'  (0x27)
+':',0x4a;	:  (0x3a)
+';',0x4a;	;  (0x3b)
+'?',0x51;	?  (0x3f)
+'[',0x5b;	[  (0x5b)
+'\',0x61;	\  (0x5c)
+']',0x5d;	]  (0x5d)
+'{',0x5b;	{  (0x7b)
+'|',0x61;	|  (0x7c)
+'}',0x5d;	}  (0x7d)
+
diff --git a/usr.sbin/bhyve/kbdlayout/br_noacc b/usr.sbin/bhyve/kbdlayout/br_noacc
new file mode 100644
index 000000000000..62bea6254ced
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/br_noacc
@@ -0,0 +1,22 @@
+# bhyve ps2kbd keyboard layout file
+#   (br_noacc : Brazilian (without accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'"',0x0e;	"  (0x22)
+''',0x0e;	'  (0x27)
+':',0x4a;	:  (0x3a)
+';',0x4a;	;  (0x3b)
+'?',0x51;	?  (0x3f)
+'[',0x5b;	[  (0x5b)
+'\',0x61;	\  (0x5c)
+']',0x5d;	]  (0x5d)
+'^',0x52;	^  (0x5e)
+'`',0x54;	`  (0x60)
+'{',0x5b;	{  (0x7b)
+'|',0x61;	|  (0x7c)
+'}',0x5d;	}  (0x7d)
+'~',0x52;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/centraleuropean b/usr.sbin/bhyve/kbdlayout/centraleuropean
new file mode 100644
index 000000000000..7b3a2f883aaa
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/centraleuropean
@@ -0,0 +1,12 @@
+# bhyve ps2kbd keyboard layout file
+#   (centraleuropean : Central European)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+
diff --git a/usr.sbin/bhyve/kbdlayout/ch b/usr.sbin/bhyve/kbdlayout/ch
new file mode 100644
index 000000000000..c68f78a49ede
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/ch
@@ -0,0 +1,36 @@
+# bhyve ps2kbd keyboard layout file
+#   (ch : Swiss-German)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x5b;	!  (0x21)
+'"',0x1e;	"  (0x22)
+'$',0x5d;	$  (0x24)
+'&',0x36;	&  (0x26)
+''',0x4e;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x26;	*  (0x2a)
+'+',0x16;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'\',0x61;	\  (0x5c)
+'^',0x55;	^  (0x5e)
+'_',0x4a;	_  (0x5f)
+'`',0x55;	`  (0x60)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x52;	{  (0x7b)
+'|',0x16;	|  (0x7c)
+'}',0x5d;	}  (0x7d)
+'~',0x55;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/ch-fr b/usr.sbin/bhyve/kbdlayout/ch-fr
new file mode 100644
index 000000000000..33d747f58f5a
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/ch-fr
@@ -0,0 +1,36 @@
+# bhyve ps2kbd keyboard layout file
+#   (ch-fr : Swiss-French)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x5b;	!  (0x21)
+'"',0x1e;	"  (0x22)
+'$',0x5d;	$  (0x24)
+'&',0x36;	&  (0x26)
+''',0x4e;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x26;	*  (0x2a)
+'+',0x16;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'\',0x61;	\  (0x5c)
+'^',0x55;	^  (0x5e)
+'_',0x4a;	_  (0x5f)
+'`',0x55;	`  (0x60)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x52;	{  (0x7b)
+'|',0x16;	|  (0x7c)
+'}',0x5d;	}  (0x7d)
+'~',0x55;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/ch-fr_acc b/usr.sbin/bhyve/kbdlayout/ch-fr_acc
new file mode 100644
index 000000000000..3d081fb6711c
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/ch-fr_acc
@@ -0,0 +1,33 @@
+# bhyve ps2kbd keyboard layout file
+#   (ch-fr_acc : Swiss-French (accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x5b;	!  (0x21)
+'"',0x1e;	"  (0x22)
+'$',0x5d;	$  (0x24)
+'&',0x36;	&  (0x26)
+''',0x4e;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x26;	*  (0x2a)
+'+',0x16;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'\',0x61;	\  (0x5c)
+'_',0x4a;	_  (0x5f)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x52;	{  (0x7b)
+'|',0x16;	|  (0x7c)
+'}',0x5d;	}  (0x7d)
+
diff --git a/usr.sbin/bhyve/kbdlayout/ch_acc b/usr.sbin/bhyve/kbdlayout/ch_acc
new file mode 100644
index 000000000000..5b916d444e6f
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/ch_acc
@@ -0,0 +1,33 @@
+# bhyve ps2kbd keyboard layout file
+#   (ch_acc : Swiss-German (accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x5b;	!  (0x21)
+'"',0x1e;	"  (0x22)
+'$',0x5d;	$  (0x24)
+'&',0x36;	&  (0x26)
+''',0x4e;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x26;	*  (0x2a)
+'+',0x16;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'\',0x61;	\  (0x5c)
+'_',0x4a;	_  (0x5f)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x52;	{  (0x7b)
+'|',0x16;	|  (0x7c)
+'}',0x5d;	}  (0x7d)
+
diff --git a/usr.sbin/bhyve/kbdlayout/ch_macbook_acc b/usr.sbin/bhyve/kbdlayout/ch_macbook_acc
new file mode 100644
index 000000000000..3c7a032bebe6
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/ch_macbook_acc
@@ -0,0 +1,37 @@
+# bhyve ps2kbd keyboard layout file
+#   (ch_macbook_acc : Swiss-German Macbook/Macbook Pro (accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'!',0x5b;	!  (0x21)
+'"',0x1e;	"  (0x22)
+'$',0x5d;	$  (0x24)
+'&',0x36;	&  (0x26)
+''',0x4e;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x26;	*  (0x2a)
+'+',0x16;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x0e;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x0e;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'@',0x34;	@  (0x40)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'[',0x2e;	[  (0x5b)
+'\',0x61;	\  (0x5c)
+']',0x36;	]  (0x5d)
+'_',0x4a;	_  (0x5f)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x3e;	{  (0x7b)
+'|',0x3d;	|  (0x7c)
+'}',0x46;	}  (0x7d)
+'~',0x31;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/cz b/usr.sbin/bhyve/kbdlayout/cz
new file mode 100644
index 000000000000..98f6108231ee
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/cz
@@ -0,0 +1,11 @@
+# bhyve ps2kbd keyboard layout file
+#   (cz : Czech (QWERTZ, accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+')',0x9b;	)  (0x29)
+'*',0xb7;	*  (0x2a)
+'+',0x82;	+  (0x2b)
+
diff --git a/usr.sbin/bhyve/kbdlayout/de b/usr.sbin/bhyve/kbdlayout/de
new file mode 100644
index 000000000000..745f826a9de2
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/de
@@ -0,0 +1,37 @@
+# bhyve ps2kbd keyboard layout file
+#   (de : German)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'"',0x1e;	"  (0x22)
+'#',0x5d;	#  (0x23)
+'&',0x36;	&  (0x26)
+''',0x5d;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x5b;	*  (0x2a)
+'+',0x5b;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'@',0x15;	@  (0x40)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'[',0x3e;	[  (0x5b)
+'\',0x4e;	\  (0x5c)
+']',0x46;	]  (0x5d)
+'^',0x0e;	^  (0x5e)
+'_',0x4a;	_  (0x5f)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x3d;	{  (0x7b)
+'|',0x61;	|  (0x7c)
+'}',0x45;	}  (0x7d)
+'~',0x5b;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/de_acc b/usr.sbin/bhyve/kbdlayout/de_acc
new file mode 100644
index 000000000000..2ba06f3d166b
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/de_acc
@@ -0,0 +1,36 @@
+# bhyve ps2kbd keyboard layout file
+#   (de_acc : German (accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'"',0x1e;	"  (0x22)
+'#',0x5d;	#  (0x23)
+'&',0x36;	&  (0x26)
+''',0x5d;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x5b;	*  (0x2a)
+'+',0x5b;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'@',0x15;	@  (0x40)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'[',0x3e;	[  (0x5b)
+'\',0x4e;	\  (0x5c)
+']',0x46;	]  (0x5d)
+'^',0x0e;	^  (0x5e)
+'_',0x4a;	_  (0x5f)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x3d;	{  (0x7b)
+'|',0x61;	|  (0x7c)
+'}',0x45;	}  (0x7d)
+
diff --git a/usr.sbin/bhyve/kbdlayout/de_noacc b/usr.sbin/bhyve/kbdlayout/de_noacc
new file mode 100644
index 000000000000..4d215116e2a7
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/de_noacc
@@ -0,0 +1,38 @@
+# bhyve ps2kbd keyboard layout file
+#   (de_noacc : German (no accent keys))
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+'"',0x1e;	"  (0x22)
+'#',0x5d;	#  (0x23)
+'&',0x36;	&  (0x26)
+''',0x55;	'  (0x27)
+'(',0x3e;	(  (0x28)
+')',0x46;	)  (0x29)
+'*',0x5b;	*  (0x2a)
+'+',0x5b;	+  (0x2b)
+'-',0x4a;	-  (0x2d)
+':',0x49;	:  (0x3a)
+';',0x41;	;  (0x3b)
+'<',0x61;	<  (0x3c)
+'=',0x45;	=  (0x3d)
+'>',0x61;	>  (0x3e)
+'?',0x4e;	?  (0x3f)
+'@',0x15;	@  (0x40)
+'Y',0x1a;	Y  (0x59)
+'Z',0x35;	Z  (0x5a)
+'[',0x3e;	[  (0x5b)
+'\',0x4e;	\  (0x5c)
+']',0x46;	]  (0x5d)
+'^',0x0e;	^  (0x5e)
+'_',0x4a;	_  (0x5f)
+'`',0x55;	`  (0x60)
+'y',0x1a;	y  (0x79)
+'z',0x35;	z  (0x7a)
+'{',0x3d;	{  (0x7b)
+'|',0x61;	|  (0x7c)
+'}',0x45;	}  (0x7d)
+'~',0x5b;	~  (0x7e)
+
diff --git a/usr.sbin/bhyve/kbdlayout/default b/usr.sbin/bhyve/kbdlayout/default
new file mode 100644
index 000000000000..8674c280280b
--- /dev/null
+++ b/usr.sbin/bhyve/kbdlayout/default
@@ -0,0 +1,248 @@
+# bhyve ps2kbd keyboard layout file (US - default)
+#
+# Created by: Koine Yuusuke(koinec) <koinec@users.osdn.me>
+#
+# $FreeBSD$
+
+# for those who create the Keyboard Layout File. ******************************
+#  To create the keyboard layout file, first copy this 'default' file into the
+#  same dir. with the layout name as the file name.
+#  The file name is a character string that can be specified as it is in the
+#  -k option of the bhyve command, so a normal language name is desirable.
+#  Then, it is necessary to define the difference between the standard US keyboard
+#  and the keyboard for each language according to the setting method described
+#  in the comment below.
+#
+#  Note that lines starting with '#' and blank lines are ignored.
+#  In addition, the definition of the standard layout setting (US keyboard)
+#  is described as a comment line below for reference.
+#  So you usually only need to remove the '#' and fix it to the correct ScanCode
+#  only on the lines of the key that you can't type correctly with the standard
+#  US keyboard settings.
+
+
+# Alphabet/Number/Sign Keys ---------------------------------------------------
+#   Format:
+#     'Chr',ScanCode(Hex); <Comment>
+#       or
+#     AsciiCode(Hex),ScanCode(Hex); <Comment>
+#
+#  If there are ASCII characters that cannot be entered correctly with the
+#  standard settings(US Keyboard layout), delete the "#" at the beginning of the
+#  relevant line below and set the correct ScanCode.
+#
+#  For example, when a Japanese Keyboard is used, the '@' sign cannot be input
+#  correctly and the number '2' is input.
+#  This is because the US keyboard can input the '@' sign with the Shift + number'2'
+#  keys, and the ScanCode of the '@' sign is the number '2' key by default.
+#  In this case, remove the '#' at the beginning of the line with the '@' sign
+#  below and correct the ScanCode from 0x1e to 0x54 so that you can enter it
+#  correctly.
+#  ScanCode differs depending on the keyboard of eash language, so check it on
+#  the Internet.
+#  Note that keys that have no problems with input have the same settings as
+#  the US keyboard, so you do not need to set anything below.
+#  See the "/usr/share/bhyve/kbdlayout/jp106" file for the specific setting method.
+
+# '!',0x16;	!  (0x21)
+# '"',0x52;	"  (0x22)
+# '#',0x26;	#  (0x23)
+# '$',0x25;	$  (0x24)
+# '%',0x2e;	%  (0x25)
+# '&',0x3d;	&  (0x26)
+# ''',0x52;	'  (0x27)
+# '(',0x46;	(  (0x28)
+# ')',0x45;	)  (0x29)
+# '*',0x3e;	*  (0x2a)
+# '+',0x55;	+  (0x2b)
+# ',',0x41;	,  (0x2c)
+# '-',0x4e;	-  (0x2d)
+# '.',0x49;	.  (0x2e)
+# '/',0x4a;	/  (0x2f)
+
+# '0',0x45;	0  (0x30)
+# '1',0x16;	1  (0x31)
+# '2',0x1e;	2  (0x32)
+# '3',0x26;	3  (0x33)
+# '4',0x25;	4  (0x34)
+# '5',0x2e;	5  (0x35)
+# '6',0x36;	6  (0x36)
+# '7',0x3d;	7  (0x37)
+# '8',0x3e;	8  (0x38)
+# '9',0x46;	9  (0x39)
+# ':',0x4c;	:  (0x3a)
+# ';',0x4c;	;  (0x3b)
+# '<',0x41;	<  (0x3c)
+# '=',0x55;	=  (0x3d)
+# '>',0x49;	>  (0x3e)
+# '?',0x4a;	?  (0x3f)
+
+# '@',0x1e;	@  (0x40)
+# 'A',0x1c;	A  (0x41)
+# 'B',0x32;	B  (0x42)
+# 'C',0x21;	C  (0x43)
+# 'D',0x23;	D  (0x44)
+# 'E',0x24;	E  (0x45)
+# 'F',0x2b;	F  (0x46)
+# 'G',0x34;	G  (0x47)
+# 'H',0x33;	H  (0x48)
+# 'I',0x43;	I  (0x49)
+# 'J',0x3b;	J  (0x4a)
+# 'K',0x42;	K  (0x4b)
+# 'L',0x4b;	L  (0x4c)
+# 'M',0x3a;	M  (0x4d)
+# 'N',0x31;	N  (0x4e)
+# 'O',0x44;	O  (0x4f)
+
+# 'P',0x4d;	P  (0x50)
+# 'Q',0x15;	Q  (0x51)
+# 'R',0x2d;	R  (0x52)
+# 'S',0x1b;	S  (0x53)
+# 'T',0x2c;	T  (0x54)
+# 'U',0x3c;	U  (0x55)
+# 'V',0x2a;	V  (0x56)
+# 'W',0x1d;	W  (0x57)
+# 'X',0x22;	X  (0x58)
+# 'Y',0x35;	Y  (0x59)
+# 'Z',0x1a;	Z  (0x5a)
+# '[',0x54;	[  (0x5b)
+# '\',0x5d;	\  (0x5c)
+# ']',0x5b;	]  (0x5d)
+# '^',0x36;	^  (0x5e)
+# '_',0x4e;	_  (0x5f)
+
+# '`',0x0e;	`  (0x60)
+# 'a',0x1c;	a  (0x61)
+# 'b',0x32;	b  (0x62)
+# 'c',0x21;	c  (0x63)
+# 'd',0x23;	d  (0x64)
+# 'e',0x24;	e  (0x65)
+# 'f',0x2b;	f  (0x66)
+# 'g',0x34;	g  (0x67)
+# 'h',0x33;	h  (0x68)
+# 'i',0x43;	i  (0x69)
+# 'j',0x3b;	j  (0x6a)
+# 'k',0x42;	k  (0x6b)
+# 'l',0x4b;	l  (0x6c)
+# 'm',0x3a;	m  (0x6d)
+# 'n',0x31;	n  (0x6e)
+# 'o',0x44;	o  (0x6f)
+
+# 'p',0x4d;	p  (0x70)
+# 'q',0x15;	q  (0x71)
+# 'r',0x2d;	r  (0x72)
+# 's',0x1b;	s  (0x73)
+# 't',0x2c;	t  (0x74)
+# 'u',0x3c;	u  (0x75)
+# 'v',0x2a;	v  (0x76)
+# 'w',0x1d;	w  (0x77)
+# 'x',0x22;	x  (0x78)
+# 'y',0x35;	y  (0x79)
*** 2668 LINES SKIPPED ***