- step by step to build embedded Linux development environment - based on ubuntu-16.04 64 Wei

 

Environment to build

1. Change the ubuntu source

Reference Site

Change the file sources.list

cd /etc/apt
sudo cp sources.list sources.list.bak
sudo vim sources.list

To the following code:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

Update Source

sudo apt-get update
sudo apt-get upgrade

Note: Frequently used commands

sudo apt-get update  更新源
sudo apt-get install package 安装包
sudo apt-get remove package 删除包 sudo apt-cache search package 搜索软件包 sudo apt-cache show package 获取包的相关信息,如说明、大小、版本等 sudo apt-get install package --reinstall 重新安装包 sudo apt-get -f install 修复安装 sudo apt-get remove package --purge 删除包,包括配置文件等 sudo apt-get build-dep package 安装相关的编译环境 sudo apt-get upgrade 更新已安装的包 sudo apt-get dist-upgrade 升级系统 sudo apt-cache depends package 了解使用该包依赖那些包 sudo apt-cache rdepends package 查看该包被哪些包依赖 sudo apt-get source package 下载该包的源代码 sudo apt-get clean && sudo apt-get autoclean 清理无用的包 sudo apt-get check 检查是否有损坏的依赖 sudo apt autoremove 自动删除无用的包 

2. VIM installation

Installation VIM

sudo apt-get install vim

Installation curl

sudo apt install curl

Install vim-plug

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 

Remark

:PlugStatus   # 查看安装状态
:PlugInstall  # 安装插件 

Configure vim, created and compiled ~ / .vimrc


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""特设的配置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" 定义快捷键的前缀,即 <Leader>
let mapleader=";"

" >>
" " 文件类型侦测
"
" " 开启文件类型侦测
filetype on
" " 根据侦测到的不同类型加载对应的插件 filetype plugin on " " " << " >> " " vim 自身(非插件)快捷键 " " " 定义快捷键到行首和行尾 nmap LB 0 nmap LE $ " " " 设置快捷键将选中文本块复制至系统剪贴板 vmap <Leader>y "+y " " 设置快捷键将系统剪贴板内容粘贴至vim nmap <Leader>p "+p " " " 定义快捷键关闭当前分割窗口 nmap <Leader>q :q<CR> " " 定义快捷键保存当前窗口内容 nmap <Leader>w :w<CR> " " 定义快捷键保存所有窗口内容并退出 vim nmap <Leader>wq :wq<CR> " 禁用 Ex 模式 map Q <Nop> " " " 设置快捷键遍历子窗口 " " 依次遍历 nnoremap nw <C-W><C-W> " " 跳转至右方的窗口 nnoremap <Leader>l <C-W>l " " 跳转至方的窗口 nnoremap <Leader>h <C-W>h " " 跳转至上方的子窗口 nnoremap <Leader>k <C-W>k " " 跳转至下方的子窗口 nnoremap <Leader>j <C-W>j " " " 定义快捷键在结对符之间跳转 nmap <Leader>m % " 重新映射<ESC> inoremap <Leader>v <ESC> " " 重新定义ESC imap <Leader>fj <ESC> " " << " 方向键重映射 inoremap <C-h> <Left> inoremap <C-j> <Down> inoremap <C-k> <Up> inoremap <C-l> <Right> inoremap <Leader>i <Left> inoremap <Leader>a <ESC>o " 让配置变更立即生效 "autocmd BufWritePost ~/.vimrc source ~/.vimrc """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" ""插件管理 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" call plug#begin('~/.vim/plugged') Plug 'scrooloose/nerdtree' Plug 'altercation/vim-colors-solarized' Plug 'tomasr/molokai' Plug 'vim-airline/vim-airline' Plug 'scrooloose/nerdcommenter' Plug 'luochen1990/rainbow' Plug 'SirVer/ultisnips' Plug 'junegunn/vim-easy-align' Plug 'nathanaelkane/vim-indent-guides' Plug 'derekwyatt/vim-fswitch' " .c和.h的切换 Plug 'majutsushi/tagbar' Plug 'Valloric/YouCompleteMe' Plug 'dyng/ctrlsf.vim' Plug 'honza/vim-snippets' Plug 'fholgado/minibufexpl.vim' Plug 'rdnetto/YCM-Generator' call plug#end() " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 配色方案 " syntax enable colorscheme solarized "colorscheme molokai " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 工程文件浏览 " " " 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list nmap <Leader>fl :NERDTreeToggle<CR> ""修改树的显示图标 let g:NERDTreeDirArrowExpandable = '+' let g:NERDTreeDirArrowCollapsible = '-' " " 设置 NERDTree 子窗口宽度 let NERDTreeWinSize=22 " " 设置 NERDTree 子窗口位置 let NERDTreeWinPos="right" " " 显示隐藏文件 let NERDTreeShowHidden=1 " " NERDTree 子窗口中不显示冗余帮助信息 let NERDTreeMinimalUI=1 " " 删除文件时自动删除文件对应 buffer let NERDTreeAutoDeleteBuffer=1 ""当NERDTree为剩下的唯一窗口时自动关闭 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 批量注释和反注释 nerdcommenter " " <leader>cc : 注释 " <leader>cu : 反注释 " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 彩虹括号 " let g:rainbow_active = 1 " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "" " 代码补全 snippets "" let g:UltiSnipsSnippetDirectories=["mysnippets"] let g:UltiSnipsExpandTrigger="<leader><tab>" let g:UltiSnipsJumpForwardTrigger="<leader><tab>" let g:UltiSnipsJumpBackwardTrigger="<leader><s-tab>" "" "" " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 缩进标线 " let g:indent_guides_enable_on_vim_startup = 0 let g:indent_guides_auto_colors = 0 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3 autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4 let g:indent_guides_guide_size = 1 "对齐宽度 let g:indent_guides_start_level = 1 " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 快速对齐 " " ,a= 对齐等号表达 " ,a: 对齐冒号表达式(json/map等) " # 默认左对齐 " ,a<space> 首个空格对齐 " ,a2<space> 第二个空格对齐 " ,a-<space> 倒数第一个空格对齐 " ,a-2<space> 倒数第二个空格对齐 " ,a*<space> 所有空格依次对齐 " # 右对齐 " ,a<Enter>*<space> " vmap <Leader>a <Plug>(EasyAlign) nmap <Leader>a <Plug>(EasyAlign) if !exists('g:easy_align_delimiters') let g:easy_align_delimiters = {} endif let g:easy_align_delimiters['#'] = { 'pattern': '#', 'ignore_groups': ['String'] } " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 缩进标线 " *.cpp 和 *.h 间切换 nmap <silent> <Leader>sw :FSHere<cr> " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 使用 ctrlsf.vim 插件在工程内全局查找光标所在关键字,设置快捷键。 " 快捷键速记法:search in project " nnoremap <Leader>sp :CtrlSF<CR> " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " taglist 列出tag " " 设置 tagbar 子窗口的位置出现在主编辑区的左边 let tagbar_left=1 " 设置显示/隐藏标签列表子窗口的快捷键。速记:identifier list by tag nnoremap <Leader>ilt :TagbarToggle<CR> " 设置标签子窗口的宽度 let tagbar_width=32 " tagbar 子窗口中不显示冗余帮助信息 let g:tagbar_compact=1 " 设置 ctags 对哪些代码标识符生成标签 let g:tagbar_type_cpp = { \ 'kinds' : [ \ 'c:classes:0:1', \ 'd:macros:0:1', \ 'e:enumerators:0:0', \ 'f:functions:0:1', \ 'g:enumeration:0:1', \ 'l:local:0:1', \ 'm:members:0:1', \ 'n:namespaces:0:1', \ 'p:functions_prototypes:0:1', \ 's:structs:0:1', \ 't:typedefs:0:1', \ 'u:unions:0:1', \ 'v:global:0:1', \ 'x:external:0:1' \ ], \ 'sro' : '::', \ 'kind2scope' : { \ 'g' : 'enum', \ 'n' : 'namespace', \ 'c' : 'class', \ 's' : 'struct', \ 'u' : 'union' \ }, \ 'scope2kind' : { \ 'enum' : 'g', \ 'namespace' : 'n', \ 'class' : 'c', \ 'struct' : 's', \ 'union' : 'u' \ } \ } " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " tags设置 Ctrl + ]:跳转定义 Ctrl + o:返回定义 " " 根据自己的工程设置 set tags+=/home/zwx/Templates/tags " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 基于语义的声明/定义跳转 YCM " " 使用 :YcmGenerateConfig 生成配置文件 " 跳转到定义处 nnoremap <leader>jc :YcmCompleter GoToDefinitionElseDeclaration<CR> " 只能是 #include 或已打开的文件 nnoremap <leader>jd :YcmCompleter GoToDefinition<CR> " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示 let g:ycm_confirm_extra_conf=0 " 补全功能在注释中同样有效 let g:ycm_complete_in_comments=1 " 开启 YCM 标签补全引擎 let g:ycm_collect_identifiers_from_tags_files=0 " 补全内容不以分割子窗口形式出现,只显示补全列表 set completeopt-=preview " 从第三个键入字符就开始罗列匹配项 let g:ycm_min_num_of_chars_for_completion=3 " 禁止缓存匹配项,每次都重新生成匹配项 let g:ycm_cache_omnifunc=0 " 语法关键字补全 let g:ycm_seed_identifiers_with_syntax=1 " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " " 多文档编辑 " " 显示/隐藏 MiniBufExplorer 窗口 map <Leader>bl :MBEToggle<cr> " " buffer 切换快捷键 map <leader>ff :MBEbn<cr> map <leader>bb :MBEbp<cr> " " " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" ""实用设置 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " 设置当文件被改动时自动载入 set autoread " quickfix模式 autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr> "代码补全 set completeopt=preview,menu "允许插件 filetype plugin on "共享剪贴板 set clipboard=unnamed "从不备份 set nobackup "make 运行 :set makeprg=g++\ -Wall\ \ % "自动保存 "set autowrite set ruler " 打开状态栏标尺 set cursorline " 突出显示当前行 set cursorcolumn " 突出显示当前列 set magic " 设置魔术 set guioptions-=T " 隐藏工具栏 set guioptions-=m " 隐藏菜单栏 " 不要使用vi的键盘模式,而是vim自己的 set nocompatible " 开启语法高亮 syntax enable " 语法高亮,允许使用其他的高亮配色方案 set syntax=on " 去掉输入错误的提示声音 set noeb " 在处理未保存或只读文件的时候,弹出确认 set confirm " 自动缩进 set autoindent set cindent " Tab键的宽度 set tabstop=4 " 统一缩进为4 set softtabstop=4 set shiftwidth=4 " 用空格代替制表符 set expandtab " 在行和段开始处使用制表符 set smarttab " 显示行号 set number " 历史记录数 set history=1000 "禁止生成临时文件 set nobackup set noswapfile "搜索忽略大小写 set ignorecase "搜索逐字符高亮 set hlsearch set incsearch "行内替换 set gdefault "编码设置 set enc=utf-8 set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 "语言设置 set langmenu=zh_CN.UTF-8 set helplang=cn " 总是显示状态行 set laststatus=2 " 显示命令 set showcmd " 命令行(在状态行下)的高度,默认为1,这里是2 set cmdheight=2 " 侦测文件类型 filetype on " 载入文件类型插件 filetype plugin on " 为特定文件类型载入相关缩进文件 filetype indent on " 保存全局变量 set viminfo+=! " 带有如下符号的单词不要被换行分割 set iskeyword+=_,$,@,%,#,- " 字符间插入的像素行数目 set linespace=0 " 增强模式中的命令行自动完成操作 set wildmenu " 使回格键(backspace)正常处理indent, eol, start等 set backspace=2 " 允许backspace和光标键跨越行边界 set nowrap " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位) set mouse=v "set selection=exclusive "set selectmode=mouse,key " 通过使用: commands命令,告诉我们文件的哪一行被改变过 set report=0 " 在被分割的窗口间显示空白,便于阅读 set fillchars=vert:\ ,stl:\ ,stlnc:\ " 高亮显示匹配的括号 "set showmatch " 匹配括号高亮的时间(单位是十分之一秒) "set matchtime=1 "hi MatchParen ctermbg=red guibg=lightblue " 关闭括号自动匹配 let loaded_matchparen = 1 " 光标移动到buffer的顶部和底部时保持3行距离 set scrolloff=3 " 为C程序提供自动缩进 set smartindent " 高亮显示普通txt文件(需要txt.vim脚本) au BufRead,BufNewFile * setfiletype txt " 禁止光标闪烁 set guicursor=a:block-blinkon0 " 基于缩进或语法进行的代码折叠 "set foldmethod=indent set foldmethod=syntax "" 启动 vim 时关闭折叠代码 set nofoldenable " za,打开或关闭当前折叠;zM,关闭所有折叠;zR,打开所有折叠 

YouCompleteMe installation

  • Install python
sudo apt-get install python
  • Installation depends software and libraries
sudo apt-get install build-essential cmake python-dev python3-dev
  • Installation clang
sudo apt-get install clang
  • After completion YouComplete vim-plug mounting is performed in the directory ~ / .vim / plugged / YouCompleteMe:
./install.py --clang-completer
sudo ./install.sh
  • So far, YouComPleteMe plug-in installation is complete.

vim and color mounting terminal ubuntu

  • Create a directory
mkdir ~/.dircolors
mkdir -p ~/download/scheme
  • Download Color
git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git
git clone https://github.com/seebi/dircolors-solarized.git
  • Configuration
cd ~/download/scheme/gnome-terminal-colors-solarized/
./set_dark.sh

Select 1, YES, 2

Added in ~ / .bashrc

eval `dircolors ~/.dircolors/dircolors.256dark`

You can restart the terminal.

Set the cursor does not blink

ubuntu under System Settings -> Keyboard remove Cursor blinks in text fields

Set vim enable the system clipboard

You need to install the following plug-ins

sudo apt-get install vim-gnome

Such vim command line: reg, will find two special registers: "* and" +

Chinese install Google Pinyin Input Method

Chinese Language Pack Installation

sudo apt-get install language-pack-zh-hans

Installing Google Pinyin

sudo apt-get install fcitx-googlepinyin

Open SystemSettings -> Language Support, the system will search language pack, according to the system prompts to install the language packs keyboard input method system "as: fcitx

Restart the computer

Open a terminal, execute open a terminal and execute "fcitx-configtool" command, increase chiese Google Pinyin

3 解决smbus host controller not enabled

Modify the text:

sudo gedit /etc/modprobe.d/blacklist.conf

Add the following:

blacklist i2c_piix4

Regenerate boot file:

sudo update-initramfs -u -k all

Restart the computer, click configureFcitx join google pinyin

4 install the necessary software linux

sudo apt-get install build-essential git-core libncurses5-dev flex bison texinfo zip unzip zlib1g-dev gettext u-boot-tools g++ xz-utils mtd-utils gawk diffstat gcc-multilib python git make gcc g++ diffstat bzip2 gawk chrpath wget cpio texinfo lzop 

Installation prerequisites 64

sudo apt-get install lsb-core lib32stdc++6

5 Set Network

  • To bridge
  • Ubuntu network IP settings
sudo vim /etc/network/interfaces

Modify as follows:

# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto ens33 iface ens33 inet static address 192.168.188.210 netmask 255.255.255.0 gateway 192.168.188.1 dns-nameservers 192.168.188.1 

Restart the computer

  • View IP command
ifconfig -a

6 Install and start OPENSSL

sudo apt-get install openssh-server

After completion of the installation can be used to connect the secureCRT

7 Install and start FTP

sudo apt-get install vsftpd
sudo gedit /etc/vsftpd.conf 

Change setting:

    local_enable = YES
    write_enable = YES 

Restart

sudo reboot

After completion of the installation can be connected with the cureftp

8 Mill profiling

  • Unzip files Mill
unzip MYD-Y6ULX-20190329-m44.zip 
  • Linaro compiler installation
cd $DEV_ROOT
tar -xvf 03-Tools/Toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz -C /home/zwx/dragon/tool/gcc/linaro 

Increase quickly switch script

cd ~/dragon/tool/gcc/
vim linaro.sh

Add the following files:

#!/bin/sh
export PATH=$PATH:/home/zwx/work/dragon/tool/gcc/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin export CROSS_COMPILE=arm-linux-gnueabihf export ARCH=arm

Guess you like

Origin www.cnblogs.com/zwxwill/p/11810259.html