嵌入式爱好者

嵌入式爱好者 门户 知识库 查看内容

G2L命令行显示中文(Linux4.19.165)

2023-7-31 13:32| 发布者: xing星| 查看: 152| 评论: 0

类目:  >  知识库     文档编号: 1073

修改内核配置

路径OKG2L-linux-sdk10里面加载环境变量. environment-setup-aarch64-smarc-rzg2l-toolchain

进入OKG2L-linux-kernel中执行make menuconfig ARCH=arm64

做以下修改

  • File systems---> DOS/FAT/NT Filesystems --->Default codepage for FAT

    改为 936

  • File systems---> DOS/FAT/NT Filesystems ---> Default iocharset for FAT

    改为 utf8

  • File systems--->Native language support --->Simplified Chinese charset (CP936, GB2312)

    选为星号

  • File systems--->Native language support --->NLS UTF-8

    选为星号

  • File systems--->Native language support --->Default NLS Option

    改为utf8

重新编译内核

编译出来的内核镜像在OKG2L-linux-sdk10/images/kernel/Image

参照使用手册重新烧写内核镜像到开发板,或者直接将Image替换到开发板的/boot文件夹中

busybox配置

busybox位置:OKG2L-linux-sdk/tools/third**/busybox-1.34.1.tar.bz2

sdk中解压这个,进去执行make menuconfig

  • Settings---> Don't use /usr

    选择为星号

  • Settings---> Cross compiler prefix

    填入aarch64-poky-linux-

  • Settings---> Path to sysroot

    填入/opt/poky/3.1.5/sysroots/aarch64-poky-linux/

  • Settings--->Enable locale support (system needs locale for this to work)

    选择为星号

  • Settings--->Support Unicode

    选择为星号

  • Settings--->Character code to substitute unprintable characters with

    修改为65533

  • Settings--->Range of supported Unicode characters

    修改为195102

修改./libbb/printable_string.c注释掉0x7f

                if (c < ' ')
                       break;
//             if (c >= 0x7f)
//                     break;
               s++;
      }

#if ENABLE_UNICODE_SUPPORT
       dst = unicode_conv_to_printable(stats, str);
#else
      {
               char *d = dst = xstrdup(str);
               while (1) {
                       unsigned char c = *d;
                       if (c == '\0')
                               break;
                       if (c < ' ' /*|| c >= 0x7f*/)
                               *d = '?';
                       d++;

修改./libbb/unicode.c注释掉0x7f

static char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char *src, unsigned width, int flags)
{
       char *dst;
       unsigned dst_len;
       unsigned uni_count;
       unsigned uni_width;

       if (unicode_status != UNICODE_ON) {
               char *d;
               if (flags & UNI_FLAG_PAD) {
                       d = dst = xmalloc(width + 1);
                       while ((int)--width >= 0) {
                               unsigned char c = *src;
                               if (c == '\0') {
                                       do
                                               *d++ = ' ';
                                       while ((int)--width >= 0);
                                       break;
                              }
                               *d++ = (c >= ' '/* && c < 0x7f*/) ? c : '?';
                               src++;
                      }
                       *d = '\0';
              } else {
                       d = dst = xstrndup(src, width);
                       while (*d) {
                               unsigned char c = *d;
                               if (c < ' '/* || c >= 0x7f*/)
                                       *d = '?';
                               d++;
                      }
              }

参照编译手册配置交叉工具编译链environment-setup-aarch64-poky-linux

执行

make –j8
make install

./_install/bin/busybox复制出来,后面替换到开发板的/usr/bin下面

执行ln -sf /usr/bin/busybox /usr/bin/ls

sync之后,reboot重新启动,ls就可以正常显示中文了

测试情况中文.txt

root@okg2l:/run/media/sda1/test/chinese test/Chinese_test# ls
显示中文     显示中文.txt


已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2025-6-9 08:39

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部