4c30d46517
* refs/heads/tmp-5da1114: Revert crypto changes from android-4.19.79-95 Revert "UPSTREAM: PM / wakeup updates" Revert "ANDROID: of: property: Enable of_devlink by default" Revert "UPSTREAM: dt-bindings: arm: coresight: Add support for coresight-loses-context-with-cpu" UPSTREAM: net: usbnet: Fix -Wcast-function-type UPSTREAM: USB: dummy-hcd: use usb_urb_dir_in instead of usb_pipein UPSTREAM: USB: dummy-hcd: increase max number of devices to 32 ANDROID: tty: serdev: Fix broken serial console input ANDROID: update kernel ABI (perf_event changes) BACKPORT: perf_event: Add support for LSM and SELinux checks UPSTREAM: iommu: Allow io-pgtable to be used outside of drivers/iommu/ ANDROID: update abi for 4.19.94 release ANDROID: update abi due to revert Revert "BACKPORT: perf_event: Add support for LSM and SELinux checks" UPSTREAM: selinux: sidtab reverse lookup hash table UPSTREAM: selinux: avoid atomic_t usage in sidtab UPSTREAM: selinux: check sidtab limit before adding a new entry UPSTREAM: selinux: fix context string corruption in convert_context() UPSTREAM: selinux: overhaul sidtab to fix bug and improve performance UPSTREAM: selinux: refactor mls_context_to_sid() and make it stricter UPSTREAM: selinux: use separate table for initial SID lookup UPSTREAM: selinux: make "selinux_policycap_names[]" const char * UPSTREAM: selinux: refactor sidtab conversion ANDROID: Update ABI representation ANDROID: GKI: clk: Don't disable unused clocks with sync state support ANDROID: GKI: clk: Add support for clock providers with sync state ANDROID: GKI: driver core: Add dev_has_sync_state() ANDROID: update kernel ABI representation BACKPORT: perf_event: Add support for LSM and SELinux checks ANDROID: update ABI representation UPSTREAM: exit: panic before exit_mm() on global init exit ANDROID: serdev: Fix platform device support ANDROID: Kconfig.gki: Add Hidden SPRD DRM configs ANDROID: gki_defconfig: Disable TRANSPARENT_HUGEPAGE ANDROID: gki_defconfig: Enable CONFIG_GNSS_CMDLINE_SERIAL ANDROID: gnss: Add command line test driver ANDROID: serdev: add platform device support ANDROID: gki_defconfig: enable ARM64_SW_TTBR0_PAN ANDROID: gki_defconfig: Set BINFMT_MISC as =m UPSTREAM: binder: fix incorrect calculation for num_valid ABI: Update ABI after f2fs merge ANDROID: add initial ABI whitelist for android-4.19 ANDROID: staging: android: ion: Fix build when CONFIG_ION_SYSTEM_HEAP=n ANDROID: staging: android: ion: Expose total heap and pool sizes via sysfs ANDROID: Update ABI representation due to vmstat counter changes UPSTREAM: include/linux/slab.h: fix sparse warning in kmalloc_type() UPSTREAM: mm, slab: shorten kmalloc cache names for large sizes UPSTREAM: mm, proc: add KReclaimable to /proc/meminfo UPSTREAM: mm: rename and change semantics of nr_indirectly_reclaimable_bytes UPSTREAM: dcache: allocate external names from reclaimable kmalloc caches UPSTREAM: mm, slab/slub: introduce kmalloc-reclaimable caches UPSTREAM: mm, slab: combine kmalloc_caches and kmalloc_dma_caches ANDROID: abi update for 4.19.89 ANDROID: update abi_gki_aarch64.xml for LTO, CFI, and SCS ANDROID: gki_defconfig: enable LTO, CFI, and SCS ANDROID: update abi_gki_aarch64.xml for CONFIG_GNSS ANDROID: cuttlefish_defconfig: Enable CONFIG_GNSS UPSTREAM: arm64: Validate tagged addresses in access_ok() called from kernel threads ANDROID: mm: Throttle rss_stat tracepoint UPSTREAM: mm: slub: really fix slab walking for init_on_free ANDROID: update abi_gki_aarch64.xml for nf change ANDROID: kbuild: limit LTO inlining ANDROID: kbuild: merge module sections with LTO ANDROID: netfilter: nf_nat: remove static from nf_nat_ipv4_fn UPSTREAM: drm/client: remove the exporting of drm_client_close ANDROID: f2fs: fix possible merge of unencrypted with encrypted I/O UPSTREAM: binder: Add binder_proc logging to binderfs UPSTREAM: binder: Make transaction_log available in binderfs UPSTREAM: binder: Add stats, state and transactions files UPSTREAM: binder: add a mount option to show global stats UPSTREAM: binder: Validate the default binderfs device names. UPSTREAM: binder: Add default binder devices through binderfs when configured UPSTREAM: binder: fix CONFIG_ANDROID_BINDER_DEVICES UPSTREAM: android: binder: use kstrdup instead of open-coding it UPSTREAM: binderfs: remove separate device_initcall() UPSTREAM: binderfs: respect limit on binder control creation UPSTREAM: binderfs: switch from d_add() to d_instantiate() UPSTREAM: binderfs: drop lock in binderfs_binder_ctl_create UPSTREAM: binderfs: kill_litter_super() before cleanup UPSTREAM: binderfs: rework binderfs_binder_device_create() UPSTREAM: binderfs: rework binderfs_fill_super() UPSTREAM: binderfs: prevent renaming the control dentry UPSTREAM: binderfs: remove outdated comment UPSTREAM: binderfs: fix error return code in binderfs_fill_super() UPSTREAM: binderfs: handle !CONFIG_IPC_NS builds UPSTREAM: binderfs: reserve devices for initial mount UPSTREAM: binderfs: rename header to binderfs.h UPSTREAM: binderfs: implement "max" mount option UPSTREAM: binderfs: make each binderfs mount a new instance UPSTREAM: binderfs: remove wrong kern_mount() call UPSTREAM: binder: implement binderfs UPSTREAM: binder: remove BINDER_DEBUG_ENTRY() ANDROID: Don't base allmodconfig on gki_defconfig ANDROID: Disable UNWINDER_ORC for allmodconfig ANDROID: update abi_gki_aarch64.xml for 4.19.87 BACKPORT: ARM: 8905/1: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer ANDROID: update abi_gki_aarch64.xml ANDROID: gki_defconfig: =m's applied for virtio configs in arm64 UPSTREAM: of: property: Add device link support for interrupt-parent, dmas and -gpio(s) UPSTREAM: of: property: Add device link support for "iommu-map" UPSTREAM: of: property: Fix the semantics of of_is_ancestor_of() UPSTREAM: i2c: of: Populate fwnode in of_i2c_get_board_info() UPSTREAM: driver core: Clarify documentation for fwnode_operations.add_links() UPSTREAM: dt-bindings: arm: coresight: Add support for coresight-loses-context-with-cpu BACKPORT: coresight: etm4x: Save/restore state across CPU low power states ANDROID: Update ABI representation ANDROID: gki_defconfig: IIO=y f2fs: stop GC when the victim becomes fully valid f2fs: expose main_blkaddr in sysfs f2fs: choose hardlimit when softlimit is larger than hardlimit in f2fs_statfs_project() f2fs: Fix deadlock in f2fs_gc() context during atomic files handling f2fs: show f2fs instance in printk_ratelimited f2fs: fix potential overflow f2fs: fix to update dir's i_pino during cross_rename f2fs: support aligned pinned file f2fs: avoid kernel panic on corruption test f2fs: fix wrong description in document f2fs: cache global IPU bio f2fs: fix to avoid memory leakage in f2fs_listxattr f2fs: check total_segments from devices in raw_super f2fs: update multi-dev metadata in resize_fs f2fs: mark recovery flag correctly in read_raw_super_block() f2fs: fix to update time in lazytime mode vfs: don't allow writes to swap files mm: set S_SWAPFILE on blockdev swap devices BACKPORT: ARM: 8900/1: UNWINDER_FRAME_POINTER implementation for Clang ANDROID: update abi_gki_aarch64.xml for 4.19.87 ANDROID: gki_defconfig: FW_CACHE to no FROMGIT: firmware_class: make firmware caching configurable FROMLIST: arm64: implement Shadow Call Stack FROMLIST: arm64: disable SCS for hypervisor code BACKPORT: FROMLIST: arm64: vdso: disable Shadow Call Stack FROMLIST: arm64: efi: restore x18 if it was corrupted FROMLIST: arm64: preserve x18 when CPU is suspended FROMLIST: arm64: reserve x18 from general allocation with SCS FROMLIST: arm64: disable function graph tracing with SCS FROMLIST: scs: add support for stack usage debugging FROMLIST: scs: add accounting FROMLIST: add support for Clang's Shadow Call Stack (SCS) FROMLIST: arm64: kernel: avoid x18 in __cpu_soft_restart FROMLIST: arm64: kvm: stop treating register x18 as caller save FROMLIST: arm64/lib: copy_page: avoid x18 register in assembler code FROMLIST: arm64: mm: avoid x18 in idmap_kpti_install_ng_mappings ANDROID: use non-canonical CFI jump tables ANDROID: arm64: add __nocfi to __apply_alternatives ANDROID: arm64: add __pa_function ANDROID: arm64: allow ThinLTO to be selected ANDROID: soc/tegra: disable ARCH_TEGRA_210_SOC with LTO FROMLIST: arm64: fix alternatives with LLVM's integrated assembler ANDROID: irqchip/gic-v3: rename gic_of_init to work around a ThinLTO+CFI bug ANDROID: init: ensure initcall ordering with LTO Revert "ANDROID: init: ensure initcall ordering with LTO" ANDROID: add support for ThinLTO ANDROID: clang: update to 10.0.1 ANDROID: gki_defconfig: enable CONFIG_REGULATOR_FIXED_VOLTAGE ANDROID: gki_defconfig: removed CONFIG_PM_WAKELOCKS ANDROID: gki_defconfig: enable CONFIG_IKHEADERS as m FROMGIT: pinctrl: devicetree: Avoid taking direct reference to device name string ANDROID: update abi_gki_aarch64.xml for 4.19.86 update ANDROID: Update ABI representation ANDROID: gki_defconfig: disable FUNCTION_TRACER ANDROID: Update the ABI representation ANDROID: update ABI representation ANDROID: add unstripped modules to the distribution FROMLIST: vsprintf: Inline call to ptr_to_hashval UPSTREAM: rss_stat: Add support to detect RSS updates of external mm UPSTREAM: mm: emit tracepoint when RSS changes FROMGIT: driver core: Allow device link operations inside sync_state() ANDROID: uid_sys_stats: avoid double accounting of dying threads ANDROID: scsi: ufs-qcom: Enable BROKEN_CRYPTO quirk flag ANDROID: scsi: ufs-hisi: Enable BROKEN_CRYPTO quirk flag ANDROID: scsi: ufs: Add quirk bit for controllers that don't play well with inline crypto ANDROID: scsi: ufs: UFS init should not require inline crypto ANDROID: scsi: ufs: UFS crypto variant operations API ANDROID: gki_defconfig: enable inline encryption BACKPORT: FROMLIST: ext4: add inline encryption support BACKPORT: FROMLIST: f2fs: add inline encryption support BACKPORT: FROMLIST: fscrypt: add inline encryption support BACKPORT: FROMLIST: scsi: ufs: Add inline encryption support to UFS BACKPORT: FROMLIST: scsi: ufs: UFS crypto API BACKPORT: FROMLIST: scsi: ufs: UFS driver v2.1 spec crypto additions BACKPORT: FROMLIST: block: blk-crypto for Inline Encryption ANDROID: block: Fix bio_crypt_should_process WARN_ON BACKPORT: FROMLIST: block: Add encryption context to struct bio BACKPORT: FROMLIST: block: Keyslot Manager for Inline Encryption FROMLIST: f2fs: add support for IV_INO_LBLK_64 encryption policies FROMLIST: ext4: add support for IV_INO_LBLK_64 encryption policies BACKPORT: FROMLIST: fscrypt: add support for IV_INO_LBLK_64 policies FROMLIST: fscrypt: zeroize fscrypt_info before freeing FROMLIST: fscrypt: remove struct fscrypt_ctx BACKPORT: FROMLIST: fscrypt: invoke crypto API for ESSIV handling ANDROID: build kernels with llvm-nm and llvm-objcopy ANDROID: Fix allmodconfig build with CC=clang UPSTREAM: mm/page_poison: expose page_poisoning_enabled to kernel modules FROMGIT: of: property: Add device link support for iommus, mboxes and io-channels FROMGIT: of: property: Make it easy to add device links from DT properties FROMGIT: of: property: Minor style clean up of of_link_to_phandle() Revert "ANDROID: of/property: Add device link support for iommus" ANDROID: Add allmodconfig build.configs for x86_64 and aarch64 ANDROID: fix allmodconfig build ANDROID: nf: IDLETIMER: Fix possible use before initialization in idletimer_resume BACKPORT: coresight: funnel: Support static funnel BACKPORT:FROMGIT: coresight: replicator: Fix missing spin_lock_init() BACKPORT:FROMGIT: coresight: funnel: Fix missing spin_lock_init() BACKPORT:FROMGIT: coresight: Serialize enabling/disabling a link device. UPSTREAM: coresight: tmc-etr: Add barrier packets when moving offset forward UPSTREAM: coresight: tmc-etr: Decouple buffer sync and barrier packet insertion UPSTREAM: coresight: tmc: Make memory width mask computation into a function UPSTREAM: coresight: tmc-etr: Fix perf_data check UPSTREAM: coresight: tmc-etr: Fix updating buffer in not-snapshot mode. UPSTREAM: coresight: tmc-etr: Check if non-secure access is enabled UPSTREAM: coresight: tmc-etr: Handle memory errors BACKPORT: coresight: etr_buf: Consolidate refcount initialization UPSTREAM: coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute UPSTREAM: coresight: Use coresight device names for sinks in PMU attribute UPSTREAM: coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id from preemptible UPSTREAM: coresight: tmc-etr: Do not call smp_processor_id() from preemptible UPSTREAM: coresight: perf: Don't set the truncated flag in snapshot mode UPSTREAM: coresight: tmc-etf: Fix snapshot mode update function UPSTREAM: coresight: tmc-etr: Properly set AUX buffer head in snapshot mode UPSTREAM: coresight: tmc-etr: Add support for CPU-wide trace scenarios UPSTREAM: coresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios UPSTREAM: coresight: tmc-etr: Introduce the notion of IDR to ETR devices UPSTREAM: coresight: tmc-etr: Introduce the notion of reference counting to ETR devices UPSTREAM: coresight: tmc-etr: Introduce the notion of process ID to ETR devices UPSTREAM: coresight: tmc-etr: Create per-thread buffer allocation function UPSTREAM: coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf() UPSTREAM: coresight: Communicate perf event to sink buffer allocation functions UPSTREAM: coresight: perf: Refactor function free_event_data() UPSTREAM: coresight: perf: Clean up function etm_setup_aux() UPSTREAM: coresight: Properly address concurrency in sink::update() functions UPSTREAM: coresight: Properly address errors in sink::disable() functions UPSTREAM: coresight: Move reference counting inside sink drivers UPSTREAM: coresight: Adding return code to sink::disable() operation UPSTREAM: coresight: etm4x: Configure tracers to emit timestamps UPSTREAM: coresight: etm4x: Skip selector pair 0 UPSTREAM: coresight: etm4x: Add kernel configuration for CONTEXTID UPSTREAM: coresight: pmu: Adding ITRACE property to cs_etm PMU UPSTREAM: coresight: tmc: Cleanup power management UPSTREAM: coresight: Fix freeing up the coresight connections UPSTREAM: coresight: tmc: Report DMA setup failures UPSTREAM: coresight: catu: fix clang build warning UPSTREAM: perf/core: Fix the address filtering fix UPSTREAM: perf, pt, coresight: Fix address filters for vmas with non-zero offset UPSTREAM: perf: Copy parent's address filter offsets on clone UPSTREAM: coresight: Use event attributes for sink selection UPSTREAM: coresight: perf: Add "sinks" group to PMU directory UPSTREAM: coresight: etb10: Add support for CLAIM tag UPSTREAM: coreisght: tmc: Claim device before use UPSTREAM: coresight: dynamic-replicator: Claim device for use UPSTREAM: coresight: funnel: Claim devices before use UPSTREAM: coresight: etmx: Claim devices before use UPSTREAM: coresight: Add support for CLAIM tag protocol UPSTREAM: coresight: dynamic-replicator: Handle multiple connections UPSTREAM: coresight: etb10: Handle errors enabling the device UPSTREAM: coresight: etm3: Add support for handling errors UPSTREAM: coresight: etm4x: Add support for handling errors UPSTREAM: coresight: tmc-etb/etf: Prepare to handle errors enabling UPSTREAM: coresight: tmc-etr: Handle errors enabling CATU UPSTREAM: coresight: tmc-etr: Refactor for handling errors UPSTREAM: coresight: Handle failures in enabling a trace path UPSTREAM: coresight: tmc: Fix byte-address alignment for RRP UPSTREAM: coresight: etm4x: Configure EL2 exception level when kernel is running in HYP UPSTREAM: coresight: etb10: Splitting function etb_enable() UPSTREAM: coresight: etb10: Refactor etb_drvdata::mode handling UPSTREAM: coresight: etm-perf: Add support for ETR backend UPSTREAM: coresight: perf: Remove set_buffer call back UPSTREAM: coresight: perf: Add helper to retrieve sink configuration UPSTREAM: coresight: perf: Remove reset_buffer call back for sinks UPSTREAM: coresight: Convert driver messages to dev_dbg UPSTREAM: coresight: tmc-etr: Relax collection of trace from sysfs mode UPSTREAM: coresight: tmc-etr: Handle driver mode specific ETR buffers UPSTREAM: coresight: perf: Disable trace path upon source error UPSTREAM: coresight: perf: Allow tracing on hotplugged CPUs UPSTREAM: coresight: perf: Avoid unncessary CPU hotplug read lock UPSTREAM: coresight: perf: Fix per cpu path management UPSTREAM: coresight: Fix handling of sinks UPSTREAM: coresight: Use ERR_CAST instead of ERR_PTR UPSTREAM: coresight: Fix remote endpoint parsing UPSTREAM: coresight: platform: Fix leaking device reference UPSTREAM: coresight: platform: Fix refcounting for graph nodes UPSTREAM: coresight: platform: Refactor graph endpoint parsing UPSTREAM: coresight: Document error handling in coresight_register ANDROID: regression introduced override_creds=off ANDROID: overlayfs: internal getxattr operations without sepolicy checking ANDROID: overlayfs: add __get xattr method ANDROID: Add optional __get xattr method paired to __vfs_getxattr UPSTREAM: scsi: ufs: override auto suspend tunables for ufs UPSTREAM: scsi: core: allow auto suspend override by low-level driver FROMGIT: of: property: Skip adding device links to suppliers that aren't devices ANDROID: gki_defconfig: enable CONFIG_KEYBOARD_GPIO UPSTREAM: dm bufio: introduce a global cache replacement UPSTREAM: dm bufio: remove old-style buffer cleanup UPSTREAM: dm bufio: introduce a global queue UPSTREAM: dm bufio: refactor adjust_total_allocated UPSTREAM: dm bufio: call adjust_total_allocated from __link_buffer and __unlink_buffer ANDROID: dummy_cpufreq: Implement get() ANDROID: gki_defconfig: enable CONFIG_CPUSETS ANDROID: virtio: virtio_input: Set the amount of multitouch slots in virtio input rtlwifi: Fix potential overflow on P2P code ANDROID: cpufreq: create dummy cpufreq driver ANDROID: Allow DRM_IOCTL_MODE_*_DUMB for render clients. Cuttlefish Wifi: Add data ops in virt_wifi driver for scan data simulation ANDROID: of: property: Enable of_devlink by default ANDROID: of: property: Make sure child dependencies don't block probing of parent ANDROID: driver core: Allow fwnode_operations.add_links to differentiate errors ANDROID: driver core: Allow a device to wait on optional suppliers ANDROID: driver core: Add device link support for SYNC_STATE_ONLY flag FROMGIT: docs: driver-model: Add documentation for sync_state FROMGIT: driver: core: Improve documentation for fwnode_operations.add_links() FROMGIT: of: property: Minor code formatting/style clean ups ANDROID: of/property: Add device link support for iommus ANDROID: move up spin_unlock_bh() ahead of remove_proc_entry() BACKPORT: arm64: tags: Preserve tags for addresses translated via TTBR1 UPSTREAM: arm64: memory: Implement __tag_set() as common function UPSTREAM: arm64/mm: fix variable 'tag' set but not used UPSTREAM: arm64: avoid clang warning about self-assignment ANDROID: sdcardfs: evict dentries on fscrypt key removal ANDROID: fscrypt: add key removal notifier chain ANDROID: refactor build.config files to remove duplication ANDROID: Move from clang r353983c to r365631c ANDROID: gki_defconfig: remove PWRSEQ_EMMC and PWRSEQ_SIMPLE ANDROID: unconditionally compile sig_ok in struct module ANDROID: gki_defconfig: enable fs-verity UPSTREAM: mm: vmalloc: show number of vmalloc pages in /proc/meminfo BACKPORT: PM/sleep: Expose suspend stats in sysfs UPSTREAM: power: supply: Init device wakeup after device_add() UPSTREAM: PM / wakeup: Unexport wakeup_source_sysfs_{add,remove}() UPSTREAM: PM / wakeup: Register wakeup class kobj after device is added UPSTREAM: PM / wakeup: Fix sysfs registration error path UPSTREAM: PM / wakeup: Show wakeup sources stats in sysfs UPSTREAM: PM / wakeup: Use wakeup_source_register() in wakelock.c UPSTREAM: PM / wakeup: Drop wakeup_source_init(), wakeup_source_prepare() UPSTREAM: PM / wakeup: Drop wakeup_source_drop() UPSTREAM: PM / core: Add support to skip power management in device/driver model gki_defconfig: Enable CONFIG_DM_SNAPSHOT ANDROID: gki_defconfig: enable accelerated AES and SHA-256 ANDROID: fix overflow in /proc/uid_cputime/remove_uid_range ANDROID: kasan: fix has_attribute check on older GCC versions ANDROID: gki_defconfig: enable CONFIG_PARAVIRT and CONFIG_HYPERVISOR_GUEST ANDROID: gki_defconfig: enable CONFIG_NLS_* ANDROID: gki_defconfig: Enable BPF_JIT and BPF_JIT_ALWAYS_ON FROMGIT: of: property: Create device links for all child-supplier depencencies FROMGIT: of/platform: Pause/resume sync state during init and of_platform_populate() BACKPORT: FROMGIT: driver core: Add sync_state driver/bus callback BACKPORT: FROMGIT: of: property: Add functional dependency link from DT bindings FROMGIT: driver core: Add support for linking devices during device addition FROMGIT: driver core: Add fwnode_to_dev() to look up device from fwnode UPSTREAM: mm: untag user pointers in mmap/munmap/mremap/brk UPSTREAM: vfio/type1: untag user pointers in vaddr_get_pfn UPSTREAM: tee/shm: untag user pointers in tee_shm_register UPSTREAM: media/v4l2-core: untag user pointers in videobuf_dma_contig_user_get UPSTREAM: drm/radeon: untag user pointers in radeon_gem_userptr_ioctl BACKPORT: drm/amdgpu: untag user pointers UPSTREAM: userfaultfd: untag user pointers UPSTREAM: fs/namespace: untag user pointers in copy_mount_options UPSTREAM: mm: untag user pointers in get_vaddr_frames UPSTREAM: mm: untag user pointers in mm/gup.c UPSTREAM: mm: untag user pointers passed to memory syscalls BACKPORT: lib: untag user pointers in strn*_user UPSTREAM: arm64: Fix reference to docs for ARM64_TAGGED_ADDR_ABI UPSTREAM: selftests, arm64: add kernel headers path for tags_test BACKPORT: arm64: Relax Documentation/arm64/tagged-pointers.rst UPSTREAM: arm64: Define Documentation/arm64/tagged-address-abi.rst UPSTREAM: arm64: Change the tagged_addr sysctl control semantics to only prevent the opt-in UPSTREAM: arm64: Tighten the PR_{SET, GET}_TAGGED_ADDR_CTRL prctl() unused arguments UPSTREAM: selftests, arm64: fix uninitialized symbol in tags_test.c UPSTREAM: arm64: mm: Really fix sparse warning in untagged_addr() UPSTREAM: selftests, arm64: add a selftest for passing tagged pointers to kernel BACKPORT: arm64: Introduce prctl() options to control the tagged user addresses ABI UPSTREAM: arm64: untag user pointers in access_ok and __uaccess_mask_ptr UPSTREAM: uaccess: add noop untagged_addr definition BACKPORT: block: annotate refault stalls from IO submission f2fs: add a condition to detect overflow in f2fs_ioc_gc_range() f2fs: fix to add missing F2FS_IO_ALIGNED() condition f2fs: fix to fallback to buffered IO in IO aligned mode f2fs: fix to handle error path correctly in f2fs_map_blocks f2fs: fix extent corrupotion during directIO in LFS mode f2fs: check all the data segments against all node ones f2fs: Add a small clarification to CONFIG_FS_F2FS_FS_SECURITY f2fs: fix inode rwsem regression f2fs: fix to avoid accessing uninitialized field of inode page in is_alive() f2fs: avoid infinite GC loop due to stale atomic files f2fs: Fix indefinite loop in f2fs_gc() f2fs: convert inline_data in prior to i_size_write f2fs: fix error path of f2fs_convert_inline_page() f2fs: add missing documents of reserve_root/resuid/resgid f2fs: fix flushing node pages when checkpoint is disabled f2fs: enhance f2fs_is_checkpoint_ready()'s readability f2fs: clean up __bio_alloc()'s parameter f2fs: fix wrong error injection path in inc_valid_block_count() f2fs: fix to writeout dirty inode during node flush f2fs: optimize case-insensitive lookups f2fs: introduce f2fs_match_name() for cleanup f2fs: Fix indefinite loop in f2fs_gc() f2fs: allocate memory in batch in build_sit_info() f2fs: support FS_IOC_{GET,SET}FSLABEL f2fs: fix to avoid data corruption by forbidding SSR overwrite f2fs: Fix build error while CONFIG_NLS=m Revert "f2fs: avoid out-of-range memory access" f2fs: cleanup the code in build_sit_entries. f2fs: fix wrong available node count calculation f2fs: remove duplicate code in f2fs_file_write_iter f2fs: fix to migrate blocks correctly during defragment f2fs: use wrapped f2fs_cp_error() f2fs: fix to use more generic EOPNOTSUPP f2fs: use wrapped IS_SWAPFILE() f2fs: Support case-insensitive file name lookups f2fs: include charset encoding information in the superblock fs: Reserve flag for casefolding f2fs: fix to avoid call kvfree under spinlock fs: f2fs: Remove unnecessary checks of SM_I(sbi) in update_general_status() f2fs: disallow direct IO in atomic write f2fs: fix to handle quota_{on,off} correctly f2fs: fix to detect cp error in f2fs_setxattr() f2fs: fix to spread f2fs_is_checkpoint_ready() f2fs: support fiemap() for directory inode f2fs: fix to avoid discard command leak f2fs: fix to avoid tagging SBI_QUOTA_NEED_REPAIR incorrectly f2fs: fix to drop meta/node pages during umount f2fs: disallow switching io_bits option during remount f2fs: fix panic of IO alignment feature f2fs: introduce {page,io}_is_mergeable() for readability f2fs: fix livelock in swapfile writes f2fs: add fs-verity support ext4: update on-disk format documentation for fs-verity ext4: add fs-verity read support ext4: add basic fs-verity support fs-verity: support builtin file signatures fs-verity: add SHA-512 support fs-verity: implement FS_IOC_MEASURE_VERITY ioctl fs-verity: implement FS_IOC_ENABLE_VERITY ioctl fs-verity: add data verification hooks for ->readpages() fs-verity: add the hook for file ->setattr() fs-verity: add the hook for file ->open() fs-verity: add inode and superblock fields fs-verity: add Kconfig and the helper functions for hashing fs: uapi: define verity bit for FS_IOC_GETFLAGS fs-verity: add UAPI header fs-verity: add MAINTAINERS file entry fs-verity: add a documentation file ext4: fix kernel oops caused by spurious casefold flag ext4: fix coverity warning on error path of filename setup ext4: optimize case-insensitive lookups ext4: fix dcache lookup of !casefolded directories unicode: update to Unicode 12.1.0 final unicode: add missing check for an error return from utf8lookup() ext4: export /sys/fs/ext4/feature/casefold if Unicode support is present unicode: refactor the rule for regenerating utf8data.h ext4: Support case-insensitive file name lookups ext4: include charset encoding information in the superblock unicode: update unicode database unicode version 12.1.0 unicode: introduce test module for normalized utf8 implementation unicode: implement higher level API for string handling unicode: reduce the size of utf8data[] unicode: introduce code for UTF-8 normalization unicode: introduce UTF-8 character database ext4 crypto: fix to check feature status before get policy fscrypt: document the new ioctls and policy version ubifs: wire up new fscrypt ioctls f2fs: wire up new fscrypt ioctls ext4: wire up new fscrypt ioctls fscrypt: require that key be added when setting a v2 encryption policy fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS ioctl fscrypt: allow unprivileged users to add/remove keys for v2 policies fscrypt: v2 encryption policy support fscrypt: add an HKDF-SHA512 implementation fscrypt: add FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl fscrypt: rename keyinfo.c to keysetup.c fscrypt: move v1 policy key setup to keysetup_v1.c fscrypt: refactor key setup code in preparation for v2 policies fscrypt: rename fscrypt_master_key to fscrypt_direct_key fscrypt: add ->ci_inode to fscrypt_info fscrypt: use FSCRYPT_* definitions, not FS_* fscrypt: use FSCRYPT_ prefix for uapi constants fs, fscrypt: move uapi definitions to new header <linux/fscrypt.h> fscrypt: use ENOPKG when crypto API support missing fscrypt: improve warnings for missing crypto API support fscrypt: improve warning messages for unsupported encryption contexts fscrypt: make fscrypt_msg() take inode instead of super_block fscrypt: clean up base64 encoding/decoding fscrypt: remove loadable module related code Updated following files to fix build errors: drivers/gpu/msm/kgsl_pool.c drivers/hwtracing/coresight/coresight-dummy.c drivers/iommu/dma-mapping-fast.c drivers/iommu/io-pgtable-fast.c drivers/iommu/io-pgtable-msm-secure.c kernel/taskstats.c mm/vmalloc.c security/selinux/ss/sidtab.h Conflicts: arch/arm/Makefile arch/arm64/Kconfig arch/x86/include/asm/syscall_wrapper.h build.config.common drivers/clk/clk.c drivers/hwtracing/coresight/coresight-etm-perf.c drivers/hwtracing/coresight/coresight-funnel.c drivers/hwtracing/coresight/coresight-tmc-etf.c drivers/hwtracing/coresight/coresight-tmc-etr.c drivers/hwtracing/coresight/coresight-tmc.c drivers/hwtracing/coresight/coresight-tmc.h drivers/hwtracing/coresight/coresight.c drivers/hwtracing/coresight/of_coresight.c drivers/iommu/arm-smmu.c drivers/iommu/io-pgtable-arm.c drivers/iommu/io-pgtable.c drivers/scsi/scsi_sysfs.c drivers/scsi/sd.c drivers/scsi/ufs/ufshcd.c drivers/scsi/ufs/ufshcd.h drivers/staging/android/ion/ion.c drivers/staging/android/ion/ion.h drivers/staging/android/ion/ion_page_pool.c fs/ext4/readpage.c fs/f2fs/data.c fs/f2fs/f2fs.h fs/f2fs/file.c fs/f2fs/segment.c fs/f2fs/super.c include/linux/clk-provider.h include/linux/compiler_types.h include/linux/coresight.h include/linux/mmzone.h include/scsi/scsi_device.h include/trace/events/kmem.h kernel/events/core.c kernel/sched/core.c mm/vmstat.c Change-Id: I2eca52b08b484f2b5c30437671cab8cb0195b8d6 Signed-off-by: Ivaylo Georgiev <irgeorgiev@codeaurora.org>
1863 lines
63 KiB
Makefile
1863 lines
63 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
VERSION = 4
|
|
PATCHLEVEL = 19
|
|
SUBLEVEL = 95
|
|
EXTRAVERSION =
|
|
NAME = "People's Front"
|
|
|
|
# *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.
|
|
|
|
# That's our default target when none is given on the command line
|
|
PHONY := _all
|
|
_all:
|
|
|
|
# o Do not use make's built-in rules and variables
|
|
# (this increases performance and avoids hard-to-debug behaviour);
|
|
# o Look for make include files relative to root of kernel src
|
|
MAKEFLAGS += -rR --include-dir=$(CURDIR)
|
|
|
|
# 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
|
|
|
|
# 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.
|
|
|
|
# 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.
|
|
#
|
|
# 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
|
|
|
|
ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
|
|
quiet=silent_
|
|
tools_silent=s
|
|
endif
|
|
|
|
export quiet Q KBUILD_VERBOSE
|
|
|
|
# kbuild supports saving output files in a separate directory.
|
|
# To locate output files in a separate directory two syntaxes are supported.
|
|
# In both cases the working directory must be the root of the kernel src.
|
|
# 1) O=
|
|
# Use "make O=dir/to/store/output/files/"
|
|
#
|
|
# 2) Set KBUILD_OUTPUT
|
|
# Set the environment variable KBUILD_OUTPUT to point to the directory
|
|
# where the output files shall be placed.
|
|
# export KBUILD_OUTPUT=dir/to/store/output/files/
|
|
# make
|
|
#
|
|
# The O= assignment takes precedence over the KBUILD_OUTPUT environment
|
|
# variable.
|
|
|
|
# KBUILD_SRC is not intended to be used by the regular user (for now),
|
|
# it is set on invocation of make with KBUILD_OUTPUT or O= specified.
|
|
ifeq ($(KBUILD_SRC),)
|
|
|
|
# OK, Make called in directory where kernel src resides
|
|
# Do we want to locate output files in a separate directory?
|
|
ifeq ("$(origin O)", "command line")
|
|
KBUILD_OUTPUT := $(O)
|
|
endif
|
|
|
|
# Cancel implicit rules on top Makefile
|
|
$(CURDIR)/Makefile Makefile: ;
|
|
|
|
ifneq ($(words $(subst :, ,$(CURDIR))), 1)
|
|
$(error main directory cannot contain spaces nor colons)
|
|
endif
|
|
|
|
ifneq ($(KBUILD_OUTPUT),)
|
|
# check that the output directory actually exists
|
|
saved-output := $(KBUILD_OUTPUT)
|
|
KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
|
|
&& pwd)
|
|
$(if $(KBUILD_OUTPUT),, \
|
|
$(error failed to create output directory "$(saved-output)"))
|
|
|
|
PHONY += $(MAKECMDGOALS) sub-make
|
|
|
|
$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
|
|
@:
|
|
|
|
# Invoke a second make in the output directory, passing relevant variables
|
|
sub-make:
|
|
$(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
|
|
-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
|
|
|
|
# Leave processing to above invocation of make
|
|
skip-makefile := 1
|
|
endif # ifneq ($(KBUILD_OUTPUT),)
|
|
endif # ifeq ($(KBUILD_SRC),)
|
|
|
|
# We process the rest of the Makefile if this is the final invocation of make
|
|
ifeq ($(skip-makefile),)
|
|
|
|
# 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 to specify directory of external module to build
|
|
# Old syntax make ... SUBDIRS=$PWD is still supported
|
|
# Setting the environment variable KBUILD_EXTMOD take precedence
|
|
ifdef SUBDIRS
|
|
KBUILD_EXTMOD ?= $(SUBDIRS)
|
|
endif
|
|
|
|
ifeq ("$(origin M)", "command line")
|
|
KBUILD_EXTMOD := $(M)
|
|
endif
|
|
|
|
ifeq ($(KBUILD_SRC),)
|
|
# building in the source tree
|
|
srctree := .
|
|
else
|
|
ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
|
|
# building in a subdirectory of the source tree
|
|
srctree := ..
|
|
else
|
|
srctree := $(KBUILD_SRC)
|
|
endif
|
|
endif
|
|
|
|
export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC
|
|
|
|
objtree := .
|
|
src := $(srctree)
|
|
obj := $(objtree)
|
|
|
|
VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
|
|
|
|
export 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_% archheaders archscripts \
|
|
%asm-generic kernelversion %src-pkg
|
|
no-sync-config-targets := $(no-dot-config-targets) install %install \
|
|
kernelrelease
|
|
|
|
config-targets := 0
|
|
mixed-targets := 0
|
|
dot-config := 1
|
|
may-sync-config := 1
|
|
|
|
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
|
dot-config := 0
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
|
|
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
|
|
may-sync-config := 0
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(KBUILD_EXTMOD),)
|
|
may-sync-config := 0
|
|
endif
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
ifneq ($(filter config %config,$(MAKECMDGOALS)),)
|
|
config-targets := 1
|
|
ifneq ($(words $(MAKECMDGOALS)),1)
|
|
mixed-targets := 1
|
|
endif
|
|
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-targets := 1
|
|
endif
|
|
endif
|
|
|
|
# install and modules_install need also be processed one by one
|
|
ifneq ($(filter install,$(MAKECMDGOALS)),)
|
|
ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
|
|
mixed-targets := 1
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(mixed-targets),1)
|
|
# ===========================================================================
|
|
# We're called with mixed targets (*config and build targets).
|
|
# Handle them one by one.
|
|
|
|
PHONY += $(MAKECMDGOALS) __build_one_by_one
|
|
|
|
$(filter-out __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
|
|
|
|
# We need some generic definitions (do not try to remake the file).
|
|
scripts/Kbuild.include: ;
|
|
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
|
|
|
|
# SHELL used by kbuild
|
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
|
else echo sh; fi ; fi)
|
|
|
|
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)
|
|
|
|
HOSTCC = gcc
|
|
HOSTCXX = g++
|
|
KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
|
|
-fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
|
|
$(HOSTCFLAGS)
|
|
KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
|
|
KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
|
|
KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
|
|
|
|
# Make variables (CC, etc...)
|
|
AS = $(CROSS_COMPILE)as
|
|
LD = $(CROSS_COMPILE)ld
|
|
REAL_CC = $(CROSS_COMPILE)gcc
|
|
CPP = $(CC) -E
|
|
AR = $(CROSS_COMPILE)ar
|
|
NM = $(CROSS_COMPILE)nm
|
|
STRIP = $(CROSS_COMPILE)strip
|
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
|
LEX = flex
|
|
YACC = bison
|
|
AWK = awk
|
|
GENKSYMS = scripts/genksyms/genksyms
|
|
INSTALLKERNEL := installkernel
|
|
DEPMOD = /sbin/depmod
|
|
PERL = perl
|
|
PYTHON = python
|
|
PYTHON2 = python2
|
|
PYTHON3 = python3
|
|
CHECK = sparse
|
|
|
|
# Use the wrapper for the compiler. This wrapper scans for new
|
|
# warnings and causes the build to stop upon encountering them
|
|
CC = $(PYTHON) $(srctree)/scripts/gcc-wrapper.py $(REAL_CC)
|
|
|
|
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 $(KBUILD_SRC), -I$(srctree)/include) \
|
|
-I$(objtree)/include \
|
|
$(USERINCLUDE)
|
|
|
|
KBUILD_AFLAGS := -D__ASSEMBLY__
|
|
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
|
-fno-strict-aliasing -fno-common -fshort-wchar \
|
|
-Werror-implicit-function-declaration \
|
|
-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 := -T $(srctree)/scripts/module-common.lds
|
|
KBUILD_LDFLAGS :=
|
|
GCC_PLUGINS_CFLAGS :=
|
|
CLANG_FLAGS :=
|
|
|
|
export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
|
|
export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
|
|
export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
|
|
export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
|
|
|
|
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
|
|
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
|
|
export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
|
|
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 KBUILD_ARFLAGS
|
|
|
|
# When compiling out-of-tree modules, put MODVERDIR in the module
|
|
# tree rather than in the kernel tree. The kernel tree might
|
|
# even be read-only.
|
|
export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
|
|
|
|
# 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
|
|
|
|
# To avoid any implicit rule to kick in, define an empty command.
|
|
scripts/basic/%: scripts_basic ;
|
|
|
|
PHONY += outputmakefile
|
|
# outputmakefile generates a Makefile in the output directory, if using a
|
|
# separate output directory. This allows convenient use of make in the
|
|
# output directory.
|
|
outputmakefile:
|
|
ifneq ($(KBUILD_SRC),)
|
|
$(Q)ln -fsn $(srctree) source
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
|
|
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
|
|
endif
|
|
|
|
ifeq ($(cc-name),clang)
|
|
ifneq ($(CROSS_COMPILE),)
|
|
CLANG_TRIPLE ?= $(CROSS_COMPILE)
|
|
CLANG_FLAGS += --target=$(notdir $(CLANG_TRIPLE:%-=%))
|
|
ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_FLAGS)), y)
|
|
$(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?")
|
|
endif
|
|
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
|
|
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
|
|
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
|
|
endif
|
|
ifneq ($(GCC_TOOLCHAIN),)
|
|
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
|
|
endif
|
|
CLANG_FLAGS += -no-integrated-as
|
|
CLANG_FLAGS += $(call cc-option, -Wno-misleading-indentation)
|
|
CLANG_FLAGS += $(call cc-option, -Wno-bool-operation)
|
|
CLANG_FLAGS += -Werror=unknown-warning-option
|
|
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
|
KBUILD_AFLAGS += $(CLANG_FLAGS)
|
|
export CLANG_FLAGS
|
|
endif
|
|
|
|
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
|
|
RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register
|
|
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
|
|
RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline
|
|
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
|
|
RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_VDSO_CFLAGS_CLANG)))
|
|
export RETPOLINE_CFLAGS
|
|
export RETPOLINE_VDSO_CFLAGS
|
|
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
|
|
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
|
|
|
|
# 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 | head -n 1)
|
|
|
|
ifeq ($(config-targets),1)
|
|
# ===========================================================================
|
|
# *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: scripts_basic outputmakefile FORCE
|
|
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
|
|
|
%config: scripts_basic outputmakefile FORCE
|
|
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
|
|
|
else
|
|
# ===========================================================================
|
|
# 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.
|
|
# 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.
|
|
|
|
ifeq ($(MAKECMDGOALS),modules)
|
|
KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
|
|
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 _all modules,$(MAKECMDGOALS)),)
|
|
KBUILD_MODULES := 1
|
|
endif
|
|
|
|
ifeq ($(MAKECMDGOALS),)
|
|
KBUILD_MODULES := 1
|
|
endif
|
|
|
|
export KBUILD_MODULES KBUILD_BUILTIN
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
# Objects we will link into vmlinux / subdirs we need to visit
|
|
init-y := init/
|
|
drivers-y := drivers/ sound/ firmware/ techpack/
|
|
net-y := net/
|
|
libs-y := lib/
|
|
core-y := usr/
|
|
virt-y := virt/
|
|
endif # KBUILD_EXTMOD
|
|
|
|
ifeq ($(dot-config),1)
|
|
include include/config/auto.conf
|
|
endif
|
|
|
|
# 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
|
|
|
|
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
|
|
|
|
# Make toolchain changes before including arch/$(SRCARCH)/Makefile to ensure
|
|
# ar/cc/ld-* macros return correct values.
|
|
ifdef CONFIG_LTO_CLANG
|
|
# use llvm-ar for building symbol tables from IR files, and llvm-nm instead
|
|
# of objdump for processing symbol versions and exports
|
|
LLVM_AR := llvm-ar
|
|
LLVM_NM := llvm-nm
|
|
export LLVM_AR LLVM_NM
|
|
endif
|
|
|
|
# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
|
|
# values of the respective KBUILD_* variables
|
|
ARCH_CPPFLAGS :=
|
|
ARCH_AFLAGS :=
|
|
ARCH_CFLAGS :=
|
|
include arch/$(SRCARCH)/Makefile
|
|
|
|
ifeq ($(dot-config),1)
|
|
ifeq ($(may-sync-config),1)
|
|
# 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
|
|
|
|
# To avoid any implicit rule to kick in, define an empty command
|
|
$(KCONFIG_CONFIG): ;
|
|
|
|
# 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.
|
|
%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
|
|
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
|
|
else
|
|
# 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 # $(dot-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, int-in-bool-context)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
|
|
|
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
|
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
|
|
else
|
|
ifdef CONFIG_PROFILE_ALL_BRANCHES
|
|
KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
|
|
else
|
|
KBUILD_CFLAGS += -O2
|
|
endif
|
|
endif
|
|
|
|
KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
|
|
$(call cc-disable-warning,maybe-uninitialized,))
|
|
|
|
# Tell gcc to never replace conditional load with a non-conditional one
|
|
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
|
|
|
# check for 'asm goto'
|
|
ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
|
|
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
|
|
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
|
endif
|
|
|
|
include scripts/Makefile.kcov
|
|
include scripts/Makefile.gcc-plugins
|
|
|
|
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 += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
|
|
endif
|
|
|
|
stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector
|
|
stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector
|
|
stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
|
|
|
|
KBUILD_CFLAGS += $(stackp-flags-y)
|
|
|
|
ifeq ($(cc-name),clang)
|
|
ifneq ($(CROSS_COMPILE),)
|
|
CLANG_TRIPLE ?= $(CROSS_COMPILE)
|
|
CLANG_TARGET := --target=$(notdir $(CLANG_TRIPLE:%-=%))
|
|
GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
|
|
endif
|
|
ifneq ($(GCC_TOOLCHAIN),)
|
|
CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN)
|
|
endif
|
|
KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) -meabi gnu
|
|
KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
|
|
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, duplicate-decl-specifier)
|
|
KBUILD_CFLAGS += -Wno-asm-operand-widths
|
|
KBUILD_CFLAGS += -Wno-initializer-overrides
|
|
KBUILD_CFLAGS += -fno-builtin
|
|
KBUILD_CFLAGS += $(call cc-option, -Wno-undefined-optimized)
|
|
KBUILD_CFLAGS += $(call cc-option, -Wno-tautological-constant-out-of-range-compare)
|
|
KBUILD_CFLAGS += $(call cc-option, -mllvm -disable-struct-const-merge)
|
|
|
|
# Quiet clang warning: comparison of unsigned expression < 0 is always false
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
|
|
# 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 += $(call cc-option, -mno-global-merge,)
|
|
KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
|
|
else
|
|
|
|
# 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)
|
|
endif
|
|
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
|
|
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 pattern, if desired.
|
|
ifdef CONFIG_INIT_STACK_ALL
|
|
KBUILD_CFLAGS += -ftrivial-auto-var-init=pattern
|
|
endif
|
|
|
|
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
|
|
|
|
KBUILD_CFLAGS += $(call cc-option, -Wvla)
|
|
|
|
ifdef CONFIG_DEBUG_INFO
|
|
ifdef CONFIG_DEBUG_INFO_SPLIT
|
|
KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g)
|
|
else
|
|
KBUILD_CFLAGS += -g
|
|
endif
|
|
KBUILD_AFLAGS += -Wa,-gdwarf-2
|
|
endif
|
|
ifdef CONFIG_DEBUG_INFO_DWARF4
|
|
KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,)
|
|
endif
|
|
|
|
ifdef CONFIG_DEBUG_INFO_REDUCED
|
|
KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
|
|
$(call cc-option,-fno-var-tracking)
|
|
endif
|
|
|
|
ifdef CONFIG_FUNCTION_TRACER
|
|
ifdef CONFIG_FTRACE_MCOUNT_RECORD
|
|
# gcc 5 supports generating the mcount tables directly
|
|
ifeq ($(call cc-option-yn,-mrecord-mcount),y)
|
|
CC_FLAGS_FTRACE += -mrecord-mcount
|
|
export CC_USING_RECORD_MCOUNT := 1
|
|
endif
|
|
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_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)
|
|
ifdef CONFIG_DYNAMIC_FTRACE
|
|
ifdef CONFIG_HAVE_C_RECORDMCOUNT
|
|
BUILD_C_RECORDMCOUNT := y
|
|
export BUILD_C_RECORDMCOUNT
|
|
endif
|
|
endif
|
|
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_LTO_CLANG
|
|
ifdef CONFIG_THINLTO
|
|
lto-clang-flags := -flto=thin
|
|
KBUILD_LDFLAGS += --thinlto-cache-dir=.thinlto-cache
|
|
else
|
|
lto-clang-flags := -flto
|
|
endif
|
|
lto-clang-flags += -fvisibility=default $(call cc-option, -fsplit-lto-unit)
|
|
|
|
# Limit inlining across translation units to reduce binary size
|
|
LD_FLAGS_LTO_CLANG := -mllvm -import-instr-limit=5
|
|
|
|
KBUILD_LDFLAGS += $(LD_FLAGS_LTO_CLANG)
|
|
KBUILD_LDFLAGS_MODULE += $(LD_FLAGS_LTO_CLANG)
|
|
|
|
KBUILD_LDS_MODULE += $(srctree)/scripts/module-lto.lds
|
|
|
|
# allow disabling only clang LTO where needed
|
|
DISABLE_LTO_CLANG := -fno-lto
|
|
export DISABLE_LTO_CLANG
|
|
endif
|
|
|
|
ifdef CONFIG_LTO
|
|
LTO_CFLAGS := $(lto-clang-flags)
|
|
KBUILD_CFLAGS += $(LTO_CFLAGS)
|
|
|
|
DISABLE_LTO := $(DISABLE_LTO_CLANG)
|
|
export LTO_CFLAGS DISABLE_LTO
|
|
endif
|
|
|
|
ifdef CONFIG_CFI_CLANG
|
|
cfi-clang-flags += -fsanitize=cfi -fno-sanitize-cfi-canonical-jump-tables
|
|
DISABLE_CFI_CLANG := -fno-sanitize=cfi
|
|
ifdef CONFIG_MODULES
|
|
cfi-clang-flags += -fsanitize-cfi-cross-dso
|
|
DISABLE_CFI_CLANG += -fno-sanitize-cfi-cross-dso
|
|
endif
|
|
ifdef CONFIG_CFI_PERMISSIVE
|
|
cfi-clang-flags += -fsanitize-recover=cfi -fno-sanitize-trap=cfi
|
|
endif
|
|
|
|
# also disable CFI when LTO is disabled
|
|
DISABLE_LTO_CLANG += $(DISABLE_CFI_CLANG)
|
|
# allow disabling only clang CFI where needed
|
|
export DISABLE_CFI_CLANG
|
|
endif
|
|
|
|
ifdef CONFIG_CFI
|
|
CFI_CFLAGS := $(cfi-clang-flags)
|
|
KBUILD_CFLAGS += $(CFI_CFLAGS)
|
|
|
|
DISABLE_CFI := $(DISABLE_CFI_CLANG)
|
|
DISABLE_LTO += $(DISABLE_CFI)
|
|
export CFI_CFLAGS DISABLE_CFI
|
|
endif
|
|
|
|
ifdef CONFIG_SHADOW_CALL_STACK
|
|
CC_FLAGS_SCS := -fsanitize=shadow-call-stack
|
|
KBUILD_CFLAGS += $(CC_FLAGS_SCS)
|
|
export CC_FLAGS_SCS
|
|
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 += $(call cc-option,-Wdeclaration-after-statement,)
|
|
|
|
# disable pointer signed / unsigned warnings in gcc 4.0
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
|
|
|
|
# disable stringop warnings in gcc 8+
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
|
|
|
|
# disable invalid "can't wrap" optimizations for signed / pointers
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
|
|
|
|
# clang sets -fmerge-all-constants by default as optimization, but this
|
|
# is non-conforming behavior for C and in fact breaks the kernel, so we
|
|
# need to disable it here generally.
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
|
|
|
|
# for gcc -fno-merge-all-constants disables everything, but it is fine
|
|
# to have actual conforming behavior enabled.
|
|
KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
|
|
|
|
# Make sure -fstack-check isn't enabled (like gentoo apparently did)
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
|
|
|
|
# conserve stack if available
|
|
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
|
|
|
|
# disallow errors like 'EXPORT_GPL(foo);' with missing header
|
|
KBUILD_CFLAGS += $(call cc-option,-Werror=implicit-int)
|
|
|
|
# require functions to have arguments in prototypes, not empty 'int foo()'
|
|
KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes)
|
|
|
|
# Prohibit date/time macros, which would make the build non-deterministic
|
|
KBUILD_CFLAGS += $(call cc-option,-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_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
|
|
|
|
# ensure -fcf-protection is disabled when using retpoline as it is
|
|
# incompatible with -mindirect-branch=thunk-extern
|
|
ifdef CONFIG_RETPOLINE
|
|
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
|
|
endif
|
|
|
|
# use the deterministic mode of AR if available
|
|
KBUILD_ARFLAGS := $(call ar-option,D)
|
|
|
|
include scripts/Makefile.kasan
|
|
include scripts/Makefile.extrawarn
|
|
include scripts/Makefile.ubsan
|
|
|
|
# Add any arch overrides and user supplied CPPFLAGS, AFLAGS and CFLAGS as the
|
|
# last assignments
|
|
KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS)
|
|
KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS)
|
|
KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS)
|
|
|
|
# Use --build-id when available.
|
|
LDFLAGS_BUILD_ID := $(call ld-option, --build-id)
|
|
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
|
|
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
|
|
|
|
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
|
|
LDFLAGS_vmlinux += $(call ld-option, -X,)
|
|
endif
|
|
|
|
ifeq ($(CONFIG_RELR),y)
|
|
LDFLAGS_vmlinux += --pack-dyn-relocs=relr
|
|
endif
|
|
|
|
# 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 = gzip -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
|
|
|
|
# Select initial ramdisk compression format, default is gzip(1).
|
|
# This shall be used by the dracut(8) tool while creating an initramfs image.
|
|
#
|
|
INITRD_COMPRESS-y := gzip
|
|
INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
|
|
INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma
|
|
INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz
|
|
INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo
|
|
INITRD_COMPRESS-$(CONFIG_RD_LZ4) := lz4
|
|
# do not export INITRD_COMPRESS, since we didn't actually
|
|
# choose a sane default compression above.
|
|
# export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
|
|
|
|
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)
|
|
|
|
ifdef CONFIG_STACK_VALIDATION
|
|
has_libelf := $(call try-run,\
|
|
echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
|
|
ifeq ($(has_libelf),1)
|
|
objtool_target := tools/objtool FORCE
|
|
else
|
|
SKIP_STACK_VALIDATION := 1
|
|
export SKIP_STACK_VALIDATION
|
|
endif
|
|
endif
|
|
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
|
|
|
|
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
|
|
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
|
|
$(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
|
|
|
|
vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
|
|
$(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
|
|
|
|
init-y := $(patsubst %/, %/built-in.a, $(init-y))
|
|
core-y := $(patsubst %/, %/built-in.a, $(core-y))
|
|
drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y))
|
|
net-y := $(patsubst %/, %/built-in.a, $(net-y))
|
|
libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
|
|
libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
|
|
virt-y := $(patsubst %/, %/built-in.a, $(virt-y))
|
|
|
|
# Externally visible symbols (used by link-vmlinux.sh)
|
|
export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
|
|
export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y)
|
|
export KBUILD_VMLINUX_LIBS := $(libs-y1)
|
|
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
|
|
export LDFLAGS_vmlinux
|
|
# used by scripts/package/Makefile
|
|
export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
|
|
|
|
vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
|
|
|
|
# Recurse until adjust_autoksyms.sh is satisfied
|
|
PHONY += autoksyms_recursive
|
|
autoksyms_recursive: $(vmlinux-deps)
|
|
ifdef CONFIG_TRIM_UNUSED_KSYMS
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
|
|
"$(MAKE) -f $(srctree)/Makefile vmlinux"
|
|
endif
|
|
|
|
# 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)
|
|
ifdef CONFIG_TRIM_UNUSED_KSYMS
|
|
KBUILD_MODULES := 1
|
|
endif
|
|
|
|
autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
|
|
|
|
$(autoksyms_h):
|
|
$(Q)mkdir -p $(dir $@)
|
|
$(Q)touch $@
|
|
|
|
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)
|
|
|
|
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
|
|
ifdef CONFIG_HEADERS_CHECK
|
|
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
|
|
endif
|
|
ifdef CONFIG_GDB_SCRIPTS
|
|
$(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
|
|
endif
|
|
+$(call if_changed,link-vmlinux)
|
|
|
|
# Build samples along the rest of the kernel. This needs headers_install.
|
|
ifdef CONFIG_SAMPLES
|
|
vmlinux-dirs += samples
|
|
samples: headers_install
|
|
endif
|
|
|
|
# The actual objects are generated when descending,
|
|
# make sure no implicit rule kicks in
|
|
$(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
|
|
|
|
# Handle descending into subdirectories listed in $(vmlinux-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 += $(vmlinux-dirs)
|
|
$(vmlinux-dirs): prepare scripts
|
|
$(Q)$(MAKE) $(build)=$@ need-builtin=1
|
|
|
|
define filechk_kernel.release
|
|
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
|
endef
|
|
|
|
# Store (new) KERNELRELEASE string in include/config/kernel.release
|
|
include/config/kernel.release: $(srctree)/Makefile 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 asm-generic gcc-plugins $(autoksyms_h)
|
|
$(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.
|
|
|
|
# Listed in dependency order
|
|
PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
|
|
|
|
# prepare3 is used to check if we are building in a separate output directory,
|
|
# and if so do:
|
|
# 1) Check that make has not been executed in the kernel src $(srctree)
|
|
prepare3: include/config/kernel.release
|
|
ifneq ($(KBUILD_SRC),)
|
|
@$(kecho) ' Using $(srctree) as source for kernel'
|
|
$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
|
|
echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
|
|
echo >&2 " in the '$(srctree)' directory.";\
|
|
/bin/false; \
|
|
fi;
|
|
endif
|
|
|
|
# prepare2 creates a makefile if using a separate output directory.
|
|
# From this point forward, .config has been reprocessed, so any rules
|
|
# that need to depend on updated CONFIG_* values can be checked here.
|
|
prepare2: prepare3 outputmakefile asm-generic
|
|
|
|
prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
|
|
$(cmd_crmodverdir)
|
|
|
|
archprepare: archheaders archscripts prepare1 scripts_basic
|
|
|
|
prepare0: archprepare gcc-plugins
|
|
$(Q)$(MAKE) $(build)=.
|
|
|
|
# All the preparing..
|
|
prepare: prepare0 prepare-objtool
|
|
|
|
# Support for using generic headers in asm-generic
|
|
PHONY += asm-generic uapi-asm-generic
|
|
asm-generic: uapi-asm-generic
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
|
src=asm obj=arch/$(SRCARCH)/include/generated/asm
|
|
uapi-asm-generic:
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
|
src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
|
|
|
|
PHONY += prepare-objtool
|
|
prepare-objtool: $(objtool_target)
|
|
ifeq ($(SKIP_STACK_VALIDATION),1)
|
|
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
|
|
|
|
ifdef cfi-flags
|
|
ifeq ($(call cc-option, $(cfi-flags)),)
|
|
@echo Cannot use CONFIG_CFI: $(cfi-flags) not supported by compiler >&2 && exit 1
|
|
endif
|
|
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
|
|
define filechk_utsrelease.h
|
|
if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
|
|
echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
|
|
exit 1; \
|
|
fi; \
|
|
(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
|
|
endef
|
|
|
|
define filechk_version.h
|
|
(echo \#define LINUX_VERSION_CODE $(shell \
|
|
expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
|
|
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
|
|
endef
|
|
|
|
$(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
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Kernel headers
|
|
|
|
#Default location for installed headers
|
|
export INSTALL_HDR_PATH = $(objtree)/usr
|
|
|
|
# If we do an all arch process set dst to include/arch-$(SRCARCH)
|
|
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include)
|
|
|
|
PHONY += archheaders
|
|
archheaders:
|
|
|
|
PHONY += archscripts
|
|
archscripts:
|
|
|
|
PHONY += __headers
|
|
__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
|
|
$(Q)$(MAKE) $(build)=scripts build_unifdef
|
|
|
|
PHONY += headers_install_all
|
|
headers_install_all:
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
|
|
|
|
PHONY += headers_install
|
|
headers_install: __headers
|
|
$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
|
|
$(error Headers not exportable for the $(SRCARCH) architecture))
|
|
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
|
|
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst)
|
|
$(Q)$(MAKE) $(hdr-inst)=techpack
|
|
|
|
PHONY += headers_check_all
|
|
headers_check_all: headers_install_all
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
|
|
|
|
PHONY += headers_check
|
|
headers_check: headers_install
|
|
$(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
|
|
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1
|
|
$(Q)$(MAKE) $(hdr-inst)=techpack HDRCHECK=1
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Kernel selftest
|
|
|
|
PHONY += kselftest
|
|
kselftest:
|
|
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
|
|
|
|
PHONY += kselftest-clean
|
|
kselftest-clean:
|
|
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean
|
|
|
|
PHONY += kselftest-merge
|
|
kselftest-merge:
|
|
$(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
|
|
-m $(objtree)/.config \
|
|
$(srctree)/tools/testing/selftests/*/config
|
|
+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Modules
|
|
|
|
ifdef CONFIG_MODULES
|
|
|
|
# By default, build modules as well
|
|
|
|
all: modules
|
|
|
|
# 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
|
|
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
|
|
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
|
|
@$(kecho) ' Building modules, stage 2.';
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
|
|
modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
|
|
$(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
|
|
|
|
%/modules.builtin: include/config/auto.conf include/config/tristate.conf
|
|
$(Q)$(MAKE) $(modbuiltin)=$*
|
|
|
|
|
|
# Target to prepare building external modules
|
|
PHONY += modules_prepare
|
|
modules_prepare: prepare scripts
|
|
|
|
# Target to install modules
|
|
PHONY += modules_install
|
|
modules_install: _modinst_ _modinst_post
|
|
|
|
PHONY += _modinst_
|
|
_modinst_:
|
|
@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
|
|
@cp -f $(objtree)/modules.order $(MODLIB)/
|
|
@cp -f $(objtree)/modules.builtin $(MODLIB)/
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
|
|
|
# This depmod is only for convenience to give the initial
|
|
# boot a modules.dep even before / is mounted read-write. However the
|
|
# boot script depmod is the master version.
|
|
PHONY += _modinst_post
|
|
_modinst_post: _modinst_
|
|
$(call cmd,depmod)
|
|
|
|
ifeq ($(CONFIG_MODULE_SIG), y)
|
|
PHONY += modules_sign
|
|
modules_sign:
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
|
|
endif
|
|
|
|
else # CONFIG_MODULES
|
|
|
|
# Modules not configured
|
|
# ---------------------------------------------------------------------------
|
|
|
|
PHONY += modules modules_install
|
|
modules modules_install:
|
|
@echo >&2
|
|
@echo >&2 "The present kernel configuration has modules disabled."
|
|
@echo >&2 "Type 'make config' and enable loadable module support."
|
|
@echo >&2 "Then build a kernel with module support enabled."
|
|
@echo >&2
|
|
@exit 1
|
|
|
|
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_DIRS += $(MODVERDIR) include/ksym
|
|
|
|
# Directories & files removed with 'make mrproper'
|
|
MRPROPER_DIRS += include/config usr/include include/generated \
|
|
arch/*/include/generated .tmp_objdiff
|
|
MRPROPER_FILES += .config .config.old .version \
|
|
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
|
|
signing_key.pem signing_key.priv signing_key.x509 \
|
|
x509.genkey extra_certificates signing_key.x509.keyid \
|
|
signing_key.x509.signer vmlinux-gdb.py
|
|
|
|
# clean - Delete most, but leave enough to build external modules
|
|
#
|
|
clean: rm-dirs := $(CLEAN_DIRS)
|
|
clean: rm-files := $(CLEAN_FILES)
|
|
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples)
|
|
|
|
PHONY += $(clean-dirs) clean archclean vmlinuxclean
|
|
$(clean-dirs):
|
|
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
|
|
|
vmlinuxclean:
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
|
|
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
|
|
|
|
clean: archclean vmlinuxclean
|
|
|
|
# mrproper - Delete all generated files, including .config
|
|
#
|
|
mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
|
|
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
|
|
mrproper-dirs := $(addprefix _mrproper_,scripts)
|
|
|
|
PHONY += $(mrproper-dirs) mrproper archmrproper
|
|
$(mrproper-dirs):
|
|
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
|
|
|
|
mrproper: clean archmrproper $(mrproper-dirs)
|
|
$(call cmd,rmdirs)
|
|
$(call cmd,rmfiles)
|
|
|
|
# distclean
|
|
#
|
|
PHONY += distclean
|
|
|
|
distclean: mrproper
|
|
@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
|
|
# ---------------------------------------------------------------------------
|
|
package-dir := scripts/package
|
|
|
|
%src-pkg: FORCE
|
|
$(Q)$(MAKE) $(build)=$(package-dir) $@
|
|
%pkg: include/config/kernel.release FORCE
|
|
$(Q)$(MAKE) $(build)=$(package-dir) $@
|
|
|
|
|
|
# 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 ' namespacecheck - Name space analysis on compiled kernel'
|
|
@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 ' headers_check - Sanity check on exported headers'
|
|
@echo ' headerdep - Detect inclusion cycles in headers'
|
|
@echo ' coccicheck - Check with Coccinelle'
|
|
@echo ''
|
|
@echo 'Kernel selftest:'
|
|
@echo ' kselftest - Build and run kernel selftest (run as root)'
|
|
@echo ' Build, install, and boot kernel before'
|
|
@echo ' running kselftest on it'
|
|
@echo ' kselftest-clean - Remove all generated kselftest files'
|
|
@echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing'
|
|
@echo ' .config.'
|
|
@echo ''
|
|
@echo 'Userspace tools targets:'
|
|
@echo ' use "make tools/help"'
|
|
@echo ' or "cd tools; make help"'
|
|
@echo ''
|
|
@echo 'Kernel packaging:'
|
|
@$(MAKE) $(build)=$(package-dir) 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 " %-24s - 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 (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 gcc 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): scripts_basic FORCE
|
|
$(Q)$(MAKE) $(build)=Documentation $@
|
|
|
|
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 modules
|
|
KBUILD_MODULES := 1
|
|
|
|
PHONY += $(objtree)/Module.symvers
|
|
$(objtree)/Module.symvers:
|
|
@test -e $(objtree)/Module.symvers || ( \
|
|
echo; \
|
|
echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \
|
|
echo " is missing; modules will have no dependencies and modversions."; \
|
|
echo )
|
|
|
|
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
|
|
PHONY += $(module-dirs) modules
|
|
$(module-dirs): prepare $(objtree)/Module.symvers
|
|
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
|
|
|
|
modules: $(module-dirs)
|
|
@$(kecho) ' Building modules, stage 2.';
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
|
|
PHONY += modules_install
|
|
modules_install: _emodinst_ _emodinst_post
|
|
|
|
install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
|
|
PHONY += _emodinst_
|
|
_emodinst_:
|
|
$(Q)mkdir -p $(MODLIB)/$(install-dir)
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
|
|
|
PHONY += _emodinst_post
|
|
_emodinst_post: _emodinst_
|
|
$(call cmd,depmod)
|
|
|
|
clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
|
|
|
|
PHONY += $(clean-dirs) clean
|
|
$(clean-dirs):
|
|
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
|
|
|
clean: rm-dirs := $(MODVERDIR)
|
|
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
|
|
|
|
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 ' clean - remove generated files in module directory only'
|
|
@echo ''
|
|
|
|
# Dummies...
|
|
PHONY += prepare scripts
|
|
prepare:
|
|
$(cmd_crmodverdir)
|
|
scripts: ;
|
|
endif # KBUILD_EXTMOD
|
|
|
|
clean: $(clean-dirs)
|
|
$(call cmd,rmdirs)
|
|
$(call cmd,rmfiles)
|
|
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
|
|
\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
|
|
-o -name '*.ko.*' -o -name '*.dtb' -o -name '*.dtb.S' \
|
|
-o -name '*.dwo' -o -name '*.lst' \
|
|
-o -name '*.su' \
|
|
-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 modules.builtin -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 = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@
|
|
|
|
tags TAGS cscope gtags: FORCE
|
|
$(call cmd,tags)
|
|
|
|
# Scripts to check various things for consistency
|
|
# ---------------------------------------------------------------------------
|
|
|
|
PHONY += includecheck versioncheck coccicheck namespacecheck 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)$(CONFIG_SHELL) $(srctree)/scripts/$@
|
|
|
|
namespacecheck:
|
|
$(PERL) $(srctree)/scripts/namespace.pl
|
|
|
|
export_report:
|
|
$(PERL) $(srctree)/scripts/export_report.pl
|
|
|
|
endif #ifeq ($(config-targets),1)
|
|
endif #ifeq ($(mixed-targets),1)
|
|
|
|
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) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
|
|
|
|
kernelrelease:
|
|
@echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
|
|
|
kernelversion:
|
|
@echo $(KERNELVERSION)
|
|
|
|
image_name:
|
|
@echo $(KBUILD_IMAGE)
|
|
|
|
# Clear a bunch of variables before executing the submake
|
|
tools/: FORCE
|
|
$(Q)mkdir -p $(objtree)/tools
|
|
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/
|
|
|
|
tools/%: FORCE
|
|
$(Q)mkdir -p $(objtree)/tools
|
|
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ $*
|
|
|
|
# Single targets
|
|
# ---------------------------------------------------------------------------
|
|
# Single targets are compatible with:
|
|
# - build with mixed source and output
|
|
# - build with separate output dir 'make O=...'
|
|
# - external modules
|
|
#
|
|
# target-dir => where to store outputfile
|
|
# build-dir => directory in kernel source tree to use
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
build-dir = $(patsubst %/,%,$(dir $@))
|
|
target-dir = $(dir $@)
|
|
else
|
|
zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
|
|
build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
|
|
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
|
|
endif
|
|
|
|
%.s: %.c prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.i: %.c prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.o: %.c prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.lst: %.c prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.s: %.S prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.o: %.S prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.symtypes: %.c prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
%.ll: %.c prepare scripts FORCE
|
|
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
|
|
|
# Modules
|
|
/: prepare scripts FORCE
|
|
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
|
$(build)=$(build-dir)
|
|
# Make sure the latest headers are built for Documentation
|
|
Documentation/ samples/: headers_install
|
|
%/: prepare scripts FORCE
|
|
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
|
$(build)=$(build-dir)
|
|
%.ko: prepare scripts FORCE
|
|
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
|
$(build)=$(build-dir) $(@:.ko=.o)
|
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
|
|
# FIXME Should go into a make.lib or something
|
|
# ===========================================================================
|
|
|
|
quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
|
|
cmd_rmdirs = rm -rf $(rm-dirs)
|
|
|
|
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
|
|
cmd_rmfiles = rm -f $(rm-files)
|
|
|
|
# Run depmod only if we have System.map and depmod is executable
|
|
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
|
|
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
|
|
$(KERNELRELEASE)
|
|
|
|
# Create temporary dir for module support files
|
|
# clean it up only when building all modules
|
|
cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
|
|
$(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
|
|
|
|
# read all saved command lines
|
|
|
|
cmd_files := $(wildcard .*.cmd $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
|
|
|
|
ifneq ($(cmd_files),)
|
|
$(cmd_files): ; # Do not try to update included dependency files
|
|
include $(cmd_files)
|
|
endif
|
|
|
|
endif # skip-makefile
|
|
|
|
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)
|