-
Notifications
You must be signed in to change notification settings - Fork 102
/
flash.txt
139 lines (101 loc) · 10.6 KB
/
flash.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
fx flash vim2 --pave
FUCHSIA_BUILD_DIR的定义在fuchsia/.config里
source "${FUCHSIA_BUILD_DIR}"/image_paths.sh
IMAGE_BLOB_RAW=obj/build/images/blob.blk
IMAGE_QEMU_KERNEL_RAW=../build-zircon/build-arm64/qemu-boot-shim.bin
IMAGE_ZIRCONA_ZBI=fuchsia.zbi
IMAGE_BOOT_RAM=fuchsia.zbi
IMAGE_FVM_RAW=obj/build/images/fvm.blk
IMAGE_FVM_SPARSE=obj/build/images/fvm.sparse.blk
IMAGE_DATA_RAW=obj/build/images/data.blk
IMAGE_DATA_FVM_RAW=obj/build/images/fvm.data.sparse.blk
IMAGE_NETBOOT_ZBI=netboot.zbi
IMAGE_NETBOOT_RAM=netboot.zbi
IMAGE_ZIRCON_VBOOT=fuchsia.vboot
IMAGE_INSTALLER_RAW=obj/build/images/installer.blk
source "${FUCHSIA_BUILD_DIR}"/zedboot_image_paths.sh
IMAGE_ZEDBOOT_ZBI=zedboot.zbi
IMAGE_ZIRCONR_ZBI=zedboot.zbi
IMAGE_ZEDBOOT_VBOOT=zedboot.vboot
fastboot flash boot IMAGE_ZIRCONR_ZBI=zedboot.zbi
zedboot里包含的是
build/images/zedboot/BUILD.gn
里zedboot_binary_patterns以及它们的依赖so
zedboot.zbi的生成:
[3702/23998] /usr/bin/env
../../build/gn_run_binary.sh
../../buildtools/linux-x64/clang/bin
../build-zircon/tools/zbi
--output=zedboot.zbi
--depfile=zedboot.zbi.d
--complete=arm64
../build-zircon/build-arm64/zircon.bin
obj/build/images/zedboot/zedboot.manifest
--entry=config/devmgr=obj/build/images/zedboot/devmgr_config.txt
--type=cmdline
====
kernel/arch/arm64/image.S
./prebuilt/downloads/gcc/bin/aarch64-elf-ld -nostdlib --build-id -z noexecstack -z max-page-size=4096 --gc-sections --emit-relocs -T kernel/kernel.ld /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel-vars.ld /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/platform/generic-arm/generic-arm.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/arch/arm64/arm64.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/top/top.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/hdcp/amlogic_s912/amlogic_s912.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/interrupt/arm_gic/common/common.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/interrupt/arm_gic/v2/v2.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/interrupt/arm_gic/v3/v3.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/iommu/dummy/dummy.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/pcie/pcie.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/pdev/pdev.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/pdev/power/power.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/power/hisi/hisi.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/psci/psci.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/timer/arm_generic/arm_generic.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/uart/amlogic_s905/amlogic_s905.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/uart/nxp-imx/nxp-imx.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/uart/pl011/pl011.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/kernel/kernel.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/bitmap/bitmap.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/cbuf/cbuf.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/crashlog/crashlog.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/debugcommands/debugcommands.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/debuglog/debuglog.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/ktrace/ktrace.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/memory_limit/memory_limit.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/mtrace/mtrace.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/userboot/userboot.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/version/version.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/zbi/zbi.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/object/object.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/platform/platform.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/syscalls/syscalls.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/target/target.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/tests/tests.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/interrupt/interrupt.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/pdev/interrupt/interrupt.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/pdev/uart/uart.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/udisplay/udisplay.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/console/console.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/counters/counters.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/crypto/crypto.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/debug/debug.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/explicit-memory/explicit-memory.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/fbl/fbl.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/fixed_point/fixed_point.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/header_tests/header_tests.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/heap/heap.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/hypervisor/hypervisor.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/libc/libc.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/oom/oom.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/pci/pci.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/pow2_range_allocator/pow2_range_allocator.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/pretty/pretty.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/region-alloc/region-alloc.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/unittest/unittest.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/user_copy/user_copy.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/vdso/vdso.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/zircon-internal/zircon-internal.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/zxcpp/zxcpp.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/vm/vm.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/arch/arm64/hypervisor/hypervisor.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/dev/hw_rng/hw_rng.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/gfx/gfx.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/gfxconsole/gfxconsole.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/heap/cmpctmalloc/cmpctmalloc.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/kernel/lib/io/io.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/third_party/lib/cryptolib/cryptolib.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/third_party/lib/jitterentropy/jitterentropy.mod.o /home/xzx/fuchsia/out/build-zircon/build-arm64/third_party/lib/uboringssl/uboringssl.mod.o -o /home/xzx/fuchsia/out/build-zircon/build-arm64/zircon.elf
aarch64-elf-ld -nostdlib --build-id -z noexecstack -z max-page-size=4096 --gc-sections --build-id=none \
-o kernel-image.elf -T kernel/image.ld --just-symbols zircon.elf \
kernel-vars.ld kernel.image.o
aarch64-elf-objcopy -O binary kernel-image.elf kernel.zbi
ln -f kernel.zbi zircon.bin
====
../build-zircon/tools/zbi 的生成:
[3660/23998] /usr/bin/env ../../build/images/finalize_manifests.py
--depfile=obj/build/images/zedboot/zedboot.manifest.d
--build-id-file=obj/build/images/zedboot/zedboot.manifest.ids.txt
--stripped-dir=obj/build/images/zedboot/zedboot.manifest.stripped
@__build_images_zedboot_zedboot.manifest___build_toolchain_fuchsia_arm64__rule..rsp
----
res文件的内容:
["--cwd=/home/xzx/fuchsia/buildtools/linux-x64/clang/lib", "--manifest=/home/xzx/fuchsia/buildtools/linux-x64/clang/lib/aarch64-fuchsia.manifest", "--cwd=/home/xzx/fuchsia/out/build-zircon/build-arm64-asan/..", "--manifest=/home/xzx/fuchsia/out/build-zircon/build-arm64-asan/bootfs.manifest", "--cwd=/home/xzx/fuchsia/out/build-zircon/build-arm64/..", "--manifest=/home/xzx/fuchsia/out/build-zircon/build-arm64/bootfs.manifest", "--output=obj/build/images/zedboot/zedboot.manifest", "--groups=all", "--cwd=.", "--binary=bin/devmgr", "--binary=bin/dlog", "--binary=bin/fshost", "--binary=bin/netsvc", "--binary=bin/svchost", "--binary=bin/virtual-console", "--binary=driver/*", "--binary=bin/blobfs", "--binary=bin/install-disk-image", "--binary=bin/minfs", "--binary=bin/mount", "--binary=bin/dd", "--binary=bin/driverctl", "--binary=bin/fixfs", "--binary=bin/fsck*", "--binary=bin/gpt", "--binary=bin/killall", "--binary=bin/lsblk", "--binary=bin/lsdev", "--binary=bin/lsusb", "--binary=bin/mkfs*", "--binary=bin/netdump", "--binary=bin/ping", "--binary=bin/ps", "--binary=bin/sh", "--binary=bin/umount"]
----
./prebuilt/downloads/clang/bin/clang++
-o /home/xzx/fuchsia/out/build-zircon/tools/zbi
-g -O2 -Isystem/public -Isystem/private -I/home/xzx/fuchsia/out/build-zircon/gen/global/include
-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare --sysroot=./prebuilt/downloads/sysroot
-Lprebuilt/downloads/clang/lib -ldl -lpthread -static-libstdc++
-Wno-unused-command-line-argument \
/home/xzx/fuchsia/out/build-zircon/system/host/zbi/system/host/zbi/zbi.cpp.o
/home/xzx/fuchsia/out/build-zircon/tools/lib/liblz4.hostlib.a
/home/xzx/fuchsia/out/build-zircon/tools/lib/libcksum.hostlib.a
/home/xzx/fuchsia/out/build-zircon/tools/lib/libfbl.hostlib.a
flash完了之后
boot arm -- -1
生成zedboot.zbi的gn在//build/images/zedboot/BUILD.gn
====
依赖这个文件的生成:
generate_manifest("zedboot.manifest") {
visibility = [ ":*" ]
args = []
foreach(pattern, zedboot_binary_patterns) {
args += [ "--binary=" + pattern ]
}
}
====
依赖的目标
[3565/23998] /usr/bin/env ../../build/images/manifest.py
--output=obj/build/images/zedboot/devmgr_config.txt
--entry=netsvc.netboot=true --entry=virtcon.font=18x32
====
dm reboot-recovery 干了啥
最终调用了bl31 api:
unsigned aml_reboot(uint64_t function_id, uint64_t arg0, uint64_t arg1, uint64_t arg2)
{
register long x0 asm("x0") = function_id;
register long x1 asm("x1") = arg0;
register long x2 asm("x2") = arg1;
register long x3 asm("x3") = arg2;
asm volatile(
__asmeq("%0", "x0")
__asmeq("%1", "x1")
__asmeq("%2", "x2")
__asmeq("%3", "x3")
"smc #0\n"
: "+r" (x0)
: "r" (x1), "r" (x2), "r" (x3));
return function_id;
}
x1是用来选择启动分区的。