Operation process
The main process is as follows. Firstly, mount the file system image on the built template board, and use qemu + chroot to enter the arm file system. The specific operations are as follows:
- The file system image file is rootfs IMG, the mounting path is / home/jw/disk_2/rk356x_rootfs/rootfs, you can build the following scripts to facilitate each mount. The specific contents are as follows:
- automount.sh
ARM_ROOTFS=/home/jw/disk_2/rk356x_rootfs/rootfs ROOTFS_FILE=./rootfs.img sudo mount -o loop ${ROOTFS_FILE} ${ARM_ROOTFS} sudo mount -o bind /dev ${ARM_ROOTFS}/dev sudo mount -o bind /dev/pts ${ARM_ROOTFS}/dev/pts sudo mount -o bind /proc ${ARM_ROOTFS}/proc sudo mount -o bind /sys ${ARM_ROOTFS}/sys
- Use the chroot command to switch to the target file system, as follows
$ sudo chroot /home/jw/disk_2/rk356x_rootfs/rootfs /bin/bash
- At this time, you can install the libraries in the target file system image through the normal apt command. When some libraries do not exist in the apt source, you can also compile in this virtual file system. The specific operation is the same as that of normal x86_ The source code is compiled in the same way on the 64 host, so I won't say more here.
- When we need source code, we can use apt source libxxx to obtain the source code library of apt deb package. The main target of this compilation is lightdm library, so here I operate as follows:
# apt source lightdm
- After obtaining the source code, you can enter the source code path and use Autogen Auto build tools such as sh or configure complete the project build and compilation.
x86_64 native cross compiling open source library of aarch64 architecture
In the previous step, we obtained the corresponding open source code on the board, but if we need a faster compilation target, Cross compilation can be performed using the cross compilation tool on the machine (the disadvantage is that if the compilation target relies on a large number of third-party libraries, we also need to configure the corresponding library environment). For the cross compilation dependency problem, we can mount the target file system and point the library path to be connected to the mounted file system, so as to solve the problem of a large number of dependent libraries. The specific operations are as follows:
- Mount the arm file system and mirror it to / home / JW / disk_ 2/rk356x_ Under the rootfs / rootfs path, refer to the previous step for specific operations
- Find the path where the cross compilation tool chain is located. The directory of the cross compilation tool aarch64 Linux GNU GCC I use here is / home/jw/disk_2/Code/rk356x-linux/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/ .
- According to its own environment and the configure parameters of the compilation library, the specific parameters can refer to the debian/rules file under the target library. This file is an important file required to build the deb package. Write the automatic build compilation script. The specific script contents are as follows:
- auto_build.sh
MY_SYSROOT="/home/jw/disk_2/rk356x_rootfs/rootfs" COMM_FLAGS="--sysroot=$MY_SYSROOT \ -Wl,-rpath-link=$MY_SYSROOT/lib/aarch64-linux-gnu \ -Wl,-rpath-link=$MY_SYSROOT/usr/lib/aarch64-linux-gnu " export PATH=/home/jw/disk_2/Code/rk356x-linux/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/:$PATH export CC="aarch64-linux-gnu-gcc " export CXX="aarch64-linux-gnu-g++ " export PKG_CONFIG_PATH="$MY_SYSROOT/usr/lib/aarch64-linux-gnu/pkgconfig:$MY_SYSROOT/usr/lib/pkgconfig:$MY_SYSROOT/usr/share/pkgconfig" export PKG_CONFIG_LIBDIR="$MY_SYSROOT/usr/lib/aarch64-linux-gnu/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="$MY_SYSROOT" export CPPFLAGS="-Wdate-time -DPRE_RELEASE=0 -fPIC $COMM_FLAGS" export CFLAGS="-I/home/jw/disk_2/rk356x_rootfs/rootfs/usr/include -I/home/jw/disk_2/rk356x_rootfs/rootfs/usr/lib/aarch64-linux-gnu/glib-2.0/include -g -O0 -Wformat -fPIC $COMM_FLAGS" export CXXFLAGS="-g -O0 -Wformat -fPIC $COMM_FLAGS" export LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic $COMM_FLAGS" export LIBS="-ldl" #../configure --host=aarch64 --with-greeter-user=lightdm --with-user-session=lightdm-xsession --disable-silent-rules --enable-liblightdm-qt5 --prefix=/home/jw/disk_2/Code/third/install-pack/ ../configure -v \ --build=x86_64-linux-gnu \ --host=aarch64-linux-gnu \ --with-sysroot=${MY_SYSROOT} \ --prefix=${MY_SYSROOT}/usr/ww \ --with-pkgversion='Debian 8.3.0-6'\ --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs \ --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ \ --with-gcc-major-version-only \ --program-suffix=-8 \ --program-prefix=aarch64-linux-gnu- \ --enable-shared \ --with-pic=pulsecore \ --enable-linker-build-id \ --libexecdir=/usr/lib \ --without-included-gettext \ --enable-threads=posix \ --libdir=/usr/lib \ --enable-nls \ --enable-bootstrap \ --enable-clocale=gnu \ --enable-libstdcxx-debug \ --enable-libstdcxx-time=yes \ --with-default-libstdcxx-abi=new \ --enable-gnu-unique-object \ --disable-libquadmath \ --disable-libquadmath-support \ --enable-plugin \ --enable-default-pie \ --with-system-zlib \ --disable-libphobos \
Execute script auto_build.sh
[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-gKZgeOip-1640832604325)(en-resource://database/831:1)]
Problems encountered and Solutions
1.pkg-config
pkg-config The tool facilitates the path setting of compiled header files and library files pc File saves information about header files, library files, and library dependencies. In the cross compilation environment, the target board pc The path information saved in the file may only be relative to the root directory of the target board( nfs Mount directory), so that when cross compiling on the host side, pkg-config The obtained path cannot be correctly located to the cross compiled library file and header file on the target board, and the compilation cannot be carried out correctly. utilize pkg-config environment variable PKG_CONFIG_SYSROOT_DIR This problem can be better solved by setting PKG_CONFIG_SYSROOT_DIR Is the root directory of the target board, pkg-config Will be in pc The path obtained in the file is prefixed $PKG_CONFIG_SYSROOT_DIR,The processed path can be correctly located to the location of the library file and header file.
2.Libtool
Libtool The tool can easily establish a dynamic link library in different platforms, which hides some underlying details. libtool utilize la The location and dependency of the file record library are similar to the above problems. In the cross compilation environment, it stores the path relative to the root directory of the target board. Cross compilation will cause problems. It seems that for libtool There is no relatively simple solution to this problem, but it is modified la The directory location in the file can solve this problem. The main modification is la Two locations in the file dependency_libs: Save the dependency of the library, and modify it to the absolute path of the host side libdir: Save the location of the library file and change it to the absolute path on the host side SSH Unable to connect"connection reset by ip_address port 22"Problem solving
If open SSH is installed on the server, the client cannot connect and c onnection reset by (server_ip_address) port 22 appears
If you encounter the above problems, it means that the installation of open ssh on the current machine is not complete, so you'd better reset the ssh configuration. The specific operations are as follows:
$ sudo rm /etc/ssh/ssh_host_* $ sudo dpkg-reconfigure openssh-server
Configure error: Python headers not found
When executing configure, because the Python header file is not found and an error is reported, you can execute the following command to solve it:
$ sudo apt-get install python-dev # for python2.x installs $ sudo apt-get install python3-dev # for python3.x installs
Method of image file expansion under linux
After the previously mounted file system image, when we install a large number of Library environments through apt, we will find that the available space is getting less and less, and there is no space at the last point. At this time, we need to expand the image file. The specific operations are as follows:
1. Create a file of 10M size
#dd if=/dev/zero of=/add.img bs=1M count=10
- Associate this file into a block device
#losetup /dev/loop0 /add.img
- Check whether the association is successful
# losetup -a /dev/loop0: [fd00]:173960 (/add.img)
- Format it into an ext3 file system
#mkfs.ext3 /dev/loop0
5. Uninstall the association relationship and view it again
#losetup -d /dev/loop0 #losetup -a
6. Add space to the original img file
Note: here is the > > symbol to append, not >, > is a new write!!
#cat /add.img >> /old.img
- Scan check
#e2fsck -f /old.img
- Reset its size property
#resize2fs /old.img
9. Finally, mount the expanded image and use df -h to view it. You will find that the expansion of the image file has been completed
pkg_config_path environment variable setting
1, View pkg_config_path environment variable
command
root@kali:~# echo $PKG_CONFIG_PATH
You can clearly see from the above that my "pkg_config_path environment variable" is empty.
2, Where is your pkgconfig# path?
root@kali:~# find / -name pkgconfig
You can clearly see that there are three pkgconfig paths: / usr/share/pkgconfig, / usr/lib/pkgconfig, / usr / lib / x86_ 64 Linux GNU / pkgconfig, choose by yourself! I suggest you choose either of the first two.
3, Set pkg_config_path environment variable
Method there are two ways to set pkg_config_path environment variable.
1. If you just want to add the pkg of a library, just use the following command:
root@kali:~# export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
2. If you want to overwrite the original pkg, you can choose this method. Because PKG_CONFIG_LIBDIR has priority over PKG_CONFIG_PATH is high, so pkg will be overwritten_ CONFIG_ Path settings.
root@kali:~# export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/
You can also use the following commands. Be sure to put them in PKG_ CONFIG_ In front of the path so that it can be read first.
root@kali:~# export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:$PKG_CONFIG_PATH
[GitHub] a solution to very slow cloning.
- 1. Copy clone address
- 2. Replace GitHub( https://github.com/ )Domain name is https://github.com.cnpmjs.org/
Original address: https://github.com/FanCiyuan/macrozheng.git Address after replacement: https://github.com.cnpmjs.org/FanCiyuan/macrozheng.git
- 3, git clone https://github.com.cnpmjs.org/FanCiyuan/macrozheng.git
The following error message appears when executing the make command:
DPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/jiajia/libuuid-1.0.3/libuuid-1.0.3/missing aclocal-1.13 /home/jiajia/libuuid-1.0.3/libuuid-1.0.3/missing: Line 81: aclocal-1.13: Command not found WARNING: 'aclocal-1.13' is missing on your system. You should only need it if you modified 'acinclude.m4' or 'configure.ac' or m4 files included by 'configure.ac'. The 'aclocal' program is part of the GNU Automake package: <http://www.gnu.org/software/automake> It also requires GNU Autoconf, GNU m4 and Perl in order to run: <http://www.gnu.org/software/autoconf> <http://www.gnu.org/software/m4/> <http://www.perl.org/> Makefile:424: recipe for target 'aclocal.m4' failed make: *** [aclocal.m4] Error 127
- Core issues:
'aclocal-1.13' is missing on your system.
- terms of settlement
autoreconf -ivf
intltool version is too low
Because the intltool version is too low, it needs to be updated, but refer to the update method described on the Internet:
wget http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.gz tar zxvf intltool-0.40.6.tar.gz cd intltool-0.40.6 ./configure make && make install
However, after the update, it is found that intltool update cannot be executed normally.
/usr/bin/intltool-update Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/^(.*)\${ <-- HERE ?([A-Z_]+)}?(.*)$/ at /usr/bin/intl
Refer to the previous reference link to modify some characters in the intltool update script file.