Android AOSP 基础二 Android 系统源码的整编和单编

参考:http://liuwangshu.cn/framework/aosp/3-compiling-aosp.html

编译之前,请安装并开启 kvm 的支持,文中有介绍。

...
The new table will be used at the next reboot.
The operation has completed successfully.

#### build completed successfully (06:20:25 (hh:mm:ss)) ####

wanglei@wanglei-virtual-machine:~$ emulator
emulator: WARNING: Couldn't find crash service executable /home/wanglei/prebuilts/android-emulator/linux-x86_64/emulator64-crash-service

emulator: WARNING: system partition size adjusted to match image file (2562 MB > 800 MB)

emulator: WARNING: cannot read adb public key file: /home/wanglei/.android/adbkey.pub
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM requires a CPU that supports vmx or svm
#############使用模拟器运行编译好的操作系统报错##############
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
wanglei@wanglei-virtual-machine:~$ egrep -c '(vmx|svm)' /proc/cpuinfo
0 #### 检查当前cpu是否支持虚拟化 0 不支持
wanglei@wanglei-virtual-machine:~$ 
##############解决方法######################
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
wanglei@wanglei-virtual-machine:~$ sudo rm /var/lib/dpkg/lock-frontend 
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
wanglei@wanglei-virtual-machine:~$ sudo rm /var/lib/dpkg/lock
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
E: dpkg 被中断,您必须手工运行 ‘sudo dpkg --configure -a’ 解决此问题。
wanglei@wanglei-virtual-machine:~$ sudo dpkg --configure -a
dpkg: 错误: 另外一个进程已经为 dpkg 状态数据库 加锁
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?
wanglei@wanglei-virtual-machine:~$ sudo rm /var/lib/dpkg/lock
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  at augeas-lenses cpu-checker dctrl-tools debootstrap devscripts dmeventd dput ebtables ibverbs-providers ipxe-qemu ipxe-qemu-256k-compat-efi-roms kpartx libaio1 libaugeas0
  libb-hooks-endofscope-perl libb-hooks-op-check-perl libcacard0 libclass-method-modifiers-perl libclass-xsaccessor-perl libdata-optlist-perl libdevel-callchecker-perl
  libdevel-globaldestruction-perl libdevmapper-event1.02.1 libdistro-info-perl libdynaloader-functions-perl libfdt1 libfile-chdir-perl libfile-homedir-perl libfile-which-perl
  libgetopt-long-descriptive-perl libgit-wrapper-perl libibverbs1 libimport-into-perl libio-stringy-perl libiscsi7 liblist-compare-perl liblvm2app2.2 liblvm2cmd2.02
  libmodule-implementation-perl libmodule-runtime-perl libmoo-perl libnamespace-clean-perl libnetcf1 libnl-route-3-200 libnumber-compare-perl libnumber-range-perl
  libpackage-stash-perl libpackage-stash-xs-perl libparams-classify-perl libparams-util-perl libparams-validate-perl libpath-iterator-rule-perl libpath-tiny-perl
  libpod-constants-perl librados2 librbd1 librdmacm1 libreadline5 libregexp-pattern-license-perl librole-tiny-perl libsdl1.2debian libsort-key-perl libsort-versions-perl
  libspice-server1 libstrictures-perl libstring-copyright-perl libstring-escape-perl libsub-exporter-perl libsub-exporter-progressive-perl libsub-identify-perl
  libsub-install-perl libsub-quote-perl libtext-glob-perl libunicode-utf8-perl libusbredirparser1 libvariable-magic-perl libvirt-clients libvirt-daemon
  libvirt-daemon-driver-storage-rbd libvirt-daemon-system libvirt0 libxen-4.9 libxenstore3.0 licensecheck lvm2 msr-tools python-cheetah python-libvirt python-vm-builder
  python3-gpg python3-magic python3-unidiff qemu-block-extra qemu-system-common qemu-system-x86 qemu-utils seabios sharutils wdiff
建议安装:
  default-mta | mail-transport-agent augeas-doc debtags ubuntu-archive-keyring adequate autopkgtest bls-standalone bsd-mailx | mailx check-all-the-things cvs-buildpackage
  devscripts-el diffoscope disorderfs dose-extra duck faketime gnuplot how-can-i-help libnet-smtps-perl libterm-size-perl libyaml-syck-perl mozilla-devscripts mutt piuparts
  postgresql-client quilt ratt reprotest svn-buildpackage w3m debian-keyring equivs libsoap-lite-perl python3-paramiko mini-dinstall augeas-tools libscalar-number-perl
  libbareword-filehandles-perl libindirect-perl libmultidimensional-perl libvirt-daemon-driver-storage-gluster libvirt-daemon-driver-storage-sheepdog
  libvirt-daemon-driver-storage-zfs numad radvd auditd systemtap nfs-common zfsutils pm-utils thin-provisioning-tools python-markdown python-pygments python-memcache samba
  vde2 sgabios ovmf sharutils-doc wdiff-doc
E: 无法获得锁 /var/cache/apt/archives/lock - open (11: 资源暂时不可用)
E: 无法对目录 /var/cache/apt/archives/ 加锁
wanglei@wanglei-virtual-machine:~$ sudo rm /var/cache/apt/archives/lock 
wanglei@wanglei-virtual-machine:~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  at augeas-lenses cpu-checker dctrl-tools debootstrap devscripts dmeventd dput ebtables ibverbs-providers ipxe-qemu ipxe-qemu-256k-compat-efi-roms kpartx libaio1 libaugeas0
  libb-hooks-endofscope-perl libb-hooks-op-check-perl libcacard0 libclass-method-modifiers-perl libclass-xsaccessor-perl libdata-optlist-perl libdevel-callchecker-perl
  libdevel-globaldes
####################################################
wanglei@wanglei-virtual-machine:~$ check success or not
Command 'check' not found, did you mean:

  command 'fcheck' from deb fcheck
  command 'mcheck' from deb mtools
  command 'icheck' from deb icheck
  command 'acheck' from deb acheck
  command 'hcheck' from deb ganeti
  command 'hcheck' from deb ganeti-htools
  command 'vcheck' from deb vcheck
  command 'chuck' from deb chuck

Try: sudo apt install <deb name>

wanglei@wanglei-virtual-machine:~$ Check success or not
Check:未找到命令
wanglei@wanglei-virtual-machine:~$ sudo kvm-ok
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

参考:https://blog.csdn.net/fengxingzhe001/article/details/78060126

sudo adduser 报错 

参考:https://juejin.im/post/5cb45264e51d456e720778f3

wanglei@wanglei-virtual-machine:~$ sudo kvm-ok INFO: Your CPU does not support KVM extensions KVM acceleration can NOT be used

参考:https://blog.csdn.net/dintingin/article/details/69940685

关闭虚拟机(init 0),修改虚拟机设置

重新启动后,再次检查

wanglei@wanglei-virtual-machine:~$ sudo kvm-ok
[sudo] wanglei 的密码: 
INFO: /dev/kvm exists
KVM acceleration can be used # 可以使用kvm加速度
wanglei@wanglei-virtual-machine:~$ 

 

发表评论

zh_CNChinese
zh_CNChinese