编译Android 4.0.4(打包出问题)

开发环境Ubuntu 12.04

一、编译准备

1.安装java
uestc@uestc-ThinkPad-T43:~/tools$ ls
jdk1.6.0_24  jdk-6u24-linux-i586.bin
uestc@uestc-ThinkPad-T43:~/tools$ chmod +x jdk-6u24-linux-i586.bin
uestc@uestc-ThinkPad-T43:~/tools$ ./jdk-6u24-linux-i586.bin
安装完成配置如下:
uestc@uestc-ThinkPad-T43:~/tools$ sudo mkdir /usr/lib/jvm
uestc@uestc-ThinkPad-T43:~/tools$ sudo mv jdk1.6.0_24 /usr/lib/jvm
uestc@uestc-ThinkPad-T43:~/tools$ sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.6.0_24/bin/java” 1
update-alternatives: 使用 /usr/lib/jvm/jdk1.6.0_24/bin/java 来提供 /usr/bin/java (java),于 自动模式 中。
uestc@uestc-ThinkPad-T43:~/tools$ sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.6.0_24/bin/javac” 1
update-alternatives: 使用 /usr/lib/jvm/jdk1.6.0_24/bin/javac 来提供 /usr/bin/javac (javac),于 自动模式 中。
uestc@uestc-ThinkPad-T43:~/tools$ sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jdk1.6.0_24/bin/javaws” 1
update-alternatives: 使用 /usr/lib/jvm/jdk1.6.0_24/bin/javaws 来提供 /usr/bin/javaws (javaws),于 自动模式 中。
uestc@uestc-ThinkPad-T43:~/tools$ sudo update-alternatives –config java
链接组 java 中只有一个候选项:/usr/lib/jvm/jdk1.6.0_24/bin/java
无需配置。
uestc@uestc-ThinkPad-T43:~/tools$ sudo update-alternatives –config javac
链接组 javac 中只有一个候选项:/usr/lib/jvm/jdk1.6.0_24/bin/javac
无需配置。
uestc@uestc-ThinkPad-T43:~/tools$ sudo gedit /etc/environment
在最后一行添加JAVA_HOME=”/usr/lib/jvm/jdk1.6.0_24″
2.安装必要的包
尽量全安装吧,编译一次太花时间了。
uestc@uestc-ThinkPad-T43:~/tools$ sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
zip 已经是最新的版本了。
zip 被设置为手动安装。
gnupg 已经是最新的版本了。
将会安装下列额外的软件包:
dpkg-dev fakeroot g++ g++-4.6 g++-4.6-multilib gcc-4.6-multilib gcc-multilib
git-man lib64gcc1 lib64gomp1 lib64quadmath0 lib64stdc++6
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
libbison-dev libc-bin libc-dev-bin libc6 libc6-amd64 libc6-dev-amd64
libdpkg-perl libdrm-dev libdrm-intel1 libdrm-nouveau1a libdrm-nouveau2
libdrm-radeon1 libdrm2 liberror-perl libfl-dev libkms1 libpthread-stubs0
libpthread-stubs0-dev libstdc++6-4.6-dev libtimedate-perl libtinfo-dev
libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxext-dev m4
mesa-common-dev mingw32-binutils mingw32-runtime x11proto-input-dev
x11proto-kb-dev x11proto-xext-dev xorg-sgml-doctools xtrans-dev
建议安装的软件包:
bison-doc debian-keyring gcc-4.6-doc libstdc++6-4.6-dbg lib64stdc++6-4.6-dbg
lib64mudflap0 git-daemon-run git-daemon-sysvinit git-doc git-el git-arch
git-cvs git-svn git-email git-gui gitk gitweb glibc-doc ncurses-doc
libstdc++6-4.6-doc libxcb-doc gcc-doc cpp-doc
下列【新】软件包将被安装:
bison build-essential curl dpkg-dev fakeroot flex g++ g++-4.6
g++-4.6-multilib g++-multilib gcc-4.6-multilib gcc-multilib git git-man
gperf lib64gcc1 lib64gomp1 lib64quadmath0 lib64stdc++6
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
libbison-dev libc6-amd64 libc6-dev-amd64 libdpkg-perl libdrm-dev
liberror-perl libfl-dev libgl1-mesa-dev libkms1 libncurses5-dev
libpthread-stubs0 libpthread-stubs0-dev libreadline6-dev libstdc++6-4.6-dev
libtimedate-perl libtinfo-dev libx11-dev libx11-doc libxau-dev libxcb1-dev
libxdmcp-dev libxext-dev libxml2-utils m4 mesa-common-dev mingw32
mingw32-binutils mingw32-runtime python-markdown tofrodos x11proto-core-dev
x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xorg-sgml-doctools
xsltproc xtrans-dev zlib1g-dev
下列软件包将被升级:
libc-bin libc-dev-bin libc6 libc6-dev libdrm-intel1 libdrm-nouveau1a
libdrm-nouveau2 libdrm-radeon1 libdrm2
升级了 9 个软件包,新安装了 60 个软件包,要卸载 0 个软件包,有 220 个软件包未被升级。
需要下载 78.7 MB 的软件包。
解压缩后会消耗掉 247 MB 的额外空间。
您希望继续执行吗?[Y/n]y
……开始安装
注:ubuntu 10.04.4用如下替换
sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev
接着安装
uestc@uestc-ThinkPad-T43:~/tools$ sudo apt-get install u-boot-tools texinfo texlive ccache gawk gettext uuid-dev
[sudo] password for uestc:
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
u-boot-tools 已经是最新的版本了。
将会安装下列额外的软件包:
intltool-debian lacheck latex-beamer latex-xcolor libgettextpo0
libmail-sendmail-perl libsigsegv2 libsys-hostname-long-perl libunistring0
lmodern luatex pgf po-debconf prosper ps2eps tex-common texlive-base
texlive-binaries texlive-common texlive-doc-base texlive-extra-utils
texlive-font-utils texlive-fonts-recommended texlive-fonts-recommended-doc
texlive-generic-recommended texlive-latex-base texlive-latex-base-doc
texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex
texlive-pstricks texlive-pstricks-doc tipa
建议安装的软件包:
distcc gettext-doc auctex libmail-box-perl debhelper texinfo-doc-nonfree
texlive-doc-en perl-tk dvidvi fragmaster latexmk purifyeps xindy psutils
t1utils
下列【新】软件包将被安装:
ccache gawk gettext intltool-debian lacheck latex-beamer latex-xcolor
libgettextpo0 libmail-sendmail-perl libsigsegv2 libsys-hostname-long-perl
libunistring0 lmodern luatex pgf po-debconf prosper ps2eps tex-common
texinfo texlive texlive-base texlive-binaries texlive-common
texlive-doc-base texlive-extra-utils texlive-font-utils
texlive-fonts-recommended texlive-fonts-recommended-doc
texlive-generic-recommended texlive-latex-base texlive-latex-base-doc
texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex
texlive-pstricks texlive-pstricks-doc tipa uuid-dev
升级了 0 个软件包,新安装了 39 个软件包,要卸载 0 个软件包,有 220 个软件包未被升级。
需要下载 223 MB 的软件包。
解压缩后会消耗掉 371 MB 的额外空间。
您希望继续执行吗?[Y/n]y
修改Android.mk
uestc@uestc-ThinkPad-T43:~$ cd cubieboard-tv-sdk/
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ ls
abi       build   development  external    kernel    ndk       sdk
bionic    cts     device       frameworks  libcore   packages  system
bootable  dalvik  docs         hardware    Makefile  prebuilt  tools
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ gedit frameworks/base/media/libstagefright/Android.mk

LOCAL_STATIC_LIBRARIES := \
libstagefright_color_conversion \
libstagefright_aacenc \
libstagefright_amrnbenc \
libstagefright_amrwbenc \
libstagefright_avcenc \
libstagefright_m4vh263enc \
libstagefright_matroska \
libstagefright_timedtext \
libvpx \
libstagefright_mpeg2ts \
libstagefright_id3 \
libFLAC \
libstagefright_rtsp \

二、编译
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ source build/envsetup.sh
including device/allwinner/common/vendorsetup.sh
including device/allwinner/cubieboard/vendorsetup.sh
including sdk/bash_completion/adb.bash
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ lunch

You’re building on Linux

Lunch menu… pick a combo:
1. full-eng
2. full_x86-eng
3. vbox_x86-eng
4. cubieboard-eng

Which would you like? [full-eng] 4

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=cubieboard
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76D
============================================

uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ make -j1
出现错误
host Java: jsr305lib (out/host/common/obj/JAVA_LIBRARIES/jsr305lib_intermediates/classes)
/bin/bash: jar: 未找到命令
make: *** [out/host/common/obj/JAVA_LIBRARIES/jsr305lib_intermediates/javalib.jar] 错误 127
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$

这样处理,添加java路径,继续编译。make -j1据说表示单线程,没错我电脑还是单核的,还不知道能不能编译过。不管了,回去睡觉,编译一晚明天再看。
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ export PATH=$PATH:/usr/lib/jvm/jdk1.6.0_24/bin/
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ make -j1
……..
failed to reconstruct target deflate chunk 1 [(null)]; treating as normal
Construct patches for 3 chunks…
patch   0 is 216 bytes (of 4218890)
patch   1 is 323444 bytes (of 974981)
patch   2 is 146 bytes (of 1905)
chunk   0: normal   (         0,    4218890)         216
chunk   1: deflate  (   4218890,    1314639)      323444  (null)
chunk   2: normal   (   5533529,        167)         146
Install system fs image: out/target/product/cubieboard/system.img
out/target/product/cubieboard/system.img+out/target/product/cubieboard/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p total size is 187410530
Target userdata fs image: out/target/product/cubieboard/userdata.img
in mkuserimg.sh PATH=out/host/linux-x86/bin/:/usr/lib/jvm/java-6-sun/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/uestc/cubieboard-tv-sdk/out/host/linux-x86/bin:/home/uestc/cubieboard-tv-sdk/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin:/home/uestc/cubieboard-tv-sdk/development/emulator/qtools:/home/uestc/cubieboard-tv-sdk/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin:/home/uestc/cubieboard-tv-sdk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:/usr/lib/jvm/jdk1.6.0_24/bin/
make_ext4fs -s -l 128M -a data out/target/product/cubieboard/userdata.img out/target/product/cubieboard/data
Creating filesystem with parameters:
Size: 134217728
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 32768
Block groups: 1
Reserved block group size: 7
Created filesystem with 15/8192 inodes and 1568/32768 blocks

home分了20G左右,编译完还提示空间不足150M,真担心空间不够。看cubieboard-tv-sdk居然占了19.9G。
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ ls out/target/product/cubieboard/ -l
总用量 205932
-rw-rw-r–  1 uestc uestc        12  6月  6 05:14 android-info.txt
-rw-r–r–  1 uestc uestc   5195776  6月  6 05:14 boot.img
-rw-rw-r–  1 uestc uestc     15845  6月  5 23:05 clean_steps.mk
drwxrwxr-x  4 uestc uestc      4096  6月  6 00:29 data
-rw-rw-r–  1 uestc uestc     56486  6月  6 05:14 installed-files.txt
-rwxrwxr-x  1 uestc uestc   4214976  6月  5 23:53 kernel
drwxrwxr-x 15 uestc uestc      4096  6月  6 04:56 obj
-rw-rw-r–  1 uestc uestc       557  6月  5 23:05 previous_build_config.mk
-rw-rw-r–  1 uestc uestc    974999  6月  6 05:14 ramdisk.img
-rw-rw-r–  1 uestc uestc   1314657  6月  6 05:14 ramdisk-recovery.img
drwxrwxr-x  3 uestc uestc      4096  6月  6 05:14 recovery
-rwxrwxr-x  1 uestc uestc       290  6月  6 00:29 recovery.fstab
-rw-r–r–  1 uestc uestc   5533696  6月  6 05:14 recovery.img
drwxrwxr-x  8 uestc uestc      4096  6月  6 00:30 root
drwxrwxr-x  5 uestc uestc      4096  6月  6 04:51 symbols
drwxrwxr-x 13 uestc uestc      4096  6月  6 04:10 system
-rw-r–r–  1 uestc uestc 187086592  6月  6 05:14 system.img
-rw-r–r–  1 uestc uestc   6422724  6月  6 05:15 userdata.img
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$
三、打包、测试
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ chmod +x ./tools/pack-cm.sh
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ ./tools/pack-cm.sh
!!!Packing for crane!!!
“chips/sun4i/configs/crane/default/env_mmc.cfg” -> “out/env_mmc.cfg”
“chips/sun4i/configs/crane/default/env_nand.cfg” -> “out/env_nand.cfg”
“chips/sun4i/configs/crane/default/image.cfg” -> “out/image.cfg”
“chips/sun4i/configs/crane/cubieboard/sys_config1.fex” -> “out/sys_config1.fex”
“chips/sun4i/configs/crane/cubieboard/sys_config.fex” -> “out/sys_config.fex”
cp: 无法获取”/u-boot.bin” 的文件状态(stat): 没有那个文件或目录
./pack: 行 172: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/script: 无法执行二进制文件
./pack: 行 173: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/script: 无法执行二进制文件
./pack: 行 174: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/update_23: 无法执行二进制文件
./pack: 行 175: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/update_23: 无法执行二进制文件
cp: 无法获取”sys_config1.bin” 的文件状态(stat): 没有那个文件或目录
cp: 无法获取”sys_config1.bin” 的文件状态(stat): 没有那个文件或目录
./pack: 行 180: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/update_mbr: 无法执行二进制文件
mkdir: 已创建目录 “bootfs/vendor”
mkdir: 已创建目录 “bootfs/vendor/system”
mkdir: 已创建目录 “bootfs/vendor/system/media”
disk : c
CopyRootToFS(/home/uestc/cubieboard-tv-sdk/tools/pack/out/bootfs)
c:\linux
c:\sprite
c:\vendor
c:\vendor\system
c:\vendor\system\media
c:\os_show
c:\magic.bin
find magic !!
RealLen=0x68BC00
CPlugin Free lib
CPlugin Free lib
FileLength=68bc00 FileSizeHigh=0
FileLength=40000 FileSizeHigh=0
FileLength=4f4800 FileSizeHigh=0
FileLength=b26b700 FileSizeHigh=0
FileLength=547000 FileSizeHigh=0
/home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/eDragonEx//home/uestc/cubieboard-tv-sdk/tools/pack/outFile dlinfo.fex Not ExistBuildImg 360
Dragon execute image.cfg Failed ! 360
CPlugin Free lib
CPlugin Free lib
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$
打包还是没成功,和以前的错误一样,拷贝一个u-boot.bin后还有如下问题。
uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$ ./tools/pack-cm.sh !!!Packing for crane!!!
“chips/sun4i/configs/crane/default/env_mmc.cfg” -> “out/env_mmc.cfg”
“chips/sun4i/configs/crane/default/env_nand.cfg” -> “out/env_nand.cfg”
“chips/sun4i/configs/crane/default/image.cfg” -> “out/image.cfg”
“chips/sun4i/configs/crane/cubieboard/sys_config1.fex” -> “out/sys_config1.fex”
“chips/sun4i/configs/crane/cubieboard/sys_config.fex” -> “out/sys_config.fex”
“/u-boot.bin” -> “bootfs/linux/u-boot.bin”
./pack: 行 172: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/script: 无法执行二进制文件
./pack: 行 173: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/script: 无法执行二进制文件
./pack: 行 174: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/update_23: 无法执行二进制文件
./pack: 行 175: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/update_23: 无法执行二进制文件
cp: 无法获取”sys_config1.bin” 的文件状态(stat): 没有那个文件或目录
cp: 无法获取”sys_config1.bin” 的文件状态(stat): 没有那个文件或目录
./pack: 行 180: /home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/mod_update/update_mbr: 无法执行二进制文件
mkdir: 已创建目录 “bootfs/vendor”
mkdir: 已创建目录 “bootfs/vendor/system”
mkdir: 已创建目录 “bootfs/vendor/system/media”
disk : c
CopyRootToFS(/home/uestc/cubieboard-tv-sdk/tools/pack/out/bootfs)
c:\linux
c:\sprite
c:\vendor
c:\vendor\system
c:\vendor\system\media
c:\os_show
c:\magic.bin
find magic !!
RealLen=0x68BC00
CPlugin Free lib
CPlugin Free lib
FileLength=68bc00 FileSizeHigh=0
FileLength=40000 FileSizeHigh=0
FileLength=4f4800 FileSizeHigh=0
FileLength=b26b700 FileSizeHigh=0
FileLength=547000 FileSizeHigh=0
/home/uestc/cubieboard-tv-sdk/tools/pack/pctools/linux/eDragonEx//home/uestc/cubieboard-tv-sdk/tools/pack/outFile dlinfo.fex Not ExistBuildImg 360
Dragon execute image.cfg Failed ! 360
CPlugin Free lib
CPlugin Free lib

uestc@uestc-ThinkPad-T43:~/cubieboard-tv-sdk$

我前几天在Ubuntu 10.04上也遇到这样的问题,网上有回答没有安装u-boot-tools之类的包,发现在Ubuntu 10.04安不上没有源。换成Ubuntu 12.04,u-boot-tools等包是安上了,但同样报错,贴出来,有没有遇到类似问题的,还在解决中……

你可能感兴趣的:(liunx,arduino,pcduino,minipc)