LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1109|回复: 4

中文内核补丁

[复制链接]
发表于 2009-1-4 19:36:42 | 显示全部楼层 |阅读模式
看到http://blog.chinaunix.net/u/13265/showart.php?id=1008020
有中文内核补丁,不过没敢尝试。有没高人整成功的发个教程出来?看起来比zhcon要好使的样子。


原文如下:
内核补丁:字符终端下显示UTF-8字符
更新:
    2009年1月1日(元旦):新增gpm支持
    2009年1月1日(元旦):新增fbcondecor-2.6.28版支持补丁
    2009年1月1日(元旦):补丁更新为2.6.28通用补丁
    2008年10月18日:补丁更新为2.6.27通用补丁
    2008年7月21日:补丁更新为2.6.26通用补丁
    2008年7月21日:字体补丁做为2.6通用补丁
    2008年7月6日:补丁更新为2.6.25通用补丁

说明:
  这个补丁是在2006年就写好了,当时对应的内核版本是2.6.17,并应用在当时自己设计的Linux发行版(Olive)中,可以在Linuxsir中的LFS版块的Olive子版块中看到当时的截图:http://www.linuxsir.cn/bbs/thread271775.html

  后来这个补丁一直没再去改进,一不小心给我就压到“箱底”了,最近将其翻出来晒晒,顺带将其升级到2.6.25.6的版本上,有兴趣的朋友可以自己下载试试,该补丁GPL2方式发布,欢迎大家来改进代码。

  更新:本补丁如果有更新我会在我的blog(http://youbest.cublog.cn)中进 ... 看最新状态。

补丁说明:
    补丁分两个主要补丁和一个附加补丁

    文字显示补丁:
    http://zdbr.net.cn/download/utf8-kernel-2.6.28-core-2.patch.bz2
    http://zdbr.net.cn/download/utf8-kernel-2.6.27-core-1.patch.bz2
    http://zdbr.net.cn/download/utf8-kernel-2.6.26-core-1.patch.bz2
    以下为补丁说明:
     # 作者(author): 孙海勇
     # 发布协议(License): GPL v2
     # 邮件(email): youbest@sina.com
     # 说明:此补丁用于Linux内核,实现直接在framebuffer环境下直接显示UTF-8编码的文字功能。此补丁为功能补丁,不包含字库。

    字库补丁:
    http://zdbr.net.cn/download/utf8-kernel-2.6-fonts-1.patch.bz2
    以下为补丁说明:
     # 作者(author): 孙海勇
     # 发布协议(License): GPL v2
     # 邮件(email): youbest@sina.com
     # 说明:此补丁用于Linux内核,实现直接在framebuffer环境下直接显示UTF-8编码的文字功能。此补丁为字库补丁。

    附加补丁:
    http://zdbr.net.cn/download/utf8 ... ondecor-1.patch.bz2
    以下为补丁说明:
     # 作者(author): 孙海勇
     # 发布协议(License): GPL v2
     # 邮件(email): youbest@sina.com
     # 说明:此补丁用于Linux内核,实现直接在framebuffer环境下直接显示UTF-8编码的文字功能。此补丁为fbcondecor功能修正补丁,需要实现给内核打fbcondecor补丁。

  内核编译需要加入framebuffer支持。
发表于 2009-1-4 23:24:05 | 显示全部楼层
将那两个补丁打上去,然后再重新编译一下,就OK了。

1.将两个补丁解压到/usr/src/linux下
utf8-kernel-2.6.26-core-1.patch
utf8-kernel-2.6-fonts-1.patch

2.然后patch
  1. Gentoo-PJQ linux # patch -p1 <utf8-kernel-2.6.26-core-1.patch
  2. patching file drivers/char/vt.c
  3. Hunk #1 succeeded at 290 (offset 13 lines).
  4. Hunk #2 succeeded at 334 with fuzz 2 (offset 18 lines).
  5. Hunk #3 succeeded at 356 (offset 18 lines).
  6. Hunk #4 succeeded at 527 (offset 18 lines).
  7. Hunk #5 succeeded at 536 (offset 18 lines).
  8. Hunk #6 succeeded at 546 (offset 18 lines).
  9. Hunk #7 succeeded at 689 (offset 18 lines).
  10. Hunk #8 succeeded at 815 (offset 18 lines).
  11. Hunk #9 succeeded at 892 (offset 36 lines).
  12. Hunk #10 succeeded at 2143 (offset 58 lines).
  13. Hunk #11 succeeded at 2155 (offset 58 lines).
  14. Hunk #12 succeeded at 2220 (offset 58 lines).
  15. Hunk #13 succeeded at 2263 (offset 58 lines).
  16. Hunk #14 succeeded at 2289 (offset 58 lines).
  17. Hunk #15 succeeded at 2369 (offset 58 lines).
  18. Hunk #16 succeeded at 3043 (offset 58 lines).
  19. patching file drivers/video/console/bitblit.c
  20. Hunk #1 FAILED at 17.
  21. Hunk #2 succeeded at 134 (offset 30 lines).
  22. Hunk #3 succeeded at 212 (offset 30 lines).
  23. Hunk #4 succeeded at 277 (offset 30 lines).
  24. Hunk #5 succeeded at 293 (offset 30 lines).
  25. Hunk #6 succeeded at 304 (offset 30 lines).
  26. Hunk #7 succeeded at 357 (offset 30 lines).
  27. Hunk #8 succeeded at 417 with fuzz 1 (offset 80 lines).
  28. Hunk #9 succeeded at 506 (offset 80 lines).
  29. Hunk #10 succeeded at 527 (offset 80 lines).
  30. Hunk #11 succeeded at 582 (offset 80 lines).
  31. 1 out of 11 hunks FAILED -- saving rejects to file drivers/video/console/bitblit.c.rej
  32. patching file drivers/video/console/fbcon.c
  33. Hunk #1 succeeded at 996 (offset 3 lines).
  34. Hunk #2 succeeded at 1363 (offset 22 lines).
  35. Hunk #3 succeeded at 1629 (offset 27 lines).
  36. Hunk #4 succeeded at 1692 (offset 27 lines).
  37. Hunk #5 succeeded at 1705 (offset 27 lines).
  38. Hunk #6 succeeded at 1788 (offset 27 lines).
  39. Hunk #7 succeeded at 1811 (offset 27 lines).
  40. Hunk #8 succeeded at 1834 (offset 27 lines).
  41. Hunk #9 succeeded at 1879 (offset 27 lines).
  42. Hunk #10 succeeded at 2864 (offset 113 lines).
  43. Hunk #11 succeeded at 2984 (offset 113 lines).
复制代码
  1. Gentoo-PJQ linux # patch -p1 <utf8-kernel-2.6.26-core-1.patch
  2. patching file drivers/char/vt.c
  3. Hunk #1 succeeded at 290 (offset 13 lines).
  4. Hunk #2 succeeded at 334 with fuzz 2 (offset 18 lines).
  5. Hunk #3 succeeded at 356 (offset 18 lines).
  6. Hunk #4 succeeded at 527 (offset 18 lines).
  7. Hunk #5 succeeded at 536 (offset 18 lines).
  8. Hunk #6 succeeded at 546 (offset 18 lines).
  9. Hunk #7 succeeded at 689 (offset 18 lines).
  10. Hunk #8 succeeded at 815 (offset 18 lines).
  11. Hunk #9 succeeded at 892 (offset 36 lines).
  12. Hunk #10 succeeded at 2143 (offset 58 lines).
  13. Hunk #11 succeeded at 2155 (offset 58 lines).
  14. Hunk #12 succeeded at 2220 (offset 58 lines).
  15. Hunk #13 succeeded at 2263 (offset 58 lines).
  16. Hunk #14 succeeded at 2289 (offset 58 lines).
  17. Hunk #15 succeeded at 2369 (offset 58 lines).
  18. Hunk #16 succeeded at 3043 (offset 58 lines).
  19. patching file drivers/video/console/bitblit.c
  20. Hunk #1 FAILED at 17.
  21. Hunk #2 succeeded at 134 (offset 30 lines).
  22. Hunk #3 succeeded at 212 (offset 30 lines).
  23. Hunk #4 succeeded at 277 (offset 30 lines).
  24. Hunk #5 succeeded at 293 (offset 30 lines).
  25. Hunk #6 succeeded at 304 (offset 30 lines).
  26. Hunk #7 succeeded at 357 (offset 30 lines).
  27. Hunk #8 succeeded at 417 with fuzz 1 (offset 80 lines).
  28. Hunk #9 succeeded at 506 (offset 80 lines).
  29. Hunk #10 succeeded at 527 (offset 80 lines).
  30. Hunk #11 succeeded at 582 (offset 80 lines).
  31. 1 out of 11 hunks FAILED -- saving rejects to file drivers/video/console/bitblit.c.rej
  32. patching file drivers/video/console/fbcon.c
  33. Hunk #1 succeeded at 996 (offset 3 lines).
  34. Hunk #2 succeeded at 1363 (offset 22 lines).
  35. Hunk #3 succeeded at 1629 (offset 27 lines).
  36. Hunk #4 succeeded at 1692 (offset 27 lines).
  37. Hunk #5 succeeded at 1705 (offset 27 lines).
  38. Hunk #6 succeeded at 1788 (offset 27 lines).
  39. Hunk #7 succeeded at 1811 (offset 27 lines).
  40. Hunk #8 succeeded at 1834 (offset 27 lines).
  41. Hunk #9 succeeded at 1879 (offset 27 lines).
  42. Hunk #10 succeeded at 2864 (offset 113 lines).
  43. Hunk #11 succeeded at 2984 (offset 113 lines).
复制代码

其中第一个补丁,有点问题,需要手动patch
drivers/video/console/bitblit.c

1>. cd drivers/video/console/
2>.grep "^+" bitblit.c.rej|sed 's/^+//g'
将这些内容添加到bitblit.c 中的#include下面。
  1. Gentoo-PJQ console # grep "^+" bitblit.c.rej|sed 's/^+//g'
  2. #include <linux/font.h>
  3. #include "fonts_utf8.h"
  4. static int fbcon_softback_size = 32768;
  5. const unsigned short * hibyte_pos(struct vc_data *vc, const unsigned short *p)
  6. {
  7.         unsigned long pos = (long)p;
  8.         if (pos >= vc->vc_origin && pos < vc->vc_scr_end) {
  9.                 /* pos in the vc buffer - Chrisl 99.11.12*/
  10.                 return (unsigned short*)(pos + vc->vc_screenbuf_size);
  11.         } else if (vc->vc_num == fg_console){
  12.                 /*&& softback_lines,because the scroll will first change
  13.                 softback_lines, then call this function, so it is ignored here
  14.                                                             -JimChen 99.11.12*/
  15.                 return (unsigned short *) (pos + fbcon_softback_size);
  16.         } else {
  17.                 /* Should not happen */
  18.                     printk("Warnning, changing not active console\n");
  19.                 return p;
  20.         }
  21. }
复制代码

3.然后再make,启用新内核。
回复 支持 反对

使用道具 举报

发表于 2009-1-4 23:31:45 | 显示全部楼层
仅在2.6.27-gentoo-r7操作过,没在28上进行过。但过程应该都差不多。
  1. Gentoo-PJQ linux # uname -a
  2. Linux Gentoo-PJQ 2.6.27-gentoo-r7 #2 Sat Dec 27 22:07:02 CST 2008 i686 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-1-4 23:41:29 | 显示全部楼层
Post by pjq;1934133
仅在2.6.27-gentoo-r7操作过,没在28上进行过。但过程应该都差不多。

  1. Gentoo-PJQ linux # uname -a
  2. Linux Gentoo-PJQ 2.6.27-gentoo-r7 #2 Sat Dec 27 22:07:02 CST 2008 i686 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
复制代码


也就是说那个r7之类的没关系是不是?补丁打上不会出错吧。。
回复 支持 反对

使用道具 举报

发表于 2009-1-5 12:45:28 | 显示全部楼层
Post by o_xyz;1934137
也就是说那个r7之类的没关系是不是?补丁打上不会出错吧。。

是的,我这里没问题,你仔细看看他上面的说明.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表