summaryrefslogtreecommitdiffstats
path: root/edify (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Moving recovery resources from /system to /vendorBill Peckham2019-10-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is part of a topic that moves the recovery resources from the system partition to the vendor partition, if it exists, or the vendor directory on the system partition otherwise. The recovery resources are moving from the system image to the vendor partition so that a single system image may be used with either an A/B or a non-A/B vendor image. The topic removes a delta in the system image that prevented such reuse in the past. The recovery resources that are moving are involved with updating the recovery partition after an update. In a non-A/B configuration, the system boots from the recovery partition, updates the other partitions (system, vendor, etc.) Then, the next time the system boots normally, a script updates the recovery partition (if necessary). This script, the executables it invokes, and the data files that it uses were previously on the system partition. The resources that are moving include the following. * install-recovery.sh * applypatch * recovery-resource.dat (if present) * recovery-from-boot.p (if present) This makes the applypatch executable a vendor module. This change supports making dependencies of the applypatch executable available to applypatch, which is now on vendor. Since install-recovery.sh is now a vendor service, we add the applypatch/vendor_flash_recovery.rc file to /vendor/etc/init to start the service. Bug: 68319577 Test: Ensure that recovery partition is updated correctly. Change-Id: I01c0800ee6078aa6c9d716d5f154ad2d63c7af84
* Add a GetMappedPackageLength to UpdaterRobin Lee2019-07-081-0/+1
| | | | | | | | | | | | Corresponds to GetMappedPackageAddress. There is at least one custom device recovery with an extension to copy the package somewhere else as a backup. Ability to do this was removed in change ag/955273. Test: lunch cf_x86_tv-eng; make Test: atest recovery_unit_test recovery_component_test Change-Id: I0e61d8a8839c47721874526504ea03b9ca7bafa9
* Implement updater runtime for dynamic partitionsTianjie Xu2019-06-241-1/+6
| | | | | | | | | | The simulator skips executing the operations for dynamic partitions, and will use the logical images under target_files/IMAGES directly. (Similar to the targets without DAP enabled) Bug: 131911365 Test: run update on cuttlefish, run simulator Change-Id: Id318d97ece4560df9f20dc5cabeb8b2e261bdf9c
* Add UpdaterRuntime classTianjie Xu2019-05-214-6/+123
| | | | | | | | | | | This class adds a wrapper to the runtime dependent functions. Therefore, the behavior of update on device stays the same, while simulators can have their own implementations. Also change the caller side of the registered updater functions to call these runtime wrappers. Bug: 131911365 Test: unit tests pass, sideload an update on cuttlefish Change-Id: Ib3ab67132991d67fc132f27120e4152439d16ac5
* Merge "edify: Rename parse_string to ParseString and let it take std::string."Tao Bao2018-07-102-4/+4
|\
| * edify: Rename parse_string to ParseString and let it take std::string.Tao Bao2018-07-102-4/+4
| | | | | | | | | | | | | | Also simplify the helper function expect() in {edify,updater}_test.cpp. Test: Run recovery_component_test on marlin. Change-Id: If54febba4b5013f6d71546318a1ca6b635204ac8
* | edify: Remove VAL_INVALID and move ValueType into Value class.Tao Bao2018-07-102-15/+12
|/ | | | | | Test: mmma -j bootable/recovery Test: Run recovery_component_test and recovery_unit_test on marlin. Change-Id: I4b240e3e771c387b9694be9c0f2f74e0265ab4cb
* Avoid overwrite of the error message in AbortFnTianjie Xu2018-01-291-8/+11
| | | | | | | | | | | | | The AbortFn() used to overwrite the error message, hiding the real failure reported in ErrorAbort(). And we will miss the failure in the script patterns like 'blockimageupdate() || abort()' We will ensure there's one line break at the end of ErrorAbort's error message; and append to the existing error message when calling abort(). Test: Message from ErrorAbort shows up in the log Change-Id: I3aebd06629c5129330250c7fe5e8cdead2ae85bc
* edify: Export the header and move to Soong.Tao Bao2017-10-096-56/+48
| | | | | | | | Also make matching changes to applypatch modules which include edify/expr.h. Test: mmma bootable/recovery Change-Id: Ia72be3caa010d7f56a70add2da345e631b306378
* Revert "Revert "Move error_code.h into otautil.""Tao Bao2017-10-093-4/+5
| | | | | | | | | | | | | | | | This reverts commit 26436d6d6010d5323349af7e119ff8f34f85c40c to re-land "Move error_code.h into otautil.". This way it stops requiring relative path ".." in LOCAL_C_INCLUDES (uncrypt and edify). Soong doesn't accept non-local ".." in "local_include_dirs". This CL needs to land with device-specific module changes (e.g. adding the dependency on libotautil). Test: lunch aosp_{angler,bullhead,dragon,fugu,sailfish}-userdebug; mmma bootable/recovery Change-Id: If193241801af2dae73eccd31ce57cd2b81c9fd96
* applypatch: Forward declare struct Value.Tao Bao2017-10-091-0/+16
| | | | | | | | | | | | | And move '#include "edify/expr.h"' into .cpp files. This breaks the transitive dependency on libedify. Modules that include "applypatch/applypatch.h" don't need to add libedify into their dependency list, unless they really need anything from libedify. Build libedify static library for host, which is needed by libimgpatch. Test: mmma bootable/recovery Change-Id: Ibb53d322579fcbf593438d058d9bcee240625941
* Don't include "error_code.h" in edify/expr.h.Tao Bao2017-10-052-23/+24
| | | | | | | | | | | | | Use forward declartion to avoid pull in the module that contains error_code.h (trying to move it into libotautil). Otherwise all the modules that include "edify/expr.h" need to depend on the module that exports error_code.h. .cpp sources should include "error_code.h" explicitly to use the enums. Test: lunch aosp_{angler,bullhead,dragon,fugu,sailfish}-userdebug; mmma bootable/recovery Change-Id: Ic82db2746c7deb866e8cdfb3c57e0b1ecc71c4dc
* Revert "Move error_code.h into otautil."Tao Bao2017-10-052-4/+3
| | | | | | | | This reverts commit 623fe7e701d5d0fb17082d1ced14498af1b44e5b. Reason for revert: Need to address device-specific modules. Change-Id: Ib7a4191e7f193dfff49b02d3de76dda856800251
* Move error_code.h into otautil.Tao Bao2017-10-042-3/+4
| | | | | | | | | This way it stops requiring relative path ".." in LOCAL_C_INCLUDES (uncrypt and edify). Soong doesn't accept non-local ".." in "local_include_dirs". Test: mmma bootable/recovery Change-Id: Ia4649789cef2aaeb2785483660e9ea5a8b389c62
* edify: Remove edify_parser.Tao Bao2017-10-032-99/+0
| | | | | | | | | | | | | It used to be containing some unit tests for basic edify syntax, which has been moved into recovery_component_test (commit d770d2e7afd8a909156447c2b79d8739228279d7). The edify_parser host tool supports edify built-in functions only, but doesn't recognize the ones defined in updater. This makes it much less useful to do any real analyzing work. Test: mmma bootable/recovery Change-Id: I3c12f5402d2d6698e0ef5ac6c2e7804c0fbba78a
* Turn on -Wall for libedifyTianjie Xu2017-08-312-2/+4
| | | | | | Bug: 64939312 Test: mma Change-Id: Ia4afc6241b1f11ce261be6840f21a793b23014a6
* Remove LOCAL_CLANGLennart Wieboldt2017-07-251-2/+0
| | | | | | | clang is the default compiler since Android nougat Change-Id: I930bba431dc49970cb4491ed5fcf44b5e00e97df Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
* Suppress the unused variable warning in parser.yyTianjie Xu2017-03-281-0/+3
| | | | | | | | | The warning says: bootable/recovery/edify/parser.yy:123.3-9: warning: unused value: $1 Bug: 36678950 Test: mma Change-Id: Ic734c416a5a8f62fb5e516669102c1d2b4ad5083
* Don't fail ReadArgs if length to parse is 0Tianjie Xu2017-03-231-1/+1
| | | | | Test: recovery component tests pass Change-Id: I0946ba498d845ec552ae7e4c79dc94618b2fdf6d
* Remove malloc in edify functionsTianjie Xu2017-03-224-129/+153
| | | | | | | | And switch them to std::vector & std::unique_ptr Bug: 32117870 Test: recovery tests passed on sailfish Change-Id: I5a45951c4bdf895be311d6d760e52e7a1b0798c3
* Cleanup ReadArgs & ReadValueArgs usageTianjie Xu2016-11-012-135/+13
| | | | | | | | ReadArgs will switch to using std::string and std::unique_ptr. Also cleanup the callers. Test: mma & component test passed. Change-Id: I4724406ae6c0c134a27bbd1cdd24ad5d343b2a3b
* Change StringValue to use std::stringTianjie Xu2016-10-153-173/+205
| | | | | | | | | | | Changing the field of 'Value' in edify to std::string from char*. Meanwhile cleaning up the users of 'Value' and switching them to cpp style. Test: compontent tests passed. Bug: 31713288 Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
* edify: Some clean-ups to libedify.Tao Bao2016-10-135-91/+47
| | | | | | | | | | | | - Remove dead declarations in expr.h: SetError(), GetError(), ClearError(). - Remove the declaration of Build() out of expr.h. - Use std::unordered_map to implement RegisterFunction() and FindFunction(); kill FinishRegistration(). - Add a testcase for calling unknown functions. Test: mmma bootable/recovery; recovery_component_test passes. Change-Id: I9af6825ae677f92b22d716a4a5682f58522af03b
* edify: Move State.script and State.errmsg to std::string.Tao Bao2016-10-043-60/+37
| | | | | | | | | | | This way we kill a few strdup() and free() calls. Test: 1. recovery_component_test still passes; 2. Applying an update with the new updater works; 3. The error code in a script with abort("E310: xyz") is recorded into last_install correctly. Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a
* edify: Move the testcases to gtest.Tao Bao2016-10-043-227/+109
| | | | | | | | | | | | | Now they live in tests/component/edify_test.cpp. Also rename edify/main.cpp to edify/edify_parser.cpp. It becomes a host-side debugging tool that validates the input edify script. However, it supports edify builtin functions only and doesn't recognize the ones defined via updater. Test: recovery_component_test passes on device. Change-Id: Ib94a787bf15098a9cc078d256b6a6dc96ff12b2e
* Turn on -Werror for recoveryTianjie Xu2016-09-301-0/+2
| | | | | | | | | | Also remove the 0xff comparison when validating the bootloader message fields. As the fields won't be erased to 0xff after we remove the MTD support. Bug: 28202046 Test: The recovery folder compiles for aosp_x86-eng Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
* resolve merge conflicts of 7ce287d to nyc-dev-plus-aospTianjie Xu2016-06-041-0/+2
|\ | | | | | | Change-Id: I2194d1170281f58eb508f2ef63b39c8729125f76
| * Call ioctl before each write on retryTianjie Xu2016-06-031-0/+2
| | | | | | | | | | | | | | | | If the update is a retry, ioctl(BLKDISCARD) the destination blocks before writing to these blocks. Bug: 28990135 Change-Id: I1e703808e68ebb1292cd66afd76be8fd6946ee59
* | resolve merge conflicts of 50f6417 to nyc-dev-plus-aospTianjie Xu2016-05-233-11/+50
|\| | | | | | | Change-Id: I42c127f7946e678acf6596f6352f090abc0ca019
| * Allow recovery to return error codesTianjie Xu2016-05-203-11/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Write error code, cause code, and retry count into last_install. So we can have more information about the reason of a failed OTA. Example of new last_install: @/cache/recovery/block.map package name 0 install result retry: 1 retry count (new) error: 30 error code (new) cause: 12 error cause (new) Details in: go/android-ota-errorcode Bug: 28471955 Change-Id: I00e7153c821e7355c1be81a86c7f228108f3dc37
* | Fix google-runtime-int warnings.Chih-Hung Hsieh2016-04-181-3/+4
|/ | | | | Bug: 28220065 Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
* edify: accept long string literal.Yabin Cui2016-01-272-13/+16
| | | | | Bug: 24717917 Change-Id: I134cf00ae7efbc3703f976459a1b9f9a197e495d
* Rename .l/.y to .ll/.yyYing Wang2016-01-123-2/+2
| | | | | | | Now to generate .cpp you need to use .ll/.yy. Bug: 26492989 Change-Id: Ib078e03b3b0758f7a62595c343e52ae856bcb33f
* edify: Switch to C++.Tao Bao2015-08-205-37/+27
| | | | Change-Id: I71aede6e29af1dc4bb858a62016c8035db5d3452
* Use CPPFLAGS instead of CFLAGS.Dan Albert2015-08-081-4/+4
| | | | | | | | | | While we build these as C, to the build system they are technically C++ and are subject to the global CPPFLAGS. Set LOCAL_CPPFLAGS here instead of LOCAL_CFLAGS so we can be sure we override anything provided by the build system. Bug: http://b/23043421 Change-Id: I344b54ae4ff9f142365a42c33ba160c1be17a342
* recovery: Switch to clangTao Bao2015-06-031-0/+2
| | | | | | And a few trival fixes to suppress warnings. Change-Id: I38734b5f4434643e85feab25f4807b46a45d8d65
* Remove an uninitialized value.Dan Albert2014-12-181-2/+1
| | | | | | | The assignment of this value was removed in 0d32f25, but the declaration was still there and still tested. Clang issues a warning for this. Change-Id: I748bfb8b4f78ceed1c1b5b1bb80cb4e873e4facc
* Global C++11 compatibility.Dan Albert2014-11-201-3/+4
| | | | | | | | | | | Our build system compiles flex/bison as C++ rather than C, but a few projects add `-x c` to their flags, forcing the compiler to compile them as C. This causes the compiler to reject the global C++ standard flag, so we need to explicitly provide a C standard flag to override it. Bug: 18466763 Change-Id: Id68ad9317261ed4d857a949b07288bd137ff6303
* clean up some warnings when building recoveryDoug Zongker2014-02-145-7/+15
| | | | Change-Id: I1541534ee6978ddf8d548433986679ce9507d508
* recovery: move log output to stdoutDoug Zongker2013-07-092-7/+7
| | | | | | | | Recovery currently has a random mix of messages printed to stdout and messages printed to stderr, which can make logs hard to read. Move everything to stdout. Change-Id: Ie33bd4a9e1272e731302569cdec918e0534c48a6
* minor recovery changesDoug Zongker2012-04-122-2/+10
| | | | | | | | | | | | - add the --just_exit option to make recovery exit normally without doing anything - make it possible to build updater extensions in C++ - add the clear_display command so that the updater binary can request recovery switch to the NONE background UI These are all used to support the notion of using OTA as a factory reflash mechanism. Change-Id: Ib00d1cbf540feff38f52a61a2cf198915b48488c
* make StringValue wrapper okay to call on NULLDoug Zongker2010-02-251-0/+1
| | | | | | | The docs say "don't do this", but it's trivial to make safe. Make StringValue(NULL) return NULL instead of crashing. Change-Id: I2221bcb4c98d8adb4e25c764d7bdcfa787822bcf
* refactor applypatch and friendsDoug Zongker2010-02-232-1/+4
| | | | | | | | | | | | | | | | | | | Change the applypatch function to take meaningful arguments instead of argc and argv. Move all the parsing of arguments into main.c (for the standalone binary) and into install.c (for the updater function). applypatch() takes patches as Value objects, so we can pass in blobs extracted from the package without ever writing them to temp files. The patching code is changed to read the patch from memory instead of a file. A bunch of compiler warnings (mostly about signed vs unsigned types) are fixed. Support for the IMGDIFF1 format is dropped. (We've been generating IMGDIFF2 packages for some time now.) Change-Id: I217563c500012750f27110db821928a06211323f
* add missing includes to fix mac build (maybe)Doug Zongker2010-02-202-0/+4
| | | | Change-Id: Id2712940c4929f3a8b3ba5d4e9e03bb8034747ee
* relocate applypatch; add type system and new functions to edifyDoug Zongker2010-02-182-60/+166
| | | | | | | | | | | | | | | | | | | | | | | | | - Move applypatch to this package (from build). - Add a rudimentary type system to edify: instead of just returning a char*, functions now return a Value*, which is a struct that can carry different types of value (currently just STRING and BLOB). Convert all functions to this new scheme. - Change the one-argument form of package_extract_file to return a Value of the new BLOB type. - Add read_file() to load a local file and return a blob, and sha1_check() to test a blob (or string) against a set of possible sha1s. read_file() uses the file-loading code from applypatch so it can read MTD partitions as well. This is the start of better integration between applypatch and the rest of edify. b/2361316 - VZW Issue PP628: Continuous reset to Droid logo: framework-res.apk update failed (CR LIBtt59130) Change-Id: Ibd038074749a4d515de1f115c498c6c589ee91e5
* Filename check and free allocated stringsKenny Root2010-02-182-0/+7
| | | | | | | Make sure file is valid before we try to read it. Also free all the strings we allocate in various functions so we don't leak memory. Change-Id: Ica3c8dae992e73718c79c12ff5d7e315c290caea
* add file_getprop() to updaterDoug Zongker2009-06-182-0/+17
| | | | | | | Add a function to read a property from a ".prop"-formatted file (key=value pairs, one per line, ignore # comment lines and blank lines). Move ErrorAbort to the core of edify; it's not specific to updater now that errors aren't stored in the app cookie.
* add less_than_int, greater_than_int to edifyDoug Zongker2009-06-132-0/+63
| | | | | | | Add functions less_than_int() and greater_than_int() that interpret their args as ints and do the comparison. ("<" and ">" operators, if implemented, should do string comparison.) This lets us do the build time check currently done by the check_prereq binary.
* fixes to edify and updater scriptDoug Zongker2009-06-126-442/+540
| | | | | | | | | | | | | | | | | | | | | A few more changes to edify: - fix write_raw_image(); my last change neglected to close the write context, so the written image was corrupt. - each expression tracks the span of the source code from which it was compiled, so that assert()'s error message can include the source of the expression that failed. - the 'cookie' argument to each Function is replaced with a State object, which contains the cookie, the source script (for use with the above spans), and the current error message (replacing the global variables that were used for this purpose). - in the recovery image, a new command "ui_print" can be sent back through the command pipe to cause text to appear on the screen. Add a new ui_print() function to print things from scripts. Rename existing "print" function to "stdout".
* edify extensions for OTA package installation, part 2Doug Zongker2009-06-123-8/+11
| | | | | | | | | | | | | | | | | | Adds more edify functions for OTAs: is_mounted getprop apply_patch apply_patch_check apply_patch_space write_raw_image write_firmware_image package_extract_file This allows us to install radios, hboots, boot images, and install incremental OTA packages. Fixes a couple of dumb bugs in edify itself: - we were doubling the size of the function table each time it was *not* full, rather than each time it was full - "no such function" errors weren't visible to the parser, so they didn't prevent execution of the script.
* edify extensions for OTA package installation, part 1Doug Zongker2009-06-126-12/+136
| | | | | | | | | | | | | | | Adds the following edify functions: mount unmount format show_progress delete delete_recursive package_extract symlink set_perm set_perm_recursive This set is enough to extract and install the system part of a (full) OTA package. Adds the updater binary that extracts an edify script from the OTA package and then executes it. Minor changes to the edify core (adds a sleep() builtin for debugging, adds "." to the set of characters that can appear in an unquoted string).
* core of edify, an eventual replacement for amendDoug Zongker2009-06-107-0/+889
Edify is a simple scripting language for OTA installation, to be used when we move to OTAs being installed via binaries shipped with the package.