d615d2d800
This merges the 5.10.210 LTS releases into the android12-5.10 branch. Included in here are the following commits: *47e789159e
Revert "hrtimer: Report offline hrtimer enqueue" *c5fa21f10b
Revert "scsi: core: Introduce enum scsi_disposition" *7c333b5976
Revert "scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler" *d32a2a4b7b
Revert "scsi: core: Move scsi_host_busy() out of host lock if it is for per-command" *b2600e62c4
Revert "bpf: Add map and need_defer parameters to .map_fd_put_ptr()" *379ac05cc3
Revert "drm/mipi-dsi: Fix detach call without attach" *0412bcfd88
Revert "serial: Add rs485_supported to uart_port" *8e1cc643b1
Revert "serial: 8250_exar: Fill in rs485_supported" *e18733695d
Revert "serial: 8250_exar: Set missing rs485_supported flag" *8755d58540
Revert "ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()" *66e91da883
Merge 5.10.210 into android12-5.10-lts |\ | *aa6ca808a4
Linux 5.10.210 | *cf5a69e355
PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq() | *9f53d24852
net: bcmgenet: Fix EEE implementation | *9a865a11d6
netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval() | *67f386f756
drm/msm/dsi: Enable runtime PM | *21b38d85f6
PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend() | *ede393e118
PM: runtime: add devm_pm_runtime_enable helper | *a891a0621e
dm: limit the number of targets and parameter size area | *c90746c03b
nilfs2: replace WARN_ONs for invalid DAT metadata block requests | *f3e4963566
nilfs2: fix potential bug in end_buffer_async_write | *db896bbe4a
sched/membarrier: reduce the ability to hammer on sys_membarrier | *8f8f185643
net: prevent mss overflow in skb_segment() | *f7e0231eea
Revert "arm64: Stash shadow stack pointer in the task struct on interrupt" | *70ca0dbae4
hrtimer: Ignore slack time for RT tasks in schedule_hrtimeout_range() | *c80ddc1092
netfilter: ipset: Missing gc cancellations fixed | *a24d5f2ac8
netfilter: ipset: fix performance regression in swap operation | *583a6c76b9
scripts/decode_stacktrace.sh: optionally use LLVM utilities | *0f906882eb
scripts: decode_stacktrace: demangle Rust symbols | *a3d71b6ae9
scripts/decode_stacktrace.sh: support old bash version | *ae992f14b1
scripts/decode_stacktrace.sh: silence stderr messages from addr2line/nm | *00f09825e1
serial: 8250_exar: Set missing rs485_supported flag | *84bf7b8759
serial: 8250_exar: Fill in rs485_supported | *dfd8b9d26b
serial: Add rs485_supported to uart_port | *0c36878222
crypto: lib/mpi - Fix unexpected pointer access in mpi_ec_init | *e0d2eeec88
mips: Fix max_mapnr being uninitialized on early stages | *41a4bd51d8
PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support | *ff67f77fb0
bus: moxtet: Add spi device table | *88ec9bbcd3
Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d" | *6a42eb0d21
tracing: Inform kmemleak of saved_cmdlines allocation | *3a6e27dbe2
pmdomain: core: Move the unused cleanup to a _sync initcall | *978e50ef8c
can: j1939: Fix UAF in j1939_sk_match_filter during setsockopt(SO_J1939_FILTER) | *e4a6d3acad
of: property: fix typo in io-channels | *8180d0c27b
ceph: prevent use-after-free in encode_cap_msg() | *2e9506c9e0
s390/qeth: Fix potential loss of L3-IP@ in case of network issues | *888679afbf
irqchip/gic-v3-its: Fix GICv4.1 VPE affinity update | *2809645d8a
irqchip/irq-brcmstb-l2: Add write memory barrier before exit | *45a3657c3f
wifi: mac80211: reload info pointer in ieee80211_tx_dequeue() | *c7fa9590a9
nfp: flower: prevent re-adding mac index for bonded port | *962091c408
nfp: use correct macro for LengthSelect in BAR config | *58054faf3b
crypto: ccp - Fix null pointer dereference in __sev_platform_shutdown_locked | *98a4026b22
nilfs2: fix hang in nilfs_lookup_dirty_data_buffers() | *364a66be2a
nilfs2: fix data corruption in dsync block recovery for small block sizes | *a643d8d179
ALSA: hda/conexant: Add quirk for SWS JS201D | *ca0533fe66
mmc: slot-gpio: Allow non-sleeping GPIO ro | *bdc29f9ca3
x86/mm/ident_map: Use gbpages only where full GB page should be mapped. | *09f21bee5b
x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 | *1a8a72ee17
serial: max310x: improve crystal stable clock detection | *6f248ee7aa
serial: max310x: set default value when reading clock ready bit | *92a0a5d613
ring-buffer: Clean ring_buffer_poll_wait() error return | *9ec807e7b6
hv_netvsc: Fix race condition between netvsc_probe and netvsc_remove | *93d8109bf1
media: rc: bpf attach/detach requires write permission | *a98ccbcddb
iio: accel: bma400: Fix a compilation problem | *36a49290d7
iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC | *fa5884dd5b
staging: iio: ad5933: fix type mismatch regression | *8a744f925d
tracing: Fix wasted memory in saved_cmdlines logic | *d033a555d9
ext4: fix double-free of blocks due to wrong extents moved_len | *f86e12415b
misc: fastrpc: Mark all sessions as invalid in cb_remove | *a423042052
binder: signal epoll threads of self-work | *6d11240dd1
ALSA: hda/realtek: Enable headset mic on Vaio VJFE-ADL | *cdaddb457d
xen-netback: properly sync TX responses | *0d8011a878
net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame() | *2f6d16f052
nfc: nci: free rx_data_reassembly skb on NCI device cleanup | *5abf3e8af2
kbuild: Fix changing ELF file type for output of gen_btf for big endian | *6717c593c7
firewire: core: correct documentation of fw_csr_string() kernel API | *2dc1d93b2c
lsm: fix the logic in security_inode_getsecctx() | *7d4e19f7ff
scsi: Revert "scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock" | *ca188f2512
modpost: trim leading spaces when processing source files list | *7a14b8a477
i2c: i801: Fix block process call transactions | *5e8a6140d4
i2c: i801: Remove i801_set_block_buffer_mode | *230e89b5ad
powerpc/kasan: Fix addr error caused by page alignment | *486a4176bc
media: ir_toy: fix a memleak in irtoy_tx | *b8da59ad91
usb: f_mass_storage: forbid async queue when shutdown happen | *9a8ccbc6ec
USB: hub: check for alternate port before enabling A_ALT_HNP_SUPPORT | *9d07bdbfa4
usb: ucsi_acpi: Fix command completion handling | *f304eb4833
HID: wacom: Do not register input devices until after hid_hw_start | *4f7927310e
HID: wacom: generic: Avoid reporting a serial of '0' to userspace | *d51fc41e15
ALSA: hda/realtek: Enable Mute LED on HP Laptop 14-fq0xxx | *8da18c51ce
ALSA: hda/realtek: Fix the external mic not being recognised for Acer Swift 1 SF114-32 | *81e7d2530d
mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again | *56cfbe6071
tracing/trigger: Fix to return error if failed to alloc snapshot | *6d05659b60
i40e: Fix waiting for queues of all VSIs to be disabled | *f026f23849
MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler | *ed8c87ac8a
net: sysfs: Fix /sys/class/net/<iface> path for statistics | *4a98bc739d
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() | *f8cd86c67d
spi: ppc4xx: Drop write-only variable | *55cfccb658
net: openvswitch: limit the number of recursions from action sets | *3f9b9585b7
of: unittest: Fix compile in the non-dynamic case | *dc8bce9c71
btrfs: send: return EOPNOTSUPP on unknown flags | *22965e4fee
btrfs: forbid deleting live subvol qgroup | *3f5d47eb16
btrfs: do not ASSERT() if the newly created subvolume already got read | *d7247ce32a
btrfs: forbid creating subvol qgroups | *4cee42fcf5
netfilter: nft_set_rbtree: skip end interval element from gc | *feace3c240
net: stmmac: xgmac: fix a typo of register name in DPP safety handling | *78115a3473
net: stmmac: xgmac: use #define for string constants | *8868106251
clocksource: Skip watchdog check for large watchdog intervals | *cda4ca038c
vhost: use kzalloc() instead of kmalloc() followed by memset() | *63d97c3aba
Input: atkbd - skip ATKBD_CMD_SETLEDS when skipping ATKBD_CMD_GETID | *9a564a9a07
Input: i8042 - fix strange behavior of touchpad on Clevo NS70PU | *b1f576be92
hrtimer: Report offline hrtimer enqueue | *b87060b3e8
usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK | *34fd6f444b
USB: serial: cp210x: add ID for IMST iM871A-USB | *53479fcfd0
USB: serial: option: add Fibocom FM101-GL variant | *c537b88b39
USB: serial: qcserial: add new usb-id for Dell Wireless DW5826e | *e800ef36d1
net/af_iucv: clean up a try_then_request_module() | *9f56f38331
blk-iocost: Fix an UBSAN shift-out-of-bounds warning | *9878c660d1
scsi: core: Move scsi_host_busy() out of host lock if it is for per-command | *1dd947c21d
netfilter: nft_set_pipapo: remove scratch_aligned pointer | *d6fcad0da2
netfilter: nft_set_pipapo: add helper to release pcpu scratch area | *1771e8347f
netfilter: nft_set_pipapo: store index in scratch maps | *d1ec65c49e
netfilter: nft_ct: reject direction for ct id | *730fce47e5
netfilter: nft_compat: restrict match/target protocol to u16 | *78909916a2
netfilter: nft_compat: reject unused compat flag | *b06e067e93
ppp_async: limit MRU to 64K | *19d7314f2f
tipc: Check the bearer type before calling tipc_udp_nl_bearer_add() | *09e91f3e7e
rxrpc: Fix response to PING RESPONSE ACKs to a dead call | *88081ba415
inet: read sk->sk_family once in inet_recv_error() | *7e42379d29
hwmon: (coretemp) Fix bogus core_id to attr name mapping | *f0da068c75
hwmon: (coretemp) Fix out-of-bounds memory access | *9551de5caa
hwmon: (aspeed-pwm-tacho) mutex for tach reading | *edfd328fe7
atm: idt77252: fix a memleak in open_card_ubr0 | *e77bf828f1
tunnels: fix out of bounds access when building IPv6 PMTU error | *fd473100bf
selftests: net: avoid just another constant wait | *2fc45a4631
net: stmmac: xgmac: fix handling of DPP safety error for DMA channels | *66c8243e61
drm/msm/dp: return correct Colorimetry for DP_TEST_DYNAMIC_RANGE_CEA case | *be3b82e487
phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP | *784d315482
dmaengine: fix is_slave_direction() return false when DMA_DEV_TO_DEV | *68459d2b0c
phy: renesas: rcar-gen3-usb2: Fix returning wrong error code | *ae6769ba51
dmaengine: fsl-qdma: Fix a memory leak related to the queue command DMA | *fbe1c5c6a8
dmaengine: fsl-qdma: Fix a memory leak related to the status queue DMA | *3496a1da71
dmaengine: ti: k3-udma: Report short packet errors | *b7dbf4115b
dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools | *6db18971f7
PM: sleep: Fix error handling in dpm_prepare() | *6388d0e320
uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++ | *2563e7c687
bonding: remove print in bond_verify_device_path | *d1a9900e64
HID: apple: Add 2021 magic keyboard FN key mapping | *b1e3ea7c48
HID: apple: Add support for the 2021 Magic Keyboard | *e5eca7954a
net: sysfs: Fix /sys/class/net/<iface> path | *f199018dc7
af_unix: fix lockdep positive in sk_diag_dump_icons() | *9c9cab01c7
net: ipv4: fix a memleak in ip_setup_cork | *65ee90efc9
netfilter: nft_ct: sanitize layer 3 and 4 protocol number in custom expectations | *32fa7abb18
netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger | *d0b5b1f124
llc: call sock_orphan() at release time | *e34c91e7e8
ipv6: Ensure natural alignment of const ipv6 loopback and router addresses | *b45fae96bd
ixgbe: Fix an error handling path in ixgbe_read_iosf_sb_reg_x550() | *f8bccfa175
ixgbe: Refactor overtemp event handling | *e16c254f60
ixgbe: Refactor returning internal error codes | *2499c0661b
ixgbe: Remove non-inclusive language | *f48bf9a83b
tcp: add sanity checks to rx zerocopy | *14690e419b
net-zerocopy: Refactor frag-is-remappable test. | *a9bc32879a
ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv() | *a57b114a84
ip6_tunnel: use dev_sw_netstats_rx_add() | *f5944853f7
scsi: core: Move scsi_host_busy() out of host lock for waking up EH handler | *7efadce40a
scsi: core: Introduce enum scsi_disposition | *dca11bfa01
scsi: isci: Fix an error code problem in isci_io_request_build() | *948090f66a
drm: using mul_u32_u32() requires linux/math64.h | *02161f622d
wifi: cfg80211: fix RCU dereference in __cfg80211_bss_update | *b54eecdc08
perf: Fix the nr_addr_filters fix | *73eda26931
drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()' | *feacc80040
drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_power_management_table()' | *e016e35846
ceph: fix deadlock or deadcode of misusing dget() | *7610ba1319
blk-mq: fix IO hang from sbitmap wakeup race | *27ae156e63
virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings | *0079078f5e
libsubcmd: Fix memory leak in uniq() | *32a8243788
PCI/AER: Decode Requester ID when no error info found | *feaf0752b3
fs/kernfs/dir: obey S_ISGID | *6f921430b0
tty: allow TIOCSLCKTRMIOS with CAP_CHECKPOINT_RESTORE | *e962b59d37
usb: hub: Replace hardcoded quirk value with BIT() macro | *4a5d0528cf
PCI: switchtec: Fix stdev_release() crash after surprise hot remove | *385e49a40f
PCI: Only override AMD USB controller if required | *bb59b30a5c
mfd: ti_am335x_tscadc: Fix TI SoC dependencies | *e4fdf3b176
xen/gntdev: Fix the abuse of underlying struct page in DMA-buf import | *89bdf3a9f9
i3c: master: cdns: Update maximum prescaler value for i2c clock | *b345f330ae
um: net: Fix return type of uml_net_start_xmit() | *ef21984653
um: Don't use vfprintf() for os_info() | *e4cc555388
um: Fix naming clash between UML and scheduler | *d47f5d41d8
leds: trigger: panic: Don't register panic notifier if creating the trigger failed | *8342ac4a55
drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()' | *48bb06f8e3
drm/amdgpu: Let KFD sync with VM fences | *e90c8f9785
watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 | *6f59516a36
clk: mmp: pxa168: Fix memory leak in pxa168_clk_init() | *2cb6059468
clk: hi3620: Fix memory leak in hi3620_mmc_clk_init() | *5fd28ab1c8
drm/msm/dpu: Ratelimit framedone timeout msgs | *179fe24bd6
media: ddbridge: fix an error code problem in ddb_probe | *ac2630fd3c
IB/ipoib: Fix mcast list locking | *9503ce5f87
drm/exynos: Call drm_atomic_helper_shutdown() at shutdown/unbind time | *1eeca000f2
ALSA: hda: intel-dspcfg: add filters for ARL-S and ARL | *3841b8a64e
ALSA: hda: Intel: add HDA_ARL PCI ID support | *56d717aa7b
PCI: add INTEL_HDA_ARL to pci_ids.h | *b68e373dc0
media: rockchip: rga: fix swizzling for RGB formats | *32c5e3f808
media: stk1160: Fixed high volume of stk1160_dbg messages | *425a441c5c
drm/mipi-dsi: Fix detach call without attach | *0ec29a0f03
drm/framebuffer: Fix use of uninitialized variable | *d7b81afa11
drm/drm_file: fix use of uninitialized variable | *9a572fc1f6
f2fs: fix write pointers on zoned device after roll forward | *7fb8c13273
drm/amd/display: Fix tiled display misalignment | *3a1da8abd7
RDMA/IPoIB: Fix error code return in ipoib_mcast_join | *13d20b2c20
fast_dput(): handle underflows gracefully | *706fb30da0
ASoC: doc: Fix undefined SND_SOC_DAPM_NOPM argument | *354785abdf
ALSA: hda: Refer to correct stream index at loops | *80c69f576f
f2fs: fix to check return value of f2fs_reserve_new_block() | *e474e7a7d6
i40e: Fix VF disable behavior to block all traffic | *ed6de41473
Bluetooth: L2CAP: Fix possible multiple reject send | *e1bcd9a42e
Bluetooth: qca: Set both WIDEBAND_SPEECH and LE_STATES quirks for QCA2066 | *27575c2f1f
wifi: cfg80211: free beacon_ies when overridden from hidden BSS | *40bcbf7d90
wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift() | *1632481a99
wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices | *2131606a5f
arm64: dts: qcom: msm8998: Fix 'out-ports' is a required property | *4668f3e6ac
arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property | *82f6e7e68e
md: Whenassemble the array, consult the superblock of the freshest device | *1746cd95a5
block: prevent an integer overflow in bvec_try_merge_hw_page | *1335310a6a
net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path | *9c51d26ff9
ARM: dts: imx23/28: Fix the DMA controller node name | *6c22388d96
ARM: dts: imx23-sansa: Use preferred i2c-gpios properties | *fb9bdf84b6
ARM: dts: imx27-apf27dev: Fix LED name | *1dd3a37909
ARM: dts: imx25/27: Pass timing0 | *3c2bce8976
ARM: dts: imx25: Fix the iim compatible string | *95bc866c11
block/rnbd-srv: Check for unlikely string overflow | *03ca1d3d8f
ionic: pass opcode to devcmd_wait | *ba108f3db9
ARM: dts: imx1: Fix sram node | *2f22ce556e
ARM: dts: imx27: Fix sram node | *e6c0ea054c
ARM: dts: imx: Use flash@0,0 pattern | *bfbaf1551b
ARM: dts: imx25/27-eukrea: Fix RTC node name | *24bb6b2647
ARM: dts: rockchip: fix rk3036 hdmi ports node | *11c1fc73bf
bpf: Set uattr->batch.count as zero before batched update or deletion | *2e7f8d05ec
scsi: libfc: Fix up timeout error in fc_fcp_rec_error() | *a72670f465
scsi: libfc: Don't schedule abort twice | *80700978cb
bpf: Add map and need_defer parameters to .map_fd_put_ptr() | *84770a996a
wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus() | *c390b6a2c3
ARM: dts: imx7s: Fix nand-controller #size-cells | *d7cb295b53
ARM: dts: imx7s: Fix lcdif compatible | *73ead7a37a
ARM: dts: imx7d: Fix coresight funnel ports | *86781b3a8e
scsi: arcmsr: Support new PCI device IDs 1883 and 1886 | *db516f6030
bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk | *4f87b8d932
PCI: Add no PM reset quirk for NVIDIA Spectrum devices | *9bc7617a0d
scsi: lpfc: Fix possible file string name overflow when updating firmware | *9b9bbba16b
selftests/bpf: Fix pyperf180 compilation failure with clang18 | *747838941f
selftests/bpf: satisfy compiler by having explicit return in btf test | *69e905beca
wifi: rt2x00: restart beacon queue when hardware reset | *cfbbb3199e
ext4: avoid online resizing failures due to oversized flex bg | *e7b9fa6c29
ext4: remove unnecessary check from alloc_flex_gd() | *b960192422
ext4: unify the type of flexbg_size to unsigned int | *64448275f8
ext4: fix inconsistent between segment fstrim and full fstrim | *5183595c0b
ecryptfs: Reject casefold directory inodes | *c430e6bb43
SUNRPC: Fix a suspicious RCU usage warning | *150a3a3871
KVM: s390: fix setting of fpc register | *856caf2730
s390/ptrace: handle setting of fpc register correctly | *e2b77d107b
jfs: fix array-index-out-of-bounds in diNewExt | *5f1f459520
rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock() | *ae53c54ed7
afs: fix the usage of read_seqbegin_or_lock() in afs_find_server*() | *a02356d996
afs: fix the usage of read_seqbegin_or_lock() in afs_lookup_volume_rcu() | *108c4db057
crypto: stm32/crc32 - fix parsing list of devices | *a63e48cd83
pstore/ram: Fix crash when setting number of cpus to an odd number | *bc6ef64dbe
jfs: fix uaf in jfs_evict_inode | *2037cb9d95
jfs: fix array-index-out-of-bounds in dbAdjTree | *1c40ca3d39
jfs: fix slab-out-of-bounds Read in dtSearch | *7aa3385447
UBSAN: array-index-out-of-bounds in dtSplitRoot | *de34de6e57
FS:JFS:UBSAN:array-index-out-of-bounds in dbAdjTree | *95c864c811
ACPI: APEI: set memory failure flags as MF_ACTION_REQUIRED on synchronous events | *3399cc7013
PM / devfreq: Synchronize devfreq_monitor_[start/stop] | *b17a71435e
ACPI: extlog: fix NULL pointer dereference check | *c261594853
PNP: ACPI: fix fortify warning | *3a13ed6298
ACPI: video: Add quirk for the Colorful X15 AT 23 Laptop | *c74b2af2cc
audit: Send netlink ACK before setting connection in auditd_set | *37e00ed71e
regulator: core: Only increment use_count when enable_count changes | *19c7132270
debugobjects: Stop accessing objects after releasing hash bucket lock | *c57cb397fe
perf/core: Fix narrow startup race when creating the perf nr_addr_filters sysfs file | *5224b9db24
x86/mce: Mark fatal MCE's page as poison to avoid panic in the kdump kernel | *beee482cc4
powerpc/lib: Validate size for vector operations | *24a58abcff
powerpc: pmd_move_must_withdraw() is only needed for CONFIG_TRANSPARENT_HUGEPAGE | *02e5b2ff47
x86/boot: Ignore NMIs during very early boot | *9d06c199d8
powerpc/mm: Fix build failures due to arch_reserved_kernel_pages() | *3928c06363
powerpc: Fix build error due to is_valid_bugaddr() | *353496cb35
drivers/perf: pmuv3: don't expose SW_INCR event in sysfs | *aa28eecb43
powerpc/mm: Fix null-pointer dereference in pgtable_cache_add | *4e806600eb
x86/entry/ia32: Ensure s32 is sign extended to s64 | *cdc01845df
tick/sched: Preserve number of idle sleeps across CPU hotplug events | *3736a7832b
mips: Call lose_fpu(0) before initializing fcr31 in mips_set_personality_nan | *95a8a5193e
spi: bcm-qspi: fix SFDP BFPT read by usig mspi read | *f1ba5bf9e0
gpio: eic-sprd: Clear interrupt after set the interrupt type | *0924bcd2fd
drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume | *b6abe30de3
drm/exynos: fix accidental on-stack copy of exynos_drm_plane | *4e56c5a9b9
drm: panel-simple: add missing bus flags for Tianma tm070jvhg[30/33] | *e1c50b0c62
btrfs: avoid copying BTRFS_ROOT_SUBVOL_DEAD flag to snapshot of subvolume being deleted | *d073f4608b
btrfs: remove err variable from btrfs_delete_subvolume | *90ad17575d
mm/sparsemem: fix race in accessing memory_section->usage | *74a80f8dda
mm: use __pfn_to_section() instead of open coding it | *43872f44ee
media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run | *9087d0c2ba
arm64: dts: qcom: sc7180: fix USB wakeup interrupt types | *3de807b140
arm64: dts: qcom: sc7180: Use pdc interrupts for USB instead of GIC interrupts | *8b2c7bb605
ARM: dts: samsung: exynos4210-i9100: Unconditionally enable LDO12 | *162ae0e78b
pipe: wakeup wr_wait after setting max_usage | *b6f27626f5
fs/pipe: move check to pipe_has_watch_queue() | *f46eb83238
PM: sleep: Fix possible deadlocks in core system-wide PM code | *8b604883d4
PM: core: Remove unnecessary (void *) conversions | *57df40f800
PM: sleep: Avoid calling put_device() under dpm_list_mtx | *2245a84985
PM: sleep: Use dev_printk() when possible | *8a6a51b80b
drm/bridge: nxp-ptn3460: simplify some error checking | *bedbbdf056
drm/tidss: Fix atomic_flush check | *ea19252691
drm/bridge: nxp-ptn3460: fix i2c_master_send() error checking | *f55261469b
drm: Don't unref the same fb many times by mistake due to deadlock handling | *bb575bc3e7
gpiolib: acpi: Ignore touchpad wakeup on GPD G1619-04 | *55a60251fa
netfilter: nf_tables: reject QUEUE/DROP verdict parameters | *9489e214ea
netfilter: nft_chain_filter: handle NETDEV_UNREGISTER for inet/ingress basechain | *05dd9facfb
wifi: iwlwifi: fix a memory corruption | *c0760a5c3e
exec: Fix error handling in begin_new_exec() | *30f38928b6
rbd: don't move requests to the running list on errors | *2bdf872bcf
btrfs: don't abort filesystem when attempting to snapshot deleted subvolume | *5d3687baa9
btrfs: defrag: reject unknown flags of btrfs_ioctl_defrag_range_args | *f27937426b
btrfs: don't warn if discard range is not aligned to sector | *f8a7a51a6c
btrfs: tree-checker: fix inline ref size in error messages | *be90e25880
btrfs: ref-verify: free ref cache before clearing mount opt | *7c3a572e15
net: fec: fix the unhandled context fault from smmu | *a52b2faf60
fjes: fix memleaks in fjes_hw_setup | *e1bf3ec97a
selftests: netdevsim: fix the udp_tunnel_nic test | *83f99138bf
net: mvpp2: clear BM pool before initialization | *6a2e2d9890
netfilter: nf_tables: validate NFPROTO_* family | *4fbdc3a18f
netfilter: nf_tables: restrict anonymous set and map names to 16 bytes | *cf116d9c3c
net/mlx5e: fix a double-free in arfs_create_groups | *1123661a08
net/mlx5: DR, Use the right GVMI number for drop action | *a3eba5989f
ipv6: init the accept_queue's spinlocks in inet6_create | *be8d1f619e
netlink: fix potential sleeping issue in mqueue_flush_file | *69ca75e063
tcp: Add memory barrier to tcp_push() | *8499e2f121
afs: Hide silly-rename files from userspace | *ef70dfa0b1
tracing: Ensure visibility when inserting an element into tracing_map | *5ae8d50044
net/rds: Fix UBSAN: array-index-out-of-bounds in rds_cmsg_recv | *9ccdef19cf
llc: Drop support for ETH_P_TR_802_2. | *04f2a74b56
llc: make llc_ui_sendmsg() more robust against bonding changes | *ea4c3cb7fd
vlan: skip nested type that is not IFLA_VLAN_QOS_MAPPING | *fc74f86a33
bnxt_en: Wait for FLR to complete during probe | *bc99dcedd2
tcp: make sure init the accept_queue's spinlocks once | *5fed92ca32
net/smc: fix illegal rmb_desc access in SMC-D connection dump | *c71e1c1a08
KVM: use __vcalloc for very large allocations | *95670878a6
mm: vmalloc: introduce array allocation functions | *02f629bb46
smb3: Replace smb2pdu 1-element arrays with flex-arrays | *443b16ee3d
stddef: Introduce DECLARE_FLEX_ARRAY() helper | *bfc0647791
block: Remove special-casing of compound pages | *ff4332f1ec
rename(): fix the locking of subdirectories | *d132010e6d
ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path | *c6e6640784
nouveau/vmm: don't set addr on the fail path to avoid warning | *83217f1bcb
rtc: Adjust failure return code for cmos_set_alarm() | *b51578bd86
mmc: mmc_spi: remove custom DMA mapped buffers | *59020bf099
mmc: core: Use mrq.sbc in close-ended ffu | *625cb3f3bc
scripts/get_abi: fix source path leak | *311dc5afad
lsm: new security_file_ioctl_compat() hook | *f726690397
arm64: dts: qcom: sdm845: fix USB DP/DM HS PHY interrupts | *dfc2c685f3
arm64: dts: qcom: sdm845: fix USB wakeup interrupt types | *ac4dcccbe9
async: Introduce async_schedule_dev_nocall() | *9ef68b58fd
async: Split async_schedule_node_domain() | *1dd8449e20
parisc/firmware: Fix F-extend for PDC addresses | *20a6dea2d1
bus: mhi: host: Drop chan lock before queuing buffers | *69ca89d80f
rpmsg: virtio: Free driver_override when rpmsg_remove() | *cd51e26a3b
crypto: s390/aes - Fix buffer overread in CTR mode | *c6a8111aac
hwrng: core - Fix page fault dead lock on mmap-ed hwrng | *981a31b754
PM: hibernate: Enforce ordering during image compression/decompression | *462c383e73
crypto: api - Disallow identical driver names | *fa94912241
ext4: allow for the last group to be marked as trimmed | *d173ef1255
iio:adc:ad7091r: Move exports into IIO_AD7091R namespace. | *9de69732dd
dmaengine: fix NULL pointer in channel unregistration function | *653d289060
iio: adc: ad7091r: Enable internal vref if external vref is not supplied | *1eba6f7ffa
iio: adc: ad7091r: Allow users to configure device events | *9ec7498a25
iio: adc: ad7091r: Set alert bit in config register | *be5d6a297d
serial: sc16is7xx: add check for unsupported SPI modes during probe | *8df2aec94b
spi: introduce SPI_MODE_X_MASK macro | *6ec08ce3bf
serial: sc16is7xx: set safe default SPI clock frequency | *e83f114994
units: add the HZ macros | *762217e973
units: change from 'L' to 'UL' | *f37f4a0c53
PCI: mediatek: Clear interrupt status before dispatching handler | *490eaca842
usb: cdns3: Fix uvc fail when DMA cross 4k boundery since sg enabled | *bf70321419
usb: cdns3: fix iso transfer error when mult is not zero | *6aec2f089d
usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config | *2fdc98b05c
usb: cdns3: fix uvc failure work since sg support enabled | *67d3c71cf8
usb: cdns3: Fixes for sparse warnings *bb4ccced84
Merge branch 'android12-5.10' into branch 'android12-5.10-lts' Change-Id: I426dde9c00dda717bda1273bfda50890d07f6610 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2073 lines
67 KiB
Makefile
2073 lines
67 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
VERSION = 5
|
|
PATCHLEVEL = 10
|
|
SUBLEVEL = 210
|
|
EXTRAVERSION =
|
|
NAME = Dare mighty things
|
|
|
|
# *DOCUMENTATION*
|
|
# To see a list of typical targets execute "make help"
|
|
# More info can be located in ./README
|
|
# Comments in this file are targeted only to the developer, do not
|
|
# expect to learn how to build the kernel reading this file.
|
|
|
|
$(if $(filter __%, $(MAKECMDGOALS)), \
|
|
$(error targets prefixed with '__' are only for internal use))
|
|
|
|
# That's our default target when none is given on the command line
|
|
PHONY := __all
|
|
__all:
|
|
|
|
# We are using a recursive build, so we need to do a little thinking
|
|
# to get the ordering right.
|
|
#
|
|
# Most importantly: sub-Makefiles should only ever modify files in
|
|
# their own directory. If in some directory we have a dependency on
|
|
# a file in another dir (which doesn't happen often, but it's often
|
|
# unavoidable when linking the built-in.a targets which finally
|
|
# turn into vmlinux), we will call a sub make in that other dir, and
|
|
# after that we are sure that everything which is in that other dir
|
|
# is now up to date.
|
|
#
|
|
# The only cases where we need to modify files which have global
|
|
# effects are thus separated out and done before the recursive
|
|
# descending is started. They are now explicitly listed as the
|
|
# prepare rule.
|
|
|
|
ifneq ($(sub_make_done),1)
|
|
|
|
# Do not use make's built-in rules and variables
|
|
# (this increases performance and avoids hard-to-debug behaviour)
|
|
MAKEFLAGS += -rR
|
|
|
|
# Avoid funny character set dependencies
|
|
unexport LC_ALL
|
|
LC_COLLATE=C
|
|
LC_NUMERIC=C
|
|
export LC_COLLATE LC_NUMERIC
|
|
|
|
# Avoid interference with shell env settings
|
|
unexport GREP_OPTIONS
|
|
|
|
# Beautify output
|
|
# ---------------------------------------------------------------------------
|
|
#
|
|
# Normally, we echo the whole command before executing it. By making
|
|
# that echo $($(quiet)$(cmd)), we now have the possibility to set
|
|
# $(quiet) to choose other forms of output instead, e.g.
|
|
#
|
|
# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
|
|
# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
|
|
#
|
|
# If $(quiet) is empty, the whole command will be printed.
|
|
# If it is set to "quiet_", only the short version will be printed.
|
|
# If it is set to "silent_", nothing will be printed at all, since
|
|
# the variable $(silent_cmd_cc_o_c) doesn't exist.
|
|
#
|
|
# A simple variant is to prefix commands with $(Q) - that's useful
|
|
# for commands that shall be hidden in non-verbose mode.
|
|
#
|
|
# $(Q)ln $@ :<
|
|
#
|
|
# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
|
|
# If KBUILD_VERBOSE equals 1 then the above command is displayed.
|
|
# If KBUILD_VERBOSE equals 2 then give the reason why each target is rebuilt.
|
|
#
|
|
# To put more focus on warnings, be less verbose as default
|
|
# Use 'make V=1' to see the full commands
|
|
|
|
ifeq ("$(origin V)", "command line")
|
|
KBUILD_VERBOSE = $(V)
|
|
endif
|
|
ifndef KBUILD_VERBOSE
|
|
KBUILD_VERBOSE = 0
|
|
endif
|
|
|
|
ifeq ($(KBUILD_VERBOSE),1)
|
|
quiet =
|
|
Q =
|
|
else
|
|
quiet=quiet_
|
|
Q = @
|
|
endif
|
|
|
|
# If the user is running make -s (silent mode), suppress echoing of
|
|
# commands
|
|
# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
|
|
|
|
ifeq ($(filter 3.%,$(MAKE_VERSION)),)
|
|
silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
|
|
else
|
|
silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
|
|
endif
|
|
|
|
ifeq ($(silence),s)
|
|
quiet=silent_
|
|
endif
|
|
|
|
export quiet Q KBUILD_VERBOSE
|
|
|
|
# Kbuild will save output files in the current working directory.
|
|
# This does not need to match to the root of the kernel source tree.
|
|
#
|
|
# For example, you can do this:
|
|
#
|
|
# cd /dir/to/store/output/files; make -f /dir/to/kernel/source/Makefile
|
|
#
|
|
# If you want to save output files in a different location, there are
|
|
# two syntaxes to specify it.
|
|
#
|
|
# 1) O=
|
|
# Use "make O=dir/to/store/output/files/"
|
|
#
|
|
# 2) Set KBUILD_OUTPUT
|
|
# Set the environment variable KBUILD_OUTPUT to point to the output directory.
|
|
# export KBUILD_OUTPUT=dir/to/store/output/files/; make
|
|
#
|
|
# The O= assignment takes precedence over the KBUILD_OUTPUT environment
|
|
# variable.
|
|
|
|
# Do we want to change the working directory?
|
|
ifeq ("$(origin O)", "command line")
|
|
KBUILD_OUTPUT := $(O)
|
|
endif
|
|
|
|
ifneq ($(KBUILD_OUTPUT),)
|
|
# Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
|
|
# expand a shell special character '~'. We use a somewhat tedious way here.
|
|
abs_objtree := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)
|
|
$(if $(abs_objtree),, \
|
|
$(error failed to create output directory "$(KBUILD_OUTPUT)"))
|
|
|
|
# $(realpath ...) resolves symlinks
|
|
abs_objtree := $(realpath $(abs_objtree))
|
|
else
|
|
abs_objtree := $(CURDIR)
|
|
endif # ifneq ($(KBUILD_OUTPUT),)
|
|
|
|
ifeq ($(abs_objtree),$(CURDIR))
|
|
# Suppress "Entering directory ..." unless we are changing the work directory.
|
|
MAKEFLAGS += --no-print-directory
|
|
else
|
|
need-sub-make := 1
|
|
endif
|
|
|
|
abs_srctree := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
|
|
ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
|
|
$(error source directory cannot contain spaces or colons)
|
|
endif
|
|
|
|
ifneq ($(abs_srctree),$(abs_objtree))
|
|
# Look for make include files relative to root of kernel src
|
|
#
|
|
# This does not become effective immediately because MAKEFLAGS is re-parsed
|
|
# once after the Makefile is read. We need to invoke sub-make.
|
|
MAKEFLAGS += --include-dir=$(abs_srctree)
|
|
need-sub-make := 1
|
|
endif
|
|
|
|
this-makefile := $(lastword $(MAKEFILE_LIST))
|
|
|
|
ifneq ($(filter 3.%,$(MAKE_VERSION)),)
|
|
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
|
|
# We need to invoke sub-make to avoid implicit rules in the top Makefile.
|
|
need-sub-make := 1
|
|
# Cancel implicit rules for this Makefile.
|
|
$(this-makefile): ;
|
|
endif
|
|
|
|
export abs_srctree abs_objtree
|
|
export sub_make_done := 1
|
|
|
|
ifeq ($(need-sub-make),1)
|
|
|
|
PHONY += $(MAKECMDGOALS) __sub-make
|
|
|
|
$(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make
|
|
@:
|
|
|
|
# Invoke a second make in the output directory, passing relevant variables
|
|
__sub-make:
|
|
$(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
|
|
|
|
endif # need-sub-make
|
|
endif # sub_make_done
|
|
|
|
# We process the rest of the Makefile if this is the final invocation of make
|
|
ifeq ($(need-sub-make),)
|
|
|
|
# Do not print "Entering directory ...",
|
|
# but we want to display it when entering to the output directory
|
|
# so that IDEs/editors are able to understand relative filenames.
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
# Call a source code checker (by default, "sparse") as part of the
|
|
# C compilation.
|
|
#
|
|
# Use 'make C=1' to enable checking of only re-compiled files.
|
|
# Use 'make C=2' to enable checking of *all* source files, regardless
|
|
# of whether they are re-compiled or not.
|
|
#
|
|
# See the file "Documentation/dev-tools/sparse.rst" for more details,
|
|
# including where to get the "sparse" utility.
|
|
|
|
ifeq ("$(origin C)", "command line")
|
|
KBUILD_CHECKSRC = $(C)
|
|
endif
|
|
ifndef KBUILD_CHECKSRC
|
|
KBUILD_CHECKSRC = 0
|
|
endif
|
|
|
|
# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
|
|
# directory of external module to build. Setting M= takes precedence.
|
|
ifeq ("$(origin M)", "command line")
|
|
KBUILD_EXTMOD := $(M)
|
|
endif
|
|
|
|
$(if $(word 2, $(KBUILD_EXTMOD)), \
|
|
$(error building multiple external modules is not supported))
|
|
|
|
export KBUILD_CHECKSRC KBUILD_EXTMOD
|
|
|
|
extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)
|
|
|
|
# ANDROID: set up mixed-build support. mixed-build allows device kernel modules
|
|
# to be compiled against a GKI kernel. This approach still uses the headers and
|
|
# Kbuild from device kernel, so care must be taken to ensure that those headers match.
|
|
ifdef KBUILD_MIXED_TREE
|
|
# Need vmlinux.symvers for modpost and System.map for depmod, check whether they exist in KBUILD_MIXED_TREE
|
|
required_mixed_files=vmlinux.symvers System.map
|
|
$(if $(filter-out $(words $(required_mixed_files)), \
|
|
$(words $(wildcard $(add-prefix $(KBUILD_MIXED_TREE)/,$(required_mixed_files))))),,\
|
|
$(error KBUILD_MIXED_TREE=$(KBUILD_MIXED_TREE) doesn't contain $(required_mixed_files)))
|
|
endif
|
|
|
|
mixed-build-prefix = $(if $(KBUILD_MIXED_TREE),$(KBUILD_MIXED_TREE)/)
|
|
export KBUILD_MIXED_TREE
|
|
|
|
ifeq ($(abs_srctree),$(abs_objtree))
|
|
# building in the source tree
|
|
srctree := .
|
|
building_out_of_srctree :=
|
|
else
|
|
ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
|
|
# building in a subdirectory of the source tree
|
|
srctree := ..
|
|
else
|
|
srctree := $(abs_srctree)
|
|
endif
|
|
building_out_of_srctree := 1
|
|
endif
|
|
|
|
ifneq ($(KBUILD_ABS_SRCTREE),)
|
|
srctree := $(abs_srctree)
|
|
endif
|
|
|
|
objtree := .
|
|
VPATH := $(srctree)
|
|
|
|
export building_out_of_srctree srctree objtree VPATH
|
|
|
|
# To make sure we do not include .config for any of the *config targets
|
|
# catch them early, and hand them over to scripts/kconfig/Makefile
|
|
# It is allowed to specify more targets when calling make, including
|
|
# mixing *config targets and build targets.
|
|
# For example 'make oldconfig all'.
|
|
# Detect when mixed targets is specified, and make a second invocation
|
|
# of make so .config is not included in this case either (for *config).
|
|
|
|
version_h := include/generated/uapi/linux/version.h
|
|
old_version_h := include/linux/version.h
|
|
|
|
clean-targets := %clean mrproper cleandocs
|
|
no-dot-config-targets := $(clean-targets) \
|
|
cscope gtags TAGS tags help% %docs check% coccicheck \
|
|
$(version_h) headers headers_% archheaders archscripts \
|
|
%asm-generic kernelversion %src-pkg dt_binding_check \
|
|
outputmakefile
|
|
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
|
|
image_name
|
|
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
|
|
|
|
config-build :=
|
|
mixed-build :=
|
|
need-config := 1
|
|
may-sync-config := 1
|
|
single-build :=
|
|
|
|
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|
need-config :=
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
|
|
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
|
|
may-sync-config :=
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(KBUILD_EXTMOD),)
|
|
may-sync-config :=
|
|
endif
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
ifneq ($(filter %config,$(MAKECMDGOALS)),)
|
|
config-build := 1
|
|
ifneq ($(words $(MAKECMDGOALS)),1)
|
|
mixed-build := 1
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
# We cannot build single targets and the others at the same time
|
|
ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
|
|
single-build := 1
|
|
ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
|
|
mixed-build := 1
|
|
endif
|
|
endif
|
|
|
|
# For "make -j clean all", "make -j mrproper defconfig all", etc.
|
|
ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
|
|
ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
|
|
mixed-build := 1
|
|
endif
|
|
endif
|
|
|
|
# install and modules_install need also be processed one by one
|
|
ifneq ($(filter install,$(MAKECMDGOALS)),)
|
|
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
|
|
mixed-build := 1
|
|
endif
|
|
endif
|
|
|
|
ifdef mixed-build
|
|
# ===========================================================================
|
|
# We're called with mixed targets (*config and build targets).
|
|
# Handle them one by one.
|
|
|
|
PHONY += $(MAKECMDGOALS) __build_one_by_one
|
|
|
|
$(MAKECMDGOALS): __build_one_by_one
|
|
@:
|
|
|
|
__build_one_by_one:
|
|
$(Q)set -e; \
|
|
for i in $(MAKECMDGOALS); do \
|
|
$(MAKE) -f $(srctree)/Makefile $$i; \
|
|
done
|
|
|
|
else # !mixed-build
|
|
|
|
include scripts/Kbuild.include
|
|
|
|
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
|
|
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
|
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
|
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
|
|
|
|
include scripts/subarch.include
|
|
|
|
# Cross compiling and selecting different set of gcc/bin-utils
|
|
# ---------------------------------------------------------------------------
|
|
#
|
|
# When performing cross compilation for other architectures ARCH shall be set
|
|
# to the target architecture. (See arch/* for the possibilities).
|
|
# ARCH can be set during invocation of make:
|
|
# make ARCH=ia64
|
|
# Another way is to have ARCH set in the environment.
|
|
# The default ARCH is the host where make is executed.
|
|
|
|
# CROSS_COMPILE specify the prefix used for all executables used
|
|
# during compilation. Only gcc and related bin-utils executables
|
|
# are prefixed with $(CROSS_COMPILE).
|
|
# CROSS_COMPILE can be set on the command line
|
|
# make CROSS_COMPILE=ia64-linux-
|
|
# Alternatively CROSS_COMPILE can be set in the environment.
|
|
# Default value for CROSS_COMPILE is not to prefix executables
|
|
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
|
|
ARCH ?= $(SUBARCH)
|
|
|
|
# Architecture as present in compile.h
|
|
UTS_MACHINE := $(ARCH)
|
|
SRCARCH := $(ARCH)
|
|
|
|
# Additional ARCH settings for x86
|
|
ifeq ($(ARCH),i386)
|
|
SRCARCH := x86
|
|
endif
|
|
ifeq ($(ARCH),x86_64)
|
|
SRCARCH := x86
|
|
endif
|
|
|
|
# Additional ARCH settings for sparc
|
|
ifeq ($(ARCH),sparc32)
|
|
SRCARCH := sparc
|
|
endif
|
|
ifeq ($(ARCH),sparc64)
|
|
SRCARCH := sparc
|
|
endif
|
|
|
|
# Additional ARCH settings for sh
|
|
ifeq ($(ARCH),sh64)
|
|
SRCARCH := sh
|
|
endif
|
|
|
|
KCONFIG_CONFIG ?= .config
|
|
export KCONFIG_CONFIG
|
|
|
|
# Default file for 'make defconfig'. This may be overridden by arch-Makefile.
|
|
export KBUILD_DEFCONFIG := defconfig
|
|
|
|
# SHELL used by kbuild
|
|
CONFIG_SHELL := sh
|
|
|
|
HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null)
|
|
HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null)
|
|
HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
|
|
|
|
ifneq ($(LLVM),)
|
|
HOSTCC = clang
|
|
HOSTCXX = clang++
|
|
else
|
|
HOSTCC = gcc
|
|
HOSTCXX = g++
|
|
endif
|
|
|
|
KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
|
|
-O2 -fomit-frame-pointer -std=gnu89
|
|
KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
|
|
KBUILD_USERLDFLAGS := $(USERLDFLAGS)
|
|
|
|
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
|
|
KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
|
|
KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
|
|
KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
|
|
|
|
# Make variables (CC, etc...)
|
|
CPP = $(CC) -E
|
|
ifneq ($(LLVM),)
|
|
CC = clang
|
|
LD = ld.lld
|
|
AR = llvm-ar
|
|
NM = llvm-nm
|
|
OBJCOPY = llvm-objcopy
|
|
OBJDUMP = llvm-objdump
|
|
READELF = llvm-readelf
|
|
STRIP = llvm-strip
|
|
else
|
|
CC = $(CROSS_COMPILE)gcc
|
|
LD = $(CROSS_COMPILE)ld
|
|
AR = $(CROSS_COMPILE)ar
|
|
NM = $(CROSS_COMPILE)nm
|
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
|
READELF = $(CROSS_COMPILE)readelf
|
|
STRIP = $(CROSS_COMPILE)strip
|
|
endif
|
|
PAHOLE = pahole
|
|
RESOLVE_BTFIDS = $(objtree)/tools/bpf/resolve_btfids/resolve_btfids
|
|
LEX = flex
|
|
YACC = bison
|
|
AWK = awk
|
|
INSTALLKERNEL := installkernel
|
|
DEPMOD = depmod
|
|
PERL = perl
|
|
PYTHON = python
|
|
PYTHON3 = python3
|
|
CHECK = sparse
|
|
BASH = bash
|
|
KGZIP = gzip
|
|
KBZIP2 = bzip2
|
|
KLZOP = lzop
|
|
LZMA = lzma
|
|
LZ4 = lz4
|
|
XZ = xz
|
|
ZSTD = zstd
|
|
|
|
PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh)
|
|
|
|
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
|
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
|
|
NOSTDINC_FLAGS :=
|
|
CFLAGS_MODULE =
|
|
AFLAGS_MODULE =
|
|
LDFLAGS_MODULE =
|
|
CFLAGS_KERNEL =
|
|
AFLAGS_KERNEL =
|
|
LDFLAGS_vmlinux =
|
|
|
|
# Use USERINCLUDE when you must reference the UAPI directories only.
|
|
USERINCLUDE := \
|
|
-I$(srctree)/arch/$(SRCARCH)/include/uapi \
|
|
-I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
|
|
-I$(srctree)/include/uapi \
|
|
-I$(objtree)/include/generated/uapi \
|
|
-include $(srctree)/include/linux/kconfig.h
|
|
|
|
# Use LINUXINCLUDE when you must reference the include/ directory.
|
|
# Needed to be compatible with the O= option
|
|
LINUXINCLUDE := \
|
|
-I$(srctree)/arch/$(SRCARCH)/include \
|
|
-I$(objtree)/arch/$(SRCARCH)/include/generated \
|
|
$(if $(building_out_of_srctree),-I$(srctree)/include) \
|
|
-I$(objtree)/include \
|
|
$(USERINCLUDE)
|
|
|
|
KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
|
|
KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
|
|
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
|
|
-Werror=implicit-function-declaration -Werror=implicit-int \
|
|
-Werror=return-type -Wno-format-security \
|
|
-std=gnu89
|
|
KBUILD_CPPFLAGS := -D__KERNEL__
|
|
KBUILD_AFLAGS_KERNEL :=
|
|
KBUILD_CFLAGS_KERNEL :=
|
|
KBUILD_AFLAGS_MODULE := -DMODULE
|
|
KBUILD_CFLAGS_MODULE := -DMODULE
|
|
KBUILD_LDFLAGS_MODULE :=
|
|
KBUILD_LDFLAGS :=
|
|
CLANG_FLAGS :=
|
|
|
|
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
|
|
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
|
|
export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
|
|
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
|
|
export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
|
|
export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS
|
|
|
|
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
|
|
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
|
|
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
|
|
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
|
|
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
|
|
export PAHOLE_FLAGS
|
|
|
|
# Files to ignore in find ... statements
|
|
|
|
export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
|
|
-name CVS -o -name .pc -o -name .hg -o -name .git \) \
|
|
-prune -o
|
|
export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
|
|
--exclude CVS --exclude .pc --exclude .hg --exclude .git
|
|
|
|
# ===========================================================================
|
|
# Rules shared between *config targets and build targets
|
|
|
|
# Basic helpers built in scripts/basic/
|
|
PHONY += scripts_basic
|
|
scripts_basic:
|
|
$(Q)$(MAKE) $(build)=scripts/basic
|
|
$(Q)rm -f .tmp_quiet_recordmcount
|
|
|
|
PHONY += outputmakefile
|
|
# Before starting out-of-tree build, make sure the source tree is clean.
|
|
# outputmakefile generates a Makefile in the output directory, if using a
|
|
# separate output directory. This allows convenient use of make in the
|
|
# output directory.
|
|
# At the same time when output Makefile generated, generate .gitignore to
|
|
# ignore whole output directory
|
|
outputmakefile:
|
|
ifdef building_out_of_srctree
|
|
$(Q)if [ -f $(srctree)/.config -o \
|
|
-d $(srctree)/include/config -o \
|
|
-d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
|
|
echo >&2 "***"; \
|
|
echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
|
|
echo >&2 "*** in $(abs_srctree)";\
|
|
echo >&2 "***"; \
|
|
false; \
|
|
fi
|
|
$(Q)ln -fsn $(srctree) source
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
|
|
$(Q)test -e .gitignore || \
|
|
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
|
|
endif
|
|
|
|
ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
|
|
ifneq ($(CROSS_COMPILE),)
|
|
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
|
|
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
|
|
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
|
|
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
|
|
endif
|
|
ifneq ($(GCC_TOOLCHAIN),)
|
|
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
|
|
endif
|
|
ifeq ($(LLVM_IAS),1)
|
|
CLANG_FLAGS += -fintegrated-as
|
|
else
|
|
CLANG_FLAGS += -fno-integrated-as
|
|
endif
|
|
CLANG_FLAGS += -Werror=unknown-warning-option
|
|
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
|
KBUILD_AFLAGS += $(CLANG_FLAGS)
|
|
export CLANG_FLAGS
|
|
endif
|
|
|
|
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
|
|
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
|
|
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
|
|
# and from include/config/auto.conf.cmd to detect the compiler upgrade.
|
|
CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1)
|
|
|
|
ifdef config-build
|
|
# ===========================================================================
|
|
# *config targets only - make sure prerequisites are updated, and descend
|
|
# in scripts/kconfig to make the *config target
|
|
|
|
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
|
|
# KBUILD_DEFCONFIG may point out an alternative default configuration
|
|
# used for 'make defconfig'
|
|
include arch/$(SRCARCH)/Makefile
|
|
export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
|
|
|
|
config: outputmakefile scripts_basic FORCE
|
|
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
|
|
|
%config: outputmakefile scripts_basic FORCE
|
|
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
|
|
|
else #!config-build
|
|
# ===========================================================================
|
|
# Build targets only - this includes vmlinux, arch specific targets, clean
|
|
# targets and others. In general all targets except *config targets.
|
|
|
|
# If building an external module we do not care about the all: rule
|
|
# but instead __all depend on modules
|
|
PHONY += all
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
__all: all
|
|
else
|
|
__all: modules
|
|
endif
|
|
|
|
# Decide whether to build built-in, modular, or both.
|
|
# Normally, just do built-in.
|
|
|
|
KBUILD_MODULES :=
|
|
KBUILD_BUILTIN := 1
|
|
|
|
# If we have only "make modules", don't compile built-in objects.
|
|
ifeq ($(MAKECMDGOALS),modules)
|
|
KBUILD_BUILTIN :=
|
|
endif
|
|
|
|
# If we have "make <whatever> modules", compile modules
|
|
# in addition to whatever we do anyway.
|
|
# Just "make" or "make all" shall build modules as well
|
|
|
|
ifneq ($(filter all modules nsdeps %compile_commands.json clang-%,$(MAKECMDGOALS)),)
|
|
KBUILD_MODULES := 1
|
|
endif
|
|
|
|
ifeq ($(MAKECMDGOALS),)
|
|
KBUILD_MODULES := 1
|
|
endif
|
|
|
|
export KBUILD_MODULES KBUILD_BUILTIN
|
|
|
|
ifdef need-config
|
|
include include/config/auto.conf
|
|
endif
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
# Objects we will link into vmlinux / subdirs we need to visit
|
|
core-y := init/ usr/
|
|
drivers-y := drivers/ sound/
|
|
drivers-$(CONFIG_SAMPLES) += samples/
|
|
drivers-y += net/ virt/
|
|
libs-y := lib/
|
|
endif # KBUILD_EXTMOD
|
|
|
|
ifndef KBUILD_MIXED_TREE
|
|
# The all: target is the default when no target is given on the
|
|
# command line.
|
|
# This allow a user to issue only 'make' to build a kernel including modules
|
|
# Defaults to vmlinux, but the arch makefile usually adds further targets
|
|
all: vmlinux
|
|
endif
|
|
|
|
CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \
|
|
$(call cc-option,-fno-tree-loop-im) \
|
|
$(call cc-disable-warning,maybe-uninitialized,)
|
|
export CFLAGS_GCOV
|
|
|
|
# The arch Makefiles can override CC_FLAGS_FTRACE. We may also append it later.
|
|
ifdef CONFIG_FUNCTION_TRACER
|
|
CC_FLAGS_FTRACE := -pg
|
|
endif
|
|
|
|
ifdef CONFIG_CC_IS_GCC
|
|
RETPOLINE_CFLAGS := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
|
|
RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch-cs-prefix)
|
|
RETPOLINE_VDSO_CFLAGS := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register)
|
|
endif
|
|
ifdef CONFIG_CC_IS_CLANG
|
|
RETPOLINE_CFLAGS := -mretpoline-external-thunk
|
|
RETPOLINE_VDSO_CFLAGS := -mretpoline
|
|
endif
|
|
|
|
ifdef CONFIG_RETHUNK
|
|
RETHUNK_CFLAGS := -mfunction-return=thunk-extern
|
|
RETPOLINE_CFLAGS += $(RETHUNK_CFLAGS)
|
|
endif
|
|
|
|
export RETPOLINE_CFLAGS
|
|
export RETPOLINE_VDSO_CFLAGS
|
|
|
|
include arch/$(SRCARCH)/Makefile
|
|
|
|
ifdef need-config
|
|
ifdef may-sync-config
|
|
# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
|
|
# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
|
|
# because some architectures define CROSS_COMPILE there.
|
|
include include/config/auto.conf.cmd
|
|
|
|
$(KCONFIG_CONFIG):
|
|
@echo >&2 '***'
|
|
@echo >&2 '*** Configuration file "$@" not found!'
|
|
@echo >&2 '***'
|
|
@echo >&2 '*** Please run some configurator (e.g. "make oldconfig" or'
|
|
@echo >&2 '*** "make menuconfig" or "make xconfig").'
|
|
@echo >&2 '***'
|
|
@/bin/false
|
|
|
|
# The actual configuration files used during the build are stored in
|
|
# include/generated/ and include/config/. Update them if .config is newer than
|
|
# include/config/auto.conf (which mirrors .config).
|
|
#
|
|
# This exploits the 'multi-target pattern rule' trick.
|
|
# The syncconfig should be executed only once to make all the targets.
|
|
# (Note: use the grouped target '&:' when we bump to GNU Make 4.3)
|
|
#
|
|
# Do not use $(call cmd,...) here. That would suppress prompts from syncconfig,
|
|
# so you cannot notice that Kconfig is waiting for the user input.
|
|
%/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG)
|
|
$(Q)$(kecho) " SYNC $@"
|
|
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
|
|
else # !may-sync-config
|
|
# External modules and some install targets need include/generated/autoconf.h
|
|
# and include/config/auto.conf but do not care if they are up-to-date.
|
|
# Use auto.conf to trigger the test
|
|
PHONY += include/config/auto.conf
|
|
|
|
include/config/auto.conf:
|
|
$(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
|
|
echo >&2; \
|
|
echo >&2 " ERROR: Kernel configuration is invalid."; \
|
|
echo >&2 " include/generated/autoconf.h or $@ are missing.";\
|
|
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
|
|
echo >&2 ; \
|
|
/bin/false)
|
|
|
|
endif # may-sync-config
|
|
endif # need-config
|
|
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
|
|
|
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
|
|
KBUILD_CFLAGS += -O2
|
|
else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
|
|
KBUILD_CFLAGS += -O3
|
|
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
|
KBUILD_CFLAGS += -Os
|
|
endif
|
|
|
|
# Tell gcc to never replace conditional load with a non-conditional one
|
|
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
|
|
|
|
ifdef CONFIG_READABLE_ASM
|
|
# Disable optimizations that make assembler listings hard to read.
|
|
# reorder blocks reorders the control in the function
|
|
# ipa clone creates specialized cloned functions
|
|
# partial inlining inlines only parts of functions
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
|
|
$(call cc-option,-fno-ipa-cp-clone,) \
|
|
$(call cc-option,-fno-partial-inlining)
|
|
endif
|
|
|
|
ifneq ($(CONFIG_FRAME_WARN),0)
|
|
KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
|
|
endif
|
|
|
|
stackp-flags-y := -fno-stack-protector
|
|
stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector
|
|
stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
|
|
|
|
KBUILD_CFLAGS += $(stackp-flags-y)
|
|
|
|
KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
|
|
KBUILD_CFLAGS += $(KBUILD_CFLAGS-y)
|
|
|
|
ifdef CONFIG_CC_IS_CLANG
|
|
KBUILD_CPPFLAGS += -Qunused-arguments
|
|
KBUILD_CFLAGS += -Wno-format-invalid-specifier
|
|
KBUILD_CFLAGS += -Wno-gnu
|
|
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
|
|
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
|
|
# See modpost pattern 2
|
|
KBUILD_CFLAGS += -mno-global-merge
|
|
else
|
|
|
|
# Warn about unmarked fall-throughs in switch statement.
|
|
# Disabled for clang while comment to attribute conversion happens and
|
|
# https://github.com/ClangBuiltLinux/linux/issues/636 is discussed.
|
|
KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
|
|
endif
|
|
|
|
# These warnings generated too much noise in a regular build.
|
|
# Use make W=1 to enable them (see scripts/Makefile.extrawarn)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
|
|
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
|
|
|
|
# These result in bogus false positives
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
|
|
|
|
ifdef CONFIG_FRAME_POINTER
|
|
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
|
else
|
|
# Some targets (ARM with Thumb2, for example), can't be built with frame
|
|
# pointers. For those, we don't have FUNCTION_TRACER automatically
|
|
# select FRAME_POINTER. However, FUNCTION_TRACER adds -pg, and this is
|
|
# incompatible with -fomit-frame-pointer with current GCC, so we don't use
|
|
# -fomit-frame-pointer with FUNCTION_TRACER.
|
|
ifndef CONFIG_FUNCTION_TRACER
|
|
KBUILD_CFLAGS += -fomit-frame-pointer
|
|
endif
|
|
endif
|
|
|
|
# Initialize all stack variables with a 0xAA pattern.
|
|
ifdef CONFIG_INIT_STACK_ALL_PATTERN
|
|
KBUILD_CFLAGS += -ftrivial-auto-var-init=pattern
|
|
endif
|
|
|
|
# Initialize all stack variables with a zero value.
|
|
ifdef CONFIG_INIT_STACK_ALL_ZERO
|
|
KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
|
|
ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER
|
|
# https://github.com/llvm/llvm-project/issues/44842
|
|
KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
|
endif
|
|
endif
|
|
|
|
DEBUG_CFLAGS :=
|
|
|
|
# Workaround for GCC versions < 5.0
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
|
|
ifdef CONFIG_CC_IS_GCC
|
|
DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
|
|
endif
|
|
|
|
ifdef CONFIG_DEBUG_INFO
|
|
|
|
ifdef CONFIG_DEBUG_INFO_SPLIT
|
|
DEBUG_CFLAGS += -gsplit-dwarf
|
|
else
|
|
DEBUG_CFLAGS += -g
|
|
endif
|
|
|
|
ifdef CONFIG_AS_IS_LLVM
|
|
KBUILD_AFLAGS += -g
|
|
else
|
|
KBUILD_AFLAGS += -Wa,-gdwarf-2
|
|
endif
|
|
|
|
ifdef CONFIG_DEBUG_INFO_DWARF4
|
|
DEBUG_CFLAGS += -gdwarf-4
|
|
endif
|
|
|
|
ifdef CONFIG_DEBUG_INFO_REDUCED
|
|
DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
|
|
$(call cc-option,-fno-var-tracking)
|
|
endif
|
|
|
|
ifdef CONFIG_DEBUG_INFO_COMPRESSED
|
|
DEBUG_CFLAGS += -gz=zlib
|
|
KBUILD_AFLAGS += -gz=zlib
|
|
KBUILD_LDFLAGS += --compress-debug-sections=zlib
|
|
endif
|
|
|
|
endif # CONFIG_DEBUG_INFO
|
|
|
|
KBUILD_CFLAGS += $(DEBUG_CFLAGS)
|
|
export DEBUG_CFLAGS
|
|
|
|
ifdef CONFIG_FUNCTION_TRACER
|
|
ifdef CONFIG_FTRACE_MCOUNT_USE_CC
|
|
CC_FLAGS_FTRACE += -mrecord-mcount
|
|
ifdef CONFIG_HAVE_NOP_MCOUNT
|
|
ifeq ($(call cc-option-yn, -mnop-mcount),y)
|
|
CC_FLAGS_FTRACE += -mnop-mcount
|
|
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
|
|
endif
|
|
endif
|
|
endif
|
|
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
|
|
CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
|
|
endif
|
|
ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
|
|
ifdef CONFIG_HAVE_C_RECORDMCOUNT
|
|
BUILD_C_RECORDMCOUNT := y
|
|
export BUILD_C_RECORDMCOUNT
|
|
endif
|
|
endif
|
|
ifdef CONFIG_HAVE_FENTRY
|
|
ifeq ($(call cc-option-yn, -mfentry),y)
|
|
CC_FLAGS_FTRACE += -mfentry
|
|
CC_FLAGS_USING += -DCC_USING_FENTRY
|
|
endif
|
|
endif
|
|
export CC_FLAGS_FTRACE
|
|
KBUILD_CFLAGS += $(CC_FLAGS_FTRACE) $(CC_FLAGS_USING)
|
|
KBUILD_AFLAGS += $(CC_FLAGS_USING)
|
|
endif
|
|
|
|
# We trigger additional mismatches with less inlining
|
|
ifdef CONFIG_DEBUG_SECTION_MISMATCH
|
|
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
|
|
endif
|
|
|
|
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
|
|
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
|
|
LDFLAGS_vmlinux += --gc-sections
|
|
endif
|
|
|
|
ifdef CONFIG_SHADOW_CALL_STACK
|
|
CC_FLAGS_SCS := -fsanitize=shadow-call-stack
|
|
KBUILD_CFLAGS += $(CC_FLAGS_SCS)
|
|
export CC_FLAGS_SCS
|
|
endif
|
|
|
|
ifdef CONFIG_LTO_CLANG
|
|
ifdef CONFIG_LTO_CLANG_THIN
|
|
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
|
|
KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod-prefix).thinlto-cache
|
|
else
|
|
CC_FLAGS_LTO := -flto
|
|
endif
|
|
|
|
ifeq ($(SRCARCH),x86)
|
|
# TODO(b/182572011): Revert workaround for compiler / linker bug.
|
|
CC_FLAGS_LTO += -fvisibility=hidden
|
|
else
|
|
CC_FLAGS_LTO += -fvisibility=default
|
|
endif
|
|
|
|
# Limit inlining across translation units to reduce binary size
|
|
KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
|
|
endif
|
|
|
|
ifdef CONFIG_LTO
|
|
KBUILD_CFLAGS += $(CC_FLAGS_LTO)
|
|
export CC_FLAGS_LTO
|
|
endif
|
|
|
|
ifdef CONFIG_CFI_CLANG
|
|
CC_FLAGS_CFI := -fsanitize=cfi \
|
|
-fsanitize-cfi-cross-dso \
|
|
-fno-sanitize-cfi-canonical-jump-tables \
|
|
-fno-sanitize-blacklist
|
|
|
|
ifdef CONFIG_CFI_PERMISSIVE
|
|
CC_FLAGS_CFI += -fsanitize-recover=cfi \
|
|
-fno-sanitize-trap=cfi
|
|
else
|
|
ifndef CONFIG_UBSAN_TRAP
|
|
CC_FLAGS_CFI += -ftrap-function=__ubsan_handle_cfi_check_fail_abort
|
|
endif
|
|
endif
|
|
|
|
# If LTO flags are filtered out, we must also filter out CFI.
|
|
CC_FLAGS_LTO += $(CC_FLAGS_CFI)
|
|
KBUILD_CFLAGS += $(CC_FLAGS_CFI)
|
|
export CC_FLAGS_CFI
|
|
endif
|
|
|
|
ifdef CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B
|
|
KBUILD_CFLAGS += -falign-functions=32
|
|
endif
|
|
|
|
# arch Makefile may override CC so keep this after arch Makefile is included
|
|
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
|
|
|
# warn about C99 declaration after statement
|
|
KBUILD_CFLAGS += -Wdeclaration-after-statement
|
|
|
|
# Variable Length Arrays (VLAs) should not be used anywhere in the kernel
|
|
KBUILD_CFLAGS += -Wvla
|
|
|
|
# disable pointer signed / unsigned warnings in gcc 4.0
|
|
KBUILD_CFLAGS += -Wno-pointer-sign
|
|
|
|
# disable stringop warnings in gcc 8+
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
|
|
|
|
# We'll want to enable this eventually, but it's not going away for 5.7 at least
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
|
|
|
|
# Another good warning that we'll want to enable eventually
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
|
|
|
|
# Enabled with W=2, disabled by default as noisy
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
|
|
|
|
# disable invalid "can't wrap" optimizations for signed / pointers
|
|
KBUILD_CFLAGS += -fno-strict-overflow
|
|
|
|
# Make sure -fstack-check isn't enabled (like gentoo apparently did)
|
|
KBUILD_CFLAGS += -fno-stack-check
|
|
|
|
# conserve stack if available
|
|
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
|
|
|
|
# Prohibit date/time macros, which would make the build non-deterministic
|
|
KBUILD_CFLAGS += -Werror=date-time
|
|
|
|
# enforce correct pointer usage
|
|
KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
|
|
|
|
# Require designated initializers for all marked structures
|
|
KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
|
|
|
|
# change __FILE__ to the relative path from the srctree
|
|
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
|
|
|
|
# include additional Makefiles when needed
|
|
include-y := scripts/Makefile.extrawarn
|
|
include-$(CONFIG_KASAN) += scripts/Makefile.kasan
|
|
include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan
|
|
include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan
|
|
include-$(CONFIG_KCOV) += scripts/Makefile.kcov
|
|
include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins
|
|
|
|
include $(addprefix $(srctree)/, $(include-y))
|
|
|
|
# scripts/Makefile.gcc-plugins is intentionally included last.
|
|
# Do not add $(call cc-option,...) below this line. When you build the kernel
|
|
# from the clean source tree, the GCC plugins do not exist at this point.
|
|
|
|
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
|
|
KBUILD_CPPFLAGS += $(KCPPFLAGS)
|
|
KBUILD_AFLAGS += $(KAFLAGS)
|
|
KBUILD_CFLAGS += $(KCFLAGS)
|
|
|
|
KBUILD_LDFLAGS_MODULE += --build-id=sha1
|
|
LDFLAGS_vmlinux += --build-id=sha1
|
|
|
|
KBUILD_LDFLAGS += -z noexecstack
|
|
KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments)
|
|
|
|
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
|
|
LDFLAGS_vmlinux += $(call ld-option, -X,)
|
|
endif
|
|
|
|
ifeq ($(CONFIG_RELR),y)
|
|
LDFLAGS_vmlinux += --pack-dyn-relocs=relr --use-android-relr-tags
|
|
endif
|
|
|
|
# We never want expected sections to be placed heuristically by the
|
|
# linker. All sections should be explicitly named in the linker script.
|
|
ifdef CONFIG_LD_ORPHAN_WARN
|
|
LDFLAGS_vmlinux += --orphan-handling=warn
|
|
endif
|
|
|
|
# Align the bit size of userspace programs with the kernel
|
|
KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
|
|
KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
|
|
|
|
# make the checker run with the right architecture
|
|
CHECKFLAGS += --arch=$(ARCH)
|
|
|
|
# insure the checker run with the right endianness
|
|
CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
|
|
|
|
# the checker needs the correct machine size
|
|
CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
|
|
|
|
# Default kernel image to build when no specific target is given.
|
|
# KBUILD_IMAGE may be overruled on the command line or
|
|
# set in the environment
|
|
# Also any assignments in arch/$(ARCH)/Makefile take precedence over
|
|
# this default value
|
|
export KBUILD_IMAGE ?= vmlinux
|
|
|
|
#
|
|
# INSTALL_PATH specifies where to place the updated kernel and system map
|
|
# images. Default is /boot, but you can set it to other values
|
|
export INSTALL_PATH ?= /boot
|
|
|
|
#
|
|
# INSTALL_DTBS_PATH specifies a prefix for relocations required by build roots.
|
|
# Like INSTALL_MOD_PATH, it isn't defined in the Makefile, but can be passed as
|
|
# an argument if needed. Otherwise it defaults to the kernel install path
|
|
#
|
|
export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
|
|
|
|
#
|
|
# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
|
|
# relocations required by build roots. This is not defined in the
|
|
# makefile but the argument can be passed to make if needed.
|
|
#
|
|
|
|
MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
|
|
export MODLIB
|
|
|
|
#
|
|
# INSTALL_MOD_STRIP, if defined, will cause modules to be
|
|
# stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
|
|
# the default option --strip-debug will be used. Otherwise,
|
|
# INSTALL_MOD_STRIP value will be used as the options to the strip command.
|
|
|
|
ifdef INSTALL_MOD_STRIP
|
|
ifeq ($(INSTALL_MOD_STRIP),1)
|
|
mod_strip_cmd = $(STRIP) --strip-debug
|
|
else
|
|
mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP)
|
|
endif # INSTALL_MOD_STRIP=1
|
|
else
|
|
mod_strip_cmd = true
|
|
endif # INSTALL_MOD_STRIP
|
|
export mod_strip_cmd
|
|
|
|
# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed
|
|
# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP
|
|
# or CONFIG_MODULE_COMPRESS_XZ.
|
|
|
|
mod_compress_cmd = true
|
|
ifdef CONFIG_MODULE_COMPRESS
|
|
ifdef CONFIG_MODULE_COMPRESS_GZIP
|
|
mod_compress_cmd = $(KGZIP) -n -f
|
|
endif # CONFIG_MODULE_COMPRESS_GZIP
|
|
ifdef CONFIG_MODULE_COMPRESS_XZ
|
|
mod_compress_cmd = $(XZ) -f
|
|
endif # CONFIG_MODULE_COMPRESS_XZ
|
|
endif # CONFIG_MODULE_COMPRESS
|
|
export mod_compress_cmd
|
|
|
|
ifdef CONFIG_MODULE_SIG_ALL
|
|
$(eval $(call config_filename,MODULE_SIG_KEY))
|
|
|
|
mod_sign_cmd = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509
|
|
else
|
|
mod_sign_cmd = true
|
|
endif
|
|
export mod_sign_cmd
|
|
|
|
HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
|
|
|
|
has_libelf := $(call try-run,\
|
|
echo "int main() {}" | \
|
|
$(HOSTCC) $(KBUILD_HOSTCFLAGS) -xc -o /dev/null $(KBUILD_HOSTLDFLAGS) $(HOST_LIBELF_LIBS) -,1,0)
|
|
|
|
ifdef CONFIG_STACK_VALIDATION
|
|
ifeq ($(has_libelf),1)
|
|
objtool_target := tools/objtool FORCE
|
|
else
|
|
SKIP_STACK_VALIDATION := 1
|
|
export SKIP_STACK_VALIDATION
|
|
endif
|
|
endif
|
|
|
|
PHONY += resolve_btfids_clean
|
|
|
|
resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
|
|
|
|
# tools/bpf/resolve_btfids directory might not exist
|
|
# in output directory, skip its clean in that case
|
|
resolve_btfids_clean:
|
|
ifneq ($(wildcard $(resolve_btfids_O)),)
|
|
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
|
|
endif
|
|
|
|
ifdef CONFIG_BPF
|
|
ifdef CONFIG_DEBUG_INFO_BTF
|
|
ifeq ($(has_libelf),1)
|
|
resolve_btfids_target := tools/bpf/resolve_btfids FORCE
|
|
else
|
|
ERROR_RESOLVE_BTFIDS := 1
|
|
endif
|
|
endif # CONFIG_DEBUG_INFO_BTF
|
|
endif # CONFIG_BPF
|
|
|
|
PHONY += prepare0
|
|
|
|
export MODORDER := $(extmod-prefix)modules.order
|
|
export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Kernel headers
|
|
|
|
PHONY += headers
|
|
|
|
#Default location for installed headers
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
PHONY += archheaders archscripts
|
|
hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
|
|
headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
|
|
else
|
|
hdr-prefix = $(KBUILD_EXTMOD)/
|
|
hdr-inst := -f $(srctree)/scripts/Makefile.headersinst dst=$(KBUILD_EXTMOD)/usr/include objtree=$(objtree)/$(KBUILD_EXTMOD) obj
|
|
endif
|
|
|
|
export INSTALL_HDR_PATH = $(objtree)/$(hdr-prefix)usr
|
|
|
|
quiet_cmd_headers_install = INSTALL $(INSTALL_HDR_PATH)/include
|
|
cmd_headers_install = \
|
|
mkdir -p $(INSTALL_HDR_PATH); \
|
|
rsync -mrl --include='*/' --include='*\.h' --exclude='*' \
|
|
$(hdr-prefix)usr/include $(INSTALL_HDR_PATH);
|
|
|
|
PHONY += headers_install
|
|
headers_install: headers
|
|
$(call cmd,headers_install)
|
|
|
|
headers:
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
|
|
$(error Headers not exportable for the $(SRCARCH) architecture))
|
|
endif
|
|
$(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)include/uapi
|
|
$(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)arch/$(SRCARCH)/include/uapi
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ io_uring/
|
|
|
|
vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
|
|
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
|
|
$(libs-y) $(libs-m)))
|
|
|
|
vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
|
|
$(patsubst %/,%,$(filter %/, $(core-) \
|
|
$(drivers-) $(libs-))))
|
|
|
|
build-dirs := $(vmlinux-dirs)
|
|
clean-dirs := $(vmlinux-alldirs)
|
|
|
|
subdir-modorder := $(addsuffix /modules.order, $(build-dirs))
|
|
|
|
# Externally visible symbols (used by link-vmlinux.sh)
|
|
KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y))
|
|
KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y)))
|
|
ifdef CONFIG_MODULES
|
|
KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
|
|
KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
|
|
else
|
|
KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y))
|
|
endif
|
|
KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y))
|
|
|
|
export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
|
|
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
|
|
# used by scripts/Makefile.package
|
|
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools)
|
|
|
|
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
|
|
|
|
# Recurse until adjust_autoksyms.sh is satisfied
|
|
PHONY += autoksyms_recursive
|
|
ifdef CONFIG_TRIM_UNUSED_KSYMS
|
|
# For the kernel to actually contain only the needed exported symbols,
|
|
# we have to build modules as well to determine what those symbols are.
|
|
# (this can be evaluated only once include/config/auto.conf has been included)
|
|
KBUILD_MODULES := 1
|
|
|
|
autoksyms_recursive: descend modules.order
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
|
|
"$(MAKE) -f $(srctree)/Makefile autoksyms_recursive"
|
|
endif
|
|
|
|
autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
|
|
|
|
quiet_cmd_autoksyms_h = GEN $@
|
|
cmd_autoksyms_h = mkdir -p $(dir $@); \
|
|
$(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@
|
|
|
|
$(autoksyms_h):
|
|
$(call cmd,autoksyms_h)
|
|
|
|
ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
|
|
|
|
# Final link of vmlinux with optional arch pass after final link
|
|
cmd_link-vmlinux = \
|
|
$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \
|
|
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
|
|
|
|
ifndef KBUILD_MIXED_TREE
|
|
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
|
|
+$(call if_changed,link-vmlinux)
|
|
endif
|
|
|
|
targets := vmlinux
|
|
|
|
# The actual objects are generated when descending,
|
|
# make sure no implicit rule kicks in
|
|
$(sort $(vmlinux-deps) $(subdir-modorder)): descend ;
|
|
|
|
filechk_kernel.release = \
|
|
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion \
|
|
$(srctree) $(BRANCH) $(KMI_GENERATION))"
|
|
|
|
# Store (new) KERNELRELEASE string in include/config/kernel.release
|
|
include/config/kernel.release: FORCE
|
|
$(call filechk,kernel.release)
|
|
|
|
# Additional helpers built in scripts/
|
|
# Carefully list dependencies so we do not try to build scripts twice
|
|
# in parallel
|
|
PHONY += scripts
|
|
scripts: scripts_basic scripts_dtc
|
|
$(Q)$(MAKE) $(build)=$(@)
|
|
|
|
# Things we need to do before we recursively start building the kernel
|
|
# or the modules are listed in "prepare".
|
|
# A multi level approach is used. prepareN is processed before prepareN-1.
|
|
# archprepare is used in arch Makefiles and when processed asm symlink,
|
|
# version.h and scripts_basic is processed / created.
|
|
|
|
PHONY += prepare archprepare
|
|
|
|
archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
|
|
asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
|
|
include/generated/autoconf.h
|
|
|
|
prepare0: archprepare
|
|
$(Q)$(MAKE) $(build)=scripts/mod
|
|
$(Q)$(MAKE) $(build)=.
|
|
|
|
# All the preparing..
|
|
prepare: prepare0 prepare-objtool prepare-resolve_btfids
|
|
|
|
# Support for using generic headers in asm-generic
|
|
asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj
|
|
|
|
PHONY += asm-generic uapi-asm-generic
|
|
asm-generic: uapi-asm-generic
|
|
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm \
|
|
generic=include/asm-generic
|
|
uapi-asm-generic:
|
|
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
|
|
generic=include/uapi/asm-generic
|
|
|
|
PHONY += prepare-objtool prepare-resolve_btfids
|
|
prepare-objtool: $(objtool_target)
|
|
ifeq ($(SKIP_STACK_VALIDATION),1)
|
|
ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
|
|
@echo "error: Cannot generate __mcount_loc for CONFIG_DYNAMIC_FTRACE=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
|
@false
|
|
endif
|
|
ifdef CONFIG_UNWINDER_ORC
|
|
@echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
|
@false
|
|
else
|
|
@echo "warning: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
|
endif
|
|
endif
|
|
|
|
prepare-resolve_btfids: $(resolve_btfids_target)
|
|
ifeq ($(ERROR_RESOLVE_BTFIDS),1)
|
|
@echo "error: Cannot resolve BTF IDs for CONFIG_DEBUG_INFO_BTF, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
|
|
@false
|
|
endif
|
|
# Generate some files
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# KERNELRELEASE can change from a few different places, meaning version.h
|
|
# needs to be updated, so this check is forced on all builds
|
|
|
|
uts_len := 64
|
|
ifneq (,$(BUILD_NUMBER))
|
|
UTS_RELEASE=$(KERNELRELEASE)-ab$(BUILD_NUMBER)
|
|
else
|
|
UTS_RELEASE=$(KERNELRELEASE)
|
|
endif
|
|
define filechk_utsrelease.h
|
|
if [ `echo -n "$(UTS_RELEASE)" | wc -c ` -gt $(uts_len) ]; then \
|
|
echo '"$(UTS_RELEASE)" exceeds $(uts_len) characters' >&2; \
|
|
exit 1; \
|
|
fi; \
|
|
echo \#define UTS_RELEASE \"$(UTS_RELEASE)\"
|
|
endef
|
|
|
|
define filechk_version.h
|
|
if [ $(SUBLEVEL) -gt 255 ]; then \
|
|
echo \#define LINUX_VERSION_CODE $(shell \
|
|
expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + 255); \
|
|
else \
|
|
echo \#define LINUX_VERSION_CODE $(shell \
|
|
expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
|
|
fi; \
|
|
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + \
|
|
((c) > 255 ? 255 : (c)))'
|
|
endef
|
|
|
|
$(version_h): PATCHLEVEL := $(if $(PATCHLEVEL), $(PATCHLEVEL), 0)
|
|
$(version_h): SUBLEVEL := $(if $(SUBLEVEL), $(SUBLEVEL), 0)
|
|
$(version_h): FORCE
|
|
$(call filechk,version.h)
|
|
$(Q)rm -f $(old_version_h)
|
|
|
|
include/generated/utsrelease.h: include/config/kernel.release FORCE
|
|
$(call filechk,utsrelease.h)
|
|
|
|
PHONY += headerdep
|
|
headerdep:
|
|
$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
|
|
$(srctree)/scripts/headerdep.pl -I$(srctree)/include
|
|
|
|
# Deprecated. It is no-op now.
|
|
PHONY += headers_check
|
|
headers_check:
|
|
@:
|
|
|
|
ifdef CONFIG_HEADERS_INSTALL
|
|
prepare: headers
|
|
endif
|
|
|
|
PHONY += scripts_unifdef
|
|
scripts_unifdef: scripts_basic
|
|
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Kernel selftest
|
|
|
|
PHONY += kselftest
|
|
kselftest:
|
|
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
|
|
|
|
kselftest-%: FORCE
|
|
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
|
|
|
|
PHONY += kselftest-merge
|
|
kselftest-merge:
|
|
$(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
|
|
$(Q)find $(srctree)/tools/testing/selftests -name config | \
|
|
xargs $(srctree)/scripts/kconfig/merge_config.sh -m $(objtree)/.config
|
|
$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Devicetree files
|
|
|
|
ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),)
|
|
# ANDROID: allow this to be overridden by the build environment. This allows
|
|
# one to compile a device tree that is located out-of-tree.
|
|
dtstree ?= arch/$(SRCARCH)/boot/dts
|
|
endif
|
|
|
|
ifneq ($(dtstree),)
|
|
|
|
%.dtb: include/config/kernel.release scripts_dtc
|
|
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
|
|
|
|
PHONY += dtbs dtbs_install dtbs_check
|
|
dtbs: include/config/kernel.release scripts_dtc
|
|
$(Q)$(MAKE) $(build)=$(dtstree)
|
|
|
|
ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
|
|
export CHECK_DTBS=y
|
|
dtbs: dt_binding_check
|
|
endif
|
|
|
|
dtbs_check: dtbs
|
|
|
|
dtbs_install:
|
|
$(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
|
|
|
|
ifdef CONFIG_OF_EARLY_FLATTREE
|
|
all: dtbs
|
|
endif
|
|
|
|
endif
|
|
|
|
PHONY += scripts_dtc
|
|
scripts_dtc: scripts_basic
|
|
$(Q)$(MAKE) $(build)=scripts/dtc
|
|
|
|
ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),)
|
|
export CHECK_DT_BINDING=y
|
|
endif
|
|
|
|
PHONY += dt_binding_check
|
|
dt_binding_check: scripts_dtc
|
|
$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Modules
|
|
|
|
ifdef CONFIG_MODULES
|
|
|
|
# By default, build modules as well
|
|
|
|
all: modules
|
|
|
|
# When we're building modules with modversions, we need to consider
|
|
# the built-in objects during the descend as well, in order to
|
|
# make sure the checksums are up to date before we record them.
|
|
ifdef CONFIG_MODVERSIONS
|
|
KBUILD_BUILTIN := 1
|
|
endif
|
|
|
|
# Build modules
|
|
#
|
|
# A module can be listed more than once in obj-m resulting in
|
|
# duplicate lines in modules.order files. Those are removed
|
|
# using awk while concatenating to the final file.
|
|
|
|
PHONY += modules
|
|
# if KBUILD_BUILTIN && !KBUILD_MIXED_TREE, depend on vmlinux
|
|
modules: $(if $(KBUILD_BUILTIN), $(if $(KBUILD_MIXED_TREE),,vmlinux)) modules_check modules_prepare
|
|
|
|
PHONY += modules_check
|
|
modules_check: modules.order
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
|
|
|
|
cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
|
|
|
|
modules.order: $(subdir-modorder) FORCE
|
|
$(call if_changed,modules_order)
|
|
|
|
targets += modules.order
|
|
|
|
# Target to prepare building external modules
|
|
PHONY += modules_prepare
|
|
modules_prepare: prepare
|
|
$(Q)$(MAKE) $(build)=scripts scripts/module.lds
|
|
|
|
modules_install: __modinst_pre
|
|
PHONY += __modinst_pre
|
|
__modinst_pre:
|
|
@rm -rf $(MODLIB)/kernel
|
|
@rm -f $(MODLIB)/source
|
|
@mkdir -p $(MODLIB)/kernel
|
|
@ln -s $(abspath $(srctree)) $(MODLIB)/source
|
|
@if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
|
|
rm -f $(MODLIB)/build ; \
|
|
ln -s $(CURDIR) $(MODLIB)/build ; \
|
|
fi
|
|
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
|
|
@cp -f $(mixed-build-prefix)modules.builtin $(MODLIB)/
|
|
@cp -f $(or $(mixed-build-prefix),$(objtree)/)modules.builtin.modinfo $(MODLIB)/
|
|
|
|
ifeq ($(CONFIG_MODULE_SIG), y)
|
|
PHONY += modules_sign
|
|
modules_sign:
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
|
|
endif
|
|
|
|
endif # CONFIG_MODULES
|
|
|
|
###
|
|
# Cleaning is done on three levels.
|
|
# make clean Delete most generated files
|
|
# Leave enough to build external modules
|
|
# make mrproper Delete the current configuration, and all generated files
|
|
# make distclean Remove editor backup files, patch leftover files and the like
|
|
|
|
# Directories & files removed with 'make clean'
|
|
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
|
|
modules.builtin modules.builtin.modinfo modules.nsdeps \
|
|
compile_commands.json .thinlto-cache
|
|
|
|
# Directories & files removed with 'make mrproper'
|
|
MRPROPER_FILES += include/config include/generated \
|
|
arch/$(SRCARCH)/include/generated .tmp_objdiff \
|
|
debian snap tar-install \
|
|
.config .config.old .version \
|
|
Module.symvers \
|
|
signing_key.pem signing_key.priv signing_key.x509 \
|
|
x509.genkey extra_certificates signing_key.x509.keyid \
|
|
signing_key.x509.signer vmlinux-gdb.py \
|
|
*.spec
|
|
|
|
# Directories & files removed with 'make distclean'
|
|
DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
|
|
|
|
# clean - Delete most, but leave enough to build external modules
|
|
#
|
|
clean: rm-files := $(CLEAN_FILES)
|
|
|
|
PHONY += archclean vmlinuxclean
|
|
|
|
vmlinuxclean:
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
|
|
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
|
|
|
|
clean: archclean vmlinuxclean resolve_btfids_clean
|
|
|
|
# mrproper - Delete all generated files, including .config
|
|
#
|
|
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
|
|
mrproper-dirs := $(addprefix _mrproper_,scripts)
|
|
|
|
PHONY += $(mrproper-dirs) mrproper
|
|
$(mrproper-dirs):
|
|
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
|
|
|
|
mrproper: clean $(mrproper-dirs)
|
|
$(call cmd,rmfiles)
|
|
|
|
# distclean
|
|
#
|
|
distclean: rm-files := $(wildcard $(DISTCLEAN_FILES))
|
|
|
|
PHONY += distclean
|
|
|
|
distclean: mrproper
|
|
$(call cmd,rmfiles)
|
|
@find $(srctree) $(RCS_FIND_IGNORE) \
|
|
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
|
|
-o -name '*.bak' -o -name '#*#' -o -name '*%' \
|
|
-o -name 'core' \) \
|
|
-type f -print | xargs rm -f
|
|
|
|
|
|
# Packaging of the kernel to various formats
|
|
# ---------------------------------------------------------------------------
|
|
|
|
%src-pkg: FORCE
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
|
|
%pkg: include/config/kernel.release FORCE
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
|
|
|
|
# Brief documentation of the typical targets used
|
|
# ---------------------------------------------------------------------------
|
|
|
|
boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig)
|
|
boards := $(sort $(notdir $(boards)))
|
|
board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig))
|
|
board-dirs := $(sort $(notdir $(board-dirs:/=)))
|
|
|
|
PHONY += help
|
|
help:
|
|
@echo 'Cleaning targets:'
|
|
@echo ' clean - Remove most generated files but keep the config and'
|
|
@echo ' enough build support to build external modules'
|
|
@echo ' mrproper - Remove all generated files + config + various backup files'
|
|
@echo ' distclean - mrproper + remove editor backup and patch files'
|
|
@echo ''
|
|
@echo 'Configuration targets:'
|
|
@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
|
|
@echo ''
|
|
@echo 'Other generic targets:'
|
|
@echo ' all - Build all targets marked with [*]'
|
|
@echo '* vmlinux - Build the bare kernel'
|
|
@echo '* modules - Build all modules'
|
|
@echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
|
|
@echo ' dir/ - Build all files in dir and below'
|
|
@echo ' dir/file.[ois] - Build specified target only'
|
|
@echo ' dir/file.ll - Build the LLVM assembly file'
|
|
@echo ' (requires compiler support for LLVM assembly generation)'
|
|
@echo ' dir/file.lst - Build specified mixed source/assembly target only'
|
|
@echo ' (requires a recent binutils and recent build (System.map))'
|
|
@echo ' dir/file.ko - Build module including final link'
|
|
@echo ' modules_prepare - Set up for building external modules'
|
|
@echo ' tags/TAGS - Generate tags file for editors'
|
|
@echo ' cscope - Generate cscope index'
|
|
@echo ' gtags - Generate GNU GLOBAL index'
|
|
@echo ' kernelrelease - Output the release version string (use with make -s)'
|
|
@echo ' kernelversion - Output the version stored in Makefile (use with make -s)'
|
|
@echo ' image_name - Output the image name (use with make -s)'
|
|
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
|
|
echo ' (default: $(INSTALL_HDR_PATH))'; \
|
|
echo ''
|
|
@echo 'Static analysers:'
|
|
@echo ' checkstack - Generate a list of stack hogs'
|
|
@echo ' versioncheck - Sanity check on version.h usage'
|
|
@echo ' includecheck - Check for duplicate included header files'
|
|
@echo ' export_report - List the usages of all exported symbols'
|
|
@echo ' headerdep - Detect inclusion cycles in headers'
|
|
@echo ' coccicheck - Check with Coccinelle'
|
|
@echo ' clang-analyzer - Check with clang static analyzer'
|
|
@echo ' clang-tidy - Check with clang-tidy'
|
|
@echo ''
|
|
@echo 'Tools:'
|
|
@echo ' nsdeps - Generate missing symbol namespace dependencies'
|
|
@echo ''
|
|
@echo 'Kernel selftest:'
|
|
@echo ' kselftest - Build and run kernel selftest'
|
|
@echo ' Build, install, and boot kernel before'
|
|
@echo ' running kselftest on it'
|
|
@echo ' Run as root for full coverage'
|
|
@echo ' kselftest-all - Build kernel selftest'
|
|
@echo ' kselftest-install - Build and install kernel selftest'
|
|
@echo ' kselftest-clean - Remove all generated kselftest files'
|
|
@echo ' kselftest-merge - Merge all the config dependencies of'
|
|
@echo ' kselftest to existing .config.'
|
|
@echo ''
|
|
@$(if $(dtstree), \
|
|
echo 'Devicetree:'; \
|
|
echo '* dtbs - Build device tree blobs for enabled boards'; \
|
|
echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'; \
|
|
echo ' dt_binding_check - Validate device tree binding documents'; \
|
|
echo ' dtbs_check - Validate device tree source files';\
|
|
echo '')
|
|
|
|
@echo 'Userspace tools targets:'
|
|
@echo ' use "make tools/help"'
|
|
@echo ' or "cd tools; make help"'
|
|
@echo ''
|
|
@echo 'Kernel packaging:'
|
|
@$(MAKE) -f $(srctree)/scripts/Makefile.package help
|
|
@echo ''
|
|
@echo 'Documentation targets:'
|
|
@$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
|
|
@echo ''
|
|
@echo 'Architecture specific targets ($(SRCARCH)):'
|
|
@$(if $(archhelp),$(archhelp),\
|
|
echo ' No architecture specific help defined for $(SRCARCH)')
|
|
@echo ''
|
|
@$(if $(boards), \
|
|
$(foreach b, $(boards), \
|
|
printf " %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
|
|
echo '')
|
|
@$(if $(board-dirs), \
|
|
$(foreach b, $(board-dirs), \
|
|
printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
|
|
printf " %-16s - Show all of the above\\n" help-boards; \
|
|
echo '')
|
|
|
|
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
|
|
@echo ' make V=2 [targets] 2 => give reason for rebuild of target'
|
|
@echo ' make O=dir [targets] Locate all output files in "dir", including .config'
|
|
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
|
|
@echo ' (sparse by default)'
|
|
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
|
|
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
|
|
@echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
|
|
@echo ' 1: warnings which may be relevant and do not occur too often'
|
|
@echo ' 2: warnings which occur quite often but may still be relevant'
|
|
@echo ' 3: more obscure warnings, can most likely be ignored'
|
|
@echo ' Multiple levels can be combined with W=12 or W=123'
|
|
@echo ''
|
|
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
|
|
@echo 'For further info see the ./README file'
|
|
|
|
|
|
help-board-dirs := $(addprefix help-,$(board-dirs))
|
|
|
|
help-boards: $(help-board-dirs)
|
|
|
|
boards-per-dir = $(sort $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)))
|
|
|
|
$(help-board-dirs): help-%:
|
|
@echo 'Architecture specific targets ($(SRCARCH) $*):'
|
|
@$(if $(boards-per-dir), \
|
|
$(foreach b, $(boards-per-dir), \
|
|
printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \
|
|
echo '')
|
|
|
|
|
|
# Documentation targets
|
|
# ---------------------------------------------------------------------------
|
|
DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
|
|
linkcheckdocs dochelp refcheckdocs
|
|
PHONY += $(DOC_TARGETS)
|
|
$(DOC_TARGETS):
|
|
$(Q)$(MAKE) $(build)=Documentation $@
|
|
|
|
# Misc
|
|
# ---------------------------------------------------------------------------
|
|
|
|
PHONY += scripts_gdb
|
|
scripts_gdb: prepare0
|
|
$(Q)$(MAKE) $(build)=scripts/gdb
|
|
$(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
|
|
|
|
ifdef CONFIG_GDB_SCRIPTS
|
|
all: scripts_gdb
|
|
endif
|
|
|
|
else # KBUILD_EXTMOD
|
|
|
|
###
|
|
# External module support.
|
|
# When building external modules the kernel used as basis is considered
|
|
# read-only, and no consistency checks are made and the make
|
|
# system is not used on the basis kernel. If updates are required
|
|
# in the basis kernel ordinary make commands (without M=...) must
|
|
# be used.
|
|
#
|
|
# The following are the only valid targets when building external
|
|
# modules.
|
|
# make M=dir clean Delete all automatically generated files
|
|
# make M=dir modules Make all modules in specified dir
|
|
# make M=dir Same as 'make M=dir modules'
|
|
# make M=dir modules_install
|
|
# Install the modules built in the module directory
|
|
# Assumes install directory is already created
|
|
|
|
# We are always building only modules.
|
|
KBUILD_BUILTIN :=
|
|
KBUILD_MODULES := 1
|
|
|
|
build-dirs := $(KBUILD_EXTMOD)
|
|
$(MODORDER): descend
|
|
@:
|
|
|
|
compile_commands.json: $(extmod-prefix)compile_commands.json
|
|
PHONY += compile_commands.json
|
|
|
|
clean-dirs := $(KBUILD_EXTMOD)
|
|
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps \
|
|
$(KBUILD_EXTMOD)/compile_commands.json $(KBUILD_EXTMOD)/.thinlto-cache
|
|
|
|
PHONY += help
|
|
help:
|
|
@echo ' Building external modules.'
|
|
@echo ' Syntax: make -C path/to/kernel/src M=$$PWD target'
|
|
@echo ''
|
|
@echo ' modules - default target, build the module(s)'
|
|
@echo ' modules_install - install the module'
|
|
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'
|
|
@echo ' (default: $(abspath $(INSTALL_HDR_PATH)))'
|
|
@echo ' clean - remove generated files in module directory only'
|
|
@echo ''
|
|
|
|
# no-op for external module builds
|
|
PHONY += prepare modules_prepare
|
|
|
|
endif # KBUILD_EXTMOD
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Modules
|
|
|
|
PHONY += modules modules_install
|
|
|
|
ifdef CONFIG_MODULES
|
|
|
|
modules: $(MODORDER)
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
|
|
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
|
|
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
|
|
$(KERNELRELEASE) $(mixed-build-prefix)
|
|
|
|
modules_install:
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
|
$(call cmd,depmod)
|
|
|
|
else # CONFIG_MODULES
|
|
|
|
# Modules not configured
|
|
# ---------------------------------------------------------------------------
|
|
|
|
modules modules_install:
|
|
@echo >&2 '***'
|
|
@echo >&2 '*** The present kernel configuration has modules disabled.'
|
|
@echo >&2 '*** To use the module feature, please run "make menuconfig" etc.'
|
|
@echo >&2 '*** to enable CONFIG_MODULES.'
|
|
@echo >&2 '***'
|
|
@exit 1
|
|
|
|
KBUILD_MODULES :=
|
|
|
|
endif # CONFIG_MODULES
|
|
|
|
# Single targets
|
|
# ---------------------------------------------------------------------------
|
|
# To build individual files in subdirectories, you can do like this:
|
|
#
|
|
# make foo/bar/baz.s
|
|
#
|
|
# The supported suffixes for single-target are listed in 'single-targets'
|
|
#
|
|
# To build only under specific subdirectories, you can do like this:
|
|
#
|
|
# make foo/bar/baz/
|
|
|
|
ifdef single-build
|
|
|
|
# .ko is special because modpost is needed
|
|
single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
|
|
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
|
|
|
|
$(single-ko): single_modpost
|
|
@:
|
|
$(single-no-ko): descend
|
|
@:
|
|
|
|
# Remove MODORDER when done because it is not the real one.
|
|
PHONY += single_modpost
|
|
single_modpost: $(single-no-ko) modules_prepare
|
|
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
$(Q)rm -f $(MODORDER)
|
|
|
|
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
|
|
|
|
# trim unrelated directories
|
|
build-dirs := $(foreach d, $(build-dirs), \
|
|
$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
|
|
|
|
endif
|
|
|
|
# Handle descending into subdirectories listed in $(build-dirs)
|
|
# Preset locale variables to speed up the build process. Limit locale
|
|
# tweaks to this spot to avoid wrong language settings when running
|
|
# make menuconfig etc.
|
|
# Error messages still appears in the original language
|
|
PHONY += descend $(build-dirs)
|
|
descend: $(build-dirs)
|
|
$(build-dirs): prepare
|
|
$(Q)$(MAKE) $(build)=$@ \
|
|
single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \
|
|
$(if $(KBUILD_MIXED_TREE),,need-builtin=1) need-modorder=1
|
|
|
|
clean-dirs := $(addprefix _clean_, $(clean-dirs))
|
|
PHONY += $(clean-dirs) clean
|
|
$(clean-dirs):
|
|
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
|
|
|
clean: $(clean-dirs)
|
|
$(call cmd,rmfiles)
|
|
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) \
|
|
$(if $(filter-out arch/$(SRCARCH)/boot/dts, $(dtstree)), $(dtstree)) \
|
|
$(RCS_FIND_IGNORE) \
|
|
\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
|
|
-o -name '*.ko.*' \
|
|
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
|
|
-o -name '*.dwo' -o -name '*.lst' \
|
|
-o -name '*.su' -o -name '*.mod' \
|
|
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
|
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
|
|
-o -name '*.asn1.[ch]' \
|
|
-o -name '*.symtypes' -o -name 'modules.order' \
|
|
-o -name '.tmp_*.o.*' \
|
|
-o -name '*.c.[012]*.*' \
|
|
-o -name '*.ll' \
|
|
-o -name '*.gcno' \
|
|
-o -name '*.*.symversions' \) -type f -print | xargs rm -f
|
|
|
|
# Generate tags for editors
|
|
# ---------------------------------------------------------------------------
|
|
quiet_cmd_tags = GEN $@
|
|
cmd_tags = $(BASH) $(srctree)/scripts/tags.sh $@
|
|
|
|
tags TAGS cscope gtags: FORCE
|
|
$(call cmd,tags)
|
|
|
|
# Script to generate missing namespace dependencies
|
|
# ---------------------------------------------------------------------------
|
|
|
|
PHONY += nsdeps
|
|
nsdeps: export KBUILD_NSDEPS=1
|
|
nsdeps: modules
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
|
|
|
|
# Clang Tooling
|
|
# ---------------------------------------------------------------------------
|
|
|
|
quiet_cmd_gen_compile_commands = GEN $@
|
|
cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
|
|
|
|
$(extmod-prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \
|
|
$(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \
|
|
$(if $(CONFIG_MODULES), $(MODORDER)) FORCE
|
|
$(call if_changed,gen_compile_commands)
|
|
|
|
targets += $(extmod-prefix)compile_commands.json
|
|
|
|
PHONY += clang-tidy clang-analyzer
|
|
|
|
ifdef CONFIG_CC_IS_CLANG
|
|
quiet_cmd_clang_tools = CHECK $<
|
|
cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
|
|
|
|
clang-tidy clang-analyzer: $(extmod-prefix)compile_commands.json
|
|
$(call cmd,clang_tools)
|
|
else
|
|
clang-tidy clang-analyzer:
|
|
@echo "$@ requires CC=clang" >&2
|
|
@false
|
|
endif
|
|
|
|
# Scripts to check various things for consistency
|
|
# ---------------------------------------------------------------------------
|
|
|
|
PHONY += includecheck versioncheck coccicheck export_report
|
|
|
|
includecheck:
|
|
find $(srctree)/* $(RCS_FIND_IGNORE) \
|
|
-name '*.[hcS]' -type f -print | sort \
|
|
| xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
|
|
|
|
versioncheck:
|
|
find $(srctree)/* $(RCS_FIND_IGNORE) \
|
|
-name '*.[hcS]' -type f -print | sort \
|
|
| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
|
|
|
|
coccicheck:
|
|
$(Q)$(BASH) $(srctree)/scripts/$@
|
|
|
|
export_report:
|
|
$(PERL) $(srctree)/scripts/export_report.pl
|
|
|
|
PHONY += checkstack kernelrelease kernelversion image_name
|
|
|
|
# UML needs a little special treatment here. It wants to use the host
|
|
# toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone
|
|
# else wants $(ARCH), including people doing cross-builds, which means
|
|
# that $(SUBARCH) doesn't work here.
|
|
ifeq ($(ARCH), um)
|
|
CHECKSTACK_ARCH := $(SUBARCH)
|
|
else
|
|
CHECKSTACK_ARCH := $(ARCH)
|
|
endif
|
|
checkstack:
|
|
$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
|
|
$(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
|
|
|
|
kernelrelease:
|
|
@echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion \
|
|
$(srctree) $(BRANCH) $(KMI_GENERATION))"
|
|
|
|
kernelversion:
|
|
@echo $(KERNELVERSION)
|
|
|
|
image_name:
|
|
@echo $(KBUILD_IMAGE)
|
|
|
|
# Clear a bunch of variables before executing the submake
|
|
|
|
ifeq ($(quiet),silent_)
|
|
tools_silent=s
|
|
endif
|
|
|
|
tools/: FORCE
|
|
$(Q)mkdir -p $(objtree)/tools
|
|
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
|
|
|
|
tools/%: FORCE
|
|
$(Q)mkdir -p $(objtree)/tools
|
|
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
|
|
|
|
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
|
|
cmd_rmfiles = rm -rf $(rm-files)
|
|
|
|
# read saved command lines for existing targets
|
|
existing-targets := $(wildcard $(sort $(targets)))
|
|
|
|
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
|
|
|
|
endif # config-build
|
|
endif # mixed-build
|
|
endif # need-sub-make
|
|
|
|
PHONY += FORCE
|
|
FORCE:
|
|
|
|
# Declare the contents of the PHONY variable as phony. We keep that
|
|
# information in a variable so we can use it in if_changed and friends.
|
|
.PHONY: $(PHONY)
|