public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: linux-tiny <Linux-tiny@selenic.com>,
	linux-embedded <linux-embedded@vger.kernel.org>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] console - Add configurable support for console charset translation
Date: Mon, 2 Jun 2008 15:37:09 -0700	[thread overview]
Message-ID: <48447615.5050806@am.sony.com> (raw)

With CONSOLE_TRANSLATIONS turned off, this saves about 6K
on my kernel configured for an ARM development board (OMAP
5912 OSK).  In embedded products I'm familiar with,
console translations are not needed.

This was taken from the Linux-tiny project and updated slightly
for 2.6.25.

  drivers/char/consolemap.c |   81 ++++++++++++++++++++++++++++++++++++++++++++++
  drivers/char/vt.c         |    4 ++
  init/Kconfig              |    7 +++
  3 files changed, 92 insertions(+)

Signed-off-by: Tim Bird <tim.bird@am.sony.com>

--- a/drivers/char/consolemap.c
+++ b/drivers/char/consolemap.c
@@ -22,6 +22,8 @@
  #include <linux/consolemap.h>
  #include <linux/vt_kern.h>

+#ifdef CONFIG_CONSOLE_TRANSLATIONS
+
  static unsigned short translations[][256] = {
    /* 8-bit Latin-1 mapped to Unicode -- trivial mapping */
    {
@@ -742,3 +744,82 @@ console_map_init(void)
  }

  EXPORT_SYMBOL(con_copy_unimap);
+
+#else
+
+u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode)
+{
+	return glyph;
+}
+
+unsigned short *set_translate(int m, struct vc_data *vc)
+{
+	return NULL;
+}
+
+int con_set_trans_old(unsigned char *arg)
+{
+	return 0;
+}
+
+int con_get_trans_old(unsigned char *arg)
+{
+	return -EINVAL;
+}
+
+int con_set_trans_new(ushort *arg)
+{
+	return 0;
+}
+
+int con_get_trans_new(ushort *arg)
+{
+	return -EINVAL;
+}
+
+int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
+{
+	return 0;
+}
+
+int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair *list)
+{
+	return 0;
+}
+
+int con_set_default_unimap(struct vc_data *vc)
+{
+	return 0;
+}
+
+int con_copy_unimap(struct vc_data *d, struct vc_data *s)
+{
+	return 0;
+}
+
+int con_get_unimap(struct vc_data *vc, ushort ct, ushort *uct,
+		   struct unipair *list)
+{
+	return -EINVAL;
+}
+
+void con_free_unimap(struct vc_data *vc) { }
+
+int conv_uni_to_pc(struct vc_data *conp, long ucs)
+{
+	return ucs > 0xff ? -1: ucs;
+}
+
+void __init console_map_init(void) { }
+
+u32 conv_8bit_to_uni(unsigned char c)
+{
+	return c;
+}
+
+int conv_uni_to_8bit(u32 uni)
+{
+	return (int)uni & 0xff;
+}
+
+#endif
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2198,7 +2198,11 @@ rescan_last_byte:
  			c = 0xfffd;
  		    tc = c;
  		} else {	/* no utf or alternate charset mode */
+#ifdef CONFIG_CONSOLE_TRANSLATIONS
  		    tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c];
+#else
+		    tc = c;
+#endif
  		}

                  /* If the original code was a control character we
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -758,6 +758,13 @@ config PROC_PAGE_MONITOR
  	  /proc/kpagecount, and /proc/kpageflags. Disabling these
            interfaces will reduce the size of the kernel by approximately 4kb.

+config CONSOLE_TRANSLATIONS
+	default y
+	bool "Enable character translations in console" if EMBEDDED
+	help
+	  This enables support for font mapping and Unicode translation
+          on virtual consoles.
+
  endmenu		# General setup

  config SLABINFO


             reply	other threads:[~2008-06-02 22:37 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02 22:37 Tim Bird [this message]
2008-06-03  1:34 ` [PATCH] console - Add configurable support for console charset translation H. Peter Anvin
2008-06-03  7:00   ` Jamie Lokier
2008-06-03 15:46   ` Matt Mackall
2008-06-03  8:36 ` David Woodhouse
2008-06-03 13:45 ` David Woodhouse
2008-06-03 14:06   ` Holger Schurig
2008-06-03 14:10     ` David Woodhouse
2008-06-04  0:01   ` Tim Bird
2008-06-04  0:16     ` David Woodhouse
2008-06-04  1:03       ` Josh Boyer
2008-06-04  1:05         ` David Woodhouse
2008-06-04  3:13           ` Josh Boyer
2008-06-04  9:16             ` David Woodhouse
2008-06-04 10:07               ` Adrian Bunk
2008-06-04 10:10                 ` David Woodhouse
2008-06-04 15:35       ` Tim Bird
2008-06-04 11:55     ` Alan Cox
2008-06-04 13:55       ` David Woodhouse
2008-06-04 14:07         ` Alan Cox
2008-06-04 14:27           ` David Woodhouse
2008-06-04 10:33 ` Adrian Bunk
2008-06-04 17:51   ` Rob Landley
2008-06-04 18:34   ` Bernhard Fischer
2008-06-04 19:01     ` Adrian Bunk
2008-06-04 19:21       ` Bernhard Fischer
2008-06-04 19:20         ` Alan Cox
2008-06-04 18:51   ` Tim Bird
2008-06-04 19:15     ` Sam Ravnborg
2008-06-04 19:23       ` Tim Bird
2008-06-04 20:23         ` Adrian Bunk
2008-06-04 20:42           ` Tim Bird
2008-06-05  6:55             ` Jörn Engel
2008-06-05  7:18           ` Uwe Klein
2008-06-04 20:24       ` Jörn Engel
2008-06-04 19:40     ` Adrian Bunk
2008-06-06 23:47       ` Tim Bird
2008-06-07  4:29         ` Rob Landley
2008-06-10  1:37           ` mainlining min-configs Tim Bird
2008-06-10  3:14             ` Ben Nizette
2008-06-10  4:16               ` Paul Mundt
2008-06-10  8:36             ` Adrian Bunk
2008-06-10 18:18               ` Tim Bird
2008-06-10 18:30                 ` Adrian Bunk
2008-06-10 18:51                   ` Sam Ravnborg
2008-06-10 19:05                     ` Adrian Bunk
2008-06-11  5:09                     ` Rob Landley
2008-06-11  6:39                       ` Sam Ravnborg
2008-06-11 19:09                         ` Tim Bird
2008-06-11 19:22                           ` Sam Ravnborg
2008-06-11 19:36                           ` Adrian Bunk
2008-06-11 19:46                             ` Tim Bird
2008-06-12  1:42                               ` Rob Landley
2008-06-11 19:48                             ` Sam Ravnborg
2008-06-12  0:01                           ` Rob Landley
2008-06-11  5:17                   ` Rob Landley
2008-06-11  5:51                 ` Rob Landley
2008-06-11  3:48               ` Rob Landley
2008-06-11  3:32             ` Rob Landley
2008-06-11  8:59             ` Christian MICHON
2008-06-04 19:42     ` [PATCH] console - Add configurable support for console charset translation Bernhard Fischer
2008-06-11  7:08   ` Holger Schurig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48447615.5050806@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=Linux-tiny@selenic.com \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox