Yan
Yan Just a simple man.

Amlogic Yocto使用记录

Amlogic Yocto使用记录

记录VIM4开发Yocto过程中碰见的问题。

1. 查看单包支持的所有命令

以uboot为例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
yan@yan-wyb:~/yan/git/khadas/amlogic/Yocto-SDK/build$ bitbake u-boot -c listtasks
do_build                     Default task for a recipe - depends on all other normal tasks required to 'build' a recipe
do_buildclean                Call 'make clean' or equivalent in /home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/u-boot/v2019.01+git999-r1/u-boot-v2019.01+git999/
do_checkuri                  Validates the SRC_URI value
do_clean                     Removes all output files for a target
do_cleanall                  Removes all output files, shared state cache, and downloaded source files for a target
do_cleansstate               Removes all output files and shared state cache for a target
do_compile                   Compiles the source in the compilation directory
do_configure                 Configures the source by enabling and disabling any build-time and configuration options for the software being built
do_deploy                    Writes deployable output files to the deploy directory
do_deploy_source_date_epoch
do_devpyshell                Starts an interactive Python shell for development/debugging
do_devshell                  Starts a shell with the environment set up for development/debugging
do_fetch                     Fetches the source code
do_install                   Copies files from the compilation directory to a holding area
do_listtasks                 Lists all defined tasks for a target
do_package                   Analyzes the content of the holding area and splits it into subsets based on available packages and files
do_package_qa                Runs QA checks on packaged files
do_package_write_ipk         Creates the actual IPK packages and places them in the Package Feed area
do_packagedata               Creates package metadata used by the build system to generate the final packages
do_patch                     Locates patch files and applies them to the source code
do_populate_lic              Writes license information for the recipe that is collected later when the image is constructed
do_populate_sysroot          Copies a subset of files installed by do_install into the sysroot in order to make them available to other recipes
do_prepare_recipe_sysroot
do_unpack                    Unpacks the source code into a working directory
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds

每个layer支持的命令有所差异

2. Python版本不对

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3.
Please set up python v2 as your default 'python' interpreter.
bash: conf/local.conf: No such file or directory
===========================================

MACHINE=mesont7-an400
OUTPUT_DIR=build
AML_PATCH_PATH=/aml-patches-invalid

===========================================
Common targets are:
amlogic-image-bootstrap
amlogic-yocto
packagegroup-amlogic-baserootfs
packagegroup-amlogic-fullrootfs
recovery-image
vbmeta-image
vendor-image
grep: ./../.repo/manifest.xml: No such file or directory
 Manifest Name =

 Missing file /home/yan/yan/git/khadas/amlogic/Yocto-SDK/.repo/manifests/.conf !!!  Please check.

Yocto只支持Python2,需要确保使用了Python2的环境,如果使用了conda等虚拟环境请先退出。

3. 内核修改后未clean报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ERROR: linux-meson-5.4.125+git999-r2 do_compile: oe_runmake failed
ERROR: linux-meson-5.4.125+git999-r2 do_compile: Execution of '/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/temp/run.do_compile.32363' failed with exit code 1
ERROR: Logfile of failure stored in: /home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/temp/log.do_compile.32363
Log data follows:
| DEBUG: Executing python function externalsrc_compile_prefunc
| NOTE: linux-meson: compiling from external source tree /home/yan/yan/git/khadas/amlogic/Yocto-SDK/aml-comp/kernel/aml-5.4
| DEBUG: Python function externalsrc_compile_prefunc finished
| DEBUG: Executing shell function do_compile
| inside kernel_meson
| NOTE: make -j 16 HOSTCC=gcc  -isystem/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/include -O2 -pipe -L/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/lib                         -L/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/lib                         -Wl,-rpath,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 HOSTCPP=gcc  -E HOSTCXX=g++  -isystem/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/include -O2 -pipe -L/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/lib                         -L/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/lib                         -Wl,-rpath,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 Image.gz CC=aarch64-poky-linux-gcc   -fuse-ld=bfd -fdebug-prefix-map=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2=/usr/src/debug/linux-meson/5.4.125+git999-r2                     -fdebug-prefix-map=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot=                     -fdebug-prefix-map=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot-native=                      -fdebug-prefix-map=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work-shared/mesont7-an400/kernel-source=/usr/src/kernel  --sysroot=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot  --sysroot=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot LD=aarch64-poky-linux-ld.bfd    --sysroot=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot  --sysroot=/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/recipe-sysroot
| ***
| *** The source tree is not clean, please run 'make mrproper'
| *** in /home/yan/yan/git/khadas/amlogic/Yocto-SDK/aml-comp/kernel/aml-5.4
| ***
| make[2]: *** [/home/yan/yan/git/khadas/amlogic/Yocto-SDK/aml-comp/kernel/aml-5.4/Makefile:562: outputmakefile] Error 1
| make[1]: *** [/home/yan/yan/git/khadas/amlogic/Yocto-SDK/aml-comp/kernel/aml-5.4/Makefile:736: include/config/auto.conf.cmd] Error 2
| make[1]: *** [include/config/auto.conf.cmd] Deleting file 'include/config/tristate.conf'
| make: *** [/home/yan/yan/git/khadas/amlogic/Yocto-SDK/aml-comp/kernel/aml-5.4/Makefile:179: sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/yan/yan/git/khadas/amlogic/Yocto-SDK/build/tmp/work/mesont7_an400-poky-linux/linux-meson/5.4.125+git999-r2/temp/run.do_compile.32363' failed with exit code 1
ERROR: Task (/home/yan/yan/git/khadas/amlogic/Yocto-SDK/meta-meson/recipes-kernel/linux/linux-meson_5.4.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 608 tasks of which 607 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 1 seconds

其中明显提示了The source tree is not clean, please run 'make mrproper'

清理内核

1
$ make distclean

再次编译通过

4. Uboot make saveconfig以后未找到defconfig

Amlogic U-Boot代码的编译都会在build目录下进行,因此make savedefconfig以后,在build目录可以找到相应的defcongfig.

5. 内核以及U-Boot配置文件

kernel: meta-meson/recipes-kernel/linux/linux-meson_5.4.bb

U-Boot: meta-meson/recipes-bsp/u-boot/u-boot_2019.01.bb