blob: a9d12b4df36ea675202288c6166dd629aa4ff036 [file] [log] [blame]
Doug Zongkerc3d56f82012-08-02 10:42:27 -07001# Copyright (C) 2012 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Emit commands needed for Mantaray during OTA installation
16(installing the bootloader)."""
17
18import common
19
20def FullOTA_InstallEnd(info):
21 try:
22 bootloader_img = info.input_zip.read("RADIO/bootloader.img")
23 except KeyError:
24 print "no bootloader.img in target_files; skipping install"
25 else:
26 WriteBootloader(info, bootloader_img)
27
JP Abgralld301cdb2014-11-24 14:29:39 -080028def IncrementalOTA_InstallBegin(info):
29 info.script.Unmount("/system")
30 info.script.TunePartition("/system", "-O", "^has_journal")
31 info.script.Mount("/system")
32
Doug Zongkerc3d56f82012-08-02 10:42:27 -070033def IncrementalOTA_VerifyEnd(info):
34 # try:
35 # target_radio_img = info.target_zip.read("RADIO/radio.img")
36 # source_radio_img = info.source_zip.read("RADIO/radio.img")
37 # except KeyError:
38 # # No source or target radio. Nothing to verify
39 # pass
40 # else:
41 # if source_radio_img != target_radio_img:
42 # info.script.CacheFreeSpaceCheck(len(source_radio_img))
43 # radio_type, radio_device = common.GetTypeAndDevice("/radio", info.info_dict)
44 # info.script.PatchCheck("%s:%s:%d:%s:%d:%s" % (
45 # radio_type, radio_device,
46 # len(source_radio_img), common.sha1(source_radio_img).hexdigest(),
47 # len(target_radio_img), common.sha1(target_radio_img).hexdigest()))
48 pass
49
50def IncrementalOTA_InstallEnd(info):
51 try:
52 target_bootloader_img = info.target_zip.read("RADIO/bootloader.img")
53 try:
54 source_bootloader_img = info.source_zip.read("RADIO/bootloader.img")
55 except KeyError:
56 source_bootloader_img = None
57
58 if source_bootloader_img == target_bootloader_img:
59 print "bootloader unchanged; skipping"
60 else:
61 WriteBootloader(info, target_bootloader_img)
62 except KeyError:
63 print "no bootloader.img in target target_files; skipping install"
64
65def WriteBootloader(info, bootloader_img):
66 common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img)
67 bl_type, bl_device = common.GetTypeAndDevice("/bootloader", info.info_dict)
68
69 fstab = info.info_dict["fstab"]
70
71 info.script.Print("Writing bootloader...")
Doug Zongkerfe650da2012-08-08 15:01:23 -070072 force_ro = "/sys/block/" + bl_device.split("/")[-1] + "/force_ro"
Doug Zongkerd8771b22012-08-17 13:06:01 -070073 info.script.AppendExtra(
74 ('samsung.manta.write_bootloader(package_extract_file('
75 '"bootloader.img"), "%s", "%s");') %
76 (bl_device, force_ro))