Page MenuHomeFreeBSD

D34479.1779175183.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D34479.1779175183.diff

Index: stand/i386/common/cons.h
===================================================================
--- stand/i386/common/cons.h
+++ 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_ */
Index: stand/i386/common/cons.c
===================================================================
--- stand/i386/common/cons.c
+++ 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,35 @@
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 BOOT_DEFAULT_KEYMAP */
+
return (v86.eax);
+ }
if (V86_ZR(v86.efl))
return (0);
Index: stand/i386/gptboot/Makefile
===================================================================
--- stand/i386/gptboot/Makefile
+++ 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
@@ -63,4 +69,12 @@
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/${.TARGET}
+ ${KEYMAP} -L ${BOOT_DEFAULT_KEYMAP} | ${KEYMAP_FIX} >> ${BOOTOBJ}/i386/common/${.TARGET}
+ printf "\n#endif /* _consmap_h_ */\n" >> ${BOOTOBJ}/i386/common/${.TARGET}
+
.include <bsd.prog.mk>
Index: stand/i386/gptzfsboot/Makefile
===================================================================
--- stand/i386/gptzfsboot/Makefile
+++ 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,15 @@
${OPENCRYPTO_XTS}
${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32}
+
zfsboot.o: ${ZFSSRC}/zfsimpl.c
+cons.o: consmap.h
+
+consmap.h:
+ mkdir -p ${BOOTOBJ}/i386/common
+ printf "#ifndef _consmap_h_\n#define _consmap_h_\n\n" > ${BOOTOBJ}/i386/common/${.TARGET}
+ ${KEYMAP} -L ${BOOT_DEFAULT_KEYMAP} | ${KEYMAP_FIX} >> ${BOOTOBJ}/i386/common/${.TARGET}
+ printf "\n#endif /* _consmap_h_ */\n" >> ${BOOTOBJ}/i386/common/${.TARGET}
+
.include <bsd.prog.mk>
Index: stand/libsa/geli/geliboot.c
===================================================================
--- stand/libsa/geli/geliboot.c
+++ 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

Mime Type
text/plain
Expires
Tue, May 19, 7:19 AM (15 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28738557
Default Alt Text
D34479.1779175183.diff (4 KB)

Event Timeline