一 、下载源码:
$ git clone
https://github.com/fuchsia-mirror/zircon.git
or $ git clone
https://fuchsia.googlesource.com/zircon
二、安装编译工具链:
进入源码目录执行(需要科学上网)
$ cd zircon
$ ./scripts/download-toolchain
三、编译Zircon:
$ make -j32 arm64
四、下载QEMU:
$ cd ..
$ git clone
https://fuchsia.googlesource.com/buildtools
$ cd buildtools
$ vim fuchsia.ensure
$ ./update.sh
注意:需要下载Google定制的QEMU,亲测QEMU官网或者Ubuntu仓库的QEMU无法正常运行Zircon,会报qemu-system-aarch64: Property '.virtualization' not found错误。
注意:可以节省下载时间,建议删除fuchsia.ensure中的其他内容,我们只需要下载qemu即可。
fuchsia.ensure最终的内容如下:
# Copyright 2017 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
$VerifiedPlatform linux-amd64
$VerifiedPlatform mac-amd64
@Subdir qemu
fuchsia/qemu/mac-amd64 git_revision:0f0027d617976b4cbb7b937d5836f8ef0ac25ba1
五、使用QEMU模拟运行Zircon:
$ cd ../zircon
$ ./scripts/run-zircon-arm64
运行结果见附录。
在终端中可以执行cd、ls、ps、top等命令,其他的需要进一步研究。
注意:./scripts/run-zircon-arm64会自动识别到magenta/scripts/../../buildtools/linux-x64/qemu/bin/qemu-system-aarch64
或者可以qemu-system-aarch64所在目录添加到环境变量中。
附录:
./scripts/run-zircon-arm64
+ echo CMDLINE: TERM=xterm-256color kernel.entropy-mixin=93aaa284aa63dab82825c15798a4d2c0cb84e21f05f1be6ba614beb9ae393c81 kernel.halt-on-panic=true
CMDLINE: TERM=xterm-256color kernel.entropy-mixin=93aaa284aa63dab82825c15798a4d2c0cb84e21f05f1be6ba614beb9ae393c81 kernel.halt-on-panic=true
+ exec qemu-system-aarch64 -m 2048 -nographic -net none -smp 4 -kernel /Users/xichangbao/Gitbox/magenta/build-arm64/zircon.bin -machine virtualization=true -cpu cortex-a53 -machine virt -initrd build-arm64/qemu-bootdata.bin -append 'TERM=xterm-256color kernel.entropy-mixin=93aaa284aa63dab82825c15798a4d2c0cb84e21f05f1be6ba614beb9ae393c81 kernel.halt-on-panic=true '
[00000.000] 00000.00000> PMM: boot reserve add [0x40080000, 0x40202fff]
[00000.000] 00000.00000> FDT: device tree located at [0x48800000, 0x4880ffff]
[00000.000] 00000.00000> PMM: boot reserve add [0x48800000, 0x4880ffff]
[00000.000] 00000.00000> kernel command line: TERM=xterm-256color kernel.entropy-mixin=93aaa284aa63dab82825c15798a4d2c0cb84e21f05f1be6ba614beb9ae393c81
[00000.000] 00000.00000> kernel.halt-on-panic=true
[00000.000] 00000.00000> detected GICv2
[00000.000] 00000.00000> arm generic timer freq 62500000 Hz
[00000.011] 00000.00000> cntpct_per_ns: 00000000.1000000000000000
[00000.011] 00000.00000> ns_per_cntpct: 00000010.0000000000000000
[00000.011] 00000.00000> test_time_conversion_check_result:270: FAIL, off by 72057594037927936
[00000.011] 00000.00000> mem bank 0: base 0x40000000 length 0x8000000
[00000.011] 00000.00000> periph mem bank 0: phys base 0 virt base 0xffffffffc0000000 length 0x40000000
[00000.012] 00000.00000> reserving ramdisk phys range [0x48000000, 0x4872efff]
[00000.012] 00000.00000> PMM: boot reserve add [0x48000000, 0x4872efff]
[00000.012] 00000.00000> boot structure at 0x48800000 seems to point to a FDT
[00000.012] 00000.00000> overriding mem arena 0 size from FDT: 0x80000000
[00000.012] 00000.00000> PMM: add arena 'sdram' [0x40000000, 0xbfffffff]
[00000.060] 00000.00000> PMM: boot reserve marking WIRED [0x40080000, 0x40202fff]
[00000.060] 00000.00000> PMM: boot reserve marking WIRED [0x48000000, 0x4872efff]
[00000.061] 00000.00000> PMM: boot reserve marking WIRED [0x48800000, 0x4880ffff]
[00000.061] 00000.00000>