diff --git a/.gitignore b/.gitignore index 2e9239279..515a7f45a 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ TAGS*~ git-src .git-credentials /*.log +.project +.cproject +.ccache \ No newline at end of file diff --git a/BSDmakefile b/BSDmakefile index c6a042569..66fe08858 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -1,7 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# + world ${.TARGETS}: @gmake $@ diff --git a/COPYING b/COPYING new file mode 100644 index 000000000..ea8112482 --- /dev/null +++ b/COPYING @@ -0,0 +1,12 @@ +OpenWrt is provided under: + + SPDX-License-Identifier: GPL-2.0-only + +Being under the terms of the GNU General Public License version 2 only, +according with: + + LICENSES/GPL-2.0 + +In addition, other licenses may also apply. + +All contributions to OpenWrt are subject to this COPYING file. diff --git a/Config.in b/Config.in index d30c04839..546e8249c 100644 --- a/Config.in +++ b/Config.in @@ -1,8 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2006-2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# mainmenu "OpenWrt Configuration" diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d60c31a97..000000000 --- a/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Makefile b/Makefile index 32c050bb4..e18bc1860 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,6 @@ -# Makefile for OpenWrt +# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# TOPDIR:=${CURDIR} LC_ALL:=C @@ -62,6 +58,11 @@ dirclean: clean rm -rf $(TMP_DIR) $(MAKE) -C $(TOPDIR)/scripts/config clean +cacheclean: +ifneq ($(CONFIG_CCACHE),) + $(STAGING_DIR_HOST)/bin/ccache -C +endif + ifndef DUMP_TARGET_DB $(BUILD_DIR)/.prepared: Makefile @mkdir -p $$(dirname $@) @@ -119,6 +120,9 @@ world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp- $(_SINGLE)$(SUBMAKE) -r package/index $(_SINGLE)$(SUBMAKE) -r json_overview_image_info $(_SINGLE)$(SUBMAKE) -r checksum +ifneq ($(CONFIG_CCACHE),) + $(STAGING_DIR_HOST)/bin/ccache -s +endif .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean diff --git a/config/Config-build.in b/config/Config-build.in index ac1e05d2f..dd3142795 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -1,9 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2006-2013 OpenWrt.org # Copyright (C) 2016 LEDE Project -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# menu "Global build settings" @@ -56,13 +54,12 @@ menu "Global build settings" If the target supports a newer kernel version than the default, you can use this config option to enable it - config DISPLAY_SUPPORT bool "Show packages that require graphics support (local or remote)" default n config BUILD_PATENTED - default n + default y bool "Compile with support for patented functionality" help When this option is disabled, software which provides patented functionality @@ -89,19 +86,20 @@ menu "Global build settings" This removes all ipkg/opkg status data files from the target directory before building the root filesystem. - config IPK_FILES_CHECKSUMS - bool - prompt "Record files checksums in package metadata" - default n - help - This makes file checksums part of package metadata. It increases size - but provides you with pkg_check command to check for flash coruptions. - config INCLUDE_CONFIG bool "Include build configuration in firmware" if DEVEL default n help - If enabled, buildinfo files will be stored in /etc/build.* of firmware. + If enabled, config.seed will be stored in /etc/build.config of firmware. + + config REPRODUCIBLE_DEBUG_INFO + bool "Make debug information reproducible" + default BUILDBOT + help + This strips the local build path out of debug information. This has the + advantage of making it reproducible, but the disadvantage of making local + debugging using ./scripts/remote-gdb harder, since the debug data will + no longer point to the full path on the build host. config COLLECT_KERNEL_DEBUG bool @@ -173,6 +171,14 @@ menu "Global build settings" help Specifies arguments passed to the strip command when stripping binaries. + config SSTRIP_ARGS + string + prompt "Sstrip arguments" + depends on USE_SSTRIP + default "-z" + help + Specifies arguments passed to the sstrip command when stripping binaries. + config STRIP_KERNEL_EXPORTS bool "Strip unnecessary exports from the kernel image" help @@ -198,10 +204,6 @@ menu "Global build settings" config USE_UCLIBCXX bool "uClibc++" - config USE_LIBCXX - bool "libc++" - depends on !USE_UCLIBC - config USE_LIBSTDCXX bool "libstdc++" endchoice @@ -256,10 +258,8 @@ menu "Global build settings" bool "None" config PKG_CC_STACKPROTECTOR_REGULAR bool "Regular" - depends on KERNEL_CC_STACKPROTECTOR_REGULAR config PKG_CC_STACKPROTECTOR_STRONG bool "Strong" - depends on KERNEL_CC_STACKPROTECTOR_STRONG endchoice choice @@ -275,11 +275,11 @@ menu "Global build settings" bool "Strong" endchoice - config KERNEL_STACKPROTECTOR + config KERNEL_STACKPROTECTOR bool default KERNEL_CC_STACKPROTECTOR_REGULAR || KERNEL_CC_STACKPROTECTOR_STRONG - config KERNEL_STACKPROTECTOR_STRONG + config KERNEL_STACKPROTECTOR_STRONG bool default KERNEL_CC_STACKPROTECTOR_STRONG @@ -321,4 +321,46 @@ menu "Global build settings" bool "Full" endchoice + config TARGET_ROOTFS_SECURITY_LABELS + bool + select KERNEL_SQUASHFS_XATTR + select KERNEL_EXT4_FS_SECURITY + select KERNEL_F2FS_FS_SECURITY + select KERNEL_UBIFS_FS_SECURITY + select KERNEL_JFFS2_FS_SECURITY + + config SELINUX + bool "Enable SELinux" + select KERNEL_SECURITY_SELINUX + select TARGET_ROOTFS_SECURITY_LABELS + select PACKAGE_procd-selinux + select PACKAGE_busybox-selinux + help + This option enables SELinux kernel features, applies security labels + in squashfs rootfs and selects the selinux-variants of busybox and procd. + + Selecting this option results in about 0.5MiB of additional flash space + usage accounting for increased kernel and rootfs size. + + choice + prompt "default SELinux type" + depends on TARGET_ROOTFS_SECURITY_LABELS + default SELINUXTYPE_dssp + help + Select SELinux policy to be installed and used for applying rootfs labels. + + config SELINUXTYPE_targeted + bool "targeted" + select PACKAGE_refpolicy + help + SELinux Reference Policy (refpolicy) + + config SELINUXTYPE_dssp + bool "dssp" + select PACKAGE_selinux-policy + help + Defensec SELinux Security Policy -- OpenWrt edition + + endchoice + endmenu diff --git a/config/Config-devel.in b/config/Config-devel.in index 70ec0ce9a..57031d42f 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -1,8 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2006-2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# menuconfig DEVEL bool "Advanced configuration options (for developers)" @@ -65,10 +63,17 @@ menuconfig DEVEL config CCACHE bool "Use ccache" if DEVEL - default n + default y help Compiler cache; see https://ccache.samba.org/ + config CCACHE_DIR + string "Set ccache directory" if CCACHE + default "" + help + Store ccache in this directory. + If not set, uses './.ccache' + config EXTERNAL_KERNEL_TREE string "Use external kernel tree" if DEVEL default "" @@ -100,18 +105,16 @@ menuconfig DEVEL It can be a git hash or a branch name. If unused, the clone's repository HEAD will be checked-out. + config KERNEL_GIT_MIRROR_HASH + string "Enter hash of Git kernel tree source checkout tarball" if DEVEL + depends on (KERNEL_GIT_CLONE_URI != "") + default "" + config BUILD_LOG bool "Enable log files during build process" if DEVEL help If enabled, log files will be written to the ./log directory. - config BUILD_LOG_DIR - string "Log folder" if DEVEL - default "" - help - Store build logs in this directory. - If not set, uses './logs' - config SRC_TREE_OVERRIDE bool "Enable package source tree override" if DEVEL help diff --git a/config/Config-images.in b/config/Config-images.in index e384e0cd5..eb0aa2c84 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -1,8 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2006-2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# menu "Target Images" @@ -15,12 +13,12 @@ menu "Target Images" choice prompt "Compression" default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ar71xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ath79_mikrotik + default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx + default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS default TARGET_INITRAMFS_COMPRESSION_NONE depends on TARGET_ROOTFS_INITRAMFS help @@ -39,13 +37,19 @@ menu "Target Images" bool "lzma" config TARGET_INITRAMFS_COMPRESSION_LZO + depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE bool "lzo" config TARGET_INITRAMFS_COMPRESSION_LZ4 + depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE bool "lz4" config TARGET_INITRAMFS_COMPRESSION_XZ bool "xz" + + config TARGET_INITRAMFS_COMPRESSION_ZSTD + depends on !LINUX_5_4 && !LINUX_4_19 + bool "zstd" endchoice config EXTERNAL_CPIO @@ -56,11 +60,20 @@ menu "Target Images" Kernel uses specified external cpio as INITRAMFS_SOURCE. config TARGET_INITRAMFS_FORCE - bool "Force" - depends on TARGET_ROOTFS_INITRAMFS - default n - help - Ignore the initramfs passed by the bootloader. + bool "Force" + depends on TARGET_ROOTFS_INITRAMFS + default n + help + Ignore the initramfs passed by the bootloader. + + config TARGET_ROOTFS_INITRAMFS_SEPARATE + bool "separate ramdisk" + depends on USES_SEPARATE_INITRAMFS && TARGET_ROOTFS_INITRAMFS && !TARGET_INITRAMFS_FORCE + default y if USES_SEPARATE_INITRAMFS + help + Generate separate initrd.cpio instead of embedding it. + This is useful for generating images with a dedicated + ramdisk e.g. in U-Boot's uImage and uImage.FIT formats. comment "Root filesystem archives" @@ -81,6 +94,7 @@ menu "Target Images" menuconfig TARGET_ROOTFS_EXT4FS bool "ext4" default y if USES_EXT4 + default n if TARGET_x86 help Build an ext4 root filesystem. @@ -122,6 +136,13 @@ menu "Target Images" help Create an ext4 filesystem with a journal. + config TARGET_ROOTFS_ISO + bool "iso" + default n + depends on TARGET_x86_generic + help + Create a bootable ISO image. + config TARGET_ROOTFS_JFFS2 bool "jffs2" depends on USES_JFFS2 @@ -186,32 +207,32 @@ menu "Target Images" config GRUB_IMAGES bool "Build GRUB images (Linux x86 or x86_64 host only)" depends on TARGET_x86 - depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS + depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS select PACKAGE_grub2 default y - config GRUB_EFI_IMAGES - bool "Build GRUB EFI images (Linux x86 or x86_64 host only)" + config EFI_IMAGES + bool "Build EFI GRUB images (Linux x86 or x86_64 host only)" depends on TARGET_x86 - depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS + depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS select PACKAGE_grub2 select PACKAGE_grub2-efi - select PACKAGE_kmod-fs-vfat default y config GRUB_CONSOLE bool "Use Console Terminal (in addition to Serial)" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on GRUB_IMAGES || EFI_IMAGES default y config GRUB_SERIAL string "Serial port device" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES - default "ttyS0" + depends on GRUB_IMAGES || EFI_IMAGES + default "hvc0" if TARGET_x86_xen_domu + default "ttyS0" if ! TARGET_x86_xen_domu config GRUB_BAUDRATE int "Serial port baud rate" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on GRUB_IMAGES || EFI_IMAGES default 38400 if TARGET_x86_generic default 115200 @@ -222,47 +243,67 @@ menu "Target Images" config GRUB_BOOTOPTS string "Extra kernel boot options" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on GRUB_IMAGES || EFI_IMAGES + default "xencons=hvc" if TARGET_x86_xen_domu help If you don't know, just leave it blank. config GRUB_TIMEOUT string "Seconds to wait before booting the default entry" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on GRUB_IMAGES || EFI_IMAGES default "0" help If you don't know, 5 seconds is a reasonable default. config GRUB_TITLE string "Title for the menu entry in GRUB" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on GRUB_IMAGES || EFI_IMAGES default "OpenWrt" help This is the title of the GRUB menu entry. If unspecified, it defaults to OpenWrt. - config ISO_IMAGES - bool "Build LiveCD image (ISO)" - depends on TARGET_x86 - depends on GRUB_IMAGES || GRUB_EFI_IMAGES - config VDI_IMAGES bool "Build VirtualBox image files (VDI)" - depends on TARGET_x86 - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on TARGET_x86 || TARGET_x86_64 + select GRUB_IMAGES + select TARGET_IMAGES_PAD select PACKAGE_kmod-e1000 config VMDK_IMAGES bool "Build VMware image files (VMDK)" - depends on TARGET_x86 - depends on GRUB_IMAGES || GRUB_EFI_IMAGES - default y + depends on TARGET_x86 || TARGET_x86_64 + select GRUB_IMAGES + select TARGET_IMAGES_PAD select PACKAGE_kmod-e1000 + default y + + config VHD_IMAGES + bool "Build Hyper-V image files (VHD)" + depends on TARGET_x86 || TARGET_x86_64 + depends on GRUB_IMAGES || EFI_IMAGES + select TARGET_IMAGES_PAD + select PACKAGE_kmod-tulip + default n + + config QCOW2_IMAGES + bool "Build PVE/KVM image files (QCOW2)" + depends on TARGET_x86 || TARGET_x86_64 + depends on GRUB_IMAGES || EFI_IMAGES + select TARGET_IMAGES_PAD + select PACKAGE_kmod-e1000 + default n + + config TARGET_IMAGES_PAD + bool "Pad images to filesystem size (for JFFS2)" + depends on GRUB_IMAGES || EFI_IMAGES + default y config TARGET_IMAGES_GZIP bool "GZip images" - depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta - default n + depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS || TARGET_x86 + default y + default n if TARGET_x86 comment "Image Options" @@ -270,21 +311,21 @@ menu "Target Images" config TARGET_KERNEL_PARTSIZE int "Kernel partition size (in MB)" - depends on USES_BOOT_PART + depends on GRUB_IMAGES || EFI_IMAGES || USES_BOOT_PART default 8 if TARGET_apm821xx_sata default 64 if TARGET_bcm27xx default 16 config TARGET_ROOTFS_PARTSIZE int "Root filesystem partition size (in MB)" - depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_rb532 || TARGET_sunxi || TARGET_uml + depends on GRUB_IMAGES || EFI_IMAGES || USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_mvebu || TARGET_rb532 || TARGET_sunxi || TARGET_uml default 160 help Select the root filesystem partition size. config TARGET_ROOTFS_PARTNAME string "Root partition on target device" - depends on GRUB_IMAGES || GRUB_EFI_IMAGES + depends on GRUB_IMAGES || EFI_IMAGES help Override the root partition on the final device. If left empty, it will be mounted by PARTUUID which makes the kernel find the diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 75afe26d7..df236cce0 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1,8 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# # Copyright (C) 2006-2014 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# config KERNEL_BUILD_USER string "Custom Kernel Build User Name" @@ -35,6 +33,10 @@ config KERNEL_SWAP bool "Support for paging of anonymous memory (swap)" default y if !SMALL_FLASH +config KERNEL_PROC_STRIPPED + bool "Strip non-essential /proc functionality to reduce code size" + default y if SMALL_FLASH + config KERNEL_DEBUG_FS bool "Compile the kernel with debug filesystem enabled" default y @@ -44,15 +46,10 @@ config KERNEL_DEBUG_FS write to these files. Many common debugging facilities, such as ftrace, require the existence of debugfs. -# remove KERNEL_MIPS_FPU_EMULATOR after kernel 4.14 and 4.14 are gone -config KERNEL_MIPS_FPU_EMULATOR - bool "Compile the kernel with MIPS FPU Emulator" - default y - depends on (mips || mipsel || mips64 || mips64el) - config KERNEL_MIPS_FP_SUPPORT bool - default y if KERNEL_MIPS_FPU_EMULATOR + default y + depends on (mips || mipsel || mips64 || mips64el) config KERNEL_ARM_PMU bool @@ -90,126 +87,6 @@ config KERNEL_PROFILING Enable the extended profiling support mechanisms used by profilers such as OProfile. -config KERNEL_UBSAN - bool "Compile the kernel with undefined behaviour sanity checker" - help - This option enables undefined behaviour sanity checker - Compile-time instrumentation is used to detect various undefined - behaviours in runtime. Various types of checks may be enabled - via boot parameter ubsan_handle - (see: Documentation/dev-tools/ubsan.rst). - -config KERNEL_UBSAN_SANITIZE_ALL - bool "Enable instrumentation for the entire kernel" - depends on KERNEL_UBSAN - default y - help - This option activates instrumentation for the entire kernel. - If you don't enable this option, you have to explicitly specify - UBSAN_SANITIZE := y for the files/directories you want to check for UB. - Enabling this option will get kernel image size increased - significantly. - -config KERNEL_UBSAN_ALIGNMENT - bool "Enable checking of pointers alignment" - depends on KERNEL_UBSAN - help - This option enables detection of unaligned memory accesses. - Enabling this option on architectures that support unaligned - accesses may produce a lot of false positives. - -config KERNEL_UBSAN_NULL - bool "Enable checking of null pointers" - depends on KERNEL_UBSAN - help - This option enables detection of memory accesses via a - null pointer. - -config KERNEL_KASAN - bool "Compile the kernel with KASan: runtime memory debugger" - select KERNEL_SLUB_DEBUG - depends on (x86_64 || aarch64) - help - Enables kernel address sanitizer - runtime memory debugger, - designed to find out-of-bounds accesses and use-after-free bugs. - This is strictly a debugging feature and it requires a gcc version - of 4.9.2 or later. Detection of out of bounds accesses to stack or - global variables requires gcc 5.0 or later. - This feature consumes about 1/8 of available memory and brings about - ~x3 performance slowdown. - For better error detection enable CONFIG_STACKTRACE. - Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB - (the resulting kernel does not boot). - -config KERNEL_KASAN_EXTRA - bool "KAsan: extra checks" - depends on KERNEL_KASAN && KERNEL_DEBUG_KERNEL - help - This enables further checks in the kernel address sanitizer, for now - it only includes the address-use-after-scope check that can lead - to excessive kernel stack usage, frame size warnings and longer - compile time. - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more - - -choice - prompt "Instrumentation type" - depends on KERNEL_KASAN - default KERNEL_KASAN_OUTLINE - -config KERNEL_KASAN_OUTLINE - bool "Outline instrumentation" - help - Before every memory access compiler insert function call - __asan_load*/__asan_store*. These functions performs check - of shadow memory. This is slower than inline instrumentation, - however it doesn't bloat size of kernel's .text section so - much as inline does. - -config KERNEL_KASAN_INLINE - bool "Inline instrumentation" - help - Compiler directly inserts code checking shadow memory before - memory accesses. This is faster than outline (in some workloads - it gives about x2 boost over outline instrumentation), but - make kernel's .text size much bigger. - This requires a gcc version of 5.0 or later. - -endchoice - -config KERNEL_KCOV - bool "Compile the kernel with code coverage for fuzzing" - select KERNEL_DEBUG_FS - help - KCOV exposes kernel code coverage information in a form suitable - for coverage-guided fuzzing (randomized testing). - - If RANDOMIZE_BASE is enabled, PC values will not be stable across - different machines and across reboots. If you need stable PC values, - disable RANDOMIZE_BASE. - - For more details, see Documentation/kcov.txt. - -config KERNEL_KCOV_ENABLE_COMPARISONS - bool "Enable comparison operands collection by KCOV" - depends on KERNEL_KCOV - help - KCOV also exposes operands of every comparison in the instrumented - code along with operand sizes and PCs of the comparison instructions. - These operands can be used by fuzzing engines to improve the quality - of fuzzing coverage. - -config KERNEL_KCOV_INSTRUMENT_ALL - bool "Instrument all code by default" - depends on KERNEL_KCOV - default y if KERNEL_KCOV - help - If you are doing generic system call fuzzing (like e.g. syzkaller), - then you will want to instrument the whole kernel and you should - say y here. If you are doing more targeted fuzzing (like e.g. - filesystem fuzzing with AFL) then you will want to enable coverage - for more specific subsets of files, and should say n here. - config KERNEL_TASKSTATS bool "Compile the kernel with task resource/io statistics and accounting" default n @@ -272,6 +149,40 @@ config KERNEL_FUNCTION_PROFILER depends on KERNEL_FUNCTION_TRACER default n +config KERNEL_IRQSOFF_TRACER + bool "Interrupts-off Latency Tracer" + depends on KERNEL_FTRACE + help + This option measures the time spent in irqs-off critical + sections, with microsecond accuracy. + + The default measurement method is a maximum search, which is + disabled by default and can be runtime (re-)started + via: + + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency + + (Note that kernel size and overhead increase with this option + enabled. This option and the preempt-off timing option can be + used together or separately.) + +config KERNEL_PREEMPT_TRACER + bool "Preemption-off Latency Tracer" + depends on KERNEL_FTRACE + help + This option measures the time spent in preemption-off critical + sections, with microsecond accuracy. + + The default measurement method is a maximum search, which is + disabled by default and can be runtime (re-)started + via: + + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency + + (Note that kernel size and overhead increase with this option + enabled. This option and the irqs-off timing option can be + used together or separately.) + config KERNEL_DEBUG_KERNEL bool default n @@ -333,10 +244,6 @@ config KERNEL_KPROBES instrumentation and testing. If in doubt, say "N". -config KERNEL_KPROBE_EVENT - bool - default y if KERNEL_KPROBES - config KERNEL_KPROBE_EVENTS bool default y if KERNEL_KPROBES @@ -345,6 +252,10 @@ config KERNEL_AIO bool "Compile the kernel with asynchronous IO support" default y if !SMALL_FLASH +config KERNEL_IO_URING + bool "Compile the kernel with io_uring support" + default y if !SMALL_FLASH + config KERNEL_FHANDLE bool "Compile the kernel with support for fhandle syscalls" default y if !SMALL_FLASH @@ -357,6 +268,31 @@ config KERNEL_BLK_DEV_BSG bool "Compile the kernel with SCSI generic v4 support for any block device" default n +config KERNEL_TRANSPARENT_HUGEPAGE + bool + default n + +choice + prompt "Transparent Hugepage Support sysfs defaults" + depends on KERNEL_TRANSPARENT_HUGEPAGE + default KERNEL_TRANSPARENT_HUGEPAGE_ALWAYS + + config KERNEL_TRANSPARENT_HUGEPAGE_ALWAYS + bool "always" + + config KERNEL_TRANSPARENT_HUGEPAGE_MADVISE + bool "madvise" +endchoice + +config KERNEL_HUGETLBFS + bool + +config KERNEL_HUGETLB_PAGE + bool "Compile the kernel with HugeTLB support" + select KERNEL_TRANSPARENT_HUGEPAGE + select KERNEL_HUGETLBFS + default n + config KERNEL_MAGIC_SYSRQ bool "Compile the kernel with SysRq support" default y @@ -382,74 +318,6 @@ config KERNEL_PROVE_LOCKING select KERNEL_DEBUG_KERNEL default n -config KERNEL_LOCKUP_DETECTOR - bool "Compile the kernel with detect Hard and Soft Lockups" - depends on KERNEL_DEBUG_KERNEL - help - Say Y here to enable the kernel to act as a watchdog to detect - hard and soft lockups. - - Softlockups are bugs that cause the kernel to loop in kernel - mode for more than 20 seconds, without giving other tasks a - chance to run. The current stack trace is displayed upon - detection and the system will stay locked up. - - Hardlockups are bugs that cause the CPU to loop in kernel mode - for more than 10 seconds, without letting other interrupts have a - chance to run. The current stack trace is displayed upon detection - and the system will stay locked up. - - The overhead should be minimal. A periodic hrtimer runs to - generate interrupts and kick the watchdog task every 4 seconds. - An NMI is generated every 10 seconds or so to check for hardlockups. - - The frequency of hrtimer and NMI events and the soft and hard lockup - thresholds can be controlled through the sysctl watchdog_thresh. - -config KERNEL_DETECT_HUNG_TASK - bool "Compile the kernel with detect Hung Tasks" - depends on KERNEL_DEBUG_KERNEL - default KERNEL_LOCKUP_DETECTOR - help - Say Y here to enable the kernel to detect "hung tasks", - which are bugs that cause the task to be stuck in - uninterruptible "D" state indefinitely. - - When a hung task is detected, the kernel will print the - current stack trace (which you should report), but the - task will stay in uninterruptible state. If lockdep is - enabled then all held locks will also be reported. This - feature has negligible overhead. - -config KERNEL_WQ_WATCHDOG - bool "Compile the kernel with detect Workqueue Stalls" - depends on KERNEL_DEBUG_KERNEL - help - Say Y here to enable stall detection on workqueues. If a - worker pool doesn't make forward progress on a pending work - item for over a given amount of time, 30s by default, a - warning message is printed along with dump of workqueue - state. This can be configured through kernel parameter - "workqueue.watchdog_thresh" and its sysfs counterpart. - -config KERNEL_DEBUG_ATOMIC_SLEEP - bool "Compile the kernel with sleep inside atomic section checking" - depends on KERNEL_DEBUG_KERNEL - help - If you say Y here, various routines which may sleep will become very - noisy if they are called inside atomic sections: when a spinlock is - held, inside an rcu read side critical section, inside preempt disabled - sections, inside an interrupt, etc... - -config KERNEL_DEBUG_VM - bool "Compile the kernel with debug VM" - depends on KERNEL_DEBUG_KERNEL - help - Enable this to turn on extended checks in the virtual-memory system - that may impact performance. - - If unsure, say N. - config KERNEL_PRINTK_TIME bool "Enable printk timestamps" default y @@ -513,23 +381,23 @@ if KERNEL_DEVTMPFS endif config KERNEL_KEYS - bool "Enable kernel access key retention support" - default n + bool "Enable kernel access key retention support" + default !SMALL_FLASH config KERNEL_PERSISTENT_KEYRINGS - bool "Enable kernel persistent keyrings" - depends on KERNEL_KEYS - default n + bool "Enable kernel persistent keyrings" + depends on KERNEL_KEYS + default n + +config KERNEL_KEYS_REQUEST_CACHE + bool "Enable temporary caching of the last request_key() result" + depends on KERNEL_KEYS + default n config KERNEL_BIG_KEYS - bool "Enable large payload keys on kernel keyrings" - depends on KERNEL_KEYS - default n - -config KERNEL_ENCRYPTED_KEYS - tristate "Enable keys with encrypted payloads on kernel keyrings" - depends on KERNEL_KEYS - default n + bool "Enable large payload keys on kernel keyrings" + depends on KERNEL_KEYS + default n # # CGROUP support symbols @@ -551,21 +419,29 @@ if KERNEL_CGROUPS config KERNEL_FREEZER bool - default y if KERNEL_CGROUP_FREEZER config KERNEL_CGROUP_FREEZER - bool "Freezer cgroup subsystem" - default y + bool "legacy Freezer cgroup subsystem" + default n + select KERNEL_FREEZER help Provides a way to freeze and unfreeze all tasks in a cgroup. + (legacy cgroup1-only controller, in cgroup2 freezer + is integrated in the Memory controller) config KERNEL_CGROUP_DEVICE - bool "Device controller for cgroups" - default y + bool "legacy Device controller for cgroups" + default n help Provides a cgroup implementing whitelists for devices which a process in the cgroup can mknod or open. + (legacy cgroup1-only controller) + + config KERNEL_CGROUP_HUGETLB + bool "HugeTLB controller" + default n + select KERNEL_HUGETLB_PAGE config KERNEL_CGROUP_PIDS bool "PIDs cgroup subsystem" @@ -574,6 +450,14 @@ if KERNEL_CGROUPS Provides enforcement of process number limits in the scope of a cgroup. + config KERNEL_CGROUP_RDMA + bool "RDMA controller for cgroups" + default y + + config KERNEL_CGROUP_BPF + bool "Support for eBPF programs attached to cgroups" + default y + config KERNEL_CPUSETS bool "Cpuset support" default y if !SMALL_FLASH @@ -609,6 +493,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG bool "Memory Resource Controller for Control Groups" default y if !SMALL_FLASH + select KERNEL_FREEZER depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18 help Provides a memory resource controller that manages both anonymous @@ -631,7 +516,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG_SWAP bool "Memory Resource Controller Swap Extension" - default n + default y if !SMALL_FLASH depends on KERNEL_MEMCG help Add swap management feature to memory resource controller. When you @@ -763,12 +648,16 @@ if KERNEL_CGROUPS files in a cgroup which can be useful for debugging. config KERNEL_NET_CLS_CGROUP - bool "Control Group Classifier" - default y + bool "legacy Control Group Classifier" + default n + + config KERNEL_CGROUP_NET_CLASSID + bool "legacy Network classid cgroup" + default n config KERNEL_CGROUP_NET_PRIO - bool "Network priority cgroup" - default y + bool "legacy Network priority cgroup" + default n endif @@ -778,7 +667,7 @@ endif config KERNEL_NAMESPACES bool "Enable kernel namespaces" - default y if !SMALL_FLASH + default n if KERNEL_NAMESPACES @@ -847,13 +736,13 @@ config KERNEL_POSIX_MQUEUE config KERNEL_SECCOMP_FILTER bool - default y if !SMALL_FLASH + default n config KERNEL_SECCOMP bool "Enable seccomp support" depends on !(TARGET_uml) select KERNEL_SECCOMP_FILTER - default y if !SMALL_FLASH + default n help Build kernel with support for seccomp. @@ -893,6 +782,15 @@ if KERNEL_IPV6 config KERNEL_IPV6_PIMSM_V2 def_bool n + config KERNEL_IPV6_SEG6_LWTUNNEL + bool "Enable support for lightweight tunnels" + default y if !SMALL_FLASH + help + Using lwtunnel (needed for IPv6 segment routing) requires ip-full package. + + config KERNEL_LWTUNNEL_BPF + def_bool n + endif # @@ -979,7 +877,7 @@ menu "Filesystem ACL and attr support options" select KERNEL_FS_POSIX_ACL default y if USE_FS_ACL_ATTR - config KERNEL_HFSPLUS_FS_POSIX_ACL + config KERNEL_HFSPLUG_FS_POSIX_ACL bool "Enable POSIX ACL for HFS+ Filesystems" select KERNEL_FS_POSIX_ACL default y if USE_FS_ACL_ATTR @@ -1036,6 +934,9 @@ config KERNEL_SQUASHFS_FRAGMENT_CACHE_SIZE default 2 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) default 3 +config KERNEL_SQUASHFS_XATTR + bool "Squashfs XATTR support" + # # compile optimiziation setting # @@ -1057,3 +958,59 @@ config KERNEL_CC_OPTIMIZE_FOR_SIZE your compiler resulting in a smaller kernel. endchoice + +config KERNEL_AUDIT + bool "Auditing support" + +config KERNEL_SECURITY + bool "Enable different security models" + +config KERNEL_SECURITY_NETWORK + bool "Socket and Networking Security Hooks" + select KERNEL_SECURITY + +config KERNEL_SECURITY_SELINUX + bool "NSA SELinux Support" + select KERNEL_SECURITY_NETWORK + select KERNEL_AUDIT + +config KERNEL_SECURITY_SELINUX_BOOTPARAM + bool "NSA SELinux boot parameter" + depends on KERNEL_SECURITY_SELINUX + default y + +config KERNEL_SECURITY_SELINUX_DISABLE + bool "NSA SELinux runtime disable" + depends on KERNEL_SECURITY_SELINUX + +config KERNEL_SECURITY_SELINUX_DEVELOP + bool "NSA SELinux Development Support" + depends on KERNEL_SECURITY_SELINUX + default y + +config KERNEL_SECURITY_SELINUX_SIDTAB_HASH_BITS + int + depends on KERNEL_SECURITY_SELINUX + default 9 + +config KERNEL_SECURITY_SELINUX_SID2STR_CACHE_SIZE + int + depends on KERNEL_SECURITY_SELINUX + default 256 + +config KERNEL_LSM + string + default "lockdown,yama,loadpin,safesetid,integrity,selinux" + depends on KERNEL_SECURITY_SELINUX + +config KERNEL_EXT4_FS_SECURITY + bool "Ext4 Security Labels" + +config KERNEL_F2FS_FS_SECURITY + bool "F2FS Security Labels" + +config KERNEL_UBIFS_FS_SECURITY + bool "UBIFS Security Labels" + +config KERNEL_JFFS2_FS_SECURITY + bool "JFFS2 Security Labels" diff --git a/include/autotools.mk b/include/autotools.mk index ae320fbde..1686f69f8 100644 --- a/include/autotools.mk +++ b/include/autotools.mk @@ -1,9 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2007-2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2007-2020 OpenWrt.org + +ifneq ($(__autotools_inc),1) +__autotools_inc=1 autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2)) @@ -65,6 +65,12 @@ define patch_libtool ); endef +define set_libtool_abiver + sed -i \ + -e 's,^soname_spec=.*,soname_spec="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION)",' \ + -e 's,^library_names_spec=.*,library_names_spec="\\$$$${libname}\\$$$${shared_ext}.$(PKG_ABI_VERSION) \\$$$${libname}\\$$$${shared_ext}",' \ + $(PKG_BUILD_DIR)/libtool +endef PKG_LIBTOOL_PATHS?=$(CONFIGURE_PATH) PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH) @@ -87,7 +93,7 @@ endef define gettext_version_target (cd $(PKG_BUILD_DIR) && \ - GETTEXT_VERSION=$(shell $(STAGING_DIR_HOSTPKG)/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -ne '1s/.*\([0-9]\.[0-9]\{2\}\.[0-9]\).*/\1/p' ) && \ + GETTEXT_VERSION=$(shell $(STAGING_DIR_HOSTPKG)/bin/gettext -V | $(STAGING_DIR_HOST)/bin/sed -rne '1s/.*\b([0-9]\.[0-9]+(\.[0-9]+)?)\b.*/\1/p' ) && \ $(STAGING_DIR_HOST)/bin/sed \ -i $(PKG_BUILD_DIR)/configure.ac \ -e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \ @@ -113,6 +119,10 @@ ifneq ($(filter libtool,$(PKG_FIXUP)),) endif endif +ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),) + Hooks/Configure/Post += set_libtool_abiver +endif + ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),) PKG_BUILD_DEPENDS += libtool gettext libiconv ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),) @@ -145,12 +155,8 @@ define patch_libtool_host $(HOST_BUILD_DIR))) endef -ifneq ($(filter patch-libtool,$(PKG_FIXUP)),) - Hooks/HostConfigure/Pre += patch_libtool_host -endif - ifneq ($(filter patch-libtool,$(HOST_FIXUP)),) - Hooks/HostConfigure/Pre += $(strip $(call patch_libtool,$(HOST_BUILD_DIR))) + Hooks/HostConfigure/Pre += patch_libtool_host endif ifneq ($(filter libtool,$(HOST_FIXUP)),) @@ -170,3 +176,5 @@ ifneq ($(filter autoreconf,$(HOST_FIXUP)),) Hooks/HostConfigure/Pre += autoreconf_host endif endif + +endif #__autotools_inc diff --git a/include/cmake.mk b/include/cmake.mk index a5ba7d31b..96c4d7df3 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -4,6 +4,7 @@ PKG_INSTALL:=1 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) MAKE_FLAGS+=VERBOSE=1 + HOST_MAKE_FLAGS+=VERBOSE=1 endif CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR)) @@ -18,16 +19,22 @@ else endif ifeq ($(CONFIG_CCACHE),) + CMAKE_C_COMPILER_LAUNCHER:= + CMAKE_CXX_COMPILER_LAUNCHER:= CMAKE_C_COMPILER:=$(call cmake_tool,$(TARGET_CC)) CMAKE_CXX_COMPILER:=$(call cmake_tool,$(TARGET_CXX)) - CMAKE_C_COMPILER_ARG1:= - CMAKE_CXX_COMPILER_ARG1:= + + CMAKE_HOST_C_COMPILER:=$(HOSTCC) + CMAKE_HOST_CXX_COMPILER:=$(HOSTCXX) else CCACHE:=$(STAGING_DIR_HOST)/bin/ccache - CMAKE_C_COMPILER:=$(CCACHE) - CMAKE_C_COMPILER_ARG1:=$(TARGET_CC_NOCACHE) - CMAKE_CXX_COMPILER:=$(CCACHE) - CMAKE_CXX_COMPILER_ARG1:=$(TARGET_CXX_NOCACHE) + CMAKE_C_COMPILER_LAUNCHER:=$(CCACHE) + CMAKE_CXX_COMPILER_LAUNCHER:=$(CCACHE) + CMAKE_C_COMPILER:=$(TARGET_CC_NOCACHE) + CMAKE_CXX_COMPILER:=$(TARGET_CXX_NOCACHE) + + CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE) + CMAKE_HOST_CXX_COMPILER:=$(HOSTCXX_NOCACHE) endif CMAKE_AR:=$(call cmake_tool,$(TARGET_AR)) CMAKE_NM:=$(call cmake_tool,$(TARGET_NM)) @@ -50,12 +57,12 @@ define Build/Configure/Default -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \ + -DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \ -DCMAKE_C_COMPILER="$(CMAKE_C_COMPILER)" \ - -DCMAKE_C_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="$(CMAKE_CXX_COMPILER_LAUNCHER)" \ -DCMAKE_CXX_COMPILER="$(CMAKE_CXX_COMPILER)" \ - -DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_COMPILER_ARG1)" \ + -DCMAKE_ASM_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \ -DCMAKE_ASM_COMPILER="$(CMAKE_C_COMPILER)" \ - -DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \ -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \ -DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \ @@ -71,6 +78,12 @@ define Build/Configure/Default -DDL_LIBRARY=$(STAGING_DIR) \ -DCMAKE_PREFIX_PATH=$(STAGING_DIR) \ -DCMAKE_SKIP_RPATH=TRUE \ + -DCMAKE_EXPORT_PACKAGE_REGISTRY=FALSE \ + -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE \ + -DCMAKE_FIND_USE_PACKAGE_REGISTRY=FALSE \ + -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \ + -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ + -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ $(CMAKE_OPTIONS) \ $(CMAKE_SOURCE_DIR) \ ) @@ -90,6 +103,12 @@ define Host/Configure/Default LDFLAGS="$(HOST_LDFLAGS)" \ cmake \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \ + -DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="$(CMAKE_CXX_COMPILER_LAUNCHER)" \ + -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" \ + -DCMAKE_ASM_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \ + -DCMAKE_ASM_COMPILER="$(CMAKE_HOST_C_COMPILER)" \ -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \ @@ -104,6 +123,12 @@ define Host/Configure/Default -DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \ -DCMAKE_SKIP_RPATH=TRUE \ -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_EXPORT_PACKAGE_REGISTRY=FALSE \ + -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE \ + -DCMAKE_FIND_USE_PACKAGE_REGISTRY=FALSE \ + -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \ + -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ + -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ $(CMAKE_HOST_OPTIONS) \ $(HOST_CMAKE_SOURCE_DIR) \ ) diff --git a/include/debug.mk b/include/debug.mk index 59a99c0f7..98a1d6e88 100644 --- a/include/debug.mk +++ b/include/debug.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2007-2020 OpenWrt.org # debug flags: # diff --git a/include/depends.mk b/include/depends.mk index 3df51adae..465e4e952 100644 --- a/include/depends.mk +++ b/include/depends.mk @@ -1,9 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2007-2020 OpenWrt.org + # define a dependency on a subtree # parameters: # 1: directories/files @@ -13,7 +11,7 @@ DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*" -find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) | mkhash md5 +find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | $(MKHASH) md5 define rdep .PRECIOUS: $(2) diff --git a/include/download.mk b/include/download.mk index 9c8ada052..609956b00 100644 --- a/include/download.mk +++ b/include/download.mk @@ -1,10 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2006-2012 OpenWrt.org # Copyright (C) 2016 LEDE project -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# PROJECT_GIT = https://git.openwrt.org @@ -12,9 +9,11 @@ OPENWRT_GIT = $(PROJECT_GIT) LEDE_GIT = $(PROJECT_GIT) ifdef PKG_SOURCE_VERSION -PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION)) -PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz + ifndef PKG_VERSION + PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION)) + endif + PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION) + PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz endif DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) @@ -28,7 +27,7 @@ define dl_method $(strip \ $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)), $(if $(2),$(2), \ - $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ + $(if $(filter @OPENWRT @APACHE/% @DEBIAN/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ $(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \ $(if $(filter svn://%,$(1)),svn, \ $(if $(filter cvs://%,$(1)),cvs, \ @@ -75,7 +74,7 @@ else check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix)) endif -gen_sha256sum = $(shell mkhash sha256 $(DL_DIR)/$(1)) +gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1)) ifdef FIXUP F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) diff --git a/include/feeds.mk b/include/feeds.mk index 9637424c5..98e315bce 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -1,10 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2014 OpenWrt.org # Copyright (C) 2016 LEDE Project -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -include $(TMP_DIR)/.packageauxvars @@ -36,6 +33,8 @@ define FeedSourcesAppend echo 'src/gz %d_core %U/targets/%S/packages'; \ $(strip $(if $(CONFIG_PER_FEED_REPO), \ echo 'src/gz %d_base %U/packages/%A/base'; \ + $(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \ + echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \ $(foreach feed,$(FEEDS_AVAILABLE), \ $(if $(CONFIG_FEED_$(feed)), \ echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \ @@ -44,5 +43,5 @@ endef # 1: package name define GetABISuffix -$(if $(filter-out kmod-%,$(1)),$(if $(Package/$(1)/abiversion),$(if $(filter %0 %1 %2 %3 %4 %5 %6 %7 %8 %9,$(1)),-)$(Package/$(1)/abiversion))) +$(if $(filter-out kmod-%,$(1)),$(if $(ABIV_$(1)),$(ABIV_$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v))))) endef diff --git a/include/hardening.mk b/include/hardening.mk index 4e49e6b1b..6acd862f5 100644 --- a/include/hardening.mk +++ b/include/hardening.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2015-2020 OpenWrt.org PKG_CHECK_FORMAT_SECURITY ?= 1 PKG_ASLR_PIE ?= 1 diff --git a/include/host-build.mk b/include/host-build.mk index 9fc14241c..e4a5c48e7 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org include $(INCLUDE_DIR)/download.mk @@ -132,7 +129,6 @@ define Host/Exports/Default $(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX) $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig $(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig - $(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache) $(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE)) $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG)) endef @@ -184,6 +180,8 @@ ifndef DUMP clean-build: host-clean-build endif + $(DL_DIR)/$(FILE): FORCE + $(_host_target)host-prepare: $(HOST_STAMP_PREPARED) $(_host_target)host-configure: $(HOST_STAMP_CONFIGURED) $(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED) diff --git a/include/image-commands.mk b/include/image-commands.mk index f1eeb38b4..f21f9e3f0 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -3,16 +3,12 @@ IMAGE_KERNEL = $(word 1,$^) IMAGE_ROOTFS = $(word 2,$^) -define rootfs_align -$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1)))))) +define ModelNameLimit16 +$(shell expr substr "$(word 2, $(subst _, ,$(1)))" 1 16) endef -define Build/uImage - mkimage -A $(LINUX_KARCH) \ - -O linux -T kernel \ - -C $(1) -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ - -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' -d $@ $@.new - mv $@.new $@ +define rootfs_align +$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1)))))) endef define Build/buffalo-enc @@ -48,6 +44,26 @@ define Build/buffalo-dhp-image mv $@.new $@ endef +define Build/elx-header + $(eval hw_id=$(word 1,$(1))) + $(eval xor_pattern=$(word 2,$(1))) + ( \ + echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \ + dd bs=42 count=1 conv=sync; \ + hw_id="$(hw_id)"; \ + echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \ + dd bs=20 count=1 conv=sync; \ + echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ + dd bs=8 count=1 conv=sync; \ + echo -ne "$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ + dd bs=58 count=1 conv=sync; \ + ) > $(KDIR)/tmp/$(DEVICE_NAME).header + $(call Build/xor-image,-p $(xor_pattern) -x) + cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new + mv $@.new $@ + rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header +endef + define Build/eva-image $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new mv $@.new $@ @@ -142,6 +158,13 @@ define Build/append-dtb cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@ endef +define Build/append-dtb-elf + $(TARGET_CROSS)objcopy \ + --set-section-flags=.appended_dtb=alloc,contents \ + --update-section \ + .appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@ +endef + define Build/install-dtb $(call locked, \ $(foreach dts,$(DEVICE_DTS), \ @@ -153,14 +176,31 @@ define Build/install-dtb ) endef +define Build/initrd_compression + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \ + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),.gzip) \ + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),.lzma) \ + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \ + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd) +endef + define Build/fit $(TOPDIR)/scripts/mkits.sh \ -D $(DEVICE_NAME) -o $@.its -k $@ \ - $(if $(word 2,$(1)),-d $(word 2,$(1))) -C $(word 1,$(1)) \ + -C $(word 1,$(1)) $(if $(word 2,$(1)),\ + $(if $(DEVICE_DTS_OVERLAY),-d $(KERNEL_BUILD_DIR)/image-$$(basename $(word 2,$(1))),\ + -d $(word 2,$(1)))) \ + $(if $(findstring with-rootfs,$(word 3,$(1))),-r $(IMAGE_ROOTFS)) \ + $(if $(findstring with-initrd,$(word 3,$(1))), \ + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \ + -i $(KERNEL_BUILD_DIR)/initrd.cpio$(strip $(call Build/initrd_compression)))) \ -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ - -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \ + $(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \ + $(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \ + -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ -A $(LINUX_KARCH) -v $(LINUX_VERSION) - PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\ + -E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new @mv $@.new $@ endef @@ -203,6 +243,14 @@ define Build/jffs2 @mv $@.new $@ endef +define Build/kernel2minor + $(eval temp_file := $(shell mktemp)) + cp $@ $(temp_file) + kernel2minor -k $(temp_file) -r $(temp_file).new $(1) + mv $(temp_file).new $@ + rm -f $(temp_file) +endef + define Build/kernel-bin rm -f $@ cp $< $@ @@ -269,27 +317,14 @@ define Build/xor-image endef define Build/check-size - @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE)))))) -ge "$$(stat -c%s $@)" ] || { \ - echo "WARNING: Image file $@ is too big" >&2; \ + @imagesize="$$(stat -c%s $@)"; \ + limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \ + [ $$limitsize -ge $$imagesize ] || { \ + echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \ rm -f $@; \ } endef -define Build/check-kernel-size - @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $(IMAGE_KERNEL))" ] || { \ - echo "WARNING: Kernel for $@ is too big > $(1)" >&2; \ - rm -f $@; \ - } -endef - -define Build/combined-image - -sh $(TOPDIR)/scripts/combined-image.sh \ - "$(IMAGE_KERNEL)" \ - "$@" \ - "$@.new" - @mv $@.new $@ -endef - define Build/linksys-image $(TOPDIR)/scripts/linksys-image.sh \ "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \ @@ -407,6 +442,21 @@ metadata_json = \ } \ }' +define Build/uImage + mkimage \ + -A $(LINUX_KARCH) \ + -O linux \ + -T kernel \ + -C $(word 1,$(1)) \ + -a $(KERNEL_LOADADDR) \ + -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \ + $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \ + $(wordlist 2,$(words $(1)),$(1)) \ + -d $@ $@.new + mv $@.new $@ +endef + define Build/append-metadata $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \ @@ -416,15 +466,3 @@ define Build/append-metadata fwtool -S "$@.ucert" "$@" ;\ } endef - -define Build/kernel2minor - kernel2minor -k $@ -r $@.new $(1) - mv $@.new $@ -endef - -# Convert a raw image into a $1 type image. -# E.g. | qemu-image vdi -define Build/qemu-image - qemu-img convert -f raw -O $1 $@ $@.new - @mv $@.new $@ -endef diff --git a/include/image-legacy.mk b/include/image-legacy.mk deleted file mode 100644 index 1ccaec09b..000000000 --- a/include/image-legacy.mk +++ /dev/null @@ -1,93 +0,0 @@ -ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),) - define Image/mkfs/ubifs/generate - $(CP) ./ubinize$(1).cfg $(KDIR) - ( cd $(KDIR); \ - $(STAGING_DIR_HOST)/bin/ubinize \ - $(if $($(PROFILE)_UBI_OPTS),$($(PROFILE)_UBI_OPTS),$(shell echo $(UBI_OPTS))) \ - -o $(KDIR)/root$(1).ubi \ - ubinize$(1).cfg \ - ) - endef - - define Image/mkfs/ubifs/legacy - - $(if $($(PROFILE)_UBIFS_OPTS)$(UBIFS_OPTS), - $(STAGING_DIR_HOST)/bin/mkfs.ubifs \ - $(if $($(PROFILE)_UBIFS_OPTS),$($(PROFILE)_UBIFS_OPTS),$(UBIFS_OPTS)) \ - $(if $(CONFIG_TARGET_UBIFS_FREE_SPACE_FIXUP),--space-fixup) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_NONE),--compr=none) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_LZO),--compr=lzo) \ - $(if $(CONFIG_TARGET_UBIFS_COMPRESSION_ZLIB),--compr=zlib) \ - $(if $(shell echo $(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)),--jrn-size=$(CONFIG_TARGET_UBIFS_JOURNAL_SIZE)) \ - --squash-uids \ - -o $(KDIR)/root.ubifs \ - -d $(TARGET_DIR) - ) - $(call Image/Build,ubifs) - - $(if $($(PROFILE)_UBI_OPTS)$(UBI_OPTS), - $(if $(wildcard ./ubinize.cfg),$(call Image/mkfs/ubifs/generate,)) - $(if $(wildcard ./ubinize-overlay.cfg),$(call Image/mkfs/ubifs/generate,-overlay)) - ) - $(if $(wildcard ./ubinize.cfg),$(call Image/Build,ubi)) - endef -endif - -LegacyDevice/Dump = $(Device/Dump) - -define LegacyDevice/Check - $(Device/Check/Common) - _TARGET_PREPARE := $$(if $$(_PROFILE_SET),legacy-images-prepare,prepare-disabled) - _TARGET := $$(if $$(_PROFILE_SET),legacy-images,install-disabled) - $$(if $$(_PROFILE_SET),install: legacy-images-make) - ifndef IB - $$(if $$(_PROFILE_SET),kernel_prepare: legacy-images-prepare-make) - endif -endef - -ifdef TARGET_PER_DEVICE_ROOTFS - define Image/Build/Profile/Filesystem - cp $(KDIR)/root.$(2)+pkg=$(3) $(KDIR)/root.$(2) - $(call Image/Build/$(2),$(2)) - $(call Image/Build/Profile,$(1),$(2)) - endef -else - Image/Build/Profile/Filesystem = $(Image/Build/Profile) -endif - -define LegacyDevice/Build - $$(_TARGET): legacy-image-$(1) - $$(_TARGET_PREPARE): legacy-image-prepare-$(1) - .PHONY: legacy-image-prepare-$(1) legacy-image-$(1) - - legacy-image-prepare-$(1): - $$(call Image/Prepare/Profile,$(1)) - - ifndef IB - ifdef CONFIG_TARGET_PER_DEVICE_ROOTFS - ROOTFS/$(1) := $(foreach fs,$(TARGET_FILESYSTEMS), \ - $(KDIR)/root.$(fs)$$(strip $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),+pkg=$$(ROOTFS_ID/$(1)))) \ - ) - - $$(ROOTFS/$(1)): target-dir-$$(ROOTFS_ID/$(1)) - legacy-images-make: $$(if $$(_PROFILE_SET),$$(ROOTFS/$(1))) - endif - endif - - legacy-image-$(1): - $$(call Image/BuildKernel/Profile,$(1)) - $(foreach fs,$(TARGET_FILESYSTEMS), - $$(call Image/Build/Profile/Filesystem,$(1),$(fs),$$(ROOTFS_ID/$(1))) - ) - -endef - -define LegacyDevice - $(call Device/InitProfile,$(1)) - $(call Device/Default,$(1)) - $(call LegacyDevice/Default,$(1)) - $(call LegacyDevice/$(1),$(1)) - $(call LegacyDevice/Check,$(1)) - $(call LegacyDevice/$(if $(DUMP),Dump,Build),$(1)) - -endef diff --git a/include/image.mk b/include/image.mk index 3cd3c77c6..ef0d46051 100644 --- a/include/image.mk +++ b/include/image.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org override TARGET_BUILD= include $(INCLUDE_DIR)/prereq.mk @@ -17,7 +14,6 @@ ifndef IB endif endif -include $(INCLUDE_DIR)/image-legacy.mk include $(INCLUDE_DIR)/feeds.mk include $(INCLUDE_DIR)/rootfs.mk @@ -30,7 +26,7 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3)) param_mangle = $(subst $(space),_,$(strip $(1))) param_unmangle = $(subst _,$(space),$(1)) -mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | cut -b1-8) +mkfs_packages_id = $(shell echo $(sort $(1)) | $(MKHASH) md5 | cut -b1-8) mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR)) KDIR=$(KERNEL_BUILD_DIR) @@ -44,8 +40,7 @@ IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_COMBINED:=$(IMG_PREFIX)-combined -IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8) -IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/') +IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8) MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt @@ -94,6 +89,7 @@ fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS) += squashfs fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE)) fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BLOCKSIZE)) fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4 +fs-types-$(CONFIG_TARGET_ROOTFS_ISO) += iso fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE))) @@ -143,7 +139,7 @@ endef define Image/BuildKernel/MkFIT $(TOPDIR)/scripts/mkits.sh \ -D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C $(4) -a $(5) -e $(6) \ - -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \ + -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \ -A $(LINUX_KARCH) -v $(LINUX_VERSION) PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb endef @@ -163,18 +159,12 @@ DTC_FLAGS += \ -Wno-unit_address_format \ -Wno-pci_bridge \ -Wno-pci_device_bus_num \ - -Wno-pci_device_reg -ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1) - DTC_FLAGS += \ - -Wno-avoid_unnecessary_addr_size \ - -Wno-alias_paths -endif -ifeq ($(strip $(call kernel_patchver_ge,4.18.0)),1) - DTC_FLAGS += \ - -Wno-graph_child_address \ - -Wno-graph_port \ - -Wno-unique_unit_address -endif + -Wno-pci_device_reg \ + -Wno-avoid_unnecessary_addr_size \ + -Wno-alias_paths \ + -Wno-graph_child_address \ + -Wno-graph_port \ + -Wno-unique_unit_address define Image/pad-to dd if=$(1) of=$(1).new bs=$(2) conv=sync @@ -200,6 +190,7 @@ define Image/BuildDTB -o $(2).tmp $(1) $(LINUX_DIR)/scripts/dtc/dtc -O dtb \ -i$(dir $(1)) $(DTC_FLAGS) $(4) \ + $(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \ -o $(2) $(2).tmp $(RM) $(2).tmp endef @@ -234,40 +225,28 @@ endef $(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S)))) $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S)))) -define Image/mkfs/squashfs +define Image/mkfs/squashfs-common $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \ -nopad -noappend -root-owned \ -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \ -processors $(shell nproc) endef -# $(1): board name -# $(2): rootfs type -# $(3): kernel image -# $(4): compat string -ifneq ($(CONFIG_NAND_SUPPORT),) - define Image/Build/SysupgradeNAND - mkdir -p "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/" - echo "BOARD=$(if $(4),$(4),$(1))" > "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/CONTROL" - [ -z "$(2)" ] || $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/root" - [ -z "$(3)" ] || $(CP) "$(3)" "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/kernel" - (cd "$(KDIR_TMP)"; $(TAR) cvf \ - "$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(if $(4),$(4),$(1)) \ - $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \ - ) - endef - -# $(1) board name -# $(2) ubinize-image options (e.g. --uboot-env and/or --kernel kernelimage) -# $(3) rootfstype (e.g. squashfs or ubifs) -# $(4) options to pass-through to ubinize (i.e. $($(PROFILE)_UBI_OPTS))) - define Image/Build/UbinizeImage - sh $(TOPDIR)/scripts/ubinize-image.sh $(2) \ - "$(KDIR)/root.$(3)" \ - "$(KDIR)/$(IMG_PREFIX)-$(1)-$(3)-ubinized.bin" \ - $(4) - endef - +ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y) +define Image/mkfs/squashfs + echo ". $(call mkfs_target_dir,$(1))/etc/selinux/config" > $@.fakeroot-script + echo "$(STAGING_DIR_HOST)/bin/setfiles -r" \ + "$(call mkfs_target_dir,$(1))" \ + "$(call mkfs_target_dir,$(1))/etc/selinux/\$${SELINUXTYPE}/contexts/files/file_contexts " \ + "$(call mkfs_target_dir,$(1))" >> $@.fakeroot-script + echo "$(Image/mkfs/squashfs-common)" >> $@.fakeroot-script + chmod +x $@.fakeroot-script + $(FAKEROOT) "$@.fakeroot-script" +endef +else +define Image/mkfs/squashfs + $(call Image/mkfs/squashfs-common,$(1)) +endef endif define Image/mkfs/ubifs @@ -415,18 +394,20 @@ define Device/Init DEVICE_DTS := DEVICE_DTS_CONFIG := DEVICE_DTS_DIR := + DEVICE_DTS_OVERLAY := + DEVICE_FDT_NUM := SOC := BOARD_NAME := + UIMAGE_MAGIC := UIMAGE_NAME := - SUPPORTED_DEVICES := + SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) IMAGE_METADATA := FILESYSTEMS := $(TARGET_FILESYSTEMS) UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-$(1) - BROKEN := DEFAULT := endef @@ -434,9 +415,10 @@ DEFAULT_DEVICE_VARS := \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ - DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \ - IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH IMAGE_SIZE \ - DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ + DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \ + SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ + SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH \ + IMAGE_SIZE DEVICE_PACKAGES DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \ DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT @@ -487,7 +469,8 @@ endef ifndef IB define Device/Build/initramfs $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1)) - $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) + $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) \ + $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)) $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) @@ -496,6 +479,38 @@ define Device/Build/initramfs $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare @rm -f $$@ $$(call concat_cmd,$$(KERNEL_INITRAMFS)) + + $(call Device/Export,$(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,$(1)) + + $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) + @mkdir -p $$(shell dirname $$@) + DEVICE_ID="$(1)" \ + BIN_DIR="$(BIN_DIR)" \ + SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ + IMAGE_NAME="$$(notdir $$^)" \ + IMAGE_TYPE="kernel" \ + IMAGE_FILESYSTEM="initramfs" \ + IMAGE_PREFIX="$$(IMAGE_PREFIX)" \ + DEVICE_VENDOR="$$(DEVICE_VENDOR)" \ + DEVICE_MODEL="$$(DEVICE_MODEL)" \ + DEVICE_VARIANT="$$(DEVICE_VARIANT)" \ + DEVICE_ALT0_VENDOR="$$(DEVICE_ALT0_VENDOR)" \ + DEVICE_ALT0_MODEL="$$(DEVICE_ALT0_MODEL)" \ + DEVICE_ALT0_VARIANT="$$(DEVICE_ALT0_VARIANT)" \ + DEVICE_ALT1_VENDOR="$$(DEVICE_ALT1_VENDOR)" \ + DEVICE_ALT1_MODEL="$$(DEVICE_ALT1_MODEL)" \ + DEVICE_ALT1_VARIANT="$$(DEVICE_ALT1_VARIANT)" \ + DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \ + DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \ + DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \ + DEVICE_TITLE="$$(DEVICE_TITLE)" \ + DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \ + TARGET="$(BOARD)" \ + SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \ + VERSION_NUMBER="$(VERSION_NUMBER)" \ + VERSION_CODE="$(VERSION_CODE)" \ + SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \ + $(TOPDIR)/scripts/json_add_image_info.py $$@ endef endif @@ -521,7 +536,7 @@ endef endif define Device/Build/kernel - $$(eval $$(foreach dts,$$(DEVICE_DTS), \ + $$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \ $$(call Device/Build/dtb,$$(notdir $$(dts)), \ $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ $$(dts) \ @@ -577,8 +592,10 @@ define Device/Build/image @mkdir -p $$(shell dirname $$@) DEVICE_ID="$(DEVICE_NAME)" \ BIN_DIR="$(BIN_DIR)" \ + SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ IMAGE_NAME="$(IMAGE_NAME)" \ IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \ + IMAGE_FILESYSTEM="$(1)" \ IMAGE_PREFIX="$(IMAGE_PREFIX)" \ DEVICE_VENDOR="$(DEVICE_VENDOR)" \ DEVICE_MODEL="$(DEVICE_MODEL)" \ @@ -639,7 +656,6 @@ Target-Profile-Name: $(DEVICE_DISPLAY) Target-Profile-Packages: $(DEVICE_PACKAGES) Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0) Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES) -$(if $(BROKEN),Target-Profile-Broken: $(BROKEN)) $(if $(DEFAULT),Target-Profile-Default: $(DEFAULT)) Target-Profile-Description: $(DEVICE_DESCRIPTION) @@ -690,8 +706,6 @@ define BuildImage prepare: compile: clean: - legacy-images-prepare: - legacy-images: image_prepare: ifeq ($(IB),) @@ -707,9 +721,6 @@ define BuildImage rm -rf $(BUILD_DIR)/json_info_files $(call Image/Prepare) - legacy-images-prepare-make: image_prepare - $(MAKE) legacy-images-prepare BIN_DIR="$(BIN_DIR)" - else image_prepare: mkdir -p $(BIN_DIR) $(KDIR)/tmp @@ -723,17 +734,12 @@ define BuildImage $(call Image/InstallKernel) $(foreach device,$(TARGET_DEVICES),$(call Device,$(device))) - $(foreach device,$(LEGACY_DEVICES),$(call LegacyDevice,$(device))) install-images: kernel_prepare $(foreach fs,$(filter-out $(if $(UBIFS_OPTS),,ubifs),$(TARGET_FILESYSTEMS) $(fs-subtypes-y)),$(KDIR)/root.$(fs)) $(foreach fs,$(TARGET_FILESYSTEMS), $(call Image/Build,$(fs)) ) - legacy-images-make: install-images - $(call Image/mkfs/ubifs/legacy) - $(MAKE) legacy-images BIN_DIR="$(BIN_DIR)" - install: install-images $(call Image/Manifest) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 32c91a5b8..32eb545b5 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -1,9 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org + include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/depends.mk @@ -105,7 +103,7 @@ define BuildKernel xargs $(TARGET_CROSS)nm | \ awk '$$$$1 == "U" { print $$$$2 } ' | \ sort -u > $(KERNEL_BUILD_DIR)/mod_symtab.txt - $(TARGET_CROSS)nm -n $(LINUX_DIR)/vmlinux.o | grep ' [rR] __ksymtab' | sed -e 's,........ [rR] __ksymtab_,,' > $(KERNEL_BUILD_DIR)/kernel_symtab.txt + $(TARGET_CROSS)nm -n $(LINUX_DIR)/vmlinux.o | awk '/^[0-9a-f]+ [rR] __ksymtab_/ {print substr($$$$3,11)}' > $(KERNEL_BUILD_DIR)/kernel_symtab.txt grep -Ff $(KERNEL_BUILD_DIR)/mod_symtab.txt $(KERNEL_BUILD_DIR)/kernel_symtab.txt > $(KERNEL_BUILD_DIR)/sym_include.txt grep -Fvf $(KERNEL_BUILD_DIR)/mod_symtab.txt $(KERNEL_BUILD_DIR)/kernel_symtab.txt > $(KERNEL_BUILD_DIR)/sym_exclude.txt ( \ @@ -157,21 +155,15 @@ define BuildKernel compile: $(LINUX_DIR)/.modules $(MAKE) -C image compile TARGET_BUILD= - oldconfig menuconfig nconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE + oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE rm -f $(LINUX_DIR)/.config.prev rm -f $(STAMP_CONFIGURED) $(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config $(_SINGLE)$(KERNEL_MAKE) \ - $(if $(findstring Darwin,$(HOST_OS)), \ - HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses" \ - HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \ - filechk_conf_cfg=" :" \ - ) \ + $(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \ YACC=$(STAGING_DIR_HOST)/bin/bison \ $$@ - $(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config | \ - grep -vE '(CONFIG_CC_(HAS_ASM_GOTO|IS_GCC|IS_CLANG)|GCC_VERSION)=' \ - > $(LINUX_RECONFIG_TARGET) + $(call LINUX_RECONF_DIFF,$(LINUX_DIR)/.config) > $(LINUX_RECONFIG_TARGET) install: $(LINUX_DIR)/.image +$(MAKE) -C image compile install TARGET_BUILD= diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index db93a53d7..bfa6a5ed9 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -1,12 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org ifdef CONFIG_STRIP_KERNEL_EXPORTS - KERNEL_MAKEOPTS += \ + KERNEL_MAKEOPTS_IMAGE += \ EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h" endif @@ -24,7 +21,7 @@ Kernel/Patch:=$(Kernel/Patch/Default) ifneq (,$(findstring .xz,$(LINUX_SOURCE))) LINUX_CAT:=xzcat else - LINUX_CAT:=zcat + LINUX_CAT:=gzip -dc endif ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") @@ -46,10 +43,20 @@ else rmdir $(LINUX_DIR); \ fi ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR) + if [ -d $(LINUX_DIR)/user_headers ]; then \ + rm -rf $(LINUX_DIR)/user_headers; \ + fi endef endif ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) + define Kernel/SetInitramfs/PreConfigure + grep -v -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config + echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config + echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config + endef + else ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"") define Kernel/SetInitramfs/PreConfigure grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config @@ -62,14 +69,19 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(LINUX_DIR)/.config endef endif +endif define Kernel/SetInitramfs rm -f $(LINUX_DIR)/.config.prev mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old $(call Kernel/SetInitramfs/PreConfigure) + ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config echo "$(if $(CONFIG_TARGET_INITRAMFS_FORCE),CONFIG_INITRAMFS_FORCE=y,# CONFIG_INITRAMFS_FORCE is not set)" >> $(LINUX_DIR)/.config + else + echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(LINUX_DIR)/.config + endif echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_DIR)/.config echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config @@ -77,6 +89,7 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(LINUX_DIR)/.config echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(LINUX_DIR)/.config echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),CONFIG_INITRAMFS_COMPRESSION_LZ4=y\nCONFIG_RD_LZ4=y,# CONFIG_INITRAMFS_COMPRESSION_LZ4 is not set\n# CONFIG_RD_LZ4 is not set)" >> $(LINUX_DIR)/.config + echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),CONFIG_INITRAMFS_COMPRESSION_ZSTD=y\nCONFIG_RD_ZSTD=y,# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set\n# CONFIG_RD_ZSTD is not set)" >> $(LINUX_DIR)/.config endef else endif @@ -105,7 +118,7 @@ define Kernel/Configure/Default cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ } $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install - grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic + grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic endef define Kernel/Configure/Initramfs @@ -114,7 +127,7 @@ endef define Kernel/CompileModules/Default rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map - +$(KERNEL_MAKE) modules + +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules endef OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id @@ -136,19 +149,38 @@ define Kernel/CopyImage } endef +# Always add "modules" so a proper Module.symvers file is written that +# also contains symbols from the kernel modules. Without these symbols +# external packages that depend on exported symbols from kernel modules +# will fail to build. define Kernel/CompileImage/Default rm -f $(TARGET_DIR)/init - +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules + +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules $(call Kernel/CopyImage) endef +# Here as well, always add "modules", see comment above. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) define Kernel/CompileImage/Initramfs $(call Kernel/Configure/Initramfs) $(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init) rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio* - +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) +ifeq ($(CONFIG_EXTERNAL_CPIO),y) + $(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio +else + ( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root > $(KERNEL_BUILD_DIR)/initrd.cpio ) +endif + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2) + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio) + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma) +# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),) + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio) +# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),) + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio) +endif + +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules $(call Kernel/CopyImage,-initramfs) endef else @@ -161,5 +193,3 @@ define Kernel/Clean/Default rm -f $(LINUX_KERNEL) $(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean endef - - diff --git a/include/kernel-version.mk b/include/kernel-version.mk index a82d981c5..fb18167cf 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -1,18 +1,16 @@ -# Use the default kernel version if the Makefile doesn't override it +# Use the default kernel version if the Makefile doesn't override it LINUX_RELEASE?=1 ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-4.14 = .195 -LINUX_VERSION-4.19 = .138 LINUX_VERSION-5.4 = .124 +LINUX_VERSION-5.10 = .43 -LINUX_KERNEL_HASH-4.14.195 = 394f28798670240baacd9e2cce521fbd79f8da5e1fc191695b0e11381445a021 -LINUX_KERNEL_HASH-4.19.138 = d15c27d05f6c527269b75b30cc72972748e55720e7e00ad8abbaa4fe3b1d5e02 LINUX_KERNEL_HASH-5.4.124 = f7f29dda2b042d7b5986d18274413131cf70e17288c05e9a683df1f46c507d82 +LINUX_KERNEL_HASH-5.10.43 = 83b81e433ba2f8ee143064fb163699ee857e26dd789006bc1e9edf1ccd0bd403 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/include/kernel.mk b/include/kernel.mk index 40aa1a516..e4074a48f 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org ifneq ($(filter check,$(MAKECMDGOALS)),) CHECK:=1 @@ -118,7 +115,11 @@ KERNEL_MAKE_FLAGS = \ CONFIG_SHELL="$(BASH)" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ $(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \ - cmd_syscalls= + cmd_syscalls= \ + $(if $(__package_mk),KBUILD_EXTRA_SYMBOLS="$(wildcard $(PKG_SYMVERS_DIR)/*.symvers)") + +KERNEL_NOSTDINC_FLAGS = \ + -nostdinc $(if $(DUMP),, -isystem $(shell $(TARGET_CC) -print-file-name=include)) ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),) KERNEL_MAKE_FLAGS += \ @@ -140,14 +141,6 @@ PKG_EXTMOD_SUBDIRS ?= . PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers -define populate_module_symvers - @mkdir -p $(PKG_SYMVERS_DIR) - cat /dev/null > $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers; \ - for subdir in $(PKG_EXTMOD_SUBDIRS); do \ - cat $(PKG_SYMVERS_DIR)/*.symvers 2>/dev/null > $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers; \ - done -endef - define collect_module_symvers for subdir in $(PKG_EXTMOD_SUBDIRS); do \ realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \ @@ -156,12 +149,12 @@ define collect_module_symvers grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \ done; \ sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \ + mkdir -p $(PKG_SYMVERS_DIR); \ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers endef define KernelPackage/hooks ifneq ($(PKG_NAME),kernel) - Hooks/Compile/Pre += populate_module_symvers Hooks/Compile/Post += collect_module_symvers endif define KernelPackage/hooks diff --git a/include/netfilter.mk b/include/netfilter.mk index c95bcb504..36de07d58 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2014 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org ifneq ($(__inc_netfilter),1) __inc_netfilter:=1 @@ -67,9 +64,7 @@ $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MARK, $(P_XT) # kernel only $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK, $(P_XT)nf_conntrack),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK_RTCACHE, $(P_XT)nf_conntrack_rtcache),)) $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV4, $(P_V4)nf_defrag_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_CONNTRACK_IPV4, $(P_V4)nf_conntrack_ipv4),)) $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_STATE, $(P_XT)xt_state)) $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_TARGET_CT, $(P_XT)xt_CT)) @@ -97,6 +92,7 @@ $(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_ADDRTYPE, $(if $(NF_KMO $(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_OWNER, $(P_XT)xt_owner)) $(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_PKTTYPE, $(P_XT)xt_pkttype)) $(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_QUOTA, $(P_XT)xt_quota)) +$(eval $(call nf_add,IPT_EXTRA,CONFIG_NETFILTER_XT_MATCH_CGROUP, $(P_XT)xt_cgroup)) #$(eval $(call nf_add,IPT_EXTRA,CONFIG_IP_NF_TARGET_ROUTE, $(P_V4)ipt_ROUTE)) @@ -109,6 +105,10 @@ $(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_ph $(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_STRING, $(P_XT)xt_string)) $(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf)) +# imq + +$(eval $(call nf_add,IPT_IMQ,CONFIG_IP_NF_TARGET_IMQ, $(P_V4)ipt_IMQ)) +$(eval $(call nf_add,IPT_IMQ,CONFIG_NETFILTER_XT_TARGET_IMQ, $(P_XT)xt_IMQ)) # ipopt @@ -122,7 +122,6 @@ $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_STATISTIC, $(P_XT)xt_st $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_TCPMSS, $(P_XT)xt_tcpmss)) $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_TARGET_CLASSIFY, $(P_XT)xt_CLASSIFY)) -$(eval $(call nf_add,IPT_IPOPT,CONFIG_IP_NF_MATCH_DSCP, $(P_V4)ipt_dscp)) $(eval $(call nf_add,IPT_IPOPT,CONFIG_IP_NF_TARGET_ECN, $(P_V4)ipt_ECN)) $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_ECN, $(P_XT)xt_ecn)) @@ -157,19 +156,15 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_REJECT6,CONFIG_NF_REJECT_IPV6, $(P_V6)nf $(eval $(if $(NF_KMOD),$(call nf_add,NF_IPT6,CONFIG_IP6_NF_IPTABLES, $(P_V6)ip6_tables),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV6, $(P_V6)nf_defrag_ipv6, ge 4.19),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK6,CONFIG_NF_DEFRAG_IPV6, $(P_V6)nf_defrag_ipv6, lt 4.19),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK6,CONFIG_NF_CONNTRACK_IPV6, $(P_V6)nf_conntrack_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV6, $(P_V6)nf_defrag_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_FILTER, $(P_V6)ip6table_filter),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_MANGLE, $(P_V6)ip6table_mangle),)) -$(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_QUEUE, $(P_V6)ip6_queue),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_IPV6,CONFIG_NF_LOG_IPV6, $(P_V6)nf_log_ipv6),)) $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, ip6t_icmp6))) -$(eval $(call nf_add,IPT_IPV6,CONFIG_IP6_NF_TARGET_LOG, $(P_V6)ip6t_LOG)) $(eval $(call nf_add,IPT_IPV6,CONFIG_IP6_NF_TARGET_REJECT, $(P_V6)ip6t_REJECT)) # ipv6 extra @@ -185,26 +180,18 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt)) # kernel only $(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT, $(P_XT)nf_nat),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_REDIRECT, $(P_XT)nf_nat_redirect),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_IPV4, $(P_V4)nf_nat_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_MASQUERADE_IPV4, $(P_V4)nf_nat_masquerade_ipv4, lt 4.18),)) - -$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT6,CONFIG_NF_NAT_IPV6, $(P_V6)nf_nat_ipv6),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT6,CONFIG_NF_NAT_MASQUERADE_IPV6, $(P_V6)nf_nat_masquerade_ipv6, lt 4.18),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_NAT, $(P_XT)xt_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT,CONFIG_IP_NF_NAT, $(P_V4)iptable_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_NAT, $(P_V6)ip6table_nat),)) -$(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_MASQUERADE, $(P_V6)ip6t_MASQUERADE, lt 5.2),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, $(P_V6)ip6t_NPT),)) # userland only $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT,CONFIG_NF_NAT, ipt_SNAT ipt_DNAT))) $(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, ip6t_DNPT ip6t_SNPT))) -$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_MASQUERADE, $(P_V4)ipt_MASQUERADE, lt 5.2)) -$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_MASQUERADE, $(P_XT)xt_MASQUERADE, ge 5.2)) -$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_REDIRECT, $(P_XT)xt_REDIRECT)) +$(eval $(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_TARGET_MASQUERADE, $(P_XT)xt_MASQUERADE)) +$(eval $(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_TARGET_REDIRECT, $(P_XT)xt_REDIRECT)) # nat-extra @@ -223,8 +210,6 @@ $(eval $(call nf_add,NF_NATHELPER,CONFIG_NF_NAT_FTP, $(P_XT)nf_nat_ftp)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_BROADCAST, $(P_XT)nf_conntrack_broadcast)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_AMANDA, $(P_XT)nf_conntrack_amanda)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_AMANDA, $(P_XT)nf_nat_amanda)) -$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CT_PROTO_GRE, $(P_XT)nf_conntrack_proto_gre)) -$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_PROTO_GRE, $(P_V4)nf_nat_proto_gre)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_H323, $(P_XT)nf_conntrack_h323)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_H323, $(P_V4)nf_nat_h323)) $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_PPTP, $(P_XT)nf_conntrack_pptp)) @@ -264,8 +249,8 @@ $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_sock $(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6)) $(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPROXY)) -$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4, ge 4.18)) -$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6, ge 4.18)) +$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4)) +$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6)) # led $(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED)) @@ -335,15 +320,9 @@ $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nf # nftables $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES, $(P_XT)nf_tables),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_INET, $(P_XT)nf_tables_inet, lt 4.17),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV4, $(P_V4)nf_tables_ipv4, lt 4.17),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, $(P_V6)nf_tables_ipv6, lt 4.17),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_SET, $(P_XT)nf_tables_set, ge 4.18),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, $(P_V4)nft_chain_route_ipv4),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, $(P_V6)nft_chain_route_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_SET, $(P_XT)nf_tables_set),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_COUNTER, $(P_XT)nft_counter),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_EXTHDR, $(P_XT)nft_exthdr),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, $(P_XT)nft_hash),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LIMIT, $(P_XT)nft_limit),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),)) @@ -354,23 +333,17 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, $(P_XT)nft_quota $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, $(P_XT)nft_redir),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT, $(P_XT)nft_reject $(P_V4)nft_reject_ipv4 $(P_V6)nft_reject_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT_INET, $(P_XT)nft_reject_inet),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, $(P_XT)nft_set_hash, lt 4.18),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, $(P_XT)nft_set_rbtree, lt 4.18),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_ARP,CONFIG_NF_TABLES_ARP, $(P_V4)nf_tables_arp, lt 4.17),)) - -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NF_TABLES_BRIDGE, $(P_EBT)nf_tables_bridge, lt 4.17),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_META, $(P_EBT)nft_meta_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EBT)nft_reject_bridge),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_CHAIN_NAT_IPV4, $(P_V4)nft_chain_nat_ipv4),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_chain_nat),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ, $(P_XT)nft_masq),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ_IPV4, $(P_V4)nft_masq_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6),)) -$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_CHAIN_NAT_IPV6, $(P_V6)nft_chain_nat_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_MASQ_IPV6, $(P_V6)nft_masq_ipv6),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB, $(P_XT)nft_fib),)) @@ -378,6 +351,7 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_INET, $(P_XT)nft_fib $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV4, $(P_V4)nft_fib_ipv4),)) $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV6, $(P_V6)nft_fib_ipv6),)) +$(eval $(if $(NF_KMOD),$(call nf_add,NFT_QUEUE,CONFIG_NFT_QUEUE, $(P_XT)nft_queue),)) # userland only IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m) diff --git a/include/nls.mk b/include/nls.mk index 04838821b..742f8c25a 100644 --- a/include/nls.mk +++ b/include/nls.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2011-2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2011-2020 OpenWrt.org # iconv full ifeq ($(CONFIG_BUILD_NLS),y) diff --git a/include/package-bin.mk b/include/package-bin.mk index 4ae049af5..192f0726d 100644 --- a/include/package-bin.mk +++ b/include/package-bin.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2007-2014 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2007-2020 OpenWrt.org ifeq ($(DUMP),) define BuildTarget/bin diff --git a/include/package-defaults.mk b/include/package-defaults.mk index 2fed72b1a..3ee3a965f 100644 --- a/include/package-defaults.mk +++ b/include/package-defaults.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread @@ -59,6 +56,7 @@ define Package/Default ALTERNATIVES:= LICENSE:=$(PKG_LICENSE) LICENSE_FILES:=$(PKG_LICENSE_FILES) + FILE_MODES:=$(PKG_FILE_MODES) endef Build/Patch:=$(Build/Patch/Default) diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index ef98c482f..597452e4b 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org ifneq ($(DUMP),) @@ -24,8 +21,7 @@ $(if $(MENU),Menu: $(MENU) )$(if $(DEFAULT),Default: $(DEFAULT) )$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1 )Version: $(VERSION) -$(if $(ABI_VERSION),ABIVersion: $(ABI_VERSION) -)Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) +Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) Conflicts: $(CONFLICTS) Menu-Depends: $(MDEPENDS) Provides: $(PROVIDES) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index 569edcbf0..b066e116f 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -1,23 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2014 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org ifndef DUMP include $(INCLUDE_DIR)/feeds.mk endif -# invoke ipkg-build with some default options -IPKG_BUILD:= \ - $(SCRIPT_DIR)/ipkg-build -c -o 0 -g 0 - IPKG_REMOVE:= \ $(SCRIPT_DIR)/ipkg-remove IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg +# Generates a make statement to return a wildcard for candidate ipkg files +# 1: package name +define gen_ipkg_wildcard + $(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])* +endef + +# 1: package name +# 2: candidate ipk files +define remove_ipkg_files + $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2)) +endef + # 1: package name # 2: variable name # 3: variable suffix @@ -94,7 +99,7 @@ _endef=endef ifeq ($(DUMP),) define BuildTarget/ipkg - ABIV_$(1):=$(call GetABISuffix,$(1)) + ABIV_$(1):=$(if $(filter-out kmod-%,$(1)),$(ABI_VERSION)) PDIR_$(1):=$(call FeedPackageDir,$(1)) IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) @@ -151,7 +156,12 @@ ifeq ($(DUMP),) $(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed mkdir -p $(STAGING_DIR_ROOT)/stamp - $(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version) + $(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || { \ + echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version; \ + $(foreach pkg,$(filter-out $(1),$(PROVIDES)), \ + cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version; \ + ) \ + } ) $(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy) touch $$@ @@ -165,7 +175,7 @@ Package: $(1)$$(ABIV_$(1)) Version: $(VERSION) $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) )$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS)) -)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(call GetABISuffix,$(provide)))))) +)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1)))))) )$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES)) )$$(call addfield,Source,$(SOURCE) )$$(call addfield,SourceName,$(1) @@ -173,6 +183,8 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS) )$$(call addfield,LicenseFiles,$(LICENSE_FILES) )$$(call addfield,Section,$(SECTION) )$$(call addfield,Require-User,$(USERID) +)$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH) +)$$(if $$(ABIV_$(1)),ABIVersion: $$(ABIV_$(1)) )$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID) )$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed )$(if $(filter essential,$(PKG_FLAGS)),Essential: yes @@ -184,8 +196,10 @@ $(_endef) $$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL) $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description) $$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG) + $$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH) $(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk - @rm -rf $$(IDIR_$(1)) $$(if $$(call opkg_package_files,$(1)*),; $$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*)) + @rm -rf $$(IDIR_$(1)); \ + $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1)))) mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR) $(call Package/$(1)/install,$$(IDIR_$(1))) $(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay) @@ -207,8 +221,8 @@ $(_endef) ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),) (cd $$(IDIR_$(1)); \ ( \ - find . -type f \! -path ./CONTROL/\* -exec sha256sum \{\} \; 2> /dev/null | \ - sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \ + find . -type f \! -path ./CONTROL/\* -exec $(MKHASH) sha256 -n \{\} \; 2> /dev/null | \ + sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \ ) || true \ ) endif @@ -221,13 +235,13 @@ $(_endef) ( \ echo "#!/bin/sh"; \ echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \ - echo "[ -x "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \ + echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \ echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \ echo "default_postinst \$$$$0 \$$$$@"; \ ) > postinst; \ ( \ echo "#!/bin/sh"; \ - echo "[ -x "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \ + echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \ echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \ echo "default_prerm \$$$$0 \$$$$@"; \ ) > prerm; \ @@ -249,11 +263,11 @@ $(_endef) endif $(INSTALL_DIR) $$(PDIR_$(1)) - $(IPKG_BUILD) $$(IDIR_$(1)) $$(PDIR_$(1)) + $(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1)) @[ -f $$(IPKG_$(1)) ] $(1)-clean: - $$(if $$(call opkg_package_files,$(1)*),$$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*)) + $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1)))) clean: $(1)-clean diff --git a/include/package-seccomp.mk b/include/package-seccomp.mk index fa49617d4..86e834450 100644 --- a/include/package-seccomp.mk +++ b/include/package-seccomp.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2015-2020 OpenWrt.org PKG_CONFIG_DEPENDS+= CONFIG_KERNEL_SECCOMP diff --git a/include/package.mk b/include/package.mk index 057569274..fc1bb7d67 100644 --- a/include/package.mk +++ b/include/package.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2008 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org __package_mk:=1 @@ -19,6 +16,8 @@ PKG_IREMAP ?= 1 MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) +PKG_SOURCE_DATE_EPOCH:=$(if $(DUMP),,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(CURDIR))) + ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) PKG_JOBS?=-j1 else @@ -59,7 +58,7 @@ include $(INCLUDE_DIR)/quilt.mk find_library_dependencies = \ $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ - $(sort $(foreach dep4, \ + $(filter-out $(BUILD_PACKAGES), $(sort $(foreach dep4, \ $(sort $(foreach dep3, \ $(sort $(foreach dep2, \ $(sort $(foreach dep1, \ @@ -74,7 +73,7 @@ find_library_dependencies = \ $(Package/$(dep3)/depends) $(dep3) \ )), \ $(Package/$(dep4)/depends) $(dep4) \ - )), \ + ))) \ )) @@ -173,7 +172,6 @@ define Build/Exports/Default $(1) : export CONFIG_SITE:=$$(CONFIG_SITE) $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH) $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH) - $(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache) endef Build/Exports=$(Build/Exports/Default) @@ -185,6 +183,8 @@ define Build/CoreTargets $(call Build/Autoclean) $(call DefaultTargets) + $(DL_DIR)/$(FILE): FORCE + download: $(foreach hook,$(Hooks/Download), $(call $(hook))$(sep) @@ -223,7 +223,7 @@ define Build/CoreTargets $(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG) $(STAMP_INSTALLED): $(STAMP_BUILT) rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME) - mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages + mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages $(foreach hook,$(Hooks/InstallDev/Pre),\ $(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\ ) @@ -342,9 +342,9 @@ clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build) clean: force-clean-build $(CleanStaging) - $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR)/host) + $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST)) $(Build/Clean) - rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) + rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST) dist: $(Build/Dist) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 83dad0f2d..639d1ad0f 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/prereq.mk @@ -14,8 +11,8 @@ PKG_NAME:=Build dependency # Required for the toolchain $(eval $(call TestHostCommand,working-make, \ - Please install GNU make v3.82 or later. (This version has bugs), \ - $(MAKE) -v | grep -E 'Make (3\.8[2-9]|3\.9[0-9]|[4-9]\.)')) + Please install GNU make v4.1 or later., \ + $(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)')) $(eval $(call TestHostCommand,case-sensitive-fs, \ OpenWrt can only be built on a case-sensitive filesystem, \ @@ -26,37 +23,37 @@ $(eval $(call TestHostCommand,proper-umask, \ Please build with umask 022 - other values produce broken packages, \ umask | grep -xE 0?0[012][012])) +ifndef IB $(eval $(call SetupHostCommand,gcc, \ - Please install the GNU C Compiler (gcc) 4.8 or later, \ - $(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ - gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ + Please install the GNU C Compiler (gcc) 6 or later, \ + $(CC) -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \ + gcc -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \ gcc --version | grep -E 'Apple.(LLVM|clang)' )) $(eval $(call TestHostCommand,working-gcc, \ - \nPlease reinstall the GNU C Compiler (4.8 or later) - \ + Please reinstall the GNU C Compiler (6 or later) - \ it appears to be broken, \ echo 'int main(int argc, char **argv) { return 0; }' | \ gcc -x c -o $(TMP_DIR)/a.out -)) $(eval $(call SetupHostCommand,g++, \ - Please install the GNU C++ Compiler (g++) 4.8 or later, \ - $(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ - g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ + Please install the GNU C++ Compiler (g++) 6 or later, \ + $(CXX) -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \ + g++ -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \ g++ --version | grep -E 'Apple.(LLVM|clang)' )) $(eval $(call TestHostCommand,working-g++, \ - \nPlease reinstall the GNU C++ Compiler (4.8 or later) - \ + Please reinstall the GNU C++ Compiler (6 or later) - \ it appears to be broken, \ echo 'int main(int argc, char **argv) { return 0; }' | \ g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \ $(TMP_DIR)/a.out)) -ifndef IB $(eval $(call TestHostCommand,ncurses, \ Please install ncurses. (Missing libncurses.so or ncurses.h), \ echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \ gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses)) -endif +endif # IB ifeq ($(HOST_OS),Linux) zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic @@ -68,11 +65,22 @@ $(eval $(call TestHostCommand,perl-data-dumper, \ Please install the Perl Data::Dumper module, \ perl -MData::Dumper -e 1)) +$(eval $(call TestHostCommand,perl-findbin, \ + Please install the Perl FindBin module, \ + perl -MFindBin -e 1)) + +$(eval $(call TestHostCommand,perl-file-copy, \ + Please install the Perl File::Copy module, \ + perl -MFile::Copy -e 1)) + +$(eval $(call TestHostCommand,perl-file-compare, \ + Please install the Perl File::Compare module, \ + perl -MFile::Compare -e 1)) + $(eval $(call TestHostCommand,perl-thread-queue, \ Please install the Perl Thread::Queue module, \ perl -MThread::Queue -e 1)) - $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \ gtar --version 2>&1 | grep GNU, \ gnutar --version 2>&1 | grep GNU, \ @@ -114,10 +122,15 @@ $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \ ggrep --version 2>&1 | grep GNU, \ grep --version 2>&1 | grep GNU)) +$(eval $(call SetupHostCommand,egrep,Please install GNU 'grep', \ + gegrep --version 2>&1 | grep GNU, \ + egrep --version 2>&1 | grep GNU)) + $(eval $(call SetupHostCommand,getopt, \ Please install an extended getopt version that supports --long, \ gnugetopt -o t --long test -- --test | grep '^ *--test *--', \ - getopt -o t --long test -- --test | grep '^ *--test *--')) + getopt -o t --long test -- --test | grep '^ *--test *--', \ + /usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--')) $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ gnustat -c%s $(TOPDIR)/Makefile, \ @@ -134,24 +147,28 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ wget --version | grep GNU)) +$(eval $(call SetupHostCommand,install,Please install GNU 'install', \ + install --version | grep GNU, \ + ginstall --version | grep GNU)) + $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) $(eval $(call CleanupPython2)) -$(eval $(call SetupHostCommand,python,Please install Python >= 3.5, \ +$(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \ + python3.9 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \ python3.6 -V 2>&1 | grep 'Python 3', \ - python3.5 -V 2>&1 | grep 'Python 3', \ - python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?')) + python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?')) -$(eval $(call SetupHostCommand,python3,Please install Python >= 3.5, \ +$(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \ + python3.9 -V 2>&1 | grep 'Python 3', \ python3.8 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \ python3.6 -V 2>&1 | grep 'Python 3', \ - python3.5 -V 2>&1 | grep 'Python 3', \ - python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?')) + python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?')) $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \ git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule)) @@ -159,6 +176,12 @@ $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \ $(eval $(call SetupHostCommand,file,Please install the 'file' package, \ file --version 2>&1 | grep file)) +$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \ + rsync --version $(1)/usr/lib/opkg/status.new mv $(1)/usr/lib/opkg/status.new $(1)/usr/lib/opkg/status - -find $(1)/usr/lib/opkg -empty | $(XARGS) rm -rf + -find $(1)/usr/lib/opkg -empty -delete endef endif @@ -69,7 +69,7 @@ define prepare_rootfs @( \ cd $(1); \ for script in ./usr/lib/opkg/info/*.postinst; do \ - IPKG_INSTROOT=$(1) $$(which bash) $$script; \ + IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \ ret=$$?; \ if [ $$ret -ne 0 ]; then \ echo "postinst script $$script has failed with exit code $$ret" >&2; \ @@ -79,24 +79,22 @@ define prepare_rootfs for script in ./etc/init.d/*; do \ grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \ if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \ - IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \ + IPKG_INSTROOT=$(1) $$(command -v bash) ./etc/rc.common $$script enable; \ echo "Enabling" $$(basename $$script); \ else \ - IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script disable; \ + IPKG_INSTROOT=$(1) $$(command -v bash) ./etc/rc.common $$script disable; \ echo "Disabling" $$(basename $$script); \ fi; \ done || true \ ) $(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status) - @-find $(1) -name CVS | $(XARGS) rm -rf - @-find $(1) -name .svn | $(XARGS) rm -rf - @-find $(1) -name .git | $(XARGS) rm -rf - @-find $(1) -name '.#*' | $(XARGS) rm -f - rm -rf $(1)/tmp/* - rm -f $(1)/usr/lib/opkg/lists/* - rm -f $(1)/usr/lib/opkg/info/*.postinst* - rm -f $(1)/var/lock/*.lock - rm -rf $(1)/boot + @-find $(1) -name CVS -o -name .svn -o -name .git -o -name '.#*' | $(XARGS) rm -rf + rm -rf \ + $(1)/boot \ + $(1)/tmp/* \ + $(1)/usr/lib/opkg/info/*.postinst* \ + $(1)/usr/lib/opkg/lists/* \ + $(1)/var/lock/*.lock $(call clean_ipkg,$(1)) $(call mklibs,$(1)) $(if $(SOURCE_DATE_EPOCH),find $(1)/ -mindepth 1 -execdir touch -hcd "@$(SOURCE_DATE_EPOCH)" "{}" +) diff --git a/include/scan.mk b/include/scan.mk index 7df5dc648..aee24cb3e 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -1,4 +1,5 @@ include $(TOPDIR)/include/verbose.mk +include $(TOPDIR)/rules.mk TMP_DIR:=$(TOPDIR)/tmp all: $(TMP_DIR)/.$(SCAN_TARGET) @@ -100,7 +101,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST) $(TARGET_STAMP):: +( \ $(NO_TRACE_MAKE) $(FILELIST); \ - MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \ + MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | $(MKHASH) md5 | awk '{print $$1}'); \ [ -f "$@.$$MD5SUM" ] || { \ rm -f $@.*; \ touch $@.$$MD5SUM; \ diff --git a/include/shell.sh b/include/shell.sh old mode 100644 new mode 100755 diff --git a/include/subdir.mk b/include/subdir.mk index 6512e24c2..be080859b 100644 --- a/include/subdir.mk +++ b/include/subdir.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2007-2020 OpenWrt.org ifeq ($(MAKECMDGOALS),prereq) SUBTARGETS:=prereq @@ -23,7 +20,7 @@ define subtarget endef define ERROR - ($(call MESSAGE, $(2)); $(if $(BUILD_LOG), echo "$(2)" >> $(BUILD_LOG_DIR)/$(1)/error.txt)) + ($(call MESSAGE, $(2)); $(if $(BUILD_LOG), echo "$(2)" >> $(BUILD_LOG_DIR)/$(1)/error.txt;) $(if $(3),, exit 1;)) endef lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1))) @@ -66,7 +63,7 @@ define subdir $(foreach btype,$(buildtypes-$(bd)), $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype)))) $(call log_make,$(1)/$(bd),$(target),$(btype),$(filter-out __default,$(variant))) \ - $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) [$(btype)] failed to build.)) + || $(call ERROR,$(2), ERROR: $(1)/$(bd) [$(btype)] failed to build.,$(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target)))) $(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target))) ) $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(NO_DEPS)$(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))) @@ -74,7 +71,7 @@ define subdir $(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd)/$(filter-out __default,$(variant))) $(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant)))) $(call log_make,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))) \ - $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).)) + || $(call ERROR,$(1), ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).,$(findstring $(bd),$($(1)/builddirs-ignore-$(target)))) ) $(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),, # aliases diff --git a/include/target.mk b/include/target.mk index 4ffbe2985..8b20cda2e 100644 --- a/include/target.mk +++ b/include/target.mk @@ -1,10 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2007-2008 OpenWrt.org # Copyright (C) 2016 LEDE Project -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# ifneq ($(__target_inc),1) __target_inc=1 @@ -13,19 +10,25 @@ __target_inc=1 DEVICE_TYPE?=router # Default packages - the really basic set -DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd urandom-seed urngd \ -block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw wget libustream-openssl ca-certificates \ -default-settings luci luci-app-ddns luci-app-upnp luci-app-autoreboot luci-app-webadmin \ +DEFAULT_PACKAGES:=base-files libc libgcc dropbear mtd uci opkg netifd fstools uclient-fetch logd urandom-seed urngd \ +block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw wget-ssl libustream-openssl ca-certificates \ +default-settings luci luci-app-ddns luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot luci-newapi \ luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic \ luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramfree \ luci-app-sfe luci-app-nlbwmon luci-app-accesscontrol luci-app-cpufreq \ ddns-scripts_aliyun ddns-scripts_dnspod -# For the basic set -DEFAULT_PACKAGES.basic:= + +ifneq ($(CONFIG_SELINUX),) +DEFAULT_PACKAGES+=busybox-selinux procd-selinux +else +DEFAULT_PACKAGES+=busybox procd +endif + # For nas targets DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm # For router targets DEFAULT_PACKAGES.router:=dnsmasq-full iptables ppp ppp-mod-pppoe firewall +DEFAULT_PACKAGES.bootloader:= ifneq ($(DUMP),) all: dumpinfo @@ -156,11 +159,11 @@ ifeq ($(CONFIG_TARGET),env) LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config endif -__linux_confcmd = $(SCRIPT_DIR)/kconfig.pl $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1) +__linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1) -LINUX_CONF_CMD = $(call __linux_confcmd,$(LINUX_KCONFIG_LIST),) -LINUX_RECONF_CMD = $(call __linux_confcmd,$(LINUX_RECONFIG_LIST),) -LINUX_RECONF_DIFF = $(call __linux_confcmd,$(filter-out $(LINUX_RECONFIG_TARGET),$(LINUX_RECONFIG_LIST)),'>') +LINUX_CONF_CMD = $(SCRIPT_DIR)/kconfig.pl $(call __linux_confcmd,$(LINUX_KCONFIG_LIST)) +LINUX_RECONF_CMD = $(SCRIPT_DIR)/kconfig.pl $(call __linux_confcmd,$(LINUX_RECONFIG_LIST)) +LINUX_RECONF_DIFF = $(SCRIPT_DIR)/kconfig.pl - '>' $(call __linux_confcmd,$(filter-out $(LINUX_RECONFIG_TARGET),$(LINUX_RECONFIG_LIST))) $(1) $(GENERIC_PLATFORM_DIR)/config-filter ifeq ($(DUMP),1) BuildTarget=$(BuildTargets/DumpCurrent) @@ -175,13 +178,15 @@ ifeq ($(DUMP),1) CPU_CFLAGS += -mno-branch-likely CPU_CFLAGS_mips32 = -mips32 -mtune=mips32 CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64 + CPU_CFLAGS_mips64r2 = -mips64r2 -mtune=mips64r2 -mabi=64 + CPU_CFLAGS_4kec = -mips32r2 -mtune=4kec CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64 endif ifeq ($(ARCH),i386) - CPU_TYPE ?= pentium - CPU_CFLAGS_pentium = -march=pentium-mmx + CPU_TYPE ?= pentium-mmx + CPU_CFLAGS_pentium-mmx = -march=pentium-mmx CPU_CFLAGS_pentium4 = -march=pentium4 endif ifneq ($(findstring arm,$(ARCH)),) diff --git a/include/toolchain-build.mk b/include/toolchain-build.mk index 35d8c9380..b7a253b71 100644 --- a/include/toolchain-build.mk +++ b/include/toolchain-build.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2009 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2009-2020 OpenWrt.org override CONFIG_AUTOREBUILD= override CONFIG_AUTOREMOVE= diff --git a/include/toplevel.mk b/include/toplevel.mk index 5cf93ce7e..f5a2593a1 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -1,14 +1,10 @@ -# Makefile for OpenWrt -# -# Copyright (C) 2007-2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. +# SPDX-License-Identifier: GPL-2.0-only # +# Copyright (C) 2007-2020 OpenWrt.org PREP_MK= OPENWRT_BUILD= QUIET=0 -export IS_TTY=$(shell tty -s && echo 1 || echo 0) +export IS_TTY=$(if $(MAKE_TERMOUT),1,0) include $(TOPDIR)/include/verbose.mk @@ -19,7 +15,6 @@ else SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh) endif -HOSTCC ?= $(CC) export REVISION export SOURCE_DATE_EPOCH export GIT_CONFIG_PARAMETERS='core.autocrlf=false' @@ -29,6 +24,12 @@ export GNU_HOST_NAME:=$(shell $(TOPDIR)/scripts/config.guess) export HOST_OS:=$(shell uname) export HOST_ARCH:=$(shell uname -m) +ifeq ($(HOST_OS),Darwin) + ifneq ($(filter /Applications/Xcode.app/% /Library/Developer/%,$(MAKE)),) + $(error Please use a newer version of GNU make. The version shipped by Apple is not supported) + endif +endif + # prevent perforce from messing with the patch utility unexport P4PORT P4USER P4CONFIG P4CLIENT @@ -53,13 +54,6 @@ export PATH:=$(path) unexport TAR_OPTIONS -ifneq ($(shell $(HOSTCC) 2>&1 | grep clang),) - export HOSTCC_REAL?=$(HOSTCC) - export HOSTCC_WRAPPER:=$(TOPDIR)/scripts/clang-gcc-wrapper -else - export HOSTCC_WRAPPER:=$(HOSTCC) -endif - ifeq ($(FORCE),) .config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build endif @@ -91,6 +85,7 @@ prepare-tmpinfo: FORCE [ tmp/.config-feeds.in -nt tmp/.packageauxvars ] || ./scripts/feeds feed_config > tmp/.config-feeds.in ./scripts/package-metadata.pl mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; } ./scripts/package-metadata.pl pkgaux tmp/.packageinfo > tmp/.packageauxvars || { rm -f tmp/.packageauxvars; false; } + ./scripts/package-metadata.pl usergroup tmp/.packageinfo > tmp/.packageusergroup || { rm -f tmp/.packageusergroup; false; } touch $(TOPDIR)/tmp/.build .config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo) @@ -108,7 +103,7 @@ endif scripts/config/%onf: CFLAGS+= -O2 scripts/config/%onf: @$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \ - -C scripts/config $(notdir $@) CC="$(HOSTCC_WRAPPER)" + -C scripts/config $(notdir $@) $(eval $(call rdep,scripts/config,scripts/config/mconf)) @@ -141,6 +136,13 @@ menuconfig: scripts/config/mconf prepare-tmpinfo FORCE [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \ $< Config.in +nconfig: scripts/config/nconf prepare-tmpinfo FORCE + if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \ + cp $(HOME)/.openwrt/defconfig .config; \ + fi + [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \ + $< Config.in + xconfig: scripts/config/qconf prepare-tmpinfo FORCE if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \ cp $(HOME)/.openwrt/defconfig .config; \ @@ -162,6 +164,7 @@ kernel_oldconfig: prepare_kernel_conf ifneq ($(DISTRO_PKG_CONFIG),) kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) kernel_nconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) +kernel_xconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) endif kernel_menuconfig: prepare_kernel_conf $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig @@ -169,6 +172,9 @@ kernel_menuconfig: prepare_kernel_conf kernel_nconfig: prepare_kernel_conf $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux nconfig +kernel_xconfig: prepare_kernel_conf + $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux xconfig + staging_dir/host/.prereq-build: include/prereq-build.mk mkdir -p tmp @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ @@ -249,10 +255,10 @@ package/symlinks-clean: ./scripts/feeds uninstall -a help: - cat README + cat README.md distclean: - rm -rf bin build_dir .config* dl feeds key-build* logs package/feeds package/openwrt-packages staging_dir tmp + rm -rf bin build_dir .ccache .config* dl feeds key-build* logs package/feeds staging_dir tmp @$(_SINGLE)$(SUBMAKE) -C scripts/config clean ifeq ($(findstring v,$(DEBUG)),) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk new file mode 100644 index 000000000..dd740c45f --- /dev/null +++ b/include/trusted-firmware-a.mk @@ -0,0 +1,95 @@ +PKG_NAME ?= trusted-firmware-a +PKG_CPE_ID ?= cpe:/a:arm:arm_trusted_firmware + +ifndef PKG_SOURCE_PROTO +PKG_SOURCE = trusted-firmware-a-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot +endif + +PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_TARGETS := bin +PKG_FLAGS:=nonshared + +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=docs/license.rst + +PKG_BUILD_PARALLEL:=1 + +export GCC_HONOUR_COPTS=s + +define Package/trusted-firmware-a/install/default + $(CP) $(patsubst %,$(PKG_BUILD_DIR)/build/$(PLAT)/release/%,$(TFA_IMAGE)) $(1)/ +endef + +Package/trusted-firmware-a/install = $(Package/trusted-firmware-a/install/default) + +define Trusted-Firmware-A/Init + BUILD_TARGET:= + BUILD_SUBTARGET:= + BUILD_DEVICES:= + NAME:= + DEPENDS:= + HIDDEN:= + DEFAULT:= + PLAT:= + VARIANT:=$(1) + TFA_IMAGE:= +endef + +TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) + +define Build/Trusted-Firmware-A/Target + $(eval $(call Trusted-Firmware-A/Init,$(1))) + $(eval $(call Trusted-Firmware-A/Default,$(1))) + $(eval $(call Trusted-Firmware-A/$(1),$(1))) + + define Package/trusted-firmware-a-$(1) + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=Trusted-Firmware-A for $(NAME) + VARIANT:=$(VARIANT) + DEPENDS:=@!IN_SDK $(DEPENDS) + HIDDEN:=$(HIDDEN) + ifneq ($(BUILD_TARGET),) + DEPENDS += @$(TARGET_DEP) + ifneq ($(BUILD_DEVICES),) + DEFAULT := y if ($(TARGET_DEP)_Default \ + $(patsubst %,|| $(TARGET_DEP)_DEVICE_%,$(BUILD_DEVICES)) \ + $(patsubst %,|| $(patsubst TARGET_%,TARGET_DEVICE_%,$(TARGET_DEP))_DEVICE_%,$(BUILD_DEVICES))) + endif + endif + $(if $(DEFAULT),DEFAULT:=$(DEFAULT)) + URL:=https://www.trustedfirmware.org/projects/tf-a/ + endef + + define Package/trusted-firmware-a-$(1)/install + $$(Package/trusted-firmware-a/install) + endef +endef + + +define Build/Compile/Trusted-Firmware-A + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ + CROSS_COMPILE=$(TARGET_CROSS) \ + OPENSSL_DIR=$(STAGING_DIR_HOST) \ + PLAT=$(PLAT) \ + BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ + $(TFA_MAKE_FLAGS) +endef + +define BuildPackage/Trusted-Firmware-A/Defaults + Build/Configure/Default = $$$$(Build/Configure/Trusted-Firmware-A) + Build/Compile/Default = $$$$(Build/Compile/Trusted-Firmware-A) +endef + +define BuildPackage/Trusted-Firmware-A + $(eval $(call BuildPackage/Trusted-Firmware-A/Defaults)) + $(foreach type,$(if $(DUMP),$(TFA_TARGETS),$(BUILD_VARIANT)), \ + $(eval $(call Build/Trusted-Firmware-A/Target,$(type))) + ) + $(eval $(call Build/DefaultTargets)) + $(foreach type,$(if $(DUMP),$(TFA_TARGETS),$(BUILD_VARIANT)), \ + $(call BuildPackage,trusted-firmware-a-$(type)) + ) +endef diff --git a/include/uclibc++.mk b/include/uclibc++.mk index 27533279c..a1a61f26d 100644 --- a/include/uclibc++.mk +++ b/include/uclibc++.mk @@ -4,8 +4,8 @@ ifndef DUMP endif endif -PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX CONFIG_USE_LIBCXX -CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBCXX:libcxx +USE_LIBSTDCXX:libstdcpp +PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX +CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp ifneq ($(CONFIG_USE_UCLIBCXX),) ifneq ($(CONFIG_CCACHE),) @@ -14,11 +14,3 @@ ifneq ($(CONFIG_USE_UCLIBCXX),) TARGET_CXX=g++-uc endif endif - -ifneq ($(CONFIG_USE_LIBCXX),) - ifneq ($(CONFIG_CCACHE),) - TARGET_CXX_NOCACHE=g++-libcxx - else - TARGET_CXX=g++-libcxx - endif -endif diff --git a/include/unpack.mk b/include/unpack.mk index 5bb27d41c..6a56b8e74 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006-2007 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org HOST_TAR:=$(TAR) TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS) diff --git a/include/verbose.mk b/include/verbose.mk index d26008019..3ecf842d1 100644 --- a/include/verbose.mk +++ b/include/verbose.mk @@ -1,9 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only # -# Copyright (C) 2006 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2020 OpenWrt.org ifndef OPENWRT_VERBOSE OPENWRT_VERBOSE:= diff --git a/include/version.mk b/include/version.mk index 7d3c1ad64..bbc690818 100644 --- a/include/version.mk +++ b/include/version.mk @@ -1,10 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2012-2015 OpenWrt.org # Copyright (C) 2016 LEDE Project -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# # Substituted by SDK, do not remove # REVISION:=x @@ -26,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),21.02-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/21.02-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) @@ -108,4 +105,3 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \ -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \ -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \ -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' - diff --git a/package/Makefile b/package/Makefile index 58c1ba2bb..209be3467 100644 --- a/package/Makefile +++ b/package/Makefile @@ -11,6 +11,7 @@ include $(INCLUDE_DIR)/feeds.mk include $(INCLUDE_DIR)/rootfs.mk -include $(TMP_DIR)/.packagedeps +package-y += kernel/linux $(curdir)/autoremove:=1 $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m)) $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m)) @@ -65,8 +66,10 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(if $(CONFIG_TARGET_PER_DE - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755 rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG) mkdir -p $(TARGET_DIR)/tmp - $(call opkg,$(TARGET_DIR)) install \ - $(call opkg_package_files,$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))) + $(file >$(TMP_DIR)/opkg_install_list,\ + $(call opkg_package_files,\ + $(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))) + $(call opkg,$(TARGET_DIR)) install $$(cat $(TMP_DIR)/opkg_install_list) @for file in $(PACKAGE_INSTALL_FILES); do \ [ -s $$file.flags ] || continue; \ for flag in `cat $$file.flags`; do \ @@ -84,7 +87,7 @@ $(curdir)/index: FORCE mkdir -p $$d; \ cd $$d || continue; \ $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \ - grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages; \ + grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)' Packages.manifest > Packages; \ case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \ $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \ { echo ""; echo ""; } >> Packages;; \ diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 7e0d34170..89a8551cc 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2007-2016 OpenWrt.org +# Copyright (C) 2007-2021 OpenWrt.org # Copyright (C) 2010 Vertical Communications # # This is free software, licensed under the GNU General Public License v2. @@ -12,8 +12,8 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=225 PKG_FLAGS:=nonshared +PKG_RELEASE:=$(COMMITCOUNT) PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ PKG_BUILD_DEPENDS:=usign/host ucert/host @@ -30,14 +30,14 @@ PKG_CONFIG_DEPENDS += \ include $(INCLUDE_DIR)/package.mk ifneq ($(DUMP),1) - STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) + STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5) TARGET:=-$(BOARD) endif define Package/base-files SECTION:=base CATEGORY:=Base system - DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool + DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool TITLE:=Base filesystem for OpenWrt URL:=http://openwrt.org/ VERSION:=$(PKG_RELEASE)-$(REVISION) @@ -47,7 +47,6 @@ define Package/base-files/conffiles /etc/config/ /etc/config/network /etc/config/system -/etc/crontabs/ /etc/dropbear/ /etc/ethers /etc/group @@ -109,14 +108,12 @@ ifdef CONFIG_SIGNED_PACKAGES endef -ifndef CONFIG_BUILDBOT define Package/base-files/install-key mkdir -p $(1)/etc/opkg/keys $(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub` endef endif -endif ifeq ($(CONFIG_NAND_SUPPORT),) define Package/base-files/nand-support @@ -192,16 +189,12 @@ define Package/base-files/install $(if $(CONFIG_INCLUDE_CONFIG), \ echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.config; \ - cat $(BIN_DIR)/config.buildinfo >>$(1)/etc/build.config; \ - cat $(BIN_DIR)/feeds.buildinfo >>$(1)/etc/build.feeds; \ - cat $(BIN_DIR)/version.buildinfo >>$(1)/etc/build.version) + cat $(BIN_DIR)/config.seed >>$(1)/etc/build.config) $(if $(CONFIG_CLEAN_IPKG),, \ mkdir -p $(1)/etc/opkg; \ $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf); \ $(VERSION_SED_SCRIPT) $(1)/etc/opkg/distfeeds.conf) - $(if $(CONFIG_IPK_FILES_CHECKSUMS),, \ - rm -f $(1)/sbin/pkg_check) endef ifneq ($(DUMP),1) diff --git a/package/base-files/files/bin/board_detect b/package/base-files/files/bin/board_detect index 441db6a08..840bd0178 100755 --- a/package/base-files/files/bin/board_detect +++ b/package/base-files/files/bin/board_detect @@ -5,7 +5,7 @@ CFG=$1 [ -n "$CFG" ] || CFG=/etc/board.json [ -d "/etc/board.d/" -a ! -s "$CFG" ] && { - for a in `ls /etc/board.d/*`; do + for a in $(ls /etc/board.d/*); do [ -x $a ] || continue; $(. $a) done diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index b8665f262..3cd0b3f60 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -7,6 +7,35 @@ CFG=/etc/board.json [ -s $CFG ] || /bin/board_detect || exit 1 [ -s /etc/config/network -a -s /etc/config/system ] && exit 0 +generate_bridge() { + local name=$1 + local macaddr=$2 + uci -q batch <<-EOF + set network.$name=device + set network.$name.name=$name + set network.$name.type=bridge + EOF + if [ -n "$macaddr" ]; then + uci -q batch <<-EOF + set network.$name.macaddr=$macaddr + EOF + fi +} + +bridge_vlan_id=0 +generate_bridge_vlan() { + local name=$1_vlan + local device=$2 + local ports="$3" + local vlan="$4" + uci -q batch <<-EOF + set network.$name=bridge-vlan + set network.$name.device='$device' + set network.$name.vlan='$vlan' + set network.$name.ports='$ports' + EOF +} + generate_static_network() { uci -q batch <<-EOF delete network.loopback @@ -62,20 +91,47 @@ generate_static_network() { addr_offset=2 generate_network() { - local ifname macaddr protocol type ipaddr netmask + local ports ifname macaddr protocol type ipaddr netmask vlan + local bridge=$2 json_select network json_select "$1" - json_get_vars ifname macaddr protocol ipaddr netmask + json_get_values ports ports + json_get_vars ifname macaddr protocol ipaddr netmask vlan json_select .. json_select .. - [ -n "$ifname" ] || return + [ -n "$ifname" -o -n "$ports" ] || return - # force bridge for multi-interface devices (and lan) - case "$1:$ifname" in - *\ * | lan:*) type="bridge" ;; - esac + # Force bridge for "lan" as it may have other devices (e.g. wireless) + # bridged + [ "$1" = "lan" -a -z "$ports" ] && { + ports="$ifname" + } + + [ -n "$ports" -a -z "$bridge" ] && { + uci -q batch <<-EOF + add network device + set network.@device[-1].name='br-$1' + set network.@device[-1].type='bridge' + set network.@device[-1].macaddr='$macaddr' + EOF + for port in $ports; do uci add_list network.@device[-1].ports="$port"; done + ifname=br-$1 + type= + macaddr="" + } + + [ -n "$bridge" ] && { + [ -z "$ports" ] && ports="$ifname" + if [ -z "$vlan" ]; then + bridge_vlan_id=$((bridge_vlan_id + 1)) + vlan=$bridge_vlan_id + fi + generate_bridge_vlan $1 $bridge "$ports" $vlan + ifname=$bridge.$vlan + type="" + } uci -q batch <<-EOF delete network.$1 @@ -236,7 +292,6 @@ generate_switch() { json_select .. } - generate_static_system() { uci -q batch <<-EOF delete system.@system[0] @@ -254,7 +309,7 @@ generate_static_system() { add_list system.ntp.server='ntp1.aliyun.com' add_list system.ntp.server='time1.cloud.tencent.com' add_list system.ntp.server='time.ustc.edu.cn' - add_list system.ntp.server='cn.pool.ntp.org' + add_list system.ntp.server='pool.ntp.org' EOF if json_is_a system object; then @@ -426,14 +481,22 @@ generate_gpioswitch() { json_init json_load "$(cat ${CFG})" -umask 077 - if [ ! -s /etc/config/network ]; then + bridge_name="" touch /etc/config/network generate_static_network + json_get_vars bridge + [ -n "$bridge" ] && { + json_select bridge + json_get_vars name macaddr + generate_bridge "$name" "$macaddr" + json_select .. + bridge_name=$name + } + json_get_keys keys network - for key in $keys; do generate_network $key; done + for key in $keys; do generate_network $key $bridge_name; done json_get_keys keys switch for key in $keys; do generate_switch $key; done diff --git a/package/base-files/files/etc/bench.log b/package/base-files/files/etc/bench.log new file mode 100644 index 000000000..e69de29bb diff --git a/package/base-files/files/etc/diag.sh b/package/base-files/files/etc/diag.sh old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/hotplug.d/net/00-sysctl b/package/base-files/files/etc/hotplug.d/net/00-sysctl old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 21aecde61..974b68860 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -20,7 +20,6 @@ uci_apply_defaults() { boot() { [ -f /proc/mounts ] || /sbin/mount_root [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc - [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD mkdir -p /var/run mkdir -p /var/log @@ -34,7 +33,10 @@ boot() { mkdir -p /tmp/resolv.conf.d touch /tmp/resolv.conf.d/resolv.conf.auto ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf + ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf.auto grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug + grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf + grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe /sbin/kmodloader diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 932a69a82..51cb8b517 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -21,7 +21,7 @@ load_led() { config_get dev $1 dev config_get ports $1 port config_get mode $1 mode - config_get_bool default $1 default "nil" + config_get_bool default $1 default "0" config_get delayon $1 delayon config_get delayoff $1 delayoff config_get interval $1 interval "50" @@ -31,10 +31,11 @@ load_led() { config_get gpio $1 gpio "0" config_get inverted $1 inverted "0" - if [ "$trigger" = "rssi" ]; then - # handled by rssileds userspace process - return - fi + # execute application led trigger + [ -f "/usr/libexec/led-trigger/${trigger}" ] && { + . "/usr/libexec/led-trigger/${trigger}" + return 0 + } [ "$trigger" = "usbdev" ] && { # Backward compatibility: translate to the new trigger diff --git a/package/base-files/files/etc/init.d/system b/package/base-files/files/etc/init.d/system index 0e33c522b..08cf86b97 100755 --- a/package/base-files/files/etc/init.d/system +++ b/package/base-files/files/etc/init.d/system @@ -27,7 +27,7 @@ system_config() { ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ # apply timezone to kernel - busybox date -k + hwclock -u --systz } reload_service() { diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index 0beff1608..9a3ac069a 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -1,3 +1,4 @@ +#!/bin/sh [ -e /tmp/.failsafe ] && export FAILSAFE=1 [ -f /etc/banner ] && cat /etc/banner @@ -12,7 +13,6 @@ export PATH="%PATH%" export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) export HOME=${HOME:-/root} export PS1='\u@\h:\w\$ ' -export ENV=/etc/shinit case "$TERM" in xterm*|rxvt*) @@ -20,6 +20,16 @@ case "$TERM" in ;; esac +[ -x /bin/more ] || alias more=less +[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi + +alias ll='ls -alF --color=auto' + +[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc + +[ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; } +[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } + [ -n "$FAILSAFE" ] || { for FILE in /etc/profile.d/*.sh; do [ -e "$FILE" ] && . "$FILE" @@ -38,3 +48,12 @@ in order to prevent unauthorized SSH logins. -------------------------------------------------- EOF fi + +service() { + [ -f "/etc/init.d/$1" ] || { + echo "service "'"'"$1"'"'" not found, the following services are available:" + ls "/etc/init.d" + return 1 + } + /etc/init.d/$@ +} diff --git a/package/base-files/files/etc/rc.local b/package/base-files/files/etc/rc.local old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/shinit b/package/base-files/files/etc/shinit old mode 100644 new mode 100755 index 6b715c1ef..6b682d876 --- a/package/base-files/files/etc/shinit +++ b/package/base-files/files/etc/shinit @@ -1,4 +1,4 @@ -[ -x /bin/more ] || alias more=less +[ -x /bin/more ] || [ -x /usr/bin/more ] || alias more=less [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi alias ll='ls -alF --color=auto' @@ -9,12 +9,24 @@ alias ll='ls -alF --color=auto' [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } service() { - [ -f "/etc/init.d/$1" ] || { - echo "service "'"'"$1"'"'" not found, the following services are available:" - ls "/etc/init.d" + if [ -f "/etc/init.d/$1" ]; then + /etc/init.d/$@ + else + echo "Usage: service [command]" + if [ -n "$1" ]; then + echo "Service "'"'"$1"'"'" not found, the following services are available:" + else + echo "The following services are available:" + fi + for F in /etc/init.d/* ; do + printf "%-30s\t%10s\t%10s\n" "$F" \ + $( $($F enabled) && echo "enabled" || echo "disabled" ) \ + $( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \ + | jsonfilter -q -e "@['$(basename $F)'].instances[*].running" | uniq)" = "true" ] \ + && echo "running" || echo "stopped" ) + done; return 1 - } - /etc/init.d/$@ + fi } [ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit" diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf index bc8c57969..46d079b36 100644 --- a/package/base-files/files/etc/sysctl.d/10-default.conf +++ b/package/base-files/files/etc/sysctl.d/10-default.conf @@ -8,8 +8,6 @@ fs.suid_dumpable=2 fs.protected_hardlinks=1 fs.protected_symlinks=1 -net.core.bpf_jit_enable=1 - net.ipv4.conf.default.arp_ignore=1 net.ipv4.conf.all.arp_ignore=1 net.ipv4.ip_forward=1 diff --git a/package/base-files/files/etc/uci-defaults/10_migrate-shadow b/package/base-files/files/etc/uci-defaults/10_migrate-shadow old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/12_network-generate-ula b/package/base-files/files/etc/uci-defaults/12_network-generate-ula old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/13_fix-group-user b/package/base-files/files/etc/uci-defaults/13_fix-group-user old mode 100644 new mode 100755 index bf9febdfe..74f501e8f --- a/package/base-files/files/etc/uci-defaults/13_fix-group-user +++ b/package/base-files/files/etc/uci-defaults/13_fix-group-user @@ -1,6 +1,6 @@ . /lib/functions.sh -for file in `grep -sl Require-User /usr/lib/opkg/info/*.control`; do +for file in $(grep -sl Require-User /usr/lib/opkg/info/*.control); do file="${file##*/}" file="${file%.control}" add_group_and_user "${file}" diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh old mode 100755 new mode 100644 index a77b66970..f528b10ac --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Copyright (C) 2006-2014 OpenWrt.org # Copyright (C) 2006 Fokus Fraunhofer # Copyright (C) 2010 Vertical Communications @@ -70,7 +69,7 @@ config () { local cfgtype="$1" local name="$2" - export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$((CONFIG_NUM_SECTIONS + 1)) + export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1)) name="${name:-cfg$CONFIG_NUM_SECTIONS}" append CONFIG_SECTIONS "$name" export ${NO_EXPORT:+-n} CONFIG_SECTION="$name" @@ -93,7 +92,7 @@ list() { config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0 [ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}" - len=$((len + 1)) + len=$(($len + 1)) config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value" config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len" append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP" @@ -108,20 +107,27 @@ config_unset() { # config_get