存档

2010年9月18日 的存档

让FreeBSD 在zh_CN.UTF-8语言环境下显示U盘中文

2010年9月18日 16hot 没有评论

是在freebsdchina.org 上看到的帖子,感谢pax的贡献。之前不怎么使用U盘,没有尝试。现在在用HD2手机,SD卡是fat32位的文件系统,用安装了freebsd的笔记本连接时,中文总是不能正常显示。于是找到pax的帖子,给系统源码打补丁,重新编译msdosfs模块。

原文地址:

http://www.freebsdchina.org/forum/viewtopic.php?t=44213&postdays=0&postorder=asc&start=20

http://www.freebsdchina.org/forum/viewtopic.php?t=44223&postdays=0&postorder=asc&start=0

为了方便,我将下载回来的补丁文件上传到博客,下载地址:

msdosfs.patch

我用的是FreeBSD 8.1-stable,使用方法:

1、打补丁

# cd /usr/src/sys/fs/msdosfs/
# patch -p1 < /opt/distfiles/msdosfs.patch.txt

2、编译模块

# cd /usr/src/sys/modules/msdosfs
# make clean && make

3、安装和加载模块

# make install
# kldload msdosfs

4、挂载U盘

# mount_msdosfs -L zh_CN.UTF-8 /dev/da0s1 /opt/media

5、卸载U盘

# umount /opt/media

注意事项:

1、如果msdosfs模块已经编译在内核里,则需要在打补丁后,重新编译内核;
2、如果更新源码后,需要重新打补丁;
3、确认locale环境是zh_CN.UTF-8

LANG=zh_CN.UTF-8
LC_CTYPE=”zh_CN.UTF-8″
LC_COLLATE=”zh_CN.UTF-8″
LC_TIME=”zh_CN.UTF-8″
LC_NUMERIC=”zh_CN.UTF-8″
LC_MONETARY=”zh_CN.UTF-8″
LC_MESSAGES=”zh_CN.UTF-8″
LC_ALL=

分类: BSD/linux 标签: ,