Merge "Make build_vendor script configurable"

This commit is contained in:
Inseob Kim
2022-08-19 13:00:54 +00:00
committed by Gerrit Code Review

View File

@@ -15,18 +15,48 @@
# limitations under the License.
#
function usage() {
cat <<EOF
Usage: $0 -d device-name -p product-name -r dist-dir
Builds a vendor image for given product and analyze ninja inputs.
-d device name to build (e.g. vsoc_x86_64)
-p product name to build (e.g. cf_x86_64_phone)
-r directory for dist (e.g. out/dist)
-h display this help and exit
EOF
exit
}
while getopts d:p:r:h flag
do
case "${flag}" in
d) device=${OPTARG};;
p) product=${OPTARG};;
r) dist_dir=${OPTARG};;
h) usage;;
*) usage;;
esac
done
if [[ -z "$device" || -z "$product" || -z "$dist_dir" ]]; then
echo "missing arguments"
usage
fi
export ALLOW_MISSING_DEPENDENCIES=true
build/soong/soong_ui.bash --make-mode vendorimage collect_ninja_inputs \
TARGET_PRODUCT=cf_x86_64_phone TARGET_BUILD_VARIANT=userdebug
TARGET_PRODUCT=$product TARGET_BUILD_VARIANT=userdebug
mkdir -p $DIST_DIR/soong
mkdir -p $dist_dir/soong
for f in out/*.ninja out/soong/build.ninja; do
gzip -c $f > $DIST_DIR/${f#out/}.gz
gzip -c $f > $dist_dir/${f#out/}.gz
done
cp out/target/product/vsoc_x86_64/vendor.img $DIST_DIR
cp out/target/product/$device/vendor.img $dist_dir
out/host/linux-x86/bin/collect_ninja_inputs -n prebuilts/build-tools/linux-x86/bin/ninja \
-f out/combined-cf_x86_64_phone.ninja -t vendorimage > $DIST_DIR/ninja_inputs.json
-f out/combined-$product.ninja -t vendorimage > $dist_dir/ninja_inputs.json