1.添加字体
下面以文泉驿为例
$ mkdir -p rootfs/usr/share/fonts/wqy //在busybox 文件系统里创建目录存放wqy 字体
$ cp /usr/share/fonts/misc/wenquanyi* rootfs/usr/share/fonts/wqy
//复制pc机系统里的字体到busybox 文件系统
$ cp /etc/fonts/font.conf rootfs/etc/fonts
$ cp /etc/fonts/font.dtd rootfs/etc/fonts
$ vim rootfs/etc/fonts/font.conf
/usr/share/fonts/zh_CN
usr/share/fonts/wqy // 此处添加寻找字体的路径
复制 mkfontscale mkfontdir fc-cache fc-list 命令及相应的库到 busybox 文件系统,以下的操作在运行busybox文件系统的板子上执行
$ cd /usr/share/fonts/wqy
$ mkfontscale // 生成 fonts.alias 文件
$ mkfontdir //生成 fonts.dir 文件
$ fc-cache -vf
//更新字体缓冲 会在 /var/cache/fontconfig(由/etc/fonts/font.conf 指定生成缓存文件的存储路径) 下生成新字体缓冲文件
$ fc-list 查看当前系统里拥有的字体
2.添加字符集
在linux 系统中安装 glibc 时便会安装 locale,localedef 命令,想要添加字体集得安装 locales 软件包
$ cp /usr/bin/locale rootfs/usr/bin
$ cp /usr/sbin/localedef rootfs/usr/bin
$ cp /usr/sbin/locale-gen rootfs/usr/sbin
$ cp /etc/locale.alias rootfs/etc/
$ cp /etc/locale.gen rootfs/etc
$ vi rootfs/etc/locale.gen
找到你想要添加的字符集,去除前面的 "#"
以下的操作在运行busybox文件系统的板子上执行
$ locale-gen //产生字符集 这里以 zh_CN.GBK 为例
zh_CN.GBK character map file `zh_CN.GBK' not found: No such file or directory
复制 /usr/share/i18n/charmaps/GBK.gz 到文件系统对应的目录
zh_CN.GBK cannot open locale definition file 'zh_CN' no such file or directory
原来是/usr/share/i18n/locales/文件夹下的zh_*都没有了,复制过来,再更新OK
zh_CN.GBK cannot open locale definition file 'i18n' no such file or directory
zh_CN.GBK cannot open locale definition file 'iso14651_t1_pinyin' no such file or directory
zh_CN.GBK cannot open locale definition file 'iso14651_t1_common' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_neutral' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_combining' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_circle' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_cjk_compat' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_compat' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_font' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_fraction' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_narrow' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_small' no such file or directory
zh_CN.GBK cannot open locale definition file 'translit_wide' no such file or directory
到/usr/share/i18n/locales/i18n 目录下复制对的文件 到文件系统对应的目录
zh_CN.GBK cannot create temporary file : No such file or directory
$ mkdir -p /usr/lib/locale/ //locale-gen 执行成功之后会在此目录生成locale-archive 文件
$ locale //查看当前所设置的字符集
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
出现在上面的提示,是因为在执行locale命令时,会根据所设置的$LANG, $LC_ALL环境变量去/usr/share/locale 目录下面找对应的语言包目录,这里由于没有 zh_CN.UTF-8 目录(没有安装zh_CN.UTF-8语言包),所以会有以上提示,复制主机文件系统里 /usr/share/locale/zh_CN.UTF-8 到busybox 文件系统对应的目录就好了
$ locale -a //显示当前的所有字符集
C
POSIX
zh_CN.gbk //这是后添加的,busybox 默认只有支持 C,POSIX 字符集
zh_CN.utf8
阅读(4919) | 评论(1) | 转发(0) |