编译 Chromium OS

{ 撰文/yang }

粗略的介绍一下 Chromium OS 的编译过程。

安装下面的依赖:


sudo apt-get install subversion pkg-config python perl g++ g++-multilib bison
flex gperf libnss3-dev libgtk2.0-dev libnspr4-0d libasound2-dev libnspr4-dev
msttcorefonts libgconf2-dev libcairo2-dev libdbus-1-dev wdiff lighttpd php5-cgi
sun-java6-fonts git-core  

然后,使用 gclient 获取 Chromium OS 的源码目录(四百多兆):


mkdir chromiumos  
cd chromiumos  
gclient config http://src.chromium.org/git/chromiumos.git  
gclient sync  

编译脚本都在 chromiumos/src/scripts 下面,依次执行下面几个脚本:

./make_local_repo.sh  

运行这个脚本之前,确保安装了 reprepro,否则会提示找不到命令,这时,需要将 chromiumos/repo 目录删除才可以重新执行 make_local_repro.sh 脚本,汗~这个搞了好久 Orz。

./make_chroot.sh  

创建 chroot 编译环境后,需要下载 Chrome 浏览器,改名为 chrome-chromeos.zip 并放到 ~/chromiumos/src/build/x86/local_assets,这个目录需要自己依次创建。

然后进入 chroot 环境:

./enter_chroot.sh

这时,可以创建一个脱机用户,为了防止没有网络链接的情况下无法登录:

cd ../platform/pam_google && ./enable_localaccount.sh USERNAME 

再依次编译软件包和内核,创建磁盘镜像:

./build_platform_packages.sh  
./build_kernel.sh  
./build_image.sh  

脚本执行完毕后,会如下提示:

Done. Image created in
/home/yang/trunk/src/build/images/999.999.32809.061105-a1

然后会生成 rootfs.image 磁盘镜像,可以将该镜像转为虚拟机磁盘(vmdk):

./image_to_vmware.sh --from=~/Downloads/chromiumos/chromiumos.git/src/build/images/999.999.32809.061105-a1 --to=~/Downloads/chromiumos/chromiumos.git/src/build/images/999.999.32809.061105-a1/rootfs.vmdk

截图:

ChromiumOS

在 VMware 没有体验到好处,看来要用到我的 Wind U100 上网本了^^

{ Source. Thanks yang. }

Read More:

19 Comments

  1. 1 shellexy Commented @ 2009-11-24 16:13Reply to this comment

    目前似乎还是 Intel Moblin 更牛,

    Moblin 是完整的 Linux,可是启动时间只有 5 秒,比不完整的 ChromeOS 还快。

  2. 2 yang Commented @ 2009-11-24 16:23Reply to this comment

    @shellexy: 不是同一个概念的linux操作系统。

  3. 3 autoxbc Commented @ 2009-11-24 16:46Reply to this comment

    说对了,炒的就是个概念。

  4. 4 liangsuilong Commented @ 2009-11-24 17:22Reply to this comment

    Just for ia32, x86_64玩不到..

  5. 5 kidfruit Commented @ 2009-11-24 18:10Reply to this comment

    google这次纯粹玩概念…………

  6. 6 autoxbc Commented @ 2009-11-24 18:19Reply to this comment

    @Toy:

    正文代码高亮用了

    <pre>
    <code>
    这样的结构,其中 pre 标签会强制浏览器按照原始 html 格式输出,遇到特别长的命令会撑破页面结构,比如本文截图上面的那一句。可以考虑去掉 pre 标签或者添加 code {white-space:normal}。

  7. 7 autoxbc Commented @ 2009-11-24 18:21Reply to this comment

    怕了,手写的标签也被解析了。说的是 <pre>   <code>

  8. 8 Toy Commented @ 2009-11-24 18:28Reply to this comment

    @autoxbc: Thanks.

  9. 9 hufey Commented @ 2009-11-24 22:05Reply to this comment

    gclient是哪个包里的?我的ubuntu 910里没有

  10. 10 leos Commented @ 2009-11-25 9:15Reply to this comment

    昨天下载过vm的磁盘文件,有些网址就是连不上,比如说第一个就链接不上,郁闷……而且我自己的帐号无法登录,只好使用Mark!

  11. 11 timberg Commented @ 2009-11-25 18:31Reply to this comment

    gclient可以在 Google上面搜索到,syn 下载,是python程序,能运行,但是把chromium的源代码弄不下来,真希望有完整打包下载的

  12. 12 黑日白月 Commented @ 2009-11-25 19:58Reply to this comment

    其实看了别人的虚拟机演示视频,昨天又自己在别人机子上尝试了下 Moblin 2.1(我的本本是 AMD,囧……),感觉还是后者比较有前途……

  13. 13 yang Commented @ 2009-11-25 20:06Reply to this comment

    @黑日白月: 觉得moblin只是个启动很快的linux系统罢了。个人觉得,chrome OS在现在还是个展览版,等到正式版的时候,用户体验包括UI等肯定会有大的改变。

  14. 14 yang Commented @ 2009-11-25 20:09Reply to this comment

    @timberg: 有打包的啊。直接下载这个:http://build.chromium.org/buildbot/archives/chromiumos-0.4.22.8.tar.gz,应该没有河蟹吧?

  15. 15 yang Commented @ 2009-11-25 20:10Reply to this comment

    @hufey: gclient是获取chromiumOS源码的工具。需要单独下载的。

  16. 16 kidfruit Commented @ 2009-11-25 20:23Reply to this comment

    @黑日白月: 虽然现阶段感觉moblin比chrome os要好。但是google在玩市场方面是Intel远不能及的,从现在chrome os的市场期待度和moblin的市场期待度就可以看出来了,即使chrome os还基本上啥都不能做,moblin已经可以使用…………

    一直都很坚持google是个广告公司和信息公司,不是软件公司…………但愿google不会害了linux…………

  17. 17 eric Commented @ 2009-11-26 3:57Reply to this comment

    对于卖广告的系统毫无兴趣。

  18. 18 King.xu Commented @ 2009-12-10 10:01Reply to this comment

    执行'svn checkout' 时发生一个错误:"301 Moved Permanently"

    king@king-laptop:~/chromium$gclient config http://src.chromium.org/git/chromiumos.git king@king-laptop:~/chromium$ gclient sync

    ________ running 'svn checkout http://src.chromium.org/git/chromiumos.git /home/king/chromium/chromiumos.git' in '/home/king/chromium' svn: Repository moved permanently to 'http://src.chromium.org/git/chromiumos.git/'; please relocate Error: failed to run command: svn checkout http://src.chromium.org/git/chromiumos.git /home/king/chromium/chromiumos.git king@king-laptop:~/chromium$

  19. 19 lazyfai Commented @ 2009-12-14 17:06Reply to this comment

    我自己搞了一个中文化版本,有兴趣的可以拿去看看... 还有是全世界最小的,只需 512M SD/USB http://www.xepc.org/