add kernel 5.10 support and sync with upstream

This commit is contained in:
lean 2021-06-14 18:30:08 +08:00
parent 7883a5d2e6
commit 7a50383ab6
6093 changed files with 354969 additions and 425752 deletions

3
.gitignore vendored
View File

@ -27,3 +27,6 @@ TAGS*~
git-src git-src
.git-credentials .git-credentials
/*.log /*.log
.project
.cproject
.ccache

View File

@ -1,7 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
world ${.TARGETS}: world ${.TARGETS}:
@gmake $@ @gmake $@

12
COPYING Normal file
View File

@ -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.

View File

@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006-2013 OpenWrt.org # 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" mainmenu "OpenWrt Configuration"

340
LICENSE
View File

@ -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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
<signature of Ty Coon>, 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.

View File

@ -1,10 +1,6 @@
# Makefile for OpenWrt # SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007 OpenWrt.org # Copyright (C) 2007 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
TOPDIR:=${CURDIR} TOPDIR:=${CURDIR}
LC_ALL:=C LC_ALL:=C
@ -62,6 +58,11 @@ dirclean: clean
rm -rf $(TMP_DIR) rm -rf $(TMP_DIR)
$(MAKE) -C $(TOPDIR)/scripts/config clean $(MAKE) -C $(TOPDIR)/scripts/config clean
cacheclean:
ifneq ($(CONFIG_CCACHE),)
$(STAGING_DIR_HOST)/bin/ccache -C
endif
ifndef DUMP_TARGET_DB ifndef DUMP_TARGET_DB
$(BUILD_DIR)/.prepared: Makefile $(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@) @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 package/index
$(_SINGLE)$(SUBMAKE) -r json_overview_image_info $(_SINGLE)$(SUBMAKE) -r json_overview_image_info
$(_SINGLE)$(SUBMAKE) -r checksum $(_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 .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean

View File

@ -1,9 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006-2013 OpenWrt.org # Copyright (C) 2006-2013 OpenWrt.org
# Copyright (C) 2016 LEDE Project # 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" menu "Global build settings"
@ -56,13 +54,12 @@ menu "Global build settings"
If the target supports a newer kernel version than the default, If the target supports a newer kernel version than the default,
you can use this config option to enable it you can use this config option to enable it
config DISPLAY_SUPPORT config DISPLAY_SUPPORT
bool "Show packages that require graphics support (local or remote)" bool "Show packages that require graphics support (local or remote)"
default n default n
config BUILD_PATENTED config BUILD_PATENTED
default n default y
bool "Compile with support for patented functionality" bool "Compile with support for patented functionality"
help help
When this option is disabled, software which provides patented functionality 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 This removes all ipkg/opkg status data files from the target directory
before building the root filesystem. 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 config INCLUDE_CONFIG
bool "Include build configuration in firmware" if DEVEL bool "Include build configuration in firmware" if DEVEL
default n default n
help 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 config COLLECT_KERNEL_DEBUG
bool bool
@ -173,6 +171,14 @@ menu "Global build settings"
help help
Specifies arguments passed to the strip command when stripping binaries. 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 config STRIP_KERNEL_EXPORTS
bool "Strip unnecessary exports from the kernel image" bool "Strip unnecessary exports from the kernel image"
help help
@ -198,10 +204,6 @@ menu "Global build settings"
config USE_UCLIBCXX config USE_UCLIBCXX
bool "uClibc++" bool "uClibc++"
config USE_LIBCXX
bool "libc++"
depends on !USE_UCLIBC
config USE_LIBSTDCXX config USE_LIBSTDCXX
bool "libstdc++" bool "libstdc++"
endchoice endchoice
@ -256,10 +258,8 @@ menu "Global build settings"
bool "None" bool "None"
config PKG_CC_STACKPROTECTOR_REGULAR config PKG_CC_STACKPROTECTOR_REGULAR
bool "Regular" bool "Regular"
depends on KERNEL_CC_STACKPROTECTOR_REGULAR
config PKG_CC_STACKPROTECTOR_STRONG config PKG_CC_STACKPROTECTOR_STRONG
bool "Strong" bool "Strong"
depends on KERNEL_CC_STACKPROTECTOR_STRONG
endchoice endchoice
choice choice
@ -321,4 +321,46 @@ menu "Global build settings"
bool "Full" bool "Full"
endchoice 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 endmenu

View File

@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006-2013 OpenWrt.org # 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 menuconfig DEVEL
bool "Advanced configuration options (for developers)" bool "Advanced configuration options (for developers)"
@ -65,10 +63,17 @@ menuconfig DEVEL
config CCACHE config CCACHE
bool "Use ccache" if DEVEL bool "Use ccache" if DEVEL
default n default y
help help
Compiler cache; see https://ccache.samba.org/ 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 config EXTERNAL_KERNEL_TREE
string "Use external kernel tree" if DEVEL string "Use external kernel tree" if DEVEL
default "" default ""
@ -100,18 +105,16 @@ menuconfig DEVEL
It can be a git hash or a branch name. It can be a git hash or a branch name.
If unused, the clone's repository HEAD will be checked-out. 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 config BUILD_LOG
bool "Enable log files during build process" if DEVEL bool "Enable log files during build process" if DEVEL
help help
If enabled, log files will be written to the ./log directory. 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 config SRC_TREE_OVERRIDE
bool "Enable package source tree override" if DEVEL bool "Enable package source tree override" if DEVEL
help help

View File

@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006-2013 OpenWrt.org # 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" menu "Target Images"
@ -15,12 +13,12 @@ menu "Target Images"
choice choice
prompt "Compression" prompt "Compression"
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx 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_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_lantiq
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips 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 default TARGET_INITRAMFS_COMPRESSION_NONE
depends on TARGET_ROOTFS_INITRAMFS depends on TARGET_ROOTFS_INITRAMFS
help help
@ -39,13 +37,19 @@ menu "Target Images"
bool "lzma" bool "lzma"
config TARGET_INITRAMFS_COMPRESSION_LZO config TARGET_INITRAMFS_COMPRESSION_LZO
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
bool "lzo" bool "lzo"
config TARGET_INITRAMFS_COMPRESSION_LZ4 config TARGET_INITRAMFS_COMPRESSION_LZ4
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
bool "lz4" bool "lz4"
config TARGET_INITRAMFS_COMPRESSION_XZ config TARGET_INITRAMFS_COMPRESSION_XZ
bool "xz" bool "xz"
config TARGET_INITRAMFS_COMPRESSION_ZSTD
depends on !LINUX_5_4 && !LINUX_4_19
bool "zstd"
endchoice endchoice
config EXTERNAL_CPIO config EXTERNAL_CPIO
@ -62,6 +66,15 @@ menu "Target Images"
help help
Ignore the initramfs passed by the bootloader. 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" comment "Root filesystem archives"
config TARGET_ROOTFS_CPIOGZ config TARGET_ROOTFS_CPIOGZ
@ -81,6 +94,7 @@ menu "Target Images"
menuconfig TARGET_ROOTFS_EXT4FS menuconfig TARGET_ROOTFS_EXT4FS
bool "ext4" bool "ext4"
default y if USES_EXT4 default y if USES_EXT4
default n if TARGET_x86
help help
Build an ext4 root filesystem. Build an ext4 root filesystem.
@ -122,6 +136,13 @@ menu "Target Images"
help help
Create an ext4 filesystem with a journal. 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 config TARGET_ROOTFS_JFFS2
bool "jffs2" bool "jffs2"
depends on USES_JFFS2 depends on USES_JFFS2
@ -186,32 +207,32 @@ menu "Target Images"
config GRUB_IMAGES config GRUB_IMAGES
bool "Build GRUB images (Linux x86 or x86_64 host only)" bool "Build GRUB images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 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
default y default y
config GRUB_EFI_IMAGES config EFI_IMAGES
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)" bool "Build EFI GRUB images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 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
select PACKAGE_grub2-efi select PACKAGE_grub2-efi
select PACKAGE_kmod-fs-vfat
default y default y
config GRUB_CONSOLE config GRUB_CONSOLE
bool "Use Console Terminal (in addition to Serial)" bool "Use Console Terminal (in addition to Serial)"
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || EFI_IMAGES
default y default y
config GRUB_SERIAL config GRUB_SERIAL
string "Serial port device" string "Serial port device"
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || EFI_IMAGES
default "ttyS0" default "hvc0" if TARGET_x86_xen_domu
default "ttyS0" if ! TARGET_x86_xen_domu
config GRUB_BAUDRATE config GRUB_BAUDRATE
int "Serial port baud rate" 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 38400 if TARGET_x86_generic
default 115200 default 115200
@ -222,47 +243,67 @@ menu "Target Images"
config GRUB_BOOTOPTS config GRUB_BOOTOPTS
string "Extra kernel boot options" 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 help
If you don't know, just leave it blank. If you don't know, just leave it blank.
config GRUB_TIMEOUT config GRUB_TIMEOUT
string "Seconds to wait before booting the default entry" string "Seconds to wait before booting the default entry"
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || EFI_IMAGES
default "0" default "0"
help help
If you don't know, 5 seconds is a reasonable default. If you don't know, 5 seconds is a reasonable default.
config GRUB_TITLE config GRUB_TITLE
string "Title for the menu entry in GRUB" string "Title for the menu entry in GRUB"
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || EFI_IMAGES
default "OpenWrt" default "OpenWrt"
help help
This is the title of the GRUB menu entry. This is the title of the GRUB menu entry.
If unspecified, it defaults to OpenWrt. 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 config VDI_IMAGES
bool "Build VirtualBox image files (VDI)" bool "Build VirtualBox image files (VDI)"
depends on TARGET_x86 depends on TARGET_x86 || TARGET_x86_64
depends on GRUB_IMAGES || GRUB_EFI_IMAGES select GRUB_IMAGES
select TARGET_IMAGES_PAD
select PACKAGE_kmod-e1000 select PACKAGE_kmod-e1000
config VMDK_IMAGES config VMDK_IMAGES
bool "Build VMware image files (VMDK)" bool "Build VMware image files (VMDK)"
depends on TARGET_x86 depends on TARGET_x86 || TARGET_x86_64
depends on GRUB_IMAGES || GRUB_EFI_IMAGES select GRUB_IMAGES
default y select TARGET_IMAGES_PAD
select PACKAGE_kmod-e1000 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 config TARGET_IMAGES_GZIP
bool "GZip images" bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS || TARGET_x86
default n default y
default n if TARGET_x86
comment "Image Options" comment "Image Options"
@ -270,21 +311,21 @@ menu "Target Images"
config TARGET_KERNEL_PARTSIZE config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MB)" 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 8 if TARGET_apm821xx_sata
default 64 if TARGET_bcm27xx default 64 if TARGET_bcm27xx
default 16 default 16
config TARGET_ROOTFS_PARTSIZE config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MB)" 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 default 160
help help
Select the root filesystem partition size. Select the root filesystem partition size.
config TARGET_ROOTFS_PARTNAME config TARGET_ROOTFS_PARTNAME
string "Root partition on target device" string "Root partition on target device"
depends on GRUB_IMAGES || GRUB_EFI_IMAGES depends on GRUB_IMAGES || EFI_IMAGES
help help
Override the root partition on the final device. If left empty, Override the root partition on the final device. If left empty,
it will be mounted by PARTUUID which makes the kernel find the it will be mounted by PARTUUID which makes the kernel find the

View File

@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2006-2014 OpenWrt.org # 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 config KERNEL_BUILD_USER
string "Custom Kernel Build User Name" string "Custom Kernel Build User Name"
@ -35,6 +33,10 @@ config KERNEL_SWAP
bool "Support for paging of anonymous memory (swap)" bool "Support for paging of anonymous memory (swap)"
default y if !SMALL_FLASH 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 config KERNEL_DEBUG_FS
bool "Compile the kernel with debug filesystem enabled" bool "Compile the kernel with debug filesystem enabled"
default y default y
@ -44,15 +46,10 @@ config KERNEL_DEBUG_FS
write to these files. Many common debugging facilities, such as write to these files. Many common debugging facilities, such as
ftrace, require the existence of debugfs. 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 config KERNEL_MIPS_FP_SUPPORT
bool bool
default y if KERNEL_MIPS_FPU_EMULATOR default y
depends on (mips || mipsel || mips64 || mips64el)
config KERNEL_ARM_PMU config KERNEL_ARM_PMU
bool bool
@ -90,126 +87,6 @@ config KERNEL_PROFILING
Enable the extended profiling support mechanisms used by profilers such Enable the extended profiling support mechanisms used by profilers such
as OProfile. 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 config KERNEL_TASKSTATS
bool "Compile the kernel with task resource/io statistics and accounting" bool "Compile the kernel with task resource/io statistics and accounting"
default n default n
@ -272,6 +149,40 @@ config KERNEL_FUNCTION_PROFILER
depends on KERNEL_FUNCTION_TRACER depends on KERNEL_FUNCTION_TRACER
default n 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 config KERNEL_DEBUG_KERNEL
bool bool
default n default n
@ -333,10 +244,6 @@ config KERNEL_KPROBES
instrumentation and testing. instrumentation and testing.
If in doubt, say "N". If in doubt, say "N".
config KERNEL_KPROBE_EVENT
bool
default y if KERNEL_KPROBES
config KERNEL_KPROBE_EVENTS config KERNEL_KPROBE_EVENTS
bool bool
default y if KERNEL_KPROBES default y if KERNEL_KPROBES
@ -345,6 +252,10 @@ config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support" bool "Compile the kernel with asynchronous IO support"
default y if !SMALL_FLASH 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 config KERNEL_FHANDLE
bool "Compile the kernel with support for fhandle syscalls" bool "Compile the kernel with support for fhandle syscalls"
default y if !SMALL_FLASH 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" bool "Compile the kernel with SCSI generic v4 support for any block device"
default n 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 config KERNEL_MAGIC_SYSRQ
bool "Compile the kernel with SysRq support" bool "Compile the kernel with SysRq support"
default y default y
@ -382,74 +318,6 @@ config KERNEL_PROVE_LOCKING
select KERNEL_DEBUG_KERNEL select KERNEL_DEBUG_KERNEL
default n 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 config KERNEL_PRINTK_TIME
bool "Enable printk timestamps" bool "Enable printk timestamps"
default y default y
@ -514,20 +382,20 @@ endif
config KERNEL_KEYS config KERNEL_KEYS
bool "Enable kernel access key retention support" bool "Enable kernel access key retention support"
default n default !SMALL_FLASH
config KERNEL_PERSISTENT_KEYRINGS config KERNEL_PERSISTENT_KEYRINGS
bool "Enable kernel persistent keyrings" bool "Enable kernel persistent keyrings"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n default n
config KERNEL_BIG_KEYS config KERNEL_KEYS_REQUEST_CACHE
bool "Enable large payload keys on kernel keyrings" bool "Enable temporary caching of the last request_key() result"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n default n
config KERNEL_ENCRYPTED_KEYS config KERNEL_BIG_KEYS
tristate "Enable keys with encrypted payloads on kernel keyrings" bool "Enable large payload keys on kernel keyrings"
depends on KERNEL_KEYS depends on KERNEL_KEYS
default n default n
@ -551,21 +419,29 @@ if KERNEL_CGROUPS
config KERNEL_FREEZER config KERNEL_FREEZER
bool bool
default y if KERNEL_CGROUP_FREEZER
config KERNEL_CGROUP_FREEZER config KERNEL_CGROUP_FREEZER
bool "Freezer cgroup subsystem" bool "legacy Freezer cgroup subsystem"
default y default n
select KERNEL_FREEZER
help help
Provides a way to freeze and unfreeze all tasks in a Provides a way to freeze and unfreeze all tasks in a
cgroup. cgroup.
(legacy cgroup1-only controller, in cgroup2 freezer
is integrated in the Memory controller)
config KERNEL_CGROUP_DEVICE config KERNEL_CGROUP_DEVICE
bool "Device controller for cgroups" bool "legacy Device controller for cgroups"
default y default n
help help
Provides a cgroup implementing whitelists for devices which Provides a cgroup implementing whitelists for devices which
a process in the cgroup can mknod or open. 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 config KERNEL_CGROUP_PIDS
bool "PIDs cgroup subsystem" bool "PIDs cgroup subsystem"
@ -574,6 +450,14 @@ if KERNEL_CGROUPS
Provides enforcement of process number limits in the scope of a Provides enforcement of process number limits in the scope of a
cgroup. 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 config KERNEL_CPUSETS
bool "Cpuset support" bool "Cpuset support"
default y if !SMALL_FLASH default y if !SMALL_FLASH
@ -609,6 +493,7 @@ if KERNEL_CGROUPS
config KERNEL_MEMCG config KERNEL_MEMCG
bool "Memory Resource Controller for Control Groups" bool "Memory Resource Controller for Control Groups"
default y if !SMALL_FLASH default y if !SMALL_FLASH
select KERNEL_FREEZER
depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18 depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18
help help
Provides a memory resource controller that manages both anonymous Provides a memory resource controller that manages both anonymous
@ -631,7 +516,7 @@ if KERNEL_CGROUPS
config KERNEL_MEMCG_SWAP config KERNEL_MEMCG_SWAP
bool "Memory Resource Controller Swap Extension" bool "Memory Resource Controller Swap Extension"
default n default y if !SMALL_FLASH
depends on KERNEL_MEMCG depends on KERNEL_MEMCG
help help
Add swap management feature to memory resource controller. When you 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. files in a cgroup which can be useful for debugging.
config KERNEL_NET_CLS_CGROUP config KERNEL_NET_CLS_CGROUP
bool "Control Group Classifier" bool "legacy Control Group Classifier"
default y default n
config KERNEL_CGROUP_NET_CLASSID
bool "legacy Network classid cgroup"
default n
config KERNEL_CGROUP_NET_PRIO config KERNEL_CGROUP_NET_PRIO
bool "Network priority cgroup" bool "legacy Network priority cgroup"
default y default n
endif endif
@ -778,7 +667,7 @@ endif
config KERNEL_NAMESPACES config KERNEL_NAMESPACES
bool "Enable kernel namespaces" bool "Enable kernel namespaces"
default y if !SMALL_FLASH default n
if KERNEL_NAMESPACES if KERNEL_NAMESPACES
@ -847,13 +736,13 @@ config KERNEL_POSIX_MQUEUE
config KERNEL_SECCOMP_FILTER config KERNEL_SECCOMP_FILTER
bool bool
default y if !SMALL_FLASH default n
config KERNEL_SECCOMP config KERNEL_SECCOMP
bool "Enable seccomp support" bool "Enable seccomp support"
depends on !(TARGET_uml) depends on !(TARGET_uml)
select KERNEL_SECCOMP_FILTER select KERNEL_SECCOMP_FILTER
default y if !SMALL_FLASH default n
help help
Build kernel with support for seccomp. Build kernel with support for seccomp.
@ -893,6 +782,15 @@ if KERNEL_IPV6
config KERNEL_IPV6_PIMSM_V2 config KERNEL_IPV6_PIMSM_V2
def_bool n 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 endif
# #
@ -979,7 +877,7 @@ menu "Filesystem ACL and attr support options"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR 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" bool "Enable POSIX ACL for HFS+ Filesystems"
select KERNEL_FS_POSIX_ACL select KERNEL_FS_POSIX_ACL
default y if USE_FS_ACL_ATTR 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 2 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
default 3 default 3
config KERNEL_SQUASHFS_XATTR
bool "Squashfs XATTR support"
# #
# compile optimiziation setting # compile optimiziation setting
# #
@ -1057,3 +958,59 @@ config KERNEL_CC_OPTIMIZE_FOR_SIZE
your compiler resulting in a smaller kernel. your compiler resulting in a smaller kernel.
endchoice 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"

View File

@ -1,9 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007-2012 OpenWrt.org # Copyright (C) 2007-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2. ifneq ($(__autotools_inc),1)
# See /LICENSE for more information. __autotools_inc=1
#
autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2)) autoconf_bool = $(patsubst %,$(if $($(1)),--enable,--disable)-%,$(2))
@ -65,6 +65,12 @@ define patch_libtool
); );
endef 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_LIBTOOL_PATHS?=$(CONFIGURE_PATH)
PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH) PKG_AUTOMAKE_PATHS?=$(CONFIGURE_PATH)
@ -87,7 +93,7 @@ endef
define gettext_version_target define gettext_version_target
(cd $(PKG_BUILD_DIR) && \ (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 \ $(STAGING_DIR_HOST)/bin/sed \
-i $(PKG_BUILD_DIR)/configure.ac \ -i $(PKG_BUILD_DIR)/configure.ac \
-e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \ -e "s/AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION(\[$$$$GETTEXT_VERSION\])/g" && \
@ -113,6 +119,10 @@ ifneq ($(filter libtool,$(PKG_FIXUP)),)
endif endif
endif endif
ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),)
Hooks/Configure/Post += set_libtool_abiver
endif
ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),) ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
PKG_BUILD_DEPENDS += libtool gettext libiconv PKG_BUILD_DEPENDS += libtool gettext libiconv
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),) ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
@ -145,12 +155,8 @@ define patch_libtool_host
$(HOST_BUILD_DIR))) $(HOST_BUILD_DIR)))
endef endef
ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
Hooks/HostConfigure/Pre += patch_libtool_host
endif
ifneq ($(filter patch-libtool,$(HOST_FIXUP)),) ifneq ($(filter patch-libtool,$(HOST_FIXUP)),)
Hooks/HostConfigure/Pre += $(strip $(call patch_libtool,$(HOST_BUILD_DIR))) Hooks/HostConfigure/Pre += patch_libtool_host
endif endif
ifneq ($(filter libtool,$(HOST_FIXUP)),) ifneq ($(filter libtool,$(HOST_FIXUP)),)
@ -170,3 +176,5 @@ ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
Hooks/HostConfigure/Pre += autoreconf_host Hooks/HostConfigure/Pre += autoreconf_host
endif endif
endif endif
endif #__autotools_inc

View File

@ -4,6 +4,7 @@ PKG_INSTALL:=1
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
MAKE_FLAGS+=VERBOSE=1 MAKE_FLAGS+=VERBOSE=1
HOST_MAKE_FLAGS+=VERBOSE=1
endif endif
CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR)) CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
@ -18,16 +19,22 @@ else
endif endif
ifeq ($(CONFIG_CCACHE),) ifeq ($(CONFIG_CCACHE),)
CMAKE_C_COMPILER_LAUNCHER:=
CMAKE_CXX_COMPILER_LAUNCHER:=
CMAKE_C_COMPILER:=$(call cmake_tool,$(TARGET_CC)) CMAKE_C_COMPILER:=$(call cmake_tool,$(TARGET_CC))
CMAKE_CXX_COMPILER:=$(call cmake_tool,$(TARGET_CXX)) 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 else
CCACHE:=$(STAGING_DIR_HOST)/bin/ccache CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
CMAKE_C_COMPILER:=$(CCACHE) CMAKE_C_COMPILER_LAUNCHER:=$(CCACHE)
CMAKE_C_COMPILER_ARG1:=$(TARGET_CC_NOCACHE) CMAKE_CXX_COMPILER_LAUNCHER:=$(CCACHE)
CMAKE_CXX_COMPILER:=$(CCACHE) CMAKE_C_COMPILER:=$(TARGET_CC_NOCACHE)
CMAKE_CXX_COMPILER_ARG1:=$(TARGET_CXX_NOCACHE) CMAKE_CXX_COMPILER:=$(TARGET_CXX_NOCACHE)
CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
CMAKE_HOST_CXX_COMPILER:=$(HOSTCXX_NOCACHE)
endif endif
CMAKE_AR:=$(call cmake_tool,$(TARGET_AR)) CMAKE_AR:=$(call cmake_tool,$(TARGET_AR))
CMAKE_NM:=$(call cmake_tool,$(TARGET_NM)) CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
@ -50,12 +57,12 @@ define Build/Configure/Default
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_CXX_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="$(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="$(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="$(CMAKE_C_COMPILER)" \
-DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \ -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \
-DCMAKE_SHARED_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) \ -DDL_LIBRARY=$(STAGING_DIR) \
-DCMAKE_PREFIX_PATH=$(STAGING_DIR) \ -DCMAKE_PREFIX_PATH=$(STAGING_DIR) \
-DCMAKE_SKIP_RPATH=TRUE \ -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_OPTIONS) \
$(CMAKE_SOURCE_DIR) \ $(CMAKE_SOURCE_DIR) \
) )
@ -90,6 +103,12 @@ define Host/Configure/Default
LDFLAGS="$(HOST_LDFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \
cmake \ cmake \
-DCMAKE_BUILD_TYPE=Release \ -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_C_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \
@ -104,6 +123,12 @@ define Host/Configure/Default
-DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \ -DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \
-DCMAKE_SKIP_RPATH=TRUE \ -DCMAKE_SKIP_RPATH=TRUE \
-DCMAKE_INSTALL_LIBDIR=lib \ -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) \ $(CMAKE_HOST_OPTIONS) \
$(HOST_CMAKE_SOURCE_DIR) \ $(HOST_CMAKE_SOURCE_DIR) \
) )

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007 OpenWrt.org # Copyright (C) 2007-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# debug flags: # debug flags:
# #

View File

@ -1,9 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007 OpenWrt.org # Copyright (C) 2007-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# define a dependency on a subtree # define a dependency on a subtree
# parameters: # parameters:
# 1: directories/files # 1: directories/files
@ -13,7 +11,7 @@
DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*" 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 define rdep
.PRECIOUS: $(2) .PRECIOUS: $(2)

View File

@ -1,10 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2012 OpenWrt.org # Copyright (C) 2006-2012 OpenWrt.org
# Copyright (C) 2016 LEDE project # 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 PROJECT_GIT = https://git.openwrt.org
@ -12,9 +9,11 @@ OPENWRT_GIT = $(PROJECT_GIT)
LEDE_GIT = $(PROJECT_GIT) LEDE_GIT = $(PROJECT_GIT)
ifdef PKG_SOURCE_VERSION ifdef PKG_SOURCE_VERSION
PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION)) ifndef PKG_VERSION
PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION) PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz endif
PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
endif endif
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
@ -28,7 +27,7 @@ define dl_method
$(strip \ $(strip \
$(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)), $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)),
$(if $(2),$(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 git://%,$(1)),$(call dl_method_git,$(1),$(2)), \
$(if $(filter svn://%,$(1)),svn, \ $(if $(filter svn://%,$(1)),svn, \
$(if $(filter cvs://%,$(1)),cvs, \ $(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)) check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix))
endif endif
gen_sha256sum = $(shell mkhash sha256 $(DL_DIR)/$(1)) gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1))
ifdef FIXUP ifdef FIXUP
F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2)

View File

@ -1,10 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2014 OpenWrt.org # Copyright (C) 2014 OpenWrt.org
# Copyright (C) 2016 LEDE Project # 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 -include $(TMP_DIR)/.packageauxvars
@ -36,6 +33,8 @@ define FeedSourcesAppend
echo 'src/gz %d_core %U/targets/%S/packages'; \ echo 'src/gz %d_core %U/targets/%S/packages'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \ $(strip $(if $(CONFIG_PER_FEED_REPO), \
echo 'src/gz %d_base %U/packages/%A/base'; \ 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), \ $(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \ $(if $(CONFIG_FEED_$(feed)), \
echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \ echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \
@ -44,5 +43,5 @@ endef
# 1: package name # 1: package name
define GetABISuffix 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 endef

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2015 OpenWrt.org # Copyright (C) 2015-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PKG_CHECK_FORMAT_SECURITY ?= 1 PKG_CHECK_FORMAT_SECURITY ?= 1
PKG_ASLR_PIE ?= 1 PKG_ASLR_PIE ?= 1

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2010 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(INCLUDE_DIR)/download.mk include $(INCLUDE_DIR)/download.mk
@ -132,7 +129,6 @@ define Host/Exports/Default
$(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX) $(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_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
$(1) : export PKG_CONFIG_LIBDIR=$$(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 $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE))
$(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG)) $(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG))
endef endef
@ -184,6 +180,8 @@ ifndef DUMP
clean-build: host-clean-build clean-build: host-clean-build
endif endif
$(DL_DIR)/$(FILE): FORCE
$(_host_target)host-prepare: $(HOST_STAMP_PREPARED) $(_host_target)host-prepare: $(HOST_STAMP_PREPARED)
$(_host_target)host-configure: $(HOST_STAMP_CONFIGURED) $(_host_target)host-configure: $(HOST_STAMP_CONFIGURED)
$(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED) $(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED)

View File

@ -3,16 +3,12 @@
IMAGE_KERNEL = $(word 1,$^) IMAGE_KERNEL = $(word 1,$^)
IMAGE_ROOTFS = $(word 2,$^) IMAGE_ROOTFS = $(word 2,$^)
define rootfs_align define ModelNameLimit16
$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1)))))) $(shell expr substr "$(word 2, $(subst _, ,$(1)))" 1 16)
endef endef
define Build/uImage define rootfs_align
mkimage -A $(LINUX_KARCH) \ $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
-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 $@
endef endef
define Build/buffalo-enc define Build/buffalo-enc
@ -48,6 +44,26 @@ define Build/buffalo-dhp-image
mv $@.new $@ mv $@.new $@
endef 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 define Build/eva-image
$(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new
mv $@.new $@ mv $@.new $@
@ -142,6 +158,13 @@ define Build/append-dtb
cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@ cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
endef 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 define Build/install-dtb
$(call locked, \ $(call locked, \
$(foreach dts,$(DEVICE_DTS), \ $(foreach dts,$(DEVICE_DTS), \
@ -153,14 +176,31 @@ define Build/install-dtb
) )
endef 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 define Build/fit
$(TOPDIR)/scripts/mkits.sh \ $(TOPDIR)/scripts/mkits.sh \
-D $(DEVICE_NAME) -o $@.its -k $@ \ -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)) \ -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) -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 $@ @mv $@.new $@
endef endef
@ -203,6 +243,14 @@ define Build/jffs2
@mv $@.new $@ @mv $@.new $@
endef 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 define Build/kernel-bin
rm -f $@ rm -f $@
cp $< $@ cp $< $@
@ -269,27 +317,14 @@ define Build/xor-image
endef endef
define Build/check-size define Build/check-size
@[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE)))))) -ge "$$(stat -c%s $@)" ] || { \ @imagesize="$$(stat -c%s $@)"; \
echo "WARNING: Image file $@ is too big" >&2; \ 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 $@; \ rm -f $@; \
} }
endef 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 define Build/linksys-image
$(TOPDIR)/scripts/linksys-image.sh \ $(TOPDIR)/scripts/linksys-image.sh \
"$(call param_get_default,type,$(1),$(DEVICE_NAME))" \ "$(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 define Build/append-metadata
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \ [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
@ -416,15 +466,3 @@ define Build/append-metadata
fwtool -S "$@.ucert" "$@" ;\ fwtool -S "$@.ucert" "$@" ;\
} }
endef 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

View File

@ -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

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2010 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
override TARGET_BUILD= override TARGET_BUILD=
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk
@ -17,7 +14,6 @@ ifndef IB
endif endif
endif endif
include $(INCLUDE_DIR)/image-legacy.mk
include $(INCLUDE_DIR)/feeds.mk include $(INCLUDE_DIR)/feeds.mk
include $(INCLUDE_DIR)/rootfs.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_mangle = $(subst $(space),_,$(strip $(1)))
param_unmangle = $(subst _,$(space),$(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)) mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR))
KDIR=$(KERNEL_BUILD_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_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
IMG_COMBINED:=$(IMG_PREFIX)-combined IMG_COMBINED:=$(IMG_PREFIX)-combined
IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8) 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/')
MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt 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) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE))
fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_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_EXT4FS) += ext4
fs-types-$(CONFIG_TARGET_ROOTFS_ISO) += iso
fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs
fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE))) fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE)))
@ -143,7 +139,7 @@ endef
define Image/BuildKernel/MkFIT define Image/BuildKernel/MkFIT
$(TOPDIR)/scripts/mkits.sh \ $(TOPDIR)/scripts/mkits.sh \
-D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C $(4) -a $(5) -e $(6) \ -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) -A $(LINUX_KARCH) -v $(LINUX_VERSION)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb
endef endef
@ -163,18 +159,12 @@ DTC_FLAGS += \
-Wno-unit_address_format \ -Wno-unit_address_format \
-Wno-pci_bridge \ -Wno-pci_bridge \
-Wno-pci_device_bus_num \ -Wno-pci_device_bus_num \
-Wno-pci_device_reg -Wno-pci_device_reg \
ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1)
DTC_FLAGS += \
-Wno-avoid_unnecessary_addr_size \ -Wno-avoid_unnecessary_addr_size \
-Wno-alias_paths -Wno-alias_paths \
endif
ifeq ($(strip $(call kernel_patchver_ge,4.18.0)),1)
DTC_FLAGS += \
-Wno-graph_child_address \ -Wno-graph_child_address \
-Wno-graph_port \ -Wno-graph_port \
-Wno-unique_unit_address -Wno-unique_unit_address
endif
define Image/pad-to define Image/pad-to
dd if=$(1) of=$(1).new bs=$(2) conv=sync dd if=$(1) of=$(1).new bs=$(2) conv=sync
@ -200,6 +190,7 @@ define Image/BuildDTB
-o $(2).tmp $(1) -o $(2).tmp $(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \ $(LINUX_DIR)/scripts/dtc/dtc -O dtb \
-i$(dir $(1)) $(DTC_FLAGS) $(4) \ -i$(dir $(1)) $(DTC_FLAGS) $(4) \
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
-o $(2) $(2).tmp -o $(2) $(2).tmp
$(RM) $(2).tmp $(RM) $(2).tmp
endef endef
@ -234,40 +225,28 @@ endef
$(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S)))) $(eval $(foreach S,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/template,$(S))))
$(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/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)) $@ \ $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
-nopad -noappend -root-owned \ -nopad -noappend -root-owned \
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \ -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
-processors $(shell nproc) -processors $(shell nproc)
endef endef
# $(1): board name ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
# $(2): rootfs type define Image/mkfs/squashfs
# $(3): kernel image echo ". $(call mkfs_target_dir,$(1))/etc/selinux/config" > $@.fakeroot-script
# $(4): compat string echo "$(STAGING_DIR_HOST)/bin/setfiles -r" \
ifneq ($(CONFIG_NAND_SUPPORT),) "$(call mkfs_target_dir,$(1))" \
define Image/Build/SysupgradeNAND "$(call mkfs_target_dir,$(1))/etc/selinux/\$${SELINUXTYPE}/contexts/files/file_contexts " \
mkdir -p "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/" "$(call mkfs_target_dir,$(1))" >> $@.fakeroot-script
echo "BOARD=$(if $(4),$(4),$(1))" > "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/CONTROL" echo "$(Image/mkfs/squashfs-common)" >> $@.fakeroot-script
[ -z "$(2)" ] || $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/root" chmod +x $@.fakeroot-script
[ -z "$(3)" ] || $(CP) "$(3)" "$(KDIR_TMP)/sysupgrade-$(if $(4),$(4),$(1))/kernel" $(FAKEROOT) "$@.fakeroot-script"
(cd "$(KDIR_TMP)"; $(TAR) cvf \ endef
"$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-sysupgrade.tar" sysupgrade-$(if $(4),$(4),$(1)) \ else
$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \ define Image/mkfs/squashfs
) $(call Image/mkfs/squashfs-common,$(1))
endef 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
endif endif
define Image/mkfs/ubifs define Image/mkfs/ubifs
@ -415,18 +394,20 @@ define Device/Init
DEVICE_DTS := DEVICE_DTS :=
DEVICE_DTS_CONFIG := DEVICE_DTS_CONFIG :=
DEVICE_DTS_DIR := DEVICE_DTS_DIR :=
DEVICE_DTS_OVERLAY :=
DEVICE_FDT_NUM :=
SOC := SOC :=
BOARD_NAME := BOARD_NAME :=
UIMAGE_MAGIC :=
UIMAGE_NAME := UIMAGE_NAME :=
SUPPORTED_DEVICES := SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
IMAGE_METADATA := IMAGE_METADATA :=
FILESYSTEMS := $(TARGET_FILESYSTEMS) FILESYSTEMS := $(TARGET_FILESYSTEMS)
UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-$(1) UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-$(1)
BROKEN :=
DEFAULT := DEFAULT :=
endef endef
@ -434,9 +415,10 @@ DEFAULT_DEVICE_VARS := \
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \ DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \
IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH IMAGE_SIZE \ SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ 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_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \
DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT
@ -487,7 +469,8 @@ endef
ifndef IB ifndef IB
define Device/Build/initramfs define Device/Build/initramfs
$(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1)) $(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 $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) $(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 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
@rm -f $$@ @rm -f $$@
$$(call concat_cmd,$$(KERNEL_INITRAMFS)) $$(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 endef
endif endif
@ -521,7 +536,7 @@ endef
endif endif
define Device/Build/kernel define Device/Build/kernel
$$(eval $$(foreach dts,$$(DEVICE_DTS), \ $$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
$$(call Device/Build/dtb,$$(notdir $$(dts)), \ $$(call Device/Build/dtb,$$(notdir $$(dts)), \
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \ $$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
$$(dts) \ $$(dts) \
@ -577,8 +592,10 @@ define Device/Build/image
@mkdir -p $$(shell dirname $$@) @mkdir -p $$(shell dirname $$@)
DEVICE_ID="$(DEVICE_NAME)" \ DEVICE_ID="$(DEVICE_NAME)" \
BIN_DIR="$(BIN_DIR)" \ BIN_DIR="$(BIN_DIR)" \
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
IMAGE_NAME="$(IMAGE_NAME)" \ IMAGE_NAME="$(IMAGE_NAME)" \
IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \ IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \
IMAGE_FILESYSTEM="$(1)" \
IMAGE_PREFIX="$(IMAGE_PREFIX)" \ IMAGE_PREFIX="$(IMAGE_PREFIX)" \
DEVICE_VENDOR="$(DEVICE_VENDOR)" \ DEVICE_VENDOR="$(DEVICE_VENDOR)" \
DEVICE_MODEL="$(DEVICE_MODEL)" \ DEVICE_MODEL="$(DEVICE_MODEL)" \
@ -639,7 +656,6 @@ Target-Profile-Name: $(DEVICE_DISPLAY)
Target-Profile-Packages: $(DEVICE_PACKAGES) Target-Profile-Packages: $(DEVICE_PACKAGES)
Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0) Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0)
Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES) Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES)
$(if $(BROKEN),Target-Profile-Broken: $(BROKEN))
$(if $(DEFAULT),Target-Profile-Default: $(DEFAULT)) $(if $(DEFAULT),Target-Profile-Default: $(DEFAULT))
Target-Profile-Description: Target-Profile-Description:
$(DEVICE_DESCRIPTION) $(DEVICE_DESCRIPTION)
@ -690,8 +706,6 @@ define BuildImage
prepare: prepare:
compile: compile:
clean: clean:
legacy-images-prepare:
legacy-images:
image_prepare: image_prepare:
ifeq ($(IB),) ifeq ($(IB),)
@ -707,9 +721,6 @@ define BuildImage
rm -rf $(BUILD_DIR)/json_info_files rm -rf $(BUILD_DIR)/json_info_files
$(call Image/Prepare) $(call Image/Prepare)
legacy-images-prepare-make: image_prepare
$(MAKE) legacy-images-prepare BIN_DIR="$(BIN_DIR)"
else else
image_prepare: image_prepare:
mkdir -p $(BIN_DIR) $(KDIR)/tmp mkdir -p $(BIN_DIR) $(KDIR)/tmp
@ -723,17 +734,12 @@ define BuildImage
$(call Image/InstallKernel) $(call Image/InstallKernel)
$(foreach device,$(TARGET_DEVICES),$(call Device,$(device))) $(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)) install-images: kernel_prepare $(foreach fs,$(filter-out $(if $(UBIFS_OPTS),,ubifs),$(TARGET_FILESYSTEMS) $(fs-subtypes-y)),$(KDIR)/root.$(fs))
$(foreach fs,$(TARGET_FILESYSTEMS), $(foreach fs,$(TARGET_FILESYSTEMS),
$(call Image/Build,$(fs)) $(call Image/Build,$(fs))
) )
legacy-images-make: install-images
$(call Image/mkfs/ubifs/legacy)
$(MAKE) legacy-images BIN_DIR="$(BIN_DIR)"
install: install-images install: install-images
$(call Image/Manifest) $(call Image/Manifest)

View File

@ -1,9 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2007 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk
include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/depends.mk
@ -105,7 +103,7 @@ define BuildKernel
xargs $(TARGET_CROSS)nm | \ xargs $(TARGET_CROSS)nm | \
awk '$$$$1 == "U" { print $$$$2 } ' | \ awk '$$$$1 == "U" { print $$$$2 } ' | \
sort -u > $(KERNEL_BUILD_DIR)/mod_symtab.txt 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 -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 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 compile: $(LINUX_DIR)/.modules
$(MAKE) -C image compile TARGET_BUILD= $(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 $(LINUX_DIR)/.config.prev
rm -f $(STAMP_CONFIGURED) rm -f $(STAMP_CONFIGURED)
$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config $(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
$(_SINGLE)$(KERNEL_MAKE) \ $(_SINGLE)$(KERNEL_MAKE) \
$(if $(findstring Darwin,$(HOST_OS)), \ $(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses" \
HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \
filechk_conf_cfg=" :" \
) \
YACC=$(STAGING_DIR_HOST)/bin/bison \ YACC=$(STAGING_DIR_HOST)/bin/bison \
$$@ $$@
$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config | \ $(call LINUX_RECONF_DIFF,$(LINUX_DIR)/.config) > $(LINUX_RECONFIG_TARGET)
grep -vE '(CONFIG_CC_(HAS_ASM_GOTO|IS_GCC|IS_CLANG)|GCC_VERSION)=' \
> $(LINUX_RECONFIG_TARGET)
install: $(LINUX_DIR)/.image install: $(LINUX_DIR)/.image
+$(MAKE) -C image compile install TARGET_BUILD= +$(MAKE) -C image compile install TARGET_BUILD=

View File

@ -1,12 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2015 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifdef CONFIG_STRIP_KERNEL_EXPORTS ifdef CONFIG_STRIP_KERNEL_EXPORTS
KERNEL_MAKEOPTS += \ KERNEL_MAKEOPTS_IMAGE += \
EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h" EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h"
endif endif
@ -24,7 +21,7 @@ Kernel/Patch:=$(Kernel/Patch/Default)
ifneq (,$(findstring .xz,$(LINUX_SOURCE))) ifneq (,$(findstring .xz,$(LINUX_SOURCE)))
LINUX_CAT:=xzcat LINUX_CAT:=xzcat
else else
LINUX_CAT:=zcat LINUX_CAT:=gzip -dc
endif endif
ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
@ -46,10 +43,20 @@ else
rmdir $(LINUX_DIR); \ rmdir $(LINUX_DIR); \
fi fi
ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR) ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
if [ -d $(LINUX_DIR)/user_headers ]; then \
rm -rf $(LINUX_DIR)/user_headers; \
fi
endef endef
endif endif
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) 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)),"") ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"")
define Kernel/SetInitramfs/PreConfigure define Kernel/SetInitramfs/PreConfigure
grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config 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 echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(LINUX_DIR)/.config
endef endef
endif endif
endif
define Kernel/SetInitramfs define Kernel/SetInitramfs
rm -f $(LINUX_DIR)/.config.prev rm -f $(LINUX_DIR)/.config.prev
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
$(call Kernel/SetInitramfs/PreConfigure) $(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_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(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 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 "$(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_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 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_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_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_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 endef
else else
endif endif
@ -105,7 +118,7 @@ define Kernel/Configure/Default
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ 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 $(_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 endef
define Kernel/Configure/Initramfs define Kernel/Configure/Initramfs
@ -114,7 +127,7 @@ endef
define Kernel/CompileModules/Default define Kernel/CompileModules/Default
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
+$(KERNEL_MAKE) modules +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
endef endef
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id 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 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 define Kernel/CompileImage/Default
rm -f $(TARGET_DIR)/init 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) $(call Kernel/CopyImage)
endef endef
# Here as well, always add "modules", see comment above.
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
define Kernel/CompileImage/Initramfs define Kernel/CompileImage/Initramfs
$(call Kernel/Configure/Initramfs) $(call Kernel/Configure/Initramfs)
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init $(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(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* 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) $(call Kernel/CopyImage,-initramfs)
endef endef
else else
@ -161,5 +193,3 @@ define Kernel/Clean/Default
rm -f $(LINUX_KERNEL) rm -f $(LINUX_KERNEL)
$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
endef endef

View File

@ -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 LINUX_RELEASE?=1
ifdef CONFIG_TESTING_KERNEL ifdef CONFIG_TESTING_KERNEL
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
endif endif
LINUX_VERSION-4.14 = .195
LINUX_VERSION-4.19 = .138
LINUX_VERSION-5.4 = .124 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.4.124 = f7f29dda2b042d7b5986d18274413131cf70e17288c05e9a683df1f46c507d82
LINUX_KERNEL_HASH-5.10.43 = 83b81e433ba2f8ee143064fb163699ee857e26dd789006bc1e9edf1ccd0bd403
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2015 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifneq ($(filter check,$(MAKECMDGOALS)),) ifneq ($(filter check,$(MAKECMDGOALS)),)
CHECK:=1 CHECK:=1
@ -118,7 +115,11 @@ KERNEL_MAKE_FLAGS = \
CONFIG_SHELL="$(BASH)" \ CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \ $(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)),) ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
KERNEL_MAKE_FLAGS += \ KERNEL_MAKE_FLAGS += \
@ -140,14 +141,6 @@ PKG_EXTMOD_SUBDIRS ?= .
PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers 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 define collect_module_symvers
for subdir in $(PKG_EXTMOD_SUBDIRS); do \ for subdir in $(PKG_EXTMOD_SUBDIRS); do \
realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \ 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; \ grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
done; \ done; \
sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \ 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 mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers
endef endef
define KernelPackage/hooks define KernelPackage/hooks
ifneq ($(PKG_NAME),kernel) ifneq ($(PKG_NAME),kernel)
Hooks/Compile/Pre += populate_module_symvers
Hooks/Compile/Post += collect_module_symvers Hooks/Compile/Post += collect_module_symvers
endif endif
define KernelPackage/hooks define KernelPackage/hooks

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2014 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifneq ($(__inc_netfilter),1) ifneq ($(__inc_netfilter),1)
__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 # 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, $(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_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_MATCH_STATE, $(P_XT)xt_state))
$(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_TARGET_CT, $(P_XT)xt_CT)) $(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_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_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_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)) #$(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_STRING, $(P_XT)xt_string))
$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf)) $(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 # 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_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_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_IP_NF_TARGET_ECN, $(P_V4)ipt_ECN))
$(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_MATCH_ECN, $(P_XT)xt_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_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_CONNTRACK,CONFIG_NF_DEFRAG_IPV6, $(P_V6)nf_defrag_ipv6),))
$(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,IPT_IPV6,CONFIG_IP6_NF_FILTER, $(P_V6)ip6table_filter),)) $(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_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_NF_LOG_IPV6, $(P_V6)nf_log_ipv6),))
$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, ip6t_icmp6))) $(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)) $(eval $(call nf_add,IPT_IPV6,CONFIG_IP6_NF_TARGET_REJECT, $(P_V6)ip6t_REJECT))
# ipv6 extra # ipv6 extra
@ -185,26 +180,18 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt))
# kernel only # 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, $(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_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_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_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),)) $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, $(P_V6)ip6t_NPT),))
# userland only # 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_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 $(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_NETFILTER_XT_TARGET_MASQUERADE, $(P_XT)xt_MASQUERADE))
$(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_NETFILTER_XT_TARGET_REDIRECT, $(P_XT)xt_REDIRECT))
$(eval $(call nf_add,IPT_NAT,CONFIG_IP_NF_TARGET_REDIRECT, $(P_XT)xt_REDIRECT))
# nat-extra # 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_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_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_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_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_NAT_H323, $(P_V4)nf_nat_h323))
$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_PPTP, $(P_XT)nf_conntrack_pptp)) $(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_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_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_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_IPV4, $(P_V4)nf_tproxy_ipv4))
$(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_IPV6, $(P_V6)nf_tproxy_ipv6))
# led # led
$(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_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 # 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, $(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_SET, $(P_XT)nf_tables_set),))
$(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_NFT_COUNTER, $(P_XT)nft_counter),)) $(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_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_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_LIMIT, $(P_XT)nft_limit),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),)) $(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_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, $(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_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_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_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_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_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, $(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_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_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_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),)) $(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_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_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 # userland only
IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m) IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m)

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2011-2012 OpenWrt.org # Copyright (C) 2011-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# iconv full # iconv full
ifeq ($(CONFIG_BUILD_NLS),y) ifeq ($(CONFIG_BUILD_NLS),y)

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007-2014 OpenWrt.org # Copyright (C) 2007-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifeq ($(DUMP),) ifeq ($(DUMP),)
define BuildTarget/bin define BuildTarget/bin

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
@ -59,6 +56,7 @@ define Package/Default
ALTERNATIVES:= ALTERNATIVES:=
LICENSE:=$(PKG_LICENSE) LICENSE:=$(PKG_LICENSE)
LICENSE_FILES:=$(PKG_LICENSE_FILES) LICENSE_FILES:=$(PKG_LICENSE_FILES)
FILE_MODES:=$(PKG_FILE_MODES)
endef endef
Build/Patch:=$(Build/Patch/Default) Build/Patch:=$(Build/Patch/Default)

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifneq ($(DUMP),) ifneq ($(DUMP),)
@ -24,8 +21,7 @@ $(if $(MENU),Menu: $(MENU)
)$(if $(DEFAULT),Default: $(DEFAULT) )$(if $(DEFAULT),Default: $(DEFAULT)
)$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1 )$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1
)Version: $(VERSION) )Version: $(VERSION)
$(if $(ABI_VERSION),ABIVersion: $(ABI_VERSION) Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
)Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
Conflicts: $(CONFLICTS) Conflicts: $(CONFLICTS)
Menu-Depends: $(MDEPENDS) Menu-Depends: $(MDEPENDS)
Provides: $(PROVIDES) Provides: $(PROVIDES)

View File

@ -1,23 +1,28 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2014 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifndef DUMP ifndef DUMP
include $(INCLUDE_DIR)/feeds.mk include $(INCLUDE_DIR)/feeds.mk
endif endif
# invoke ipkg-build with some default options
IPKG_BUILD:= \
$(SCRIPT_DIR)/ipkg-build -c -o 0 -g 0
IPKG_REMOVE:= \ IPKG_REMOVE:= \
$(SCRIPT_DIR)/ipkg-remove $(SCRIPT_DIR)/ipkg-remove
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg 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 # 1: package name
# 2: variable name # 2: variable name
# 3: variable suffix # 3: variable suffix
@ -94,7 +99,7 @@ _endef=endef
ifeq ($(DUMP),) ifeq ($(DUMP),)
define BuildTarget/ipkg define BuildTarget/ipkg
ABIV_$(1):=$(call GetABISuffix,$(1)) ABIV_$(1):=$(if $(filter-out kmod-%,$(1)),$(ABI_VERSION))
PDIR_$(1):=$(call FeedPackageDir,$(1)) PDIR_$(1):=$(call FeedPackageDir,$(1))
IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) 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 $(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
mkdir -p $(STAGING_DIR_ROOT)/stamp 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) $(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy)
touch $$@ touch $$@
@ -165,7 +175,7 @@ Package: $(1)$$(ABIV_$(1))
Version: $(VERSION) Version: $(VERSION)
$$(call addfield,Depends,$$(Package/$(1)/DEPENDS) $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS)) )$$(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,Alternatives,$$(call mergelist,$(ALTERNATIVES))
)$$(call addfield,Source,$(SOURCE) )$$(call addfield,Source,$(SOURCE)
)$$(call addfield,SourceName,$(1) )$$(call addfield,SourceName,$(1)
@ -173,6 +183,8 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,LicenseFiles,$(LICENSE_FILES) )$$(call addfield,LicenseFiles,$(LICENSE_FILES)
)$$(call addfield,Section,$(SECTION) )$$(call addfield,Section,$(SECTION)
)$$(call addfield,Require-User,$(USERID) )$$(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 $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
)$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed )$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed
)$(if $(filter essential,$(PKG_FLAGS)),Essential: yes )$(if $(filter essential,$(PKG_FLAGS)),Essential: yes
@ -184,8 +196,10 @@ $(_endef)
$$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL) $$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL)
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description) $$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG) $$(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 $(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) mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
$(call Package/$(1)/install,$$(IDIR_$(1))) $(call Package/$(1)/install,$$(IDIR_$(1)))
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay) $(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
@ -207,8 +221,8 @@ $(_endef)
ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),) ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
(cd $$(IDIR_$(1)); \ (cd $$(IDIR_$(1)); \
( \ ( \
find . -type f \! -path ./CONTROL/\* -exec sha256sum \{\} \; 2> /dev/null | \ find . -type f \! -path ./CONTROL/\* -exec $(MKHASH) sha256 -n \{\} \; 2> /dev/null | \
sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \ sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
) || true \ ) || true \
) )
endif endif
@ -221,13 +235,13 @@ $(_endef)
( \ ( \
echo "#!/bin/sh"; \ echo "#!/bin/sh"; \
echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \ 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 ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
echo "default_postinst \$$$$0 \$$$$@"; \ echo "default_postinst \$$$$0 \$$$$@"; \
) > postinst; \ ) > postinst; \
( \ ( \
echo "#!/bin/sh"; \ 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 ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
echo "default_prerm \$$$$0 \$$$$@"; \ echo "default_prerm \$$$$0 \$$$$@"; \
) > prerm; \ ) > prerm; \
@ -249,11 +263,11 @@ $(_endef)
endif endif
$(INSTALL_DIR) $$(PDIR_$(1)) $(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)) ] @[ -f $$(IPKG_$(1)) ]
$(1)-clean: $(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 clean: $(1)-clean

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2015 OpenWrt.org # Copyright (C) 2015-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PKG_CONFIG_DEPENDS+= CONFIG_KERNEL_SECCOMP PKG_CONFIG_DEPENDS+= CONFIG_KERNEL_SECCOMP

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2008 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
__package_mk:=1 __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)) 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) ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
PKG_JOBS?=-j1 PKG_JOBS?=-j1
else else
@ -59,7 +58,7 @@ include $(INCLUDE_DIR)/quilt.mk
find_library_dependencies = \ find_library_dependencies = \
$(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \
$(sort $(foreach dep4, \ $(filter-out $(BUILD_PACKAGES), $(sort $(foreach dep4, \
$(sort $(foreach dep3, \ $(sort $(foreach dep3, \
$(sort $(foreach dep2, \ $(sort $(foreach dep2, \
$(sort $(foreach dep1, \ $(sort $(foreach dep1, \
@ -74,7 +73,7 @@ find_library_dependencies = \
$(Package/$(dep3)/depends) $(dep3) \ $(Package/$(dep3)/depends) $(dep3) \
)), \ )), \
$(Package/$(dep4)/depends) $(dep4) \ $(Package/$(dep4)/depends) $(dep4) \
)), \ ))) \
)) ))
@ -173,7 +172,6 @@ define Build/Exports/Default
$(1) : export CONFIG_SITE:=$$(CONFIG_SITE) $(1) : export CONFIG_SITE:=$$(CONFIG_SITE)
$(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH) $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH)
$(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH) $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH)
$(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache)
endef endef
Build/Exports=$(Build/Exports/Default) Build/Exports=$(Build/Exports/Default)
@ -185,6 +183,8 @@ define Build/CoreTargets
$(call Build/Autoclean) $(call Build/Autoclean)
$(call DefaultTargets) $(call DefaultTargets)
$(DL_DIR)/$(FILE): FORCE
download: download:
$(foreach hook,$(Hooks/Download), $(foreach hook,$(Hooks/Download),
$(call $(hook))$(sep) $(call $(hook))$(sep)
@ -223,7 +223,7 @@ define Build/CoreTargets
$(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG) $(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG)
$(STAMP_INSTALLED): $(STAMP_BUILT) $(STAMP_INSTALLED): $(STAMP_BUILT)
rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME) 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),\ $(foreach hook,$(Hooks/InstallDev/Pre),\
$(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\ $(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 clean: force-clean-build
$(CleanStaging) $(CleanStaging)
$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR)/host) $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
$(Build/Clean) $(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: dist:
$(Build/Dist) $(Build/Dist)

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2012 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk
@ -14,8 +11,8 @@ PKG_NAME:=Build dependency
# Required for the toolchain # Required for the toolchain
$(eval $(call TestHostCommand,working-make, \ $(eval $(call TestHostCommand,working-make, \
Please install GNU make v3.82 or later. (This version has bugs), \ Please install GNU make v4.1 or later., \
$(MAKE) -v | grep -E 'Make (3\.8[2-9]|3\.9[0-9]|[4-9]\.)')) $(MAKE) -v | grep -E 'Make (4\.[1-9]|[5-9]\.)'))
$(eval $(call TestHostCommand,case-sensitive-fs, \ $(eval $(call TestHostCommand,case-sensitive-fs, \
OpenWrt can only be built on a case-sensitive filesystem, \ 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, \ Please build with umask 022 - other values produce broken packages, \
umask | grep -xE 0?0[012][012])) umask | grep -xE 0?0[012][012]))
ifndef IB
$(eval $(call SetupHostCommand,gcc, \ $(eval $(call SetupHostCommand,gcc, \
Please install the GNU C Compiler (gcc) 4.8 or later, \ Please install the GNU C Compiler (gcc) 6 or later, \
$(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ $(CC) -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ gcc -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
gcc --version | grep -E 'Apple.(LLVM|clang)' )) gcc --version | grep -E 'Apple.(LLVM|clang)' ))
$(eval $(call TestHostCommand,working-gcc, \ $(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, \ it appears to be broken, \
echo 'int main(int argc, char **argv) { return 0; }' | \ echo 'int main(int argc, char **argv) { return 0; }' | \
gcc -x c -o $(TMP_DIR)/a.out -)) gcc -x c -o $(TMP_DIR)/a.out -))
$(eval $(call SetupHostCommand,g++, \ $(eval $(call SetupHostCommand,g++, \
Please install the GNU C++ Compiler (g++) 4.8 or later, \ Please install the GNU C++ Compiler (g++) 6 or later, \
$(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ $(CXX) -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ g++ -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
g++ --version | grep -E 'Apple.(LLVM|clang)' )) g++ --version | grep -E 'Apple.(LLVM|clang)' ))
$(eval $(call TestHostCommand,working-g++, \ $(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, \ it appears to be broken, \
echo 'int main(int argc, char **argv) { return 0; }' | \ echo 'int main(int argc, char **argv) { return 0; }' | \
g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \ g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
$(TMP_DIR)/a.out)) $(TMP_DIR)/a.out))
ifndef IB
$(eval $(call TestHostCommand,ncurses, \ $(eval $(call TestHostCommand,ncurses, \
Please install ncurses. (Missing libncurses.so or ncurses.h), \ Please install ncurses. (Missing libncurses.so or ncurses.h), \
echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \ echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses)) gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
endif endif # IB
ifeq ($(HOST_OS),Linux) ifeq ($(HOST_OS),Linux)
zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic 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, \ Please install the Perl Data::Dumper module, \
perl -MData::Dumper -e 1)) 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, \ $(eval $(call TestHostCommand,perl-thread-queue, \
Please install the Perl Thread::Queue module, \ Please install the Perl Thread::Queue module, \
perl -MThread::Queue -e 1)) perl -MThread::Queue -e 1))
$(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \ $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
gtar --version 2>&1 | grep GNU, \ gtar --version 2>&1 | grep GNU, \
gnutar --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, \ ggrep --version 2>&1 | grep GNU, \
grep --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, \ $(eval $(call SetupHostCommand,getopt, \
Please install an extended getopt version that supports --long, \ Please install an extended getopt version that supports --long, \
gnugetopt -o t --long test -- --test | grep '^ *--test *--', \ 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, \ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
gnustat -c%s $(TOPDIR)/Makefile, \ gnustat -c%s $(TOPDIR)/Makefile, \
@ -134,24 +147,28 @@ $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
$(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
wget --version | grep GNU)) 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, \ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
perl --version | grep "perl.*v5")) perl --version | grep "perl.*v5"))
$(eval $(call CleanupPython2)) $(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.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -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\.[6-9]\.?'))
python3 -V 2>&1 | grep -E 'Python 3\.[5-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.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \ python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -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\.[6-9]\.?'))
python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?'))
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \ $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule)) 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, \ $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
file --version 2>&1 | grep file)) file --version 2>&1 | grep file))
$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \
rsync --version </dev/null))
$(eval $(call SetupHostCommand,which,Please install 'which', \
which which | grep which))
$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $< $(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2015 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifneq ($(__prereq_inc),1) ifneq ($(__prereq_inc),1)
__prereq_inc:=1 __prereq_inc:=1

View File

@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007-2009 OpenWrt.org # Copyright (C) 2007-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
ifeq ($(TARGET_BUILD),1) ifeq ($(TARGET_BUILD),1)
PKG_BUILD_DIR:=$(LINUX_DIR) PKG_BUILD_DIR:=$(LINUX_DIR)
@ -161,7 +159,7 @@ define Quilt/Template
false; \ false; \
} }
@[ -n "$$$$(ls $(1)/patches/series)" -o \ @[ -n "$$$$(ls $(1)/patches/series)" -o \
"$$$$(cat $(1)/patches/series | mkhash md5)" = "$$(sort $(1)/patches/series | mkhash md5)" ] || { \ "$$$$(cat $(1)/patches/series | $(MKHASH) md5)" = "$$(sort $(1)/patches/series | $(MKHASH) md5)" ] || { \
echo "The patches are not sorted in the right order. Please fix."; \ echo "The patches are not sorted in the right order. Please fix."; \
false; \ false; \
} }

View File

@ -47,7 +47,7 @@ TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
ifdef CONFIG_CLEAN_IPKG ifdef CONFIG_CLEAN_IPKG
define clean_ipkg define clean_ipkg
-find $(1)/usr/lib/opkg/info -type f -and -not -name '*.control' | $(XARGS) rm -rf -find $(1)/usr/lib/opkg/info -type f -and -not -name '*.control' -delete
-sed -i -ne '/^Require-User: /p' $(1)/usr/lib/opkg/info/*.control -sed -i -ne '/^Require-User: /p' $(1)/usr/lib/opkg/info/*.control
awk ' \ awk ' \
BEGIN { conffiles = 0; print "Conffiles:" } \ BEGIN { conffiles = 0; print "Conffiles:" } \
@ -56,7 +56,7 @@ ifdef CONFIG_CLEAN_IPKG
conffiles == 1 { print } \ conffiles == 1 { print } \
' $(1)/usr/lib/opkg/status >$(1)/usr/lib/opkg/status.new ' $(1)/usr/lib/opkg/status >$(1)/usr/lib/opkg/status.new
mv $(1)/usr/lib/opkg/status.new $(1)/usr/lib/opkg/status 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 endef
endif endif
@ -69,7 +69,7 @@ define prepare_rootfs
@( \ @( \
cd $(1); \ cd $(1); \
for script in ./usr/lib/opkg/info/*.postinst; do \ for script in ./usr/lib/opkg/info/*.postinst; do \
IPKG_INSTROOT=$(1) $$(which bash) $$script; \ IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
ret=$$?; \ ret=$$?; \
if [ $$ret -ne 0 ]; then \ if [ $$ret -ne 0 ]; then \
echo "postinst script $$script has failed with exit code $$ret" >&2; \ 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 \ for script in ./etc/init.d/*; do \
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \ grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \ 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); \ echo "Enabling" $$(basename $$script); \
else \ 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); \ echo "Disabling" $$(basename $$script); \
fi; \ fi; \
done || true \ done || true \
) )
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status) $(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 CVS -o -name .svn -o -name .git -o -name '.#*' | $(XARGS) rm -rf
@-find $(1) -name .svn | $(XARGS) rm -rf rm -rf \
@-find $(1) -name .git | $(XARGS) rm -rf $(1)/boot \
@-find $(1) -name '.#*' | $(XARGS) rm -f $(1)/tmp/* \
rm -rf $(1)/tmp/* $(1)/usr/lib/opkg/info/*.postinst* \
rm -f $(1)/usr/lib/opkg/lists/* $(1)/usr/lib/opkg/lists/* \
rm -f $(1)/usr/lib/opkg/info/*.postinst* $(1)/var/lock/*.lock
rm -f $(1)/var/lock/*.lock
rm -rf $(1)/boot
$(call clean_ipkg,$(1)) $(call clean_ipkg,$(1))
$(call mklibs,$(1)) $(call mklibs,$(1))
$(if $(SOURCE_DATE_EPOCH),find $(1)/ -mindepth 1 -execdir touch -hcd "@$(SOURCE_DATE_EPOCH)" "{}" +) $(if $(SOURCE_DATE_EPOCH),find $(1)/ -mindepth 1 -execdir touch -hcd "@$(SOURCE_DATE_EPOCH)" "{}" +)

View File

@ -1,4 +1,5 @@
include $(TOPDIR)/include/verbose.mk include $(TOPDIR)/include/verbose.mk
include $(TOPDIR)/rules.mk
TMP_DIR:=$(TOPDIR)/tmp TMP_DIR:=$(TOPDIR)/tmp
all: $(TMP_DIR)/.$(SCAN_TARGET) all: $(TMP_DIR)/.$(SCAN_TARGET)
@ -100,7 +101,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
$(TARGET_STAMP):: $(TARGET_STAMP)::
+( \ +( \
$(NO_TRACE_MAKE) $(FILELIST); \ $(NO_TRACE_MAKE) $(FILELIST); \
MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \ MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | $(MKHASH) md5 | awk '{print $$1}'); \
[ -f "$@.$$MD5SUM" ] || { \ [ -f "$@.$$MD5SUM" ] || { \
rm -f $@.*; \ rm -f $@.*; \
touch $@.$$MD5SUM; \ touch $@.$$MD5SUM; \

0
include/shell.sh Normal file → Executable file
View File

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007 OpenWrt.org # Copyright (C) 2007-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifeq ($(MAKECMDGOALS),prereq) ifeq ($(MAKECMDGOALS),prereq)
SUBTARGETS:=prereq SUBTARGETS:=prereq
@ -23,7 +20,7 @@ define subtarget
endef endef
define ERROR 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 endef
lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1))) lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1)))
@ -66,7 +63,7 @@ define subdir
$(foreach btype,$(buildtypes-$(bd)), $(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 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))) \ $(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))) $(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)))) $(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 $(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)))) $(if $($(1)/autoremove),$(call rebuild_check,$(1)/$(bd),$(target),,$(filter-out __default,$(variant))))
$(call log_make,$(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),, $(if $(PREREQ_ONLY)$(DUMP_TARGET_DB),,
# aliases # aliases

View File

@ -1,10 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2007-2008 OpenWrt.org # Copyright (C) 2007-2008 OpenWrt.org
# Copyright (C) 2016 LEDE Project # 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) ifneq ($(__target_inc),1)
__target_inc=1 __target_inc=1
@ -13,19 +10,25 @@ __target_inc=1
DEVICE_TYPE?=router DEVICE_TYPE?=router
# Default packages - the really basic set # 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 \ 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 libustream-openssl ca-certificates \ 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-autoreboot luci-app-webadmin \ 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-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-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramfree \
luci-app-sfe luci-app-nlbwmon luci-app-accesscontrol luci-app-cpufreq \ luci-app-sfe luci-app-nlbwmon luci-app-accesscontrol luci-app-cpufreq \
ddns-scripts_aliyun ddns-scripts_dnspod 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 # For nas targets
DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
# For router targets # For router targets
DEFAULT_PACKAGES.router:=dnsmasq-full iptables ppp ppp-mod-pppoe firewall DEFAULT_PACKAGES.router:=dnsmasq-full iptables ppp ppp-mod-pppoe firewall
DEFAULT_PACKAGES.bootloader:=
ifneq ($(DUMP),) ifneq ($(DUMP),)
all: dumpinfo all: dumpinfo
@ -156,11 +159,11 @@ ifeq ($(CONFIG_TARGET),env)
LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config
endif 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_CONF_CMD = $(SCRIPT_DIR)/kconfig.pl $(call __linux_confcmd,$(LINUX_KCONFIG_LIST))
LINUX_RECONF_CMD = $(call __linux_confcmd,$(LINUX_RECONFIG_LIST),) LINUX_RECONF_CMD = $(SCRIPT_DIR)/kconfig.pl $(call __linux_confcmd,$(LINUX_RECONFIG_LIST))
LINUX_RECONF_DIFF = $(call __linux_confcmd,$(filter-out $(LINUX_RECONFIG_TARGET),$(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) ifeq ($(DUMP),1)
BuildTarget=$(BuildTargets/DumpCurrent) BuildTarget=$(BuildTargets/DumpCurrent)
@ -175,13 +178,15 @@ ifeq ($(DUMP),1)
CPU_CFLAGS += -mno-branch-likely CPU_CFLAGS += -mno-branch-likely
CPU_CFLAGS_mips32 = -mips32 -mtune=mips32 CPU_CFLAGS_mips32 = -mips32 -mtune=mips32
CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64 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_24kc = -mips32r2 -mtune=24kc
CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc
CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64 CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64
endif endif
ifeq ($(ARCH),i386) ifeq ($(ARCH),i386)
CPU_TYPE ?= pentium CPU_TYPE ?= pentium-mmx
CPU_CFLAGS_pentium = -march=pentium-mmx CPU_CFLAGS_pentium-mmx = -march=pentium-mmx
CPU_CFLAGS_pentium4 = -march=pentium4 CPU_CFLAGS_pentium4 = -march=pentium4
endif endif
ifneq ($(findstring arm,$(ARCH)),) ifneq ($(findstring arm,$(ARCH)),)

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2009 OpenWrt.org # Copyright (C) 2009-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
override CONFIG_AUTOREBUILD= override CONFIG_AUTOREBUILD=
override CONFIG_AUTOREMOVE= override CONFIG_AUTOREMOVE=

View File

@ -1,14 +1,10 @@
# Makefile for OpenWrt # 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
PREP_MK= OPENWRT_BUILD= QUIET=0 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 include $(TOPDIR)/include/verbose.mk
@ -19,7 +15,6 @@ else
SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh) SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh)
endif endif
HOSTCC ?= $(CC)
export REVISION export REVISION
export SOURCE_DATE_EPOCH export SOURCE_DATE_EPOCH
export GIT_CONFIG_PARAMETERS='core.autocrlf=false' 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_OS:=$(shell uname)
export HOST_ARCH:=$(shell uname -m) 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 # prevent perforce from messing with the patch utility
unexport P4PORT P4USER P4CONFIG P4CLIENT unexport P4PORT P4USER P4CONFIG P4CLIENT
@ -53,13 +54,6 @@ export PATH:=$(path)
unexport TAR_OPTIONS 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),) ifeq ($(FORCE),)
.config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build .config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build
endif endif
@ -91,6 +85,7 @@ prepare-tmpinfo: FORCE
[ tmp/.config-feeds.in -nt tmp/.packageauxvars ] || ./scripts/feeds feed_config > tmp/.config-feeds.in [ 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 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 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 touch $(TOPDIR)/tmp/.build
.config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo) .config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo)
@ -108,7 +103,7 @@ endif
scripts/config/%onf: CFLAGS+= -O2 scripts/config/%onf: CFLAGS+= -O2
scripts/config/%onf: scripts/config/%onf:
@$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \ @$(_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)) $(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; \ [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
$< Config.in $< 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 xconfig: scripts/config/qconf prepare-tmpinfo FORCE
if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \ if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
cp $(HOME)/.openwrt/defconfig .config; \ cp $(HOME)/.openwrt/defconfig .config; \
@ -162,6 +164,7 @@ kernel_oldconfig: prepare_kernel_conf
ifneq ($(DISTRO_PKG_CONFIG),) ifneq ($(DISTRO_PKG_CONFIG),)
kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH) kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_nconfig: 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 endif
kernel_menuconfig: prepare_kernel_conf kernel_menuconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
@ -169,6 +172,9 @@ kernel_menuconfig: prepare_kernel_conf
kernel_nconfig: prepare_kernel_conf kernel_nconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux nconfig $(_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 staging_dir/host/.prereq-build: include/prereq-build.mk
mkdir -p tmp mkdir -p tmp
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ @$(_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 ./scripts/feeds uninstall -a
help: help:
cat README cat README.md
distclean: 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 @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
ifeq ($(findstring v,$(DEBUG)),) ifeq ($(findstring v,$(DEBUG)),)

View File

@ -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

View File

@ -4,8 +4,8 @@ ifndef DUMP
endif endif
endif endif
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX CONFIG_USE_LIBCXX PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBCXX:libcxx +USE_LIBSTDCXX:libstdcpp CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
ifneq ($(CONFIG_USE_UCLIBCXX),) ifneq ($(CONFIG_USE_UCLIBCXX),)
ifneq ($(CONFIG_CCACHE),) ifneq ($(CONFIG_CCACHE),)
@ -14,11 +14,3 @@ ifneq ($(CONFIG_USE_UCLIBCXX),)
TARGET_CXX=g++-uc TARGET_CXX=g++-uc
endif endif
endif endif
ifneq ($(CONFIG_USE_LIBCXX),)
ifneq ($(CONFIG_CCACHE),)
TARGET_CXX_NOCACHE=g++-libcxx
else
TARGET_CXX=g++-libcxx
endif
endif

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006-2007 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
HOST_TAR:=$(TAR) HOST_TAR:=$(TAR)
TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS) TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS)

View File

@ -1,9 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006-2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
ifndef OPENWRT_VERBOSE ifndef OPENWRT_VERBOSE
OPENWRT_VERBOSE:= OPENWRT_VERBOSE:=

View File

@ -1,10 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# #
# Copyright (C) 2012-2015 OpenWrt.org # Copyright (C) 2012-2015 OpenWrt.org
# Copyright (C) 2016 LEDE Project # 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 # Substituted by SDK, do not remove
# REVISION:=x # REVISION:=x
@ -26,13 +23,13 @@ PKG_CONFIG_DEPENDS += \
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) 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:=$(call qstrip,$(CONFIG_VERSION_CODE))
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) 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:=$(call qstrip,$(CONFIG_VERSION_DIST))
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) 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,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \ -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'

View File

@ -11,6 +11,7 @@ include $(INCLUDE_DIR)/feeds.mk
include $(INCLUDE_DIR)/rootfs.mk include $(INCLUDE_DIR)/rootfs.mk
-include $(TMP_DIR)/.packagedeps -include $(TMP_DIR)/.packagedeps
package-y += kernel/linux
$(curdir)/autoremove:=1 $(curdir)/autoremove:=1
$(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m)) $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
$(curdir)/builddirs-default:=. $(sort $(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 - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG) rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
mkdir -p $(TARGET_DIR)/tmp mkdir -p $(TARGET_DIR)/tmp
$(call opkg,$(TARGET_DIR)) install \ $(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_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 \ @for file in $(PACKAGE_INSTALL_FILES); do \
[ -s $$file.flags ] || continue; \ [ -s $$file.flags ] || continue; \
for flag in `cat $$file.flags`; do \ for flag in `cat $$file.flags`; do \
@ -84,7 +87,7 @@ $(curdir)/index: FORCE
mkdir -p $$d; \ mkdir -p $$d; \
cd $$d || continue; \ cd $$d || continue; \
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \ $(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) \ 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!); \ $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
{ echo ""; echo ""; } >> Packages;; \ { echo ""; echo ""; } >> Packages;; \

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2007-2016 OpenWrt.org # Copyright (C) 2007-2021 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
# #
# This is free software, licensed under the GNU General Public License v2. # 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 include $(INCLUDE_DIR)/feeds.mk
PKG_NAME:=base-files PKG_NAME:=base-files
PKG_RELEASE:=225
PKG_FLAGS:=nonshared PKG_FLAGS:=nonshared
PKG_RELEASE:=$(COMMITCOUNT)
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
PKG_BUILD_DEPENDS:=usign/host ucert/host PKG_BUILD_DEPENDS:=usign/host ucert/host
@ -30,14 +30,14 @@ PKG_CONFIG_DEPENDS += \
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
ifneq ($(DUMP),1) 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) TARGET:=-$(BOARD)
endif endif
define Package/base-files define Package/base-files
SECTION:=base SECTION:=base
CATEGORY:=Base system 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 TITLE:=Base filesystem for OpenWrt
URL:=http://openwrt.org/ URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)-$(REVISION) VERSION:=$(PKG_RELEASE)-$(REVISION)
@ -47,7 +47,6 @@ define Package/base-files/conffiles
/etc/config/ /etc/config/
/etc/config/network /etc/config/network
/etc/config/system /etc/config/system
/etc/crontabs/
/etc/dropbear/ /etc/dropbear/
/etc/ethers /etc/ethers
/etc/group /etc/group
@ -109,14 +108,12 @@ ifdef CONFIG_SIGNED_PACKAGES
endef endef
ifndef CONFIG_BUILDBOT
define Package/base-files/install-key define Package/base-files/install-key
mkdir -p $(1)/etc/opkg/keys mkdir -p $(1)/etc/opkg/keys
$(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub` $(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub`
endef endef
endif endif
endif
ifeq ($(CONFIG_NAND_SUPPORT),) ifeq ($(CONFIG_NAND_SUPPORT),)
define Package/base-files/nand-support define Package/base-files/nand-support
@ -192,16 +189,12 @@ define Package/base-files/install
$(if $(CONFIG_INCLUDE_CONFIG), \ $(if $(CONFIG_INCLUDE_CONFIG), \
echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.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)/config.seed >>$(1)/etc/build.config)
cat $(BIN_DIR)/feeds.buildinfo >>$(1)/etc/build.feeds; \
cat $(BIN_DIR)/version.buildinfo >>$(1)/etc/build.version)
$(if $(CONFIG_CLEAN_IPKG),, \ $(if $(CONFIG_CLEAN_IPKG),, \
mkdir -p $(1)/etc/opkg; \ mkdir -p $(1)/etc/opkg; \
$(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf); \ $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf); \
$(VERSION_SED_SCRIPT) $(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 endef
ifneq ($(DUMP),1) ifneq ($(DUMP),1)

View File

@ -5,7 +5,7 @@ CFG=$1
[ -n "$CFG" ] || CFG=/etc/board.json [ -n "$CFG" ] || CFG=/etc/board.json
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && { [ -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; [ -x $a ] || continue;
$(. $a) $(. $a)
done done

View File

@ -7,6 +7,35 @@ CFG=/etc/board.json
[ -s $CFG ] || /bin/board_detect || exit 1 [ -s $CFG ] || /bin/board_detect || exit 1
[ -s /etc/config/network -a -s /etc/config/system ] && exit 0 [ -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() { generate_static_network() {
uci -q batch <<-EOF uci -q batch <<-EOF
delete network.loopback delete network.loopback
@ -62,20 +91,47 @@ generate_static_network() {
addr_offset=2 addr_offset=2
generate_network() { 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 network
json_select "$1" 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 ..
json_select .. json_select ..
[ -n "$ifname" ] || return [ -n "$ifname" -o -n "$ports" ] || return
# force bridge for multi-interface devices (and lan) # Force bridge for "lan" as it may have other devices (e.g. wireless)
case "$1:$ifname" in # bridged
*\ * | lan:*) type="bridge" ;; [ "$1" = "lan" -a -z "$ports" ] && {
esac 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 uci -q batch <<-EOF
delete network.$1 delete network.$1
@ -236,7 +292,6 @@ generate_switch() {
json_select .. json_select ..
} }
generate_static_system() { generate_static_system() {
uci -q batch <<-EOF uci -q batch <<-EOF
delete system.@system[0] delete system.@system[0]
@ -254,7 +309,7 @@ generate_static_system() {
add_list system.ntp.server='ntp1.aliyun.com' add_list system.ntp.server='ntp1.aliyun.com'
add_list system.ntp.server='time1.cloud.tencent.com' add_list system.ntp.server='time1.cloud.tencent.com'
add_list system.ntp.server='time.ustc.edu.cn' 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 EOF
if json_is_a system object; then if json_is_a system object; then
@ -426,14 +481,22 @@ generate_gpioswitch() {
json_init json_init
json_load "$(cat ${CFG})" json_load "$(cat ${CFG})"
umask 077
if [ ! -s /etc/config/network ]; then if [ ! -s /etc/config/network ]; then
bridge_name=""
touch /etc/config/network touch /etc/config/network
generate_static_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 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 json_get_keys keys switch
for key in $keys; do generate_switch $key; done for key in $keys; do generate_switch $key; done

View File

0
package/base-files/files/etc/diag.sh Normal file → Executable file
View File

0
package/base-files/files/etc/hotplug.d/net/00-sysctl Normal file → Executable file
View File

View File

@ -20,7 +20,6 @@ uci_apply_defaults() {
boot() { boot() {
[ -f /proc/mounts ] || /sbin/mount_root [ -f /proc/mounts ] || /sbin/mount_root
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc [ -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/run
mkdir -p /var/log mkdir -p /var/log
@ -34,7 +33,10 @@ boot() {
mkdir -p /tmp/resolv.conf.d mkdir -p /tmp/resolv.conf.d
touch /tmp/resolv.conf.d/resolv.conf.auto 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
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 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 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
/sbin/kmodloader /sbin/kmodloader

View File

@ -21,7 +21,7 @@ load_led() {
config_get dev $1 dev config_get dev $1 dev
config_get ports $1 port config_get ports $1 port
config_get mode $1 mode 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 delayon $1 delayon
config_get delayoff $1 delayoff config_get delayoff $1 delayoff
config_get interval $1 interval "50" config_get interval $1 interval "50"
@ -31,10 +31,11 @@ load_led() {
config_get gpio $1 gpio "0" config_get gpio $1 gpio "0"
config_get inverted $1 inverted "0" config_get inverted $1 inverted "0"
if [ "$trigger" = "rssi" ]; then # execute application led trigger
# handled by rssileds userspace process [ -f "/usr/libexec/led-trigger/${trigger}" ] && {
return . "/usr/libexec/led-trigger/${trigger}"
fi return 0
}
[ "$trigger" = "usbdev" ] && { [ "$trigger" = "usbdev" ] && {
# Backward compatibility: translate to the new trigger # Backward compatibility: translate to the new trigger

View File

@ -27,7 +27,7 @@ system_config() {
ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ
# apply timezone to kernel # apply timezone to kernel
busybox date -k hwclock -u --systz
} }
reload_service() { reload_service() {

View File

@ -1,3 +1,4 @@
#!/bin/sh
[ -e /tmp/.failsafe ] && export FAILSAFE=1 [ -e /tmp/.failsafe ] && export FAILSAFE=1
[ -f /etc/banner ] && cat /etc/banner [ -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=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
export HOME=${HOME:-/root} export HOME=${HOME:-/root}
export PS1='\u@\h:\w\$ ' export PS1='\u@\h:\w\$ '
export ENV=/etc/shinit
case "$TERM" in case "$TERM" in
xterm*|rxvt*) xterm*|rxvt*)
@ -20,6 +20,16 @@ case "$TERM" in
;; ;;
esac 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" ] || { [ -n "$FAILSAFE" ] || {
for FILE in /etc/profile.d/*.sh; do for FILE in /etc/profile.d/*.sh; do
[ -e "$FILE" ] && . "$FILE" [ -e "$FILE" ] && . "$FILE"
@ -38,3 +48,12 @@ in order to prevent unauthorized SSH logins.
-------------------------------------------------- --------------------------------------------------
EOF EOF
fi 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/$@
}

0
package/base-files/files/etc/rc.local Normal file → Executable file
View File

24
package/base-files/files/etc/shinit Normal file → Executable file
View File

@ -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 [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
alias ll='ls -alF --color=auto' 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 $*; } [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
service() { service() {
[ -f "/etc/init.d/$1" ] || { if [ -f "/etc/init.d/$1" ]; then
echo "service "'"'"$1"'"'" not found, the following services are available:"
ls "/etc/init.d"
return 1
}
/etc/init.d/$@ /etc/init.d/$@
else
echo "Usage: service <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
fi
} }
[ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit" [ -n "$KSH_VERSION" -o \! -s "$HOME/.shinit" ] || . "$HOME/.shinit"

View File

@ -8,8 +8,6 @@ fs.suid_dumpable=2
fs.protected_hardlinks=1 fs.protected_hardlinks=1
fs.protected_symlinks=1 fs.protected_symlinks=1
net.core.bpf_jit_enable=1
net.ipv4.conf.default.arp_ignore=1 net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1 net.ipv4.conf.all.arp_ignore=1
net.ipv4.ip_forward=1 net.ipv4.ip_forward=1

View File

View File

View File

@ -1,6 +1,6 @@
. /lib/functions.sh . /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##*/}"
file="${file%.control}" file="${file%.control}"
add_group_and_user "${file}" add_group_and_user "${file}"

64
package/base-files/files/lib/functions.sh Executable file → Normal file
View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006-2014 OpenWrt.org # Copyright (C) 2006-2014 OpenWrt.org
# Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de> # Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de>
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
@ -70,7 +69,7 @@ config () {
local cfgtype="$1" local cfgtype="$1"
local name="$2" 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}" name="${name:-cfg$CONFIG_NUM_SECTIONS}"
append CONFIG_SECTIONS "$name" append CONFIG_SECTIONS "$name"
export ${NO_EXPORT:+-n} CONFIG_SECTION="$name" export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
@ -93,7 +92,7 @@ list() {
config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0 config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}" [ $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}_ITEM$len" "$value"
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len" config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP" append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
@ -108,20 +107,27 @@ config_unset() {
# config_get <section> <option> # config_get <section> <option>
config_get() { config_get() {
case "$3" in case "$3" in
"") eval echo "\"\${CONFIG_${1}_${2}:-\${4}}\"";; "") eval echo "\${CONFIG_${1}_${2}:-\${4}}";;
*) eval export ${NO_EXPORT:+-n} -- "${1}=\${CONFIG_${2}_${3}:-\${4}}";; *) eval export ${NO_EXPORT:+-n} -- "${1}=\${CONFIG_${2}_${3}:-\${4}}";;
esac esac
} }
# get_bool <value> [<default>]
get_bool() {
local _tmp="$1"
case "$_tmp" in
1|on|true|yes|enabled) _tmp=1;;
0|off|false|no|disabled) _tmp=0;;
*) _tmp="$2";;
esac
echo -n "$_tmp"
}
# config_get_bool <variable> <section> <option> [<default>] # config_get_bool <variable> <section> <option> [<default>]
config_get_bool() { config_get_bool() {
local _tmp local _tmp
config_get _tmp "$2" "$3" "$4" config_get _tmp "$2" "$3" "$4"
case "$_tmp" in _tmp="$(get_bool "$_tmp" "$4")"
1|on|true|yes|enabled) _tmp=1;;
0|off|false|no|disabled) _tmp=0;;
*) _tmp="$4";;
esac
export ${NO_EXPORT:+-n} "$1=$_tmp" export ${NO_EXPORT:+-n} "$1=$_tmp"
} }
@ -143,7 +149,7 @@ config_foreach() {
[ -z "$CONFIG_SECTIONS" ] && return 0 [ -z "$CONFIG_SECTIONS" ] && return 0
for section in ${CONFIG_SECTIONS}; do for section in ${CONFIG_SECTIONS}; do
config_get cfgtype "$section" TYPE config_get cfgtype "$section" TYPE
[ -n "$___type" ] && [ "x$cfgtype" != "x$___type" ] && continue [ -n "$___type" -a "x$cfgtype" != "x$___type" ] && continue
eval "$___function \"\$section\" \"\$@\"" eval "$___function \"\$section\" \"\$@\""
done done
} }
@ -162,7 +168,7 @@ config_list_foreach() {
while [ $c -le "$len" ]; do while [ $c -le "$len" ]; do
config_get val "${section}" "${option}_ITEM$c" config_get val "${section}" "${option}_ITEM$c"
eval "$function \"\$val\" \"\$@\"" eval "$function \"\$val\" \"\$@\""
c="$((c + 1))" c="$(($c + 1))"
done done
} }
@ -176,7 +182,7 @@ default_prerm() {
ret=$? ret=$?
fi fi
local shell="$(which bash)" local shell="$(command -v bash)"
for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
if [ -n "$root" ]; then if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
@ -229,7 +235,6 @@ add_group_and_user() {
default_postinst() { default_postinst() {
local root="${IPKG_INSTROOT}" local root="${IPKG_INSTROOT}"
local pkgname="$(basename ${1%.*})" local pkgname="$(basename ${1%.*})"
local filelist="/usr/lib/opkg/info/${pkgname}.list"
local ret=0 local ret=0
add_group_and_user "${pkgname}" add_group_and_user "${pkgname}"
@ -244,28 +249,23 @@ default_postinst() {
rm -fR $root/rootfs-overlay/ rm -fR $root/rootfs-overlay/
fi fi
if [ -z "$root" ]; then if [ -z "$root" ] && grep -q -s "^/etc/modules.d/" "/usr/lib/opkg/info/${pkgname}.list"; then
if grep -m1 -q -s "^/etc/modules.d/" "$filelist"; then
kmodloader kmodloader
fi fi
if grep -m1 -q -s "^/etc/sysctl.d/" "$filelist"; then if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
/etc/init.d/sysctl restart . /lib/functions/system.sh
fi
if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci [ -d /tmp/.uci ] || mkdir -p /tmp/.uci
for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i" ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
done done
uci commit uci commit
fi fi
rm -f /tmp/luci-indexcache [ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
fi
local shell="$(which bash)" local shell="$(command -v bash)"
for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
if [ -n "$root" ]; then if [ -n "$root" ]; then
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
else else
@ -323,9 +323,9 @@ group_add_next() {
echo $gid echo $gid
return return
fi fi
gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group) gids=$(cat ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
gid=65536 gid=65536
while echo "$gids" | grep -q "^$gid$"; do while [ -n "$(echo "$gids" | grep "^$gid$")" ] ; do
gid=$((gid + 1)) gid=$((gid + 1))
done done
group_add $1 $gid group_add $1 $gid
@ -335,8 +335,8 @@ group_add_next() {
group_add_user() { group_add_user() {
local grp delim="," local grp delim=","
grp=$(grep -s "^${1}:" ${IPKG_INSTROOT}/etc/group) grp=$(grep -s "^${1}:" ${IPKG_INSTROOT}/etc/group)
echo "$grp" | cut -d: -f4 | grep -q $2 && return [ -z "$(echo $grp | cut -d: -f4 | grep $2)" ] || return
echo "$grp" | grep -q ":$" && delim="" [ -n "$(echo $grp | grep ":$")" ] && delim=""
[ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd [ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd
sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group
[ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd [ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd
@ -351,9 +351,9 @@ user_add() {
local shell="${6:-/bin/false}" local shell="${6:-/bin/false}"
local rc local rc
[ -z "$uid" ] && { [ -z "$uid" ] && {
uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd) uids=$(cat ${IPKG_INSTROOT}/etc/passwd | cut -d: -f3)
uid=65536 uid=65536
while echo "$uids" | grep -q "^$uid$"; do while [ -n "$(echo "$uids" | grep "^$uid$")" ] ; do
uid=$((uid + 1)) uid=$((uid + 1))
done done
} }
@ -373,4 +373,4 @@ board_name() {
[ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic" [ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic"
} }
[ -z "$IPKG_INSTROOT" ] && [ -f /lib/config/uci.sh ] && . /lib/config/uci.sh [ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh

View File

@ -3,6 +3,16 @@
. /lib/functions.sh . /lib/functions.sh
. /lib/functions/system.sh . /lib/functions/system.sh
caldata_dd() {
local source=$1
local target=$2
local count=$(($3))
local offset=$(($4))
dd if=$source of=$target iflag=skip_bytes,fullblock bs=$count skip=$offset count=1 2>/dev/null
return $?
}
caldata_die() { caldata_die() {
echo "caldata: " "$*" echo "caldata: " "$*"
exit 1 exit 1
@ -17,7 +27,7 @@ caldata_extract() {
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ caldata_dd $mtd /lib/firmware/$FIRMWARE $count $offset || \
caldata_die "failed to extract calibration data from $mtd" caldata_die "failed to extract calibration data from $mtd"
} }
@ -34,7 +44,7 @@ caldata_extract_ubi() {
ubi=$(nand_find_volume $ubidev $part) ubi=$(nand_find_volume $ubidev $part)
[ -n "$ubi" ] || caldata_die "no UBI volume found for $part" [ -n "$ubi" ] || caldata_die "no UBI volume found for $part"
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ caldata_dd /dev/$ubi /lib/firmware/$FIRMWARE $count $offset || \
caldata_die "failed to extract calibration data from $ubi" caldata_die "failed to extract calibration data from $ubi"
} }
@ -64,8 +74,7 @@ caldata_from_file() {
[ -n "$target" ] || target=/lib/firmware/$FIRMWARE [ -n "$target" ] || target=/lib/firmware/$FIRMWARE
# dd doesn't handle partial reads from special files: use cat caldata_dd $source $target $count $offset || \
cat $source | dd of=$target iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
caldata_die "failed to extract calibration data from $source" caldata_die "failed to extract calibration data from $source"
} }
@ -73,16 +82,20 @@ caldata_sysfsload_from_file() {
local source=$1 local source=$1
local offset=$(($2)) local offset=$(($2))
local count=$(($3)) local count=$(($3))
local target_dir="/sys/$DEVPATH"
local target="$target_dir/data"
# dd doesn't handle partial reads from special files: use cat [ -d "$target_dir" ] || \
# test extract to /dev/null first caldata_die "no sysfs dir to write: $target"
cat $source | dd of=/dev/null iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
echo 1 > "$target_dir/loading"
caldata_dd $source $target $count $offset
if [ $? != 0 ]; then
echo 1 > "$target_dir/loading"
caldata_die "failed to extract calibration data from $source" caldata_die "failed to extract calibration data from $source"
else
# can't fail now echo 0 > "$target_dir/loading"
echo 1 > /sys/$DEVPATH/loading fi
cat $source | dd of=/sys/$DEVPATH/data iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null
echo 0 > /sys/$DEVPATH/loading
} }
caldata_valid() { caldata_valid() {

4
package/base-files/files/lib/functions/leds.sh Normal file → Executable file
View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2013 OpenWrt.org # Copyright (C) 2013 OpenWrt.org
get_dt_led_path() { get_dt_led_path() {
@ -18,7 +17,8 @@ get_dt_led() {
[ -n "$ledpath" ] && \ [ -n "$ledpath" ] && \
label=$(cat "$ledpath/label" 2>/dev/null) || \ label=$(cat "$ledpath/label" 2>/dev/null) || \
label=$(cat "$ledpath/chan-name" 2>/dev/null) label=$(cat "$ledpath/chan-name" 2>/dev/null) || \
label=$(basename "$ledpath")
echo "$label" echo "$label"
} }

View File

@ -1,5 +1,3 @@
#!/bin/sh
. /lib/functions.sh . /lib/functions.sh
migrate_led_sysfs() { migrate_led_sysfs() {
@ -28,11 +26,41 @@ migrate_led_sysfs() {
done; done;
} }
remove_devicename_led_sysfs() {
local cfg="$1"; shift
local exceptions="$@"
local sysfs
local name
local new_sysfs
config_get sysfs ${cfg} sysfs
config_get name ${cfg} name
# only continue if two or more colons are present
echo "${sysfs}" | grep -q ":.*:" || return
for exception in ${exceptions}; do
# no change if exceptions provided as argument are found for devicename
echo "${sysfs}" | grep -q "^${exception}:" && return
done
new_sysfs=$(echo ${sysfs} | sed "s/^[^:]*://")
uci set system.${cfg}.sysfs="${new_sysfs}"
logger -t led-migration "sysfs option of LED \"${name}\" updated to ${new_sysfs}"
}
migrate_leds() { migrate_leds() {
config_load system config_load system
config_foreach migrate_led_sysfs led "$@" config_foreach migrate_led_sysfs led "$@"
} }
remove_devicename_leds() {
config_load system
config_foreach remove_devicename_led_sysfs led "$@"
}
migrations_apply() { migrations_apply() {
local realm="$1" local realm="$1"
[ -n "$(uci changes ${realm})" ] && uci -q commit ${realm} [ -n "$(uci changes ${realm})" ] && uci -q commit ${realm}

2
package/base-files/files/lib/functions/network.sh Normal file → Executable file
View File

@ -255,7 +255,7 @@ network_find_wan() { __network_wan "$1" "0.0.0.0" "$2"; }
# find the logical interface which holds the current IPv6 default route # find the logical interface which holds the current IPv6 default route
# 1: destination variable # 1: destination variable
# 2: consider inactive dafault routes if "true" (optional) # 2: consider inactive default routes if "true" (optional)
network_find_wan6() { __network_wan "$1" "::" "$2"; } network_find_wan6() { __network_wan "$1" "::" "$2"; }
# test whether the given logical interface is running # test whether the given logical interface is running

1
package/base-files/files/lib/functions/preinit.sh Normal file → Executable file
View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006-2013 OpenWrt.org # Copyright (C) 2006-2013 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

0
package/base-files/files/lib/functions/service.sh Normal file → Executable file
View File

0
package/base-files/files/lib/functions/system.sh Normal file → Executable file
View File

31
package/base-files/files/lib/functions/uci-defaults.sh Executable file → Normal file
View File

@ -1,5 +1,3 @@
#!/bin/ash
. /lib/functions.sh . /lib/functions.sh
. /usr/share/libubox/jshn.sh . /usr/share/libubox/jshn.sh
@ -41,7 +39,13 @@ ucidef_set_interface() {
[ -n "$opt" -a -n "$val" ] || break [ -n "$opt" -a -n "$val" ] || break
[ "$opt" = "ifname" -a "$val" != "${val/ //}" ] && {
json_select_array "ports"
for e in $val; do json_add_string "" "$e"; done
json_close_array
} || {
json_add_string "$opt" "$val" json_add_string "$opt" "$val"
}
done done
if ! json_is_a protocol string; then if ! json_is_a protocol string; then
@ -84,6 +88,26 @@ ucidef_set_interfaces_lan_wan() {
ucidef_set_interface_wan "$wan_if" ucidef_set_interface_wan "$wan_if"
} }
ucidef_set_bridge_device() {
json_select_object bridge
json_add_string name "${1:switch0}"
json_select ..
}
ucidef_set_bridge_mac() {
json_select_object bridge
json_add_string macaddr "${1}"
json_select ..
}
ucidef_set_network_device_mac() {
json_select_object "network-device"
json_select_object "${1}"
json_add_string macaddr "${2}"
json_select ..
json_select ..
}
_ucidef_add_switch_port() { _ucidef_add_switch_port() {
# inherited: $num $device $need_tag $want_untag $role $index $prev_role # inherited: $num $device $need_tag $want_untag $role $index $prev_role
# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5 # inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
@ -615,5 +639,6 @@ board_config_update() {
} }
board_config_flush() { board_config_flush() {
json_dump -i -o ${CFG} json_dump -i > /tmp/.board.json
mv /tmp/.board.json ${CFG}
} }

View File

@ -1,5 +1,3 @@
#!/bin/sh
define_default_set_state() { define_default_set_state() {
. /etc/diag.sh . /etc/diag.sh
} }

0
package/base-files/files/lib/preinit/02_sysinfo Normal file → Executable file
View File

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

8
package/base-files/files/lib/preinit/30_failsafe_wait Normal file → Executable file
View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org # Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
@ -31,8 +30,6 @@ fs_wait_for_key () {
lock $keypress_wait lock $keypress_wait
{ {
while [ $timer -gt 0 ]; do while [ $timer -gt 0 ]; do
pi_failsafe_net_message=true \
preinit_net_echo "Please press button now to enter failsafe"
echo "$timer" >$keypress_sec echo "$timer" >$keypress_sec
timer=$(($timer - 1)) timer=$(($timer - 1))
sleep 1 sleep 1
@ -90,8 +87,11 @@ failsafe_wait() {
} }
grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE
if [ "$FAILSAFE" != "true" ]; then if [ "$FAILSAFE" != "true" ]; then
pi_failsafe_net_message=true
preinit_net_echo "Please press button now to enter failsafe"
pi_failsafe_net_message=false
fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true
[ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "`cat /tmp/failsafe_button`" was pressed -" [ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "$(cat /tmp/failsafe_button)" was pressed -"
[ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe [ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe
fi fi
} }

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org # Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

1
package/base-files/files/lib/preinit/70_initramfs_test Normal file → Executable file
View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

6
package/base-files/files/lib/preinit/80_mount_root Normal file → Executable file
View File

@ -1,14 +1,14 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
do_mount_root() { do_mount_root() {
mount_root mount_root
boot_run_hook preinit_mount_root boot_run_hook preinit_mount_root
[ -f /sysupgrade.tgz ] && { [ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && {
echo "- config restore -" echo "- config restore -"
cd / cd /
tar xzf /sysupgrade.tgz [ -f /sysupgrade.tgz ] && tar xzf /sysupgrade.tgz
[ -f /tmp/sysupgrade.tar ] && tar xf /tmp/sysupgrade.tar
# Prevent configuration corruption on a power loss # Prevent configuration corruption on a power loss
sync sync
} }

View File

@ -1,7 +1,11 @@
#!/bin/sh
# Copyright (C) 2006-2015 OpenWrt.org # Copyright (C) 2006-2015 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
failsafe_netlogin () {
dropbearkey -t rsa -s 1024 -f /tmp/dropbear_failsafe_host_key
dropbear -r /tmp/dropbear_failsafe_host_key <> /dev/null 2>&1
}
failsafe_shell() { failsafe_shell() {
local console="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | head -1 | sed -e 's/^console=//' -e 's/,.*//')" local console="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | head -1 | sed -e 's/^console=//' -e 's/,.*//')"
[ -n "$console" ] || console=console [ -n "$console" ] || console=console
@ -12,4 +16,5 @@ failsafe_shell() {
done & done &
} }
boot_hook_add failsafe failsafe_netlogin
boot_hook_add failsafe failsafe_shell boot_hook_add failsafe failsafe_shell

1
package/base-files/files/lib/preinit/99_10_run_init Normal file → Executable file
View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org # Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications

144
package/base-files/files/lib/upgrade/common.sh Normal file → Executable file
View File

@ -1,11 +1,7 @@
#!/bin/sh
RAM_ROOT=/tmp/root RAM_ROOT=/tmp/root
export BACKUP_FILE=sysupgrade.tgz # file extracted by preinit
[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
libs() { ldd $* 2>/dev/null | sed -E 's/(.* => )?(.*) .*/\2/'; } libs() { ldd $* 2>/dev/null | sed -r 's/(.* => )?(.*) .*/\2/'; }
install_file() { # <file> [ <file> ... ] install_file() { # <file> [ <file> ... ]
local target dest dir local target dest dir
@ -102,83 +98,54 @@ get_magic_long() {
(get_image "$@" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null (get_image "$@" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null
} }
get_magic_gpt() {
(get_image "$@" | dd bs=8 count=1 skip=64) 2>/dev/null
}
get_magic_vfat() {
(get_image "$@" | dd bs=1 count=3 skip=54) 2>/dev/null
}
part_magic_efi() {
local magic=$(get_magic_gpt "$@")
[ "$magic" = "EFI PART" ]
}
part_magic_fat() {
local magic=$(get_magic_vfat "$@")
[ "$magic" = "FAT" ]
}
export_bootdevice() { export_bootdevice() {
local cmdline bootdisk rootpart uuid blockdev uevent line class local cmdline uuid disk uevent line
local MAJOR MINOR DEVNAME DEVTYPE local MAJOR MINOR DEVNAME DEVTYPE
if read cmdline < /proc/cmdline; then if read cmdline < /proc/cmdline; then
case "$cmdline" in case "$cmdline" in
*block2mtd=*) *block2mtd=*)
bootdisk="${cmdline##*block2mtd=}" disk="${cmdline##*block2mtd=}"
bootdisk="${bootdisk%%,*}" disk="${disk%%,*}"
;; ;;
*root=*) *root=*)
rootpart="${cmdline##*root=}" disk="${cmdline##*root=}"
rootpart="${rootpart%% *}" disk="${disk%% *}"
;; ;;
esac esac
case "$bootdisk" in case "$disk" in
/dev/*) PARTUUID=[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]0002)
uevent="/sys/class/block/${bootdisk##*/}/uevent" uuid="${disk#PARTUUID=}"
;; uuid="${uuid%0002}0002"
esac for disk in $(find /dev -type b); do
set -- $(dd if=$disk bs=1 skip=$((2*512+256+128+16)) count=16 2>/dev/null | hexdump -v -e '4/1 "%02x"' | awk '{ \
case "$rootpart" in for(i=1;i<9;i=i+2) first=substr($0,i,1) substr($0,i+1,1) first; \
PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9]) for(i=9;i<13;i=i+2) second=substr($0,i,1) substr($0,i+1,1) second; \
uuid="${rootpart#PARTUUID=}" for(i=13;i<16;i=i+2) third=substr($0,i,1) substr($0,i+1,1) third; \
uuid="${uuid%-[a-f0-9][a-f0-9]}" fourth = substr($0,17,4); \
for blockdev in $(find /dev -type b); do five = substr($0,21,12); \
set -- $(dd if=$blockdev bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') } END { print toupper(first"-"second"-"third"-"fourth"-"five) }')
if [ "$4$3$2$1" = "$uuid" ]; then if [ "$1" = "$uuid" ]; then
uevent="/sys/class/block/${blockdev##*/}/uevent" uevent="/sys/class/block/${disk##*/}/uevent"
export SAVE_PARTITIONS=0
break break
fi fi
done done
;; ;;
PARTUUID=????????-????-????-????-??????????02) PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
uuid="${rootpart#PARTUUID=}" uuid="${disk#PARTUUID=}"
uuid="${uuid%02}00" uuid="${uuid%-02}"
for disk in $(find /dev -type b); do for disk in $(find /dev -type b); do
set -- $(dd if=$disk bs=1 skip=568 count=16 2>/dev/null | hexdump -v -e '8/1 "%02x "" "2/1 "%02x""-"6/1 "%02x"') set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
if [ "$4$3$2$1-$6$5-$8$7-$9" = "$uuid" ]; then if [ "$4$3$2$1" = "$uuid" ]; then
uevent="/sys/class/block/${disk##*/}/uevent" uevent="/sys/class/block/${disk##*/}/uevent"
break break
fi fi
done done
;; ;;
/dev/*) /dev/*)
uevent="/sys/class/block/${rootpart##*/}/../uevent" uevent="/sys/class/block/${disk##*/}/uevent"
;;
0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \
[a-f0-9][a-f0-9][a-f0-9] | [a-f0-9][a-f0-9][a-f0-9][a-f0-9])
rootpart=0x${rootpart#0x}
for class in /sys/class/block/*; do
while read line; do
export -n "$line"
done < "$class/uevent"
if [ $((rootpart/256)) = $MAJOR -a $((rootpart%256)) = $MINOR ]; then
uevent="$class/../uevent"
fi
done
;; ;;
esac esac
@ -236,22 +203,6 @@ get_partitions() { # <device> <filename>
rm -f "/tmp/partmap.$filename" rm -f "/tmp/partmap.$filename"
local part local part
part_magic_efi "$disk" && {
#export_partdevice will fail when partition number is greater than 15, as
#the partition major device number is not equal to the disk major device number
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
set -- $(hexdump -v -n 48 -s "$((0x380 + $part * 0x80))" -e '4/4 "%08x"" "4/4 "%08x"" "4/4 "0x%08X "' "$disk")
local type="$1"
local lba="$(( $(hex_le32_to_cpu $4) * 0x100000000 + $(hex_le32_to_cpu $3) ))"
local end="$(( $(hex_le32_to_cpu $6) * 0x100000000 + $(hex_le32_to_cpu $5) ))"
local num="$(( $end - $lba ))"
[ "$type" = "00000000000000000000000000000000" ] && continue
printf "%2d %5d %7d\n" $part $lba $num >> "/tmp/partmap.$filename"
done
} || {
for part in 1 2 3 4; do for part in 1 2 3 4; do
set -- $(hexdump -v -n 12 -s "$((0x1B2 + $part * 16))" -e '3/4 "0x%08X "' "$disk") set -- $(hexdump -v -n 12 -s "$((0x1B2 + $part * 16))" -e '3/4 "0x%08X "' "$disk")
@ -263,7 +214,16 @@ get_partitions() { # <device> <filename>
printf "%2d %5d %7d\n" $part $lba $num >> "/tmp/partmap.$filename" printf "%2d %5d %7d\n" $part $lba $num >> "/tmp/partmap.$filename"
done done
} fi
}
jffs2_copy_config() {
if grep rootfs_data /proc/mtd >/dev/null; then
# squashfs+jffs2
mtd -e rootfs_data jffs2write "$CONF_TAR" rootfs_data
else
# jffs2
mtd jffs2write "$CONF_TAR" rootfs
fi fi
} }
@ -278,10 +238,34 @@ indicate_upgrade() {
# $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m
default_do_upgrade() { default_do_upgrade() {
sync sync
if [ -n "$UPGRADE_BACKUP" ]; then if [ "$SAVE_CONFIG" -eq 1 ]; then
get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j "$UPGRADE_BACKUP" write - "${PART_NAME:-image}" get_image "$1" "$2" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}"
else else
get_image "$1" "$2" | mtd $MTD_ARGS write - "${PART_NAME:-image}" get_image "$1" "$2" | mtd write - "${PART_NAME:-image}"
fi fi
[ $? -ne 0 ] && exit 1 [ $? -ne 0 ] && exit 1
} }
do_upgrade_stage2() {
v "Performing system upgrade..."
if [ -n "$do_upgrade" ]; then
eval "$do_upgrade"
elif type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
platform_do_upgrade "$IMAGE"
else
default_do_upgrade "$IMAGE"
fi
if [ "$SAVE_CONFIG" -eq 1 ] && type 'platform_copy_config' >/dev/null 2>/dev/null; then
platform_copy_config
fi
v "Upgrade completed"
sleep 1
v "Rebooting system..."
umount -a
reboot -f
sleep 5
echo b 2>/dev/null >/proc/sysrq-trigger
}

View File

@ -1,25 +0,0 @@
#!/bin/sh
. /lib/functions.sh
include /lib/upgrade
v "Performing system upgrade..."
if type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
platform_do_upgrade "$IMAGE"
else
default_do_upgrade "$IMAGE"
fi
if [ -n "$UPGRADE_BACKUP" ] && type 'platform_copy_config' >/dev/null 2>/dev/null; then
platform_copy_config
fi
v "Upgrade completed"
sleep 1
v "Rebooting system..."
umount -a
reboot -f
sleep 5
echo b 2>/dev/null >/proc/sysrq-trigger

5
package/base-files/files/lib/upgrade/fwtool.sh Normal file → Executable file
View File

@ -9,7 +9,7 @@ fwtool_check_signature() {
fi fi
} }
if ! fwtool -q -s /tmp/sysupgrade.ucert "$1"; then if ! fwtool -q -t -s /tmp/sysupgrade.ucert "$1"; then
echo "Image signature not found" echo "Image signature not found"
[ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && { [ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && {
echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware"
@ -18,8 +18,7 @@ fwtool_check_signature() {
return 0 return 0
fi fi
fwtool -q -T -s /dev/null "$1" | \ ucert -V -m "$1" -c "/tmp/sysupgrade.ucert" -P /etc/opkg/keys
ucert -V -m - -c "/tmp/sysupgrade.ucert" -P /etc/opkg/keys
return $? return $?
} }

121
package/base-files/files/lib/upgrade/nand.sh Normal file → Executable file
View File

@ -1,16 +1,15 @@
#!/bin/sh
# Copyright (C) 2014 OpenWrt.org # Copyright (C) 2014 OpenWrt.org
# #
. /lib/functions.sh . /lib/functions.sh
# 'kernel' partition on NAND contains the kernel # 'kernel' partition or UBI volume on NAND contains the kernel
CI_KERNPART="${CI_KERNPART:-kernel}" CI_KERNPART="${CI_KERNPART:-kernel}"
# 'ubi' partition on NAND contains UBI # 'ubi' partition on NAND contains UBI
CI_UBIPART="${CI_UBIPART:-ubi}" CI_UBIPART="${CI_UBIPART:-ubi}"
# 'rootfs' partition on NAND contains the rootfs # 'rootfs' UBI volume on NAND contains the rootfs
CI_ROOTPART="${CI_ROOTPART:-rootfs}" CI_ROOTPART="${CI_ROOTPART:-rootfs}"
ubi_mknod() { ubi_mknod() {
@ -109,7 +108,7 @@ nand_restore_config() {
rmdir /tmp/new_root rmdir /tmp/new_root
return 1 return 1
fi fi
mv "$1" "/tmp/new_root/$BACKUP_FILE" mv "$1" "/tmp/new_root/sysupgrade.tgz"
umount /tmp/new_root umount /tmp/new_root
sync sync
rmdir /tmp/new_root rmdir /tmp/new_root
@ -118,8 +117,12 @@ nand_restore_config() {
nand_upgrade_prepare_ubi() { nand_upgrade_prepare_ubi() {
local rootfs_length="$1" local rootfs_length="$1"
local rootfs_type="$2" local rootfs_type="$2"
local has_kernel="${3:-0}" local kernel_length="$3"
local has_env="${4:-0}" local has_env="${4:-0}"
local rootfs_data_max="$(fw_printenv -n rootfs_data_max 2>/dev/null)"
[ -n "$rootfs_data_max" ] && rootfs_data_max=$(($rootfs_data_max))
[ -n "$rootfs_length" -o -n "$kernel_length" ] || return 1
local mtdnum="$( find_mtd_index "$CI_UBIPART" )" local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
if [ ! "$mtdnum" ]; then if [ ! "$mtdnum" ]; then
@ -149,23 +152,24 @@ nand_upgrade_prepare_ubi() {
local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
local data_ubivol="$( nand_find_volume $ubidev rootfs_data )" local data_ubivol="$( nand_find_volume $ubidev rootfs_data )"
# remove ubiblock device of rootfs local ubiblk ubiblkvol
local root_ubiblk="ubiblock${root_ubivol:3}" for ubiblk in /dev/ubiblock*_? ; do
if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then [ -e "$ubiblk" ] || continue
echo "removing $root_ubiblk" echo "removing ubiblock${ubiblk:13}"
if ! ubiblock -r /dev/$root_ubivol; then ubiblkvol=ubi${ubiblk:13}
echo "cannot remove $root_ubiblk" if ! ubiblock -r /dev/$ubiblkvol; then
return 1; echo "cannot remove $ubiblk"
fi return 1
fi fi
done
# kill volumes # kill volumes
[ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true
[ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true [ "$root_ubivol" -a "$root_ubivol" != "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true
[ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true
# update kernel # update kernel
if [ "$has_kernel" = "1" ]; then if [ -n "$kernel_length" ]; then
if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then if ! ubimkvol /dev/$ubidev -N $CI_KERNPART -s $kernel_length; then
echo "cannot create kernel volume" echo "cannot create kernel volume"
return 1; return 1;
@ -173,20 +177,31 @@ nand_upgrade_prepare_ubi() {
fi fi
# update rootfs # update rootfs
local root_size_param if [ -n "$rootfs_length" ]; then
local rootfs_size_param
if [ "$rootfs_type" = "ubifs" ]; then if [ "$rootfs_type" = "ubifs" ]; then
root_size_param="-m" rootfs_size_param="-m"
else else
root_size_param="-s $rootfs_length" rootfs_size_param="-s $rootfs_length"
fi fi
if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $root_size_param; then if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then
echo "cannot create rootfs volume" echo "cannot create rootfs volume"
return 1; return 1;
fi fi
fi
# create rootfs_data for non-ubifs rootfs # create rootfs_data for non-ubifs rootfs
if [ "$rootfs_type" != "ubifs" ]; then if [ "$rootfs_type" != "ubifs" ]; then
if ! ubimkvol /dev/$ubidev -N rootfs_data -m; then local availeb=$(cat /sys/devices/virtual/ubi/$ubidev/avail_eraseblocks)
local ebsize=$(cat /sys/devices/virtual/ubi/$ubidev/eraseblock_size)
local avail_size=$(( $availeb * $ebsize ))
local rootfs_data_size_param="-m"
if [ -n "$rootfs_data_max" ] &&
[ "$rootfs_data_max" != "0" ] &&
[ "$rootfs_data_max" -le "$avail_size" ]; then
rootfs_data_size_param="-s $rootfs_data_max"
fi
if ! ubimkvol /dev/$ubidev -N rootfs_data $rootfs_data_size_param; then
echo "cannot initialize rootfs_data volume" echo "cannot initialize rootfs_data volume"
return 1 return 1
fi fi
@ -231,9 +246,9 @@ nand_upgrade_ubinized() {
# Write the UBIFS image to UBI volume # Write the UBIFS image to UBI volume
nand_upgrade_ubifs() { nand_upgrade_ubifs() {
local rootfs_length=`(cat $1 | wc -c) 2> /dev/null` local rootfs_length=$( (cat $1 | wc -c) 2> /dev/null)
nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0" nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "" ""
local ubidev="$( nand_find_ubi "$CI_UBIPART" )" local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)"
@ -242,49 +257,83 @@ nand_upgrade_ubifs() {
nand_do_upgrade_success nand_do_upgrade_success
} }
nand_upgrade_fit() {
local fit_file="$1"
local fit_length="$(wc -c < "$fit_file")"
nand_upgrade_prepare_ubi "" "" "$fit_length" "1"
local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")"
local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")"
ubiupdatevol /dev/$fit_ubivol -s $fit_length $fit_file
nand_do_upgrade_success
}
nand_upgrade_tar() { nand_upgrade_tar() {
local tar_file="$1" local tar_file="$1"
local kernel_mtd="$(find_mtd_index $CI_KERNPART)" local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/} board_dir=${board_dir%/}
local kernel_length=`(tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null` kernel_length=$( (tar xf "$tar_file" ${board_dir}/kernel -O | wc -c) 2> /dev/null)
local rootfs_length=`(tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null` local has_rootfs=0
local rootfs_length
local rootfs_type
local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)" tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
[ "$has_rootfs" = "1" ] && {
rootfs_length=$( (tar xf "$tar_file" ${board_dir}/root -O | wc -c) 2> /dev/null)
rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
}
local has_kernel=1 local has_kernel=1
local has_env=0 local has_env=0
[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
tar xf $tar_file ${board_dir}/kernel -O | mtd write - $CI_KERNPART tar xf "$tar_file" ${board_dir}/kernel -O | mtd write - $CI_KERNPART
} }
[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0 [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$has_kernel" "$has_env" nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "${has_kernel:+$kernel_length}" "$has_env"
local ubidev="$( nand_find_ubi "$CI_UBIPART" )" local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
[ "$has_kernel" = "1" ] && { [ "$has_kernel" = "1" ] && {
local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)" local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )"
tar xf $tar_file ${board_dir}/kernel -O | \ tar xf "$tar_file" ${board_dir}/kernel -O | \
ubiupdatevol /dev/$kern_ubivol -s $kernel_length - ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
} }
local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" [ "$has_rootfs" = "1" ] && {
tar xf $tar_file ${board_dir}/root -O | \ local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )"
tar xf "$tar_file" ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length - ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
}
nand_do_upgrade_success nand_do_upgrade_success
} }
# Recognize type of passed file and start the upgrade process # Recognize type of passed file and start the upgrade process
nand_do_upgrade() { nand_do_upgrade() {
if [ -n "$IS_PRE_UPGRADE" ]; then
# Previously, nand_do_upgrade was called from the platform_pre_upgrade
# hook; this piece of code handles scripts that haven't been
# updated. All scripts should gradually move to call nand_do_upgrade
# from platform_do_upgrade instead.
export do_upgrade="nand_do_upgrade '$1'"
return
fi
local file_type=$(identify $1) local file_type=$(identify $1)
if type 'platform_nand_pre_upgrade' >/dev/null 2>/dev/null; then
platform_nand_pre_upgrade "$1"
fi
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs" [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs"
case "$file_type" in case "$file_type" in
"fit") nand_upgrade_fit $1;;
"ubi") nand_upgrade_ubinized $1;; "ubi") nand_upgrade_ubinized $1;;
"ubifs") nand_upgrade_ubifs $1;; "ubifs") nand_upgrade_ubifs $1;;
*) nand_upgrade_tar $1;; *) nand_upgrade_tar $1;;
@ -307,10 +356,10 @@ nand_do_upgrade() {
nand_do_platform_check() { nand_do_platform_check() {
local board_name="$1" local board_name="$1"
local tar_file="$2" local tar_file="$2"
local control_length=`(tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null` local control_length=$( (tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null)
local file_type="$(identify $2)" local file_type="$(identify $2)"
[ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ] && { [ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" -a "$file_type" != "fit" ] && {
echo "Invalid sysupgrade file." echo "Invalid sysupgrade file."
return 1 return 1
} }

View File

@ -6,13 +6,24 @@
export IMAGE="$1" export IMAGE="$1"
COMMAND="$2" COMMAND="$2"
export ARGV="$IMAGE"
export ARGC=1
export SAVE_CONFIG=1
export SAVE_PARTITIONS=1
export INTERACTIVE=0 export INTERACTIVE=0
export VERBOSE=1 export VERBOSE=1
export CONFFILES=/tmp/sysupgrade.conffiles export CONFFILES=/tmp/sysupgrade.conffiles
export CONF_TAR=/tmp/sysupgrade.tgz
RAMFS_COPY_BIN= # extra programs for temporary ramfs root RAMFS_COPY_BIN= # extra programs for temporary ramfs root
RAMFS_COPY_DATA= # extra data files RAMFS_COPY_DATA= # extra data files
[ -f "$CONF_TAR" ] || export SAVE_CONFIG=0
[ -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap ] && export SAVE_PARTITIONS=0
include /lib/upgrade include /lib/upgrade
@ -45,10 +56,10 @@ switch_to_ramfs() {
snapshot snapshot_tool \ snapshot snapshot_tool \
$RAMFS_COPY_BIN $RAMFS_COPY_BIN
do do
local file="$(which "$binary" 2>/dev/null)" local file="$(command -v "$binary" 2>/dev/null)"
[ -n "$file" ] && install_bin "$file" [ -n "$file" ] && install_bin "$file"
done done
install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh /lib/upgrade/do_stage2 /usr/share/libubox/jshn.sh $RAMFS_COPY_DATA install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh $RAMFS_COPY_DATA
[ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64 [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
@ -125,7 +136,10 @@ sleep 1
if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
platform_pre_upgrade "$IMAGE" IS_PRE_UPGRADE=1 platform_pre_upgrade "$IMAGE"
# Needs to be unset again because of busybox weirdness ...
IS_PRE_UPGRADE=
fi fi
if [ -n "$(rootfs_type)" ]; then if [ -n "$(rootfs_type)" ]; then

View File

@ -1,130 +0,0 @@
#!/bin/sh
#
# Package checksums checking script
# (C) 2018 CZ.NIC, z.s.p.o.
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
ERRFATAL="no"
QUIET="yes"
MISSING=""
SUMMARY=""
NL="
"
# Arguments parsing
while expr "x$1" : "x-" > /dev/null; do
if [ "x$1" = "x-s" ]; then
ERRFATAL="yes"
shift
elif [ "x$1" = "x-v" ]; then
QUIET=" no"
shift
else
echo "Usage: $(basename $0) [-s] [-v] [pkg1 pkg2 ...]"
echo
echo " -s Stop on first change"
echo " -v Verbose"
if [ "x$1" = "x-h" ]; then
exit 0
else
echo
echo "ERROR: Unknown option '$1'"
exit 1
fi
fi
done
# Check all packages by default
if [ -z "$1" ]; then
set $(cd /usr/lib/opkg/info/; for i in *.files-sha256sum; do basename $i .files-sha256sum; done)
fi
# Iterate over packages
while [ "$1" ]; do
if [ \! -f "/usr/lib/opkg/info/$1.files-sha256sum" ]; then
if [ "$ERRFATAL" = no ]; then
echo " * No checksums for $1 - skipping"
echo
else
echo " * No checksums for $1 - exiting"
exit 1
fi
if [ -z "$MISSING" ]; then
MISSING="$1"
else
MISSING="$MISSING, $1"
fi
shift
continue
fi
[ $QUIET = yes ] || echo " * Checking package $1:"
ERR=""
CHECK="`sha256sum -c /usr/lib/opkg/info/$1.files-sha256sum 2> /dev/null`"
# Are the changed files config files?
if [ $? -ne 0 ] && [ "`cat "/usr/lib/opkg/info/$1.files-sha256sum"`" ]; then
NEWCHECK="`echo "$CHECK" | grep '^.*: OK$'`"
for i in `echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'`; do
if [ "`grep "^$i\$" "/usr/lib/opkg/info/$1.conffiles" 2> /dev/null`" ] || \
[ "`echo "$i" | grep "^/etc/uci-defaults/"`" ]; then
NEWCHECK="${NEWCHECK}${NL}${i}: CONFIGURED"
else
NEWCHECK="${NEWCHECK}${NL}${i}: FAILED"
ERR="y"
fi
done
CHECK="$NEWCHECK"
fi
# Do we have changed files or not?
if [ -z "$ERR" ]; then
[ $QUIET = yes ] || [ -z "`cat "/usr/lib/opkg/info/$1.files-sha256sum"`" ] || echo "$CHECK" | sed 's|^| - |'
[ $QUIET = yes ] || echo " * Package $1 is ok"
[ $QUIET = yes ] || echo
else
if [ $QUIET = yes ]; then
echo " * Changes found in package $1:"
echo "$CHECK" | sed -n 's|^\(.*:[[:blank:]]*FAILED\)$| - \1|p'
else
echo "$CHECK" | sed 's|^| - |'
echo " * Changes found in package $1!"
fi
if [ "$ERRFATAL" = yes ]; then
echo
echo "Exiting on first change found!"
exit 1
fi
for i in `echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'`; do
SUMMARY="${SUMMARY}${NL} - $1: $i"
done
echo
fi
shift
done
# If there are changed files, report them
if [ "$SUMMARY" ]; then
echo "Some packages contain changed files!"
echo "Maybe something worth looking into?"
echo "Here is the list of packages and changed files:"
echo "$SUMMARY"
fi
if [ "$MISSING" ]; then
echo "Following packages are missing checksums: $MISSING"
fi
if [ "$MISSING" ] || [ "$SUMMARY" ]; then
exit 1
fi

View File

@ -5,7 +5,6 @@
. /usr/share/libubox/jshn.sh . /usr/share/libubox/jshn.sh
# initialize defaults # initialize defaults
export MTD_ARGS=""
export MTD_CONFIG_ARGS="" export MTD_CONFIG_ARGS=""
export INTERACTIVE=0 export INTERACTIVE=0
export VERBOSE=1 export VERBOSE=1
@ -127,16 +126,23 @@ list_changed_conffiles() {
list_conffiles | while read file csum; do list_conffiles | while read file csum; do
[ -r "$file" ] || continue [ -r "$file" ] || continue
echo "${csum} ${file}" | busybox sha256sum -sc - || echo "$file" echo "${csum} ${file}" | sha256sum -sc - || echo "$file"
done done
} }
list_static_conffiles() {
local filter=$1
find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
\( -type f -o -type l \) $filter 2>/dev/null
}
add_conffiles() { add_conffiles() {
local file="$1" local file="$1"
( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \ ( list_static_conffiles "$find_filter"; list_changed_conffiles ) |
\( -type f -o -type l \) $find_filter 2>/dev/null; sort -u > "$file"
list_changed_conffiles ) | sort -u > "$file"
return 0 return 0
} }
@ -154,9 +160,7 @@ add_overlayfiles() {
# backup files from /etc/sysupgrade.conf and /lib/upgrade/keep.d, but # backup files from /etc/sysupgrade.conf and /lib/upgrade/keep.d, but
# ignore those aready controlled by opkg conffiles # ignore those aready controlled by opkg conffiles
find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \ list_static_conffiles | sort -u |
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
\( -type f -o -type l \) 2>/dev/null | sort -u |
grep -h -v -x -F -f $conffiles > "$keepfiles" grep -h -v -x -F -f $conffiles > "$keepfiles"
# backup conffiles, but only those changed if '-u' # backup conffiles, but only those changed if '-u'
@ -192,6 +196,9 @@ add_overlayfiles() {
return 0 return 0
} }
# hooks
sysupgrade_image_check="fwtool_check_signature fwtool_check_image platform_check_image"
if [ $SAVE_OVERLAY = 1 ]; then if [ $SAVE_OVERLAY = 1 ]; then
[ ! -d /overlay/upper/etc ] && { [ ! -d /overlay/upper/etc ] && {
echo "Cannot find '/overlay/upper/etc', required for '-c'" >&2 echo "Cannot find '/overlay/upper/etc', required for '-c'" >&2
@ -248,7 +255,7 @@ do_save_conffiles() {
v "Saving config files..." v "Saving config files..."
[ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
tar c${TAR_V}zf "$conf_tar" -T "$CONFFILES" 2>/dev/null tar c${TAR_V}zpf "$conf_tar" -T "$CONFFILES" 2>/dev/null
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "Failed to create the configuration backup." echo "Failed to create the configuration backup."
rm -f "$conf_tar" rm -f "$conf_tar"
@ -282,6 +289,7 @@ if [ -n "$CONF_RESTORE" ]; then
fi fi
[ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
v "Restoring config files..."
tar -C / -x${TAR_V}zf "$CONF_RESTORE" tar -C / -x${TAR_V}zf "$CONF_RESTORE"
exit $? exit $?
fi fi
@ -294,7 +302,7 @@ type platform_check_image >/dev/null 2>/dev/null || {
case "$IMAGE" in case "$IMAGE" in
http://*|\ http://*|\
https://*) https://*)
wget -O/tmp/sysupgrade.img "$IMAGE" || exit 1 wget -O/tmp/sysupgrade.img "$IMAGE"
IMAGE=/tmp/sysupgrade.img IMAGE=/tmp/sysupgrade.img
;; ;;
esac esac
@ -314,19 +322,20 @@ case "$IMAGE" in
;; ;;
esac esac
json_load "$(/usr/libexec/validate_firmware_image "$IMAGE")" || { export ARGV="$IMAGE"
echo "Failed to check image" export ARGC=1
exit 1
} for check in $sysupgrade_image_check; do
json_get_var valid "valid" ( $check "$IMAGE" ) || {
[ "$valid" -eq 0 ] && {
if [ $FORCE -eq 1 ]; then if [ $FORCE -eq 1 ]; then
echo "Image check failed but --force given - will update anyway!" >&2 echo "Image check '$check' failed but --force given - will update anyway!" >&2
break
else else
echo "Image check failed." >&2 echo "Image check '$check' failed." >&2
exit 1 exit 1
fi fi
} }
done
if [ -n "$CONF_IMAGE" ]; then if [ -n "$CONF_IMAGE" ]; then
case "$(get_magic_word $CONF_IMAGE cat)" in case "$(get_magic_word $CONF_IMAGE cat)" in
@ -351,10 +360,16 @@ if [ $TEST -eq 1 ]; then
exit 0 exit 0
fi fi
if [ $SAVE_PARTITIONS -eq 0 ]; then
touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap
else
rm -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap
fi
install_bin /sbin/upgraded install_bin /sbin/upgraded
v "Commencing upgrade. Closing all shell sessions." v "Commencing upgrade. Closing all shell sessions."
COMMAND='/lib/upgrade/do_stage2' COMMAND='. /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2'
if [ -n "$FAILSAFE" ]; then if [ -n "$FAILSAFE" ]; then
printf '%s\x00%s\x00%s' "$RAM_ROOT" "$IMAGE" "$COMMAND" >/tmp/sysupgrade printf '%s\x00%s\x00%s' "$RAM_ROOT" "$IMAGE" "$COMMAND" >/tmp/sysupgrade

View File

@ -119,7 +119,7 @@ menuconfig INITOPT
prompt "Environment variables to set when starting init (start with none)" if INITOPT prompt "Environment variables to set when starting init (start with none)" if INITOPT
default "" default ""
help help
Should be a space seperated list of variable assignments. These Should be a space separated list of variable assignments. These
variables will be present in the environment. Spaces may not be variables will be present in the environment. Spaces may not be
present (including through expansion) even in a quoted string present (including through expansion) even in a quoted string
(env doesn't understanding quoting). (env doesn't understanding quoting).
@ -183,7 +183,7 @@ if VERSIONOPT
config VERSION_REPO config VERSION_REPO
string string
prompt "Release repository" prompt "Release repository"
default "http://downloads.openwrt.org/snapshots" default "https://downloads.openwrt.org/snapshots"
help help
This is the repository address embedded in the image, it defaults This is the repository address embedded in the image, it defaults
to the trunk snapshot repo; the url may contain the following placeholders: to the trunk snapshot repo; the url may contain the following placeholders:

View File

@ -0,0 +1,104 @@
#
# Copyright (C) 2017 Hauke Mehrtens
# Copyright (C) 2021 Daniel Golle
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-mediatek
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
PKG_SOURCE_DATE:=2021-05-08
PKG_SOURCE_VERSION:=d2c75b2139be003887af9cc5a94da5e9bdc59de7
PKG_MIRROR_HASH:=4af9ce8e11511afee7f588cc982946c06339edbfa47afef6a7f3e2231ac9f34d
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
include $(INCLUDE_DIR)/trusted-firmware-a.mk
include $(INCLUDE_DIR)/package.mk
define Trusted-Firmware-A/Default
BUILD_TARGET:=mediatek
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
TFA_IMAGE:=bl2.img bl31.bin
BOOT_DEVICE:=
DDR3_FLYBY:=
endef
define Trusted-Firmware-A/mt7622-nor-1ddr
NAME:=MediaTek MT7622 (SPI-NOR, 1x DDR3)
BOOT_DEVICE:=nor
endef
define Trusted-Firmware-A/mt7622-nor-2ddr
NAME:=MediaTek MT7622 (SPI-NOR, 2x DDR3)
BOOT_DEVICE:=nor
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-snand-1ddr
NAME:=MediaTek MT7622 (SPI-NAND, 1x DDR3)
BOOT_DEVICE:=snand
endef
define Trusted-Firmware-A/mt7622-snand-2ddr
NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3)
BOOT_DEVICE:=snand
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-emmc-1ddr
NAME:=MediaTek MT7622 (eMMC, 1x DDR3)
BOOT_DEVICE:=emmc
endef
define Trusted-Firmware-A/mt7622-emmc-2ddr
NAME:=MediaTek MT7622 (eMMC, 2x DDR3)
BOOT_DEVICE:=emmc
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-sdmmc-1ddr
NAME:=MediaTek MT7622 (SDcard, 1x DDR3)
BOOT_DEVICE:=sdmmc
endef
define Trusted-Firmware-A/mt7622-sdmmc-2ddr
NAME:=MediaTek MT7622 (SDcard, 2x DDR3)
BOOT_DEVICE:=sdmmc
DDR3_FLYBY:=1
endef
TFA_TARGETS:= \
mt7622-nor-1ddr \
mt7622-nor-2ddr \
mt7622-snand-1ddr \
mt7622-snand-2ddr \
mt7622-emmc-1ddr \
mt7622-emmc-2ddr \
mt7622-sdmmc-1ddr \
mt7622-sdmmc-2ddr
TFA_MAKE_FLAGS += \
BOOT_DEVICE=$(BOOT_DEVICE) \
USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
all
define Build/Configure
$(call Build/Configure/Default)
endef
define Package/trusted-firmware-a/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/mt7622/release/bl2.img $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.img
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/mt7622/release/bl31.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31.bin
endef
$(eval $(call BuildPackage/Trusted-Firmware-A))

View File

@ -0,0 +1,11 @@
--- a/plat/mediatek/mt7622/bl2_boot_nor.c
+++ b/plat/mediatek/mt7622/bl2_boot_nor.c
@@ -12,7 +12,7 @@
#define MT7622_NOR_MAP_BASE 0x30000000
#define FIP_BASE 0x20000
-#define FIP_SIZE 0x80000
+#define FIP_SIZE 0xa0000
const io_block_spec_t mtk_boot_dev_fip_spec = {
.offset = MT7622_NOR_MAP_BASE + FIP_BASE,

View File

@ -7,172 +7,140 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-mvebu PKG_VERSION:=2.4
PKG_VERSION:=2.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_HASH:=bf3eb3617a74cddd7fb0e0eacbfe38c3258ee07d4c8ed730deef7a175cc3d55b
PKG_SOURCE:=trusted-firmware-a-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot
PKG_HASH:=37f917922bcef181164908c470a2f941006791c0113d738c498d39d95d543b21
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/trusted-firmware-a-$(PKG_VERSION)
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=docs/license.rst
PKG_MAINTAINER:=Vladimir Vid <vladimir.vid@sartura.hr> PKG_MAINTAINER:=Vladimir Vid <vladimir.vid@sartura.hr>
include $(INCLUDE_DIR)/trusted-firmware-a.mk
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Package/arm-trusted-firmware-mvebu define Trusted-Firmware-A/Default
SECTION:=boot BUILD_TARGET:=mvebu
CATEGORY:=Boot Loaders BUILD_SUBTARGET:=cortexa53
DEPENDS:=@TARGET_mvebu_cortexa53 TFA_IMAGE:=flash-image.bin uart-images.tgz.bin
VARIANT:=$(subst arm-trusted-firmware-mvebu-,,$(1)) UBOOT:=
DDR_TOPOLOGY:=
CLOCKSPRESET:=
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-512mb
$(Package/arm-trusted-firmware-mvebu) define Trusted-Firmware-A/espressobin-512mb
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin (512MB) NAME:=Marvell ESPRESSObin (512MB)
DEPENDS:=+u-boot-espressobin DEPENDS:=+u-boot-espressobin
BUILD_DEVICES:=globalscale_espressobin
UBOOT:=espressobin UBOOT:=espressobin
DDR_TOPOLOGY:=0 DDR_TOPOLOGY:=0
CLOCKSPRESET:=CPU_800_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs define Trusted-Firmware-A/espressobin-v3-v5-1gb-1cs
$(Package/arm-trusted-firmware-mvebu) NAME:=Marvell ESPRESSObin V3-V5 (1GB 1CS)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 1CS)
DEPENDS:=+u-boot-espressobin DEPENDS:=+u-boot-espressobin
BUILD_DEVICES:=globalscale_espressobin
UBOOT:=espressobin UBOOT:=espressobin
DDR_TOPOLOGY:=4 DDR_TOPOLOGY:=4
CLOCKSPRESET:=CPU_800_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs-emmc define Trusted-Firmware-A/espressobin-v3-v5-1gb-2cs
$(Package/arm-trusted-firmware-mvebu) NAME:=Marvell ESPRESSObin V3-V5 (1GB, 2CS)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 1CS, eMMC)
DEPENDS:=+u-boot-espressobin-emmc
UBOOT:=espressobin-emmc
DDR_TOPOLOGY:=4
CLOCKSPRESET:=CPU_800_DDR_800
PLAT:=a3700
endef
define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs
$(Package/arm-trusted-firmware-mvebu)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB, 2CS)
DEPENDS:=+u-boot-espressobin DEPENDS:=+u-boot-espressobin
BUILD_DEVICES:=globalscale_espressobin
UBOOT:=espressobin UBOOT:=espressobin
DDR_TOPOLOGY:=2 DDR_TOPOLOGY:=2
CLOCKSPRESET:=CPU_800_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs-emmc define Trusted-Firmware-A/espressobin-v3-v5-2gb
$(Package/arm-trusted-firmware-mvebu) NAME:=Marvell ESPRESSObin V3-V5 (2GB)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 2CS, eMMC)
DEPENDS:=+u-boot-espressobin-emmc
UBOOT:=espressobin-emmc
DDR_TOPOLOGY:=2
CLOCKSPRESET:=CPU_800_DDR_800
PLAT:=a3700
endef
define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb
$(Package/arm-trusted-firmware-mvebu)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (2GB)
DEPENDS:=+u-boot-espressobin DEPENDS:=+u-boot-espressobin
BUILD_DEVICES:=globalscale_espressobin
UBOOT:=espressobin UBOOT:=espressobin
DDR_TOPOLOGY:=7 DDR_TOPOLOGY:=7
CLOCKSPRESET:=CPU_800_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb-emmc define Trusted-Firmware-A/espressobin-v7-1gb
$(Package/arm-trusted-firmware-mvebu) NAME:=Marvell ESPRESSObin V7 (1GB)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (2GB, eMMC)
DEPENDS:=+u-boot-espressobin-emmc
UBOOT:=espressobin-emmc
DDR_TOPOLOGY:=7
CLOCKSPRESET:=CPU_800_DDR_800
PLAT:=a3700
endef
define Package/arm-trusted-firmware-mvebu-espressobin-v7-1gb
$(Package/arm-trusted-firmware-mvebu)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (1GB)
DEPENDS:=+u-boot-espressobin DEPENDS:=+u-boot-espressobin
BUILD_DEVICES:=globalscale_espressobin-v7
UBOOT:=espressobin UBOOT:=espressobin
DDR_TOPOLOGY:=5 DDR_TOPOLOGY:=5
CLOCKSPRESET:=CPU_800_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-v7-1gb-emmc define Trusted-Firmware-A/espressobin-v7-2gb
$(Package/arm-trusted-firmware-mvebu) NAME:=Marvell ESPRESSObin V7 (2GB)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (1GB, eMMC)
DEPENDS:=+u-boot-espressobin
UBOOT:=espressobin-emmc
DDR_TOPOLOGY:=5
CLOCKSPRESET:=CPU_800_DDR_800
PLAT:=a3700
endef
define Package/arm-trusted-firmware-mvebu-espressobin-v7-2gb
$(Package/arm-trusted-firmware-mvebu)
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (2GB)
DEPENDS:=+u-boot-espressobin DEPENDS:=+u-boot-espressobin
BUILD_DEVICES:=globalscale_espressobin-v7
UBOOT:=espressobin UBOOT:=espressobin
DDR_TOPOLOGY:=6 DDR_TOPOLOGY:=6
CLOCKSPRESET:=CPU_800_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
define Package/arm-trusted-firmware-mvebu-espressobin-v7-2gb-emmc define Trusted-Firmware-A/udpu
$(Package/arm-trusted-firmware-mvebu) NAME:=Methode uDPU
TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (2GB, eMMC)
DEPENDS:=+u-boot-espressobin
UBOOT:=espressobin-emmc
DDR_TOPOLOGY:=6
CLOCKSPRESET:=CPU_800_DDR_800
PLAT:=a3700
endef
define Package/arm-trusted-firmware-mvebu-udpu
$(Package/arm-trusted-firmware-mvebu)
TITLE:=ARM Trusted Firmware for Methode uDPU
DEPENDS:=+u-boot-uDPU DEPENDS:=+u-boot-uDPU
BUILD_DEVICES:=methode_udpu
UBOOT:=uDPU UBOOT:=uDPU
DDR_TOPOLOGY:=0 DDR_TOPOLOGY:=0
CLOCKSPRESET:=CPU_1000_DDR_800 CLOCKSPRESET:=CPU_1000_DDR_800
PLAT:=a3700 PLAT:=a3700
endef endef
TFA_TARGETS:= \
espressobin-512mb \
espressobin-v3-v5-1gb-1cs \
espressobin-v3-v5-1gb-2cs \
espressobin-v3-v5-2gb \
espressobin-v7-1gb \
espressobin-v7-2gb \
udpu
TFA_MAKE_FLAGS += \
CROSS_CM3=$(STAGING_DIR_IMAGE)/$(LINARO_NAME)-$(LINARO_RELEASE).$(LINARO_VERSION)/bin/arm-linux-gnueabi- \
BL33=$(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.bin \
MV_DDR_PATH=$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
WTP=$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
DDR_TOPOLOGY=$(DDR_TOPOLOGY) \
CLOCKSPRESET=$(CLOCKSPRESET) \
A3700_UTILS_COMMIT_ID=$(A3700_UTILS_RELEASE) \
MV_DDR_COMMIT_ID=$(MV_DDR_RELEASE) \
all \
mrvl_flash
A3700_UTILS_NAME:=a3700-utils A3700_UTILS_NAME:=a3700-utils
A3700_UTILS_RELEASE:=09679790 A3700_UTILS_RELEASE:=5598e150
A3700_UTILS_SOURCE=$(A3700_UTILS_NAME)-$(A3700_UTILS_RELEASE).tar.bz2 A3700_UTILS_SOURCE=$(A3700_UTILS_NAME)-$(A3700_UTILS_RELEASE).tar.bz2
define Download/a3700-utils define Download/a3700-utils
FILE:=$(A3700_UTILS_SOURCE) FILE:=$(A3700_UTILS_SOURCE)
PROTO:=git PROTO:=git
URL:=https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git URL:=https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git
VERSION:=096797908ddd69a679fd55595c41fc02809829a9 VERSION:=5598e150fa3a1568256c30223fd2b214d729f26a
MIRROR_HASH:=9276d63d41b2e221c2fd5cceee988ca26eff5005747787f084868b3940173b7a MIRROR_HASH:=4c3a3bed97833d08af4e42995c0c5af6c107f990fd492cd90aa3e79134d2751e
SUBDIR:=$(A3700_UTILS_NAME) SUBDIR:=$(A3700_UTILS_NAME)
endef endef
MV_DDR_NAME:=mv-ddr-marvell MV_DDR_NAME:=mv-ddr-marvell
MV_DDR_RELEASE:=mainline MV_DDR_RELEASE:=6fb99002
MV_DDR_SOURCE:=$(MV_DDR_NAME)-$(MV_DDR_RELEASE).tar.bz2 MV_DDR_SOURCE:=$(MV_DDR_NAME)-$(MV_DDR_RELEASE).tar.bz2
define Download/mv-ddr-marvell define Download/mv-ddr-marvell
FILE:=$(MV_DDR_SOURCE) FILE:=$(MV_DDR_SOURCE)
PROTO:=git PROTO:=git
URL:=https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git URL:=https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git
VERSION:=a881467ef0f0185e6570dd0483023fde93cbb5f5 VERSION:=6fb99002be5dec9c7f5375b074f53148dbc0739c
MIRROR_HASH:=19f34817616c583b2b5f2612705857cf2120f6c2132355217899b1403c3fd336 MIRROR_HASH:=6836e5ea47618a7ee2f96a1a6bd8218f003789b877e521fdfcb008f2f6475dd6
SUBDIR:=$(MV_DDR_NAME) SUBDIR:=$(MV_DDR_NAME)
endef endef
@ -197,45 +165,10 @@ define Build/Prepare
mkdir -p $(STAGING_DIR_IMAGE) mkdir -p $(STAGING_DIR_IMAGE)
$(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE) $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE)
$(call PatchDir/Default,$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME),./patches-a3700-utils)
$(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(MV_DDR_SOURCE) $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(MV_DDR_SOURCE)
$(call PatchDir/Default,$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME),./patches-mv-ddr-marvell)
$(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(LINARO_SOURCE) $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(LINARO_SOURCE)
endef endef
export GCC_HONOUR_COPTS=s $(eval $(call BuildPackage/Trusted-Firmware-A))
TARGET_CFLAGS = ""
define Build/Compile
$(eval $(Package/arm-trusted-firmware-mvebu-$(BUILD_VARIANT))) \
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS) \
OPENSSL_DIR=$(STAGING_DIR_HOST) \
CROSS_CM3=$(STAGING_DIR_IMAGE)/$(LINARO_NAME)-$(LINARO_RELEASE).$(LINARO_VERSION)/bin/arm-linux-gnueabi- \
BL33=$(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.bin \
MV_DDR_PATH=$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
WTP=$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
DDR_TOPOLOGY=$(DDR_TOPOLOGY) \
CLOCKSPRESET=$(CLOCKSPRESET) \
PLAT=$(PLAT) \
all \
fip
endef
define Build/InstallDev
$(INSTALL_DIR) $(BIN_DIR)/flash-image-$(BUILD_VARIANT)
$(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/flash-image.bin $(BIN_DIR)/flash-image-$(BUILD_VARIANT)/
$(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/uart-images.tgz $(BIN_DIR)/flash-image-$(BUILD_VARIANT)/
endef
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-512mb))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs-emmc))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs-emmc))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb-emmc))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-1gb))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-1gb-emmc))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-2gb))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-2gb-emmc))
$(eval $(call BuildPackage,arm-trusted-firmware-mvebu-udpu))

View File

@ -0,0 +1,13 @@
diff --git a/wtmi/sys_init/Makefile b/wtmi/sys_init/Makefile
--- a/wtmi/sys_init/Makefile
+++ b/wtmi/sys_init/Makefile
@@ -51,7 +51,8 @@ ECHO = @echo
SED = @sed
LOCAL_VERSION_STRING ?= -armada
-BUILD_STRING := $(shell git log -n 1 --pretty=format:"%h")
+A3700_UTILS_COMMIT_ID ?= $(shell git log -n 1 --pretty=format:"%h")
+BUILD_STRING := $(A3700_UTILS_COMMIT_ID)
VERSION_STRING := $(LOCAL_VERSION_STRING)-$(BUILD_STRING)
CPUOPTS = -mthumb -mcpu=cortex-m3 -mlittle-endian

View File

@ -0,0 +1,12 @@
diff --git a/scripts/localversion.sh b/scripts/localversion.sh
--- a/scripts/localversion.sh
+++ b/scripts/localversion.sh
@@ -103,7 +103,7 @@ MV_DDR_ROOT=$1
MV_DDR_VER_CSRC=$2
# get mv_ddr git commit id
-MV_DDR_COMMIT_ID=`git -C $MV_DDR_ROOT rev-parse --verify --quiet --short HEAD 2> /dev/null`
+test -z "$MV_DDR_COMMIT_ID" && MV_DDR_COMMIT_ID=`git -C $MV_DDR_ROOT rev-parse --verify --quiet --short HEAD 2> /dev/null`
# check for uncommitted changes in mv_ddr git
MV_DDR_DIRTY_CHK=`git -C $MV_DDR_ROOT diff-index --name-only HEAD 2> /dev/null`

View File

@ -1,6 +1,6 @@
--- a/tools/fiptool/Makefile --- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile
@@ -19,7 +19,7 @@ ifeq (${DEBUG},1) @@ -20,7 +20,7 @@ ifeq (${DEBUG},1)
else else
HOSTCCFLAGS += -O2 HOSTCCFLAGS += -O2
endif endif
@ -9,7 +9,7 @@
ifeq (${V},0) ifeq (${V},0)
Q := @ Q := @
@@ -27,7 +27,7 @@ else @@ -28,7 +28,7 @@ else
Q := Q :=
endif endif

View File

@ -0,0 +1,55 @@
#
# Copyright (C) 2021 ImmortalWrt
# (https://immortalwrt.org)
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-rk3328
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/rockchip-linux/rkbin.git
PKG_SOURCE_DATE:=2020-10-30
PKG_SOURCE_VERSION:=0bb1c512492386a72a3a0b5a0e18e49c636577b9
PKG_MIRROR_HASH:=6dffe95b83f37a280f98c105fce529f45e39ce333b24709a9645aac1352457ce
PKG_MAINTAINER:=AmadeusGhost <amadeus@immortalwrt.org>
MAKE_PATH:=$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/arm-trusted-firmware-rk3328
SECTION:=boot
CATEGORY:=Boot Loaders
TITLE:=ARM Trusted Firmware for Rockchip
DEPENDS:=@TARGET_rockchip_armv8
endef
define Build/Configure
$(SED) 's,$$$$(PKG_BUILD_DIR),$(PKG_BUILD_DIR),g' $(PKG_BUILD_DIR)/trust.ini
$(call Build/Configure/Default)
endef
define Build/Compile
mkimage -n rk3328 -T rksd -d $(PKG_BUILD_DIR)/bin/rk33/rk3328_ddr_333MHz_v1.16.bin $(PKG_BUILD_DIR)/idbloader.bin
cat $(PKG_BUILD_DIR)/bin/rk33/rk322xh_miniloader_v2.50.bin >> $(PKG_BUILD_DIR)/idbloader.bin
$(PKG_BUILD_DIR)/tools/trust_merger --replace bl31.elf $(PKG_BUILD_DIR)/bin/rk33/rk322xh_bl31_v1.44.elf $(PKG_BUILD_DIR)/trust.ini
endef
define Build/InstallDev
$(INSTALL_DIR) -p $(STAGING_DIR_IMAGE)
$(CP) $(PKG_BUILD_DIR)/bin/rk33/rk322xh_bl31_v1.44.elf $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/tools/loaderimage $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/idbloader.bin $(STAGING_DIR_IMAGE)/
$(CP) $(PKG_BUILD_DIR)/trust.bin $(STAGING_DIR_IMAGE)/
endef
define Package/arm-trusted-firmware-rk3328/install
endef
$(eval $(call BuildPackage,arm-trusted-firmware-rk3328))

Some files were not shown because too many files have changed in this diff Show More