SSD202环境安装及linux问题解决和总结记录

SSD202环境安装及linux问题解决和总结记录

一、vim编辑器

启动Vim编辑器时,您处于正常模式。在这种模式下,您可以使用vim命令并浏览文件。
要输入文字,您需要按i键进入insert插入模式。使用此模式,您可以像在常规文本编辑器中一样插入和删除字符。
要从其他任何模式返回正常模式,请按Esc键

  • VIM编辑文件权限问题:E45: 'readonly' option is set (add ! to override)

    • 解决方案:q! 强制关闭文件后,在命令行里输入:sudo !! 后回车再次vim打开文件编辑就正常了
  • VIM常用指令

    • 保存文件并退出Vim/Vi:
      • :wq
    • 退出Vim/Vi而不保存文件
      • :q!
  • 查找模式

    • 在normal模式下按下/即可进入查找模式,输入要查找的字符串并按下回车。 Vim会跳转到第一个匹配。按下n查找下一个,按下N查找上一个。
  • VIM全选

    • 全选(高亮显示)
      • 按esc后,然后ggvG或者ggVG
    • 全部复制
      • 按esc后,然后ggyG
    • 全部删除
      • 按esc后,然后dG
      gg:是让光标移到首行,在vim才有效,vi中无效   
      v : 是进入Visual(可视)模式   
      G :光标移到最后一行   
      选中内容以后就可以其他的操作了,比如:   
      d  删除选中内容   
      y  复制选中内容到0号寄存器   
      "+y  复制选中内容到+寄存器,也就是系统的剪贴板,供其他程序用 
    

二、ubuntu换源

新安装了Ubuntu默认的apt源是国外的源。国内访问速度会很慢。所以更改国内源是非常有必要的。
参考链接

  • 备份源列表文件
    cd /etc/apt/
    sudo cp sources.list sources.list.bak
    
  • 修改源列表文件
      sudo vim sources.list
    
  • 将里面的内容全部删除,然后替换为阿里云源
    • 阿里云源 ubuntu20.4
      deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
      
      deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
      
      deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
      
      deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
      
      deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
      
      deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
      
      deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
      
      deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
      
      deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
      
      deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
      
    • 清华源 ubuntu20.04
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
      
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
      
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
      
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
      
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
      
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
      
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
      
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
      
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse
      
      deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse
      
  • 修改完软件源后,更新软件列表和软件:
    sudo apt-get update
    sudo apt-get upgrade
    

三、SSD202编译工具安装

推荐使用VMware虚拟机安装ubuntu开发,绝不推荐使用wsl开发因为有坑。ubuntu可使用官方推荐的16.04版本,但是我使用ubuntu 20.04也可以,下列教程针对ubuntu 20.04。因为不同版本还真有点不一样。

  • 针对 SDK 编译需要安装一些 tool,否则会编译失败,安装源要是国内阿里或者清华ubuntu 20.04配合电脑系统版本一致

    # sudo apt-get install libc6-dev-i386
    # sudo apt-get install lib32z1 lib32ncurses5-dev
    # sudo apt-get install libuuid1:i386
    	出错误E: Unable to locate package libuuid1:i386
    	执行以下命令:
    	1.dpkg --add-architecture i386
    	2.apt-get update
    	3.sudo apt-get install libuuid1:i386
    # sudo apt-get install cmake
    # sudo apt-get install libncurses5-dev libncursesw5-dev
    # sudo apt install bc
    # sudo apt-get install xz-utils
    # sudo apt-get install automake
    # sudo apt-get install libtool
    # sudo apt-get install libevdev-dev
    # sudo apt-get install pkg-config
    
  • 如果默认 sh 不是 bash,需要将 sh 改成 bash:(必须切换为bash)
    sudo rm /bin/sh
    sudo ln –s /bin/bash /bin/sh
    设置了后需要重启当前终端生效

  • 安装toolchain

    • gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf.tar.gz文件复制到虚拟机/opt/文件夹
    • 解压压缩包
      • 解压指令tar -zxvf 压缩文件名.tar.gztar -zxvf gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf.tar.gz
      • 解压多个相同后缀文件指令
        for tar in *.tar.gz; do tar xvf $tar; done
      • 解压多个相同后缀文件到指定文件夹指令
        for tar in *.tar.gz; do tar xvf $tar -C /home/; done
    • 将 toolchain 设置到环境变量中去 交叉编译工具下载使用传输口令:je6lak提取
      • 在/etc/profile 添加:export PATH=/opt/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin:$PATH
      • 完成后重新开一个终端时生效
  • 安装samba服务器

    • 安装教程参考链接

    • smb.conf内配置文件在文件末尾追加

      [work]
      	comment = samba home directory 
      	path = /home/beal.wu
      	public = yes
      	browseable = yes
      	public = yes
      	read only = no
      	valid users = user lengzg beal.wu
      	write list = lengzg beal.wu
      	create mask = 0777
      	directory mask = 0777 
      	force user = nobody
      	force group = nogroup
      	available = yes
      	writable = yes
      

四、编译流程

要把包放在ubuntu系统里面。解压TAKOYAKI_DLC00V030版本的SDK包里面的boot、kernel、project、sdk压缩包后分别得到对应的包文件

1、编译boot流程

终端进入到boot文件夹目录下执行以下命令

  1. 设置环境变量
    declare -x ARCH="arm"
  2. 设置编译环境变量
    declare -x CROSS_COMPILE="arm-linux-gnueabihf-"
  3. 选择对应的板载flash类型执行配置指令
    • SPInor Flash类型
      make infinity2m_defconfig //spinor,根据板载flash类型执行对应指令
    • SPInand Flash类型
      make infinity2m_spinand_defconfig //Spinand,根据板载flash类型执行对应指令
  4. 打开menuconfig,可视化配置,如果没有要求配置的。跳过该指令即可
    make menuconfig //modify && save
  5. 清除编译内容
    make clean
  6. 开始编译
    make

2、编译kernel流程

终端进入到kernel文件夹目录下执行以下命令

  1. 设置环境变量(如果和boot在同个终端执行则不需要再执行)
    declare -x ARCH="arm"
  2. 设置编译环境变量(如果和boot在同个终端执行则不需要再执行)
    declare -x CROSS_COMPILE="arm-linux-gnueabihf-"
  3. 选择对应的板载flash类型执行配置指令
    • SPInor Flash类型
      make infinity2m_ssc011a_s01a_minigui_defconfig //SSD20x spinor
    • SPInand Flash类型
      make infinity2m_spinand_ssc011a_s01a_minigui_defconfig //SSD20x Spinand
  4. 打开menuconfig,可视化配置,如果没有要求配置的。跳过该指令即可
    make menuconfig //modify && save
  5. 清除编译内容
    make clean
  6. 开始编译
    make

3、编译SDK流程

终端进入到project文件夹目录下执行以下命令

  1. 选择对应的板载flash类型执行配置指令
    • SPInor Flash类型
      ./setup_config.sh ./configs/nvr/i2m/8.2.1/nor.glibc-squashfs.011a.64 //SSD20x Spinor
    • SPInand Flash类型
      ./setup_config.sh ./configs/nvr/i2m/8.2.1/spinand.glibc.011a.64 //SSD20x Spinand
  2. 清除编译内容
    make clean
  3. 开始编译
    make image

4、获得编译好的images更新包

编译完以上文件后,在project/image/output/images文件夹下面都是我们更新给开发板需要的文件。将整images文件夹内的内容通过tftpd工具更新入SSD202开发板即可。

注意: 如果要更新 uboot、kernel,需要先编译 project,然后将 uboot 和 kernel 的 bin 拷贝至
/yourpath/xxx/image/output/image 中,kernel 是 uImage.xz -> kernel。或者在编译SDK时执行make image脚本在编译后会将boot和kernel编译好的固件自动复制到对应位置

虚拟机问题

  • 网络连接不上
    设置桥接模式,自动,虚拟机里看到已连接但是依旧没网。
    • 关掉虚拟机正在运行的系统,进入编辑->虚拟网络编辑器->启动设置->将桥接自动选择为本地window的网卡。详情参考连接
    • 上述步骤还不行的话。使用以下方法。详情参考连接
      1. ifconfig指令查询ip时打印如下结果
        xxx@ubuntu:~$ ifconfig
        lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        		inet 127.0.0.1  netmask 255.0.0.0
        		inet6 ::1  prefixlen 128  scopeid 0x10<host>
        		loop  txqueuelen 1000  (本地环回)
        		RX packets 4749  bytes 287841 (287.8 KB)
        		RX errors 0  dropped 0  overruns 0  frame 0
        		TX packets 4749  bytes 287841 (287.8 KB)
        		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        
      2. sudo -i切换为root用户
      3. 输入dhclient -v,这时候在查ifconfig发现能出现了ip地址。也能重新上玩了
      4. 输出结果如下(实际结果因个人电脑而异)
        ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        		inet 192.168.1.75  netmask 255.255.255.0  broadcast 192.168.1.255
        		inet6 fe23::20c:26ff:fe15:12b8  prefixlen 64  scopeid 0x20<link>
        		ether 00:0c:29:1f:12:b8  txqueuelen 1000  (以太网)
        		RX packets 267  bytes 17570 (17.5 KB)
        		RX errors 0  dropped 0  overruns 0  frame 0
        		TX packets 59  bytes 9188 (9.1 KB)
        		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        
        lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        		inet 127.0.0.1  netmask 255.0.0.0
        		inet6 ::1  prefixlen 128  scopeid 0x10<host>
        		loop  txqueuelen 1000  (本地环回)
        		RX packets 383  bytes 29360 (29.3 KB)
        		RX errors 0  dropped 0  overruns 0  frame 0
        		TX packets 383  bytes 29360 (29.3 KB)
        		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        
        
posted @ 2021-11-12 18:57  长不胖的小鱼  阅读(1049)  评论(0编辑  收藏  举报