forked from tmlind/droid4-kexecboot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
241 lines (176 loc) · 8.63 KB
/
INSTALL
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Install of LineageOS to droid 4 stock partition using droid4-kexecboot
With droid4-kexecboot it is possible to boot Android images and Linux
distros on raw partitions without using loopback devices unlike earlier
SafeStrap based installs. This also means that there is no longer a need
to necessarily keep the old stock Android image on the device.
We still use SafeStrap files as the Android recovery, but load it with
droid4-kexecboot from mmcblk1p22 preinstall partition. These instructions
assume install to raw partitions on the eMMC and micro-SD card.
As of lineage-14.1-20181212-nightly-maserati-signed.zip version, it can
now be installed to the mmcblk1p20 stock partition on droid 4 emmc while
optionally reformatting mmcblk1p25 emstorage as ext4. These instructions
assume lineage-14.1-20181212-nightly-maserati-signed.zip or a later image.
1. Hardware and files needed
Droid 4 xt894
micro-USB cable
micro-SD card
VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml.zip
sha256 bdc2e452825ee8d339c736121f6019845f2e9984afdbbebe642bba0b0f3ef175
Safestrap-maserati-v3.75-altpart.tar.gz
sha256 caa9098f407e67f0cf4603313cdd476a761b436dd5a236d67cf741b762ad93ef
From: https://github.com/timangus/droid4
And you probably also want to get the current LineageOS addonsu zip file:
addonsu-14.1-arm-signed.zip
sha256 1c0953b2eb3c5d2e88eeb7df4d60709aeb18e8acf56fb380ce83f5acb3dcbb8f
From: https://download.lineageos.org/extras
Optionally you may also want to get the current open_gapps pico zip file
if you need gapps.
2. Current limitations and things to consider for partitioning
To avoid having to reconfigure your device multiple times, you may want
to first consider how to use the partitions on eMMC cand how to partition
your mico-SD card. The mmcblk1 eMMC partitions are quite crazy, so please
read file PARTITIONS carefully before install.
3. Install droid4-kexecboot to the device
To install, use fastboot to unlock the utags and bpsw partition. Then flash
current droid4-kexecboot image and utags to boot to it:
$ fastboot flash mbm allow-mbmloader-flashing-mbm.bin
$ fastboot reboot bootloader
$ fastboot flash bpsw current/droid4-kexecboot.img
$ fastboot flash utags utags-mmcblk1p13.bin
And then you may want to lock the utags and bpsw partitions later on after
things are working again with:
$ fastboot flash mbm mbm.bin
You can get the mbm.bin from the droid 4 stock kernel firmware. And you should
have droid 4 updated to VRZ_XT894_9.8.2O-72_VZW-18-8_CFC version first.
And then you have to configure kexecboot as described below.
If you at some point want to uninstall droid4-kexecboot, it can be done with:
$ fastboot flash mbm allow-mbmloader-flashing-mbm.bin
$ fastboot reboot bootloader
$ fastboot erase utags
$ fastboot flash mbm mbm.bin
4. Install SafeStrap recovery
Start with installing SafeStrap recovery to a micro-SD card that we can
then copy to the eMMC to the mmcblk1p22 preinstall partition. The recovery
is needed for installing components with adb sideload, such as addonsu and
gapps if needed. It is also needed to install LineageOS updates later on.
After the SafeStrap recovery is installed to mmcblk1p22 preinstall partition,
it's not necessary to keep it on the micro-SD card necessarily.
Note that we cannot use the Motorola recovery because it does not support
the LineageOS keys, and cannot be modified to add keys. And it does not
support the newer key format. And as the Motorola recovery is signed, we
cannot install anything to that partition without cause in issues where
the Motorola bootloader will only boot to fastboot mode.
4.1 Extract SafeStrap files to the micro-SD card
On your PC, Extract SafeStrap and install it to the micro-sd card into
any partition for kexecboot to find it:
$ sudo mkfs.ext4 -O^metadata_csum,^64bit /dev/microsd-partition
$ sudo mount /dev/mcirosd-partition /mnt
$ sudo tar zxf Safestrap-maserati-v3.75-altpart.tar.gz -C /mnt
$ sudo umount /mnt
4.2 Boot to SafeStrap recovery with kexecboot
Install the micro-SD card into the device and boot it up. You should see
kexecboot menu with option "SafeStrap recovery". Select it with the up and
down arrow keys and press enter to boot to recovery. After few seconds,
SafeStrap recovery menu shows up on the device.
4.3 Copy SafeStrap recovery from micro-SD card to eMMC
With device running in SafeStrap recovery, connect USB cable, and copy the
recovery files from the micro-SD card to the mmcblk1p22 preinstall partition
if not already done. Note that the following will wipe your mmcblk1p22
preinstall partition, and if your're already using it for something other
than the stock Android preinstall, make a back-up first. Assuming you're
OK to wipe mmcblk1p22 preinstall partition, on your PC do:
$ adb shell
# mke2fs -T ext4 /dev/block/mmcblk1p22
# mkdir /preinstall
# mount /dev/block/mmcblk1p22 /preinstall
# mkdir /microsd
# mount /dev/block/mmcblk0p1 /microsd
# cp -r /microsd/boot /preinstall/
# umount /microsd
# umount /preinstall
4.4 Back-up the stock kernel WLAN modules for kexecboot
With device running in SafeStrap recovery, back up the stock kernel WLAN
modules to the mmcblk1p22 preinstall partition if not already done:
$ adb shell
# mkdir /preinstall
# mount /dev/block/mmcblk1p22 /preinstall
# mount /dev/block/mmcblk1p20 /system
# mkdir -p /preinstall/lib/modules/3.0.8-stock
# cp /system/lib/modules/* /preinstall/lib/modules/3.0.8-stock/
# umount /system
# umount /preinstall
5. Install LineageOS
With device running SafeStrap recovery, you can now start LineageOS
install.
5.1 Make sure mmcblk1p24 data partition is formatted
If you have updated the system to the original distro but never booted
it, it seems that the mmcblk1p24 userdata partition needs to be formatted
for LineageOS to start. Note that if you've used your device before,
there's no need for this. Also note that the following will wipe your
userdata on the device:
# mkte2fs -T ext4 /dev/block/mmcblk1p24
5.2 Optionally reformat mmcblk1p25 emstorage partition as ext4
Based on your needs as described in the PARTITIONS file, optionally
reformat mmcblk1p25 emstorage partition as ext4. This currently cannot
be done if using mmcblk1p23 webtop for LineageOS, and mmcblk1p25 emstorage
must be formatted vfat for that. For LineageOS on mmcblk1p23 webtop
partition, skip to 5.4.
$ adb shell
# mke2fs -T ext4 /dev/block/mmcblk1p25
There is no need to use any special ext4 flags above as the SafeStrap
recovery is using the stock v3.0.8 kernel that does not understand the
newer flags.
5.3 Configure mmcblk1p25 emstorage partition active_slot file
The mmcblk1p25 emstorage needs to be configured for LineageOS to use the
right boot partition no matter if it's vfat or ext4 formatted:
$ adb shell
# mount /dev/block/mmcblk1p25 /ss
# mkdir /ss/safestrap
# echo stock > /ss/safestrap/active_slot
Note that "stock" must be used above for active_slot for both mmcblk1p20
system partition without gapps and for mmcblk1p23 webtop partition. Do
not use "altpart" name above for active_slot, it will cause a blank screen
on boot.
5.4 Set the stock partition active in SafeStrap recovery
On the device, select "Boot Options" -> "Stock ROM" -> "Activate" if not
already active. After setting it, red "ROM SLot: stock" should display on
the top of the screen
5.5 Install LineageOS with adb sideload
On the device, select "Advanced" -> "ADB Sideload", check both options
to wipe caches, then swipe to start sideload
On PC, start adb sideload with the latest LineageOS 14.1 image:
$ adb sideload lineage-14.1-20181212-nightly-maserati-signed.zip
This will take several minutes. Then you may also want to install su while
at it after restarting sideload also on the device first:
$ adb sideload addonsu-14.1-arm-signed.zip
5.6 Configure kexecboot boot/boot.cfg file on the stock partition
Note that you currently need to do this every time you update LineageOS
on the mmcblk1p20 stock partition.
$ adb shell
# mount /system
# mkdir /system/boot
# cat > /system/boot/boot.cfg << EOF
LABEL=LineageOS on mmcblk1p20 stock partition
PRIORITY=8
DTB=/etc/kexec/devtree
KERNEL=/etc/kexec/kernel
INITRD=/etc/kexec/ramdisk.img
CMDLINE="androidboot.safestrap.romslot=stock"
TIMEOUT=3
EOF
Or if booting to mmcblk1p23 webtop altpart:
# cat > /system/boot/boot.cfg << EOF
LABEL=LineageOS on mmcblk1p23 webtop partition
PRIORITY=7
DTB=/etc/kexec/devtree
KERNEL=/etc/kexec/kernel
INITRD=/etc/kexec/ramdisk.img
CMDLINE="androidboot.safestrap.romslot=altpart"
TIMEOUT=3
EOF
5.7 Install optional gapps
You can install gapps pico zip file simlar to the addonsu file in 5.6 above.
If installing gapps to mmcblk1p23 webtop partition after booting it,
you need to do a "factory reset" on the device in SafeStrap under Wipe.
5.8 Done, reboot the device
The first time LineageOS starts, it will take several minutes to boot.