b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # Copyright (C) 2006-2013 OpenWrt.org |
| 2 | # |
| 3 | # This is free software, licensed under the GNU General Public License v2. |
| 4 | # See /LICENSE for more information. |
| 5 | # |
| 6 | |
| 7 | menuconfig TARGET_OPTIONS |
| 8 | bool "Target Options" if DEVEL |
| 9 | |
| 10 | config TARGET_OPTIMIZATION |
| 11 | string "Target Optimizations" if TARGET_OPTIONS |
| 12 | default DEFAULT_TARGET_OPTIMIZATION |
| 13 | help |
| 14 | Optimizations to use when building for the target host. |
| 15 | |
| 16 | config SOFT_FLOAT |
| 17 | bool "Use software floating point by default" if TARGET_OPTIONS |
| 18 | default y if !HAS_FPU |
| 19 | depends on arm || armeb || powerpc || mipsel || mips || mips64el || mips64 |
| 20 | help |
| 21 | If your target CPU does not have a Floating Point Unit (FPU) or a |
| 22 | kernel FPU emulator, but you still wish to support floating point |
| 23 | functions, then everything will need to be compiled with soft floating |
| 24 | point support (-msoft-float). |
| 25 | |
| 26 | Most people will answer N. |
| 27 | |
| 28 | config USE_MIPS16 |
| 29 | bool "Build packages with MIPS16 instructions" if TARGET_OPTIONS |
| 30 | depends on HAS_MIPS16 |
| 31 | default y |
| 32 | help |
| 33 | If your target CPU does support the MIPS16 instruction set |
| 34 | and you want to use it for packages, enable this option. |
| 35 | MIPS16 produces smaller binaries thus reducing pressure on |
| 36 | caches and TLB. |
| 37 | |
| 38 | Most people will answer N. |
| 39 | |
| 40 | |
| 41 | choice BPF_TOOLCHAIN |
| 42 | prompt "BPF toolchain" if DEVEL |
| 43 | default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN |
| 44 | default BPF_TOOLCHAIN_BUILD_LLVM |
| 45 | |
| 46 | config BPF_TOOLCHAIN_NONE |
| 47 | bool "None" |
| 48 | |
| 49 | config BPF_TOOLCHAIN_PREBUILT |
| 50 | bool "Use prebuilt LLVM toolchain" |
| 51 | depends on HAS_PREBUILT_LLVM_TOOLCHAIN |
| 52 | select USE_LLVM_PREBUILT |
| 53 | |
| 54 | config BPF_TOOLCHAIN_HOST |
| 55 | select USE_LLVM_HOST |
| 56 | bool "Use host LLVM toolchain" |
| 57 | |
| 58 | config BPF_TOOLCHAIN_BUILD_LLVM |
| 59 | select USE_LLVM_BUILD if NEED_BPF_TOOLCHAIN |
| 60 | bool "Build LLVM toolchain for eBPF" |
| 61 | help |
| 62 | If enabled, a LLVM toolchain for building eBPF binaries will be built. |
| 63 | If this is not enabled, eBPF packages can only be built if the host |
| 64 | has a suitable toolchain |
| 65 | endchoice |
| 66 | |
| 67 | config BPF_TOOLCHAIN_HOST_PATH |
| 68 | string |
| 69 | depends on BPF_TOOLCHAIN_HOST |
| 70 | prompt "Host LLVM toolchain path (prefix)" if DEVEL |
| 71 | default "/usr/local/opt/llvm" if HOST_OS_MACOS |
| 72 | default "" |
| 73 | |
| 74 | menuconfig EXTERNAL_TOOLCHAIN |
| 75 | bool |
| 76 | prompt "Use external toolchain" if DEVEL |
| 77 | help |
| 78 | If enabled, the buildroot will compile using an existing toolchain instead of |
| 79 | compiling one. |
| 80 | |
| 81 | config NATIVE_TOOLCHAIN |
| 82 | bool |
| 83 | prompt "Use host's toolchain" if DEVEL |
| 84 | depends on EXTERNAL_TOOLCHAIN |
| 85 | select NO_STRIP |
| 86 | help |
| 87 | If enabled, the buildroot will compile using the native toolchain for your |
| 88 | host instead of compiling one. |
| 89 | |
| 90 | config TARGET_NAME |
| 91 | string |
| 92 | prompt "Target name" if DEVEL |
| 93 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 94 | default "aarch64-unknown-linux-gnu" if aarch64 |
| 95 | default "aarch64_be-unknown-linux-gnu" if aarch64_be |
| 96 | default "arm-unknown-linux-gnu" if arm |
| 97 | default "armeb-unknown-linux-gnu" if armeb |
| 98 | default "i486-unknown-linux-gnu" if i386 |
| 99 | default "loongarch64-unknown-linux-gnu" if loongarch64 |
| 100 | default "mips-unknown-linux-gnu" if mips |
| 101 | default "mipsel-unknown-linux-gnu" if mipsel |
| 102 | default "powerpc-unknown-linux-gnu" if powerpc |
| 103 | default "x86_64-unknown-linux-gnu" if x86_64 |
| 104 | |
| 105 | config TOOLCHAIN_PREFIX |
| 106 | string |
| 107 | prompt "Toolchain prefix" if DEVEL |
| 108 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 109 | default "aarch64-unknown-linux-gnu" if aarch64 |
| 110 | default "aarch64_be-unknown-linux-gnu" if aarch64_be |
| 111 | default "arm-unknown-linux-gnu-" if arm |
| 112 | default "armeb-unknown-linux-gnu-" if armeb |
| 113 | default "i486-unknown-linux-gnu-" if i386 |
| 114 | default "loongarch64-unknown-linux-gnu-" if loongarch64 |
| 115 | default "mips-unknown-linux-gnu-" if mips |
| 116 | default "mipsel-unknown-linux-gnu-" if mipsel |
| 117 | default "powerpc-unknown-linux-gnu-" if powerpc |
| 118 | default "x86_64-unknown-linux-gnu-" if x86_64 |
| 119 | |
| 120 | config TOOLCHAIN_ROOT |
| 121 | string |
| 122 | prompt "Toolchain root" if DEVEL |
| 123 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 124 | default "/opt/cross/aarch64-unknown-linux-gnu" if aarch64 |
| 125 | default "/opt/cross/aarch64_be-unknown-linux-gnu" if aarch64_be |
| 126 | default "/opt/cross/arm-unknown-linux-gnu" if arm |
| 127 | default "/opt/cross/armeb-unknown-linux-gnu" if armeb |
| 128 | default "/opt/cross/i486-unknown-linux-gnu" if i386 |
| 129 | default "/opt/cross/loongarch64-unknown-linux-gnu" if loongarch64 |
| 130 | default "/opt/cross/mips-unknown-linux-gnu" if mips |
| 131 | default "/opt/cross/mipsel-unknown-linux-gnu" if mipsel |
| 132 | default "/opt/cross/powerpc-unknown-linux-gnu" if powerpc |
| 133 | default "/opt/cross/x86_64-unknown-linux-gnu" if x86_64 |
| 134 | |
| 135 | choice TOOLCHAIN_LIBC_TYPE |
| 136 | prompt "Toolchain libc" if DEVEL |
| 137 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 138 | default EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL |
| 139 | help |
| 140 | Specify the libc type used by the external toolchain. The given value |
| 141 | is passed as -m flag to all gcc and g++ invocations. This is mainly |
| 142 | intended for multilib toolchains which support glibc and uclibc at |
| 143 | the same time. If no value is specified, no -m flag is passed. |
| 144 | |
| 145 | config EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC |
| 146 | bool "glibc" |
| 147 | select USE_GLIBC |
| 148 | |
| 149 | config EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL |
| 150 | bool "musl" |
| 151 | select USE_MUSL |
| 152 | |
| 153 | endchoice |
| 154 | |
| 155 | config EXTERNAL_GCC_VERSION |
| 156 | string |
| 157 | prompt "External Toolchain GCC Version" if DEVEL |
| 158 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 159 | help |
| 160 | Manually specify the GCC version used by the selected |
| 161 | external toolchain. |
| 162 | |
| 163 | config TOOLCHAIN_LIBC |
| 164 | string |
| 165 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 166 | default "glibc" if EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC |
| 167 | default "musl" if EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL |
| 168 | |
| 169 | config TOOLCHAIN_BIN_PATH |
| 170 | string |
| 171 | prompt "Toolchain program path" if DEVEL |
| 172 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 173 | default "./usr/bin ./bin" |
| 174 | help |
| 175 | Specify additional directories searched for toolchain binaries |
| 176 | (override PATH). Use ./DIR for directories relative to the root above. |
| 177 | |
| 178 | config TOOLCHAIN_INC_PATH |
| 179 | string |
| 180 | prompt "Toolchain include path" if DEVEL |
| 181 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 182 | default "./usr/include ./include/fortify ./include" if EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL |
| 183 | default "./usr/include ./include" |
| 184 | help |
| 185 | Specify additional directories searched for header files (override |
| 186 | CPPFLAGS). Use ./DIR for directories relative to the root above. |
| 187 | |
| 188 | config TOOLCHAIN_LIB_PATH |
| 189 | string |
| 190 | prompt "Toolchain library path" if DEVEL |
| 191 | depends on EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN |
| 192 | default "./usr/lib ./lib" |
| 193 | help |
| 194 | Specify additional directories searched for libraries (override LDFLAGS). |
| 195 | Use ./DIR for directories relative to the root above. |
| 196 | |
| 197 | config NEED_TOOLCHAIN |
| 198 | bool |
| 199 | depends on DEVEL |
| 200 | default y if !EXTERNAL_TOOLCHAIN |
| 201 | |
| 202 | menuconfig TOOLCHAINOPTS |
| 203 | bool "Toolchain Options" if DEVEL |
| 204 | depends on NEED_TOOLCHAIN |
| 205 | |
| 206 | menuconfig EXTRA_TARGET_ARCH |
| 207 | bool |
| 208 | prompt "Enable an extra toolchain target architecture" if TOOLCHAINOPTS |
| 209 | depends on !sparc |
| 210 | help |
| 211 | Some builds may require a 'biarch' toolchain. This option |
| 212 | allows you to specify an additional target arch. |
| 213 | |
| 214 | Most people will answer N here. |
| 215 | |
| 216 | config EXTRA_TARGET_ARCH_NAME |
| 217 | string |
| 218 | prompt "Extra architecture name" if EXTRA_TARGET_ARCH |
| 219 | help |
| 220 | Specify the cpu name (eg powerpc64 or x86_64) of the |
| 221 | additional target architecture. |
| 222 | |
| 223 | config EXTRA_TARGET_ARCH_OPTS |
| 224 | string |
| 225 | prompt "Extra architecture compiler options" if EXTRA_TARGET_ARCH |
| 226 | help |
| 227 | If you're specifying an addition target architecture, |
| 228 | you'll probably need to also provide options to make |
| 229 | the compiler use this alternate arch. |
| 230 | |
| 231 | For example, if you're building a compiler that can build |
| 232 | both powerpc and powerpc64 binaries, you'll need to |
| 233 | specify -m64 here. |
| 234 | |
| 235 | |
| 236 | choice |
| 237 | prompt "MIPS64 user-land ABI" if TOOLCHAINOPTS && (mips64 || mips64el) |
| 238 | default MIPS64_ABI_N64 |
| 239 | help |
| 240 | MIPS64 supports 3 different user-land ABIs: o32 (legacy), |
| 241 | n32 and n64. |
| 242 | |
| 243 | config MIPS64_ABI_N64 |
| 244 | bool "n64" |
| 245 | |
| 246 | config MIPS64_ABI_N32 |
| 247 | depends on !LIBC_USE_MUSL |
| 248 | bool "n32" |
| 249 | |
| 250 | config MIPS64_ABI_O32 |
| 251 | bool "o32" |
| 252 | |
| 253 | endchoice |
| 254 | |
| 255 | comment "Binary tools" |
| 256 | depends on TOOLCHAINOPTS |
| 257 | |
| 258 | source "toolchain/binutils/Config.in" |
| 259 | |
| 260 | config DWARVES |
| 261 | bool |
| 262 | prompt "Build pahole" if TOOLCHAINOPTS |
| 263 | depends on !HOST_OS_MACOS |
| 264 | help |
| 265 | Enable if you want to build pahole and the dwarves tools. |
| 266 | |
| 267 | comment "Compiler" |
| 268 | depends on TOOLCHAINOPTS |
| 269 | |
| 270 | source "toolchain/gcc/Config.in" |
| 271 | |
| 272 | config NASM |
| 273 | bool |
| 274 | depends on ( i386 || x86_64 ) |
| 275 | prompt "Build nasm" if TOOLCHAINOPTS |
| 276 | default y |
| 277 | help |
| 278 | Enable if you want to build nasm |
| 279 | |
| 280 | comment "C Library" |
| 281 | depends on TOOLCHAINOPTS |
| 282 | |
| 283 | choice |
| 284 | prompt "C Library implementation" if TOOLCHAINOPTS |
| 285 | default LIBC_USE_GLIBC if arc |
| 286 | default LIBC_USE_MUSL |
| 287 | help |
| 288 | Select the C library implementation. |
| 289 | |
| 290 | config LIBC_USE_GLIBC |
| 291 | bool "Use glibc" |
| 292 | select USE_GLIBC |
| 293 | |
| 294 | config LIBC_USE_MUSL |
| 295 | select USE_MUSL |
| 296 | bool "Use musl" |
| 297 | depends on !arc |
| 298 | |
| 299 | endchoice |
| 300 | |
| 301 | source "toolchain/musl/Config.in" |
| 302 | |
| 303 | comment "Debuggers" |
| 304 | depends on TOOLCHAINOPTS |
| 305 | |
| 306 | config GDB |
| 307 | bool |
| 308 | prompt "Build gdb" if TOOLCHAINOPTS |
| 309 | default y if !EXTERNAL_TOOLCHAIN |
| 310 | help |
| 311 | Enable if you want to build the gdb. |
| 312 | |
| 313 | config GDB_PYTHON |
| 314 | bool |
| 315 | depends on GDB |
| 316 | prompt "Build gdb with python binding" |
| 317 | |
| 318 | help |
| 319 | Enable the python bindings for GDB to allow using python in the gdb shell. |
| 320 | |
| 321 | config HAS_BPF_TOOLCHAIN |
| 322 | default y if !BPF_TOOLCHAIN_NONE |
| 323 | bool |
| 324 | |
| 325 | config NEED_BPF_TOOLCHAIN |
| 326 | bool |
| 327 | |
| 328 | config HAS_PREBUILT_LLVM_TOOLCHAIN |
| 329 | def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n) |
| 330 | |
| 331 | config USE_LLVM_HOST |
| 332 | bool |
| 333 | |
| 334 | config USE_LLVM_PREBUILT |
| 335 | default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN |
| 336 | bool |
| 337 | |
| 338 | config USE_LLVM_BUILD |
| 339 | default y if !DEVEL && NEED_BPF_TOOLCHAIN && (BUILDBOT || !HAS_PREBUILT_LLVM_TOOLCHAIN) |
| 340 | bool |
| 341 | |
| 342 | config USE_GLIBC |
| 343 | default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc) |
| 344 | bool |
| 345 | |
| 346 | config USE_MUSL |
| 347 | default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && !(arc) |
| 348 | bool |
| 349 | |
| 350 | config SSP_SUPPORT |
| 351 | default y if !PKG_CC_STACKPROTECTOR_NONE |
| 352 | bool |
| 353 | |
| 354 | config USE_EXTERNAL_LIBC |
| 355 | bool |
| 356 | default y if EXTERNAL_TOOLCHAIN || NATIVE_TOOLCHAIN |
| 357 | |
| 358 | source "toolchain/binutils/Config.version" |
| 359 | source "toolchain/gcc/Config.version" |
| 360 | |
| 361 | config LIBC |
| 362 | string |
| 363 | default "glibc" if USE_GLIBC |
| 364 | default "musl" if USE_MUSL |
| 365 | |
| 366 | config TARGET_SUFFIX |
| 367 | string |
| 368 | default "gnueabi" if USE_GLIBC && (arm || armeb) |
| 369 | default "gnu" if USE_GLIBC && !(arm || armeb) |
| 370 | default "muslgnueabi" if USE_MUSL && (arm || armeb) |
| 371 | default "musl" if USE_MUSL && !(arm || armeb) |
| 372 | |
| 373 | config MIPS64_ABI |
| 374 | depends on mips64 || mips64el |
| 375 | string |
| 376 | default "64" if MIPS64_ABI_N64 |
| 377 | default "n32" if MIPS64_ABI_N32 |
| 378 | default "32" if MIPS64_ABI_O32 |
| 379 | default "64" |