1、下载源码
git clone https://github.com/fuchsia-mirror/zircon
2、安装工具链
如果你的开发环境是Linux,已有预编译的工具链可直接进行下载,只需在Zircon的工作目录下运行下列脚本即可:
./scripts/download-prebuilt
3、构建Zircon
对于aarch64
make -j4 arm64
对于x64
make -j4 x64
构建生成的文件位于zircon/build-{arm64,x64}下
4、运行
# for aarch64
./scripts/run-zircon-arm64
# for x86
./scripts/run-zircon-x64
这里以arm64为例子
pomelo@pomelo-mj:~/work/zircon/zircon$ ./scripts/run-zircon-arm64
CMDLINE: TERM=xterm-256color kernel.entropy-mixin=8d417aca1555bba28fbb63719ba097e90818464c50ab8434cefd92258ce4ee3c kernel.halt-on-panic=true
+ exec /home/pomelo/work/zircon/zircon/scripts/../prebuilt/downloads/qemu/bin/qemu-system-aarch64 -kernel /home/pomelo/work/zircon/zircon/build-arm64/qemu-boot-shim.bin -initrd /home/pomelo/work/zircon/zircon/build-arm64/zircon.zbi -m 2048 -nographic -net none -smp 4 -machine virtualization=true -cpu cortex-a53 -machine virt,gic_version=3 -append 'TERM=xterm-256color kernel.entropy-mixin=8d417aca1555bba28fbb63719ba097e90818464c50ab8434cefd92258ce4ee3c kernel.halt-on-panic=true '
[00000.000] 00000.00000> PMM: boot reserve add [0x48ba0000, 0x48d29fff]
[00000.000] 00000.00000> mem_arena.base 0x40000000 size 0x8000000
[00000.000] 00000.00000> overriding mem arena 0 base from FDT: 0x40000000
[00000.000] 00000.00000> overriding mem arena 0 size from FDT: 0x80000000
[00000.000] 00000.00000> detected GICv3
[00000.000] 00000.00000> arm generic timer freq 62500000 Hz
[00000.021] 00000.00000> cntpct_per_ns: 00000000.1000000000000000
[00000.021] 00000.00000> ns_per_cntpct: 00000010.0000000000000000
[00000.022] 00000.00000> test_time_conversion_check_result:243: FAIL, off by 72057594037927936
[00000.022] 00000.00000> reserving ramdisk phys range [0x48000000, 0x48a75fff]
[00000.022] 00000.00000> PMM: boot reserve add [0x48000000, 0x48a75fff]
[00000.022] 00000.00000> memory limit lib returned an error (-2), falling back to default arena
[00000.060] 00000.00000> PMM: boot reserve marking WIRED [0x48000000, 0x48a75fff]
[00000.061] 00000.00000> PMM: boot reserve marking WIRED [0x48ba0000, 0x48d29fff]
[00000.062] 00000.00000>
[00000.062] 00000.00000> welcome to Zircon
[00000.062] 00000.00000>
[00000.062] 00000.00000> KASLR: .text section at 0xffffffff10000000
[00000.062] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10092570 (global_prng_seed) at level 0x30000, flags 0x1
[00000.086] 00000.00000> initializing vm pre-heap
[00000.087] 00000.00000> VM: marking boot alloc used range [0x48d2a000, 0x48d2f040)
[00000.087] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10034670 (elf_build_id) at level 0x4fffe, flags 0x1
[00000.087] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10034840 (version) at level 0x4ffff, flags 0x1
[00000.087] 00000.00000> version:
[00000.087] 00000.00000> arch: arm64
[00000.087] 00000.00000> platform: generic-arm
[00000.087] 00000.00000> target: arm64
[00000.087] 00000.00000> project: arm64
[00000.087] 00000.00000> buildid: git-3719298073ad6adc5491a1f2a169af5293314208-dirty
[00000.087] 00000.00000> ELF build ID: b6fe00bc6e37bd808a33d38bb4cc361a4ba092ec
[00000.087] 00000.00000> initializing heap
[00000.088] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10001010 (arm_resource_init) at level 0x50000, flags 0x1
[00000.089] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10091210 (console) at level 0x50000, flags 0x1
[00000.089] 00000.00000> initializing vm
[00000.089] 00000.00000> VM: reserving kernel region [0xffffffff10000000, 0xffffffff100d5000) flags 0x28 name 'kernel_code'
[00000.093] 00000.00000> VM: reserving kernel region [0xffffffff100d5000, 0xffffffff10110000) flags 0x8 name 'kernel_rodata'
[00000.094] 00000.00000> VM: reserving kernel region [0xffffffff10110000, 0xffffffff10119000) flags 0x18 name 'kernel_data'
[00000.094] 00000.00000> VM: reserving kernel region [0xffffffff10120000, 0xffffffff1018a000) flags 0x18 name 'kernel_bss'
[00000.096] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10001000 (platform_postvm) at level 0x60000, flags 0x1
[00000.096] 00000.00000> CreateSubVmarInternal:114: warning: mapping periph has conflicting cache policies: vmo 00 arch_mmu_flags 02.
[00000.096] 00000.00000> initializing kernel
[00000.096] 00000.00000> initializing mp
[00000.096] 00000.00000> initializing timers
[00000.096] 00000.00000> INIT: cpu 0, calling hook 0xffffffff1002ac80 (debuglog) at level 0x7ffff, flags 0x1
[00000.098] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10080930 (thread_set_priority_experiment) at level 0x7ffff, flags 0x1
[00000.098] 00000.00000> thread set priority experiment is : ENABLED
[00000.098] 00000.00000> INIT: cpu 0, calling hook 0xffffffff100927c0 (global_prng_thread_safe) at level 0x7ffff, flags 0x1
[00000.098] 00000.00000> creating bootstrap completion thread
[00000.109] 00000.00000> top of bootstrap2()
[00000.110] 00000.00000> INIT: cpu 0, calling hook 0xffffffff100200e0 (dpc) at level 0x80000, flags 0x1
[00000.115] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10041130 (libobject) at level 0x80000, flags 0x1
[00000.116] 00000.00000> OOM: started thread
[00000.117] 00000.00000> ARM boot EL2
[00000.117] 00000.00000> ARM cpu 0: midr 0x410fd034 'ARM Cortex-a53 r0p4' mpidr 0x80000000 aff 0:0:0:0
[00000.117] 00000.00000> ARM Features: fp asimd aes pmull sha1 sha2 crc32
[00000.117] 00000.00000> ARM cache line sizes: icache 64 dcache 64 zva 64
[00000.118] 00000.00000> ==== ARM64 CACHE INFO CORE 0 ====
[00000.118] 00000.00000> Inner Boundary = L0
[00000.118] 00000.00000> Level of Unification Uniprocessor = L1
[00000.118] 00000.00000> Level of Coherence = L2
[00000.118] 00000.00000> Level of Unification Inner Shareable = L1
[00000.118] 00000.00000> L1 Details: Data Cache, sets=128, associativity=4, line size=64 bytes
[00000.118] 00000.00000> Instruction Cache, sets=256, associativity=2, line size=64 bytes
[00000.118] 00000.00000> L2 Details: Unified Cache, sets=1024, associativity=16, line size=64 bytes
[00000.118] 00000.00000> L3 Details: Not Implemented
[00000.118] 00000.00000> L4 Details: Not Implemented
[00000.118] 00000.00000> L5 Details: Not Implemented
[00000.118] 00000.00000> L6 Details: Not Implemented
[00000.118] 00000.00000> L7 Details: Not Implemented
[00000.119] 00000.00000> initializing platform
[00000.119] 00000.00000> Trying to start cpu 0:1 returned: 0
[00000.119] 00000.00000> Trying to start cpu 0:2 returned: 0
[00000.120] 00000.00000> INIT: cpu 2, calling hook 0xffffffff1001c800 (arm_generic_timer_init_secondary_cpu) at level 0x7ffff, flags 0x2
[00000.120] 00000.00000> Trying to start cpu 0:3 returned: 0
[00000.120] 00000.00000> initializing target
[00000.120] 00000.00000> INIT: cpu 0, calling hook 0xffffffff1001c210 (platform_dev_init) at level 0xa0000, flags 0x1
[00000.120] 00000.00000> INIT: cpu 1, calling hook 0xffffffff1001c800 (arm_generic_timer_init_secondary_cpu) at level 0x7ffff, flags 0x2
[00000.120] 00000.00000> ARM cpu 1: midr 0x410fd034 'ARM Cortex-a53 r0p4' mpidr 0x80000001 aff 0:0:0:1
[00000.120] 00000.00000> ARM cpu 2: midr 0x410fd034 'ARM Cortex-a53 r0p4' mpidr 0x80000002 aff 0:0:0:2
[00000.120] 00000.00000> entering scheduler on cpu 1
[00000.120] 00000.00000> entering scheduler on cpu 2
[00000.121] 00000.00000> UART: started IRQ driven TX
[00000.121] 00000.00000> INIT: cpu 3, calling hook 0xffffffff1001c800 (arm_generic_timer_init_secondary_cpu) at level 0x7ffff, flags 0x2
[00000.122] 00000.00000> ARM cpu 3: midr 0x410fd034 'ARM Cortex-a53 r0p4' mpidr 0x80000003 aff 0:0:0:3
[00000.122] 00000.00000> entering scheduler on cpu 3
[00000.136] 00000.00000> moving to last init level
[00000.151] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10032820 (ktrace) at level 0xc0000, flags 0x1
[00000.214] 00000.00000> ktrace: buffer at 0xffff008f9239d000 (33554432 bytes)
[00000.214] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10034660 (userboot) at level 0xc0000, flags 0x1
[00000.214] 00000.00000> userboot: ramdisk 0xa76000 @ 0xffff000048000000
[00000.217] 00000.00000> nvram-crashlog: bad header: e59f0028e59f2028 e5821000e3a01001 e5821004e3a010ff e320f003f57ff04f
[00000.217] 00000.00000> nvram-crashlog: bad header: e59f0028e59f2028 e5821000e3a01001 e5821004e3a010ff e320f003f57ff04f
[00000.226] 00000.00000> userboot: userboot rodata 0 @ [0x6a247dd9d000,0x6a247dda0000)
[00000.226] 00000.00000> userboot: userboot code 0x3000 @ [0x6a247dda0000,0x6a247ddaa000)
[00000.226] 00000.00000> userboot: vdso/full rodata 0 @ [0x6a247ddaa000,0x6a247ddb0000)
[00000.227] 00000.00000> userboot: vdso/full code 0x6000 @ [0x6a247ddb0000,0x6a247ddb1000)
[00000.230] 00000.00000> userboot: entry point @ 0x6a247dda0c20
[00000.233] 00000.00000> INIT: cpu 0, calling hook 0xffffffff10091c20 (kernel_shell) at level 0xc0000, flags 0x1
[00000.239] 01030.01037> userboot: option "TERM=xterm-256color"
[00000.239] 01030.01037> userboot: option "kernel.entropy-mixin.redacted=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
[00000.239] 01030.01037> userboot: option "kernel.halt-on-panic=true"
[00000.512] 01030.01037> userboot: searching bootfs for 'bin/devmgr'
[00000.514] 01030.01037> userboot: 'bin/devmgr' has PT_INTERP "lib/ld.so.1"
[00000.514] 01030.01037> userboot: searching bootfs for 'lib/ld.so.1'
[00000.516] 01030.01037> userboot: userboot: loaded lib/ld.so.1 at 0x8dec5162e000, entry point 0x8dec516b01e0
[00000.517] 01030.01037> userboot: userboot: loaded vDSO at 0xd79352ad3000, entry point 0x0
[00000.519] 01030.01037> userboot: process bin/devmgr started.
[00000.519] 01030.01037> userboot: waiting for loader-service requests...
[00000.527] 01030.01037> userboot: searching bootfs for 'lib/libasync-default.so'
[00000.529] 01030.01037> userboot: searching bootfs for 'lib/liblaunchpad.so'
[00000.530] 01030.01037> userboot: searching bootfs for 'lib/libfdio.so'
[00000.534] 01044.01047> {{{reset}}}
[00000.535] 01044.01047> {{{module:0::elf:6e38bd4d461e82b4e77a92bb874ef1eb0c4970e5}}}
[00000.535] 01044.01047> {{{mmap:0xb83eec377000:0x1c000:load:0:rx:0}}}
[00000.535] 01044.01047> {{{mmap:0xb83eec394000:0x2000:load:0:rw:0x1d000}}}
[00000.535] 01044.01047> dso: id=6e38bd4d461e82b4e77a92bb874ef1eb0c4970e5 base=0x0000b83eec377000 name=
[00000.535] 01044.01047> {{{module:0x3:libasync-default.so:elf:44903e6f21fd3f9f0549d0f9222bf18c5a8b88f4}}}
[00000.536] 01044.01047> {{{mmap:0x2b51e2a2c000:0x1000:load:0x3:rx:0}}}
[00000.537] 01044.01047> {{{mmap:0x2b51e2a2d000:0x1000:load:0x3:rw:0x1000}}}
[00000.537] 01044.01047> dso: id=44903e6f21fd3f9f0549d0f9222bf18c5a8b88f4 base=0x00002b51e2a2c000 name=libasync-default.so
[00000.537] 01044.01047> {{{module:0x4:liblaunchpad.so:elf:0820b89d3d7ea5948836d76c0efbbfbc6a1cc118}}}
[00000.537] 01044.01047> {{{mmap:0xf3fdde83f000:0x7000:load:0x4:rx:0}}}
[00000.537] 01044.01047> {{{mmap:0xf3fdde846000:0x2000:load:0x4:rw:0x7000}}}
[00000.537] 01044.01047> dso: id=0820b89d3d7ea5948836d76c0efbbfbc6a1cc118 base=0x0000f3fdde83f000 name=liblaunchpad.so
[00000.542] 01044.01047> {{{module:0x5:libfdio.so:elf:a644b4c85b725f2af4df3037ee531b16e9073616}}}
[00000.542] 01044.01047> {{{mmap:0x291992326000:0x21000:load:0x5:rx:0}}}
[00000.542] 01044.01047> {{{mmap:0x291992348000:0x4000:load:0x5:rw:0x22000}}}
[00000.542] 01044.01047> dso: id=a644b4c85b725f2af4df3037ee531b16e9073616 base=0x0000291992326000 name=libfdio.so
[00000.543] 01044.01047> {{{module:0x2::elf:fce2bc2f2815ef6bd44e72371c7027033f856327}}}
[00000.544] 01044.01047> {{{mmap:0xd79352ad3000:0x6000:load:0x2:r:0}}}
[00000.544] 01044.01047> {{{mmap:0xd79352ad9000:0x1000:load:0x2:rx:0x6000}}}
[00000.544] 01044.01047> dso: id=fce2bc2f2815ef6bd44e72371c7027033f856327 base=0x0000d79352ad3000 name=
[00000.545] 01044.01047> {{{module:0x1:libc.so:elf:2f27e4d4cf317a3089e54ab2cada01f52489d4c2}}}
[00000.545] 01044.01047> {{{mmap:0x8dec5162e000:0xce000:load:0x1:rx:0}}}
[00000.545] 01044.01047> {{{mmap:0x8dec516fd000:0x6000:load:0x1:rw:0xcf000}}}
[00000.547] 01044.01047> dso: id=2f27e4d4cf317a3089e54ab2cada01f52489d4c2 base=0x00008dec5162e000 name=libc.so
[00000.559] 01030.01037> userboot: loader-service channel peer closed
[00000.559] 01030.01037> userboot: finished!
[00000.562] 01044.01047> devmgr: main()
[00000.562] 01044.01047> devmgr: init
[00000.564] 01044.01047> coordinator_init()
[00000.575] 01044.01047> bootfs_open: 'config/devmgr' not found
[00000.575] 01044.01047> cmdline: TERM=xterm-256color
[00000.575] 01044.01047> cmdline: kernel.entropy-mixin.redacted=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[00000.575] 01044.01047> cmdline: kernel.halt-on-panic=true
[00000.576] 01044.01047> devmgr: svc init
[00000.589] 01044.01047> devmgr: launch /boot/bin/svchost (svchost) OK
[00000.589] 01044.01047> devmgr: vfs init
[00000.602] 01044.01047> devmgr: launch /boot/bin/fshost (fshost) OK
[00000.619] 01044.01047> devmgr: coordinator()
[00000.676] 01044.01167> devmgr: shell startup
[00000.721] 01126.01150> fshost: started.
[00000.780] 01044.01175> devmgr: launch /boot/bin/crashsvc (crashsvc) OK
[00000.811] 01044.01162> devmgr: launch /boot/bin/pwrbtn-monitor (pwrbtn-monitor) OK
[00000.834] 01044.01175> devmgr: launch /boot/bin/netsvc (netsvc) OK
[00000.875] 01044.01175> devmgr: launch /boot/bin/virtual-console (virtual-console) OK
[00000.997] 01044.01047> devcoord: launch devhost 'devhost:sys': pid=1904
[00001.026] 01044.01047> devcoord: launch devhost 'devhost:test': pid=1937
[00001.067] 01044.01047> devcoord: launch devhost 'devhost:root': pid=1981
[00001.096] 01044.01047> devcoord: launch devhost 'devhost:misc': pid=2049
[00001.222] 01044.01047> devcoord: launch devhost 'devhost:pdev:pci': pid=2268
[00001.251] 01044.01047> devcoord: launch devhost 'devhost:pdev:00:00:6': pid=2324
[00001.302] 01044.01047> devcoord: launch devhost 'devhost:pdev:01:01:1': pid=2391
[00001.387] 01044.01167> devmgr: launch /boot/bin/sh (sh:console) OK
[00001.609] 02391.02434> qemu_test_bind: qemu-test-parent
[00001.655] 02391.02434> qemu_test_bind: qemu-test-child-1
$ [00001.700] 02391.02434> qemu_test_bind: qemu-test-child-2
[00001.705] 02391.02434> qemu_test_bind: qemu-test-child-3
$
$
$ ls
d 1 0 .
d 2 0 tmp
d 2 0 pkgfs
d 2 0 blob
d 2 0 volume
d 2 0 install
d 2 0 system
d 2 0 data
d 7 0 boot
d 1 0 dev
d 1 0 svc
退出qemu
先同时按住Ctrl和a,松开再按x