Bug 193865 - [sys/conf/files.amd64] [patch] option …_DFLT_KEYMAP config header generation fix
Summary: [sys/conf/files.amd64] [patch] option …_DFLT_KEYMAP config header generation fix
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL: https://reviews.freebsd.org/D5645
Keywords: patch
: 193817 (view as bug list)
Depends on:
Blocks: 203349
  Show dependency treegraph
 
Reported: 2014-09-23 08:47 UTC by Harald Schmalzbauer
Modified: 2016-04-21 19:26 UTC (History)
4 users (show)

See Also:
op: mfc-stable10?


Attachments
dual-constype keymap lookup for XXX_DFLT_KEYMAP, from sources (7.65 KB, patch)
2014-09-23 08:47 UTC, Harald Schmalzbauer
no flags Details | Diff
Fix PC98 kmapfile vraiable after original patch was commited (1.35 KB, patch)
2016-03-15 16:09 UTC, Harald Schmalzbauer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Schmalzbauer 2014-09-23 08:47:52 UTC
Created attachment 147589 [details]
dual-constype keymap lookup for XXX_DFLT_KEYMAP, from sources

Currently, when compiling a kernel for non-default (US) keyboard layouts, the instructions for generating the keymap header files for various keyboard types are defined in a way, that the process depends on the kbdcontrol(1) utility from the building host, which leads to the problem described in the next paragraph, but is unavoidable.
But also the keymap files are referenced to the ones installed on the building machine, instead of those from the sources. This can be easily fixed. The attached patch incorporates that.

More severe is the problem with keymap name limitations due to the dependency of the build machine's kbdcontrol(1) utility.
If the keymap name, defined by the XXX_DFLT_KEYMAP config option, can't be found in the path corresponding to the build machine's active console, kernel compilation failes since no header file was generated! This means we cannot compile a vt keymap into a kernel on a machine that runs the sc console and vice versa. 
At compile time, it's not possible to determine which console (vt or sc) will be used later, so it's the responsibility of the operator to choose the matching keymap, which currently doesn't work.
Defining _DFLT_KEYMAP option must not depend on the build host! Like mentioned above, it's the operator's responsibility defining the correct keymap name, but the header file generation must work independent of the active console type, so the lookup for the keymap file has to be done in both paths, vt's and sc's (share/vt/keymaps and share/syscons/keymaps)!

The attached patch enhances the keymap file lookup and also fixes the usage of the keymap files installed (or not) on the host system, instead it uses the keymaps from sources.
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2014-09-23 17:01:11 UTC
Same problem at PR ports/193817

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193817
Comment 2 Harald Schmalzbauer 2014-12-23 14:30:43 UTC
Bump to request review/commiting to head?
Comment 3 Oliver Pinter freebsd_committer freebsd_triage 2015-02-28 21:31:58 UTC
Updated to 11-CURRENT the affected version.
Comment 4 Ed Maste freebsd_committer freebsd_triage 2016-03-15 13:49:44 UTC
See also r270652, which removed the "band aid" that had kbdcontrol searching the syscons path also under vt.
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-03-15 15:20:33 UTC
A commit references this bug:

Author: emaste
Date: Tue Mar 15 13:38:16 UTC 2016
New revision: 296899
URL: https://svnweb.freebsd.org/changeset/base/296899

Log:
  Fix atkbdmap.h generation for sc/vt consoles

  Keymap header files have historically been generated using the build
  host's /usr/sbin/kbdcontrol and using the host's keymap files.

  However, that introduces an issue when building a kernel to use vt(4)
  on a system using sc(4), or vice versa: kbdcontrol searches for keymap
  files in the /usr/share subdirectory appropriate for the host, not the
  target.

  With this change the build searches both the and sc keymap directories
  from the source tree.

  PR:		193865
  Submitted by:	Harald Schmalzbauer

Changes:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/conf/files.sparc64
Comment 6 Harald Schmalzbauer 2016-03-15 16:06:27 UTC
Thanks for taking care!
Unforutnately, there seems to be a copy'n'paste error in my patch, affecting PC98.
Note that I don't know anything about PC98, but for ukbdmak.h it's clear that it should read
kmapfile=$${kmpath}/${UKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd
instead of
kmapfile=$${kmpath}/${ATKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd

I'll attach a post-commit-patch which fixes that.

Sorry for the poor quality patch.
Comment 7 Harald Schmalzbauer 2016-03-15 16:09:18 UTC
Created attachment 168242 [details]
Fix PC98 kmapfile vraiable after original patch was commited
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-03-15 17:33:22 UTC
A commit references this bug:

Author: emaste
Date: Tue Mar 15 17:32:30 UTC 2016
New revision: 296914
URL: https://svnweb.freebsd.org/changeset/base/296914

Log:
  Fix copy-n-pasteo in r296899 ukbdmap.h header generation for pc98

  The ukbd default is specified by UKBD_DFLT_KEYMAP not ATKBD_DFLT_KEYMAP.

  PR:		193865
  Submitted by:	Harald Schmalzbauer

Changes:
  head/sys/conf/files.pc98
Comment 9 Ed Maste freebsd_committer freebsd_triage 2016-03-15 17:36:14 UTC
> Thanks for taking care!
> Unforutnately, there seems to be a copy'n'paste error in my patch, affecting PC98.

Thanks for the followup and sorry it took so long to get to this.

I have a proposed patch to kbdcontrol in review (https://reviews.freebsd.org/D5645) to add a -P <path> option that should allow a subsequent refinement of this change. Please look it over and comment if you have a chance.
Comment 10 Ed Maste freebsd_committer freebsd_triage 2016-03-15 18:52:26 UTC
*** Bug 193817 has been marked as a duplicate of this bug. ***
Comment 11 commit-hook freebsd_committer freebsd_triage 2016-03-16 04:05:13 UTC
A commit references this bug:

Author: emaste
Date: Wed Mar 16 04:05:03 UTC 2016
New revision: 296926
URL: https://svnweb.freebsd.org/changeset/base/296926

Log:
  kbdcontrol: add -P path option to add keymap search paths

  PR:		193865
  Reviewed by:	cem
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D5645

Changes:
  head/usr.sbin/kbdcontrol/kbdcontrol.1
  head/usr.sbin/kbdcontrol/kbdcontrol.c
Comment 12 Ed Maste freebsd_committer freebsd_triage 2016-03-22 20:35:07 UTC
Please see https://reviews.freebsd.org/D5708 for a simplification of the compile-time keyboard map generation.
Comment 13 commit-hook freebsd_committer freebsd_triage 2016-03-28 19:52:20 UTC
A commit references this bug:

Author: emaste
Date: Mon Mar 28 19:51:46 UTC 2016
New revision: 297363
URL: https://svnweb.freebsd.org/changeset/base/297363

Log:
  simplify compile-time default keyboard map generation

  In r296926 the -P <path> option was added to kbdcontrol, which enables
  this change for a simplified compile-time default keymap build process.

  PR:		193865
  Reviewed by:	Oliver Pinter
  Tested by:	Oliver Pinter
  MFC After:	1 month
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D5708

Changes:
  head/Makefile.inc1
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/conf/files.sparc64
Comment 14 commit-hook freebsd_committer freebsd_triage 2016-04-19 20:56:22 UTC
A commit references this bug:

Author: emaste
Date: Tue Apr 19 20:56:02 UTC 2016
New revision: 298297
URL: https://svnweb.freebsd.org/changeset/base/298297

Log:
  MFC r296926: kbdcontrol: add -P path option to add keymap search paths

  PR:		193865
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/10/
  stable/10/usr.sbin/kbdcontrol/kbdcontrol.1
  stable/10/usr.sbin/kbdcontrol/kbdcontrol.c
Comment 15 commit-hook freebsd_committer freebsd_triage 2016-04-21 19:24:52 UTC
A commit references this bug:

Author: emaste
Date: Thu Apr 21 19:24:37 UTC 2016
New revision: 298429
URL: https://svnweb.freebsd.org/changeset/base/298429

Log:
  Fix compiled-in keymap generation for sc/vt consoles

  In r298297 kbdcontrol's -P <path> option was MFC'd to stable/10, which
  enables this change for a simplified compile-time default keymap build
  process.

  PR:		193865
  MFC of:		r296899, r296914, r297363, r298402

Changes:
_U  stable/10/
  stable/10/Makefile.inc1
  stable/10/sys/conf/files.amd64
  stable/10/sys/conf/files.i386
  stable/10/sys/conf/files.pc98
  stable/10/sys/conf/files.sparc64