-
Notifications
You must be signed in to change notification settings - Fork 102
/
vim2.txt
136 lines (97 loc) · 3.53 KB
/
vim2.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
https://forum.khadas.com/t/google-fuchsia-os-on-khadas-vim2/2587
apt install ckermit
$ cat ~/.kermrc
set line /dev/ttyUSB0
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5
c
apt install gcc-5-aarch64-linux-gnu gcc-arm-none-eabi
ln -s aarch64-linux-gnu-gcc-5 aarch64-linux-gnu-gcc
cd u-boot
make kvim2_defconfig
make -j8 CROSS_COMPILE=aarch64-linux-gnu-
把u-boot.bin拷贝到fat32分区的优盘里
启动vim2时迅速按空格进入uboot命令行
kvim2#usb start
kvim2#fatload usb 0 1080000 u-boot.bin
kvim2#store rom_write 1080000 0 1000000
kvim2#reset
刷了新uboot之后可以同时按住r+p键让vim2进入fastboot模式
fastboot权限设置:
# cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
其余见khadas-vim.md
fx flash vim2 --pave
dm reboot-recovery
这个会让PSCI64_SYSTEM_RESET 发送{ 2, 0, 0 }参数,应该是选择recovery分区启动
在bl31 api.h文件里有例子
switch_bootmode="\
"get_rebootmode;"\
bl31设置了reboot mode, 应该会将启动参数写入地址AO_SEC_SD_CFG15。
但是由于bl31没有源码,所以无法确认。
uboot get_rebootmode会去读这个设置
reboot_mode_val = ((readl(AO_SEC_SD_CFG15) >> 12) & 0xf);
然后进入flash mode
run recovery_from_flash;
正常启动时,执行的是:
"storeboot="\
"kbi resetflag 1;sleep 1;" \
"zircon_bootconfig tee boot misc recovery; if imgread kernel; then bootm ${loadaddr}; fi;"\
"run update;"\
u-boot的启动配置:
#define CONFIG_PREBOOT \
"run bcb_cmd; "\
"run factory_reset_poweroff_protect;"\
"run upgrade_check;"\
"run init_display;"\
"run storeargs;"\
"run combine_key;" \
"run upgrade_key;" \
"run recovery_key;" \
"run vim2_check;" \
"run wol_init;"\
"forceupdate;" \
"run switch_bootmode;"
#define CONFIG_BOOTCOMMAND "run storeboot"
GPIOAO_8
====
do_image_read
do_image_read_kernel
store_read_ops
do_bootm
do_bootm_states
bootm_find_os
boot_get_kernel 这个函数找到header
img_addr = genimg_get_kernel_addr_fit(argc < 1 ? NULL : argv[0],
&fit_uname_config,
&fit_uname_kernel);
img_addr = genimg_get_image(img_addr);
Booting Zircon Image at 0x01080000 ...
zircon boot image被加载到这里16.5MB
bootm_load_os(images, &load_end, 0);
boot_selected_os
do_bootm_zircon
zircon_preboot
在zircon boot image后面增加一些配置数据
然后把内核搬到boot items的后面,然后启动内核,原始的zbi起始地址会放在x0中。
然后就进入//zircon/kernel/arch/arm64/start.S里的_start
====
GPIOAO_2 对应的是power key
https://dl.khadas.com/Hardware/VIM2/Schematic/VIM2_V12_Sch.pdf
它对应的内存地址是0xc810 0028 (in)
这个信息在s912 datasheet page 103 Table III.22.11 GPIO Register Information II
在u-boot里的定义在:
u-boot/arch/arm/cpu/armv8/gxl/gpio.c
static struct meson_bank mesongxbb_banks
gpio命令涉及的文件有:
cmd_gpio.c, amlogic_gpio.c, gpio-uclass.c
关于amlogic linux更多的信息:http://linux-meson.com/doku.php
gpio脚本的处理在command.c里。