yocto編譯內核命令
❶ Yocto編譯傑發或MTK的linux或android時的幾個問題
編譯問題1(audiomanager_7.0.bb的do_configure報錯):
錯誤:CMake Error at Plugins/PluginCommandInterfaceCAPI/cmake/CommonAPI.cmake:352 (message):
| Failed to generate files from FIDL:
手動執行一下:
$ commonapi-generator-linux-x86 -ll verbose -sk Default -d . /data/linux/hz_rs28_bm/sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/audiomanager/7.0-r1/audiomanager-7.0/Plugins/PluginCommandInterfaceCAPI/fidl/CommandInterface.fidl
-bash: /data/linux/hz_rs28_bm/sources/src/build/tools/commonapi_tool/commonapi-generator/commonapi-generator-linux-x86: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
解決(需要安裝32位的glibc庫和32位java jre環境):
$ sudo yum install glibc.i686
$ sudo yum install java-1.8.0-openjdk.i686
$ sudo ln -s /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.i386/jre/bin/java /bin/java
$ java -version (保證是32位的java)
編譯問題2(perl_5.20.0.bb的do_package報錯):
錯誤:ERROR: obj failed with exit code 256 (cmd was 『arm-poky-linux-gnueabi-obj』 –only-keep-debug
… generate_uudmap: File format not recognized
解決(tar在1.29版本之後需要exclude在路徑的前面):
sources/meta/poky/bitbake/lib/bb/fetch2/bzr.py
tar_flags = 「–exclude 『.bzr』 –exclude 『.bzrtags'」
修改成:
tar_flags = 「–exclude=』.bzr』 –exclude=』.bzrtags'」
sources/meta/poky/bitbake/lib/bb/fetch2/cvs.py
tar_flags = 「–exclude 『CVS'」
修改成:
tar_flags = 「–exclude=』CVS'」
sources/meta/poky/bitbake/lib/bb/fetch2/repo.py
tar_flags = 「–exclude 『.repo』 –exclude 『.git'」
修改成:
tar_flags = 「–exclude=』.repo』 –exclude=』.git'」
sources/meta/poky/bitbake/lib/bb/fetch2/svn.py
tar_flags = 「–exclude 『.svn'」
修改成:
tar_flags = 「–exclude=』.svn'」
sources/meta/poky/meta/recipes-devtools/quilt/quilt-0.63.inc
tar -cf – bin/ –exclude \*.in | ( cd ${D}${PTEST_PATH} && tar -xf – )
tar -cf – compat/ –exclude \*.in | ( cd ${D}${PTEST_PATH} && tar -xf – )
tar -cf – quilt/ –exclude \*.in | ( cd ${D}${PTEST_PATH} && tar -xf – )
tar -cf – test/ –exclude mail.test –exclude delete.test | ( cd ${D}${PTEST_PATH} && tar -xf – )
修改成:
tar -c –exclude=\*.in bin/ | ( cd ${D}${PTEST_PATH} && tar -xf – )
tar -c –exclude=\*.in compat/ | ( cd ${D}${PTEST_PATH} && tar -xf – )
tar -c –exclude=\*.in quilt/ | ( cd ${D}${PTEST_PATH} && tar -xf – )
tar -c –exclude=mail.test –exclude=delete.test test/ | ( cd ${D}${PTEST_PATH} && tar -xf – && chmod 777 test)
sources/meta/poky/meta/recipes-extended/sed/sed-4.2.2/sed-add-ptest.patch
+ cd $(BUILDDIR); tar -cf – $(TESTDIR) –exclude *.o | ( cd $(DESTDIR) && tar -xf – )
修改成:
+ cd $(BUILDDIR); tar -c –exclude=*.o $(TESTDIR) | ( cd $(DESTDIR) && tar -xf – )
sources/meta/poky/meta/recipes-support/attr/acl.inc
tar -cf – test/ –exclude nfs | ( cd ${D}${PTEST_PATH} && tar -xf – )
修改成:
tar -c –exclude=nfs test/ | ( cd ${D}${PTEST_PATH} && tar -xf – )
sources/meta/poky/meta/recipes-support/attr/attr.inc
tar -cf – test/ –exclude ext | ( cd ${D}${PTEST_PATH} && tar -xf – )
修改成:
tar -c –exclude=ext test/ | ( cd ${D}${PTEST_PATH} && tar -xf – )
sources/meta/poky/meta/recipes-devtools/perl/perl-ptest.inc
tar -cf – * –exclude \*.o –exclude libperl.so –exclude Makefile –exclude makefile –exclude hostperl \
–exclude miniperl –exclude generate_uudmap –exclude patches | ( cd ${D}${PTEST_PATH} && tar -xf – )
修改成:
tar -c –exclude=\*.o –exclude=libperl.so –exclude=Makefile –exclude=makefile –exclude=hostperl \
–exclude=miniperl –exclude=generate_uudmap –exclude=patches * | ( cd ${D}${PTEST_PATH} && tar -x )
編譯問題3(libunwind_1.1.bb的do_compile報錯):
錯誤:make[1]: latex2man: Command not found
解決:
$ sudo yum install texlive-tetex
$ sudo rpm -ivh ~/latex2man-1.18-2.noarch.rpm
編譯問題3(qt5-app_1.0.bb的do_compile報錯):
錯誤(有一批類似的錯誤):ld: cannot find -lgtest
解決:
$ vi atc_linux/application/btate/btate.pro
equals(MY_BUILD_SYSTEM, atc) {
LIBS += -L $(DA_LIBDIR)/lib -lgtest -lpthread -lbluetoothclient -lglobalbus -lappobj -lapputils
} else {
LIBS += -L$(DA_TOP)/application/lib -L$(DA_TOP)/../../sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/atc-binarys/1.0-r0/image/usr/lib -lgtest -lpthread -lbluetoothclient -l
globalbus -lappobj -lapputils
}
$ vi atc_linux/application/gps/gps_bin.pro
equals(MY_BUILD_SYSTEM, atc) {
LIBS += -L $(DA_LIBDIR)/lib -lapputils -lglobalbus -lappobj -lgps
} else {
LIBS += -L$(DA_TOP)/application/lib -L$(DA_TOP)/../../sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/gpsd/3.10-r0/gpsd-3.10/ -lapputils -lglobalbus -lappobj -lgps
}
$ vi atc_linux/application/dvr/dvr_bin.pro
equals(MY_BUILD_SYSTEM, atc) {
LIBS += -L${DA_TOP}/lib/lib/ -ldvr -ludev -lsurface_atc -lglobalbus -lappobj -lapputils -lstorage_atc -lgps
} else {
LIBS += -L${DA_TOP}/application/lib -L$(DA_TOP)/../../sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/gpsd/3.10-r0/gpsd-3.10/ -ldvr -ludev -lsurface_atc -lglobalbus –
lappobj -lapputils -lstorage_atc -lgps
}
$ vi atc_linux/application/dvr/dvr_bin.pro
INCLUDEPATH += ${DA_TOP}/kernel/kernel-3.18/drivers/ \
../common/ \
../utils/ \
../appobj/include/ \
../globalbus/include/ \
../appcommon/include/ \
../storage_atc/ \
../dvr/gps/ \
../gps/include/ \
../gps/includeex/ \
編譯問題4(makall報錯):
報錯:./makall: line 169: mkisofs: command not found
解決:$ sudo yum install mkisofs
編譯問題5(修改ac83xx_systemd_defconfig再編譯時報錯):
報錯:Applying patch remove-selinux-android.patch
patching file system/extras/ext4_utils/make_ext4fs.c
Hunk #1 FAILED at 62.
1 out of 1 hunk FAILED — rejects in file system/extras/ext4_utils/make_ext4fs.c
解決:
$ vi sources/meta/meta-atc/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
在裡面做個假的do_patch(),bitbake會優先使用本bb文件的do_patch()函數。
do_patch(){
}
編譯問題6(修改ac83xx_systemd_defconfig再編譯時報錯):
報錯:sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/qtbase/5.5.0+gitAUTOINC+c619d2daac-r0/git/src/corelib/tools/qregexp.cpp:3947:1: internal compiler error: in add_stores, at var-tracking.c:6000
解決:
$ cd sources/meta/poky/meta/recipes-devtools/gcc/gcc-4.9/
$ wget http://openlinux.windriver.com/overc/sources/core2_64/gcc-4.9.2-r0.1/0062-gcc-var-tracking.c-backport-from-gcc-trunk-r212178.patch
$ vi sources/meta/poky/meta/recipes-devtools/gcc/gcc-4.9.inc
file://0058-gcc-r212171.patch \
file://0059-gcc-PR-rtl-optimization-63348.patch \
file://target-gcc-includedir.patch \
file://0062-gcc-var-tracking.c-backport-from-gcc-trunk-r212178.patch \
其實就是這個文件:
$ cat 0062-gcc-var-tracking.c-backport-from-gcc-trunk-r212178.patch
From Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20M=C3=BCller-Klieser?= <[email protected]>
Date: Tue, 7 Apr 2015 16:15:11 +0200
Subject: [PATCH] gcc/var-tracking.c: backport from gcc trunk r212178
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
resolves a bug seen on cortexa8 building qt5 libraries.
2014-06-30 Joseph Myers <[email protected]>
* var-tracking.c (add_stores): Return instead of asserting if old
and new values for conditional store are the same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212178 138bc75d-0d04-0410-961f-82ee72b054a4
Signed-off-by: Stefan Müller-Klieser <[email protected]>
---
gcc/var-tracking.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 65d8285..7c38910 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5997,7 +5997,8 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
{
cselib_val *oval = cselib_lookup (oloc, GET_MODE (oloc), 0, VOIDmode);
- gcc_assert (oval != v);
+ if (oval == v)
+ return;
gcc_assert (REG_P (oloc) || MEM_P (oloc));
if (oval && !cselib_preserved_value_p (oval))
--
1.9.1
編譯問題7(修改ac83xx_systemd_defconfig再編譯時報錯):
報錯:libevdev/1.2.2-r0/libevdev-1.2.2/test/test-main.c:24:19: fatal error: check.h: No such file or directory
解決:
$ vi meta/poky/meta/recipes-support/libevdev/libevdev_1.2.2.bb
LIC_FILES_CHKSUM = 「file://COPYING;md5= \
file://libevdev/libevdev.h;endline=21;md5=″
DEPENDS += 「libcheck」
SRC_URI = 「 http://www.freedesktop.org/software/libevdev/ ${BP}.tar.xz」
編譯問題8(修改ac83xx_systemd_defconfig再編譯時報錯):
報錯:python報錯: 『do_rootfs』, lineno: 17, function
Exception: CalledProcessError: Command 『[『』, 『-ks』, …
解決: 沒有實際問題,重新編譯一次即可,可能是機器太忙導致超時,或者某個命令執行不成功。
編譯問題9(preuboot編譯工具問題):
報錯:make: armv7a-mediatek451_001_vfp-linux-gnueabi-gcc: Command not found
解決:
$ vi atc_linux/bootloader/preuboot/Makefile
#CROSS_COMPILE :=armv7a-mediatek451_001_vfp-linux-gnueabi-
CROSS_COMPILE :=arm-poky-linux-gnueabi-
$ vi ../../atc_linux/bootloader/preuboot/driver/mmc/include/linux/list.h
#ifndef NULL
#define NULL 0
#endif
❷ 單獨編譯內核和設備樹
source /opt/fsl-imx-xwayland/4.19-warrior/environment-setup-aarch64-poky-linux
export ARCH=arm64
make -j 16
生成的Image 和dtb在下面的路徑
~/imx-yocto-bsp/build-imx8mmevk/tmp/work/imx8mmevk-poky-linux/linux-imx/4.19.35-r0/git/arch/arm64/boot