update_engine: Use the bsdiff library instead of its executable
Currently we use bsdiff binary to generate BSDIFF and SOURCE_BSDIFF
operations. This involves writing both the source and destination
extents into disk and letting bsdiff read them again into memory. Now
that we actually can use the bsdiff library itself, why not use the
provided bsdiff library functions that can directly read source and
destination data from the memory that we already have. This CL will
reduce the patch generating time and memory footprint.
BUG=none
TEST=cros_workon_make --board=amd64-generic --test update_engine; \
brillo_update_payload generate --payload=payload.delta \
--target_image=veyron-minnie-R62-9804.0.0.bin --source_image=veyron_minnie-R61-9765.13.0.bin
Change-Id: Ib115eb5186c133d56dab91f73a2bde3176f5732d
Reviewed-on: https://chromium-review.googlesource.com/602887
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
diff --git a/Android.mk b/Android.mk
index bf9b678..07d5998 100644
--- a/Android.mk
+++ b/Android.mk
@@ -607,9 +607,10 @@
# server-side code. This is used for delta_generator and unittests but not
# for any client code.
ue_libpayload_generator_exported_static_libraries := \
+ libbsdiff \
libpayload_consumer \
- update_metadata-protos \
liblzma \
+ update_metadata-protos \
$(ue_libpayload_consumer_exported_static_libraries) \
$(ue_update_metadata_protos_exported_static_libraries)
ue_libpayload_generator_exported_shared_libraries := \
@@ -654,9 +655,10 @@
LOCAL_LDFLAGS := $(ue_common_ldflags)
LOCAL_C_INCLUDES := $(ue_common_c_includes)
LOCAL_STATIC_LIBRARIES := \
+ libbsdiff \
libpayload_consumer \
- update_metadata-protos \
liblzma \
+ update_metadata-protos \
$(ue_common_static_libraries) \
$(ue_libpayload_consumer_exported_static_libraries) \
$(ue_update_metadata_protos_exported_static_libraries)
@@ -704,8 +706,6 @@
# Build for the host.
include $(CLEAR_VARS)
LOCAL_MODULE := delta_generator
-LOCAL_REQUIRED_MODULES := \
- bsdiff
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_CPP_EXTENSION := .cc
LOCAL_CLANG := true
@@ -848,28 +848,6 @@
test_http_server.cc
include $(BUILD_EXECUTABLE)
-# bsdiff (type: executable)
-# ========================================================
-# We need bsdiff in the update_engine_unittests directory, so we build it here.
-include $(CLEAR_VARS)
-LOCAL_MODULE := ue_unittest_bsdiff
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/update_engine_unittests
-LOCAL_MODULE_STEM := bsdiff
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_SRC_FILES := ../../external/bsdiff/bsdiff_main.cc
-LOCAL_CFLAGS := \
- -D_FILE_OFFSET_BITS=64 \
- -Wall \
- -Werror \
- -Wextra \
- -Wno-unused-parameter
-LOCAL_STATIC_LIBRARIES := \
- libbsdiff \
- libbz \
- libdivsufsort64 \
- libdivsufsort
-include $(BUILD_EXECUTABLE)
-
# test_subprocess (type: executable)
# ========================================================
# Test helper subprocess program.
@@ -896,7 +874,6 @@
LOCAL_REQUIRED_MODULES := \
test_http_server \
test_subprocess \
- ue_unittest_bsdiff \
ue_unittest_delta_generator \
ue_unittest_disk_ext2_1k.img \
ue_unittest_disk_ext2_4k.img \