Commit Graph

889 Commits

Author SHA1 Message Date
Christopher Ferris
1d30c2fe19 Use the correct fuse_init_out structure size.
Kernel 2.6.16 is the first stable kernel with struct fuse_init_out
defined (fuse version 7.6). The structure is the same from 7.6 through
7.22. Beginning with 7.23, the structure increased in size and added
new parameters.

If the kernel only works on minor revs older than or equal to 22,
then use the older structure size since this code only uses the 7.22
version of the structure.

Change-Id: I00d7530e01e6b4718dcd04ad2484959d12ef4a65
2014-09-17 17:10:41 -07:00
Doug Zongker
52ae67d659 support for version 2 of block image diffs
In version 2 of block image diffs, we support a new command to load
data from the image and store it in the "stash table" and then
subsequently use entries in the stash table to fill in missing bits of
source data we're not allowed to read when doing move/bsdiff/imgdiff
commands.

This leads to smaller update packages because we can break cycles in
the ordering of how pieces are updated by storing data away and using
it later, rather than not using the data as input to the patch system
at all.  This comes at the cost of the RAM or scratch disk needed to
store the data.

The implementation is backwards compatible; it can still handle the
existing version 1 of the transfer file format.

Change-Id: I7fafe741d86b92d82d46feb2939ecf5a3890dc64
2014-09-08 14:11:48 -07:00
Doug Zongker
3de5e7cc0b am 574443d8: create block map for all update packages on /data
* commit '574443d8956802f35347cac7fae7eb16240e3c16':
  create block map for all update packages on /data
2014-09-05 17:24:50 +00:00
Doug Zongker
574443d895 create block map for all update packages on /data
Always create the block map for packages on /data; don't only look at
the encryptable/encrypted flags.

Bug: 17395453
Change-Id: Iaa7643a32898328277841e324305b9419a9e071c
2014-09-05 08:22:12 -07:00
Doug Zongker
795f9bca63 am 40482ea2: Merge "fix comment in blockimg updater code" into lmp-dev
* commit '40482ea2ae5ca8cbcf46125f601c0bc766f99943':
  fix comment in blockimg updater code
2014-09-04 15:49:21 +00:00
Andrew Boie
da8b8049db am 8328922f: use lseek64 instead of lseek
* commit '8328922ff040280007da0aaaf8b567581231d5ed':
  use lseek64 instead of lseek
2014-09-04 15:49:20 +00:00
Doug Zongker
40482ea2ae Merge "fix comment in blockimg updater code" into lmp-dev 2014-09-04 15:26:29 +00:00
Doug Zongker
f7bb09dae8 fix comment in blockimg updater code
The comment for the DEBUG_ERASE setting is exactly backwards.

Change-Id: I98ab5828365894217fc78976817a131e7d22d5c1
2014-09-04 08:10:32 -07:00
Andrew Boie
8328922ff0 use lseek64 instead of lseek
Otherwise, overflow problems can occur with images larger than
2G since the offsets will overflow a 32-bit off_t.

Change-Id: I05951a38ebeae83ad2cb938594e8d8adb323e2aa
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2014-09-04 07:54:17 -07:00
Doug Zongker
5a1bc7a233 am 5f875bf5: remove code for original block OTA mechanism
* commit '5f875bf57739bf0b5c2d182173513233bdb71ab8':
  remove code for original block OTA mechanism
2014-08-26 22:11:36 +00:00
Doug Zongker
5f875bf577 remove code for original block OTA mechanism
Superseded by newer code.

Bug: 16984795
Change-Id: I842299f6a02af7ccf51ef2ca174d813ca53deef1
2014-08-26 13:54:24 -07:00
Doug Zongker
9e62b78b36 Merge "remove code for original block OTA mechanism" 2014-08-26 17:05:30 +00:00
Doug Zongker
7b485070e0 am f449db2f: open misc device in write-only mode
* commit 'f449db2f30235a0c2fef4bc7bc41776e271a60a0':
  open misc device in write-only mode
2014-08-26 16:47:27 +00:00
Doug Zongker
f449db2f30 open misc device in write-only mode
Opening the misc block device in read-write mode runs afoul of
SELinux, which keeps the wipe code from working.  Fix.  Also change
various things to log to logcat so we can see them happening, for
future debugging.

Bug: 16715412
Change-Id: Ia14066f0a371cd605fcb544547b58a41acca70b9
2014-08-26 09:22:57 -07:00
Doug Zongker
adad8ec045 remove code for original block OTA mechanism
Superseded by newer code.

Bug: 16984795
Change-Id: I70c1d29dc03287b06ea909d17f729ec51ccb0344
2014-08-25 08:21:27 -07:00
Doug Zongker
6d3c4e8224 am 1d5d6098: fix two bugs in block image updater
* commit '1d5d6098f4a470bc8e56ae8914180041815e6e22':
  fix two bugs in block image updater
2014-08-21 18:20:18 +00:00
Doug Zongker
1d5d6098f4 fix two bugs in block image updater
The computation of file offsets was overflowing for partitions larger
than 2 GB.  The parsing of the transfer file could fail at the end if
the data happened to not be properly null-terminated.

Bug: 16984795
Change-Id: I3ce6eb3e54ab7b55aa9bbed252da5a7eacd3317a
2014-08-21 10:47:24 -07:00
Doug Zongker
0f5cf72f54 am bc7ffeda: installer for new block OTA system
* commit 'bc7ffeda98a861e346c30c771d3258030f7fcf21':
  installer for new block OTA system
2014-08-20 01:33:48 +00:00
Doug Zongker
bc7ffeda98 installer for new block OTA system
(Cherry-pick back from master.)

Bug: 16984795
Change-Id: Ifa3d8345c5e2a0be86fb28faa080ca82592a96b4
2014-08-19 16:53:39 -07:00
Doug Zongker
c0fd40159c Merge "installer for new block OTA system" 2014-08-19 02:43:23 +00:00
Doug Zongker
66f5ce387a installer for new block OTA system
Bug: 16984795
Change-Id: I90f958446baed83dec658de2430c8fc5e9c3047e
2014-08-19 13:40:15 -07:00
Doug Zongker
af003a8831 am 2efc9d99: clear BCB in misc partition before rebooting
* commit '2efc9d994ce59f9ebfc2290c2adc5d760e8939c2':
  clear BCB in misc partition before rebooting
2014-08-18 23:29:21 +00:00
Doug Zongker
2efc9d994c clear BCB in misc partition before rebooting
Something is leaving behind wipe commands in the BCB area of the /misc
partition.  We don't know what is doing that.  It should always be
safe to zero out that area from uncrypt, though (because if uncrypt is
running then it's got the command we want in the recovery command file
rather than the BCB).

Bug: 16715412
Change-Id: Iad01124287f13b80ff71d6371db6371f43c43211
2014-08-18 15:55:28 -07:00
Doug Zongker
cdc9828fca am 1a35a586: revert uncrypt back to dynamic linking, fix libs
* commit '1a35a586904cd429fd3a6a6c2de64a16ccdf693d':
  revert uncrypt back to dynamic linking, fix libs
2014-08-15 11:52:14 +00:00
Doug Zongker
ae2b63a6c7 am 537d34f9: change uncrypt to static linking
* commit '537d34f907a5e984ccad1c88825adc8ae9814834':
  change uncrypt to static linking
2014-08-14 23:49:27 +00:00
Doug Zongker
1a35a58690 revert uncrypt back to dynamic linking, fix libs
Bug: 17029174, 17015157
Change-Id: I1d24f3402875dfb972daa6daef0f385baeff84e9
2014-08-14 10:32:46 -07:00
Doug Zongker
537d34f907 change uncrypt to static linking
Bug: 17015157
Change-Id: I3c4bdcf4f11d44b617bb731a48413e3707044d1c
2014-08-14 08:01:17 -07:00
Andres Morales
f38d6e5a36 am 9dc71cfa: Merge "Erase PST partition if its marked to be erased." into lmp-dev
* commit '9dc71cfa5233789a50d8a9d2c9af87d0f106d4ad':
  Erase PST partition if its marked to be erased.
2014-08-06 17:41:05 +00:00
Doug Zongker
1eeac62ad9 am 2b5f0e0f: remove spurious parens from error message
* commit '2b5f0e0f767ce51d9605809052ad04fe83d1df83':
  remove spurious parens from error message
2014-08-06 17:40:22 +00:00
Doug Zongker
2b5f0e0f76 remove spurious parens from error message
These error messages include empty parens after each string
substition.  Ill-advised cut and paste, probably.

Bug: 16467401
Change-Id: Ib623172d6228354afdcc2e33442cc53a07f0ecbc
2014-08-06 08:25:03 -07:00
Andres Morales
9dc71cfa52 Merge "Erase PST partition if its marked to be erased." into lmp-dev 2014-08-05 00:34:22 +00:00
Andres Morales
ee19387905 Erase PST partition if its marked to be erased.
We need to wipe the challenges on this partition
if OEM unlock is enabled, as this is a signal that
the user has opted out of factory reset protection.

go/factory-reset

Bug: 16633064
Change-Id: Icb8f1433bf99ca57813f5b72d5a3dd15fa94a263
2014-08-06 09:58:55 -07:00
JP Abgrall
b04d0b0dde am 78d458c3: Fix length printing + formats
* commit '78d458c3d279a24a60fda013026b7a5454d01a9b':
  Fix length printing + formats
2014-08-05 00:12:37 +00:00
JP Abgrall
78d458c3d2 Fix length printing + formats
Fix wrong argument order.
Fix for 32 vs 64 bit.

(reported by htc)

Change-Id: Ie37a280bed2848199bcc075500e1326e371cd326
2014-08-04 16:44:33 -07:00
Doug Zongker
20c8d0075f am eaf33654: only do uncryption on packages in /data
* commit 'eaf33654c1817bd665831a13c5bd0c04daabee02':
  only do uncryption on packages in /data
2014-08-01 20:59:40 +00:00
Doug Zongker
eaf33654c1 only do uncryption on packages in /data
If recovery is invoked with a package somewhere other than /data,
leave it alone.

Change-Id: Ief358b53df467ae24a65e30e7a631da59bf13683
2014-07-31 15:42:13 -07:00
Michael Runge
5d7278d7a1 am a91ecc59: Auto create parent directories for rename support
* commit 'a91ecc59b2753a3dcc93b2619559a980074e77bd':
  Auto create parent directories for rename support
2014-07-22 01:06:26 +00:00
Michael Runge
d29f641b1c Auto create parent directories for rename support
Sometimes renames will move a file into a directory
that does not yet exist.  This will create the
parent directories, using the same symlink logic,
to ensure that there is a valid destination.

Bug: 16458395
Change-Id: Iaa005a12ce800c39f4db20f7c25a2a68cb40a52d
2014-07-22 01:02:06 +00:00
Michael Runge
a91ecc59b2 Auto create parent directories for rename support
Sometimes renames will move a file into a directory
that does not yet exist.  This will create the
parent directories, using the same symlink logic,
to ensure that there is a valid destination.

Change-Id: Iaa005a12ce800c39f4db20f7c25a2a68cb40a52d
2014-07-21 17:40:02 -07:00
Doug Zongker
945fc68c62 do sdcard sideloading through the fuse filesystem
Make a fuse filesystem that sits on top of the selected package file
on the sdcard, so we can verify that the file contents don't change
while being read and avoid copying the file to /tmp (that is, RAM)
before verifying and installing it.

Change-Id: Ifd982aa68bfe469eda5f839042648654bf7386a1
2014-07-10 10:58:35 -07:00
Doug Zongker
18a78e0a16 refactor fuse sideloading code
Split the adb-specific portions (fetching a block from the adb host
and closing the connections) out from the rest of the FUSE filesystem
code, so that we can reuse the fuse stuff for installing off sdcards
as well.

Change-Id: I0ba385fd35999c5f5cad27842bc82024a264dd14
2014-07-10 10:55:07 -07:00
Doug Zongker
93950229cf drop APPLY_CACHE and refactor APPLY_EXT
Drop support for sideloading OTA packages of the cache partition (a
half-solution that's long since been deprecated by "adb sideload").
Refactor the code to sideload OTA packages from SD cards: remove the
installation code from the file browser.

Change-Id: Id0dff6b27c4a5837546f174f50e2e1d0379c43db
2014-07-08 14:10:23 -07:00
Doug Zongker
075ad800c5 sideload without holding the whole package in RAM
Implement a new method of sideloading over ADB that does not require
the entire package to be held in RAM (useful for low-RAM devices and
devices using block OTA where we'd rather have more RAM available for
binary patching).

We communicate with the host using a new adb service called
"sideload-host", which makes the host act as a server, sending us
different parts of the package file on request.

We create a FUSE filesystem that creates a virtual file
"/sideload/package.zip" that is backed by the ADB connection -- users
see a normal file, but when they read from the file we're actually
fetching the data from the adb host.  This file is then passed to the
verification and installation systems like any other.

To prevent a malicious adb host implementation from serving different
data to the verification and installation phases of sideloading, the
FUSE filesystem verifies that the contents of the file don't change
between reads -- every time we fetch a block from the host we compare
its hash to the previous hash for that block (if it was read before)
and cause the read to fail if it changes.

One necessary change is that the minadbd started by recovery in
sideload mode no longer drops its root privileges (they're needed to
mount the FUSE filesystem).  We rely on SELinux enforcement to
restrict the set of things that can be accessed.

Change-Id: Ida7dbd3b04c1d4e27a2779d88c1da0c7c81fb114
2014-07-02 12:16:36 -07:00
Riley Andrews
e8d7dd4ed1 am 3e0fc39e: am 974fe112: Merge "Fix recovery mode."
* commit '3e0fc39ec27c0ed96ffd2a617f1841fe3bf3c8f6':
  Fix recovery mode.
2014-06-25 00:44:02 +00:00
Riley Andrews
3e0fc39ec2 am 974fe112: Merge "Fix recovery mode."
* commit '974fe112ae6df95ca6d49688d6e3e459d87e16de':
  Fix recovery mode.
2014-06-25 00:40:46 +00:00
Colin Cross
22bcf97a59 recovery: enable panic_on_oops
Set panic_on_oops=1 to reboot if the kernel panics.

Change-Id: Id9e8689a570229db2ea2a3d72b52784f8a1ed107
2014-06-24 13:43:39 -07:00
Riley Andrews
974fe112ae Merge "Fix recovery mode." 2014-06-24 18:00:13 +00:00
Riley Andrews
e739d7e6cd Fix recovery mode.
Duplicate changes made to init.rc for https://android-review.googlesource.com/98852
in the init.rc used for recovery mode.

Bug 15849856

Change-Id: Ia376ddf6373a28718653f7fb1435bf7ecb33d813
2014-06-24 17:11:10 -07:00
Ji-Hwan Lee
b9afc2bf15 Use LOCAL_REQUIRED_MODULES for mkfs.f2fs
Instead of LOCAL_ADDITIONAL_DEPENDENCIES.

Bug: 15702524
Change-Id: Ic152ae60354bf09eccdb9a85dcd04f0f076a6422
2014-06-18 17:30:14 +00:00
JP Abgrall
37aedb3faf Support F2FS for the data partition
This adds F2FS support
- for wiping a device
- for the install "format" command.

Note: crypto data in "footer" with a default/negative length
is not supported, unlike with "ext4".

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-16 19:07:39 -07:00