blob: 7945797b1fa81e41dcf6e076002e0d804a169007 [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
28def IncrementalOTA_VerifyEnd(info):
29 # try:
30 # target_radio_img = info.target_zip.read("RADIO/radio.img")
31 # source_radio_img = info.source_zip.read("RADIO/radio.img")
32 # except KeyError:
33 # # No source or target radio. Nothing to verify
34 # pass
35 # else:
36 # if source_radio_img != target_radio_img:
37 # info.script.CacheFreeSpaceCheck(len(source_radio_img))
38 # radio_type, radio_device = common.GetTypeAndDevice("/radio", info.info_dict)
39 # info.script.PatchCheck("%s:%s:%d:%s:%d:%s" % (
40 # radio_type, radio_device,
41 # len(source_radio_img), common.sha1(source_radio_img).hexdigest(),
42 # len(target_radio_img), common.sha1(target_radio_img).hexdigest()))
43 pass
44
45def IncrementalOTA_InstallEnd(info):
46 try:
47 target_bootloader_img = info.target_zip.read("RADIO/bootloader.img")
48 try:
49 source_bootloader_img = info.source_zip.read("RADIO/bootloader.img")
50 except KeyError:
51 source_bootloader_img = None
52
53 if source_bootloader_img == target_bootloader_img:
54 print "bootloader unchanged; skipping"
55 else:
56 WriteBootloader(info, target_bootloader_img)
57 except KeyError:
58 print "no bootloader.img in target target_files; skipping install"
59
60def WriteBootloader(info, bootloader_img):
61 common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img)
62 bl_type, bl_device = common.GetTypeAndDevice("/bootloader", info.info_dict)
63
64 fstab = info.info_dict["fstab"]
65
66 info.script.Print("Writing bootloader...")
67 info.script.AppendExtra('package_extract_file("bootloader.img", "%s");' %
68 bl_device)