# 常用命令
$ allmod
ACameraNdkVendorTest
ACameraNdkVendorTest_32
AImageReaderWindowHandleTest
AImageReaderWindowHandleTest_32
AMRWBEncTest
AMRWBEncTest_32
ANGLE
ATT_profile1.xml
ATT_profile2.xml
ATT_profile3.xml
ATT_profile4.xml
ATT_profile5.xml
ATT_profile6.xml
ATT_profiles.xml
AVCUtilsUnitTest
AVCUtilsUnitTest_32
AaptAutoVersionTest
AaptBasicTest
AaptSymlinkTest
# ... 59000+ in total
$ gomod CarService
$ pathmod CarService
/android/packages/services/Car/service
$ outmod CarService
/android/out/target/product/proj/system/priv-app/CarService/CarService.apk
/android/out/target/product/proj/system/priv-app/CarService/lib/arm64/libcarservicejni.so
/android/out/target/product/proj/system/priv-app/CarService/oat/arm64/CarService.odex
/android/out/target/product/proj/system/priv-app/CarService/oat/arm64/CarService.vdex
$ godir one_source_file_name.cpp
dirmods
refreshmod
sepgrep # sepolicy
cgrep
mgrep # makefile, .bp files
syswrite
$ hmm
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
Selects <product_name> as the product to build, and <build_variant> as the variant to
build, and stores those selections in the environment to be read by subsequent
invocations of 'm' etc.
- tapas: tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
Sets up the build environment for building unbundled apps (APKs).
- banchan: banchan <module1> [<module2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]
Sets up the build environment for building unbundled modules (APEXes).
- croot: Changes directory to the top of the tree, or a subdirectory thereof.
- m: Makes from the top of the tree.
- mm: Builds and installs all of the modules in the current directory, and their
dependencies.
- mmm: Builds and installs all of the modules in the supplied directories, and their
dependencies.
To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma: Same as 'mm'
- mmma: Same as 'mmm'
- provision: Flash device with all required partitions. Options will be passed on to fastboot.
- cgrep: Greps on all local C/C++ files.
- ggrep: Greps on all local Gradle files.
- gogrep: Greps on all local Go files.
- jgrep: Greps on all local Java files.
- ktgrep: Greps on all local Kotlin files.
- resgrep: Greps on all local res/*.xml files.
- mangrep: Greps on all local AndroidManifest.xml files.
- mgrep: Greps on all local Makefiles and *.bp files.
- owngrep: Greps on all local OWNERS files.
- rsgrep: Greps on all local Rust files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
- pathmod: Get the directory containing a module.
- outmod: Gets the location of a module's installed outputs with a certain extension.
- dirmods: Gets the modules defined in a given directory.
- installmod: Adb installs a module's built APK.
- refreshmod: Refresh list of modules for allmod/gomod/pathmod/outmod/installmod.
- syswrite: Remount partitions (e.g. system.img) as writable, rebooting if necessary.
Environment options:
- SANITIZE_HOST: Set to 'address' to use ASAN for all host modules.
- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages.
Look at the source to view more functions. The complete list is:
addcompletions add_lunch_combo allmod banchan bazel build_build_var_cache call_hook cgrep check_product check_type check_variant choosecombo chooseproduct choosetype choosevariant _complete_android_module_names core coredump_enable coredump_setup cproj _croot croot destroy_build_var_cache dirmods enable_zsh_completion get_abs_build_var getbugreports get_build_var getlastscreenshot get_make_command getprebuilt getscreenshotpath getsdcardpath gettargetarch gettop ggrep godir gogrep gomod hmm installmod is isviewserverstarted jgrep key_back key_home key_menu ktgrep _lunch lunch m make mangrep mgrep mm mma mmm mmma outmod owngrep pathmod pez printconfig print_lunch_menu provision qpid rcgrep refreshmod resgrep rsgrep runhat runtest sepgrep setpaths set_sequence_number set_stuff_for_environment sgrep should_add_completion showcommands smoketest source_vendorsetup startviewserver stopviewserver systemstack syswrite tapas tracedmdump treegrep _trigger_build validate_current_shell verifymodinfo _wrap_build
$ m help
$ make help
m [<goals>] # Execute the configured build.
Common goals are:
clean (aka clobber) equivalent to rm -rf out/
checkbuild Build every module defined in the source tree
droid Default target
nothing Do not build anything, just parse and validate the build structure
java Build all the java code in the source tree
native Build all the native code in the source tree
host Build all the host code (not to be run on a device) in the source tree
target Build all the target code (to be run on the device) in the source tree
(java|native)-(host|target)
(host|target)-(java|native)
Build the intersection of the two given arguments
snod Quickly rebuild the system image from built packages
Stands for "System, NO Dependencies"
vnod Quickly rebuild the vendor image from built packages
Stands for "Vendor, NO Dependencies"
pnod Quickly rebuild the product image from built packages
Stands for "Product, NO Dependencies"
senod Quickly rebuild the system_ext image from built packages
Stands for "SystemExt, NO Dependencies"
onod Quickly rebuild the odm image from built packages
Stands for "Odm, NO Dependencies"
vdnod Quickly rebuild the vendor_dlkm image from built packages
Stands for "VendorDlkm, NO Dependencies"
odnod Quickly rebuild the odm_dlkm image from built packages
Stands for "OdmDlkm, NO Dependencies"
Android源码编译命令 m/mm/mmm/hmm
于 2024-10-21 15:10:42 首次发布