Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146023141
D34479.1779127698.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D34479.1779127698.diff
View Options
diff --git a/stand/i386/common/cons.h b/stand/i386/common/cons.h
--- a/stand/i386/common/cons.h
+++ b/stand/i386/common/cons.h
@@ -32,4 +32,14 @@
int keyhit(unsigned int secs);
void getstr(char *cmdstr, size_t cmdstrsize);
+#ifdef BOOT_DEFAULT_KEYMAP
+ #define SF_LSHIFT 1
+ #define SF_RSHIFT 2
+ #define SF_SHIFT ( (SF_LSHIFT) | (SF_RSHIFT) )
+ #define SF_CTRL 4
+ #define SF_ALT 8
+ #define SF_NUMLCK 32
+ #define SF_CAPSLCK 64
+#endif /* BOOT_DEFAULT_KEYMAP */
+
#endif /* !_CONS_H_ */
diff --git a/stand/i386/common/cons.c b/stand/i386/common/cons.c
--- a/stand/i386/common/cons.c
+++ b/stand/i386/common/cons.c
@@ -28,6 +28,11 @@
#include "rbx.h"
#include "cons.h"
+#ifdef BOOT_DEFAULT_KEYMAP
+ #include <sys/kbio.h>
+ #include "consmap.h"
+#endif
+
#define SECOND 18 /* Circa that many ticks in a second. */
uint8_t ioctrl = IO_KEYBOARD;
@@ -97,8 +102,32 @@
v86.eax = fn << 8;
v86int();
- if (fn == 0)
+ if (fn == 0) {
+ #ifdef BOOT_DEFAULT_KEYMAP
+ u_char idx = 0;
+ u_char sc = (v86.eax >> 8) & 0xff; /* scan code in AH */
+ u_char sf; /* shift flags */
+
+ v86.ctl = V86_FLAGS;
+ v86.addr = 0x16;
+ v86.eax = 0x1200;
+ v86int();
+
+ sf = v86.eax & 0xff; /* shift flags in AL */
+ if ( sf & SF_SHIFT) idx |= 1;
+ if ( sf & SF_CTRL ) idx |= 2;
+ if ( sf & SF_ALT ) idx |=4;
+
+ /* handle capslock and numlock */
+ if ( (sf & SF_CAPSLCK) && ( key_map.key[sc].flgs & FLAG_LOCK_C)
+ || ( sf & SF_NUMLCK) && ( key_map.key[sc].flgs & FLAG_LOCK_N) )
+ idx ^= 1;
+
+ v86.eax = ( sc << 8) | key_map.key[sc].map[idx];
+
+ #endif /* ifdef CUSTOM_MAP */
return (v86.eax);
+ }
if (V86_ZR(v86.efl))
return (0);
diff --git a/stand/i386/gptboot/Makefile b/stand/i386/gptboot/Makefile
--- a/stand/i386/gptboot/Makefile
+++ b/stand/i386/gptboot/Makefile
@@ -36,8 +36,14 @@
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-Wno-pointer-sign
-CFLAGS.gcc+= --param max-inline-insns-single=100
+.if defined(BOOT_DEFAULT_KEYMAP)
+CFLAGS+=-DBOOT_DEFAULT_KEYMAP=\"${BOOT_DEFAULT_KEYMAP}\" -I${BOOTOBJ}/i386/common
+KEYMAP=kbdcontrol -P ${SRCTOP}/share/vt/keymaps -P ${SRCTOP}/share/syscons/keymaps
+KEYMAP_FIX=sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /'
+CLEANFILES+= consmap.h
+.endif
+CFLAGS.gcc+= --param max-inline-insns-single=100
LD_FLAGS+=${LD_FLAGS_BIN}
CLEANFILES+= gptboot
@@ -57,10 +63,20 @@
CLEANFILES+= gptboot.bin gptboot.out gptboot.o sio.o drv.o \
cons.o ${OPENCRYPTO_XTS}
+cons.o: consmap.h
+
gptboot.bin: gptboot.out
${OBJCOPY} -S -O binary gptboot.out ${.TARGET}
gptboot.out: ${BTXCRT} gptboot.o sio.o drv.o cons.o ${OPENCRYPTO_XTS}
${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBSA32}
+cons.o: consmap.h
+
+consmap.h:
+ mkdir -p ${BOOTOBJ}/i386/common
+ printf "#ifndef _consmap_h_\n#define _consmap_h_\n\n" > ${BOOTOBJ}/i386/common/consmap.h
+ ${KEYMAP} -L ${BOOT_DEFAULT_KEYMAP} | ${KEYMAP_FIX} >> ${BOOTOBJ}/i386/common/consmap.h
+ printf "\n#endif /* _consmap_h_ */\n" >> ${BOOTOBJ}/i386/common/consmap.h
+
.include <bsd.prog.mk>
diff --git a/stand/i386/gptzfsboot/Makefile b/stand/i386/gptzfsboot/Makefile
--- a/stand/i386/gptzfsboot/Makefile
+++ b/stand/i386/gptzfsboot/Makefile
@@ -44,6 +44,13 @@
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-Wno-pointer-sign
+.if defined(BOOT_DEFAULT_KEYMAP)
+CFLAGS+=-DBOOT_DEFAULT_KEYMAP=\"${BOOT_DEFAULT_KEYMAP}\" -I${BOOTOBJ}/i386/common
+KEYMAP=kbdcontrol -P ${SRCTOP}/share/vt/keymaps -P ${SRCTOP}/share/syscons/keymaps
+KEYMAP_FIX=sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /'
+CLEANFILES+= consmap.h
+.endif
+
CFLAGS.clang+= -Wno-tentative-definition-incomplete-type
NO_WCAST_ALIGN=
@@ -79,6 +86,14 @@
${OPENCRYPTO_XTS}
${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
+cons.o: consmap.h
+
zfsboot.o: ${ZFSSRC}/zfsimpl.c
+consmap.h:
+ mkdir -p ${BOOTOBJ}/i386/common
+ printf "#ifndef _consmap_h_\n#define _consmap_h_\n\n" > ${BOOTOBJ}/i386/common/consmap.h
+ ${KEYMAP} -L ${BOOT_DEFAULT_KEYMAP} | ${KEYMAP_FIX} >> ${BOOTOBJ}/i386/common/consmap.h
+ printf "\n#endif /* _consmap_h_ */\n" >> ${BOOTOBJ}/i386/common/consmap.h
+
.include <bsd.prog.mk>
diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile
--- a/stand/libsa/Makefile
+++ b/stand/libsa/Makefile
@@ -188,4 +188,9 @@
.include "${SASRC}/zfs/Makefile.inc"
.endif
+# Custom default keymap
+.if defined(BOOT_DEFAULT_KEYMAP)
+CFLAGS+=-DBOOT_DEFAULT_KEYMAP=\"${BOOT_DEFAULT_KEYMAP}\" -I${BOOTOBJ}/i386/common
+.endif
+
.include <bsd.lib.mk>
diff --git a/stand/libsa/geli/geliboot.c b/stand/libsa/geli/geliboot.c
--- a/stand/libsa/geli/geliboot.c
+++ b/stand/libsa/geli/geliboot.c
@@ -379,6 +379,10 @@
{
int i;
+ #ifdef BOOT_DEFAULT_KEYMAP
+ printf("keyboard layout: %s\n", BOOT_DEFAULT_KEYMAP);
+ #endif
+
/* TODO: Implement GELI keyfile(s) support */
for (i = 0; i < 3; i++) {
/* Try cached passphrase */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 6:08 PM (2 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28721295
Default Alt Text
D34479.1779127698.diff (5 KB)
Attached To
Mode
D34479: Add support for custom keyboard layout when GELI asks for a passphrase
Attached
Detach File
Event Timeline
Log In to Comment