1. 程式人生 > >Busybox1.21.1 掛載U盤顯示檔名是中文亂碼

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

 

 

--- Base native language support ---                                                                         

 

  (cp936) Default NLS Option

<*>   Codepage 437 (United States, Canada) 

<*>   Simplified Chinese charset (CP936, GB2312)  

<*>   ASCII (United States) 

 

<*>   NLS UTF-8 
 

 

設定預設語言支援為 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