⋊> /s/w/p/f/fuchsia on dd551fb3e4 sudo rm /usr/bin/python
⋊> /s/w/p/f/fuchsia on dd551fb3e4 sudo ln -s /usr/bin/python2 /usr/bin/python
执行fx set的时候提示数据收集
⋊> /s/w/p/f/fuchsia on dd551fb3e4 ./scripts/fx set core.x64 07:32:42
WARNING: Please opt in or out of fx metrics collection.
You will receive this warning until an option is selected.
To check what data we collect, run `fx metrics`
To opt in or out, run `fx metrics <enable|disable>
Generating compile_commands took 1113ms
Done. Made 25631 targets from 2150 files in 29551ms
看一下fx metrics的说明
When enabled, this tool creates a random unique user ID (UUID) for the Fuchsia
repository and uses that to collect the following anonymized metrics of
the session and user workflow in order to improve the user experience:
1. For every "fx" invocation:
- The output of "uname -rs" (Kernel name and release)
- The name of the "fx" subcommand invoked
- (in the future) Imports in BUILDDIR/args.gn for product and board
- (in the future) Value FUCHSIA_ARCH from BUILDDIR/fx.config
2. For the following subcomand(s) [set]:
- All arguments passed to the subcommand
3. (in the future) For the following subcomand(s) [set,build]:
- Time taken to complete
- Exit status
When metrics collection is disabled, any existing UUID is deleted, and a
new UUID will be created if metrics is later re-enabled.
When enabled, the UUID and the status are stored in /storage/wine/project/fuchsia/fuchsia/.fx-metrics-config
usage:
fx metrics
Show what metrics are collected when enabled
fx metrics status
Show if metrics collection is enabled or disabled
fx metrics [--log=LOG_FILE] enable
Enable metrics collection in fx tools
--log=<LOG_FILE> Log all metrics collected to LOG_FILE for
debugging purposes. The LOG_FILE setting is persisted
in a config file in the /tmp filesystem and will be
reset when the user logs out.
fx metrics disable
Disable metrics collection in fx tools
说的挺好的,比某些强制要权限的安卓软件强不少,我就启用了吧
⋊> /s/w/p/f/fuchsia on dd551fb3e4 ./scripts/fx metrics enable 07:37:04
Collection of metrics is now enabled for /storage/wine/project/fuchsia/fuchsia
重新set一下
⋊> /s/w/p/f/fuchsia on dd551fb3e4 ./scripts/fx set core.x64 07:37:10
Generating compile_commands took 604ms
Done. Made 25631 targets from 2150 files in 11538ms
于是开始编译fx full-build
⋊> /s/w/p/f/fuchsia on dd551fb3e4 time ./scripts/fx full-build
。。。。。。
ERROR: Unknown command full-build
Command exited with non-zero status 1
1.06user 0.38system 0:01.32elapsed 109%CPU (0avgtext+0avgdata 8120maxresident)k
0inputs+0outputs (0major+107996minor)pagefaults 0swaps
if [ -n "$IMAGE_FVM_RAW" ]; then
fvmimg="${imgdir}/fvm.blk"
args+=(-d -D "${fvmimg}" --diskfmt=raw)
stat_flags=()
if [[ $(uname) == "Darwin" ]]; then
stat_flags+=("-x")
fi
stat_output=$(stat "${stat_flags[@]}" "${FUCHSIA_BUILD_DIR}/${IMAGE_FVM_RAW}")
if [[ "$stat_output" =~ Size:\ ([0-9]+) ]]; then
size="${BASH_REMATCH[1]}"
newsize=$(($size * 2))
# We must take a copy of the build artifact, rather than re-use it, as we
# need to modify it in order to extend it.
echo -n "Creating disk image..."
cp "${FUCHSIA_BUILD_DIR}/${IMAGE_FVM_RAW}" "${fvmimg}"
"${ZIRCON_TOOLS_DIR}/fvm" "${fvmimg}" extend --length "${newsize}"
echo "done"
else
fx-error "could not extend fvm, unable to stat fvm image"
fi
fi
为了调试在stat附近添加echo来获得更详细的信息
⋊> /s/w/p/f/fuchsia on 24db8fdf7f ⨯ ./scripts/fx run -m 4096 09:49:26
stat /storage/wine/project/fuchsia/fuchsia/out/default/obj/build/images/fvm.blk
文件:/storage/wine/project/fuchsia/fuchsia/out/default/obj/build/images/fvm.blk 大小:184713216 块:294176 IO 块:4096 普通文件 设备:812h/2066d Inode:652306 硬链接:1 权限:(0777/-rwxrwxrwx) Uid:( 0/ root) Gid:( 0/ root) 最近访问:2019-06-06 08:46:25.654604100 +0800 最近更改:20
19-06-06 08:46:33.984950900 +0800 最近改动:2019-06-06 08:46:33.984950900 +0800 创建时间:-
ERROR: could not extend fvm, unable to stat fvm image
CMDLINE: TERM=screen-256color kernel.serial=legacy kernel.entropy-mixin=bcb8e29762ee95ba5422aec030bf808a7733262acb36a876425a6ec97746dea5 kernel.halt-on-panic=true
+ exec /storage/wine/project/fuchsia/fuchsia/buildtools/linux-x64/qemu/bin/qemu-system-x86_64 -kernel /storage/wine/project/fuchsia/fuchsia/out/default/../default.zircon/multiboot.bin -initrd /tmp/tmp.hZ2R9qWKFQ/fuchsia-ssh.zbi -m 4096 -nographic -drive file=/tmp/tmp.hZ2R9qWKFQ/fvm.b
lk,format=raw,if=none,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0 -net none -smp 4,threads=2 -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -cpu Haswell,+smap,-check,-fsgsbase -append 'TERM=screen-256color kernel.serial=legacy kernel.ent
ropy-mixin=bcb8e29762ee95ba5422aec030bf808a7733262acb36a876425a6ec97746dea5 kernel.halt-on-panic=true '
qemu-system-x86_64: -drive file=/tmp/tmp.hZ2R9qWKFQ/fvm.blk,format=raw,if=none,id=mydisk: Could not open '/tmp/tmp.hZ2R9qWKFQ/fvm.blk': No such file or directory
这样错误原因就很明显了,我的stat是中文输出的,不匹配正则表达式,因此修改正则,看着好怪异
if [ -n "$IMAGE_FVM_RAW" ]; then
fvmimg="${imgdir}/fvm.blk"
args+=(-d -D "${fvmimg}" --diskfmt=raw)
stat_flags=()
if [[ $(uname) == "Darwin" ]]; then
stat_flags+=("-x")
fi
stat_output=$(stat "${stat_flags[@]}" "${FUCHSIA_BUILD_DIR}/${IMAGE_FVM_RAW}")
echo stat "${stat_flags[@]}" "${FUCHSIA_BUILD_DIR}/${IMAGE_FVM_RAW}"
echo $stat_output
if [[ "$stat_output" =~ 大小:([0-9]+) ]]; then
size="${BASH_REMATCH[1]}"
newsize=$(($size * 2))
# We must take a copy of the build artifact, rather than re-use it, as we
# need to modify it in order to extend it.
echo -n "Creating disk image..."
cp "${FUCHSIA_BUILD_DIR}/${IMAGE_FVM_RAW}" "${fvmimg}"
"${ZIRCON_TOOLS_DIR}/fvm" "${fvmimg}" extend --length "${newsize}"
echo "done"
else
fx-error "could not extend fvm, unable to stat fvm image"
fi
fi
于是就能运行了~~
随手一个ls,然后…
$ ls
/boot/bin/sh: 4: Cannot create child process: -1 (ZX_ERR_INTERNAL): failed to resolve fuchsia-pkg://fuchsia.com/ls#bin/ls
# Copyright 2019 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.
config("tree_config") {
cflags = [
"-Wno-discarded-qualifiers",
"-Wno-implicit-fallthrough",
"-Wno-sign-compare",
"-Wno-unused-but-set-parameter",
"-Wno-incompatible-pointer-types",
]
cflags_c = [
"-Wno-strict-prototypes",
]
}
executable("tree") {
configs += [ ":tree_config" ]
sources = [
"color.c",
"hash.c",
"json.c",
"tree.c",
"unix.c",
"file.c",
"html.c",
"strverscmp.c",
"tree.h",
"xml.c",
]
deps = [
"$zx/system/ulib/fdio",
]
}