『壹』 uboot是什麼
U-Boot,全稱 Universal Boot Loader,是遵循GPL條款的開放源碼項目。U-Boot的作用是系統引導。U-Boot從FADSROM、8xxROM、PPCBOOT逐步發展演化而來。其源碼目錄、編譯形式與linux內核很相似,事實上,不少U-Boot源碼就是根據相應的Linux內核源程序進行簡化而形成的,尤其是一些設備的驅動程序,這從U-Boot源碼的注釋中能體現這一點。
選擇U-Boot的理由:
① 開放源碼;
② 支持多種嵌入式操作系統內核,如Linux、NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS, android;
③ 支持多個處理器系列,如PowerPC、ARM、x86、MIPS;
④ 較高的可靠性和穩定性;
⑤ 高度靈活的功能設置,適合U-Boot調試、操作系統不同引導要求、產品發布等;
⑥ 豐富的設備驅動源碼,如串口、乙太網、SDRAM、FLASH、LCD、NVRAM、EEPROM、RTC、鍵盤等;
⑦ 較為豐富的開發調試文檔與強大的網路技術支持。
『貳』 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
『叄』 從android 的boot.img解壓出來的kernal.gz怎麼解壓
這個kernel已經是zImage了,可以繼續解壓成Image。有些系統如果使用uboot引導的話,recovery的代碼修改成uImage+uramdisk好了,不一定要使用andoid原生態的做法。 Image為內核映像文件,而zImage為內核的一種映像壓縮文件,gzip弄開就好了。貌似你剛開始嵌入式開發啊,慢慢練習1年就好了。
『肆』 編譯android過程中,uboot報錯
uboot是引導程序,android是系統,兩者之間是兩個獨立工程,使用Uboot的目的只是為了引導Andriod的Linux內核和ramdisk(如果有需要使用ramdisk的話)。如果uboot通過屏蔽通過 ****.h文件中拿掉一些宏定義,使uboot編譯通過。那麼Andriod編譯時候,也應該對一下宏進行屏蔽。
『伍』 整體編譯Android系統,大家用了多少時間
我自己實際編譯ICS4.0.4源碼情況:acer台式機,3.2Ghz cpu,4核,8GB/1600hz內存,整體編譯(含u-boot、kernel、boot.img和system.img)需要1小時10分鍾。編譯時,使用make -j8(因為硬體cpu是4線程的,故使用2倍線程數)。之後的增量編譯,一般需要5~10分鍾即可。