Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66209ca9 authored by Tao Bao's avatar Tao Bao
Browse files

init: init_defaults uses more shared libraries.

This CL switches init_defaults and thus init_second_stage to depend on
commonly used shared libraries. In particular, use the following shared
libs that have been available on device (under both of normal boot and
recovery):
 - libbootloader_message
 - libext4_utils
 - libfs_mgr
 - libhidl-gen-utils
 - libkeyutils
 - liblogwrap

The following transitive dependencies have been dropped. They were only
needed when including the above libs statically. Dropping them doesn't
further affect the size though.
 - libfec
 - libfec_rs
 - libsquashfs_utils

With the change, the second stage init size has been reduced from
1094328 to 627992 bytes (aosp_taimen-userdebug), with no new shared libs
installed.

Also evaluated the impact of using `libprotobuf-cpp-lite.so` and
`libseccomp_policy.so`. It doesn't look beneficial -- at least not right
now with `init` as the singler user.
 - statically linked them both: 627992-byte
 - with libprotobuf-cpp-lite.so: 605880 (init) + 262624 (.so)
 - with libseccomp_policy.so: 605848 (init) + 32208 (.so)

Bug: 112494634
Test: `mmma -j system/core/init` with aosp_marlin-userdebug
Test: Flash the marlin build on device. Run init_test.
Test: Boot into recovery successfully.
Change-Id: I49debe9066ff36dfda55b08266862e29e2bfc96b
parent a37dada0
Loading
Loading
Loading
Loading
+8 −17
Original line number Diff line number Diff line
@@ -59,33 +59,24 @@ cc_defaults {
        },
    },
    static_libs: [
        "libbootloader_message",
        "libfs_mgr",
        "libfec",
        "libfec_rs",
        "libhidl-gen-utils",
        "libsquashfs_utils",
        "liblogwrap",
        "libext4_utils",
        "libseccomp_policy",
        "libcrypto_utils",
        "libsparse",
        "libprocessgroup",
        "libavb",
        "libkeyutils",
        "libprotobuf-cpp-lite",
        "libpropertyinfoserializer",
        "libpropertyinfoparser",
    ],
    shared_libs: [
        "libcutils",
        "libbase",
        "libc",
        "liblog",
        "libcrypto",
        "libc++",
        "libbootloader_message",
        "libcutils",
        "libdl",
        "libz",
        "libext4_utils",
        "libfs_mgr",
        "libhidl-gen-utils",
        "libkeyutils",
        "liblog",
        "liblogwrap",
        "libselinux",
    ],
}