Chapter 4 Compile Other Apps
1.1 Get the source code
We provide these programs:
Put them on GITEE at the address: https://gitee.com/weidongshan/openharmony_for_imx6ull
For convenience, you can execute the following commands in Ubuntu to download directly:
cd /home/book
git clone https://gitee.com/weidongshan/openharmony_for_imx6ull.git
This will get this directory: /home/book/openharmony_for_imx6ull
1.2 Compile the program
Assuming that the /home/book/openharmony_for_imx6ull directory has been downloaded, execute the following command to compile:
cd /home/book/openharmony_for_imx6ull/apps
for i in $(ls); do cd $i; make; cd -; done
Explain the above command below.
These directories are listed in $(ls): digital_photo_frame fb_test freetype hello.
For each item "$i", execute (do) these commands: cd $i; make; cd -. Just enter the
Directory, execute the make command to return to the upper directory.
Of course you can enter those subdirectories yourself and execute the make command manually.
Note:
(1) The two programs, freetype and digital_photo_frame, need to use the hi3518ev300 library files compiled earlier.
(2) So you need to execute "python build.py ipcamera_hi3518ev300 -b debug" first
(3) If the path of Hongmeng source code is not /home/book/openharmony, then you need to modify the Makefile, modify the path as follows:
1.3 Copy the program to rootfs
These two programs do not depend on other dynamic libraries: hello and fb_test; but the freetype program depends on libfreetype.so, and the digital_photo_frame program depends on libfreetype.so and libjpeg.so.
Where are these dynamic libraries? Let's take a coincidence. Before, "python build.py ipcamera_hi3518ev300 -b debug" was executed in "1.2.4 Compile Official Version", which generated this library file for the hi3518ev300 development board. hi3518ev300 and imx6ull belong to the cortex A7 architecture, so imx6ull can use these libraries. After perfecting the code of imx6ull in the future, there is no need for such trickery.
Execute the following command to copy the program:
cd /home/book/openharmony_for_imx6ull/apps
# 拷贝应用程序
cp hello/hello /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/bin
cp fb_test/fb_test /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/bin
cp freetype/show_line /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/bin
cp digital_photo_frame/digitpic /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/bin
# 拷贝字体文件
cp freetype/simsun.ttc /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/
# 拷贝数码相框的图标
cp digital_photo_frame/rootfs /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/ -rf
# 拷贝库文件
cp /home/book/openharmony/out/ipcamera_hi3518ev300/libs/usr/libfreetype.so /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/usr/lib/
cp /home/book/openharmony/out/ipcamera_hi3518ev300/libs/usr/libjpeg.so /home/book/openharmony/kernel/liteos_a/out/imx6ull/rootfs/usr/lib/
1.4 Make rootfs.jffs2
Execute the following commands:
cd /home/book/openharmony/kernel/liteos_a/out/imx6ull/
mkfs.jffs2 -s 0x10000 -e 0x10000 -d rootfs -o rootfs.jffs2
Put the obtained rootfs.jffs2 in the files directory of the burning tool, and you can start it with the burning tool:
1.5 Execute APP
These APPs can be executed directly, if parameters are needed, it will prompt the usage.
Note: You must use a relative path, such as "./bin/hello"; you cannot use an absolute path, such as "/bin/hello"
1.5.1 fb_test
Execute the following commands:
./bin/fb_test /dev/fb0
The effect is as follows:
1.5.2 show_line
Execute the following commands:
./bin/show_line /simsun.ttc 230 230 100
The effect is as follows:
1.5.3 digitpic
Execute the following commands:
./bin/digitpic /simsun.ttc
You can click the icon on the screen, and the effect is as follows:
Full text download
technology exchange group (
Hongmeng development/Linux/embedded/driver/data download) QQ group: 869222007