Cross-compiling vim and porting to arm embedded Linux systems

Source: Internet
Author: User
Tags bz2






Original works, permitted to reprint, please be sure to use hyperlinks in the form of the article, author information and this statement, or will be held liable.



As we all know, Vim is an enhanced version of VI, the actual experience is much better than VI, because the author for Arm system based on the BusyBox file system with only VI tools, This article mainly describes how to transplant the Vim tool into the BusyBox-based Rootfs.





First, the compilation environment:



Host machine: ubuntu-16.10 (64bit)



Target:arm



Cross tool chain: ARM-LINUX-GNUEABI-GCC



Tool Kit:



ncurses-5.9.7:https://yunpan.cn/cmkkk9pdiuu7g (Extract code: 2488)



Vim-7.4.tar.bz2:https://yunpan.cn/cmwcsc5rwptwh (Extract code: 8D84)





Second, compile preparation



Put the downloaded compressed file into the/home/liangwode/test folder and unzip the two files.





tar xvzf ncurses-5.9.7.tar.gz
bzip2 -d vim-7.4.tar.bz2
tar xvf vim-7.4.tar


Get two of directories




vim-74    ncurses-5.9








Third, compiling ncurses



    Since VIM relies on the libtinfo.so library, and the functionality of the Libtinfo.so library has been incorporated into the ncurses library, it is necessary to compile the ncurses, then create the libtinfo.so symbolic link to the ncurses Library, go to the ncurses directory, and configure cross-compilation





cd ncurses-5.9
./configure --prefix=/home/test/install_ncurses  --host=arm-linux-gnueabi --without-cxx --without-cxx-binding --without-ada --without-manpages --without-progs --without-tests --with-shared





Compiling and installing the Ncurses Library




Make && make install





This will generate the Ncurses library and header files in the/home/test/install_ncurses directory.




Bin  include  Lib  share





Enter the Lib directory to create a Littinfo symbolic link





cd lib
ln -s libncurses.so.5 libtinfo.so.5
ln -s libtinfo.so.5 libtinfo.so





Fourth. compiling vim



Enter the VIM directory and configure the Vim compilation environment, where cppflags indicates the directory where the header files associated with the Libtifo library are required for the VIM compilation process, and Ldflags indicates the directory where the Libtinfo library resides.





cd /home/liangwode/test/vim74
./configure --with-features=tiny --disable-gui --without-x --disable-selinux --disable-acl --disable-gpm CPPFLAGS=-I/home/liangwode/test/install_ncurses/include/ncurses LDFLAGS=-L/home/liangwode/test/install_ncurses/lib





Start compiling




Make CC=ARM-LINUX-GNUEABI-GCC


If there is a arm-linux-gnueabi/bin/ld:cannot find-ltinfo error in the compilation, it means that the Tinfo library has the wrong path, or there is a problem with the previous step of Ncuses compilation.






Fifth. Porting to the target machine



First, the Ncurses library is ported to the/usr/lib directory of the target machine, and the Tinfo library related symbolic link is created, the author mounts the target machine's root file system to the/mnt/sysroot directory.




Cd /home/liangwode/test/install_ncurses
Cp -frP lib/* /mnt/sysroot/usr/lib/
Cp -frP share/* /mnt/sysroot/usr/share/

/*Create a symbolic link to libtinfo.so*/
Cd /mnt/sysroot/usr/lib 
ln -s libncurses.so.5 libtinfo.so.5
ln -s libtinfo.so.5 libtinfo.so


Porting the vim executable file to the target machine





cd /home/liangwode/test/vim74/src
cp vim /mnt/sysroot/usr/sbin
cd /mnt/sysroot/usr/sbin
chmod 777 vim


Remove VI and link VI to VIM





cd /bin
rm -f vi
ln -s /usr/sbin/vim vi



Restart the target machine, after booting, input vim, done






vim


~
~                              VIM - Vi IMproved
~
~                                 version 7.4
~                           by Bram Moolenaar et al.
~                 Vim is open source and freely distributable
~
~                           Sponsor Vim development!
~                type  :help sponsor<Enter>    for information
~
~                type  :q<Enter>               to exit
~                type  :help<Enter>  or  <F1>  for on-line help
~                type  :help version7<Enter>   for version info
~
~                        Running in Vi compatible mode
~                type  :set nocp<Enter>        for Vim defaults
~                type  :help cp-default<Enter> for info on this
~
~

Cross-compiling vim and porting to arm embedded Linux systems


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.