nj

cp prebuilts/build-tools/linux-x86/bin/ninja out/host/linux-x86/bin/

ln -sf out/combined-***.ninja  build.ninja

 

ninja services // 单独编译services模块,参数一般是so库的名字(比如:libsurfaceflinger, which can find from android.bp in the SF module)

 

编译kernel:

ninja bootimage

 

编译services  生成目录为oat  

lunch后执行如下命令

export WITH_DEXPREOPT=false

make services

 

如果执行ninja进行快速编译时,遇到如下错误:

ninja: error while loading shared libraries: libjemalloc.so: cannot open shared object file: No such file or directory

使用如下解决方法:

sudo cp prebuilts/build-tools/linux-x86/lib64/libjemalloc.so /usr/lib

 

 

#!/bin/bash


color_black_on="printf \033[30m"
color_red_on="printf \033[31m"
color_green_on="printf \033[32m"
color_yellow_on="printf \033[33m"
color_blue_on="printf \033[34m"
color_purple_on="printf \033[35m"
color_cyan_on="printf \033[36m"
color_white_on="printf \033[37m"

color_off="printf \033[0m"

function green_echo()
{
$color_green_on
echo "$1"
$color_off
}

function red_echo()
{
$color_red_on
echo "$1"
$color_off
}

#-------------------------------------------------

date

if [ -z "$TARGET_PRODUCT" ]; then
red_echo "Please source and lunch, exit!"
exit 1
fi


ninja_bin="$ANDROID_BUILD_TOP/prebuilts/build-tools/linux-x86/bin/ninja"
if [ ! -f $ninja_bin ]; then
red_echo "Can't find ninja binary $ninja_bin"
exit 1
fi

ninja_build_file="$ANDROID_BUILD_TOP/out/combined-$TARGET_PRODUCT.ninja"
if [ ! -f $ninja_build_file ]; then
red_echo "Can't find ninja build file $ninja_build_file"
exit 1
fi


start_time=`date +%s`

$ninja_bin -f $ninja_build_file $*
ret=$?

time=$((`date +%s` - start_time))
$color_green_on
printf "ninja build time: %02d:%02d:%02d\n\n" $((time/3600)) $((time%3600/60)) $((time%60))
$color_off

if [ $ret -ne 0 ] ;then
exit 1
fi

上一篇:SQLyog MySQL GUI 11.13 Ultimate 中文破解版【转载】


下一篇:鸿蒙内核源码分析(GN应用篇) | GN语法及在鸿蒙的使用 | 百篇博客分析HarmonyOS源码 | v60.01