export GYP_CHROMIUM_NO_ACTION=1 # don't process gyp
gclient sync
cd src
./build/install-build-deps-android.sh
. ./build/android/envsetup.sh
gn gen out/Default --args='target_os="android" is_debug=false'
在上一篇文章<< Chromium for Android开源了 >>中谈到了Google已经完全开源了Chromium for Android,这样我们就完全可以开发与Chrome for Android媲美的Android浏览器了。通常浏览器的一些新特性和新功能会先出现在Chromium for Android上,稳定后才会出现在Chrome for Android上,如果我们基于Chromium for Android开发浏览器产品,在新特性和新功能方面不会落后于Chrome浏览器.
搜索了一下相关新闻,大约在2015年5月份开始,chromium中开始加入了chrome for android的源码。从2012年开始,chromium中开始出现Android的移植代码,但只有Content API和ContentShell,离一个完备的浏览器还有一定的距离。当然,基于Content API开发浏览器也是可行的,当年就是这么干的。Chromium for Android和Chrome for Android并非完全一样,就如同桌面版Chromium浏览器和Chrome浏览器之间的区别。
chromium移植已经接近尾声,正在冲刺beta版本。不过越往后面,越是一些难啃的骨头。虽然背靠chromium这座大山,但是网页的复杂性超乎想象。更郁闷的是,有些BUG在chrome for android上没有,但在我们的浏览器上存在。因此经常会有这样的质疑:人家的chrome浏览器好好的,你做的浏览器为什么会有这样的问题。面对这样的质疑,真是有苦说不出。在有些人看来,别人都把源代码开放出来了,超过他们是理所当然的。没有办法,碰到难啃的骨头只能迎难而上了。好在chrome for android(V25之后的版本)开始支持自行定制了,虽然没法调试全部的代码,但是部分代码还是可以调试的。这样在分析我们和chrome浏览器在代码执行路径上的差异,也许能够提供一种思路。下面就谈谈如何构建自己的chrome for android。
使用您的android设备下载chrome for android,如果能够翻墙的话就在Google Play下载,国内的应用商店也一般有,这里就不详细说了。
打开您的android设备上的chrome for android,地址栏中输入chrome://version
chromium项目使用了gyp构建系统,gyp的全称是”Generate Your Projects”。gyp构建系统使用的并不广泛,目前已知的只有chromium开源项目采用了这一构建系统。官方虽然也有一些文档,但都是一些比较基础的指南,总体来说缺少详细的文档来指导开发人员在项目中使用。
因为研究chromium的缘故,所以对gyp构建系统也有一些了解,在使用中也碰到一些问题,本文所要探讨的是如何输出gyp的变量值。这个问题的场景是这样的:在gyp中定义了变量,但是经过多重gypi包含,在别的gyp文件中可能对变量值进行了赋值。处于调试目的,我们希望输出gyp变量的值。
%u A single URL. Local files may either be passed as file: URLs or as file path.
%U A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path.
也就是说,加入了%U参数,可以传递多个URL给Chrome浏览器,浏览器会依次打开各URL。比如您在文件管理器中选择了多个html文件,然后在鼠标右键菜单中点击”Open with Google Chrome”,Chrome浏览器就会依次打开所选的网页。
Code Description
%f A single file name, even if multiple files are selected. The system reading the desktop entry should recognize that the program in question cannot handle multiple file arguments, and it should should probably spawn and execute multiple copies of a program for each selected file if the program is not able to handle additional file arguments. If files are not on the local file system (i.e. are on HTTP or FTP locations), the files will be copied to the local file system and %f will be expanded to point at the temporary file. Used for programs that do not understand the URL syntax.
%F A list of files. Use for apps that can open several local files at once. Each file is passed as a separate argument to the executable program.
%u A single URL. Local files may either be passed as file: URLs or as file path.
%U A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path.
%d Deprecated.
%D Deprecated.
%n Deprecated.
%N Deprecated.
%i The Icon key of the desktop entry expanded as two arguments, first --icon and then the value of the Icon key. Should not expand to any arguments if the Icon key is empty or missing.
%c The translated name of the application as listed in the appropriate Name key in the desktop entry.
%k The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known.
%v Deprecated.
%m Deprecated.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
virtualbox-dkms virtualbox-qt
Suggested packages:
virtualbox-guest-additions-iso vde2
The following NEW packages will be installed:
virtualbox virtualbox-dkms virtualbox-qt
0 upgraded, 3 newly installed, 0 to remove and 29 not upgraded.
Need to get 0 B/20.5 MB of archives.
After this operation, 84.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
virtualbox virtualbox-dkms virtualbox-qt
Install these packages without verification? [y/N] y
Selecting previously unselected package virtualbox.
(Reading database ... 276049 files and directories currently installed.)
Preparing to unpack .../virtualbox_4.3.10-dfsg-1ubuntu3_amd64.deb ...
Unpacking virtualbox (4.3.10-dfsg-1ubuntu3) ...
Selecting previously unselected package virtualbox-dkms.
Preparing to unpack .../virtualbox-dkms_4.3.10-dfsg-1ubuntu3_all.deb ...
Unpacking virtualbox-dkms (4.3.10-dfsg-1ubuntu3) ...
Selecting previously unselected package virtualbox-qt.
Preparing to unpack .../virtualbox-qt_4.3.10-dfsg-1ubuntu3_amd64.deb ...
Unpacking virtualbox-qt (4.3.10-dfsg-1ubuntu3) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Setting up virtualbox (4.3.10-dfsg-1ubuntu3) ...
* Stopping VirtualBox kernel modules [ OK ]
* Starting VirtualBox kernel modules * No suitable module for running kernel found
[fail]
invoke-rc.d: initscript virtualbox, action "restart" failed.
Processing triggers for ureadahead (0.100.0-16) ...
Setting up virtualbox-dkms (4.3.10-dfsg-1ubuntu3) ...
Loading new virtualbox-4.3.10 DKMS files...
First Installation: checking all kernels...
Building only for 3.13.0-46-generic
Building initial module for 3.13.0-46-generic
Done.
vboxdrv:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.13.0-46-generic/updates/dkms/
vboxnetadp.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.13.0-46-generic/updates/dkms/
vboxnetflt.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.13.0-46-generic/updates/dkms/
vboxpci.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.13.0-46-generic/updates/dkms/
depmod....
DKMS: install completed.
* Stopping VirtualBox kernel modules [ OK ]
* Starting VirtualBox kernel modules [ OK ]
Setting up virtualbox-qt (4.3.10-dfsg-1ubuntu3) ...
这个时候virtualbox可以启动了。但是建立了虚拟机后,启动虚拟系统时提示:
1
VT-x is disabled in the BIOS
解决方法:
12345678
重启系统
长按 DEL 进入 BIOS
方向键切到 BIOS Features
选中如下选项
Intel Virtualization Technology
选择 Enable
按下 F10 保存并重启