【Crhomium】Arm平台编译配置

阅读: 评论:0

【Crhomium】Arm平台编译配置

【Crhomium】Arm平台编译配置

Chromium Arm平台编译配置

  • 以下内容以Chromium67为准。
  • Chromium支持多平台编译,如Linux、android、MAC。在编译时,可以指定cpu类型,如
current_cpu="arm"
# 或
current_cpu="arm64"
  • 当指定cpu类型时,chromium的gn编译系统便会根据指定的CPU类型,进行设置。
  • 这里,分析以下当cpu类型为arm时,chromium的bulid/config模块,所做的配置。
Arm Config for build
  • 源码路径:
    src/build/i
  • Chromium官网链接: /+/master/build/i
  • 内容如下:
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/v8_i")
# These are primarily relevant in current_cpu == "arm" contexts, where
# ARM code is being compiled.  But they can also be relevant in the
# other contexts when the code will change its behavior based on the
# cpu it wants to generate code for.
if (current_cpu == "arm" || v8_current_cpu == "arm") {declare_args() {# Version of the ARM processor when compiling on ARM. Ignored on non-ARM# platforms.arm_version = 7# The ARM architecture. This will be a string like "armv6" or "armv7-a".# An empty string means to use the default for the arm_version.arm_arch = ""# The ARM floating point hardware. This will be a string like "neon" or# "vfpv3". An empty string means to use the default for the arm_version.arm_fpu = ""# The ARM floating point mode. This is either the string "hard", "soft", or# "softfp". An empty string means to use the default one for the# arm_version.arm_float_abi = ""# The ARM variant-specific tuning mode. This will be a string like "armv6"# or "cortex-a15". An empty string means to use the default for the# arm_version.arm_tune = ""# Whether to use the neon FPU instruction set or not.arm_use_neon = ""# Whether to enable optional NEON code paths.arm_optionally_use_neon = false# Thumb is a reduced instruction set available on some ARM processors that# has increased code density.arm_use_thumb = true}assert(arm_float_abi == "" || arm_float_abi == "hard" ||arm_float_abi == "soft" || arm_float_abi == "softfp")if (arm_use_neon == "") {if (current_os == "linux" && target_cpu != v8_target_cpu) {# Don't use neon on V8 simulator builds as a default.arm_use_neon = false} else {arm_use_neon = true}}if (arm_version == 6) {if (arm_arch == "") {arm_arch = "armv6"}if (arm_tune != "") {arm_tune = ""}if (arm_float_abi == "") {arm_float_abi = "softfp"}if (arm_fpu == "") {arm_fpu = "vfp"}arm_use_thumb = falsearm_use_neon = false} else if (arm_version == 7) {if (arm_arch == "") {arm_arch = "armv7-a"}if (arm_tune == "") {arm_tune = "generic-armv7-a"}if (arm_float_abi == "") {if (current_os == "android" || target_os == "android") {arm_float_abi = "softfp"} else if (current_os == "linux" && target_cpu != v8_target_cpu) {# Default to the same as Android for V8 simulator builds.arm_float_abi = "softfp"} else {arm_float_abi = "hard"}}if (arm_fpu == "") {if (arm_use_neon) {arm_fpu = "neon"} else {arm_fpu = "vfpv3-d16"}}} else if (arm_version == 8) {if (arm_arch == "") {arm_arch = "armv8-a"}if (arm_tune == "") {arm_tune = "generic-armv8-a"}if (arm_float_abi == "") {if (current_os == "android" || target_os == "android") {arm_float_abi = "softfp"} else {arm_float_abi = "hard"}}if (arm_fpu == "") {if (arm_use_neon) {arm_fpu = "neon"} else {arm_fpu = "vfpv3-d16"}}}
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {# arm64 supports only "hard".arm_float_abi = "hard"arm_use_neon = true
}
  • 分析:
  1. 首先,如果当前cpu类型为arm,或者v8当前cpu类型为arm。定义一系列参数,这些参数为默认参数。如果之前定义过,便不再定义(比如在编译时,指定了arm_float_abi(软/硬浮点))。
  declare_args() {# Version of the ARM processor when compiling on ARM. Ignored on non-ARM# platforms.arm_version = 7# The ARM architecture. This will be a string like "armv6" or "armv7-a".# An empty string means to use the default for the arm_version.arm_arch = ""# The ARM floating point hardware. This will be a string like "neon" or# "vfpv3". An empty string means to use the default for the arm_version.arm_fpu = ""# The ARM floating point mode. This is either the string "hard", "soft", or# "softfp". An empty string means to use the default one for the# arm_version.arm_float_abi = ""# The ARM variant-specific tuning mode. This will be a string like "armv6"# or "cortex-a15". An empty string means to use the default for the# arm_version.arm_tune = ""# Whether to use the neon FPU instruction set or not.arm_use_neon = ""# Whether to enable optional NEON code paths.arm_optionally_use_neon = false# Thumb is a reduced instruction set available on some ARM processors that# has increased code density.arm_use_thumb = true}
  1. 之后,就是一系列判断,对arm类型所要使用的编译参数进行判断。关于这些编译参数的具体含义,可自行百度。
# 软浮点或硬浮点
arm_float_abi
# arm架构
arm_arch
# 是否使用neno
arm_use_neon
# 是否使用thumb
arm_use_thumb
# fpu类型
arm_fpu
  1. 在定义好一系列编译参数后,使用arm编译器进行编译。

GNI文件,并非编译文件,而且模板文件。编译系统如何使用它?
答:在.gn文件中,通过import引入模板文件(有点类型C++的头文件)中的定义。

  • 例:src/,在该gn文件开头,我们可以看到import了i文件。
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.import("//build/config/i")
import("//build/i")
import("//build/config/dcheck_i")
import("//build/config/i")
import("//build/i")
import("//build/i")
import("//build/config/i")
.....

本文发布于:2024-02-05 00:50:05,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170720293461511.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:平台   Crhomium   Arm
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23