Busybox1.21.1 挂载U盘显示文件名是中文乱码
Busybox高版本默认取消了对中文的支持
到官网上下载busybox1.21.1
步骤1:添加编译器和勾选上Build shared build
make menuconfig ARCH=arm
步骤2:取消Support Unicode
步骤3:退出保存生成.config
步骤4:修改libbb/printable_string.c
先找到这样一段:
if (c < ' ')
break;
if (c >= 0x7f)
break;
s++;
注释掉某两行(34,35行):
/* if (c >= 0x7f) */
/* break; */
然后找这样一段(48行):
unsigned char c = *d;
if (c == '\0')break;
if (c < ' ' || c >= 0x7f)
*d = '?';
d++;
把 if (c < ' ' || c >= 0x7f) 改成 if (c < ' ')
步骤5:make;make install
步骤6:在_install目录下,将bin、sbin、usr拷贝到rootfs中覆盖
步骤7:拷贝编译器中的库到rootfs/lib
步骤8:内核配置
设置 FAT 的默认 codepage 为 936,默认iocharset 为utf8
---- DOS/FAT/NT Filesystems ----
<*> VFAT (Windows-95) fs support
(936) Default codepage for FAT
(utf8) Default iocharset for FAT
(cp936) Default NLS Option
<*> Codepage 437 (United States, Canada)
<*> Simplified Chinese charset (CP936, GB2312)
<*> ASCII (United States)
设置默认语言支持为 cp936(即中文),添加支持的字符集,GB2312,UTF-8
步骤9:挂载U盘
mount -t vfat -o iocharset=cp936 /dev/sda1 /tmp/
参考:
http://blog.chinaunix.net/uid-20648944-id-2937499.html
https://www.cnblogs.com/masky/archive/2013/01/27/2878996.html