Commit Graph

6920 Commits

Author SHA1 Message Date
Tianjie Xu 3168ddf79d Merge "Allow RSA 4096 key in package verification" 2019-03-27 17:57:38 +00:00
Tianjie Xu f1cbd2f7f2 Merge "Move out the code to parse block map in MemMap" 2019-03-26 21:52:40 +00:00
xunchang 908ad77af8 Allow RSA 4096 key in package verification
The RSA_verify sitll works for 4096 bits keys. And we just
need to loose the check on modulus.

Sample commands to generate the key & package:
1. openssl genrsa -out keypair.pem 4096
2. openssl pkcs8 -topk8 -inform PEM -outform DER -nocrypt \
   -in keypair.pem -out private.pk8
3. openssl req -new -x509 -key keypair.pem -out public.x509.pem \
   -days 365
4. java -Djava.library.path=prebuilts/sdk/tools/linux/lib64 -jar \
   prebuilts/sdk/tools/lib/signapk.jar -w public.x509.pem private.pk8 \
   unsigned.zip signed.zip

Bug: 129163830
Test: unit tests pass
Change-Id: I5a5ff539c9ff1955c02ec2ce4b17563cb92808a4
2019-03-26 12:28:23 -07:00
xunchang 625c588c0f Move out the code to parse block map in MemMap
We will reuse them to implement the fuse provider from block maps.

Test: unit tests pass, sideload an OTA
Change-Id: Iaa409d19569c4ccc0bb24e12518044fcddb45c69
2019-03-26 11:47:27 -07:00
Tianjie Xu 6287253eb4 Merge "Move librecovery_ui to a sub-directory" 2019-03-22 15:05:00 +00:00
Tianjie Xu 8f397309b4 Move librecovery_ui to a sub-directory
This helps to expose librecovery_ui for device specific RecoveryUi.

Bug: 76436783
Test: mma, unit tests pass
Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
(cherry picked from commit b5108c372c)
2019-03-21 10:46:11 -07:00
Tianjie Xu 3c61cd02cf Merge "Move apply_from_sdcard to fuse_sdcard_install" 2019-03-20 17:43:46 +00:00
Tianjie Xu 2037c60de4 Merge "Remove the provider_vtab" 2019-03-20 17:43:30 +00:00
xunchang 3cc23d5eac Move apply_from_sdcard to fuse_sdcard_install
Move the sdcard installation function and all helper functions to a
separate file, and drop the dependency on common.h.

In the future, we want to move these functions into the install class.

Bug: 127071893
Test: unit tests pass
Change-Id: I0b7f7cbf0b68918e638e13878ca28bfca367088a
2019-03-19 23:05:13 -07:00
Tianjie Xu eeea86f5fd Merge "Create a FuseDataProvider base class" 2019-03-19 20:34:58 +00:00
xunchang 5e6832a24d Remove the provider_vtab
It's no longer needed with the newly added FuseDataProvider class. Also
cleans up the parameters for run_fuse_sideload.

Bug: 127071893
Test: unit tests pass, run a sideload
Change-Id: I1ccd6798d187cfc6ac9f559ffb3f3edf08dad55c
2019-03-19 13:03:59 -07:00
xunchang ea2912f187 Create a FuseDataProvider base class
The fuse data provider for adb/sdcard shares common code and structures.
This cl creates a FuseDataProvider base class and provides
implementations for adb and sdcard.

In the follow cls, we can kill the provider_vtab struct; and also add
another implementation to parse a block map file and provides data.

Test: unit tests pass, sideload a package, apply a package from sdcard
Change-Id: If8311666a52a2e3c0fbae0ee9688fa6d01e4ad09
2019-03-19 11:11:58 -07:00
Treehugger Robot 98beb6414b Merge "Skip calling verify_package_compatibility when resuming." 2019-03-18 23:10:10 +00:00
Tao Bao 032403fb75 Skip calling verify_package_compatibility when resuming.
android::vintf::VintfObjectRecovery::CheckCompatibility() may try to
mount partitions in order to read the needed files, which may not be
feasible when resuming an interrupted update. This CL changes the logic
to enforce compatibility check on fresh install only.

Fix: 122864541
Test: Sideloading on taimen keeps working.
Test: Sideload a package by setting the retry bit. Check that
      compatibility check is skipped.
Change-Id: I018a0c802c85a0e84a6f2aac50630a677d64382a
2019-03-18 13:32:04 -07:00
Tianjie Xu 698dc08561 Merge "Implement FilePackage class" 2019-03-15 17:40:52 +00:00
xunchang 37304f3cc9 Implement FilePackage class
This is another implementation of the Package class. And we will later
need it when reading the package from FUSE.

Bug: 127071893
Test: unit tests pass, sideload a file package on sailfish
Change-Id: I3de5d5ef60b29c8b73517d6de3498459d7d95975
2019-03-14 15:35:09 -07:00
Tao Bao d5bbec7750 Merge "Start charger at /system/bin/charger." 2019-03-14 16:56:29 +00:00
Treehugger Robot 2e6fbfc31e Merge "Update_verifier: Remove the support for legacy text format CareMap" 2019-03-14 11:00:30 +00:00
Treehugger Robot 05f9a8e100 Merge "update_verifier: Add some missing #include's." 2019-03-14 02:10:18 +00:00
Tao Bao c89c394b46 update_verifier: Add some missing #include's.
<stdint.h> for uint8_t; <stdlib.h> for free(3); <thread> for
std::thread.

Test: mmma -j bootable/recovery
Test: Run unit tests on crosshatch.
Change-Id: Id99b29b3d514f4e453983599c8b1aa6b0fab4ef8
2019-03-13 15:45:39 -07:00
xunchang aaa6103ae7 Update_verifier: Remove the support for legacy text format CareMap
We have already switched to the protobuf format for new builds, and
the downgrade packages will require a data wipe. So it should be safe
to drop the support for text format.

This also helps to save the issue when users sideload a package with a
pending OTA, because the new CareMap contains the fingerprint of the
intended build.

Bug: 128536706
Test: unit tests pass, run update_verifier with legacy CareMap
Change-Id: I1c4d0e54ec591f16cc0a65dac76767725ff9e7c4
2019-03-13 15:24:13 -07:00
Tianjie Xu 2a33682ef5 Merge "Use the package class for wipe packages" 2019-03-13 02:11:47 +00:00
xunchang 55e3d22223 Use the package class for wipe packages
The wipe package used to open the zip file directly from the content
string. Switch to use the interface from the new package class instead.

Bug: 127071893
Test: unit tests pass
Change-Id: I990e7f00c5148710722d17140bab2e343eea3b6b
2019-03-12 15:10:41 -07:00
Tao Bao fc7a0dc3a2 Merge "minui: Managed FDs with smart pointers." 2019-03-12 21:05:41 +00:00
Tao Bao 835bf09a14 minui: Managed FDs with smart pointers.
Also clean up a few variable names.

Test: Boot into recovery. Check key inputs.
Change-Id: I058475ac22f3db8523bd8aa30ccb61be1ef45559
2019-03-11 15:59:09 -07:00
Tao Bao aefc9e3ba9 Merge "minui: Fix the wrong move of the callback." 2019-03-11 22:51:50 +00:00
Tianjie Xu ba9965199a Merge "Create a wrapper class for update package" 2019-03-11 19:53:57 +00:00
Tao Bao dfdf63501e minui: Fix the wrong move of the callback.
The input_cb in ev_init() should be shared among the detected input
devices.

Test: Boot into recovery. Check key inputs.
Change-Id: I0315f6a23625bacedd333fefacbf4ac6797bc1fd
2019-03-11 12:07:11 -07:00
Treehugger Robot 6c54127462 Merge "DO NOT MERGE - Merge PPRL.190305.001 into master" 2019-03-11 18:56:28 +00:00
xunchang f07ed2efeb Create a wrapper class for update package
Creates a new class handle the package in memory and package read from fd.
Define the new interface functions, and make approximate changes to the
verify and install functions.

Bug: 127071893
Test: unit tests pass, sideload a package
Change-Id: I66ab00654df92471184536fd147b237a86e9c5b5
2019-03-11 10:43:52 -07:00
Xin Li 3399fdabf5 DO NOT MERGE - Merge PPRL.190305.001 into master
Bug: 127812889
Change-Id: Ieceaef8b4dd56737a5836dd5e968b609cd084d36
2019-03-11 09:13:10 -07:00
Tianjie Xu a8969842ae Merge "Add a new entry in wipe package to list all wipe partitions" 2019-03-07 22:14:43 +00:00
xunchang e0d991ceca Add a new entry in wipe package to list all wipe partitions
This gives us finer control over the partitions to wipe on the host
side.

Bug: 127492427
Test: unit tests pass, install a wipe package on sailfish
Change-Id: I612f8bac743a310f28e365b490ef388b278cfccb
2019-03-06 15:37:28 -08:00
Treehugger Robot e3857ca43e Merge "Use O_CLOEXEC at a few places." 2019-03-02 00:04:26 +00:00
Tao Bao b549243b27 Use O_CLOEXEC at a few places.
Found these FDs unintentionally propagated into forked processes (e.g.
updater) during my local debugging. Use O_CLOEXEC to avoid that.

Test: Dump open FDs in updater process.
Test: Sideload a package on taimen (which uses framebuffer).
Test: Run graphics test on taimen.
Change-Id: I1fb65dd4a103c47d28b15973def9e9359c251ca3
2019-03-01 14:24:41 -08:00
Treehugger Robot 21cfc8b6f4 Merge "Use android::base::Pipe." 2019-03-01 02:17:24 +00:00
Tao Bao 6fcd208db4 Use android::base::Pipe.
Also clean up the comments regarding updater/recovery protocol.

Test: Sideload a package on taimen. Check that /tmp/recovery.log
      contains the log from update_engine_sideload.
Test: Factory reset on taimen. Check that log file has the info from
      mke2fs.
Change-Id: If560269ce7007769fc85a63bd228813bdd75bebd
2019-02-28 15:53:28 -08:00
Zhomart Mukhamejanov 52db3dc12e Merge "Updater updater_sample/README.md - build instructions." 2019-02-26 04:00:52 +00:00
Zhomart Mukhamejanov 011b5bbc06 Updater updater_sample/README.md - build instructions.
Change-Id: Icbd577e3ceeec2766eca690b529b31f562df6fb2
Test: docs only
2019-02-25 16:19:55 -08:00
David Anderson d294935bf7 Merge "Add a logo to the fastbootd screen." 2019-02-21 04:07:29 +00:00
David Anderson 983e2d5718 Add a logo to the fastbootd screen.
fastbootd looks too much like recovery, even if you're carefully reading
the menu. It's not obvious the device is in a flashing mode, and it's
too tempting to reboot or unplug the device in this state.

As a first step, this patch adds a big red "fastbootd" logo so it's less
obviously in recovery mode.

Bug: 120429730
Test: manual test
Change-Id: I73359f1fdfdc0b1694993f760fe7f35c5713b24e
2019-02-11 19:22:03 -08:00
android-build-team Robot 96f7786965 Snap for 5180536 from 8b508c984d to pi-platform-release
Change-Id: I18ffadbdab03199e33f4476135b95da658880541
2019-02-09 02:15:09 +00:00
Daniel Rosenberg 90edbb17f8 Merge "Defer marking boot successful when checkpointing" 2019-02-08 01:40:54 +00:00
Daniel Rosenberg 15f22bddfb Defer marking boot successful when checkpointing
This moves actually marking the slot as successful to a later point
so that on devices with checkpointing enabled we can still roll back to
the previous version if we fail to boot to the point that the checkpoint
is marked as successful.

Test: When taking an update on a checkpoint enabled device, it
      defers marking the slot as successful instead of directly
      marking it. Visible in logs.
Bug: 123260515

Change-Id: I7ed3595c1b0904ddbfe20d1cad4f69ecbf1ea351
2019-02-07 13:26:05 -08:00
Tianjie Xu e13b39bbb1 Merge "Recovery test: Fix an parameter issue in string construction" 2019-02-06 00:53:25 +00:00
xunchang 7b08a5a6eb Recovery test: Fix an parameter issue in string construction
The intended string constructor is supposed be
basic_string(size_type count, CharT ch). But the parameter is
accidentally reversed when calling the constructor in install_test.

Test: A failed unit test pass
Change-Id: Id9765bfa7d2368ff0d7fbeea45c9c8357864e060
2019-02-05 12:44:53 -08:00
Tom Cherry 990807a95f Merge "Add android::fs_mgr namespace for new Fstab code" 2019-01-31 19:35:54 +00:00
Tom Cherry 72a114a3e1 Add android::fs_mgr namespace for new Fstab code
Also add libfstab dependencies where needed.  Previously the
`typedef struct FstabEntry Volume;` line served to both define a
`struct FstabEntry` as well as alias Volume to it.  With the new
namespace for android::fs_mgr::FstabEntry, `struct FstabEntry` isn't
compatible anymore, so we need to alias Volume to the real
android::fs_mgr::FstabEntry.

In doing so, we need to include <fstab/fstab.h> and this requires
libfstab as a library, which a few modules did not have before.

Test: treehugger
Change-Id: I655209a0efb304b3e0568db0748bd5cf7cecbdb7
2019-01-31 09:00:40 -08:00
Tianjie Xu 9a54dd3bf9 Merge "Fix potential size overflow in blockimg.cpp" 2019-01-29 23:08:58 +00:00
Suren Baghdasaryan 5342de92e0 Merge "DO NOT MERGE: Revert "Revert "Add libprocessgroup dependency""" 2019-01-25 17:09:02 +00:00