From 7ae01698424cc3adf635c324961b1405594f5156 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 16 May 2019 14:42:42 -0700 Subject: Add misc_writer. bootloader_message.h currently divides /misc into four segments. The space between 2K and 16K is reserved for vendor use (e.g. bootloader persists flags). This CL adds a vendor tool "misc_writer", to allow writing data to the vendor space in /misc, before getting a dedicated HAL for accessing /misc partition (b/131775112). Targets need to explicitly include the module, then invoke the executable to write data. For example, the following command will write 3-byte data ("0xABCDEF") to offset 4 in vendor space (i.e. 2048 + 4 in /misc). $ /vendor/bin/misc_writer --vendor-space-offset 4 --hex-string 0xABCDEF Bug: 132906936 Test: Run recovery_unit_test on crosshatch. Test: Call the command via init.hardware.rc on crosshatch. Check that the call finishes successfully. Then check the contents written to /misc (`dd bs=1 skip=2048 if=/dev/block/sda2 count=32 | xxd`). Change-Id: I79548fc63fc79b705a0320868690569c3106949f --- bootloader_message/Android.bp | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'bootloader_message/Android.bp') diff --git a/bootloader_message/Android.bp b/bootloader_message/Android.bp index e76305fd7..8d72a1163 100644 --- a/bootloader_message/Android.bp +++ b/bootloader_message/Android.bp @@ -14,10 +14,8 @@ // limitations under the License. // -cc_library { - name: "libbootloader_message", - recovery_available: true, - host_supported: true, +cc_defaults { + name: "libbootloader_message_defaults", srcs: ["bootloader_message.cpp"], cflags: [ "-Wall", @@ -26,24 +24,36 @@ cc_library { shared_libs: [ "libbase", ], + static_libs: [ + "libfstab", + ], export_include_dirs: ["include"], +} + +cc_library { + name: "libbootloader_message", + defaults: [ + "libbootloader_message_defaults", + ], + recovery_available: true, + host_supported: true, target: { - android: { - shared_libs: [ - "libfs_mgr", - ], - }, host: { shared_libs: [ "libcutils", // for strlcpy ], - static_libs: [ - "libfstab", - ], }, darwin: { enabled: false, }, } } + +cc_library_static { + name: "libbootloader_message_vendor", + defaults: [ + "libbootloader_message_defaults", + ], + vendor: true, +} -- cgit v1.2.3