Compare commits
No commits in common. "master" and "openwrt-18.06-k5.4" have entirely different histories.
master
...
openwrt-18
@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "CI build container",
|
||||
"image": "ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v9",
|
||||
"features": {
|
||||
},
|
||||
"remoteUser": "buildbot",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": ["ms-vscode.cpptools", "plorefice.devicetree"]
|
||||
}
|
||||
}
|
||||
}
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1 @@
|
||||
* -text
|
||||
*.patch whitespace=-indent-with-non-tab,-space-before-tab,-tab-in-indent,-trailing-space
|
||||
|
93
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
93
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@ -1,93 +0,0 @@
|
||||
name: Bug report
|
||||
description: Create a bug report to help us improve
|
||||
labels:
|
||||
- bug
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: A clear and concise description of the bug.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: ImmortalWrt version
|
||||
description: |
|
||||
The ImmortalWrt release or commit hash where this bug occurs (use command below).
|
||||
```. /etc/openwrt_release && echo $DISTRIB_REVISION```
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: release
|
||||
attributes:
|
||||
label: ImmortalWrt release
|
||||
description: |
|
||||
The ImmortalWrt release or commit hash where this bug occurs (use command below).
|
||||
```. /etc/openwrt_release && echo $DISTRIB_RELEASE```
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: target
|
||||
attributes:
|
||||
label: ImmortalWrt target/subtarget
|
||||
description: |
|
||||
The ImmortalWrt target and subtarget where this bug is observed (use command below).
|
||||
```. /etc/openwrt_release && echo $DISTRIB_TARGET```
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: device
|
||||
attributes:
|
||||
label: Device
|
||||
description: |
|
||||
The device exhibiting this bug (if unsure, use command below).
|
||||
```cat /tmp/sysinfo/model```
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: image_kind
|
||||
attributes:
|
||||
label: Image kind
|
||||
options:
|
||||
- Official downloaded image
|
||||
- Self-built image
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Steps to reproduce the reported behaviour.
|
||||
- type: textarea
|
||||
id: behaviour
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: A clear and concise description of what actually happens.
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional info
|
||||
description: Add any additional info you think might be helfpul.
|
||||
- type: textarea
|
||||
id: diffconfig
|
||||
attributes:
|
||||
label: Diffconfig
|
||||
description: |
|
||||
In case of a self-built image, please attach diffconfig.
|
||||
```./scripts/diffconfig.sh```
|
||||
render: text
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Terms
|
||||
description: By submitting this issue, you agree to the terms below.
|
||||
options:
|
||||
- label: I am reporting an issue for ImmortalWrt, not an unsupported fork.
|
||||
required: true
|
9
.github/ISSUE_TEMPLATE/config.yml
vendored
9
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,9 +0,0 @@
|
||||
---
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: ImmortalWrt community
|
||||
url: https://t.me/ctcgfw_openwrt_discuss
|
||||
about: Consider reaching out to our community to get help. ImmortalWrt is a complex software project with many pitfalls; there is a good chance someone can help you solve your issue in no time.
|
||||
- name: OpenWrt documentation
|
||||
url: https://openwrt.org/docs/start
|
||||
about: The OpenWrt documentation contains a lot of valuable information.
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -14,15 +14,11 @@
|
||||
/feeds
|
||||
/feeds.conf
|
||||
/files
|
||||
/target/linux/feeds
|
||||
/overlay
|
||||
/package/feeds
|
||||
/package/openwrt-packages
|
||||
/*.patch
|
||||
/llvm-bpf*
|
||||
key-build*
|
||||
private-key.pem
|
||||
public-key.pem
|
||||
*.orig
|
||||
*.rej
|
||||
*~
|
||||
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"git.alwaysSignOff": true
|
||||
}
|
76
CONTRIBUTED.md
Normal file
76
CONTRIBUTED.md
Normal file
@ -0,0 +1,76 @@
|
||||
# CONTRIBUTED
|
||||
|
||||
## Thanks to
|
||||
|
||||
<a href="https://dlercloud.com/"><img src="https://user-images.githubusercontent.com/22235437/111103249-f9ec6e00-8588-11eb-9bfc-67cc55574555.png" width="183" height="52" border="0" alt="Dler Cloud"></a><br/>
|
||||
<a href="https://www.jetbrains.com/"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_square.png" width="120" height="120" border="0" alt="JetBrains Black Box Logo logo"></a><br/>
|
||||
<a href="https://osdn.net/"><img src="https://osdn.net/sflogo.php?group_id=13647&type=2" width="125" height="39" border="0" alt="OSDN"></a>
|
||||
|
||||
## The Source of Packages
|
||||
|
||||
### Based on: [coolsnowwolf/lede](https://github.com/coolsnowwolf/lede).<br/>
|
||||
|
||||
#### Packages
|
||||
|
||||
Package gargoyle: [ericpaulbishop/gargoyle](https://github.com/ericpaulbishop/gargoyle).<br/>
|
||||
Package Lienol: [Lienol/openwrt-package](https://github.com/Lienol/openwrt-package).<br/>
|
||||
Package ntlf9t: [ntlf9t/repositories](https://github.com/ntlf9t?tab=repositories).<br/>
|
||||
|
||||
lua-maxminddb source: [jerrykuku/lua-maxminddb](https://github.com/jerrykuku/lua-maxminddb).<br/>
|
||||
mentohust source: [KyleRicardo/MentoHUST-OpenWrt-ipk](https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk).<br/>
|
||||
node-request source: [jerrykuku/node-request](https://github.com/jerrykuku/node-request).<br/>
|
||||
openappfilter source: [destan19/OpenAppFilter](https://github.com/destan19/OpenAppFilter).<br/>
|
||||
openwrt-BBR source: [anshi233/Openwrt-BBR](https://github.com/anshi233/Openwrt-BBR).<br/>
|
||||
openwrt-chinadns-ng source: [pexcn/openwrt-chinadns-ng](https://github.com/pexcn/openwrt-chinadns-ng).<br/>
|
||||
openwrt-iptvhelper source: [riverscn/openwrt-iptvhelper](https://github.com/riverscn/openwrt-iptvhelper).<br>
|
||||
openwrt-mwol source: [Mleaf/openwrt-mwol](https://github.com/Mleaf/openwrt-mwol).<br/>
|
||||
openwrt-ootoc source: [ElonH/ootoc-OpenWRT](https://github.com/ElonH/ootoc-OpenWRT).<br/>
|
||||
openwrt-rclone source: [ElonH/Rclone-OpenWrt](https://github.com/ElonH/Rclone-OpenWrt).<br/>
|
||||
openwrt-r8168 source: [BROBIRD/openwrt-r8168](https://github.com/BROBIRD/openwrt-r8168).<br/>
|
||||
openwrt-udpspeeder source: [zhfreal/openwrt-UDPspeeder](https://github.com/zhfreal/openwrt-UDPspeeder).<br/>
|
||||
phicomm-k3screenctrl source: [lwz322/k3screenctrl\_build](https://github.com/lwz322/k3screenctrl_build).<br/>
|
||||
scutclient source: [scutclient/scutclient](https://github.com/scutclient/scutclient).<br/>
|
||||
simple-obfs source: [aa65535/openwrt-simple-obfs](https://github.com/aa65535/openwrt-simple-obfs).<br/>
|
||||
v2ray-plugin source: [teddysun/v2ray-plugin](https://github.com/teddysun/v2ray-plugin).<br/>
|
||||
|
||||
#### Luci Packages
|
||||
|
||||
luci-app-airwhu source: [KyleRicardo/luci-app-airwhu](https://github.com/KyleRicardo/luci-app-airwhu).<br/>
|
||||
luci-app-adguardhome source: [rufengsuixing/luci-app-adguardhome](https://github.com/rufengsuixing/luci-app-adguardhome).<br/>
|
||||
luci-app-autoipsetadder source: [rufengsuixing/luci-app-autoipsetadder](https://github.com/rufengsuixing/luci-app-autoipsetadder).<br>
|
||||
luci-app-bbr-mod source: [ntlf9t/luci-app-bbr-mod](https://github.com/ntlf9t/luci-app-bbr-mod).<br/>
|
||||
luci-app-beardropper source: [NateLol/natelol](https://github.com/NateLol/natelol).<br/>
|
||||
luci-app-cupsd source: [F-Light/luci-app-cupsd](https://github.com/F-Light/luci-app-cupsd).<br/>
|
||||
luci-app-diskman source: [lisaac/luci-app-diskman](https://github.com/lisaac/luci-app-diskman).<br/>
|
||||
luci-app-dockerman source: [KFERMercer/luci-app-dockerman](https://github.com/KFERMercer/luci-app-dockerman).<br/>
|
||||
luci-app-jd-dailybonus source: [jerrykuku/luci-app-jd-dailybonus](https://github.com/jerrykuku/luci-app-jd-dailybonus).<br/>
|
||||
luci-app-k3screenctrl source: [lwz322/luci-app-k3screenctrl](https://github.com/lwz322/luci-app-k3screenctrl).<br/>
|
||||
luci-app-mentohust source: [BoringCat/luci-app-mentohust](https://github.com/BoringCat/luci-app-mentohust).<br/>
|
||||
luci-app-minieap source: [BoringCat/luci-app-minieap](https://github.com/BoringCat/luci-app-minieap).<br/>
|
||||
luci-app-oled source: [NateLol/luci-app-oled](https://github.com/NateLol/luci-app-oled).<br/>
|
||||
luci-app-onliner source: [rufengsuixing/luci-app-onliner](https://github.com/rufengsuixing/luci-app-onliner).<br/>
|
||||
luci-app-qos-gargoyle source: [kuoruan/luci-app-qos-gargoyle](https://github.com/kuoruan/luci-app-qos-gargoyle).<br/>
|
||||
luci-app-scutclient source: [scutclient/luci-app-scutclient](https://github.com/scutclient/luci-app-scutclient).<br/>
|
||||
luci-app-serverchan source: [tty228/luci-app-serverchan](https://github.com/tty228/luci-app-serverchan).<br/>
|
||||
luci-app-smartinfo source: [animefansxj/luci-app-smartinfo](https://github.com/animefansxj/luci-app-smartinfo).<br/>
|
||||
luci-app-smstool source: [f8q8/luci-app-smstool-master](https://github.com/f8q8/luci-app-smstool-master).<br/>
|
||||
luci-app-usb3disable source: [rufengsuixing/luci-app-usb3disable](https://github.com/rufengsuixing/luci-app-usb3disable).<br/>
|
||||
luci-app-vssr source: [jerrykuku/luci-app-vssr](https://github.com/jerrykuku/luci-app-vssr).<br/>
|
||||
|
||||
luci-lib-docker source: [lisaac/luci-lib-docker](https://github.com/lisaac/luci-lib-docker).<br/>
|
||||
|
||||
luci-proto-minieap source: [ysc3839/luci-proto-minieap](https://github.com/ysc3839/luci-proto-minieap).<br/>
|
||||
luci-proto-modemmanager source: [nickberry17/luci-proto-modemmanager](https://github.com/nickberry17/luci-proto-modemmanager).<br/>
|
||||
|
||||
luci-theme-argonv3 source: [jerrykuku/luci-theme-argon](https://github.com/jerrykuku/luci-theme-argon).<br/>
|
||||
luci-theme-argon-mc source: [sypopo/luci-theme-argon-mc](https://github.com/sypopo/luci-theme-argon-mc).<br/>
|
||||
luci-theme-argon-mod source: [Leo-Jo-My/luci-theme-argon-mod](https://github.com/Leo-Jo-My/luci-theme-argon-mod).<br/>
|
||||
luci-theme-atmaterial source: [yangsongli/luci-theme-atmaterial](https://github.com/yangsongli/luci-theme-atmaterial).<br/>
|
||||
luci-theme-butterfly source: [Leo-Jo-My/luci-theme-butterfly](https://github.com/Leo-Jo-My/luci-theme-Butterfly).<br/>
|
||||
luci-theme-butterfly-dark source: [Leo-Jo-My/luci-theme-butterfly-dark](https://github.com/Leo-Jo-My/luci-theme-Butterfly-dark).<br/>
|
||||
luci-theme-darkmatter source: [apollo-ng/luci-theme-darkmatter](https://github.com/apollo-ng/luci-theme-darkmatter).<br/>
|
||||
luci-theme-infinityfreedom source: [xiaoqingfengATGH/luci-theme-infinityfreedom](https://github.com/xiaoqingfengATGH/luci-theme-infinityfreedom).<br/>
|
||||
luci-theme-netgearv2 source: [tracemouse/luci-theme-netgear](https://github.com/tracemouse/luci-theme-netgear).<br/>
|
||||
luci-theme-opentomato source: [Leo-Jo-My/luci-theme-opentomato](https://github.com/Leo-Jo-My/luci-theme-opentomato).<br/>
|
||||
luci-theme-opentomcat source: [Leo-Jo-My/luci-theme-opentomcat](https://github.com/Leo-Jo-My/luci-theme-opentomcat).<br/>
|
||||
luci-theme-rosy source: [rosywrt/luci-theme-rosy](https://github.com/rosywrt/luci-theme-rosy).<br/>
|
10
Config.in
10
Config.in
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (C) 2006-2013 OpenWrt.org
|
||||
|
||||
mainmenu "ImmortalWrt Configuration"
|
||||
mainmenu "OpenWrt Configuration"
|
||||
|
||||
config MODULES
|
||||
modules
|
||||
@ -13,14 +13,6 @@ config HAVE_DOT_CONFIG
|
||||
bool
|
||||
default y
|
||||
|
||||
HOST_OS := $(shell, uname)
|
||||
|
||||
config HOST_OS_LINUX
|
||||
def_bool $(shell, ./config/check-uname.sh Linux)
|
||||
|
||||
config HOST_OS_MACOS
|
||||
def_bool $(shell, ./config/check-uname.sh Darwin)
|
||||
|
||||
source "target/Config.in"
|
||||
|
||||
source "config/Config-images.in"
|
||||
|
134
LICENSES/GPL-2.0
134
LICENSES/GPL-2.0
@ -36,37 +36,48 @@ 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.
|
||||
them 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.
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
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.
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
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.
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
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.
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
@ -209,9 +220,62 @@ 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
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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
|
||||
@ -302,15 +366,15 @@ 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
|
||||
state 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
|
||||
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
|
||||
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,
|
||||
@ -325,11 +389,11 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
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:
|
||||
If the program does terminal interaction, 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'.
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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.
|
||||
|
||||
|
20
Makefile
20
Makefile
@ -14,10 +14,8 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir
|
||||
|
||||
world:
|
||||
|
||||
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -e '/usr' -e '/nix/store' -m 1)
|
||||
|
||||
export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH))
|
||||
export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH)
|
||||
DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
|
||||
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
|
||||
|
||||
ifneq ($(OPENWRT_BUILD),1)
|
||||
_SINGLE=export MAKEFLAGS=$(space);
|
||||
@ -40,9 +38,6 @@ else
|
||||
include tools/Makefile
|
||||
include toolchain/Makefile
|
||||
|
||||
# Include the test suite Makefile if it exists
|
||||
-include tests/Makefile
|
||||
|
||||
$(toolchain/stamp-compile): $(tools/stamp-compile) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check)
|
||||
$(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
|
||||
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
|
||||
@ -55,16 +50,13 @@ printdb:
|
||||
|
||||
prepare: $(target/stamp-compile)
|
||||
|
||||
_clean: FORCE
|
||||
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(TOPDIR)/staging_dir/packages
|
||||
clean: FORCE
|
||||
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
|
||||
|
||||
clean: _clean
|
||||
rm -rf $(BUILD_LOG_DIR)
|
||||
|
||||
targetclean: _clean
|
||||
targetclean: clean
|
||||
rm -rf $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
|
||||
|
||||
dirclean: targetclean clean
|
||||
dirclean: targetclean
|
||||
rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(BUILD_DIR_BASE)/host
|
||||
rm -rf $(TMP_DIR)
|
||||
$(MAKE) -C $(TOPDIR)/scripts/config clean
|
||||
|
121
README.md
121
README.md
@ -2,27 +2,24 @@
|
||||
|
||||
# Project ImmortalWrt
|
||||
|
||||
ImmortalWrt is a fork of [OpenWrt](https://openwrt.org), with more packages ported, more devices supported, default optimized profiles and localization modifications for mainland China users.<br/>
|
||||
Compared to upstream, we allow to use (non-upstreamable) modifications/hacks to provide better feature/performance/support.
|
||||
ImmortalWrt is a fork of [OpenWrt](https://openwrt.org), with more packages ported, more devices supported, better performance, and special optimizations for mainland China users.<br/>
|
||||
Compared the official one, we allow to use hacks or non-upstreamable patches / modifications to achieve our purpose. Source from anywhere.
|
||||
|
||||
Default login address: http://192.168.1.1 or http://immortalwrt.lan, username: __root__, password: _none_.
|
||||
|
||||
## Download
|
||||
Built firmware images are available for many architectures and come with a package selection to be used as WiFi home router. To quickly find a factory image usable to migrate from a vendor stock firmware to ImmortalWrt, try the *Firmware Selector*.
|
||||
## Deprecation notice
|
||||
|
||||
- [ImmortalWrt Firmware Selector](https://firmware-selector.immortalwrt.org/)
|
||||
|
||||
If your device is supported, please follow the **Info** link to see install instructions or consult the support resources listed below.
|
||||
Support for the ImmortalWrt 18.06 is EoL. Please consider upgrading to ImmortalWrt 21.02 stable release.
|
||||
|
||||
## Development
|
||||
To build your own firmware you need a GNU/Linux, BSD or macOS system (case sensitive filesystem required). Cygwin is unsupported because of the lack of a case sensitive file system.<br/>
|
||||
To build your own firmware you need a GNU/Linux, BSD or MacOSX system (case sensitive filesystem required). Cygwin is unsupported because of the lack of a case sensitive file system.<br/>
|
||||
|
||||
### Requirements
|
||||
To build with this project, Debian 11 is preferred. And you need use the CPU based on AMD64 architecture, with at least 4GB RAM and 25 GB available disk space. Make sure the __Internet__ is accessible.
|
||||
To build with this project, Ubuntu 18.04 LTS is preferred. And you need use the CPU based on AMD64 architecture, with at least 4GB RAM and 25 GB available disk space. Make sure the __Internet__ is accessible.
|
||||
|
||||
The following tools are needed to compile ImmortalWrt, the package names vary between distributions.
|
||||
|
||||
- Here is an example for Debian/Ubuntu users:<br/>
|
||||
- Here is an example for Ubuntu users:<br/>
|
||||
- Method 1:
|
||||
<details>
|
||||
<summary>Setup dependencies via APT</summary>
|
||||
@ -31,42 +28,101 @@ To build your own firmware you need a GNU/Linux, BSD or macOS system (case sensi
|
||||
sudo apt update -y
|
||||
sudo apt full-upgrade -y
|
||||
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
|
||||
bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib \
|
||||
g++-multilib git gnutls-dev gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev \
|
||||
libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev \
|
||||
libreadline-dev libssl-dev libtool libyaml-dev libz-dev lld llvm lrzsz mkisofs msmtp nano \
|
||||
ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip python3-ply python3-docutils \
|
||||
python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs \
|
||||
upx-ucl unzip vim wget xmlto xxd zlib1g-dev zstd
|
||||
bzip2 ccache cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib g++-multilib \
|
||||
git gperf haveged help2man intltool lib32gcc1 libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
|
||||
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
|
||||
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip python3-ply \
|
||||
python-docutils qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \
|
||||
vim wget xmlto xxd zlib1g-dev
|
||||
```
|
||||
</details>
|
||||
- Method 2:
|
||||
```bash
|
||||
sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.org/init_build_environment.sh)'
|
||||
curl -s https://build-scripts.immortalwrt.eu.org/init_build_environment.sh | sudo bash
|
||||
```
|
||||
|
||||
- You can also download and use prebuilt container directly:<br/>
|
||||
See #Quickstart - Build image via OPDE
|
||||
|
||||
Note:
|
||||
- Do everything as an unprivileged user, not root, without sudo.
|
||||
- For the for love of god please do __not__ use ROOT user to build your image.
|
||||
- Using CPUs based on other architectures should be fine to compile ImmortalWrt, but more hacks are needed - No warranty at all.
|
||||
- You must __not__ have spaces or non-ascii characters in PATH or in the work folders on the drive.
|
||||
- You must __not__ have spaces in PATH or in the work folders on the drive.
|
||||
- If you're using Windows Subsystem for Linux (or WSL), removing Windows folders from PATH is required, please see [Build system setup WSL](https://openwrt.org/docs/guide-developer/build-system/wsl) documentation.
|
||||
- Using macOS as the host build OS is __not__ recommended. No warranty at all. You can get tips from [Build system setup macOS](https://openwrt.org/docs/guide-developer/build-system/buildroot.exigence.macosx) documentation.
|
||||
- For more details, please see [Build system setup](https://openwrt.org/docs/guide-developer/build-system/install-buildsystem) documentation.
|
||||
|
||||
### Quickstart
|
||||
1. Run `git clone -b <branch> --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt` to clone the source code.
|
||||
2. Run `cd immortalwrt` to enter source directory.
|
||||
3. Run `./scripts/feeds update -a` to obtain all the latest package definitions defined in feeds.conf / feeds.conf.default
|
||||
4. Run `./scripts/feeds install -a` to install symlinks for all obtained packages into package/feeds/
|
||||
5. Run `make menuconfig` to select your preferred configuration for the toolchain, target system & firmware packages.
|
||||
6. Run `make` to build your firmware. This will download all sources, build the cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen applications for your target system.
|
||||
- Method 1:
|
||||
1. Run `git clone -b <branch> --single-branch https://github.com/immortalwrt/immortalwrt` to clone the source code.
|
||||
2. Run `cd immortalwrt` to enter source directory.
|
||||
3. Run `./scripts/feeds update -a` to obtain all the latest package definitions defined in feeds.conf / feeds.conf.default
|
||||
4. Run `./scripts/feeds install -a` to install symlinks for all obtained packages into package/feeds/
|
||||
5. Run `make menuconfig` to select your preferred configuration for the toolchain, target system & firmware packages.
|
||||
6. Run `make` to build your firmware. This will download all sources, build the cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen applications for your target system.
|
||||
|
||||
- Method 2:
|
||||
<details>
|
||||
<summary>Build image via OPDE</summary>
|
||||
|
||||
- Pull the prebuilt container:
|
||||
```bash
|
||||
docker pull immortalwrt/opde:base
|
||||
# docker run --rm -it immortalwrt/opde:base
|
||||
```
|
||||
|
||||
- For Linux User:
|
||||
```bash
|
||||
git clone -b <branch> --single-branch https://github.com/immortalwrt/immortalwrt && cd immortalwrt
|
||||
docker run --rm -it \
|
||||
-v $PWD:/openwrt \
|
||||
immortalwrt/opde:base zsh
|
||||
./scripts/feeds update -a && ./scripts/feeds install -a
|
||||
```
|
||||
|
||||
- For Windows User:
|
||||
1. Create a volume 'immortalwrt' and clone ImmortalWrt source into volume.
|
||||
```bash
|
||||
docker run --rm -it -v immortalwrt:/openwrt immortalwrt/opde:base git clone -b <branch> --single-branch https://github.com/immortalwrt/immortalwrt .
|
||||
```
|
||||
2. Enter docker container and update feeds.
|
||||
```bash
|
||||
docker run --rm -it -v immortalwrt:/openwrt immortalwrt/opde:base
|
||||
./scripts/feeds update -a && ./scripts/feeds install -a
|
||||
```
|
||||
- Tips: ImmortalWrt source code can not be cloned into NTFS filesystem (symbol link problem during compilation), but docker volume is fine.
|
||||
|
||||
- Proxy Support:
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
-e all_proxy=http://example.com:1081 \
|
||||
-e http_proxy=http://example.com:1081 \
|
||||
-e https_proxy=http://example.com:1081 \
|
||||
-e ALL_PROXY=http://example.com:1081 \
|
||||
-e HTTP_PROXY=http://example.com:1081 \
|
||||
-e HTTPS_PROXY=http://example.com:1081 \
|
||||
-v $PWD:/openwrt \
|
||||
immortalwrt/opde:base zsh
|
||||
```
|
||||
|
||||
> Recommand `http` rather `socks5` protocol
|
||||
>
|
||||
> IP can not be `localhost` or `127.0.0.1`
|
||||
|
||||
- For Windows User, binary is still in volume. It can be copied to outside via followed command:
|
||||
```bash
|
||||
docker run --rm -v <D:\path\to\dir>:/dst -v openwrt:/openwrt -w /dst immortalwrt:base cp /openwrt/bin /dst
|
||||
```
|
||||
> Make sure `D:\path\to\dir` has been appended in [File Sharing](https://docs.docker.com/docker-for-windows/#file-sharing).
|
||||
|
||||
</details>
|
||||
|
||||
### Related Repositories
|
||||
The main repository uses multiple sub-repositories to manage packages of different categories. All packages are installed via the OpenWrt package manager called opkg. If you're looking to develop the web interface or port packages to ImmortalWrt, please find the fitting repository below.
|
||||
The main repository uses multiple sub-repositories to manage packages of different categories. All packages are installed via the ImmortalWrt package manager called opkg. If you're looking to develop the web interface or port packages to ImmortalWrt, please find the fitting repository below.
|
||||
- [LuCI Web Interface](https://github.com/immortalwrt/luci): Modern and modular interface to control the device via a web browser.
|
||||
- [ImmortalWrt Packages](https://github.com/immortalwrt/packages): Community repository of ported packages.
|
||||
- [OpenWrt Routing](https://github.com/openwrt/routing): Packages specifically focused on (mesh) routing.
|
||||
- [OpenWrt Video](https://github.com/openwrt/video): Packages specifically focused on display servers and clients (Xorg and Wayland).
|
||||
- [CONTRIBUTED.md](https://github.com/immortalwrt/immortalwrt/blob/master/CONTRIBUTED.md): the 3rd-party packages we introduced.
|
||||
|
||||
## Support Information
|
||||
For a list of supported devices see the [OpenWrt Hardware Database](https://openwrt.org/supported_devices)
|
||||
@ -82,12 +138,3 @@ For a list of supported devices see the [OpenWrt Hardware Database](https://open
|
||||
|
||||
## License
|
||||
ImmortalWrt is licensed under [GPL-2.0-only](https://spdx.org/licenses/GPL-2.0-only.html).
|
||||
|
||||
## Acknowledgements
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="https://dlercloud.com/"><img src="https://user-images.githubusercontent.com/22235437/111103249-f9ec6e00-8588-11eb-9bfc-67cc55574555.png" width="183" height="52" border="0" alt="Dler Cloud"></a></td>
|
||||
<td><a href="https://www.jetbrains.com/"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_square.png" width="120" height="120" border="0" alt="JetBrains Black Box Logo logo"></a></td>
|
||||
<td><a href="https://sourceforge.net/"><img src="https://sourceforge.net/sflogo.php?type=17&group_id=3663829" alt="SourceForge" width=200></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -3,19 +3,6 @@
|
||||
# Copyright (C) 2006-2013 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE Project
|
||||
|
||||
config EXPERIMENTAL
|
||||
bool "Enable experimental features by default"
|
||||
help
|
||||
Set this option to build with latest bleeding edge features
|
||||
which may or may not work as expected.
|
||||
If you would like to help the development of OpenWrt, you are
|
||||
encouraged to set this option and provide feedback (both
|
||||
positive and negative). But do so only if you know how to
|
||||
recover your device in case of flashing potentially non-working
|
||||
firmware.
|
||||
|
||||
If you plan to use this build in production, say NO!
|
||||
|
||||
menu "Global build settings"
|
||||
|
||||
config JSON_OVERVIEW_IMAGE_INFO
|
||||
@ -26,14 +13,6 @@ menu "Global build settings"
|
||||
directory containing machine readable list of built profiles
|
||||
and resulting images.
|
||||
|
||||
config JSON_CYCLONEDX_SBOM
|
||||
bool "Create CycloneDX SBOM JSON"
|
||||
default BUILDBOT
|
||||
help
|
||||
Create a JSON files *.bom.cdx.json in the build
|
||||
directory containing Software Bill Of Materials in CycloneDX
|
||||
format.
|
||||
|
||||
config ALL_NONSHARED
|
||||
bool "Select all target specific packages by default"
|
||||
select ALL_KMODS
|
||||
@ -49,6 +28,7 @@ menu "Global build settings"
|
||||
|
||||
config BUILDBOT
|
||||
bool "Set build defaults for automatic builds (e.g. via buildbot)"
|
||||
default n
|
||||
help
|
||||
This option changes several defaults to be more suitable for
|
||||
automatic builds. This includes the following changes:
|
||||
@ -64,30 +44,22 @@ menu "Global build settings"
|
||||
bool "Enable signature checking in opkg"
|
||||
default SIGNED_PACKAGES
|
||||
|
||||
config DOWNLOAD_CHECK_CERTIFICATE
|
||||
bool "Enable TLS certificate verification during package download"
|
||||
default y
|
||||
|
||||
config USE_APK
|
||||
imply PACKAGE_apk-openssl
|
||||
bool "Use APK instead of OPKG to build distribution"
|
||||
default y
|
||||
|
||||
comment "General build options"
|
||||
|
||||
config TESTING_KERNEL
|
||||
bool "Use the testing kernel version"
|
||||
depends on HAS_TESTING_KERNEL
|
||||
default EXPERIMENTAL
|
||||
default n
|
||||
help
|
||||
If the target supports a newer kernel version than the default,
|
||||
you can use this config option to enable it
|
||||
|
||||
|
||||
config DISPLAY_SUPPORT
|
||||
bool "Show packages that require graphics support (local or remote)"
|
||||
default n
|
||||
|
||||
config BUILD_PATENTED
|
||||
default y
|
||||
bool "Compile with support for patented functionality"
|
||||
help
|
||||
When this option is disabled, software which provides patented functionality
|
||||
@ -95,6 +67,7 @@ menu "Global build settings"
|
||||
functionality, this optional support will get disabled for this package.
|
||||
|
||||
config BUILD_NLS
|
||||
default n
|
||||
bool "Compile with full language support"
|
||||
help
|
||||
When this option is enabled, packages are built with the full versions of
|
||||
@ -108,22 +81,16 @@ menu "Global build settings"
|
||||
config CLEAN_IPKG
|
||||
bool
|
||||
prompt "Remove ipkg/opkg status data files in final images"
|
||||
default n
|
||||
help
|
||||
This removes all ipkg/opkg status data files from the target directory
|
||||
before building the root filesystem.
|
||||
|
||||
config IPK_FILES_CHECKSUMS
|
||||
bool
|
||||
prompt "Record files checksums in package metadata"
|
||||
depends on !USE_APK
|
||||
help
|
||||
This makes file checksums part of package metadata. It increases size
|
||||
but provides you with pkg_check command to check for flash corruptions.
|
||||
|
||||
config INCLUDE_CONFIG
|
||||
bool "Include build configuration in firmware" if DEVEL
|
||||
default n
|
||||
help
|
||||
If enabled, buildinfo files will be stored in /etc/build.* of firmware.
|
||||
If enabled, config.seed will be stored in /etc/build.config of firmware.
|
||||
|
||||
config REPRODUCIBLE_DEBUG_INFO
|
||||
bool "Make debug information reproducible"
|
||||
@ -155,44 +122,22 @@ menu "Global build settings"
|
||||
config DEBUG
|
||||
bool
|
||||
prompt "Compile packages with debugging info"
|
||||
default n
|
||||
help
|
||||
Adds -g3 to the CFLAGS.
|
||||
|
||||
config USE_GC_SECTIONS
|
||||
bool
|
||||
prompt "Dead code and data elimination for all packages (EXPERIMENTAL)"
|
||||
help
|
||||
Places functions and data items into its own sections to use the linker's
|
||||
garbage collection capabilites.
|
||||
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections
|
||||
|
||||
config USE_LTO
|
||||
bool
|
||||
prompt "Use the link-time optimizer for all packages (EXPERIMENTAL)"
|
||||
help
|
||||
Adds LTO flags to the CFLAGS and LDFLAGS.
|
||||
Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto
|
||||
|
||||
config MOLD
|
||||
depends on (aarch64 || arm || i386 || i686 || m68k || powerpc || powerpc64 || sh4 || x86_64)
|
||||
depends on !GCC_USE_VERSION_11
|
||||
def_bool $(shell, ./config/check-hostcxx.sh 10 2 12)
|
||||
|
||||
config USE_MOLD
|
||||
bool
|
||||
prompt "Use the mold linker for all packages"
|
||||
depends on MOLD
|
||||
help
|
||||
Link packages with mold, a modern linker
|
||||
Packages can opt-out via setting PKG_BUILD_FLAGS:=no-mold
|
||||
|
||||
config IPV6
|
||||
def_bool y
|
||||
bool
|
||||
prompt "Enable IPv6 support in packages"
|
||||
default y
|
||||
help
|
||||
Enables IPv6 support in kernel (builtin) and packages.
|
||||
|
||||
comment "Stripping options"
|
||||
|
||||
choice
|
||||
prompt "Binary stripping method"
|
||||
default USE_STRIP if EXTERNAL_TOOLCHAIN
|
||||
default USE_STRIP if USE_GLIBC
|
||||
default USE_SSTRIP
|
||||
help
|
||||
@ -209,6 +154,7 @@ menu "Global build settings"
|
||||
help
|
||||
This will install binaries stripped using strip from binutils.
|
||||
|
||||
|
||||
config USE_SSTRIP
|
||||
bool "sstrip"
|
||||
depends on !USE_GLIBC
|
||||
@ -225,16 +171,16 @@ menu "Global build settings"
|
||||
help
|
||||
Specifies arguments passed to the strip command when stripping binaries.
|
||||
|
||||
config SSTRIP_DISCARD_TRAILING_ZEROES
|
||||
bool "Strip trailing zero bytes"
|
||||
depends on USE_SSTRIP && !USE_MOLD
|
||||
default y
|
||||
config SSTRIP_ARGS
|
||||
string
|
||||
prompt "Sstrip arguments"
|
||||
depends on USE_SSTRIP
|
||||
default "-z"
|
||||
help
|
||||
Use sstrip's -z option to discard trailing zero bytes
|
||||
Specifies arguments passed to the sstrip command when stripping binaries.
|
||||
|
||||
config STRIP_KERNEL_EXPORTS
|
||||
bool "Strip unnecessary exports from the kernel image"
|
||||
depends on BROKEN
|
||||
help
|
||||
Reduces kernel size by stripping unused kernel exports from the kernel
|
||||
image. Note that this might make the kernel incompatible with any kernel
|
||||
@ -296,22 +242,10 @@ menu "Global build settings"
|
||||
Enable GCC Stack Smashing Protection (SSP) for userspace applications
|
||||
config PKG_CC_STACKPROTECTOR_NONE
|
||||
bool "None"
|
||||
help
|
||||
No stack smashing protection.
|
||||
config PKG_CC_STACKPROTECTOR_REGULAR
|
||||
bool "Regular"
|
||||
help
|
||||
Protects functions with vulnerable objects.
|
||||
This includes functions with buffers larger than 8 bytes or calls to alloca.
|
||||
config PKG_CC_STACKPROTECTOR_STRONG
|
||||
bool "Strong"
|
||||
help
|
||||
Like Regular, but also protects functions with
|
||||
local arrays or references to local frame addresses.
|
||||
config PKG_CC_STACKPROTECTOR_ALL
|
||||
bool "All"
|
||||
help
|
||||
Protects all functions.
|
||||
endchoice
|
||||
|
||||
choice
|
||||
@ -321,18 +255,10 @@ menu "Global build settings"
|
||||
Enable GCC Stack-Smashing Protection (SSP) for the kernel
|
||||
config KERNEL_CC_STACKPROTECTOR_NONE
|
||||
bool "None"
|
||||
help
|
||||
No stack smashing protection.
|
||||
config KERNEL_CC_STACKPROTECTOR_REGULAR
|
||||
bool "Regular"
|
||||
help
|
||||
Protects functions with vulnerable objects.
|
||||
This includes functions with buffers larger than 8 bytes or calls to alloca.
|
||||
config KERNEL_CC_STACKPROTECTOR_STRONG
|
||||
bool "Strong"
|
||||
help
|
||||
Like Regular, but also protects functions with
|
||||
local arrays or references to local frame addresses.
|
||||
endchoice
|
||||
|
||||
config KERNEL_STACKPROTECTOR
|
||||
@ -423,15 +349,4 @@ menu "Global build settings"
|
||||
|
||||
endchoice
|
||||
|
||||
config USE_SECCOMP
|
||||
bool "Enable SECCOMP"
|
||||
select KERNEL_SECCOMP
|
||||
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || loongarch64 || powerpc || x86_64)
|
||||
depends on !TARGET_uml
|
||||
default y
|
||||
help
|
||||
This option enables seccomp kernel features to safely
|
||||
execute untrusted bytecode and selects the seccomp-variants
|
||||
of procd
|
||||
|
||||
endmenu
|
||||
|
@ -4,9 +4,11 @@
|
||||
|
||||
menuconfig DEVEL
|
||||
bool "Advanced configuration options (for developers)"
|
||||
default n
|
||||
|
||||
config BROKEN
|
||||
bool "Show broken platforms / packages / devices" if DEVEL
|
||||
bool "Show broken platforms / packages" if DEVEL
|
||||
default n
|
||||
|
||||
config BINARY_FOLDER
|
||||
string "Binary folder" if DEVEL
|
||||
@ -15,20 +17,6 @@ menuconfig DEVEL
|
||||
Store built firmware images and filesystem images in this directory.
|
||||
If not set, uses './bin/$(BOARD)'
|
||||
|
||||
config DOWNLOAD_TOOL_CUSTOM
|
||||
string "Use custom download tool" if DEVEL
|
||||
default ""
|
||||
help
|
||||
Use and force custom download tool instead of relying on autoselection
|
||||
between curl if available and wget as a fallback.
|
||||
|
||||
download.pl supports 3 tools officially aria2c, curl and wget.
|
||||
If one of the tool is used in this config, download.pl will use the
|
||||
default args to make use of them.
|
||||
|
||||
If the provided string is different than aria2c, curl or wget, the command
|
||||
is used as is and the download url will be appended at the end of such command.
|
||||
|
||||
config DOWNLOAD_FOLDER
|
||||
string "Download folder" if DEVEL
|
||||
default ""
|
||||
@ -51,17 +39,12 @@ menuconfig DEVEL
|
||||
|
||||
config AUTOREMOVE
|
||||
bool "Automatic removal of build directories" if DEVEL
|
||||
default n
|
||||
help
|
||||
Automatically delete build directories after make target completed.
|
||||
This allows you to symlink build_dir into a scratch location, e.g. a ramdisk,
|
||||
which does not have enough space to keep a complete build_dir.
|
||||
|
||||
config BUILD_ALL_HOST_TOOLS
|
||||
bool "Compile all host tools" if DEVEL
|
||||
help
|
||||
Compile all host host tools even if not needed. This is needed to prepare a
|
||||
universal precompiled host tools archive to use in another buildroot.
|
||||
|
||||
config BUILD_SUFFIX
|
||||
string "Build suffix to append to the target BUILD_DIR variable" if DEVEL
|
||||
default ""
|
||||
@ -80,6 +63,7 @@ menuconfig DEVEL
|
||||
|
||||
config CCACHE
|
||||
bool "Use ccache" if DEVEL
|
||||
default n
|
||||
help
|
||||
Compiler cache; see https://ccache.samba.org/
|
||||
|
||||
@ -90,11 +74,6 @@ menuconfig DEVEL
|
||||
Store ccache in this directory.
|
||||
If not set, uses './.ccache'
|
||||
|
||||
config KERNEL_CFLAGS
|
||||
string "Kernel extra CFLAGS" if DEVEL
|
||||
default "-falign-functions=32" if TARGET_bcm53xx
|
||||
default ""
|
||||
|
||||
config EXTERNAL_KERNEL_TREE
|
||||
string "Use external kernel tree" if DEVEL
|
||||
default ""
|
||||
@ -136,13 +115,6 @@ menuconfig DEVEL
|
||||
help
|
||||
If enabled, log files will be written to the ./log directory.
|
||||
|
||||
config BUILD_LOG_DIR
|
||||
string "Log folder" if DEVEL
|
||||
default ""
|
||||
help
|
||||
Store build logs in this directory.
|
||||
If not set, uses './logs'
|
||||
|
||||
config SRC_TREE_OVERRIDE
|
||||
bool "Enable package source tree override" if DEVEL
|
||||
help
|
||||
|
@ -14,10 +14,10 @@ menu "Target Images"
|
||||
prompt "Compression"
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ath79_mikrotik
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
||||
default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_qualcommax
|
||||
default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS
|
||||
default TARGET_INITRAMFS_COMPRESSION_NONE
|
||||
depends on TARGET_ROOTFS_INITRAMFS
|
||||
@ -37,15 +37,18 @@ menu "Target Images"
|
||||
bool "lzma"
|
||||
|
||||
config TARGET_INITRAMFS_COMPRESSION_LZO
|
||||
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
|
||||
bool "lzo"
|
||||
|
||||
config TARGET_INITRAMFS_COMPRESSION_LZ4
|
||||
depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE
|
||||
bool "lz4"
|
||||
|
||||
config TARGET_INITRAMFS_COMPRESSION_XZ
|
||||
bool "xz"
|
||||
|
||||
config TARGET_INITRAMFS_COMPRESSION_ZSTD
|
||||
depends on !LINUX_5_4 && !LINUX_4_19
|
||||
bool "zstd"
|
||||
endchoice
|
||||
|
||||
@ -59,6 +62,7 @@ menu "Target Images"
|
||||
config TARGET_INITRAMFS_FORCE
|
||||
bool "Force"
|
||||
depends on TARGET_ROOTFS_INITRAMFS
|
||||
default n
|
||||
help
|
||||
Ignore the initramfs passed by the bootloader.
|
||||
|
||||
@ -127,7 +131,7 @@ menu "Target Images"
|
||||
config TARGET_EXT4_JOURNAL
|
||||
bool "Create a journaling filesystem"
|
||||
depends on TARGET_ROOTFS_EXT4FS
|
||||
default y
|
||||
default n
|
||||
help
|
||||
Create an ext4 filesystem with a journal.
|
||||
|
||||
@ -148,7 +152,7 @@ menu "Target Images"
|
||||
bool "squashfs"
|
||||
default y if USES_SQUASHFS
|
||||
help
|
||||
Build a squashfs root filesystem.
|
||||
Build a squashfs-lzma root filesystem.
|
||||
|
||||
config TARGET_SQUASHFS_BLOCK_SIZE
|
||||
int "Block size (in KiB)"
|
||||
@ -156,9 +160,6 @@ menu "Target Images"
|
||||
default 64 if LOW_MEMORY_FOOTPRINT
|
||||
default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT)
|
||||
default 256
|
||||
help
|
||||
Select squashfs block size, must be one of:
|
||||
4, 8, 16, 32, 64, 128, 256, 512, 1024
|
||||
|
||||
menuconfig TARGET_ROOTFS_UBIFS
|
||||
bool "ubifs"
|
||||
@ -204,14 +205,12 @@ menu "Target Images"
|
||||
default y
|
||||
|
||||
config GRUB_EFI_IMAGES
|
||||
bool "Build GRUB EFI images"
|
||||
depends on TARGET_x86 || TARGET_armsr || TARGET_loongarch64
|
||||
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
|
||||
depends on TARGET_x86
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||
select PACKAGE_grub2 if TARGET_x86
|
||||
select PACKAGE_grub2-efi if TARGET_x86
|
||||
select PACKAGE_grub2-bios-setup if TARGET_x86
|
||||
select PACKAGE_grub2-efi-arm if TARGET_armsr
|
||||
select PACKAGE_grub2-efi-loongarch64 if TARGET_loongarch64
|
||||
select PACKAGE_grub2
|
||||
select PACKAGE_grub2-efi
|
||||
select PACKAGE_grub2-bios-setup
|
||||
select PACKAGE_kmod-fs-vfat
|
||||
default y
|
||||
|
||||
@ -220,6 +219,11 @@ menu "Target Images"
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
default y
|
||||
|
||||
config GRUB_SERIAL
|
||||
string "Serial port device"
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
default "ttyS0"
|
||||
|
||||
config GRUB_BAUDRATE
|
||||
int "Serial port baud rate"
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
@ -228,8 +232,8 @@ menu "Target Images"
|
||||
|
||||
config GRUB_FLOWCONTROL
|
||||
bool "Use RTE/CTS on serial console"
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
depends on TARGET_SERIAL != ""
|
||||
depends on GRUB_SERIAL != ""
|
||||
default n
|
||||
|
||||
config GRUB_BOOTOPTS
|
||||
string "Extra kernel boot options"
|
||||
@ -260,7 +264,7 @@ menu "Target Images"
|
||||
|
||||
config QCOW2_IMAGES
|
||||
bool "Build PVE/KVM image files (QCOW2)"
|
||||
depends on TARGET_x86 || TARGET_armsr
|
||||
depends on TARGET_x86
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
select PACKAGE_kmod-e1000
|
||||
default y if BUILDBOT
|
||||
@ -272,48 +276,40 @@ menu "Target Images"
|
||||
select PACKAGE_kmod-e1000
|
||||
default y if BUILDBOT
|
||||
|
||||
config VMDK_IMAGES
|
||||
bool "Build VMware image files (VMDK)"
|
||||
depends on TARGET_x86 || TARGET_armsr
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
select PACKAGE_kmod-e1000
|
||||
default y if BUILDBOT
|
||||
|
||||
config VHDX_IMAGES
|
||||
bool "Build Hyper-V image files (VHDX)"
|
||||
depends on TARGET_x86
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
select PACKAGE_kmod-tulip
|
||||
default y if BUILDBOT
|
||||
|
||||
config VMDK_IMAGES
|
||||
bool "Build VMware image files (VMDK)"
|
||||
depends on TARGET_x86
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
select PACKAGE_kmod-e1000
|
||||
default y if BUILDBOT
|
||||
|
||||
config TARGET_SERIAL
|
||||
string "Serial port device"
|
||||
depends on TARGET_x86 || TARGET_armsr || TARGET_loongarch64
|
||||
default "ttyS0"
|
||||
|
||||
config TARGET_IMAGES_GZIP
|
||||
bool "GZip images"
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armsr || TARGET_malta || TARGET_loongarch64
|
||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86
|
||||
default y
|
||||
|
||||
comment "Image Options"
|
||||
|
||||
source "target/linux/*/image/Config.in"
|
||||
source "target/linux/*/*/image/Config.in"
|
||||
|
||||
config TARGET_KERNEL_PARTSIZE
|
||||
int "Kernel partition size (in MiB)"
|
||||
depends on USES_BOOT_PART
|
||||
default 8 if TARGET_apm821xx_sata
|
||||
default 16 if TARGET_rockchip
|
||||
default 64 if TARGET_bcm27xx
|
||||
default 128 if TARGET_armsr
|
||||
default 32
|
||||
default 16
|
||||
|
||||
config TARGET_ROOTFS_PARTSIZE
|
||||
int "Root filesystem partition size (in MiB)"
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
|
||||
default 300 if BUILDBOT
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_mvebu
|
||||
default 800 if BUILDBOT
|
||||
default 160
|
||||
help
|
||||
Select the root filesystem partition size.
|
||||
@ -328,6 +324,7 @@ menu "Target Images"
|
||||
|
||||
config TARGET_ROOTFS_PERSIST_VAR
|
||||
bool "Make /var persistent"
|
||||
default n
|
||||
help
|
||||
Do not symlink /var to /tmp, so that its content will persist
|
||||
across reboots. When enabled, /var/run will still be linked
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
cat << EOF | "$STAGING_DIR_HOST/bin/g++" -c -x c++ -o /dev/null - >/dev/null 2>&1
|
||||
#if __clang__
|
||||
#if __clang_major__ < $3
|
||||
#error "clang too old"
|
||||
#endif
|
||||
#else
|
||||
#if __GNUC__ < $1 || (__GNUC__ == $1 && (__GNUC_MINOR__ < $2))
|
||||
#error "gcc too old"
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
[ $? -eq 0 ] && echo y || echo n
|
@ -1 +0,0 @@
|
||||
[ "$(uname)" = "$1" ] && echo y || echo n
|
@ -1,8 +1,4 @@
|
||||
src-git packages https://github.com/immortalwrt/packages.git
|
||||
src-git luci https://github.com/immortalwrt/luci.git
|
||||
src-git routing https://github.com/openwrt/routing.git
|
||||
src-git telephony https://github.com/openwrt/telephony.git
|
||||
src-git video https://github.com/openwrt/video.git
|
||||
#src-git targets https://github.com/openwrt/targets.git
|
||||
#src-git oldpackages http://git.openwrt.org/packages.git
|
||||
#src-link custom /usr/src/openwrt/custom-feed
|
||||
src-git packages https://github.com/immortalwrt/packages.git;openwrt-18.06
|
||||
src-git luci https://github.com/immortalwrt/luci.git;openwrt-18.06-k5.4
|
||||
src-git routing https://github.com/openwrt/routing.git;openwrt-22.03
|
||||
src-git telephony https://github.com/openwrt/telephony.git;openwrt-22.03
|
||||
|
@ -23,10 +23,7 @@ AM_TOOL_PATHS:= \
|
||||
LIBTOOLIZE=$(STAGING_DIR_HOST)/bin/libtoolize \
|
||||
LIBTOOL=$(STAGING_DIR_HOST)/bin/libtool \
|
||||
M4=$(STAGING_DIR_HOST)/bin/m4 \
|
||||
AUTOPOINT=true \
|
||||
GTKDOCIZE=true
|
||||
|
||||
AM_TOOL_PATHS_FAKE:=$(subst = ,=,$(patsubst "%,"$(TRUE)",$(subst =,= ",$(AM_TOOL_PATHS))))
|
||||
AUTOPOINT=true
|
||||
|
||||
# 1: build dir
|
||||
# 2: remove files
|
||||
@ -44,7 +41,7 @@ define autoreconf
|
||||
touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
|
||||
$(AM_TOOL_PATHS) \
|
||||
LIBTOOLIZE='$(STAGING_DIR_HOST)/bin/libtoolize --install' \
|
||||
$(STAGING_DIR_HOST)/bin/autoreconf -v -f -i \
|
||||
$(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
|
||||
$(if $(word 2,$(3)),--no-recursive) \
|
||||
-B $(STAGING_DIR_HOST)/share/aclocal \
|
||||
$(patsubst %,-I %,$(5)) \
|
||||
@ -116,7 +113,7 @@ ifneq ($(filter patch-libtool,$(PKG_FIXUP)),)
|
||||
endif
|
||||
|
||||
ifneq ($(filter libtool,$(PKG_FIXUP)),)
|
||||
PKG_BUILD_DEPENDS += libtool
|
||||
PKG_BUILD_DEPENDS += libtool libiconv
|
||||
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
|
||||
Hooks/Configure/Pre += autoreconf_target
|
||||
endif
|
||||
@ -126,6 +123,13 @@ ifneq ($(filter libtool-abiver,$(PKG_FIXUP)),)
|
||||
Hooks/Configure/Post += set_libtool_abiver
|
||||
endif
|
||||
|
||||
ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
|
||||
PKG_BUILD_DEPENDS += libtool libiconv
|
||||
ifeq ($(filter no-autoreconf,$(PKG_FIXUP)),)
|
||||
Hooks/Configure/Pre += autoreconf_target
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter autoreconf,$(PKG_FIXUP)),)
|
||||
ifeq ($(filter autoreconf,$(Hooks/Configure/Pre)),)
|
||||
Hooks/Configure/Pre += autoreconf_target
|
||||
@ -161,6 +165,12 @@ ifneq ($(filter libtool,$(HOST_FIXUP)),)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter libtool-ucxx,$(HOST_FIXUP)),)
|
||||
ifeq ($(filter no-autoreconf,$(HOST_FIXUP)),)
|
||||
Hooks/HostConfigure/Pre += autoreconf_host
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter autoreconf,$(HOST_FIXUP)),)
|
||||
ifeq ($(filter autoreconf,$(Hooks/HostConfigure/Pre)),)
|
||||
Hooks/HostConfigure/Pre += autoreconf_host
|
||||
|
@ -1,86 +0,0 @@
|
||||
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN
|
||||
LLVM_VER:=
|
||||
|
||||
CLANG_MIN_VER:=12
|
||||
|
||||
ifneq ($(CONFIG_USE_LLVM_HOST),)
|
||||
BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
|
||||
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
|
||||
BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH)
|
||||
else
|
||||
BPF_PATH:=$(PATH)
|
||||
endif
|
||||
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12 clang-11))
|
||||
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
|
||||
endif
|
||||
ifneq ($(CONFIG_USE_LLVM_PREBUILT),)
|
||||
CLANG:=$(TOPDIR)/llvm-bpf/bin/clang
|
||||
endif
|
||||
ifneq ($(CONFIG_USE_LLVM_BUILD),)
|
||||
CLANG:=$(STAGING_DIR_HOST)/llvm-bpf/bin/clang
|
||||
endif
|
||||
|
||||
LLVM_PATH:=$(dir $(CLANG))
|
||||
LLVM_LLC:=$(LLVM_PATH)/llc$(LLVM_VER)
|
||||
LLVM_DIS:=$(LLVM_PATH)/llvm-dis$(LLVM_VER)
|
||||
LLVM_OPT:=$(LLVM_PATH)/opt$(LLVM_VER)
|
||||
LLVM_STRIP:=$(LLVM_PATH)/llvm-strip$(LLVM_VER)
|
||||
|
||||
BPF_KARCH:=mips
|
||||
BPF_ARCH:=mips$(if $(CONFIG_ARCH_64BIT),64)$(if $(CONFIG_BIG_ENDIAN),,el)
|
||||
BPF_TARGET:=bpf$(if $(CONFIG_BIG_ENDIAN),eb,el)
|
||||
|
||||
BPF_HEADERS_DIR:=$(STAGING_DIR)/bpf-headers
|
||||
|
||||
BPF_KERNEL_INCLUDE := \
|
||||
-nostdinc -isystem $(TOOLCHAIN_ROOT_DIR)/lib/gcc/*/*/include \
|
||||
$(patsubst %,-isystem%,$(TOOLCHAIN_INC_DIRS)) \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/asm/mach-generic \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/generated \
|
||||
-I$(BPF_HEADERS_DIR)/include \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/generated/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/include/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/include/generated/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/tools/lib \
|
||||
-I$(BPF_HEADERS_DIR)/tools/testing/selftests \
|
||||
-I$(BPF_HEADERS_DIR)/samples/bpf \
|
||||
-include linux/kconfig.h -include asm_goto_workaround.h
|
||||
|
||||
BPF_CFLAGS := \
|
||||
$(BPF_KERNEL_INCLUDE) -I$(PKG_BUILD_DIR) \
|
||||
-D__KERNEL__ -D__BPF_TRACING__ -DCONFIG_GENERIC_CSUM \
|
||||
-D__TARGET_ARCH_${BPF_KARCH} \
|
||||
-m$(if $(CONFIG_BIG_ENDIAN),big,little)-endian \
|
||||
-fno-stack-protector -Wall \
|
||||
-Wno-unused-value -Wno-pointer-sign \
|
||||
-Wno-compare-distinct-pointer-types \
|
||||
-Wno-gnu-variable-sized-type-not-at-end \
|
||||
-Wno-address-of-packed-member -Wno-tautological-compare \
|
||||
-Wno-unknown-warning-option \
|
||||
-fno-asynchronous-unwind-tables \
|
||||
-Wno-uninitialized -Wno-unused-variable \
|
||||
-Wno-unused-label \
|
||||
-O2 -emit-llvm -Xclang -disable-llvm-passes
|
||||
|
||||
ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),)
|
||||
ifeq ($(DUMP)$(filter download refresh,$(MAKECMDGOALS)),)
|
||||
CLANG_VER:=$(shell $(CLANG) --target=$(BPF_TARGET) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
|
||||
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
|
||||
ifeq ($(CLANG_VER_VALID),)
|
||||
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
define CompileBPF
|
||||
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
|
||||
-c $(1) -o $(patsubst %.c,%.bc,$(1))
|
||||
$(LLVM_OPT) -O2 -mtriple=$(BPF_TARGET) < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(1))
|
||||
$(LLVM_DIS) < $(patsubst %.c,%.opt,$(1)) > $(patsubst %.c,%.S,$(1))
|
||||
$(LLVM_LLC) -march=$(BPF_TARGET) -mcpu=v3 -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
|
||||
$(CP) $(patsubst %.c,%.o,$(1)) $(patsubst %.c,%.debug.o,$(1))
|
||||
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
|
||||
endef
|
||||
|
@ -22,9 +22,9 @@ HOST_CMAKE_BINARY_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BI
|
||||
MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
|
||||
|
||||
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
|
||||
cmake_tool=$(firstword $(TOOLCHAIN_BIN_DIRS))/$(1)
|
||||
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
|
||||
else
|
||||
cmake_tool=$(shell command -v $(1))
|
||||
cmake_tool=$(shell which $(1))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CCACHE),)
|
||||
@ -49,7 +49,7 @@ CMAKE_AR:=$(call cmake_tool,$(TARGET_AR))
|
||||
CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
|
||||
CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
|
||||
|
||||
CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_ROOT_DIR)
|
||||
CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT))
|
||||
CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST)
|
||||
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
|
||||
CMAKE_HOST_INSTALL_PREFIX = $(HOST_BUILD_PREFIX)
|
||||
@ -68,8 +68,6 @@ ifeq ($(HOST_USE_NINJA),1)
|
||||
define Host/Uninstall/Default
|
||||
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) uninstall
|
||||
endef
|
||||
else
|
||||
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Unix Makefiles"
|
||||
endif
|
||||
|
||||
ifeq ($(PKG_USE_NINJA),1)
|
||||
@ -82,8 +80,6 @@ ifeq ($(PKG_USE_NINJA),1)
|
||||
define Build/Install/Default
|
||||
+DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install
|
||||
endef
|
||||
else
|
||||
CMAKE_OPTIONS += -DCMAKE_GENERATOR="Unix Makefiles"
|
||||
endif
|
||||
|
||||
define Build/Configure/Default
|
||||
@ -93,11 +89,10 @@ define Build/Configure/Default
|
||||
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
|
||||
cmake \
|
||||
--no-warn-unused-cli \
|
||||
-DCMAKE_SYSTEM_NAME=Linux \
|
||||
-DCMAKE_SYSTEM_VERSION=1 \
|
||||
-DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \
|
||||
-DCMAKE_BUILD_TYPE=$(if $(CONFIG_DEBUG),Debug,Release) \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \
|
||||
@ -146,7 +141,6 @@ define Host/Configure/Default
|
||||
CXXFLAGS="$(HOST_CFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||
cmake \
|
||||
--no-warn-unused-cli \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \
|
||||
-DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
|
||||
@ -174,7 +168,6 @@ define Host/Configure/Default
|
||||
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \
|
||||
-DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \
|
||||
-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
$(CMAKE_HOST_OPTIONS) \
|
||||
$(HOST_CMAKE_SOURCE_DIR) \
|
||||
)
|
||||
|
@ -1,5 +0,0 @@
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
DEFAULT_PACKAGES += apk-openssl
|
||||
else
|
||||
DEFAULT_PACKAGES += opkg
|
||||
endif
|
@ -12,7 +12,6 @@
|
||||
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)) -printf "%p%T@\n" | sort | $(MKHASH) md5
|
||||
find_md5_reproducible=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -print0 | xargs -0 $(MKHASH) md5 | sort | $(MKHASH) md5
|
||||
|
||||
define rdep
|
||||
.PRECIOUS: $(2)
|
||||
@ -28,7 +27,7 @@ ifneq ($(wildcard $(2)),)
|
||||
{ [ \! -f "$(3)" ] || diff $(3) $(3).1 >/dev/null; } && \
|
||||
) \
|
||||
{ \
|
||||
[ -f "$(2)_check.1" ] && mv "$(2)_check.1" "$(2)_check"; \
|
||||
[ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
|
||||
$(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
|
||||
$(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
|
||||
touch -r "$(2)" "$(2)_check"; \
|
||||
|
@ -10,18 +10,14 @@ LEDE_GIT = $(PROJECT_GIT)
|
||||
|
||||
ifdef PKG_SOURCE_VERSION
|
||||
ifndef PKG_VERSION
|
||||
PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(subst -,.,$(PKG_SOURCE_DATE)),0)~$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
||||
PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
||||
endif
|
||||
PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.zst
|
||||
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
|
||||
endif
|
||||
|
||||
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
|
||||
|
||||
# Export options for download.pl
|
||||
export DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE)
|
||||
export DOWNLOAD_TOOL_CUSTOM:=$(CONFIG_DOWNLOAD_TOOL_CUSTOM)
|
||||
|
||||
define dl_method_git
|
||||
$(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git)
|
||||
endef
|
||||
@ -168,7 +164,7 @@ define DownloadMethod/cvs
|
||||
cd $(TMP_DIR)/dl && \
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
cvs -d $(URL) export $(SOURCE_VERSION) $(SUBDIR) && \
|
||||
cvs -d $(URL) export $(VERSION) $(SUBDIR) && \
|
||||
echo "Packing checkout..." && \
|
||||
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
||||
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
||||
@ -184,10 +180,10 @@ define DownloadMethod/svn
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
( svn help export | grep -q trust-server-cert && \
|
||||
svn export --non-interactive --trust-server-cert -r$(SOURCE_VERSION) $(URL) $(SUBDIR) || \
|
||||
svn export --non-interactive -r$(SOURCE_VERSION) $(URL) $(SUBDIR) ) && \
|
||||
svn export --non-interactive --trust-server-cert -r$(VERSION) $(URL) $(SUBDIR) || \
|
||||
svn export --non-interactive -r$(VERSION) $(URL) $(SUBDIR) ) && \
|
||||
echo "Packing checkout..." && \
|
||||
export TAR_TIMESTAMP="`svn info -r$(SOURCE_VERSION) --show-item last-changed-date $(URL)`" && \
|
||||
export TAR_TIMESTAMP="" && \
|
||||
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
||||
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
||||
rm -rf $(SUBDIR); \
|
||||
@ -205,39 +201,27 @@ define DownloadMethod/github_archive
|
||||
$(SCRIPT_DIR)/dl_github_archive.py \
|
||||
--dl-dir="$(DL_DIR)" \
|
||||
--url="$(URL)" \
|
||||
--version="$(SOURCE_VERSION)" \
|
||||
--version="$(VERSION)" \
|
||||
--subdir="$(SUBDIR)" \
|
||||
--source="$(FILE)" \
|
||||
--hash="$(MIRROR_HASH)" \
|
||||
--submodules $(SUBMODULES) \
|
||||
|| ( $(call DownloadMethod/rawgit) ); \
|
||||
)
|
||||
endef
|
||||
|
||||
# Only intends to be called as a submethod from other DownloadMethod
|
||||
#
|
||||
# We first clone, checkout and then we generate a tar using the
|
||||
# git archive command to apply any rules of .gitattributes
|
||||
# To keep consistency with github generated tar archive, we default
|
||||
# the short hash to 8 (default is 7). (for git log related usage)
|
||||
define DownloadMethod/rawgit
|
||||
echo "Checking out files from the git repository..."; \
|
||||
mkdir -p $(TMP_DIR)/dl && \
|
||||
cd $(TMP_DIR)/dl && \
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
git clone --filter=blob:none $(OPTS) $(URL) $(SUBDIR) && \
|
||||
(cd $(SUBDIR) && git checkout $(SOURCE_VERSION)) && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
|
||||
echo "Generating formal git archive (apply .gitattributes rules)" && \
|
||||
(cd $(SUBDIR) && git config core.abbrev 8 && \
|
||||
git archive --format=tar HEAD --output=../$(SUBDIR).tar.git) && \
|
||||
$(if $(filter skip,$(SUBMODULES)),true,$(TAR) --ignore-failed-read -C $(SUBDIR) -f $(SUBDIR).tar.git -r .git .gitmodules 2>/dev/null) && \
|
||||
rm -rf $(SUBDIR) && mkdir $(SUBDIR) && \
|
||||
$(TAR) -C $(SUBDIR) -xf $(SUBDIR).tar.git && \
|
||||
(cd $(SUBDIR) && $(if $(filter skip,$(SUBMODULES)),true,git submodule update --init --recursive -- $(SUBMODULES) && \
|
||||
rm -rf .git .gitmodules)) && \
|
||||
git clone $(OPTS) $(URL) $(SUBDIR) && \
|
||||
(cd $(SUBDIR) && git checkout $(VERSION) && \
|
||||
git submodule update --init --recursive) && \
|
||||
echo "Packing checkout..." && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
|
||||
rm -rf $(SUBDIR)/.git && \
|
||||
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
||||
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
||||
rm -rf $(SUBDIR);
|
||||
@ -250,7 +234,7 @@ define DownloadMethod/bzr
|
||||
cd $(TMP_DIR)/dl && \
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
bzr export --per-file-timestamps -r$(SOURCE_VERSION) $(SUBDIR) $(URL) && \
|
||||
bzr export --per-file-timestamps -r$(VERSION) $(SUBDIR) $(URL) && \
|
||||
echo "Packing checkout..." && \
|
||||
export TAR_TIMESTAMP="" && \
|
||||
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
||||
@ -266,7 +250,7 @@ define DownloadMethod/hg
|
||||
cd $(TMP_DIR)/dl && \
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
hg clone -r $(SOURCE_VERSION) $(URL) $(SUBDIR) && \
|
||||
hg clone -r $(VERSION) $(URL) $(SUBDIR) && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && hg log --template '@{date}' -l 1` && \
|
||||
find $(SUBDIR) -name .hg | xargs rm -rf && \
|
||||
echo "Packing checkout..." && \
|
||||
@ -283,7 +267,7 @@ define DownloadMethod/darcs
|
||||
cd $(TMP_DIR)/dl && \
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
darcs get -t $(SOURCE_VERSION) $(URL) $(SUBDIR) && \
|
||||
darcs get -t $(VERSION) $(URL) $(SUBDIR) && \
|
||||
export TAR_TIMESTAMP=`cd $(SUBDIR) && LC_ALL=C darcs log --last 1 | sed -ne 's!^Date: \+!!p'` && \
|
||||
find $(SUBDIR) -name _darcs | xargs rm -rf && \
|
||||
echo "Packing checkout..." && \
|
||||
@ -293,12 +277,12 @@ define DownloadMethod/darcs
|
||||
)
|
||||
endef
|
||||
|
||||
Validate/cvs=SOURCE_VERSION SUBDIR
|
||||
Validate/svn=SOURCE_VERSION SUBDIR
|
||||
Validate/git=SOURCE_VERSION SUBDIR
|
||||
Validate/bzr=SOURCE_VERSION SUBDIR
|
||||
Validate/hg=SOURCE_VERSION SUBDIR
|
||||
Validate/darcs=SOURCE_VERSION SUBDIR
|
||||
Validate/cvs=VERSION SUBDIR
|
||||
Validate/svn=VERSION SUBDIR
|
||||
Validate/git=VERSION SUBDIR
|
||||
Validate/bzr=VERSION SUBDIR
|
||||
Validate/hg=VERSION SUBDIR
|
||||
Validate/darcs=VERSION SUBDIR
|
||||
|
||||
define Download/Defaults
|
||||
URL:=
|
||||
@ -311,9 +295,8 @@ define Download/Defaults
|
||||
MIRROR:=1
|
||||
MIRROR_HASH=$$(MIRROR_MD5SUM)
|
||||
MIRROR_MD5SUM:=x
|
||||
SOURCE_VERSION:=
|
||||
VERSION:=
|
||||
OPTS:=
|
||||
SUBMODULES:=
|
||||
endef
|
||||
|
||||
define Download/default
|
||||
@ -322,11 +305,10 @@ define Download/default
|
||||
URL_FILE:=$(PKG_SOURCE_URL_FILE)
|
||||
SUBDIR:=$(PKG_SOURCE_SUBDIR)
|
||||
PROTO:=$(PKG_SOURCE_PROTO)
|
||||
SUBMODULES:=$(PKG_SOURCE_SUBMODULES)
|
||||
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
|
||||
$(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
|
||||
$(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH))
|
||||
SOURCE_VERSION:=$(PKG_SOURCE_VERSION)
|
||||
VERSION:=$(PKG_SOURCE_VERSION)
|
||||
$(if $(PKG_MD5SUM),MD5SUM:=$(PKG_MD5SUM))
|
||||
$(if $(PKG_HASH),HASH:=$(PKG_HASH))
|
||||
endef
|
||||
|
@ -18,10 +18,6 @@ opkg_package_files = $(wildcard \
|
||||
$(foreach dir,$(PACKAGE_SUBDIRS), \
|
||||
$(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
|
||||
|
||||
apk_package_files = $(wildcard \
|
||||
$(foreach dir,$(PACKAGE_SUBDIRS), \
|
||||
$(foreach pkg,$(1), $(dir)/$(pkg)_*.apk)))
|
||||
|
||||
# 1: package name
|
||||
define FeedPackageDir
|
||||
$(strip $(if $(CONFIG_PER_FEED_REPO), \
|
||||
@ -32,12 +28,12 @@ $(strip $(if $(CONFIG_PER_FEED_REPO), \
|
||||
endef
|
||||
|
||||
# 1: destination file
|
||||
define FeedSourcesAppendOPKG
|
||||
define FeedSourcesAppend
|
||||
( \
|
||||
echo 'src/gz %d_core %U/targets/%S/packages'; \
|
||||
$(strip $(if $(CONFIG_PER_FEED_REPO), \
|
||||
echo 'src/gz %d_base %U/packages/%A/base'; \
|
||||
$(if $(CONFIG_BUILDBOT), \
|
||||
$(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
|
||||
echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \
|
||||
$(foreach feed,$(FEEDS_AVAILABLE), \
|
||||
$(if $(CONFIG_FEED_$(feed)), \
|
||||
@ -45,20 +41,6 @@ define FeedSourcesAppendOPKG
|
||||
) >> $(1)
|
||||
endef
|
||||
|
||||
# 1: destination file
|
||||
define FeedSourcesAppendAPK
|
||||
( \
|
||||
echo '%U/targets/%S/packages/packages.adb'; \
|
||||
$(strip $(if $(CONFIG_PER_FEED_REPO), \
|
||||
echo '%U/packages/%A/base/packages.adb'; \
|
||||
$(if $(CONFIG_BUILDBOT), \
|
||||
echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \
|
||||
$(foreach feed,$(FEEDS_AVAILABLE), \
|
||||
$(if $(CONFIG_FEED_$(feed)), \
|
||||
echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )%U/packages/%A/$(feed)/packages.adb';)))) \
|
||||
) >> $(1)
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
define GetABISuffix
|
||||
$(if $(ABIV_$(1)),$(ABIV_$(1)),$(call FormatABISuffix,$(1),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))))
|
||||
|
@ -36,11 +36,6 @@ ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
|
||||
TARGET_CFLAGS += -fstack-protector-strong
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_CC_STACKPROTECTOR_ALL
|
||||
ifeq ($(strip $(PKG_SSP)),1)
|
||||
TARGET_CFLAGS += -fstack-protector-all
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_FORTIFY_SOURCE_1
|
||||
ifeq ($(strip $(PKG_FORTIFY_SOURCE)),1)
|
||||
TARGET_CFLAGS += -D_FORTIFY_SOURCE=1
|
||||
|
@ -21,12 +21,11 @@ include $(INCLUDE_DIR)/depends.mk
|
||||
include $(INCLUDE_DIR)/quilt.mk
|
||||
|
||||
BUILD_TYPES += host
|
||||
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(HOST_PREPARED_DEPENDS)))
|
||||
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(HOST_PREPARED_DEPENDS)))
|
||||
HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured
|
||||
HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
|
||||
HOST_BUILD_PREFIX?=$(if $(IS_PACKAGE_BUILD),$(STAGING_DIR_HOSTPKG),$(STAGING_DIR_HOST))
|
||||
HOST_STAMP_INSTALLED:=$(HOST_BUILD_PREFIX)/stamp/.$(PKG_NAME)_installed
|
||||
HOST_STAMP_PROGRAMS:=$(foreach program,$(PKG_PROGRAMS),$(dir $(HOST_STAMP_INSTALLED))$(subst $(PKG_NAME),$(program),$(notdir $(HOST_STAMP_INSTALLED))) )
|
||||
|
||||
override MAKEFLAGS=
|
||||
|
||||
@ -35,31 +34,23 @@ include $(INCLUDE_DIR)/autotools.mk
|
||||
_host_target:=$(if $(HOST_QUILT),,.)
|
||||
|
||||
Host/Patch:=$(Host/Patch/Default)
|
||||
define Host/Prepare/Default
|
||||
$(if $(strip $(HOST_UNPACK)),$(HOST_UNPACK))
|
||||
ifneq ($(strip $(HOST_UNPACK)),)
|
||||
define Host/Prepare/Default
|
||||
$(HOST_UNPACK)
|
||||
[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)
|
||||
$(Host/Patch)
|
||||
endef
|
||||
endef
|
||||
endif
|
||||
|
||||
define Host/Prepare
|
||||
$(call Host/Prepare/Default)
|
||||
endef
|
||||
|
||||
define Host/Gnulib/Prepare
|
||||
$(STAGING_DIR_HOST)/bin/gnulib-tool \
|
||||
--local-dir=$(STAGING_DIR_HOST)/share/gnulib \
|
||||
--source-base=$(PKG_GNULIB_BASE) \
|
||||
$(PKG_GNULIB_ARGS) \
|
||||
$(PKG_GNULIB_MODS) \
|
||||
;
|
||||
endef
|
||||
|
||||
HOST_CONFIGURE_VARS = \
|
||||
CC="$(HOSTCC)" \
|
||||
CFLAGS="$(HOST_CFLAGS)" \
|
||||
CXX="$(HOSTCXX)" \
|
||||
CPPFLAGS="$(HOST_CPPFLAGS)" \
|
||||
CXXFLAGS="$(HOST_CXXFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||
CONFIG_SHELL="$(SHELL)"
|
||||
|
||||
@ -67,7 +58,6 @@ HOST_CONFIGURE_ARGS = \
|
||||
--target=$(GNU_HOST_NAME) \
|
||||
--host=$(GNU_HOST_NAME) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--disable-dependency-tracking \
|
||||
--program-prefix="" \
|
||||
--program-suffix="" \
|
||||
--prefix=$(HOST_BUILD_PREFIX) \
|
||||
@ -76,10 +66,6 @@ HOST_CONFIGURE_ARGS = \
|
||||
--localstatedir=$(HOST_BUILD_PREFIX)/var \
|
||||
--sbindir=$(HOST_BUILD_PREFIX)/bin
|
||||
|
||||
ifneq ($(YEAR_2038),y)
|
||||
HOST_CONFIGURE_ARGS += --disable-year2038
|
||||
endif
|
||||
|
||||
HOST_MAKE_VARS = \
|
||||
CFLAGS="$(HOST_CFLAGS)" \
|
||||
CPPFLAGS="$(HOST_CPPFLAGS)" \
|
||||
@ -111,25 +97,19 @@ define Host/Configure
|
||||
$(call Host/Configure/Default)
|
||||
endef
|
||||
|
||||
HOST_MAKE_PATH ?= .
|
||||
|
||||
define Host/Compile/Default
|
||||
+$(HOST_MAKE_VARS) \
|
||||
$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/$(HOST_MAKE_PATH) \
|
||||
$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
|
||||
$(HOST_MAKE_FLAGS) \
|
||||
$(1)
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
$(call Host/Compile/Default,$(if $(PKG_SUBDIRS),SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))'))
|
||||
endef
|
||||
|
||||
define Host/Gnulib/Compile
|
||||
$(call Host/Compile/Default,SUBDIRS='$$$$(wildcard $(PKG_GNULIB_BASE))')
|
||||
$(call Host/Compile/Default)
|
||||
endef
|
||||
|
||||
define Host/Install/Default
|
||||
$(call Host/Compile/Default,$(if $(PKG_SUBDIRS),SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))') install)
|
||||
$(call Host/Compile/Default,install)
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
@ -149,7 +129,6 @@ define Host/Exports/Default
|
||||
$(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
|
||||
$(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
|
||||
$(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig
|
||||
$(1) : export GIT_CEILING_DIRECTORIES=$$(BUILD_DIR_HOST)
|
||||
$(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE))
|
||||
$(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG))
|
||||
endef
|
||||
@ -190,7 +169,7 @@ ifndef DUMP
|
||||
$(foreach hook,$(Hooks/HostInstall/Post),$(call $(hook))$(sep))
|
||||
mkdir -p $$(shell dirname $$@)
|
||||
touch $(HOST_STAMP_BUILT)
|
||||
touch $$@ $(HOST_STAMP_PROGRAMS)
|
||||
touch $$@
|
||||
|
||||
$(call DefaultTargets,$(patsubst %,host-%,$(DEFAULT_SUBDIR_TARGETS)))
|
||||
ifndef STAMP_BUILT
|
||||
@ -205,7 +184,7 @@ ifndef DUMP
|
||||
|
||||
$(_host_target)host-prepare: $(HOST_STAMP_PREPARED)
|
||||
$(_host_target)host-configure: $(HOST_STAMP_CONFIGURED)
|
||||
$(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_PROGRAMS)
|
||||
$(_host_target)host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED)
|
||||
host-install: host-compile
|
||||
|
||||
host-clean-build: FORCE
|
||||
@ -214,21 +193,17 @@ ifndef DUMP
|
||||
|
||||
host-clean: host-clean-build
|
||||
$(call Host/Clean)
|
||||
rm -rf $(HOST_STAMP_INSTALLED) $(HOST_STAMP_PROGRAMS)
|
||||
rm -rf $(HOST_STAMP_INSTALLED)
|
||||
|
||||
ifneq ($(CONFIG_AUTOREMOVE),)
|
||||
host-compile:
|
||||
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | \
|
||||
$(XARGS) -0 rm -rf
|
||||
$(FIND) $(HOST_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | \
|
||||
$(XARGS) rm -rf
|
||||
endif
|
||||
endef
|
||||
endif
|
||||
|
||||
define HostBuild
|
||||
$(HostBuild/Core)
|
||||
$(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,
|
||||
$(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),,
|
||||
$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
|
||||
)
|
||||
)
|
||||
$(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
|
||||
endef
|
||||
|
@ -4,29 +4,13 @@ IMAGE_KERNEL = $(word 1,$^)
|
||||
IMAGE_ROOTFS = $(word 2,$^)
|
||||
|
||||
define ModelNameLimit16
|
||||
$(shell printf %.16s "$(word 2, $(subst _, ,$(1)))")
|
||||
$(shell expr substr "$(word 2, $(subst _, ,$(1)))" 1 16)
|
||||
endef
|
||||
|
||||
define rootfs_align
|
||||
$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
|
||||
endef
|
||||
|
||||
|
||||
define Build/append-dtb
|
||||
cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
|
||||
endef
|
||||
|
||||
define Build/append-dtb-elf
|
||||
$(TARGET_CROSS)objcopy \
|
||||
--set-section-flags=.appended_dtb=alloc,contents \
|
||||
--update-section \
|
||||
.appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@
|
||||
endef
|
||||
|
||||
define Build/append-kernel
|
||||
dd if=$(IMAGE_KERNEL) >> $@
|
||||
endef
|
||||
|
||||
define Build/package-kernel-ubifs
|
||||
mkdir $@.kernelubifs
|
||||
cp $@ $@.kernelubifs/kernel
|
||||
@ -37,172 +21,21 @@ define Build/package-kernel-ubifs
|
||||
endef
|
||||
|
||||
define Build/append-image
|
||||
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
|
||||
fwtool -s /dev/null -t "$@.stripmeta" || :
|
||||
fwtool -i /dev/null -t "$@.stripmeta" || :
|
||||
dd if="$@.stripmeta" >> "$@"
|
||||
rm "$@.stripmeta"
|
||||
dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
|
||||
endef
|
||||
|
||||
ifdef IB
|
||||
define Build/append-image-stage
|
||||
dd if=$(STAGING_DIR_IMAGE)/$(BOARD)-$(SUBTARGET)-$(DEVICE_NAME)-$(1) >> $@
|
||||
dd if=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1) >> $@
|
||||
endef
|
||||
else
|
||||
define Build/append-image-stage
|
||||
cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta"
|
||||
fwtool -s /dev/null -t "$@.stripmeta" || :
|
||||
fwtool -i /dev/null -t "$@.stripmeta" || :
|
||||
mkdir -p "$(STAGING_DIR_IMAGE)"
|
||||
dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)-$(SUBTARGET)-$(DEVICE_NAME)-$(1)"
|
||||
dd if="$@.stripmeta" >> "$@"
|
||||
rm "$@.stripmeta"
|
||||
dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) of=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)
|
||||
dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0)
|
||||
json_quote=$(subst ','\'',$(subst ",\",$(1)))
|
||||
#")')
|
||||
|
||||
legacy_supported_message=$(SUPPORTED_DEVICES) - Image version mismatch: image $(compat_version), \
|
||||
device 1.0. Please wipe config during upgrade (force required) or reinstall. \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),Reason: $(DEVICE_COMPAT_MESSAGE),Please check documentation ...)
|
||||
|
||||
metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))"))))
|
||||
metadata_json = \
|
||||
'{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.1", \
|
||||
"compat_version": "$(call json_quote,$(compat_version))", \
|
||||
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
||||
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
||||
[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
|
||||
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
||||
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
|
||||
"version": { \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
} \
|
||||
}'
|
||||
|
||||
define Build/append-metadata
|
||||
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@)
|
||||
sha256sum "$@" | cut -d" " -f1 > "$@.sha256sum"
|
||||
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
|
||||
cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
|
||||
usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
|
||||
ucert -A -c "$@.ucert" -x "$@.sig" ;\
|
||||
fwtool -S "$@.ucert" "$@" ;\
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/append-rootfs
|
||||
dd if=$(IMAGE_ROOTFS) >> $@
|
||||
endef
|
||||
|
||||
define Build/append-squashfs-fakeroot-be
|
||||
rm -rf $@.fakefs $@.fakesquashfs
|
||||
mkdir $@.fakefs
|
||||
$(STAGING_DIR_HOST)/bin/mksquashfs3-lzma \
|
||||
$@.fakefs $@.fakesquashfs \
|
||||
-noappend -root-owned -be -nopad -b 65536 \
|
||||
$(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
|
||||
cat $@.fakesquashfs >> $@
|
||||
endef
|
||||
|
||||
define Build/append-squashfs4-fakeroot
|
||||
rm -rf $@.fakefs $@.fakesquashfs
|
||||
mkdir $@.fakefs
|
||||
$(STAGING_DIR_HOST)/bin/mksquashfs4 \
|
||||
$@.fakefs $@.fakesquashfs \
|
||||
-nopad -noappend -root-owned
|
||||
cat $@.fakesquashfs >> $@
|
||||
endef
|
||||
|
||||
define Build/append-string
|
||||
echo -n $(1) >> $@
|
||||
endef
|
||||
|
||||
define Build/append-md5sum-ascii-salted
|
||||
cp $@ $@.salted
|
||||
echo -ne $(1) >> $@.salted
|
||||
$(STAGING_DIR_HOST)/bin/mkhash md5 $@.salted | head -c32 >> $@
|
||||
rm $@.salted
|
||||
endef
|
||||
|
||||
UBI_NAND_SIZE_LIMIT = $(IMAGE_SIZE) - ($(NAND_SIZE)*20/1024 + 4*$(BLOCKSIZE))
|
||||
|
||||
define Build/append-ubi
|
||||
sh $(TOPDIR)/scripts/ubinize-image.sh \
|
||||
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
|
||||
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
|
||||
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \
|
||||
--rootfs $(IMAGE_ROOTFS) \
|
||||
$@.tmp \
|
||||
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
|
||||
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
|
||||
$(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
|
||||
$(UBINIZE_OPTS)
|
||||
cat $@.tmp >> $@
|
||||
rm $@.tmp
|
||||
$(if $(and $(IMAGE_SIZE),$(NAND_SIZE)),\
|
||||
$(call Build/check-size,$(UBI_NAND_SIZE_LIMIT)))
|
||||
endef
|
||||
|
||||
define Build/ubinize-image
|
||||
sh $(TOPDIR)/scripts/ubinize-image.sh \
|
||||
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
|
||||
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \
|
||||
--part $(word 1,$(1))="$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(word 2,$(1))" \
|
||||
$@.tmp \
|
||||
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
|
||||
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
|
||||
$(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
|
||||
$(UBINIZE_OPTS)
|
||||
cat $@.tmp >> $@
|
||||
rm $@.tmp
|
||||
endef
|
||||
|
||||
define Build/ubinize-kernel
|
||||
cp $@ $@.tmp
|
||||
sh $(TOPDIR)/scripts/ubinize-image.sh \
|
||||
--kernel $@.tmp \
|
||||
$@ \
|
||||
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
|
||||
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
|
||||
$(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
|
||||
$(UBINIZE_OPTS)
|
||||
rm $@.tmp
|
||||
endef
|
||||
|
||||
define Build/append-uboot
|
||||
dd if=$(UBOOT_PATH) >> $@
|
||||
endef
|
||||
|
||||
# append a fake/empty uImage header, to fool bootloaders rootfs integrity check
|
||||
# for example
|
||||
define Build/append-uImage-fakehdr
|
||||
$(eval type=$(word 1,$(1)))
|
||||
$(eval magic=$(word 2,$(1)))
|
||||
touch $@.fakehdr
|
||||
$(STAGING_DIR_HOST)/bin/mkimage \
|
||||
-A $(LINUX_KARCH) -O linux -T $(type) -C none \
|
||||
-n '$(VERSION_DIST) fake $(type)' \
|
||||
$(if $(magic),-M $(magic)) \
|
||||
-d $@.fakehdr \
|
||||
-s \
|
||||
$@.fakehdr
|
||||
cat $@.fakehdr >> $@
|
||||
endef
|
||||
|
||||
define Build/buffalo-dhp-image
|
||||
$(STAGING_DIR_HOST)/bin/mkdhpimg $@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/buffalo-enc
|
||||
$(eval product=$(word 1,$(1)))
|
||||
$(eval version=$(word 2,$(1)))
|
||||
@ -231,99 +64,11 @@ define Build/buffalo-tag-dhp
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/buffalo-trx
|
||||
$(eval magic=$(word 1,$(1)))
|
||||
$(eval kern_bin=$(if $(1),$(IMAGE_KERNEL),$@))
|
||||
$(eval rtfs_bin=$(word 2,$(1)))
|
||||
$(eval apnd_bin=$(word 3,$(1)))
|
||||
$(eval kern_size=$(if $(KERNEL_SIZE),$(KERNEL_SIZE),0x400000))
|
||||
|
||||
$(if $(rtfs_bin),touch $(rtfs_bin))
|
||||
$(STAGING_DIR_HOST)/bin/otrx create $@.new \
|
||||
$(if $(magic),-M $(magic),) \
|
||||
-f $(kern_bin) \
|
||||
$(if $(rtfs_bin),\
|
||||
-a 0x20000 \
|
||||
-b $$(( $(call exp_units,$(kern_size)) )) \
|
||||
-f $(rtfs_bin),) \
|
||||
$(if $(apnd_bin),\
|
||||
-A $(apnd_bin) \
|
||||
-a 0x20000)
|
||||
define Build/buffalo-dhp-image
|
||||
$(STAGING_DIR_HOST)/bin/mkdhpimg $@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/check-size
|
||||
@imagesize="$$(stat -c%s $@)"; \
|
||||
limitsize="$$(($(call exp_units,$(if $(1),$(1),$(IMAGE_SIZE)))))"; \
|
||||
[ $$limitsize -ge $$imagesize ] || { \
|
||||
$(call ERROR_MESSAGE, WARNING: Image file $@ is too big: $$imagesize > $$limitsize); \
|
||||
rm -f $@; \
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/copy-file
|
||||
cat "$(1)" > "$@"
|
||||
endef
|
||||
|
||||
# Create a header for a D-Link AI series recovery image and add it at the beginning of the image
|
||||
# Currently supported: AQUILA M30, EAGLE M32 and R32
|
||||
# Arguments:
|
||||
# 1: Start string of the header
|
||||
# 2: Firmware version
|
||||
# 3: Block start address
|
||||
# 4: Block length
|
||||
# 5: Device FMID
|
||||
define Build/dlink-ai-recovery-header
|
||||
$(eval header_start=$(word 1,$(1)))
|
||||
$(eval firmware_version=$(word 2,$(1)))
|
||||
$(eval block_start=$(word 3,$(1)))
|
||||
$(eval block_length=$(word 4,$(1)))
|
||||
$(eval device_fmid=$(word 5,$(1)))
|
||||
# create $@.header without the checksum
|
||||
echo -en "$(header_start)\x00\x00" > "$@.header"
|
||||
# Calculate checksum over data area ($@) and append it to the header.
|
||||
# The checksum is the 2byte-sum over the whole data area.
|
||||
# Every overflow during the checksum calculation must increment the current checksum value by 1.
|
||||
od -v -w2 -tu2 -An --endian little "$@" | awk '{ s+=$$1; } END { s%=65535; printf "%c%c",s%256,s/256; }' >> "$@.header"
|
||||
echo -en "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00" >> "$@.header"
|
||||
echo -en "$(firmware_version)" >> "$@.header"
|
||||
# Only one block supported: Erase start/length is identical to data start/length
|
||||
echo -en "$(block_start)$(block_length)$(block_start)$(block_length)" >> "$@.header"
|
||||
# Only zeros
|
||||
echo -en "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" >> "$@.header"
|
||||
# Last 16 bytes, but without checksum
|
||||
echo -en "\x42\x48\x02\x00\x00\x00\x08\x00\x00\x00\x00\x00" >> "$@.header"
|
||||
echo -en "$(device_fmid)" >> "$@.header"
|
||||
# Calculate and append checksum: The checksum must be set so that the 2byte-sum of the whole header is 0.
|
||||
# Every overflow during the checksum calculation must increment the current checksum value by 1.
|
||||
od -v -w2 -tu2 -An --endian little "$@.header" | awk '{s+=65535-$$1;}END{s%=65535;printf "%c%c",s%256,s/256;}' >> "$@.header"
|
||||
cat "$@.header" "$@" > "$@.new"
|
||||
mv "$@.new" "$@"
|
||||
rm "$@.header"
|
||||
endef
|
||||
|
||||
define Build/dlink-sge-image
|
||||
$(STAGING_DIR_HOST)/bin/dlink-sge-image $(1) $@ $@.enc
|
||||
mv $@.enc $@
|
||||
endef
|
||||
|
||||
define Build/edimax-header
|
||||
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/elecom-product-header
|
||||
$(eval product=$(word 1,$(1)))
|
||||
$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
|
||||
|
||||
-( \
|
||||
echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
|
||||
echo -n "0.00" | dd bs=16 count=1 conv=sync; \
|
||||
dd if=$(fw); \
|
||||
) > $(fw).new \
|
||||
&& mv $(fw).new $(fw) || rm -f $(fw)
|
||||
endef
|
||||
|
||||
define Build/elecom-wrc-gs-factory
|
||||
$(eval product=$(word 1,$(1)))
|
||||
$(eval version=$(word 2,$(1)))
|
||||
@ -351,10 +96,10 @@ define Build/elx-header
|
||||
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
|
||||
$(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
|
||||
@ -362,145 +107,29 @@ define Build/eva-image
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/initrd_compression
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),.gzip) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),.lz4) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),.lzma) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),.lzo) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
|
||||
define Build/seama
|
||||
$(STAGING_DIR_HOST)/bin/seama -i $@ \
|
||||
-m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
|
||||
mv $@.seama $@
|
||||
endef
|
||||
|
||||
define Build/fit
|
||||
$(call locked,$(TOPDIR)/scripts/mkits.sh \
|
||||
-D $(DEVICE_NAME) -o $@.its -k $@ \
|
||||
-C $(word 1,$(1)) \
|
||||
$(if $(word 2,$(1)),\
|
||||
$(if $(findstring 11,$(if $(DEVICE_DTS_OVERLAY),1)$(if $(findstring $(KERNEL_BUILD_DIR)/image-,$(word 2,$(1))),,1)), \
|
||||
-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$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))).cpio$(strip $(call Build/initrd_compression)))) \
|
||||
-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
|
||||
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
|
||||
$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \
|
||||
$(if $(DEVICE_DTS_LOADADDR),-s $(DEVICE_DTS_LOADADDR)) \
|
||||
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
|
||||
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION), gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
|
||||
$(call locked,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 $@
|
||||
define Build/seama-seal
|
||||
$(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \
|
||||
-m "signature=$(SEAMA_SIGNATURE)"
|
||||
mv $@.seama $@
|
||||
endef
|
||||
|
||||
define Build/libdeflate-gzip
|
||||
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/gzip
|
||||
$(STAGING_DIR_HOST)/bin/gzip -f -9n -c $@ $(1) > $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/gzip-filename
|
||||
@mkdir -p $@.tmp
|
||||
@cp $@ $@.tmp/$(word 1,$(1))
|
||||
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $@.tmp/$(word 1,$(1)) $(word 2,$(1)))
|
||||
$(STAGING_DIR_HOST)/bin/gzip -f -9 -N -c $@.tmp/$(word 1,$(1)) $(word 2,$(1)) > $@.new
|
||||
@mv $@.new $@
|
||||
@rm -rf $@.tmp
|
||||
endef
|
||||
|
||||
define Build/install-dtb
|
||||
$(call locked, \
|
||||
$(foreach dts,$(DEVICE_DTS), \
|
||||
$(CP) \
|
||||
$(DTS_DIR)/$(dts).dtb \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \
|
||||
), \
|
||||
install-dtb-$(IMG_PREFIX) \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/iptime-crc32
|
||||
$(STAGING_DIR_HOST)/bin/iptime-crc32 $(1) $@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/iptime-naspkg
|
||||
$(STAGING_DIR_HOST)/bin/iptime-naspkg $(1) $@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/jffs2
|
||||
rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
|
||||
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(word 1,$(1))) && \
|
||||
cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(word 1,$(1)) && \
|
||||
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad \
|
||||
$(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) \
|
||||
--squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
|
||||
define Build/zyxel-ras-image
|
||||
let \
|
||||
newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
|
||||
$(STAGING_DIR_HOST)/bin/mkrasimage \
|
||||
-b $(RAS_BOARD) \
|
||||
-v $(RAS_VERSION) \
|
||||
-r $@ \
|
||||
-s $$newsize \
|
||||
-o $@.new \
|
||||
-d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
|
||||
$(wordlist 2,$(words $(1)),$(1)) \
|
||||
2>&1 1>/dev/null | awk '/^.+$$$$/' && \
|
||||
$(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J $(patsubst %k,,$(BLOCKSIZE))
|
||||
-rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/yaffs-filesystem
|
||||
let \
|
||||
kernel_size="$$(stat -c%s $@)" \
|
||||
kernel_chunks="(kernel_size / 1024) + 1" \
|
||||
filesystem_chunks="kernel_chunks + 3" \
|
||||
filesystem_blocks="(filesystem_chunks / 63) + 1" \
|
||||
filesystem_size="filesystem_blocks * 64 * 1024" \
|
||||
filesystem_size_with_reserve="(filesystem_blocks + 2) * 64 * 1024"; \
|
||||
head -c $$filesystem_size_with_reserve /dev/zero | tr "\000" "\377" > $@.img \
|
||||
&& yafut -d $@.img -w -i $@ -o kernel -C 1040 -B 64k -E -P -S $(1) \
|
||||
&& truncate -s $$filesystem_size $@.img \
|
||||
&& mv $@.img $@
|
||||
endef
|
||||
|
||||
define Build/kernel-bin
|
||||
rm -f $@
|
||||
cp $< $@
|
||||
endef
|
||||
|
||||
define Build/linksys-image
|
||||
let \
|
||||
size="$$(stat -c%s $@)" \
|
||||
pad="$(call exp_units,$(PAGESIZE))" \
|
||||
offset="256" \
|
||||
pad="(pad - ((size + offset) % pad)) % pad"; \
|
||||
dd if=/dev/zero bs=$$pad count=1 | tr '\000' '\377' >> $@
|
||||
printf ".LINKSYS.01000409%-15s%08X%-8s%-16s" \
|
||||
"$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
|
||||
"$$(cksum $@ | cut -d ' ' -f1)" \
|
||||
"0" "K0000000F0246434" >> $@
|
||||
dd if=/dev/zero bs=192 count=1 >> $@
|
||||
endef
|
||||
|
||||
define Build/lzma
|
||||
$(call Build/lzma-no-dict,-lc1 -lp2 -pb2 $(1))
|
||||
endef
|
||||
|
||||
define Build/lzma-no-dict
|
||||
$(STAGING_DIR_HOST)/bin/lzma e $@ $(1) $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/moxa-encode-fw
|
||||
$(TOPDIR)/scripts/moxa-encode-fw.py \
|
||||
--input $@ \
|
||||
--output $@ \
|
||||
--magic $(MOXA_MAGIC) \
|
||||
--hwid $(MOXA_HWID) \
|
||||
--buildid 00000000
|
||||
$(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \
|
||||
&& mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/netgear-chk
|
||||
@ -514,26 +143,257 @@ endef
|
||||
|
||||
define Build/netgear-dni
|
||||
$(STAGING_DIR_HOST)/bin/mkdniimg \
|
||||
-B $(NETGEAR_BOARD_ID) -v $(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \
|
||||
-B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \
|
||||
$(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
|
||||
-r "$(1)" \
|
||||
-i $@ -o $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/netgear-encrypted-factory
|
||||
$(TOPDIR)/scripts/netgear-encrypted-factory.py \
|
||||
--input-file $@ \
|
||||
--output-file $@ \
|
||||
--model $(NETGEAR_ENC_MODEL) \
|
||||
--region $(NETGEAR_ENC_REGION) \
|
||||
$(if $(NETGEAR_ENC_HW_ID_LIST),--hw-id-list "$(NETGEAR_ENC_HW_ID_LIST)") \
|
||||
$(if $(NETGEAR_ENC_MODEL_LIST),--model-list "$(NETGEAR_ENC_MODEL_LIST)") \
|
||||
--version V1.0.0.0.$(shell cat $(VERSION_DIST)| sed -e 's/[[:space:]]/-/g').$(firstword $(subst -, ,$(REVISION))) \
|
||||
--encryption-block-size 0x20000 \
|
||||
--openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \
|
||||
--key 6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \
|
||||
--iv 4a253169516c38243d6c6d2d3b384145
|
||||
define Build/append-squashfs-fakeroot-be
|
||||
rm -rf $@.fakefs $@.fakesquashfs
|
||||
mkdir $@.fakefs
|
||||
$(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
|
||||
$@.fakefs $@.fakesquashfs \
|
||||
-noappend -root-owned -be -nopad -b 65536 \
|
||||
$(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
|
||||
cat $@.fakesquashfs >> $@
|
||||
endef
|
||||
|
||||
define Build/append-string
|
||||
echo -n $(1) >> $@
|
||||
endef
|
||||
|
||||
# append a fake/empty uImage header, to fool bootloaders rootfs integrity check
|
||||
# for example
|
||||
define Build/append-uImage-fakehdr
|
||||
$(eval type=$(word 1,$(1)))
|
||||
$(eval magic=$(word 2,$(1)))
|
||||
touch $@.fakehdr
|
||||
$(STAGING_DIR_HOST)/bin/mkimage \
|
||||
-A $(LINUX_KARCH) -O linux -T $(type) -C none \
|
||||
-n '$(VERSION_DIST) fake $(type)' \
|
||||
$(if $(magic),-M $(magic)) \
|
||||
-d $@.fakehdr \
|
||||
-s \
|
||||
$@.fakehdr
|
||||
cat $@.fakehdr >> $@
|
||||
endef
|
||||
|
||||
define Build/tplink-safeloader
|
||||
-$(STAGING_DIR_HOST)/bin/tplink-safeloader \
|
||||
-B $(TPLINK_BOARD_ID) \
|
||||
-V $(REVISION) \
|
||||
-k $(IMAGE_KERNEL) \
|
||||
-r $@ \
|
||||
-o $@.new \
|
||||
-j \
|
||||
$(wordlist 2,$(words $(1)),$(1)) \
|
||||
$(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@
|
||||
endef
|
||||
|
||||
define Build/append-dtb
|
||||
cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
|
||||
endef
|
||||
|
||||
define Build/append-dtb-elf
|
||||
$(TARGET_CROSS)objcopy \
|
||||
--set-section-flags=.appended_dtb=alloc,contents \
|
||||
--update-section \
|
||||
.appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@
|
||||
endef
|
||||
|
||||
define Build/install-dtb
|
||||
$(call locked, \
|
||||
$(foreach dts,$(DEVICE_DTS), \
|
||||
$(CP) \
|
||||
$(DTS_DIR)/$(dts).dtb \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \
|
||||
), \
|
||||
install-dtb-$(IMG_PREFIX) \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/initrd_compression
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),.gzip) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),.lzma) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
|
||||
endef
|
||||
|
||||
define Build/fit
|
||||
$(TOPDIR)/scripts/mkits.sh \
|
||||
-D $(DEVICE_NAME) -o $@.its -k $@ \
|
||||
-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)) \
|
||||
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
|
||||
$(if $(DEVICE_DTS_DELIMITER),-l $(DEVICE_DTS_DELIMITER)) \
|
||||
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtb)) \
|
||||
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
|
||||
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/lzma
|
||||
$(call Build/lzma-no-dict,-lc1 -lp2 -pb2 $(1))
|
||||
endef
|
||||
|
||||
define Build/lzma-no-dict
|
||||
$(STAGING_DIR_HOST)/bin/lzma e $@ $(1) $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/gzip
|
||||
gzip -f -9n -c $@ $(1) > $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/zip
|
||||
rm -rf $@.tmp
|
||||
mkdir $@.tmp
|
||||
mv $@ $@.tmp/$(word 1,$(1))
|
||||
|
||||
TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \
|
||||
$(wordlist 2,$(words $(1)),$(1)) \
|
||||
$@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@))
|
||||
rm -rf $@.tmp
|
||||
endef
|
||||
|
||||
define Build/jffs2
|
||||
rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
|
||||
mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
|
||||
cp $@ $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$(1) && \
|
||||
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad \
|
||||
$(if $(CONFIG_BIG_ENDIAN),--big-endian,--little-endian) \
|
||||
--squash-uids -v -e $(patsubst %k,%KiB,$(BLOCKSIZE)) \
|
||||
-o $@.new \
|
||||
-d $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 \
|
||||
2>&1 1>/dev/null | awk '/^.+$$$$/' && \
|
||||
$(STAGING_DIR_HOST)/bin/padjffs2 $@.new -J $(patsubst %k,,$(BLOCKSIZE))
|
||||
-rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/kernel2minor
|
||||
$(eval temp_file := $(shell mktemp))
|
||||
cp $@ $(temp_file)
|
||||
kernel2minor -k $(temp_file) -r $(temp_file).new $(1)
|
||||
mv $(temp_file).new $@
|
||||
rm -f $(temp_file)
|
||||
endef
|
||||
|
||||
define Build/kernel-bin
|
||||
rm -f $@
|
||||
cp $< $@
|
||||
endef
|
||||
|
||||
define Build/patch-cmdline
|
||||
$(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)'
|
||||
endef
|
||||
|
||||
define Build/append-kernel
|
||||
dd if=$(IMAGE_KERNEL) >> $@
|
||||
endef
|
||||
|
||||
define Build/append-rootfs
|
||||
dd if=$(IMAGE_ROOTFS) >> $@
|
||||
endef
|
||||
|
||||
define Build/append-ubi
|
||||
sh $(TOPDIR)/scripts/ubinize-image.sh \
|
||||
$(if $(UBOOTENV_IN_UBI),--uboot-env) \
|
||||
$(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \
|
||||
$(foreach part,$(UBINIZE_PARTS),--part $(part)) \
|
||||
--rootfs $(IMAGE_ROOTFS) \
|
||||
$@.tmp \
|
||||
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
|
||||
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
|
||||
$(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
|
||||
$(UBINIZE_OPTS)
|
||||
cat $@.tmp >> $@
|
||||
rm $@.tmp
|
||||
endef
|
||||
|
||||
define Build/ubinize-kernel
|
||||
cp $@ $@.tmp
|
||||
sh $(TOPDIR)/scripts/ubinize-image.sh \
|
||||
--kernel $@.tmp \
|
||||
$@ \
|
||||
-p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
|
||||
$(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
|
||||
$(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
|
||||
$(UBINIZE_OPTS)
|
||||
rm $@.tmp
|
||||
endef
|
||||
|
||||
define Build/append-uboot
|
||||
dd if=$(UBOOT_PATH) >> $@
|
||||
endef
|
||||
|
||||
define Build/pad-to
|
||||
$(call Image/pad-to,$@,$(1))
|
||||
endef
|
||||
|
||||
define Build/pad-extra
|
||||
dd if=/dev/zero bs=$(1) count=1 >> $@
|
||||
endef
|
||||
|
||||
define Build/pad-rootfs
|
||||
$(STAGING_DIR_HOST)/bin/padjffs2 $@ $(1) \
|
||||
$(if $(BLOCKSIZE),$(BLOCKSIZE:%k=%),4 8 16 64 128 256)
|
||||
endef
|
||||
|
||||
define Build/pad-offset
|
||||
let \
|
||||
size="$$(stat -c%s $@)" \
|
||||
pad="$(subst k,* 1024,$(word 1, $(1)))" \
|
||||
offset="$(subst k,* 1024,$(word 2, $(1)))" \
|
||||
pad="(pad - ((size + offset) % pad)) % pad" \
|
||||
newsize='size + pad'; \
|
||||
dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/xor-image
|
||||
$(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1)
|
||||
mv $@.xor $@
|
||||
endef
|
||||
|
||||
define Build/check-size
|
||||
@imagesize="$$(stat -c%s $@)"; \
|
||||
limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \
|
||||
[ $$limitsize -ge $$imagesize ] || { \
|
||||
echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \
|
||||
rm -f $@; \
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/elecom-product-header
|
||||
$(eval product=$(word 1,$(1)))
|
||||
$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))
|
||||
|
||||
( \
|
||||
echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
|
||||
echo -n "0.00" | dd bs=16 count=1 conv=sync; \
|
||||
dd if=$(fw); \
|
||||
) > $(fw).new
|
||||
mv $(fw).new $(fw)
|
||||
endef
|
||||
|
||||
define Build/linksys-image
|
||||
$(TOPDIR)/scripts/linksys-image.sh \
|
||||
"$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
|
||||
$@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/openmesh-image
|
||||
@ -549,45 +409,6 @@ define Build/openmesh-image
|
||||
"$(call param_get_default,rootfs,$(1),$@)" "rootfs"
|
||||
endef
|
||||
|
||||
define Build/pad-extra
|
||||
dd if=/dev/zero bs=$(1) count=1 >> $@
|
||||
endef
|
||||
|
||||
define Build/pad-offset
|
||||
let \
|
||||
size="$$(stat -c%s $@)" \
|
||||
pad="$(call exp_units,$(word 1, $(1)))" \
|
||||
offset="$(call exp_units,$(word 2, $(1)))" \
|
||||
pad="(pad - ((size + offset) % pad)) % pad" \
|
||||
newsize='size + pad'; \
|
||||
dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/pad-rootfs
|
||||
$(STAGING_DIR_HOST)/bin/padjffs2 $@ $(1) \
|
||||
$(if $(BLOCKSIZE),$(BLOCKSIZE:%k=%),4 8 16 64 128 256)
|
||||
endef
|
||||
|
||||
define Build/pad-to
|
||||
$(call Image/pad-to,$@,$(1))
|
||||
endef
|
||||
|
||||
define Build/patch-cmdline
|
||||
$(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)'
|
||||
endef
|
||||
|
||||
# Convert a raw image into a $1 type image.
|
||||
# E.g. | qemu-image vdi <optional extra arguments to qemu-img binary>
|
||||
define Build/qemu-image
|
||||
if command -v qemu-img; then \
|
||||
qemu-img convert -f raw -O $1 $@ $@.new; \
|
||||
mv $@.new $@; \
|
||||
else \
|
||||
echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; \
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/qsdk-ipq-factory-mmc
|
||||
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
|
||||
$@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
|
||||
@ -609,21 +430,9 @@ define Build/qsdk-ipq-factory-nor
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/seama
|
||||
$(STAGING_DIR_HOST)/bin/seama -i $@ \
|
||||
-m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
|
||||
mv $@.seama $@
|
||||
endef
|
||||
|
||||
define Build/seama-seal
|
||||
$(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \
|
||||
-m "signature=$(SEAMA_SIGNATURE)"
|
||||
mv $@.seama $@
|
||||
endef
|
||||
|
||||
define Build/senao-header
|
||||
-$(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new \
|
||||
&& mv $@.new $@ || rm -f $@
|
||||
$(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/sysupgrade-tar
|
||||
@ -634,26 +443,6 @@ define Build/sysupgrade-tar
|
||||
$@
|
||||
endef
|
||||
|
||||
define Build/tplink-image-2022
|
||||
$(TOPDIR)/scripts/tplink-mkimage-2022.py \
|
||||
--create $@.new \
|
||||
--rootfs $@ \
|
||||
--support "$(TPLINK_SUPPORT_STRING)"
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/tplink-safeloader
|
||||
-$(STAGING_DIR_HOST)/bin/tplink-safeloader \
|
||||
-B $(TPLINK_BOARD_ID) \
|
||||
-V $(REVISION) \
|
||||
-k $(IMAGE_KERNEL) \
|
||||
-r $@ \
|
||||
-o $@.new \
|
||||
-j \
|
||||
$(wordlist 2,$(words $(1)),$(1)) \
|
||||
$(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@
|
||||
endef
|
||||
|
||||
define Build/tplink-v1-header
|
||||
$(STAGING_DIR_HOST)/bin/mktplinkfw \
|
||||
-c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
|
||||
@ -682,26 +471,42 @@ define Build/tplink-v1-image
|
||||
endef
|
||||
|
||||
define Build/tplink-v2-header
|
||||
-$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
|
||||
$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
|
||||
-c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
|
||||
-E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
|
||||
-w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
|
||||
-T $(TPLINK_HVERSION) -V "ver. 2.0" \
|
||||
-k $@ -o $@.new $(1) \
|
||||
&& mv $@.new $@ || rm -f $@
|
||||
-k $@ -o $@.new $(1)
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/tplink-v2-image
|
||||
-$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
|
||||
$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
|
||||
-H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
|
||||
-w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
|
||||
-T $(TPLINK_HVERSION) -V "ver. 2.0" -a 0x4 -j \
|
||||
-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new $(1) \
|
||||
&& cat $@.new >> $@ && rm -rf $@.new || rm -f $@
|
||||
-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new $(1)
|
||||
cat $@.new >> $@
|
||||
rm -rf $@.new
|
||||
endef
|
||||
|
||||
json_quote=$(subst ','\'',$(subst ",\",$(1)))
|
||||
#")')
|
||||
metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))"))))
|
||||
metadata_json = \
|
||||
'{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
||||
"metadata_version": "1.0", \
|
||||
"supported_devices":[$(call metadata_devices,$(1))], \
|
||||
"version": { \
|
||||
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
||||
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
||||
"revision": "$(call json_quote,$(REVISION))", \
|
||||
"target": "$(call json_quote,$(TARGETID))", \
|
||||
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
||||
} \
|
||||
}'
|
||||
|
||||
define Build/uImage
|
||||
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
|
||||
mkimage \
|
||||
-A $(LINUX_KARCH) \
|
||||
-O linux \
|
||||
@ -716,51 +521,19 @@ define Build/uImage
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/multiImage
|
||||
$(if $(UIMAGE_TIME),SOURCE_DATE_EPOCH="$(UIMAGE_TIME)") \
|
||||
mkimage \
|
||||
-A $(LINUX_KARCH) \
|
||||
-O linux \
|
||||
-T multi \
|
||||
-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)) \
|
||||
-d $@:$(word 2,$(1)):$(word 3,$(1)) \
|
||||
$(wordlist 4,$(words $(1)),$(1)) \
|
||||
$@.new
|
||||
mv $@.new $@
|
||||
define Build/append-metadata
|
||||
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
|
||||
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
|
||||
cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
|
||||
usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
|
||||
ucert -A -c "$@.ucert" -x "$@.sig" ;\
|
||||
fwtool -S "$@.ucert" "$@" ;\
|
||||
}
|
||||
endef
|
||||
|
||||
define Build/xor-image
|
||||
-$(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1) \
|
||||
&& mv $@.xor $@ || rm -f $@
|
||||
endef
|
||||
|
||||
define Build/zip
|
||||
rm -rf $@.tmp
|
||||
mkdir $@.tmp
|
||||
mv $@ $@.tmp/$(word 1,$(1))
|
||||
TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \
|
||||
$(wordlist 2,$(words $(1)),$(1)) \
|
||||
$@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@))
|
||||
rm -rf $@.tmp
|
||||
endef
|
||||
|
||||
define Build/zyimage
|
||||
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
|
||||
endef
|
||||
|
||||
define Build/zyxel-ras-image
|
||||
let \
|
||||
newsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \
|
||||
$(STAGING_DIR_HOST)/bin/mkrasimage \
|
||||
-b $(RAS_BOARD) \
|
||||
-v $(RAS_VERSION) \
|
||||
-r $@ \
|
||||
-s $$newsize \
|
||||
-o $@.new \
|
||||
$(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \
|
||||
&& mv $@.new $@
|
||||
# Convert a raw image into a $1 type image.
|
||||
# E.g. | qemu-image vdi <optional extra arguments to qemu-img binary>
|
||||
define Build/qemu-image
|
||||
qemu-img convert -f raw -O $1 $@ $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
279
include/image.mk
279
include/image.mk
@ -5,7 +5,6 @@
|
||||
override TARGET_BUILD=
|
||||
include $(INCLUDE_DIR)/prereq.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/kernel-defaults.mk
|
||||
include $(INCLUDE_DIR)/version.mk
|
||||
include $(INCLUDE_DIR)/image-commands.mk
|
||||
|
||||
@ -21,13 +20,6 @@ include $(INCLUDE_DIR)/rootfs.mk
|
||||
override MAKE:=$(_SINGLE)$(SUBMAKE)
|
||||
override NO_TRACE_MAKE:=$(_SINGLE)$(NO_TRACE_MAKE)
|
||||
|
||||
##@
|
||||
# @brief Convert size with unit postfix to unitless expression in bytes.
|
||||
#
|
||||
# @param 1: Size with unit. Possible unit postfix are `g`, `m`, `k`.
|
||||
##
|
||||
exp_units = $(subst k, * 1024,$(subst m, * 1024k,$(subst g, * 1024m,$(1))))
|
||||
|
||||
target_params = $(subst +,$(space),$*)
|
||||
param_get = $(patsubst $(1)=%,%,$(filter $(1)=%,$(2)))
|
||||
param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3))
|
||||
@ -45,13 +37,11 @@ IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-
|
||||
IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-)
|
||||
IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERSION_CODE))-)
|
||||
|
||||
IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)-$(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_COMBINED:=$(IMG_PREFIX)-combined
|
||||
ifeq ($(DUMP),)
|
||||
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/')
|
||||
endif
|
||||
|
||||
MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
|
||||
|
||||
@ -116,12 +106,6 @@ endef
|
||||
|
||||
PROFILE_SANITIZED := $(call tolower,$(subst DEVICE_,,$(subst $(space),-,$(PROFILE))))
|
||||
|
||||
##@
|
||||
# @brief Call function for each group of arguments.
|
||||
#
|
||||
# @param 1: List of lists of arguments. Lists are separated by `|`.
|
||||
# @param 2: Function to call for list of arguments.
|
||||
##
|
||||
define split_args
|
||||
$(foreach data, \
|
||||
$(subst |,$(space),\
|
||||
@ -129,24 +113,12 @@ $(foreach data, \
|
||||
$(call $(2),$(strip $(subst ^,$(space),$(data)))))
|
||||
endef
|
||||
|
||||
##@
|
||||
# @brief Call build function with arguments.
|
||||
#
|
||||
# @param 1: Function to call. Function name is prepended with `Build/`.
|
||||
# @param 2...: Function arguments.
|
||||
##
|
||||
define build_cmd
|
||||
$(if $(Build/$(word 1,$(1))),,$(error Missing Build/$(word 1,$(1))))
|
||||
$(call Build/$(word 1,$(1)),$(wordlist 2,$(words $(1)),$(1)))
|
||||
|
||||
endef
|
||||
|
||||
##@
|
||||
# @brief Call build functions from the list.
|
||||
#
|
||||
# @param 1: List of build functions with arguments, separated by `|`.
|
||||
# First word in each group is a build command without `Build/` prefix.
|
||||
##
|
||||
define concat_cmd
|
||||
$(call split_args,$(1),build_cmd)
|
||||
endef
|
||||
@ -174,32 +146,25 @@ endif
|
||||
|
||||
|
||||
# Disable noisy checks by default as in upstream
|
||||
DTC_WARN_FLAGS := \
|
||||
-Wno-interrupt_provider \
|
||||
-Wno-unique_unit_address \
|
||||
DTC_FLAGS += \
|
||||
-Wno-unit_address_vs_reg \
|
||||
-Wno-simple_bus_reg \
|
||||
-Wno-unit_address_format \
|
||||
-Wno-pci_bridge \
|
||||
-Wno-pci_device_bus_num \
|
||||
-Wno-pci_device_reg \
|
||||
-Wno-avoid_unnecessary_addr_size \
|
||||
-Wno-alias_paths \
|
||||
-Wno-graph_child_address \
|
||||
-Wno-simple_bus_reg
|
||||
-Wno-graph_port \
|
||||
-Wno-unique_unit_address
|
||||
|
||||
DTC_FLAGS += $(DTC_WARN_FLAGS)
|
||||
DTCO_FLAGS += $(DTC_WARN_FLAGS)
|
||||
|
||||
##@
|
||||
# @brief Pad file to specified size.
|
||||
#
|
||||
# @param 1: File.
|
||||
# @param 2: Padding.
|
||||
##
|
||||
define Image/pad-to
|
||||
dd if=$(1) of=$(1).new bs=$(2) conv=sync
|
||||
mv $(1).new $(1)
|
||||
endef
|
||||
|
||||
ifeq ($(DUMP),)
|
||||
ROOTFS_PARTSIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024)))
|
||||
endif
|
||||
|
||||
define Image/pad-root-squashfs
|
||||
$(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(ROOTFS_PARTSIZE)))
|
||||
@ -209,30 +174,20 @@ endef
|
||||
# $(2) target dtb file
|
||||
# $(3) extra CPP flags
|
||||
# $(4) extra DTC flags
|
||||
define Image/BuildDTB/sub
|
||||
define Image/BuildDTB
|
||||
$(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \
|
||||
$(DTS_CPPFLAGS) \
|
||||
-I$(DTS_DIR) \
|
||||
-I$(DTS_DIR)/include \
|
||||
-I$(LINUX_DIR)/include/ \
|
||||
-I$(LINUX_DIR)/scripts/dtc/include-prefixes \
|
||||
-undef -D__DTS__ $(3) \
|
||||
-o $(2).tmp $(1)
|
||||
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \
|
||||
-i$(dir $(1)) $(4) \
|
||||
-i$(dir $(1)) $(DTC_FLAGS) $(4) \
|
||||
$(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \
|
||||
-o $(2) $(2).tmp
|
||||
$(RM) $(2).tmp
|
||||
endef
|
||||
|
||||
define Image/BuildDTB
|
||||
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTC_FLAGS) $(DEVICE_DTC_FLAGS) $(4))
|
||||
endef
|
||||
|
||||
define Image/BuildDTBO
|
||||
$(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTCO_FLAGS) $(DEVICE_DTCO_FLAGS) $(4))
|
||||
endef
|
||||
|
||||
define Image/mkfs/jffs2/sub-raw
|
||||
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
|
||||
$(2) \
|
||||
@ -266,7 +221,8 @@ $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call Image/mkfs/jffs2-nand/template,$(S))
|
||||
define Image/mkfs/squashfs-common
|
||||
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
|
||||
-nopad -noappend -root-owned \
|
||||
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT)
|
||||
-comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
|
||||
-processors $(shell nproc)
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
|
||||
@ -308,19 +264,8 @@ define Image/mkfs/ext4
|
||||
endef
|
||||
|
||||
define Image/Manifest
|
||||
$(if $(CONFIG_USE_APK), \
|
||||
$(call apk,$(TARGET_DIR_ORIG)) list --quiet --manifest --no-network \
|
||||
--repositories-file /dev/null | sort | sed 's/ / - /' > \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest, \
|
||||
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest \
|
||||
)
|
||||
ifneq ($(CONFIG_JSON_CYCLONEDX_SBOM),)
|
||||
$(SCRIPT_DIR)/package-metadata.pl imgcyclonedxsbom \
|
||||
$(if $(IB),$(TOPDIR)/.packageinfo, $(TMP_DIR)/.packageinfo) \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest > \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).bom.cdx.json
|
||||
endif
|
||||
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
|
||||
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest
|
||||
endef
|
||||
|
||||
define Image/gzip-ext4-padded-squashfs
|
||||
@ -350,12 +295,12 @@ endif
|
||||
|
||||
ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
|
||||
define Image/Build/cpiogz
|
||||
( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
|
||||
( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
|
||||
endef
|
||||
endif
|
||||
|
||||
mkfs_packages = $(filter-out @%,$(PACKAGES_$(call param_get,pkg,pkg=$(target_params))))
|
||||
mkfs_packages_add = $(foreach pkg,$(filter-out -% ~%,$(mkfs_packages)),$(pkg)$(call GetABISuffix,$(pkg)))
|
||||
mkfs_packages_add = $(foreach pkg,$(filter-out -%,$(mkfs_packages)),$(pkg)$(call GetABISuffix,$(pkg)))
|
||||
mkfs_packages_remove = $(foreach pkg,$(patsubst -%,%,$(filter -%,$(mkfs_packages))),$(pkg)$(call GetABISuffix,$(pkg)))
|
||||
mkfs_cur_target_dir = $(call mkfs_target_dir,pkg=$(target_params))
|
||||
|
||||
@ -363,20 +308,7 @@ opkg_target = \
|
||||
$(call opkg,$(mkfs_cur_target_dir)) \
|
||||
-f $(mkfs_cur_target_dir).conf
|
||||
|
||||
apk_target = \
|
||||
$(call apk,$(mkfs_cur_target_dir)) --no-scripts \
|
||||
--repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb
|
||||
|
||||
|
||||
target-dir-%: FORCE
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
rm -rf $(mkfs_cur_target_dir)
|
||||
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
|
||||
$(if $(mkfs_packages_remove), \
|
||||
-$(apk_target) del $(mkfs_packages_remove))
|
||||
$(if $(mkfs_packages_add), \
|
||||
$(apk_target) add $(mkfs_packages_add))
|
||||
else
|
||||
rm -rf $(mkfs_cur_target_dir) $(mkfs_cur_target_dir).opkg
|
||||
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
|
||||
-mv $(mkfs_cur_target_dir)/etc/opkg $(mkfs_cur_target_dir).opkg
|
||||
@ -390,7 +322,6 @@ else
|
||||
$(call opkg_package_files,$(mkfs_packages_add)))
|
||||
-$(CP) -T $(mkfs_cur_target_dir).opkg/ $(mkfs_cur_target_dir)/etc/opkg/
|
||||
rm -rf $(mkfs_cur_target_dir).opkg $(mkfs_cur_target_dir).conf
|
||||
endif
|
||||
$(call prepare_rootfs,$(mkfs_cur_target_dir),$(TOPDIR)/files)
|
||||
|
||||
$(KDIR)/root.%: kernel_prepare
|
||||
@ -402,9 +333,6 @@ define Device/InitProfile
|
||||
DEVICE_ALT0_TITLE = $$(DEVICE_ALT0_VENDOR) $$(DEVICE_ALT0_MODEL)$$(if $$(DEVICE_ALT0_VARIANT), $$(DEVICE_ALT0_VARIANT))
|
||||
DEVICE_ALT1_TITLE = $$(DEVICE_ALT1_VENDOR) $$(DEVICE_ALT1_MODEL)$$(if $$(DEVICE_ALT1_VARIANT), $$(DEVICE_ALT1_VARIANT))
|
||||
DEVICE_ALT2_TITLE = $$(DEVICE_ALT2_VENDOR) $$(DEVICE_ALT2_MODEL)$$(if $$(DEVICE_ALT2_VARIANT), $$(DEVICE_ALT2_VARIANT))
|
||||
DEVICE_ALT3_TITLE = $$(DEVICE_ALT3_VENDOR) $$(DEVICE_ALT3_MODEL)$$(if $$(DEVICE_ALT3_VARIANT), $$(DEVICE_ALT3_VARIANT))
|
||||
DEVICE_ALT4_TITLE = $$(DEVICE_ALT4_VENDOR) $$(DEVICE_ALT4_MODEL)$$(if $$(DEVICE_ALT4_VARIANT), $$(DEVICE_ALT4_VARIANT))
|
||||
DEVICE_ALT5_TITLE = $$(DEVICE_ALT5_VENDOR) $$(DEVICE_ALT5_MODEL)$$(if $$(DEVICE_ALT5_VARIANT), $$(DEVICE_ALT5_VARIANT))
|
||||
DEVICE_VENDOR :=
|
||||
DEVICE_MODEL :=
|
||||
DEVICE_VARIANT :=
|
||||
@ -417,66 +345,28 @@ define Device/InitProfile
|
||||
DEVICE_ALT2_VENDOR :=
|
||||
DEVICE_ALT2_MODEL :=
|
||||
DEVICE_ALT2_VARIANT :=
|
||||
DEVICE_ALT3_VENDOR :=
|
||||
DEVICE_ALT3_MODEL :=
|
||||
DEVICE_ALT3_VARIANT :=
|
||||
DEVICE_ALT4_VENDOR :=
|
||||
DEVICE_ALT4_MODEL :=
|
||||
DEVICE_ALT4_VARIANT :=
|
||||
DEVICE_ALT5_VENDOR :=
|
||||
DEVICE_ALT5_MODEL :=
|
||||
DEVICE_ALT5_VARIANT :=
|
||||
DEVICE_PACKAGES :=
|
||||
DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE)
|
||||
endef
|
||||
|
||||
##@
|
||||
# @brief Image configuration variables.
|
||||
#
|
||||
# @param 1: Device name.
|
||||
##
|
||||
define Device/Init
|
||||
##@ Device name.
|
||||
DEVICE_NAME := $(1)
|
||||
##@ Commands to build kernel.
|
||||
# Commands with arguments are separated by `|`.
|
||||
##
|
||||
KERNEL:=
|
||||
##@ Commands to build initramfs.
|
||||
# Commands with arguments are separated by `|`.
|
||||
##
|
||||
KERNEL_INITRAMFS = $$(KERNEL)
|
||||
##@ Kernel command line.
|
||||
CMDLINE:=
|
||||
|
||||
##@ Images to build.
|
||||
IMAGES :=
|
||||
##@ Artifacts to build.
|
||||
ARTIFACTS :=
|
||||
##@ Device image prefix.
|
||||
DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
|
||||
##@ Device image name.
|
||||
DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
|
||||
##@ Factory image name.
|
||||
FACTORY_IMG_NAME :=
|
||||
##@ Maximum image size. Optional.
|
||||
IMAGE_SIZE :=
|
||||
##@ Maximum image size. Optional.
|
||||
NAND_SIZE :=
|
||||
##@ Kernel image prefix.
|
||||
KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
|
||||
##@ Kernel image suffix.
|
||||
KERNEL_SUFFIX := -kernel.bin
|
||||
##@ Initramfs image suffix.
|
||||
KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
|
||||
##@ Kernel image name.
|
||||
KERNEL_IMAGE = $$(KERNEL_PREFIX)$$(KERNEL_SUFFIX)
|
||||
##@ Initramfs image prefix.
|
||||
KERNEL_INITRAMFS_PREFIX = $$(DEVICE_IMG_PREFIX)-initramfs
|
||||
KERNEL_INITRAMFS_IMAGE = $$(KERNEL_INITRAMFS_PREFIX)$$(KERNEL_INITRAMFS_SUFFIX)
|
||||
##@ Initramfs image name.
|
||||
KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs
|
||||
##@ Kernel install flag.
|
||||
KERNEL_INSTALL :=
|
||||
KERNEL_NAME := vmlinux
|
||||
KERNEL_DEPENDS :=
|
||||
@ -498,19 +388,13 @@ define Device/Init
|
||||
DEVICE_DTS_CONFIG :=
|
||||
DEVICE_DTS_DELIMITER :=
|
||||
DEVICE_DTS_DIR :=
|
||||
DEVICE_DTS_LOADADDR :=
|
||||
DEVICE_DTS_OVERLAY :=
|
||||
DEVICE_FDT_NUM :=
|
||||
DEVICE_DTC_FLAGS :=
|
||||
DEVICE_DTCO_FLAGS :=
|
||||
SOC :=
|
||||
|
||||
BOARD_NAME :=
|
||||
UIMAGE_MAGIC :=
|
||||
UIMAGE_NAME :=
|
||||
UIMAGE_TIME :=
|
||||
DEVICE_COMPAT_VERSION := 1.0
|
||||
DEVICE_COMPAT_MESSAGE :=
|
||||
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
||||
IMAGE_METADATA :=
|
||||
|
||||
@ -518,28 +402,20 @@ define Device/Init
|
||||
|
||||
UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-$(1)
|
||||
|
||||
BROKEN :=
|
||||
DEFAULT :=
|
||||
endef
|
||||
|
||||
DEFAULT_DEVICE_VARS := \
|
||||
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
|
||||
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
|
||||
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \
|
||||
DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \
|
||||
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \
|
||||
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
|
||||
DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \
|
||||
DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \
|
||||
UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \
|
||||
UBOOT_PATH IMAGE_SIZE NAND_SIZE \
|
||||
FACTORY_IMG_NAME FACTORY_SIZE \
|
||||
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
|
||||
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_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \
|
||||
DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT \
|
||||
DEVICE_ALT3_VENDOR DEVICE_ALT3_MODEL DEVICE_ALT3_VARIANT \
|
||||
DEVICE_ALT4_VENDOR DEVICE_ALT4_MODEL DEVICE_ALT4_VARIANT \
|
||||
DEVICE_ALT5_VENDOR DEVICE_ALT5_MODEL DEVICE_ALT5_VARIANT
|
||||
DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT
|
||||
|
||||
define Device/ExportVar
|
||||
$(1) : $(2):=$$($(2))
|
||||
@ -553,10 +429,10 @@ endef
|
||||
ifdef IB
|
||||
DEVICE_CHECK_PROFILE = $(filter $(1),DEVICE_$(PROFILE) $(PROFILE))
|
||||
else
|
||||
DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)_$(SUBTARGET))_$(1))
|
||||
DEVICE_CHECK_PROFILE = $(CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_$(1))
|
||||
endif
|
||||
|
||||
DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)_$(SUBTARGET))_DEVICE_$(1)))
|
||||
DEVICE_EXTRA_PACKAGES = $(call qstrip,$(CONFIG_TARGET_DEVICE_PACKAGES_$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_DEVICE_$(1)))
|
||||
|
||||
define merge_packages
|
||||
$(1) :=
|
||||
@ -591,20 +467,10 @@ define Device/Build/initramfs
|
||||
$$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,))
|
||||
|
||||
$(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
|
||||
ifdef TARGET_PER_DEVICE_ROOTFS
|
||||
$(KDIR)/$$(KERNEL_INITRAMFS_NAME).$$(ROOTFS_ID/$(1)):: image_prepare target-dir-$$(ROOTFS_ID/$(1))
|
||||
$(call Kernel/CompileImage/Initramfs,$(KDIR)/target-dir-$$(ROOTFS_ID/$(1)),.$$(ROOTFS_ID/$(1)))
|
||||
endif
|
||||
$(1)-initramfs-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
|
||||
|
||||
.IGNORE: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
|
||||
|
||||
$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
|
||||
cp $$^ $$@
|
||||
|
||||
$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME)$$(strip \
|
||||
$(if $(TARGET_PER_DEVICE_ROOTFS),.$$(ROOTFS_ID/$(1))) \
|
||||
) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
|
||||
$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
|
||||
@rm -f $$@
|
||||
$$(call concat_cmd,$$(KERNEL_INITRAMFS))
|
||||
|
||||
@ -613,9 +479,9 @@ define Device/Build/initramfs
|
||||
$(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) \
|
||||
FILE_NAME="$$(notdir $$^)" \
|
||||
FILE_DIR="$(KDIR)/tmp" \
|
||||
FILE_TYPE="kernel" \
|
||||
FILE_FILESYSTEM="initramfs" \
|
||||
DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \
|
||||
@ -631,19 +497,10 @@ define Device/Build/initramfs
|
||||
DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \
|
||||
DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \
|
||||
DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \
|
||||
DEVICE_ALT3_VENDOR="$$(DEVICE_ALT3_VENDOR)" \
|
||||
DEVICE_ALT3_MODEL="$$(DEVICE_ALT3_MODEL)" \
|
||||
DEVICE_ALT3_VARIANT="$$(DEVICE_ALT3_VARIANT)" \
|
||||
DEVICE_ALT4_VENDOR="$$(DEVICE_ALT4_VENDOR)" \
|
||||
DEVICE_ALT4_MODEL="$$(DEVICE_ALT4_MODEL)" \
|
||||
DEVICE_ALT4_VARIANT="$$(DEVICE_ALT4_VARIANT)" \
|
||||
DEVICE_ALT5_VENDOR="$$(DEVICE_ALT5_VENDOR)" \
|
||||
DEVICE_ALT5_MODEL="$$(DEVICE_ALT5_MODEL)" \
|
||||
DEVICE_ALT5_VARIANT="$$(DEVICE_ALT5_VARIANT)" \
|
||||
DEVICE_TITLE="$$(DEVICE_TITLE)" \
|
||||
DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \
|
||||
TARGET="$(BOARD)" \
|
||||
SUBTARGET="$(SUBTARGET)" \
|
||||
SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
|
||||
VERSION_NUMBER="$(VERSION_NUMBER)" \
|
||||
VERSION_CODE="$(VERSION_CODE)" \
|
||||
SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
|
||||
@ -654,8 +511,7 @@ endif
|
||||
define Device/Build/compile
|
||||
$$(_COMPILE_TARGET): $(KDIR)/$(1)
|
||||
$(eval $(call Device/Export,$(KDIR)/$(1)))
|
||||
$(KDIR)/$(1): FORCE
|
||||
rm -f $(KDIR)/$(1)
|
||||
$(KDIR)/$(1):
|
||||
$$(call concat_cmd,$(COMPILE/$(1)))
|
||||
|
||||
endef
|
||||
@ -667,36 +523,19 @@ define Device/Build/dtb
|
||||
$(KDIR)/image-$(1).dtb: FORCE
|
||||
$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
|
||||
|
||||
compile-dtb: $(KDIR)/image-$(1).dtb
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
define Device/Build/dtbo
|
||||
ifndef BUILD_DTSO_$(1)
|
||||
BUILD_DTSO_$(1) := 1
|
||||
$(KDIR)/image-$(1).dtbo: FORCE
|
||||
$(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@)
|
||||
|
||||
compile-dtb: $(KDIR)/image-$(1).dtbo
|
||||
image_prepare: $(KDIR)/image-$(1).dtb
|
||||
endif
|
||||
|
||||
endef
|
||||
endif
|
||||
|
||||
define Device/Build/kernel
|
||||
$$(eval $$(foreach dts,$$(DEVICE_DTS), \
|
||||
$$(eval $$(foreach dts,$$(DEVICE_DTS) $$(DEVICE_DTS_OVERLAY), \
|
||||
$$(call Device/Build/dtb,$$(notdir $$(dts)), \
|
||||
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
|
||||
$$(dts) \
|
||||
) \
|
||||
))
|
||||
$$(eval $$(foreach dtso,$$(DEVICE_DTS_OVERLAY), \
|
||||
$$(call Device/Build/dtbo,$$(notdir $$(dtso)), \
|
||||
$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)), \
|
||||
$$(dtso) \
|
||||
) \
|
||||
))
|
||||
|
||||
$(KDIR)/$$(KERNEL_NAME):: image_prepare
|
||||
$$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
|
||||
@ -720,7 +559,6 @@ define Device/Build/image
|
||||
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
|
||||
$(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
|
||||
$(eval $(call Device/Export,$(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)),$(1)))
|
||||
$(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
|
||||
|
||||
ROOTFS/$(1)/$(3) := \
|
||||
$(KDIR)/root.$(1)$$(strip \
|
||||
@ -731,7 +569,7 @@ define Device/Build/image
|
||||
ifndef IB
|
||||
$$(ROOTFS/$(1)/$(3)): $(if $(TARGET_PER_DEVICE_ROOTFS),target-dir-$$(ROOTFS_ID/$(3)))
|
||||
endif
|
||||
$(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)): $$(KDIR_KERNEL_IMAGE) $$(ROOTFS/$(1)/$(3)) $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(if $(IB),,$(3)-initramfs-images))
|
||||
$(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)): $$(KDIR_KERNEL_IMAGE) $$(ROOTFS/$(1)/$(3))
|
||||
@rm -f $$@
|
||||
[ -f $$(word 1,$$^) -a -f $$(word 2,$$^) ]
|
||||
$$(call concat_cmd,$(if $(IMAGE/$(2)/$(1)),$(IMAGE/$(2)/$(1)),$(IMAGE/$(2))))
|
||||
@ -747,9 +585,9 @@ define Device/Build/image
|
||||
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
|
||||
@mkdir -p $$(shell dirname $$@)
|
||||
DEVICE_ID="$(DEVICE_NAME)" \
|
||||
BIN_DIR="$(BIN_DIR)" \
|
||||
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
|
||||
FILE_NAME="$(DEVICE_IMG_NAME)" \
|
||||
FILE_DIR="$(KDIR)/tmp" \
|
||||
FILE_TYPE=$(word 1,$(subst ., ,$(2))) \
|
||||
FILE_FILESYSTEM="$(1)" \
|
||||
DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \
|
||||
@ -765,19 +603,10 @@ define Device/Build/image
|
||||
DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \
|
||||
DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \
|
||||
DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \
|
||||
DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \
|
||||
DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \
|
||||
DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \
|
||||
DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \
|
||||
DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \
|
||||
DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \
|
||||
DEVICE_ALT5_VENDOR="$(DEVICE_ALT5_VENDOR)" \
|
||||
DEVICE_ALT5_MODEL="$(DEVICE_ALT5_MODEL)" \
|
||||
DEVICE_ALT5_VARIANT="$(DEVICE_ALT5_VARIANT)" \
|
||||
DEVICE_TITLE="$(DEVICE_TITLE)" \
|
||||
DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
|
||||
TARGET="$(BOARD)" \
|
||||
SUBTARGET="$(SUBTARGET)" \
|
||||
SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
|
||||
VERSION_NUMBER="$(VERSION_NUMBER)" \
|
||||
VERSION_CODE="$(VERSION_CODE)" \
|
||||
SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
|
||||
@ -790,7 +619,7 @@ define Device/Build/artifact
|
||||
$(BUILD_DIR)/json_info_files/$(DEVICE_IMG_PREFIX)-$(1).json, \
|
||||
$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1))
|
||||
$(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)))
|
||||
$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE) $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(if $(IB),,$(2)-initramfs-images)) $(2)-images
|
||||
$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
|
||||
@rm -f $$@
|
||||
$$(call concat_cmd,$(ARTIFACT/$(1)))
|
||||
|
||||
@ -802,9 +631,9 @@ define Device/Build/artifact
|
||||
$(BUILD_DIR)/json_info_files/$(DEVICE_IMG_PREFIX)-$(1).json: $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
|
||||
@mkdir -p $$(shell dirname $$@)
|
||||
DEVICE_ID="$(DEVICE_NAME)" \
|
||||
BIN_DIR="$(BIN_DIR)" \
|
||||
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
|
||||
FILE_NAME="$(DEVICE_IMG_PREFIX)-$(1)" \
|
||||
FILE_DIR="$(KDIR)/tmp" \
|
||||
FILE_TYPE="$(1)" \
|
||||
DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \
|
||||
DEVICE_VENDOR="$(DEVICE_VENDOR)" \
|
||||
@ -819,19 +648,10 @@ define Device/Build/artifact
|
||||
DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \
|
||||
DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \
|
||||
DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \
|
||||
DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \
|
||||
DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \
|
||||
DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \
|
||||
DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \
|
||||
DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \
|
||||
DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \
|
||||
DEVICE_ALT5_VENDOR="$(DEVICE_ALT5_VENDOR)" \
|
||||
DEVICE_ALT5_MODEL="$(DEVICE_ALT5_MODEL)" \
|
||||
DEVICE_ALT5_VARIANT="$(DEVICE_ALT5_VARIANT)" \
|
||||
DEVICE_TITLE="$(DEVICE_TITLE)" \
|
||||
DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
|
||||
TARGET="$(BOARD)" \
|
||||
SUBTARGET="$(SUBTARGET)" \
|
||||
SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
|
||||
VERSION_NUMBER="$(VERSION_NUMBER)" \
|
||||
VERSION_CODE="$(VERSION_CODE)" \
|
||||
SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \
|
||||
@ -840,7 +660,7 @@ define Device/Build/artifact
|
||||
endef
|
||||
|
||||
define Device/Build
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$$(eval $$(call Device/Build/initramfs,$(1))))
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
|
||||
$(call Device/Build/kernel,$(1))
|
||||
|
||||
$$(eval $$(foreach compile,$$(COMPILE), \
|
||||
@ -851,7 +671,7 @@ define Device/Build
|
||||
$$(call Device/Build/image,$$(fs),$$(image),$(1)))))
|
||||
|
||||
$$(eval $$(foreach artifact,$$(ARTIFACTS), \
|
||||
$$(call Device/Build/artifact,$$(artifact),$(1))))
|
||||
$$(call Device/Build/artifact,$$(artifact))))
|
||||
|
||||
endef
|
||||
|
||||
@ -861,7 +681,6 @@ Target-Profile-Name: $(DEVICE_DISPLAY)
|
||||
Target-Profile-Packages: $(DEVICE_PACKAGES)
|
||||
Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0)
|
||||
Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES)
|
||||
$(if $(BROKEN),Target-Profile-Broken: $(BROKEN))
|
||||
$(if $(DEFAULT),Target-Profile-Default: $(DEFAULT))
|
||||
Target-Profile-Description:
|
||||
$(DEVICE_DESCRIPTION)
|
||||
@ -869,9 +688,6 @@ $(if $(strip $(DEVICE_ALT0_TITLE)),Alternative device titles:
|
||||
- $(DEVICE_ALT0_TITLE))
|
||||
$(if $(strip $(DEVICE_ALT1_TITLE)),- $(DEVICE_ALT1_TITLE))
|
||||
$(if $(strip $(DEVICE_ALT2_TITLE)),- $(DEVICE_ALT2_TITLE))
|
||||
$(if $(strip $(DEVICE_ALT3_TITLE)),- $(DEVICE_ALT3_TITLE))
|
||||
$(if $(strip $(DEVICE_ALT4_TITLE)),- $(DEVICE_ALT4_TITLE))
|
||||
$(if $(strip $(DEVICE_ALT5_TITLE)),- $(DEVICE_ALT5_TITLE))
|
||||
@@
|
||||
|
||||
endef
|
||||
@ -889,18 +705,6 @@ ifneq ($$(strip $$(DEVICE_ALT2_TITLE)),)
|
||||
DEVICE_DISPLAY = $$(DEVICE_ALT2_TITLE) ($$(DEVICE_TITLE))
|
||||
$$(info $$(call Device/DumpInfo,$(1)))
|
||||
endif
|
||||
ifneq ($$(strip $$(DEVICE_ALT3_TITLE)),)
|
||||
DEVICE_DISPLAY = $$(DEVICE_ALT3_TITLE) ($$(DEVICE_TITLE))
|
||||
$$(info $$(call Device/DumpInfo,$(1)))
|
||||
endif
|
||||
ifneq ($$(strip $$(DEVICE_ALT4_TITLE)),)
|
||||
DEVICE_DISPLAY = $$(DEVICE_ALT4_TITLE) ($$(DEVICE_TITLE))
|
||||
$$(info $$(call Device/DumpInfo,$(1)))
|
||||
endif
|
||||
ifneq ($$(strip $$(DEVICE_ALT5_TITLE)),)
|
||||
DEVICE_DISPLAY = $$(DEVICE_ALT5_TITLE) ($$(DEVICE_TITLE))
|
||||
$$(info $$(call Device/DumpInfo,$(1)))
|
||||
endif
|
||||
DEVICE_DISPLAY = $$(DEVICE_TITLE)
|
||||
$$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1)))))
|
||||
endef
|
||||
@ -926,27 +730,24 @@ define BuildImage
|
||||
download:
|
||||
prepare:
|
||||
compile:
|
||||
compile-dtb:
|
||||
clean:
|
||||
image_prepare:
|
||||
|
||||
ifeq ($(IB),)
|
||||
.PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images
|
||||
.PHONY: download prepare compile clean image_prepare kernel_prepare install install-images
|
||||
compile:
|
||||
$(call Build/Compile)
|
||||
|
||||
clean:
|
||||
$(call Build/Clean)
|
||||
|
||||
compile-dtb:
|
||||
image_prepare: compile compile-dtb
|
||||
image_prepare: compile
|
||||
mkdir -p $(BIN_DIR) $(KDIR)/tmp
|
||||
rm -rf $(BUILD_DIR)/json_info_files
|
||||
$(call Image/Prepare)
|
||||
|
||||
else
|
||||
image_prepare:
|
||||
rm -rf $(KDIR)/tmp
|
||||
mkdir -p $(BIN_DIR) $(KDIR)/tmp
|
||||
endif
|
||||
|
||||
|
2
include/kernel-5.10
Normal file
2
include/kernel-5.10
Normal file
@ -0,0 +1,2 @@
|
||||
LINUX_VERSION-5.10 = .134
|
||||
LINUX_KERNEL_HASH-5.10.134 = ec3513acdf033dd8f8ac2545cd1bb826b0669e151185e5f70408a5c9fe273269
|
2
include/kernel-5.4
Normal file
2
include/kernel-5.4
Normal file
@ -0,0 +1,2 @@
|
||||
LINUX_VERSION-5.4 = .203
|
||||
LINUX_KERNEL_HASH-5.4.203 = fc933f5b13066cfa54aacb5e86747a167bad1d8d23972e4a03ab5ee36c29798a
|
@ -1,2 +0,0 @@
|
||||
LINUX_VERSION-6.6 = .79
|
||||
LINUX_KERNEL_HASH-6.6.79 = 07a6f904470da1a099aa1683e3025a999dd82f2438f78b006b80c6ae2e9dfe8d
|
@ -10,7 +10,7 @@ ifneq ($(DUMP),1)
|
||||
endif
|
||||
|
||||
KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
|
||||
STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),)))
|
||||
STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),)))
|
||||
STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
|
||||
include $(INCLUDE_DIR)/download.mk
|
||||
include $(INCLUDE_DIR)/quilt.mk
|
||||
@ -51,7 +51,7 @@ endif
|
||||
define Download/git-kernel
|
||||
URL:=$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI))
|
||||
PROTO:=git
|
||||
SOURCE_VERSION:=$(CONFIG_KERNEL_GIT_REF)
|
||||
VERSION:=$(CONFIG_KERNEL_GIT_REF)
|
||||
FILE:=$(LINUX_SOURCE)
|
||||
SUBDIR:=linux-$(LINUX_VERSION)
|
||||
OPTS:=$(KERNEL_GIT_OPTS)
|
||||
@ -63,7 +63,7 @@ ifdef CONFIG_COLLECT_KERNEL_DEBUG
|
||||
mkdir -p $(KERNEL_BUILD_DIR)/debug/modules
|
||||
$(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/debug/
|
||||
-$(CP) \
|
||||
$(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/*.ko \
|
||||
$(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/* \
|
||||
$(KERNEL_BUILD_DIR)/debug/modules/
|
||||
$(FIND) $(KERNEL_BUILD_DIR)/debug -type f | $(XARGS) $(KERNEL_CROSS)strip --only-keep-debug
|
||||
$(TAR) c -C $(KERNEL_BUILD_DIR) debug \
|
||||
@ -154,21 +154,14 @@ define BuildKernel
|
||||
download: $(if $(LINUX_SITE),$(DL_DIR)/$(LINUX_SOURCE))
|
||||
prepare: $(STAMP_PREPARED)
|
||||
compile: $(LINUX_DIR)/.modules
|
||||
+$(MAKE) -C image compile TARGET_BUILD=
|
||||
|
||||
dtb: $(STAMP_CONFIGURED)
|
||||
$(_SINGLE)$(KERNEL_MAKE) scripts_dtc
|
||||
$(MAKE) -C image compile-dtb TARGET_BUILD=
|
||||
$(MAKE) -C image compile TARGET_BUILD=
|
||||
|
||||
oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
|
||||
rm -f $(LINUX_DIR)/.config.prev
|
||||
rm -f $(STAMP_CONFIGURED)
|
||||
$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
|
||||
$(_SINGLE)$(KERNEL_MAKE) \
|
||||
$(if $(findstring Darwin,$(HOST_OS)), \
|
||||
HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \
|
||||
filechk_conf_cfg=" :" \
|
||||
) \
|
||||
$(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \
|
||||
YACC=$(STAGING_DIR_HOST)/bin/bison \
|
||||
$$@
|
||||
$(call LINUX_RECONF_DIFF,$(LINUX_DIR)/.config) > $(LINUX_RECONFIG_TARGET)
|
||||
|
@ -9,6 +9,10 @@ endif
|
||||
|
||||
INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
|
||||
|
||||
ifneq (,$(KERNEL_CC))
|
||||
KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
|
||||
endif
|
||||
|
||||
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
|
||||
|
||||
# defined in quilt.mk
|
||||
@ -17,7 +21,7 @@ Kernel/Patch:=$(Kernel/Patch/Default)
|
||||
ifneq (,$(findstring .xz,$(LINUX_SOURCE)))
|
||||
LINUX_CAT:=xzcat
|
||||
else
|
||||
LINUX_CAT:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc
|
||||
LINUX_CAT:=gzip -dc
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
|
||||
@ -48,56 +52,44 @@ endif
|
||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
|
||||
define Kernel/SetInitramfs/PreConfigure
|
||||
{ \
|
||||
grep -v -e CONFIG_BLK_DEV_INITRD $(2)/.config.old > $(2)/.config; \
|
||||
echo 'CONFIG_BLK_DEV_INITRD=y' >> $(2)/.config; \
|
||||
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(2)/.config; \
|
||||
}
|
||||
grep -v -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
|
||||
endef
|
||||
else
|
||||
ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"")
|
||||
define Kernel/SetInitramfs/PreConfigure
|
||||
{ \
|
||||
grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(2)/.config.old > $(2)/.config; \
|
||||
echo 'CONFIG_BLK_DEV_INITRD=y' >> $(2)/.config; \
|
||||
echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(1) $(INITRAMFS_EXTRA_FILES))"' >> $(2)/.config; \
|
||||
}
|
||||
endef
|
||||
else
|
||||
define Kernel/SetInitramfs/PreConfigure
|
||||
{ \
|
||||
grep -v INITRAMFS $(2)/.config.old > $(2)/.config; \
|
||||
echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(2)/.config; \
|
||||
}
|
||||
endef
|
||||
endif
|
||||
ifeq ($(strip $(CONFIG_EXTERNAL_CPIO)),"")
|
||||
define Kernel/SetInitramfs/PreConfigure
|
||||
grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
|
||||
endef
|
||||
else
|
||||
define Kernel/SetInitramfs/PreConfigure
|
||||
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_INITRAMFS_SOURCE="$(call qstrip,$(CONFIG_EXTERNAL_CPIO))"' >> $(LINUX_DIR)/.config
|
||||
endef
|
||||
endif
|
||||
endif
|
||||
|
||||
define Kernel/SetInitramfs
|
||||
{ \
|
||||
rm -f $(2)/.config.prev; \
|
||||
mv $(2)/.config $(2)/.config.old; \
|
||||
$(call Kernel/SetInitramfs/PreConfigure,$(1),$(2)); \
|
||||
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(2)/.config; \
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),,echo "CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)" >> $(2)/.config;) \
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),,echo "CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)" >> $(2)/.config;) \
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \
|
||||
echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(2)/.config;, \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_FORCE), \
|
||||
echo "CONFIG_INITRAMFS_FORCE=y" >> $(2)/.config;, \
|
||||
echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(2)/.config;)) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE), \
|
||||
echo "CONFIG_INITRAMFS_COMPRESSION_NONE=y" >> $(2)/.config;, \
|
||||
echo "# CONFIG_INITRAMFS_COMPRESSION_NONE is not set" >> $(2)/.config; ) \
|
||||
$(foreach ALGO,GZIP BZIP2 LZMA LZO XZ LZ4 ZSTD, \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_$(ALGO)), \
|
||||
echo "CONFIG_INITRAMFS_COMPRESSION_$(ALGO)=y" >> $(2)/.config; $\, \
|
||||
echo "# CONFIG_INITRAMFS_COMPRESSION_$(ALGO) is not set" >> $(2)/.config; $\) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_$(ALGO)), \
|
||||
echo "CONFIG_RD_$(ALGO)=y" >> $(2)/.config; $\, \
|
||||
echo "# CONFIG_RD_$(ALGO) is not set" >> $(2)/.config; $\) \
|
||||
) \
|
||||
}
|
||||
rm -f $(LINUX_DIR)/.config.prev
|
||||
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
|
||||
$(call Kernel/SetInitramfs/PreConfigure)
|
||||
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
|
||||
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
|
||||
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
|
||||
echo "$(if $(CONFIG_TARGET_INITRAMFS_FORCE),CONFIG_INITRAMFS_FORCE=y,# CONFIG_INITRAMFS_FORCE is not set)" >> $(LINUX_DIR)/.config
|
||||
else
|
||||
echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(LINUX_DIR)/.config
|
||||
endif
|
||||
echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_DIR)/.config
|
||||
echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config
|
||||
echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config
|
||||
echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA 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_LZ4),CONFIG_INITRAMFS_COMPRESSION_LZ4=y\nCONFIG_RD_LZ4=y,# CONFIG_INITRAMFS_COMPRESSION_LZ4 is not set\n# CONFIG_RD_LZ4 is not set)" >> $(LINUX_DIR)/.config
|
||||
echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),CONFIG_INITRAMFS_COMPRESSION_ZSTD=y\nCONFIG_RD_ZSTD=y,# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set\n# CONFIG_RD_ZSTD is not set)" >> $(LINUX_DIR)/.config
|
||||
endef
|
||||
else
|
||||
endif
|
||||
@ -107,7 +99,6 @@ define Kernel/SetNoInitramfs
|
||||
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
|
||||
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
|
||||
echo '# CONFIG_INITRAMFS_FORCE is not set' >> $(LINUX_DIR)/.config.set
|
||||
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config.set
|
||||
endef
|
||||
|
||||
define Kernel/Configure/Default
|
||||
@ -126,12 +117,12 @@ define Kernel/Configure/Default
|
||||
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \
|
||||
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
|
||||
}
|
||||
$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) 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
|
||||
endef
|
||||
|
||||
define Kernel/Configure/Initramfs
|
||||
$(call Kernel/SetInitramfs,$(1),$(2))
|
||||
$(call Kernel/SetInitramfs)
|
||||
endef
|
||||
|
||||
define Kernel/CompileModules/Default
|
||||
@ -150,73 +141,51 @@ ifeq ($(LINUX_KARCH),x86_64)
|
||||
IMAGES_DIR:=../../x86/boot
|
||||
endif
|
||||
|
||||
# $1: image suffix
|
||||
# $2: Per Device Rootfs ID
|
||||
define Kernel/CopyImage
|
||||
cmp -s $(LINUX_DIR)$(2)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug$(2) || { \
|
||||
$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)$(2)/vmlinux $(LINUX_KERNEL)$(1)$(2); \
|
||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)$(2)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf$(2); \
|
||||
$(CP) $(LINUX_DIR)$(2)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug$(2); \
|
||||
cmp -s $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug || { \
|
||||
$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1); \
|
||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf; \
|
||||
$(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).debug; \
|
||||
$(foreach k, \
|
||||
$(if $(KERNEL_IMAGES),$(KERNEL_IMAGES),$(filter-out vmlinux dtbs,$(KERNELNAME))), \
|
||||
$(CP) $(LINUX_DIR)$(2)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1)$(2); \
|
||||
$(CP) $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1); \
|
||||
) \
|
||||
}
|
||||
endef
|
||||
|
||||
# Always add "modules" so a proper Module.symvers file is written that
|
||||
# also contains symbols from the kernel modules. Without these symbols
|
||||
# external packages that depend on exported symbols from kernel modules
|
||||
# will fail to build.
|
||||
define Kernel/CompileImage/Default
|
||||
rm -f $(TARGET_DIR)/init
|
||||
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
|
||||
$(call Kernel/CopyImage)
|
||||
endef
|
||||
|
||||
define Kernel/PrepareConfigPerRootfs
|
||||
{ \
|
||||
[ ! -d "$(1)" ] || rm -rf $(1); \
|
||||
mkdir $(1) && $(CP) -T $(LINUX_DIR) $(1); \
|
||||
touch $(1)/.config; \
|
||||
}
|
||||
endef
|
||||
|
||||
# Here as well, always add "modules", see comment above.
|
||||
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
||||
# $1: Custom TARGET_DIR. If omitted TARGET_DIR is used.
|
||||
# $2: If defined Generate Per Rootfs Kernel Directory and use it
|
||||
# For Separate Initramf with $2 declared, skip kernel compile, it has
|
||||
# already been done previously on generic image build
|
||||
define Kernel/CompileImage/Initramfs
|
||||
$(call locked,{ \
|
||||
$(if $(2),$(call Kernel/PrepareConfigPerRootfs,$(LINUX_DIR)$(2));) \
|
||||
$(call Kernel/Configure/Initramfs,$(if $(1),$(1),$(TARGET_DIR)),$(LINUX_DIR)$(2)); \
|
||||
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(if $(1),$(1),$(TARGET_DIR))/init; \
|
||||
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(if $(1),$(1),$(TARGET_DIR)) $(if $(1),$(1),$(TARGET_DIR))/init;) \
|
||||
rm -rf $(LINUX_DIR)$(2)/usr/initramfs_data.cpio*; \
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE), \
|
||||
$(call locked,{ \
|
||||
$(if $(call qstrip,$(CONFIG_EXTERNAL_CPIO)), \
|
||||
$(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd$(2).cpio;,\
|
||||
( cd $(if $(1),$(1),$(TARGET_DIR)); find . | LC_ALL=C sort | $(STAGING_DIR_HOST)/bin/cpio --reproducible -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd$(2).cpio );) \
|
||||
$(if $(SOURCE_DATE_EPOCH), \
|
||||
touch -hcd "@$(SOURCE_DATE_EPOCH)" $(KERNEL_BUILD_DIR)/initrd$(2).cpio;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2), \
|
||||
$(STAGING_DIR_HOST)/bin/bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd$(2).cpio > $(KERNEL_BUILD_DIR)/initrd$(2).cpio.bzip2;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP), \
|
||||
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -n -f -S .gzip -12 $(KERNEL_BUILD_DIR)/initrd$(2).cpio;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4), \
|
||||
$(STAGING_DIR_HOST)/bin/lz4c -l -c1 -fz --favor-decSpeed $(KERNEL_BUILD_DIR)/initrd$(2).cpio;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA), \
|
||||
$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd$(2).cpio $(KERNEL_BUILD_DIR)/initrd$(2).cpio.lzma;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO), \
|
||||
$(STAGING_DIR_HOST)/bin/lzop -9 -f $(KERNEL_BUILD_DIR)/initrd$(2).cpio;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ), \
|
||||
$(STAGING_DIR_HOST)/bin/xz -T$(if $(filter 1,$(NPROC)),2,0) -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd$(2).cpio;) \
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD), \
|
||||
$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd$(2).cpio.zstd $(KERNEL_BUILD_DIR)/initrd$(2).cpio;) \
|
||||
}, gen-cpio$(2)); \
|
||||
$(if $(2),,$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all);),\
|
||||
$(KERNEL_MAKE) $(if $(2),-C $(LINUX_DIR)$(2)) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all);) \
|
||||
$(call Kernel/CopyImage,-initramfs,$(2)); \
|
||||
$(if $(2),rm -rf $(LINUX_DIR)$(2);) \
|
||||
}, gen-initramfs$(2));
|
||||
$(call Kernel/Configure/Initramfs)
|
||||
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
|
||||
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init)
|
||||
rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
|
||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
|
||||
ifneq ($(qstrip $(CONFIG_EXTERNAL_CPIO)),)
|
||||
$(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio
|
||||
else
|
||||
( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root > $(KERNEL_BUILD_DIR)/initrd.cpio )
|
||||
endif
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma)
|
||||
# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio)
|
||||
# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio)
|
||||
endif
|
||||
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
|
||||
$(call Kernel/CopyImage,-initramfs)
|
||||
endef
|
||||
else
|
||||
define Kernel/CompileImage/Initramfs
|
||||
|
@ -13,15 +13,6 @@ endif
|
||||
|
||||
include $(KERNEL_DETAILS_FILE)
|
||||
|
||||
ifdef KERNEL_TESTING_PATCHVER
|
||||
KERNEL_TESTING_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_TESTING_PATCHVER)
|
||||
ifeq ($(wildcard $(KERNEL_TESTING_DETAILS_FILE)),)
|
||||
$(error Missing kernel version/hash file for $(KERNEL_TESTING_PATCHVER). Please create $(KERNEL_TESTING_DETAILS_FILE))
|
||||
endif
|
||||
|
||||
include $(KERNEL_TESTING_DETAILS_FILE)
|
||||
endif
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
||||
|
@ -43,7 +43,7 @@ else
|
||||
PATCH_DIR ?= $(CURDIR)/patches$(if $(wildcard ./patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
|
||||
FILES_DIR ?= $(foreach dir,$(wildcard $(CURDIR)/files $(CURDIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
|
||||
endif
|
||||
KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)_$(SUBTARGET)
|
||||
KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET))
|
||||
LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
|
||||
LINUX_UAPI_DIR=uapi/
|
||||
LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null))
|
||||
@ -86,14 +86,10 @@ else ifneq (,$(findstring $(ARCH) , arceb ))
|
||||
LINUX_KARCH := arc
|
||||
else ifneq (,$(findstring $(ARCH) , armeb ))
|
||||
LINUX_KARCH := arm
|
||||
else ifneq (,$(findstring $(ARCH) , loongarch64 ))
|
||||
LINUX_KARCH := loongarch
|
||||
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
|
||||
LINUX_KARCH := mips
|
||||
else ifneq (,$(findstring $(ARCH) , powerpc64 ))
|
||||
LINUX_KARCH := powerpc
|
||||
else ifneq (,$(findstring $(ARCH) , riscv64 ))
|
||||
LINUX_KARCH := riscv
|
||||
else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 ))
|
||||
LINUX_KARCH := sh
|
||||
else ifneq (,$(findstring $(ARCH) , i386 x86_64 ))
|
||||
@ -105,7 +101,7 @@ endif
|
||||
KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
|
||||
|
||||
KERNEL_MAKE_FLAGS = \
|
||||
KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR))) $(filter-out -fno-plt,$(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))) $(call qstrip,$(CONFIG_KERNEL_CFLAGS))" \
|
||||
KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
|
||||
CROSS_COMPILE="$(KERNEL_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
@ -114,17 +110,14 @@ KERNEL_MAKE_FLAGS = \
|
||||
KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
|
||||
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
|
||||
KBUILD_BUILD_VERSION="0" \
|
||||
KBUILD_HOSTLDFLAGS="-L$(STAGING_DIR_HOST)/lib" \
|
||||
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
|
||||
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
|
||||
CONFIG_SHELL="$(BASH)" \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
|
||||
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
|
||||
cmd_syscalls= \
|
||||
$(if $(__package_mk),KBUILD_EXTRA_SYMBOLS="$(wildcard $(PKG_SYMVERS_DIR)/*.symvers)")
|
||||
|
||||
ifneq (,$(KERNEL_CC))
|
||||
KERNEL_MAKE_FLAGS += CC="$(KERNEL_CC)"
|
||||
endif
|
||||
|
||||
KERNEL_NOSTDINC_FLAGS = \
|
||||
-nostdinc $(if $(DUMP),, -isystem $(shell $(TARGET_CC) -print-file-name=include))
|
||||
|
||||
@ -133,17 +126,17 @@ ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL
|
||||
KERNELRELEASE=$(LINUX_VERSION)
|
||||
endif
|
||||
|
||||
ifneq ($(HOST_OS),Linux)
|
||||
KERNEL_MAKE_FLAGS += CONFIG_STACK_VALIDATION=
|
||||
export SKIP_STACK_VALIDATION:=1
|
||||
endif
|
||||
|
||||
KERNEL_MAKEOPTS = -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
|
||||
KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
|
||||
|
||||
ifdef CONFIG_USE_SPARSE
|
||||
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
|
||||
endif
|
||||
|
||||
ifneq ($(HOST_OS),Linux)
|
||||
KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION=
|
||||
export SKIP_STACK_VALIDATION:=1
|
||||
endif
|
||||
|
||||
PKG_EXTMOD_SUBDIRS ?= .
|
||||
|
||||
PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers
|
||||
@ -206,19 +199,19 @@ define KernelPackage
|
||||
$(eval $(call KernelPackage/Defaults))
|
||||
$(eval $(call KernelPackage/$(1)))
|
||||
$(eval $(call KernelPackage/$(1)/$(BOARD)))
|
||||
$(eval $(call KernelPackage/$(1)/$(BOARD)/$(SUBTARGET)))
|
||||
$(eval $(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)))
|
||||
|
||||
define Package/kmod-$(1)
|
||||
TITLE:=$(TITLE)
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
DESCRIPTION:=$(DESCRIPTION)
|
||||
EXTRA_DEPENDS:=kernel (=$(LINUX_VERSION)~$(LINUX_VERMAGIC)-r$(LINUX_RELEASE))
|
||||
VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),.$(PKG_VERSION))-r$(if $(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE))
|
||||
EXTRA_DEPENDS:=kernel (=$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC))
|
||||
VERSION:=$(LINUX_VERSION)$(if $(PKG_VERSION),+$(PKG_VERSION))-$(if $(PKG_RELEASE),$(PKG_RELEASE),$(LINUX_RELEASE))
|
||||
PKGFLAGS:=$(PKGFLAGS)
|
||||
$(call KernelPackage/$(1))
|
||||
$(call KernelPackage/$(1)/$(BOARD))
|
||||
$(call KernelPackage/$(1)/$(BOARD)/$(SUBTARGET))
|
||||
$(call KernelPackage/$(1)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic))
|
||||
endef
|
||||
|
||||
ifdef KernelPackage/$(1)/conffiles
|
||||
@ -242,7 +235,7 @@ $(call KernelPackage/$(1)/config)
|
||||
$(call KernelPackage/depends)
|
||||
$(call KernelPackage/hooks)
|
||||
|
||||
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),)
|
||||
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),)
|
||||
define Package/kmod-$(1)/install
|
||||
@for mod in $$(call version_filter,$$(FILES)); do \
|
||||
if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \
|
||||
|
@ -55,14 +55,8 @@ else
|
||||
MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
|
||||
endif
|
||||
|
||||
ifeq ($(MESON_USE_STAGING_PYTHON),)
|
||||
PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON)
|
||||
else
|
||||
PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON)
|
||||
endif
|
||||
|
||||
define Meson
|
||||
$(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1)
|
||||
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1)
|
||||
endef
|
||||
|
||||
define Meson/CreateNativeFile
|
||||
@ -71,7 +65,7 @@ define Meson/CreateNativeFile
|
||||
-e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \
|
||||
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
|
||||
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
|
||||
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
|
||||
-e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
|
||||
-e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
|
||||
@ -84,13 +78,12 @@ define Meson/CreateCrossFile
|
||||
$(STAGING_DIR_HOST)/bin/sed \
|
||||
-e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \
|
||||
-e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \
|
||||
-e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \
|
||||
-e "s|@AR@|$(TARGET_AR)|" \
|
||||
-e "s|@STRIP@|$(TARGET_CROSS)strip|" \
|
||||
-e "s|@NM@|$(TARGET_NM)|" \
|
||||
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
|
||||
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
|
||||
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
|
||||
-e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
|
||||
-e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
|
||||
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
|
||||
@ -104,9 +97,7 @@ endef
|
||||
define Host/Configure/Meson
|
||||
$(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt)
|
||||
$(call Meson, \
|
||||
setup \
|
||||
--native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
|
||||
-Ddefault_library=static \
|
||||
$(MESON_HOST_ARGS) \
|
||||
$(MESON_HOST_BUILD_DIR) \
|
||||
$(MESON_HOST_BUILD_DIR)/.., \
|
||||
@ -114,7 +105,7 @@ define Host/Configure/Meson
|
||||
endef
|
||||
|
||||
define Host/Compile/Meson
|
||||
+$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
|
||||
+$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Host/Install/Meson
|
||||
@ -129,11 +120,9 @@ define Build/Configure/Meson
|
||||
$(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt)
|
||||
$(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt)
|
||||
$(call Meson, \
|
||||
setup \
|
||||
--buildtype $(if $(CONFIG_DEBUG),debug,plain) \
|
||||
--buildtype plain \
|
||||
--native-file $(PKG_BUILD_DIR)/openwrt-native.txt \
|
||||
--cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \
|
||||
-Ddefault_library=both \
|
||||
$(MESON_ARGS) \
|
||||
$(MESON_BUILD_DIR) \
|
||||
$(MESON_BUILD_DIR)/.., \
|
||||
@ -141,7 +130,7 @@ define Build/Configure/Meson
|
||||
endef
|
||||
|
||||
define Build/Compile/Meson
|
||||
+$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1)
|
||||
+$(NINJA) -C $(MESON_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Build/Install/Meson
|
||||
|
@ -48,6 +48,8 @@ $(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_COMMENT, $(P_XT)xt_comme
|
||||
$(eval $(call nf_add,IPT_CLUSTER,CONFIG_NETFILTER_XT_MATCH_CLUSTER, $(P_XT)xt_cluster))
|
||||
|
||||
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_XT)xt_LOG))
|
||||
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_XT)nf_log_common))
|
||||
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_LOG, $(P_V4)nf_log_ipv4))
|
||||
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_TARGET_TCPMSS, $(P_XT)xt_TCPMSS))
|
||||
$(eval $(call nf_add,IPT_CORE,CONFIG_IP_NF_TARGET_REJECT, $(P_V4)ipt_REJECT))
|
||||
$(eval $(call nf_add,IPT_CORE,CONFIG_NETFILTER_XT_MATCH_TIME, $(P_XT)xt_time))
|
||||
@ -73,6 +75,7 @@ $(eval $(call nf_add,IPT_CONNTRACK,CONFIG_NETFILTER_XT_MATCH_CONNTRACK, $(P_XT)x
|
||||
|
||||
$(eval $(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_XT_MATCH_CONNBYTES, $(P_XT)xt_connbytes))
|
||||
$(eval $(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_XT_MATCH_CONNLIMIT, $(P_XT)xt_connlimit))
|
||||
$(eval $(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_CONNCOUNT, $(P_XT)nf_conncount))
|
||||
$(eval $(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_XT_CONNMARK, $(P_XT)xt_connmark))
|
||||
$(eval $(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_XT_MATCH_HELPER, $(P_XT)xt_helper))
|
||||
$(eval $(call nf_add,IPT_CONNTRACK_EXTRA,CONFIG_NETFILTER_XT_MATCH_RECENT, $(P_XT)xt_recent))
|
||||
@ -102,6 +105,10 @@ $(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_ph
|
||||
$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_STRING, $(P_XT)xt_string))
|
||||
$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf))
|
||||
|
||||
# imq
|
||||
|
||||
$(eval $(call nf_add,IPT_IMQ,CONFIG_IP_NF_TARGET_IMQ, $(P_V4)ipt_IMQ))
|
||||
$(eval $(call nf_add,IPT_IMQ,CONFIG_NETFILTER_XT_TARGET_IMQ, $(P_XT)xt_IMQ))
|
||||
|
||||
# ipopt
|
||||
|
||||
@ -131,6 +138,9 @@ $(eval $(call nf_add,IPT_IPOPT,CONFIG_NETFILTER_XT_TARGET_HL, $(P_XT)xt_HL))
|
||||
# iprange
|
||||
$(eval $(call nf_add,IPT_IPRANGE,CONFIG_NETFILTER_XT_MATCH_IPRANGE, $(P_XT)xt_iprange))
|
||||
|
||||
#clusterip
|
||||
$(eval $(call nf_add,IPT_CLUSTERIP,CONFIG_IP_NF_TARGET_CLUSTERIP, $(P_V4)ipt_CLUSTERIP))
|
||||
|
||||
# ipsec
|
||||
$(eval $(call nf_add,IPT_IPSEC,CONFIG_IP_NF_MATCH_AH, $(P_V4)ipt_ah))
|
||||
$(eval $(call nf_add,IPT_IPSEC,CONFIG_NETFILTER_XT_MATCH_ESP, $(P_XT)xt_esp))
|
||||
@ -150,6 +160,7 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNTRACK,CONFIG_NF_DEFRAG_IPV6, $(P_V6)
|
||||
|
||||
$(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_NF_LOG_IPV6, $(P_V6)nf_log_ipv6),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_IPV6,CONFIG_IP6_NF_IPTABLES, ip6t_icmp6)))
|
||||
|
||||
@ -165,13 +176,6 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_OPTS, $(P_V6)ip6t_hbh))
|
||||
$(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_FRAG, $(P_V6)ip6t_frag))
|
||||
$(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt))
|
||||
|
||||
# log
|
||||
|
||||
$(eval $(call nf_add,NF_LOG,CONFIG_NF_LOG_COMMON, $(P_XT)nf_log_common, lt 5.13))
|
||||
$(eval $(call nf_add,NF_LOG,CONFIG_NF_LOG_IPV4, $(P_V4)nf_log_ipv4, lt 5.13))
|
||||
$(eval $(call nf_add,NF_LOG,CONFIG_NF_LOG_SYSLOG, $(P_XT)nf_log_syslog, ge 5.13))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NF_LOG6,CONFIG_NF_LOG_IPV6, $(P_V6)nf_log_ipv6,lt 5.13),))
|
||||
|
||||
# nat
|
||||
|
||||
# kernel only
|
||||
@ -183,7 +187,7 @@ $(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_NAT, $(P_V6)ip6table
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, $(P_V6)ip6t_NPT),))
|
||||
|
||||
# userland only
|
||||
$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT,CONFIG_NF_NAT, ipt_NAT)))
|
||||
$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT,CONFIG_NF_NAT, ipt_SNAT ipt_DNAT)))
|
||||
$(eval $(if $(NF_KMOD),,$(call nf_add,IPT_NAT6,CONFIG_IP6_NF_TARGET_NPT, ip6t_DNPT ip6t_SNPT)))
|
||||
|
||||
$(eval $(call nf_add,IPT_NAT,CONFIG_NETFILTER_XT_TARGET_MASQUERADE, $(P_XT)xt_MASQUERADE))
|
||||
@ -204,8 +208,6 @@ $(eval $(call nf_add,NF_NATHELPER,CONFIG_NF_NAT_FTP, $(P_XT)nf_nat_ftp))
|
||||
# nathelper-extra
|
||||
|
||||
$(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_NETBIOS_NS, $(P_XT)nf_conntrack_netbios_ns))
|
||||
$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_SANE, $(P_XT)nf_conntrack_sane))
|
||||
$(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_CONNTRACK_H323, $(P_XT)nf_conntrack_h323))
|
||||
@ -222,6 +224,11 @@ $(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_CONNTRACK_IRC, $(P_XT)nf_connt
|
||||
$(eval $(call nf_add,NF_NATHELPER_EXTRA,CONFIG_NF_NAT_IRC, $(P_XT)nf_nat_irc))
|
||||
|
||||
|
||||
# ulog
|
||||
|
||||
$(eval $(call nf_add,IPT_ULOG,CONFIG_IP_NF_TARGET_ULOG, $(P_V4)ipt_ULOG))
|
||||
|
||||
|
||||
# nflog
|
||||
|
||||
$(eval $(call nf_add,IPT_NFLOG,CONFIG_NETFILTER_XT_TARGET_NFLOG, $(P_XT)xt_NFLOG))
|
||||
@ -236,15 +243,14 @@ $(eval $(call nf_add,IPT_NFQUEUE,CONFIG_NETFILTER_XT_TARGET_NFQUEUE, $(P_XT)xt_N
|
||||
|
||||
$(eval $(call nf_add,IPT_DEBUG,CONFIG_NETFILTER_XT_TARGET_TRACE, $(P_XT)xt_TRACE))
|
||||
|
||||
# socket
|
||||
$(eval $(call nf_add,NF_SOCKET,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4))
|
||||
$(eval $(call nf_add,NF_SOCKET,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6))
|
||||
$(eval $(call nf_add,IPT_SOCKET,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_socket))
|
||||
|
||||
# tproxy
|
||||
$(eval $(call nf_add,NF_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4))
|
||||
$(eval $(call nf_add,NF_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6))
|
||||
|
||||
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_socket))
|
||||
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4))
|
||||
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6))
|
||||
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPROXY))
|
||||
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4))
|
||||
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6))
|
||||
|
||||
# led
|
||||
$(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED))
|
||||
@ -252,6 +258,8 @@ $(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED))
|
||||
# tee
|
||||
|
||||
$(eval $(call nf_add,IPT_TEE,CONFIG_NETFILTER_XT_TARGET_TEE, $(P_XT)xt_TEE))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV4, $(P_V4)nf_dup_ipv4),))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV6, $(P_V6)nf_dup_ipv6),))
|
||||
|
||||
# u32
|
||||
|
||||
@ -274,10 +282,6 @@ $(eval $(call nf_add,NFNETLINK_LOG,CONFIG_NETFILTER_NETLINK_LOG, $(P_XT)nfnetlin
|
||||
|
||||
$(eval $(call nf_add,NFNETLINK_QUEUE,CONFIG_NETFILTER_NETLINK_QUEUE, $(P_XT)nfnetlink_queue))
|
||||
|
||||
# conncount
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NF_CONNCOUNT,CONFIG_NETFILTER_CONNCOUNT, $(P_XT)nf_conncount),))
|
||||
|
||||
#
|
||||
# ebtables
|
||||
#
|
||||
@ -310,6 +314,7 @@ $(eval $(call nf_add,EBTABLES_IP4,CONFIG_BRIDGE_EBT_SNAT, $(P_EBT)ebt_snat))
|
||||
|
||||
# watchers
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_LOG, $(P_EBT)ebt_log))
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_ULOG, $(P_EBT)ebt_ulog))
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFLOG, $(P_EBT)ebt_nflog))
|
||||
$(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nfqueue))
|
||||
|
||||
@ -335,7 +340,12 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NF_CONNTRACK_BRIDGE, $(P_
|
||||
|
||||
$(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_chain_nat),))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4),))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ, $(P_XT)nft_masq),))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ_IPV4, $(P_V4)nft_masq_ipv4),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6),))
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_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_INET, $(P_XT)nft_fib_inet),))
|
||||
@ -344,16 +354,6 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_FIB,CONFIG_NFT_FIB_IPV6, $(P_V6)nft_fib
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_QUEUE,CONFIG_NFT_QUEUE, $(P_XT)nft_queue),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_SOCKET,CONFIG_NFT_SOCKET, $(P_XT)nft_socket),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_TPROXY,CONFIG_NFT_TPROXY, $(P_XT)nft_tproxy),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_COMPAT,CONFIG_NFT_COMPAT, $(P_XT)nft_compat),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_XFRM,CONFIG_NFT_XFRM, $(P_XT)nft_xfrm),))
|
||||
|
||||
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CONNLIMIT,CONFIG_NFT_CONNLIMIT, $(P_XT)nft_connlimit),))
|
||||
|
||||
# userland only
|
||||
IPT_BUILTIN += $(NF_IPT-y) $(NF_IPT-m)
|
||||
IPT_BUILTIN += $(IPT_CORE-y) $(IPT_CORE-m)
|
||||
@ -368,6 +368,7 @@ IPT_BUILTIN += $(IPT_FLOW-y) $(IPT_FLOW-m)
|
||||
IPT_BUILTIN += $(IPT_IPOPT-y)
|
||||
IPT_BUILTIN += $(IPT_IPRANGE-y)
|
||||
IPT_BUILTIN += $(IPT_CLUSTER-y)
|
||||
IPT_BUILTIN += $(IPT_CLUSTERIP-y)
|
||||
IPT_BUILTIN += $(IPT_IPSEC-y)
|
||||
IPT_BUILTIN += $(IPT_IPV6-y) $(IPT_IPV6-m)
|
||||
IPT_BUILTIN += $(NF_NAT-y)
|
||||
@ -377,6 +378,7 @@ IPT_BUILTIN += $(IPT_NAT6-y)
|
||||
IPT_BUILTIN += $(IPT_NAT_EXTRA-y)
|
||||
IPT_BUILTIN += $(NF_NATHELPER-y)
|
||||
IPT_BUILTIN += $(NF_NATHELPER_EXTRA-y)
|
||||
IPT_BUILTIN += $(IPT_ULOG-y)
|
||||
IPT_BUILTIN += $(IPT_TPROXY-y)
|
||||
IPT_BUILTIN += $(NFNETLINK-y)
|
||||
IPT_BUILTIN += $(NFNETLINK_LOG-y)
|
||||
|
@ -10,9 +10,9 @@ ifeq ($(CONFIG_BUILD_NLS),y)
|
||||
INTL_PREFIX:=$(STAGING_DIR)/usr/lib/libintl-full
|
||||
INTL_FULL:=1
|
||||
|
||||
CMAKE_OPTIONS += -DCMAKE_PREFIX_PATH="$(ICONV_PREFIX);$(INTL_PREFIX)"
|
||||
# iconv stub
|
||||
else
|
||||
ICONV_PREFIX:=
|
||||
ICONV_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-stub
|
||||
ICONV_FULL:=
|
||||
|
||||
INTL_PREFIX:=
|
||||
@ -20,17 +20,12 @@ else
|
||||
endif
|
||||
|
||||
PKG_CONFIG_DEPENDS += CONFIG_BUILD_NLS
|
||||
PKG_BUILD_DEPENDS += !BUILD_NLS:libiconv
|
||||
|
||||
ICONV_DEPENDS:=+BUILD_NLS:libiconv-full
|
||||
ifeq ($(CONFIG_BUILD_NLS),y)
|
||||
ICONV_CFLAGS:=-I$(ICONV_PREFIX)/include
|
||||
ICONV_CPPFLAGS:=-I$(ICONV_PREFIX)/include
|
||||
ICONV_LDFLAGS:=-L$(ICONV_PREFIX)/lib -Wl,-rpath-link=$(ICONV_PREFIX)/lib
|
||||
else
|
||||
ICONV_CFLAGS:=
|
||||
ICONV_CPPFLAGS:=
|
||||
ICONV_LDFLAGS:=
|
||||
endif
|
||||
ICONV_CFLAGS:=-I$(ICONV_PREFIX)/include
|
||||
ICONV_CPPFLAGS:=-I$(ICONV_PREFIX)/include
|
||||
ICONV_LDFLAGS:=-L$(ICONV_PREFIX)/lib -Wl,-rpath-link=$(ICONV_PREFIX)/lib
|
||||
|
||||
INTL_DEPENDS:=+BUILD_NLS:libintl-full
|
||||
ifeq ($(CONFIG_BUILD_NLS),y)
|
||||
|
50
include/openssl-engine.mk
Normal file
50
include/openssl-engine.mk
Normal file
@ -0,0 +1,50 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2022 Enéas Ulir de Queiroz
|
||||
|
||||
ENGINES_DIR=engines-1.1
|
||||
|
||||
define Package/openssl/engine/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=SSL
|
||||
DEPENDS:=libopenssl @OPENSSL_ENGINE +libopenssl-conf
|
||||
endef
|
||||
|
||||
# 1 = engine name
|
||||
# 2 - package name, defaults to libopenssl-$(1)
|
||||
define Package/openssl/add-engine
|
||||
OSSL_ENG_PKG:=$(if $(2),$(2),libopenssl-$(1))
|
||||
Package/$$(OSSL_ENG_PKG)/conffiles:=/etc/ssl/engines.cnf.d/$(1).cnf
|
||||
|
||||
define Package/$$(OSSL_ENG_PKG)/install
|
||||
$$(INSTALL_DIR) $$(1)/usr/lib/$(ENGINES_DIR)
|
||||
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/lib/$(ENGINES_DIR)/$(1).so \
|
||||
$$(1)/usr/lib/$(ENGINES_DIR)
|
||||
$$(INSTALL_DIR) $$(1)/etc/ssl/engines.cnf.d
|
||||
$$(INSTALL_DATA) ./files/$(1).cnf $$(1)/etc/ssl/engines.cnf.d/
|
||||
endef
|
||||
|
||||
define Package/$$(OSSL_ENG_PKG)/postinst :=
|
||||
#!/bin/sh
|
||||
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
|
||||
|
||||
[ -z "$$$${IPKG_INSTROOT}" ] && uci -q get openssl.$(1) >/dev/null && exit 0
|
||||
|
||||
cat << EOF >> "$$$${OPENSSL_UCI}"
|
||||
|
||||
config engine '$(1)'
|
||||
option enabled '1'
|
||||
EOF
|
||||
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
|
||||
endef
|
||||
|
||||
define Package/$$(OSSL_ENG_PKG)/postrm :=
|
||||
#!/bin/sh
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
|
||||
uci delete openssl.$(1)
|
||||
uci commit openssl
|
||||
/etc/init.d/openssl reload
|
||||
endef
|
||||
endef
|
@ -1,79 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2022-2023 Enéas Ulir de Queiroz
|
||||
|
||||
ENGINES_DIR=engines-3
|
||||
|
||||
define Package/openssl/module/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=SSL
|
||||
DEPENDS:=libopenssl +libopenssl-conf
|
||||
endef
|
||||
|
||||
define Package/openssl/engine/Default
|
||||
$(Package/openssl/module/Default)
|
||||
DEPENDS+=@OPENSSL_ENGINE
|
||||
endef
|
||||
|
||||
|
||||
# 1 = moudule type (engine|provider)
|
||||
# 2 = module name
|
||||
# 3 = directory to save .so file
|
||||
# 4 = [ package name, defaults to libopenssl-$(2) ]
|
||||
define Package/openssl/add-module
|
||||
$(eval MOD_TYPE:=$(1))
|
||||
$(eval MOD_NAME:=$(2))
|
||||
$(eval MOD_DIR:=$(3))
|
||||
$(eval OSSL_PKG:=$(if $(4),$(4),libopenssl-$(MOD_NAME)))
|
||||
$(info Package/openssl/add-module 1='$(1)'; 2='$(2)'; 3='$(3)' 4='$(4)')
|
||||
$(info MOD_TYPE='$(MOD_TYPE)'; MOD_NAME='$(MOD_NAME)'; MOD_DIR='$(MOD_DIR)' OSSL_PKG='$(OSSL_PKG)')
|
||||
Package/$(OSSL_PKG)/conffiles:=/etc/ssl/modules.cnf.d/$(MOD_NAME).cnf
|
||||
|
||||
define Package/$(OSSL_PKG)/install
|
||||
$$(INSTALL_DIR) $$(1)/$(MOD_DIR)
|
||||
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/$(MOD_DIR)/$(MOD_NAME).so \
|
||||
$$(1)/$(MOD_DIR)
|
||||
$$(INSTALL_DIR) $$(1)/etc/ssl/modules.cnf.d
|
||||
$$(INSTALL_DATA) ./files/$(MOD_NAME).cnf $$(1)/etc/ssl/modules.cnf.d/
|
||||
endef
|
||||
|
||||
define Package/$(OSSL_PKG)/postinst
|
||||
#!/bin/sh
|
||||
OPENSSL_UCI="$$$${IPKG_INSTROOT}/etc/config/openssl"
|
||||
|
||||
[ -z "$$$${IPKG_INSTROOT}" ] \
|
||||
&& uci -q get openssl.$(MOD_NAME) >/dev/null \
|
||||
&& exit 0
|
||||
|
||||
cat << EOF >> "$$$${OPENSSL_UCI}"
|
||||
|
||||
config $(MOD_TYPE) '$(MOD_NAME)'
|
||||
option enabled '1'
|
||||
EOF
|
||||
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] || /etc/init.d/openssl reload
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(OSSL_PKG)/postrm
|
||||
#!/bin/sh
|
||||
[ -n "$$$${IPKG_INSTROOT}" ] && exit 0
|
||||
uci -q delete openssl.$(MOD_NAME) && uci commit openssl
|
||||
/etc/init.d/openssl reload
|
||||
exit 0
|
||||
endef
|
||||
endef
|
||||
|
||||
# 1 = engine name
|
||||
# 2 - package name, defaults to libopenssl-$(1)
|
||||
define Package/openssl/add-engine
|
||||
$(call Package/openssl/add-module,engine,$(1),/usr/lib/$(ENGINES_DIR),$(2))
|
||||
endef
|
||||
|
||||
# 1 = provider name
|
||||
# 2 = [ package name, defaults to libopenssl-$(1) ]
|
||||
define Package/openssl/add-provider
|
||||
$(call Package/openssl/add-module,provider,$(1),/usr/lib/ossl-modules,$(2))
|
||||
endef
|
||||
|
@ -1,113 +0,0 @@
|
||||
include $(INCLUDE_DIR)/prereq.mk
|
||||
|
||||
PKG_NAME ?= optee-os
|
||||
|
||||
ifndef PKG_SOURCE_PROTO
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL_FILE:=$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL = https://github.com/OP-TEE/optee_os/archive/refs/tags/
|
||||
TAR_OPTIONS+= --transform 's/optee_os/$(PKG_NAME)/'
|
||||
endif
|
||||
|
||||
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_TARGETS := bin
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_LICENSE:=BSD 2-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL ?= 1
|
||||
|
||||
$(eval $(call TestHostCommand,python3-cryptography, \
|
||||
Please install the Python3 cryptography module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import cryptography'))
|
||||
|
||||
$(eval $(call TestHostCommand,python3-pyelftools, \
|
||||
Please install the Python3 pyelftools module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import elftools'))
|
||||
|
||||
export GCC_HONOUR_COPTS=s
|
||||
|
||||
define Package/optee-os/install/default
|
||||
$(CP) $(patsubst %,$(PKG_BUILD_DIR)/out/arm-plat-$(PLAT)/core/%,$(OPTEE_IMAGE)) $(1)/
|
||||
endef
|
||||
|
||||
Package/optee-os/install = $(Package/optee-os/install/default)
|
||||
|
||||
define Optee-os/Init
|
||||
BUILD_TARGET:=
|
||||
BUILD_SUBTARGET:=
|
||||
BUILD_DEVICES:=
|
||||
NAME:=
|
||||
DEPENDS:=
|
||||
HIDDEN:=
|
||||
DEFAULT:=
|
||||
VARIANT:=$(1)
|
||||
PLAT:=$(1)
|
||||
PLAT_FLAVOR:=
|
||||
OPTEE_IMAGE:=tee-header_v2.bin tee-pager_v2.bin tee-pageable_v2.bin
|
||||
endef
|
||||
|
||||
TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
|
||||
|
||||
define Build/Optee-os/Target
|
||||
$(eval $(call Optee-os/Init,$(1)))
|
||||
$(eval $(call Optee-os/Default,$(1)))
|
||||
$(eval $(call Optee-os/$(1),$(1)))
|
||||
|
||||
define Package/optee-os-$(1)
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
TITLE:=OPTEE-OS 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://optee.readthedocs.io
|
||||
endef
|
||||
|
||||
define Package/optee-os-$(1)/install
|
||||
$$(Package/optee-os/install)
|
||||
endef
|
||||
endef
|
||||
|
||||
define Build/Configure/Optee-os
|
||||
endef
|
||||
|
||||
define Build/Compile/Optee-os
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
PATH=$(LINUX_DIR)/scripts/dtc/:$(PATH) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) \
|
||||
CROSS_COMPILE_core="$(TARGET_CROSS)" \
|
||||
CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \
|
||||
CROSS_COMPILE_ta_arm32="$(TARGET_CROSS)" \
|
||||
$(if $(CONFIG_ARCH_64BIT), CFG_ARM64_core=y CFG_USER_TA_TARGETS=ta_arm64, CFG_ARM32_core=y) \
|
||||
PLATFORM="$(PLAT)" \
|
||||
PLATFORM_FLAVOR="$(call qstrip,$(PLAT_FLAVOR))" \
|
||||
$(OPTEE_MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define BuildPackage/Optee-os/Defaults
|
||||
Build/Configure/Default = $$$$(Build/Configure/Optee-os)
|
||||
Build/Compile/Default = $$$$(Build/Compile/Optee-os)
|
||||
endef
|
||||
|
||||
define BuildPackage/Optee-os
|
||||
$(eval $(call BuildPackage/Optee-os/Defaults))
|
||||
$(foreach type,$(if $(DUMP),$(OPTEE_TARGETS),$(BUILD_VARIANT)), \
|
||||
$(eval $(call Build/Optee-os/Target,$(type)))
|
||||
)
|
||||
$(eval $(call Build/DefaultTargets))
|
||||
$(foreach type,$(if $(DUMP),$(OPTEE_TARGETS),$(BUILD_VARIANT)), \
|
||||
$(call BuildPackage,optee-os-$(type))
|
||||
)
|
||||
endef
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (C) 2006-2020 OpenWrt.org
|
||||
|
||||
PKG_DEFAULT_DEPENDS = +libc
|
||||
PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
|
||||
|
||||
ifneq ($(PKG_NAME),toolchain)
|
||||
PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))
|
||||
@ -20,10 +20,10 @@ define Package/Default
|
||||
PROVIDES:=
|
||||
EXTRA_DEPENDS:=
|
||||
MAINTAINER:=$(PKG_MAINTAINER)
|
||||
SOURCE:=$(patsubst $(TOPDIR)/%,%,$(patsubst $(TOPDIR)/package/%,feeds/base/%,$(CURDIR)))
|
||||
SOURCE:=$(patsubst $(TOPDIR)/%,%,$(CURDIR))
|
||||
ifneq ($(PKG_VERSION),)
|
||||
ifneq ($(PKG_RELEASE),)
|
||||
VERSION:=$(PKG_VERSION)-r$(PKG_RELEASE)
|
||||
VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
|
||||
else
|
||||
VERSION:=$(PKG_VERSION)
|
||||
endif
|
||||
@ -49,7 +49,7 @@ define Package/Default
|
||||
KCONFIG:=
|
||||
BUILDONLY:=
|
||||
HIDDEN:=
|
||||
URL:=$(PKG_URL)
|
||||
URL:=
|
||||
VARIANT:=
|
||||
DEFAULT_VARIANT:=
|
||||
USERID:=
|
||||
@ -80,7 +80,6 @@ CONFIGURE_ARGS = \
|
||||
--target=$(GNU_TARGET_NAME) \
|
||||
--host=$(GNU_TARGET_NAME) \
|
||||
--build=$(GNU_HOST_NAME) \
|
||||
--disable-dependency-tracking \
|
||||
--program-prefix="" \
|
||||
--program-suffix="" \
|
||||
--prefix=$(CONFIGURE_PREFIX) \
|
||||
@ -151,7 +150,6 @@ define Build/Install/Default
|
||||
$(MAKE_VARS) \
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
|
||||
$(MAKE_INSTALL_FLAGS) \
|
||||
$(if $(PKG_SUBDIRS),SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))') \
|
||||
$(if $(1), $(1), install);
|
||||
endef
|
||||
|
||||
|
@ -36,14 +36,13 @@ $(if $(USERID),Require-User: $(USERID)
|
||||
)Source: $(PKG_SOURCE)
|
||||
$(if $(LICENSE),License: $(LICENSE)
|
||||
)$(if $(LICENSE_FILES),LicenseFiles: $(LICENSE_FILES)
|
||||
)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
|
||||
)$(if $(URL),URL: $(URL)
|
||||
)$(if $(ABI_VERSION),ABI-Version: $(ABI_VERSION)
|
||||
)Type: $(if $(Package/$(1)/targets),$(Package/$(1)/targets),$(if $(PKG_TARGETS),$(PKG_TARGETS),ipkg))
|
||||
$(if $(KCONFIG),Kernel-Config: $(KCONFIG)
|
||||
)$(if $(BUILDONLY),Build-Only: $(BUILDONLY)
|
||||
)$(if $(HIDDEN),Hidden: $(HIDDEN)
|
||||
)Description: $(if $(Package/$(1)/description),$(Package/$(1)/description),$(TITLE))
|
||||
$(if $(URL),$(URL)
|
||||
)$(MAINTAINER)
|
||||
@@
|
||||
$(if $(Package/$(1)/config),Config:
|
||||
$(Package/$(1)/config)
|
||||
|
276
include/package-ipkg.mk
Normal file
276
include/package-ipkg.mk
Normal file
@ -0,0 +1,276 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2006-2020 OpenWrt.org
|
||||
|
||||
ifndef DUMP
|
||||
include $(INCLUDE_DIR)/feeds.mk
|
||||
endif
|
||||
|
||||
IPKG_REMOVE:= \
|
||||
$(SCRIPT_DIR)/ipkg-remove
|
||||
|
||||
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
|
||||
|
||||
# Generates a make statement to return a wildcard for candidate ipkg files
|
||||
# 1: package name
|
||||
define gen_ipkg_wildcard
|
||||
$(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])*
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
# 2: candidate ipk files
|
||||
define remove_ipkg_files
|
||||
$(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
# 2: variable name
|
||||
# 3: variable suffix
|
||||
# 4: file is a script
|
||||
define BuildIPKGVariable
|
||||
ifdef Package/$(1)/$(2)
|
||||
$$(IPKG_$(1)) : VAR_$(2)$(3)=$$(Package/$(1)/$(2))
|
||||
$(call shexport,Package/$(1)/$(2))
|
||||
$(1)_COMMANDS += echo "$$$$$$$$$(call shvar,Package/$(1)/$(2))" > $(2)$(3); $(if $(4),chmod 0755 $(2)$(3);)
|
||||
endif
|
||||
endef
|
||||
|
||||
PARENL :=(
|
||||
PARENR :=)
|
||||
|
||||
dep_split=$(subst :,$(space),$(1))
|
||||
dep_rem=$(subst !,,$(subst $(strip $(PARENL)),,$(subst $(strip $(PARENR)),,$(word 1,$(call dep_split,$(1))))))
|
||||
dep_and=dep_and_res:=$$(and $(subst $(space),$(comma),$(foreach cond,$(subst &&, ,$(1)),$$(CONFIG_$(cond)))))
|
||||
dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(eval $(call dep_and,$(cond)))$(dep_and_res)))
|
||||
dep_pos=$(if $(call dep_confvar,$(1)),$(call dep_val,$(1)))
|
||||
dep_neg=$(if $(call dep_confvar,$(1)),,$(call dep_val,$(1)))
|
||||
dep_if=$(if $(findstring !,$(1)),$(call dep_neg,$(1)),$(call dep_pos,$(1)))
|
||||
dep_val=$(word 2,$(call dep_split,$(1)))
|
||||
strip_deps=$(strip $(subst +,,$(filter-out @%,$(1))))
|
||||
filter_deps=$(foreach dep,$(call strip_deps,$(1)),$(if $(findstring :,$(dep)),$(call dep_if,$(dep)),$(dep)))
|
||||
|
||||
define AddDependency
|
||||
$$(if $(1),$$(if $(2),$$(foreach pkg,$(1),$$(IPKG_$$(pkg))): $$(foreach pkg,$(2),$$(IPKG_$$(pkg)))))
|
||||
endef
|
||||
|
||||
define FixupReverseDependencies
|
||||
DEPS := $$(filter %:$(1),$$(IDEPEND))
|
||||
DEPS := $$(patsubst %:$(1),%,$$(DEPS))
|
||||
DEPS := $$(filter $$(DEPS),$$(IPKGS))
|
||||
$(call AddDependency,$$(DEPS),$(1))
|
||||
endef
|
||||
|
||||
define FixupDependencies
|
||||
DEPS := $$(filter $(1):%,$$(IDEPEND))
|
||||
DEPS := $$(patsubst $(1):%,%,$$(DEPS))
|
||||
DEPS := $$(filter $$(DEPS),$$(IPKGS))
|
||||
$(call AddDependency,$(1),$$(DEPS))
|
||||
endef
|
||||
|
||||
ifneq ($(PKG_NAME),toolchain)
|
||||
define CheckDependencies
|
||||
@( \
|
||||
rm -f $(PKG_INFO_DIR)/$(1).missing; \
|
||||
( \
|
||||
export \
|
||||
READELF=$(TARGET_CROSS)readelf \
|
||||
OBJCOPY=$(TARGET_CROSS)objcopy \
|
||||
XARGS="$(XARGS)"; \
|
||||
$(SCRIPT_DIR)/gen-dependencies.sh "$$(IDIR_$(1))"; \
|
||||
) | while read FILE; do \
|
||||
grep -qxF "$$$$FILE" $(PKG_INFO_DIR)/$(1).provides || \
|
||||
echo "$$$$FILE" >> $(PKG_INFO_DIR)/$(1).missing; \
|
||||
done; \
|
||||
if [ -f "$(PKG_INFO_DIR)/$(1).missing" ]; then \
|
||||
echo "Package $(1) is missing dependencies for the following libraries:" >&2; \
|
||||
cat "$(PKG_INFO_DIR)/$(1).missing" >&2; \
|
||||
false; \
|
||||
fi; \
|
||||
)
|
||||
endef
|
||||
endif
|
||||
|
||||
_addsep=$(word 1,$(1))$(foreach w,$(wordlist 2,$(words $(1)),$(1)),$(strip $(2) $(w)))
|
||||
_cleansep=$(subst $(space)$(2)$(space),$(2)$(space),$(1))
|
||||
mergelist=$(call _cleansep,$(call _addsep,$(1),$(comma)),$(comma))
|
||||
addfield=$(if $(strip $(2)),$(1): $(2))
|
||||
_define=define
|
||||
_endef=endef
|
||||
|
||||
ifeq ($(DUMP),)
|
||||
define BuildTarget/ipkg
|
||||
ABIV_$(1):=$(call FormatABISuffix,$(1),$(ABI_VERSION))
|
||||
PDIR_$(1):=$(call FeedPackageDir,$(1))
|
||||
IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk
|
||||
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
||||
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
||||
|
||||
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS))))
|
||||
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
|
||||
do_install=
|
||||
ifdef Package/$(1)/install
|
||||
do_install=yes
|
||||
endif
|
||||
ifdef Package/$(1)/install-overlay
|
||||
do_install=yes
|
||||
endif
|
||||
ifdef do_install
|
||||
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
|
||||
IPKGS += $(1)
|
||||
$(_pkg_target)compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||
prepare-package-install: $$(IPKG_$(1))
|
||||
compile: $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
|
||||
else
|
||||
$(if $(CONFIG_PACKAGE_$(1)),$$(info WARNING: skipping $(1) -- package not selected))
|
||||
endif
|
||||
|
||||
.PHONY: $(PKG_INSTALL_STAMP).$(1)
|
||||
ifeq ($(CONFIG_PACKAGE_$(1)),y)
|
||||
compile: $(PKG_INSTALL_STAMP).$(1)
|
||||
endif
|
||||
$(PKG_INSTALL_STAMP).$(1): prepare-package-install
|
||||
echo "$(1)" >> $(PKG_INSTALL_STAMP)
|
||||
else
|
||||
$(if $(CONFIG_PACKAGE_$(1)),$$(warning WARNING: skipping $(1) -- package has no install section))
|
||||
endif
|
||||
endif
|
||||
|
||||
DEPENDS:=$(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
|
||||
IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS))
|
||||
IDEPEND += $$(patsubst %,$(1):%,$$(IDEPEND_$(1)))
|
||||
$(FixupDependencies)
|
||||
$(FixupReverseDependencies)
|
||||
|
||||
$(eval $(call BuildIPKGVariable,$(1),conffiles))
|
||||
$(eval $(call BuildIPKGVariable,$(1),preinst,,1))
|
||||
$(eval $(call BuildIPKGVariable,$(1),postinst,-pkg,1))
|
||||
$(eval $(call BuildIPKGVariable,$(1),prerm,-pkg,1))
|
||||
$(eval $(call BuildIPKGVariable,$(1),postrm,,1))
|
||||
|
||||
$(PKG_BUILD_DIR)/.pkgdir/$(1).installed : export PATH=$$(TARGET_PATH_PKG)
|
||||
$(PKG_BUILD_DIR)/.pkgdir/$(1).installed: $(STAMP_BUILT)
|
||||
rm -rf $$@ $(PKG_BUILD_DIR)/.pkgdir/$(1)
|
||||
mkdir -p $(PKG_BUILD_DIR)/.pkgdir/$(1)
|
||||
$(call Package/$(1)/install,$(PKG_BUILD_DIR)/.pkgdir/$(1))
|
||||
$(call Package/$(1)/install_lib,$(PKG_BUILD_DIR)/.pkgdir/$(1))
|
||||
touch $$@
|
||||
|
||||
$(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||
mkdir -p $(STAGING_DIR_ROOT)/stamp
|
||||
$(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || { \
|
||||
echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version; \
|
||||
$(foreach pkg,$(filter-out $(1),$(PROVIDES)), \
|
||||
cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version; \
|
||||
) \
|
||||
} )
|
||||
$(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy)
|
||||
touch $$@
|
||||
|
||||
Package/$(1)/DEPENDS := $$(call mergelist,$$(foreach dep,$$(filter-out @%,$$(IDEPEND_$(1))),$$(dep)$$(call GetABISuffix,$$(dep))))
|
||||
ifneq ($$(EXTRA_DEPENDS),)
|
||||
Package/$(1)/DEPENDS := $$(EXTRA_DEPENDS)$$(if $$(Package/$(1)/DEPENDS),$$(comma) $$(Package/$(1)/DEPENDS))
|
||||
endif
|
||||
|
||||
$(_define) Package/$(1)/CONTROL
|
||||
Package: $(1)$$(ABIV_$(1))
|
||||
Version: $(VERSION)
|
||||
$$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
|
||||
)$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS))
|
||||
)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1))))))
|
||||
)$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
|
||||
)$$(call addfield,Source,$(SOURCE)
|
||||
)$$(call addfield,SourceName,$(1)
|
||||
)$$(call addfield,License,$(LICENSE)
|
||||
)$$(call addfield,LicenseFiles,$(LICENSE_FILES)
|
||||
)$$(call addfield,Section,$(SECTION)
|
||||
)$$(call addfield,Require-User,$(USERID)
|
||||
)$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH)
|
||||
)$$(if $$(ABIV_$(1)),ABIVersion: $$(ABIV_$(1))
|
||||
)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
|
||||
)$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed
|
||||
)$(if $(filter essential,$(PKG_FLAGS)),Essential: yes
|
||||
)$(if $(MAINTAINER),Maintainer: $(MAINTAINER)
|
||||
)Architecture: $(PKGARCH)
|
||||
Installed-Size: 0
|
||||
$(_endef)
|
||||
|
||||
$$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL)
|
||||
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
|
||||
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
|
||||
$$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
|
||||
@rm -rf $$(IDIR_$(1)); \
|
||||
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
|
||||
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
|
||||
$(call Package/$(1)/install,$$(IDIR_$(1)))
|
||||
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
|
||||
$(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay)
|
||||
-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf
|
||||
@( \
|
||||
find $$(IDIR_$(1)) -name lib\*.so\* -or -name \*.ko | awk -F/ '{ print $$$$NF }'; \
|
||||
for file in $$(patsubst %,$(PKG_INFO_DIR)/%.provides,$$(IDEPEND_$(1))); do \
|
||||
if [ -f "$$$$file" ]; then \
|
||||
cat $$$$file; \
|
||||
fi; \
|
||||
done; $(Package/$(1)/extra_provides) \
|
||||
) | sort -u > $(PKG_INFO_DIR)/$(1).provides
|
||||
$(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
|
||||
$(CheckDependencies)
|
||||
|
||||
$(RSTRIP) $$(IDIR_$(1))
|
||||
|
||||
ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
|
||||
(cd $$(IDIR_$(1)); \
|
||||
( \
|
||||
find . -type f \! -path ./CONTROL/\* -exec $(MKHASH) sha256 -n \{\} \; 2> /dev/null | \
|
||||
sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
|
||||
) || true \
|
||||
)
|
||||
endif
|
||||
(cd $$(IDIR_$(1))/CONTROL; \
|
||||
( \
|
||||
echo "$$$$CONTROL"; \
|
||||
printf "Description: "; echo "$$$$DESCRIPTION" | sed -e 's,^[[:space:]]*, ,g'; \
|
||||
) > control; \
|
||||
chmod 644 control; \
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo "default_postinst \$$$$0 \$$$$@"; \
|
||||
) > postinst; \
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo "default_prerm \$$$$0 \$$$$@"; \
|
||||
) > prerm; \
|
||||
chmod 0755 postinst prerm; \
|
||||
$($(1)_COMMANDS) \
|
||||
)
|
||||
|
||||
ifneq ($$(KEEP_$(1)),)
|
||||
@( \
|
||||
keepfiles=""; \
|
||||
for x in $$(KEEP_$(1)); do \
|
||||
[ -f "$$(IDIR_$(1))/$$$$x" ] || keepfiles="$$$${keepfiles:+$$$$keepfiles }$$$$x"; \
|
||||
done; \
|
||||
[ -z "$$$$keepfiles" ] || { \
|
||||
mkdir -p $$(IDIR_$(1))/lib/upgrade/keep.d; \
|
||||
for x in $$$$keepfiles; do echo $$$$x >> $$(IDIR_$(1))/lib/upgrade/keep.d/$(1); done; \
|
||||
}; \
|
||||
)
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $$(PDIR_$(1))
|
||||
$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
|
||||
@[ -f $$(IPKG_$(1)) ]
|
||||
|
||||
$(1)-clean:
|
||||
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
|
||||
|
||||
clean: $(1)-clean
|
||||
|
||||
endef
|
||||
endif
|
@ -1,392 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2006-2022 OpenWrt.org
|
||||
|
||||
ifndef DUMP
|
||||
include $(INCLUDE_DIR)/feeds.mk
|
||||
endif
|
||||
|
||||
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
|
||||
|
||||
define description_escape
|
||||
$(subst `,\`,$(subst $$,\$$,$(subst ",\",$(subst \,\\,$(1)))))
|
||||
endef
|
||||
|
||||
# Generates a make statement to return a wildcard for candidate ipkg files
|
||||
# 1: package name
|
||||
define gen_package_wildcard
|
||||
$(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])*
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
# 2: candidate ipk files
|
||||
define remove_ipkg_files
|
||||
$(if $(strip $(2)),$(SCRIPT_DIR)/ipkg-remove $(1) $(2))
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
# 2: variable name
|
||||
# 3: variable suffix
|
||||
# 4: file is a script
|
||||
define BuildPackVariable
|
||||
ifdef Package/$(1)/$(2)
|
||||
$$(PACK_$(1)) : VAR_$(2)$(3)=$$(Package/$(1)/$(2))
|
||||
$(call shexport,Package/$(1)/$(2))
|
||||
$(1)_COMMANDS += echo "$$$$$$$$$(call shvar,Package/$(1)/$(2))" > $(2)$(3); $(if $(4),chmod 0755 $(2)$(3);)
|
||||
endif
|
||||
endef
|
||||
|
||||
PARENL :=(
|
||||
PARENR :=)
|
||||
|
||||
dep_split=$(subst :,$(space),$(1))
|
||||
dep_rem=$(subst !,,$(subst $(strip $(PARENL)),,$(subst $(strip $(PARENR)),,$(word 1,$(call dep_split,$(1))))))
|
||||
dep_and=dep_and_res:=$$(and $(subst $(space),$(comma),$(foreach cond,$(subst &&, ,$(1)),$$(CONFIG_$(cond)))))
|
||||
dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(eval $(call dep_and,$(cond)))$(dep_and_res)))
|
||||
dep_pos=$(if $(call dep_confvar,$(1)),$(call dep_val,$(1)))
|
||||
dep_neg=$(if $(call dep_confvar,$(1)),,$(call dep_val,$(1)))
|
||||
dep_if=$(if $(findstring !,$(1)),$(call dep_neg,$(1)),$(call dep_pos,$(1)))
|
||||
dep_val=$(word 2,$(call dep_split,$(1)))
|
||||
strip_deps=$(strip $(subst +,,$(filter-out @%,$(1))))
|
||||
filter_deps=$(foreach dep,$(call strip_deps,$(1)),$(if $(findstring :,$(dep)),$(call dep_if,$(dep)),$(dep)))
|
||||
|
||||
define AddDependency
|
||||
$$(if $(1),$$(if $(2),$$(foreach pkg,$(1),$$(PACK_$$(pkg))): $$(foreach pkg,$(2),$$(PACK_$$(pkg)))))
|
||||
endef
|
||||
|
||||
define FixupReverseDependencies
|
||||
DEPS := $$(filter %:$(1),$$(IDEPEND))
|
||||
DEPS := $$(patsubst %:$(1),%,$$(DEPS))
|
||||
DEPS := $$(filter $$(DEPS),$$(IPKGS))
|
||||
$(call AddDependency,$$(DEPS),$(1))
|
||||
endef
|
||||
|
||||
define FixupDependencies
|
||||
DEPS := $$(filter $(1):%,$$(IDEPEND))
|
||||
DEPS := $$(patsubst $(1):%,%,$$(DEPS))
|
||||
DEPS := $$(filter $$(DEPS),$$(IPKGS))
|
||||
$(call AddDependency,$(1),$$(DEPS))
|
||||
endef
|
||||
|
||||
ifneq ($(PKG_NAME),toolchain)
|
||||
define CheckDependencies
|
||||
@( \
|
||||
rm -f $(PKG_INFO_DIR)/$(1).missing; \
|
||||
( \
|
||||
export \
|
||||
READELF=$(TARGET_CROSS)readelf \
|
||||
OBJCOPY=$(TARGET_CROSS)objcopy \
|
||||
XARGS="$(XARGS)"; \
|
||||
$(SCRIPT_DIR)/gen-dependencies.sh "$$(IDIR_$(1))"; \
|
||||
) | while read FILE; do \
|
||||
grep -qxF "$$$$FILE" $(PKG_INFO_DIR)/$(1).provides || \
|
||||
echo "$$$$FILE" >> $(PKG_INFO_DIR)/$(1).missing; \
|
||||
done; \
|
||||
if [ -f "$(PKG_INFO_DIR)/$(1).missing" ]; then \
|
||||
echo "Package $(1) is missing dependencies for the following libraries:" >&2; \
|
||||
cat "$(PKG_INFO_DIR)/$(1).missing" >&2; \
|
||||
false; \
|
||||
fi; \
|
||||
)
|
||||
endef
|
||||
endif
|
||||
|
||||
_addsep=$(word 1,$(1))$(foreach w,$(wordlist 2,$(words $(1)),$(1)),$(strip $(2) $(w)))
|
||||
_cleansep=$(subst $(space)$(2)$(space),$(2)$(space),$(1))
|
||||
mergelist=$(call _cleansep,$(call _addsep,$(1),$(comma)),$(comma))
|
||||
addfield=$(if $(strip $(2)),$(1): $(2))
|
||||
_define=define
|
||||
_endef=endef
|
||||
|
||||
ifeq ($(DUMP),)
|
||||
define BuildTarget/ipkg
|
||||
ABIV_$(1):=$(call FormatABISuffix,$(1),$(ABI_VERSION))
|
||||
PDIR_$(1):=$(call FeedPackageDir,$(1))
|
||||
ifeq ($(CONFIG_USE_APK),)
|
||||
PACK_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk
|
||||
else
|
||||
PACK_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))-$(VERSION).apk
|
||||
endif
|
||||
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
||||
ADIR_$(1):=$(PKG_BUILD_DIR)/apk-$(PKGARCH)/$(1)
|
||||
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
||||
APK_SCRIPTS_$(1):=\
|
||||
--script "post-install:$$(ADIR_$(1))/post-install" \
|
||||
--script "pre-deinstall:$$(ADIR_$(1))/pre-deinstall"
|
||||
|
||||
ifdef Package/$(1)/postrm
|
||||
APK_SCRIPTS_$(1)+=--script "post-deinstall:$$(ADIR_$(1))/postrm"
|
||||
endif
|
||||
|
||||
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS))))
|
||||
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
|
||||
do_install=
|
||||
ifdef Package/$(1)/install
|
||||
do_install=yes
|
||||
endif
|
||||
ifdef Package/$(1)/install-overlay
|
||||
do_install=yes
|
||||
endif
|
||||
ifdef do_install
|
||||
ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
|
||||
IPKGS += $(1)
|
||||
$(_pkg_target)compile: $$(PACK_$(1)) $(PKG_INFO_DIR)/$(1).provides $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||
prepare-package-install: $$(PACK_$(1))
|
||||
compile: $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
|
||||
else
|
||||
$(if $(CONFIG_PACKAGE_$(1)),$$(info WARNING: skipping $(1) -- package not selected))
|
||||
endif
|
||||
|
||||
.PHONY: $(PKG_INSTALL_STAMP).$(1)
|
||||
ifeq ($(CONFIG_PACKAGE_$(1)),y)
|
||||
compile: $(PKG_INSTALL_STAMP).$(1)
|
||||
endif
|
||||
$(PKG_INSTALL_STAMP).$(1): prepare-package-install
|
||||
echo "$(1)" >> $(PKG_INSTALL_STAMP)
|
||||
else
|
||||
$(if $(CONFIG_PACKAGE_$(1)),$$(warning WARNING: skipping $(1) -- package has no install section))
|
||||
endif
|
||||
endif
|
||||
|
||||
DEPENDS:=$(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
|
||||
IDEPEND_$(1):=$$(call filter_deps,$$(DEPENDS))
|
||||
IDEPEND += $$(patsubst %,$(1):%,$$(IDEPEND_$(1)))
|
||||
$(FixupDependencies)
|
||||
$(FixupReverseDependencies)
|
||||
|
||||
$(eval $(call BuildPackVariable,$(1),conffiles))
|
||||
$(eval $(call BuildPackVariable,$(1),preinst,,1))
|
||||
$(eval $(call BuildPackVariable,$(1),postinst,-pkg,1))
|
||||
$(eval $(call BuildPackVariable,$(1),prerm,-pkg,1))
|
||||
$(eval $(call BuildPackVariable,$(1),postrm,,1))
|
||||
|
||||
$(PKG_BUILD_DIR)/.pkgdir/$(1).installed : export PATH=$$(TARGET_PATH_PKG)
|
||||
$(PKG_BUILD_DIR)/.pkgdir/$(1).installed: $(STAMP_BUILT)
|
||||
rm -rf $$@ $(PKG_BUILD_DIR)/.pkgdir/$(1)
|
||||
mkdir -p $(PKG_BUILD_DIR)/.pkgdir/$(1)
|
||||
$(call Package/$(1)/install,$(PKG_BUILD_DIR)/.pkgdir/$(1))
|
||||
$(call Package/$(1)/install_lib,$(PKG_BUILD_DIR)/.pkgdir/$(1))
|
||||
touch $$@
|
||||
|
||||
$(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(PKG_BUILD_DIR)/.pkgdir/$(1).installed
|
||||
mkdir -p $(STAGING_DIR_ROOT)/stamp
|
||||
$(if $(ABI_VERSION),echo '$(ABI_VERSION)' | cmp -s - $(PKG_INFO_DIR)/$(1).version || { \
|
||||
echo '$(ABI_VERSION)' > $(PKG_INFO_DIR)/$(1).version; \
|
||||
$(foreach pkg,$(filter-out $(1),$(PROVIDES)), \
|
||||
cp $(PKG_INFO_DIR)/$(1).version $(PKG_INFO_DIR)/$(pkg).version; \
|
||||
) \
|
||||
} )
|
||||
$(call locked,$(CP) $(PKG_BUILD_DIR)/.pkgdir/$(1)/. $(STAGING_DIR_ROOT)/,root-copy)
|
||||
touch $$@
|
||||
|
||||
Package/$(1)/DEPENDS := $$(call mergelist,$$(foreach dep,$$(filter-out @%,$$(IDEPEND_$(1))),$$(dep)$$(call GetABISuffix,$$(dep))))
|
||||
ifneq ($$(EXTRA_DEPENDS),)
|
||||
Package/$(1)/DEPENDS := $$(EXTRA_DEPENDS)$$(if $$(Package/$(1)/DEPENDS),$$(comma) $$(Package/$(1)/DEPENDS))
|
||||
endif
|
||||
|
||||
$(_define) Package/$(1)/CONTROL
|
||||
Package: $(1)$$(ABIV_$(1))
|
||||
Version: $(VERSION)
|
||||
$$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
|
||||
)$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS))
|
||||
)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(ABIV_$(1))))))
|
||||
)$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
|
||||
)$$(call addfield,Source,$(SOURCE)
|
||||
)$$(call addfield,SourceName,$(PKG_NAME)
|
||||
)$$(call addfield,License,$(LICENSE)
|
||||
)$$(call addfield,LicenseFiles,$(LICENSE_FILES)
|
||||
)$$(call addfield,Section,$(SECTION)
|
||||
)$$(call addfield,Require-User,$(USERID)
|
||||
)$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH)
|
||||
)$$(call addfield,URL,$(URL)
|
||||
)$$(if $$(ABIV_$(1)),ABIVersion: $$(ABIV_$(1))
|
||||
)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
|
||||
)$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed
|
||||
)$(if $(filter essential,$(PKG_FLAGS)),Essential: yes
|
||||
)$(if $(MAINTAINER),Maintainer: $(MAINTAINER)
|
||||
)Architecture: $(PKGARCH)
|
||||
Installed-Size: 0
|
||||
$(_endef)
|
||||
|
||||
$$(PACK_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL)
|
||||
$$(PACK_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
|
||||
$$(PACK_$(1)) : export PATH=$$(TARGET_PATH_PKG)
|
||||
$$(PACK_$(1)) : export PKG_SOURCE_DATE_EPOCH:=$(PKG_SOURCE_DATE_EPOCH)
|
||||
$(PKG_INFO_DIR)/$(1).provides $$(PACK_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-pack.mk
|
||||
rm -rf $$(IDIR_$(1))
|
||||
ifeq ($$(CONFIG_USE_APK),)
|
||||
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_package_wildcard,$(1))))
|
||||
else
|
||||
$$(call remove_ipkg_files,$(1),$$(call apk_package_files,$(call gen_package_wildcard,$(1))))
|
||||
endif
|
||||
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1)) $(PKG_INFO_DIR)
|
||||
$(call Package/$(1)/install,$$(IDIR_$(1)))
|
||||
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
|
||||
$(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay)
|
||||
-find $$(IDIR_$(1)) -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| $(XARGS) rm -rf
|
||||
@( \
|
||||
find $$(IDIR_$(1)) -name lib\*.so\* -or -name \*.ko | awk -F/ '{ print $$$$NF }'; \
|
||||
for file in $$(patsubst %,$(PKG_INFO_DIR)/%.provides,$$(IDEPEND_$(1))); do \
|
||||
if [ -f "$$$$file" ]; then \
|
||||
cat $$$$file; \
|
||||
fi; \
|
||||
done; $(Package/$(1)/extra_provides) \
|
||||
) | sort -u > $(PKG_INFO_DIR)/$(1).provides
|
||||
$(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
|
||||
$(CheckDependencies)
|
||||
|
||||
$(RSTRIP) $$(IDIR_$(1))
|
||||
|
||||
ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
|
||||
(cd $$(IDIR_$(1)); \
|
||||
( \
|
||||
find . -type f \! -path ./CONTROL/\* -exec $(MKHASH) sha256 -n \{\} \; 2> /dev/null | \
|
||||
sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
|
||||
) || true \
|
||||
)
|
||||
endif
|
||||
|
||||
ifneq ($$(KEEP_$(1)),)
|
||||
@( \
|
||||
keepfiles=""; \
|
||||
for x in $$(KEEP_$(1)); do \
|
||||
[ -f "$$(IDIR_$(1))/$$$$x" ] || keepfiles="$$$${keepfiles:+$$$$keepfiles }$$$$x"; \
|
||||
done; \
|
||||
[ -z "$$$$keepfiles" ] || { \
|
||||
mkdir -p $$(IDIR_$(1))/lib/upgrade/keep.d; \
|
||||
for x in $$$$keepfiles; do echo $$$$x >> $$(IDIR_$(1))/lib/upgrade/keep.d/$(1); done; \
|
||||
}; \
|
||||
)
|
||||
endif
|
||||
|
||||
$(INSTALL_DIR) $$(PDIR_$(1))/tmp
|
||||
|
||||
ifeq ($(CONFIG_USE_APK),)
|
||||
mkdir -p $$(IDIR_$(1))/CONTROL
|
||||
(cd $$(IDIR_$(1))/CONTROL; \
|
||||
( \
|
||||
echo "$$$$CONTROL"; \
|
||||
printf "Description: "; echo "$$$$DESCRIPTION" | sed -e 's,^[[:space:]]*, ,g'; \
|
||||
) > control; \
|
||||
chmod 644 control; \
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo "default_postinst \$$$$0 \$$$$@"; \
|
||||
) > postinst; \
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo "default_prerm \$$$$0 \$$$$@"; \
|
||||
) > prerm; \
|
||||
chmod 0755 postinst prerm; \
|
||||
$($(1)_COMMANDS) \
|
||||
)
|
||||
|
||||
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/bash $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
|
||||
else
|
||||
mkdir -p $$(ADIR_$(1))/
|
||||
mkdir -p $$(IDIR_$(1))/lib/apk/packages/
|
||||
|
||||
(cd $$(ADIR_$(1)); $($(1)_COMMANDS))
|
||||
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo 'export root="$$$${IPKG_INSTROOT}"'; \
|
||||
echo 'export pkgname="$(1)"'; \
|
||||
echo "add_group_and_user"; \
|
||||
echo "default_postinst"; \
|
||||
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/postinst-pkg"; \
|
||||
) > $$(ADIR_$(1))/post-install;
|
||||
|
||||
( \
|
||||
echo "#!/bin/sh"; \
|
||||
echo "[ -s "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
|
||||
echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
|
||||
echo 'export root="$$$${IPKG_INSTROOT}"'; \
|
||||
echo 'export pkgname="$(1)"'; \
|
||||
echo "default_prerm"; \
|
||||
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/prerm-pkg"; \
|
||||
) > $$(ADIR_$(1))/pre-deinstall;
|
||||
|
||||
[ ! -f $$(ADIR_$(1))/postrm ] || sed -zi 's/^\s*#!/#!/' "$$(ADIR_$(1))/postrm";
|
||||
|
||||
if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi;
|
||||
if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1).alternatives; fi;
|
||||
(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" > $$(IDIR_$(1))/lib/apk/packages/$(1).list)
|
||||
# Move conffiles to IDIR and build conffiles_static with csums
|
||||
if [ -f $$(ADIR_$(1))/conffiles ]; then \
|
||||
mv -f $$(ADIR_$(1))/conffiles $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \
|
||||
for file in $$$$(cat $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles); do \
|
||||
[ -f $$(IDIR_$(1))/$$$$file ] || continue; \
|
||||
csum=$$$$($(MKHASH) sha256 $$(IDIR_$(1))/$$$$file); \
|
||||
echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles_static; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# Some package (base-files) manually append stuff to conffiles
|
||||
# Append stuff from it and delete the CONTROL directory since everything else should be migrated
|
||||
if [ -f $$(IDIR_$(1))/CONTROL/conffiles ]; then \
|
||||
echo $$$$(IDIR_$(1))/CONTROL/conffiles >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles; \
|
||||
for file in $$$$(cat $$(IDIR_$(1))/CONTROL/conffiles); do \
|
||||
[ -f $$(IDIR_$(1))/$$$$file ] || continue; \
|
||||
csum=$$$$($(MKHASH) sha256 $$(IDIR_$(1))/$$$$file); \
|
||||
echo $$$$file $$$$csum >> $$(IDIR_$(1))/lib/apk/packages/$(1).conffiles_static; \
|
||||
done; \
|
||||
rm -rf $$(IDIR_$(1))/CONTROL/conffiles; \
|
||||
fi
|
||||
|
||||
if [ -z "$$$$(ls -A $$(IDIR_$(1))/CONTROL 2>/dev/null)" ]; then \
|
||||
rm -rf $$(IDIR_$(1))/CONTROL; \
|
||||
else \
|
||||
echo "CONTROL directory $$(IDIR_$(1))/CONTROL is not empty! This is not right and should be checked!" >&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk mkpkg \
|
||||
--info "name:$(1)$$(ABIV_$(1))" \
|
||||
--info "version:$(VERSION)" \
|
||||
--info "description:$$(call description_escape,$$(strip $$(Package/$(1)/description)))" \
|
||||
$(if $(findstring all,$(PKGARCH)),--info "arch:noarch",--info "arch:$(PKGARCH)") \
|
||||
--info "license:$(LICENSE)" \
|
||||
--info "origin:$(SOURCE)" \
|
||||
--info "url:$(URL)" \
|
||||
--info "maintainer:$(MAINTAINER)" \
|
||||
--info "provides:$$(foreach prov,\
|
||||
$$(filter-out $(1)$$(ABIV_$(1)), \
|
||||
$(PROVIDES)$$(if $$(ABIV_$(1)), \
|
||||
$(1)=$(VERSION) $(foreach provide, \
|
||||
$(PROVIDES), \
|
||||
$(provide)$$(ABIV_$(1))=$(VERSION) \
|
||||
) \
|
||||
) \
|
||||
), \
|
||||
$$(prov) )" \
|
||||
$(if $(DEFAULT_VARIANT),--info "provider-priority:100",$(if $(PROVIDES),--info "provider-priority:1")) \
|
||||
$$(APK_SCRIPTS_$(1)) \
|
||||
--info "depends:$$(foreach depends,$$(subst $$(comma),$$(space),$$(subst $$(space),,$$(subst $$(paren_right),,$$(subst $$(paren_left),,$$(Package/$(1)/DEPENDS))))),$$(depends))" \
|
||||
--files "$$(IDIR_$(1))" \
|
||||
--output "$$(PACK_$(1))" \
|
||||
--sign "$(BUILD_KEY_APK_SEC)"
|
||||
endif
|
||||
|
||||
@[ -f $$(PACK_$(1)) ]
|
||||
|
||||
$(1)-clean:
|
||||
ifeq ($(CONFIG_USE_APK),)
|
||||
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_package_wildcard,$(1))))
|
||||
else
|
||||
$$(call remove_ipkg_files,$(1),$$(call apk_package_files,$(call gen_package_wildcard,$(1))))
|
||||
endif
|
||||
|
||||
|
||||
clean: $(1)-clean
|
||||
|
||||
endef
|
||||
endif
|
@ -11,7 +11,8 @@ include $(INCLUDE_DIR)/download.mk
|
||||
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
||||
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
||||
PKG_BUILD_PARALLEL ?=
|
||||
PKG_SKIP_DOWNLOAD=$(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT)
|
||||
PKG_USE_MIPS16 ?= 1
|
||||
PKG_IREMAP ?= 1
|
||||
|
||||
MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j))
|
||||
|
||||
@ -22,43 +23,15 @@ PKG_JOBS?=-j1
|
||||
else
|
||||
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1)
|
||||
endif
|
||||
|
||||
PKG_BUILD_FLAGS?=
|
||||
__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto no-mold,$(PKG_BUILD_FLAGS))
|
||||
ifneq ($(__unknown_flags),)
|
||||
$(error unknown PKG_BUILD_FLAGS: $(__unknown_flags))
|
||||
endif
|
||||
|
||||
# $1=flagname, $2=default (0/1)
|
||||
define pkg_build_flag
|
||||
$(if $(filter no-$(1),$(PKG_BUILD_FLAGS)),0,$(if $(filter $(1),$(PKG_BUILD_FLAGS)),1,$(2)))
|
||||
endef
|
||||
|
||||
ifeq ($(call pkg_build_flag,iremap,1),1)
|
||||
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
|
||||
TARGET_CFLAGS += $(IREMAP_CFLAGS)
|
||||
endif
|
||||
ifdef CONFIG_USE_MIPS16
|
||||
ifeq ($(call pkg_build_flag,mips16,1),1)
|
||||
ifeq ($(strip $(PKG_USE_MIPS16)),1)
|
||||
TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS))
|
||||
TARGET_CFLAGS += -mips16 -minterlink-mips16
|
||||
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
|
||||
endif
|
||||
endif
|
||||
ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1)
|
||||
TARGET_CFLAGS+= -ffunction-sections -fdata-sections
|
||||
TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS+= -Wl,--gc-sections
|
||||
endif
|
||||
ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1)
|
||||
TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects
|
||||
TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects
|
||||
TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin
|
||||
endif
|
||||
ifdef CONFIG_USE_MOLD
|
||||
ifeq ($(call pkg_build_flag,mold,1),1)
|
||||
TARGET_LINKER:=mold
|
||||
endif
|
||||
ifeq ($(strip $(PKG_IREMAP)),1)
|
||||
IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR)))
|
||||
TARGET_CFLAGS += $(IREMAP_CFLAGS)
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/hardening.mk
|
||||
@ -111,7 +84,7 @@ ifneq ($(PREV_STAMP_PREPARED),)
|
||||
STAMP_PREPARED:=$(PREV_STAMP_PREPARED)
|
||||
CONFIG_AUTOREBUILD:=
|
||||
else
|
||||
STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS)))
|
||||
STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS)))
|
||||
endif
|
||||
STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
|
||||
STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_*
|
||||
@ -136,7 +109,7 @@ PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD
|
||||
|
||||
include $(INCLUDE_DIR)/package-defaults.mk
|
||||
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
||||
include $(INCLUDE_DIR)/package-pack.mk
|
||||
include $(INCLUDE_DIR)/package-ipkg.mk
|
||||
include $(INCLUDE_DIR)/package-bin.mk
|
||||
include $(INCLUDE_DIR)/autotools.mk
|
||||
|
||||
@ -199,7 +172,6 @@ define Build/Exports/Default
|
||||
$(1) : export CONFIG_SITE:=$$(CONFIG_SITE)
|
||||
$(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH)
|
||||
$(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH)
|
||||
$(1) : export GIT_CEILING_DIRECTORIES:=$$(BUILD_DIR)
|
||||
endef
|
||||
Build/Exports=$(Build/Exports/Default)
|
||||
|
||||
@ -251,7 +223,7 @@ define Build/CoreTargets
|
||||
$(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG)
|
||||
$(STAMP_INSTALLED): $(STAMP_BUILT)
|
||||
rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME)
|
||||
mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages
|
||||
mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages
|
||||
$(foreach hook,$(Hooks/InstallDev/Pre),\
|
||||
$(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\
|
||||
)
|
||||
@ -286,13 +258,13 @@ define Build/CoreTargets
|
||||
ifneq ($(CONFIG_AUTOREMOVE),)
|
||||
compile:
|
||||
-touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null
|
||||
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' -print0 | \
|
||||
$(XARGS) -0 rm -rf
|
||||
$(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \
|
||||
$(XARGS) rm -rf
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/DefaultTargets
|
||||
$(if $(PKG_SKIP_DOWNLOAD),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
|
||||
$(if $(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
|
||||
$(if $(DUMP),,$(Build/CoreTargets))
|
||||
|
||||
define Build/DefaultTargets
|
||||
@ -343,7 +315,7 @@ endef
|
||||
|
||||
Build/Prepare=$(call Build/Prepare/Default,)
|
||||
Build/Configure=$(call Build/Configure/Default,)
|
||||
Build/Compile=$(call Build/Compile/Default,$(if $(PKG_SUBDIRS),SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))'))
|
||||
Build/Compile=$(call Build/Compile/Default,)
|
||||
Build/Install=$(if $(PKG_INSTALL),$(call Build/Install/Default,))
|
||||
Build/Dist=$(call Build/Dist/Default,)
|
||||
Build/DistCheck=$(call Build/DistCheck/Default,)
|
||||
@ -370,9 +342,9 @@ clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build)
|
||||
|
||||
clean: force-clean-build
|
||||
$(CleanStaging)
|
||||
$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR)/host)
|
||||
$(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
|
||||
$(Build/Clean)
|
||||
rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST)
|
||||
rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST)
|
||||
|
||||
dist:
|
||||
$(Build/Dist)
|
||||
|
@ -8,13 +8,6 @@ include $(INCLUDE_DIR)/prereq.mk
|
||||
SHELL:=sh
|
||||
PKG_NAME:=Build dependency
|
||||
|
||||
$(eval $(call TestHostCommand,true, \
|
||||
Please install GNU 'coreutils', \
|
||||
$(TRUE)))
|
||||
|
||||
$(eval $(call TestHostCommand,false, \
|
||||
Please install GNU 'coreutils', \
|
||||
$(FALSE); [ $$$$$$$$? = 1 ] && $(TRUE)))
|
||||
|
||||
# Required for the toolchain
|
||||
$(eval $(call TestHostCommand,working-make, \
|
||||
@ -32,42 +25,34 @@ $(eval $(call TestHostCommand,proper-umask, \
|
||||
|
||||
ifndef IB
|
||||
$(eval $(call SetupHostCommand,gcc, \
|
||||
Please install the GNU C Compiler (gcc) 8 or later, \
|
||||
$(CC) -dumpversion | grep -E '^([8-9]\.?|1[0-9]\.?)', \
|
||||
gcc -dumpversion | grep -E '^([8-9]\.?|1[0-9]\.?)', \
|
||||
gcc-8 -dumpversion | grep -E '^([8-9]\.?|1[0-9]\.?)', \
|
||||
Please install the GNU C Compiler (gcc) 6 or later, \
|
||||
$(CC) -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
|
||||
gcc -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
|
||||
gcc --version | grep -E 'Apple.(LLVM|clang)' ))
|
||||
|
||||
$(eval $(call TestHostCommand,working-gcc, \
|
||||
Please reinstall the GNU C Compiler (8 or later) - \
|
||||
Please reinstall the GNU C Compiler (6 or later) - \
|
||||
it appears to be broken, \
|
||||
echo 'int main(int argc, char **argv) { return 0; }' | \
|
||||
$(STAGING_DIR_HOST)/bin/gcc -x c -o $(TMP_DIR)/a.out -))
|
||||
gcc -x c -o $(TMP_DIR)/a.out -))
|
||||
|
||||
$(eval $(call SetupHostCommand,g++, \
|
||||
Please install the GNU C++ Compiler (g++) 8 or later, \
|
||||
$(CXX) -dumpversion | grep -E '^([8-9]\.?|1[0-9]\.?)', \
|
||||
g++ -dumpversion | grep -E '^([8-9]\.?|1[0-9]\.?)', \
|
||||
g++-8 -dumpversion | grep -E '^([8-9]\.?|1[0-9]\.?)', \
|
||||
Please install the GNU C++ Compiler (g++) 6 or later, \
|
||||
$(CXX) -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
|
||||
g++ -dumpversion | grep -E '^([6-9]\.?|1[0-9]\.?)', \
|
||||
g++ --version | grep -E 'Apple.(LLVM|clang)' ))
|
||||
|
||||
$(eval $(call TestHostCommand,working-g++, \
|
||||
Please reinstall the GNU C++ Compiler (8 or later) - \
|
||||
Please reinstall the GNU C++ Compiler (6 or later) - \
|
||||
it appears to be broken, \
|
||||
echo 'int main(int argc, char **argv) { return 0; }' | \
|
||||
$(STAGING_DIR_HOST)/bin/g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
|
||||
g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
|
||||
$(TMP_DIR)/a.out))
|
||||
|
||||
$(eval $(call RequireCHeader,ncurses.h, \
|
||||
$(eval $(call TestHostCommand,ncurses, \
|
||||
Please install ncurses. (Missing libncurses.so or ncurses.h), \
|
||||
initscr(), -lncurses))
|
||||
|
||||
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
|
||||
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule, \
|
||||
git submodule --help | grep -- --recursive))
|
||||
|
||||
$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \
|
||||
rsync --version </dev/null))
|
||||
echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
|
||||
gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
|
||||
endif # IB
|
||||
|
||||
ifeq ($(HOST_OS),Linux)
|
||||
@ -96,10 +81,6 @@ $(eval $(call TestHostCommand,perl-thread-queue, \
|
||||
Please install the Perl Thread::Queue module, \
|
||||
perl -MThread::Queue -e 1))
|
||||
|
||||
$(eval $(call TestHostCommand,perl-ipc-cmd, \
|
||||
Please install the Perl IPC:Cmd module, \
|
||||
perl -MIPC::Cmd -e 1))
|
||||
|
||||
$(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
|
||||
gtar --version 2>&1 | grep GNU, \
|
||||
gnutar --version 2>&1 | grep GNU, \
|
||||
@ -149,21 +130,13 @@ $(eval $(call SetupHostCommand,getopt, \
|
||||
Please install an extended getopt version that supports --long, \
|
||||
gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
|
||||
getopt -o t --long test -- --test | grep '^ *--test *--', \
|
||||
/usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
|
||||
/opt/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
|
||||
|
||||
$(eval $(call SetupHostCommand,realpath,Please install a 'realpath' utility, \
|
||||
grealpath /, \
|
||||
realpath /))
|
||||
/usr/local/opt/gnu-getopt/bin/getopt -o t --long test -- --test | grep '^ *--test *--'))
|
||||
|
||||
$(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
|
||||
gnustat -c%s $(TOPDIR)/Makefile, \
|
||||
gstat -c%s $(TOPDIR)/Makefile, \
|
||||
stat -c%s $(TOPDIR)/Makefile))
|
||||
|
||||
$(eval $(call SetupHostCommand,gzip,Please install 'gzip', \
|
||||
gzip --version </dev/null))
|
||||
|
||||
$(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
|
||||
unzip 2>&1 | grep zipfile, \
|
||||
unzip))
|
||||
@ -181,64 +154,48 @@ $(eval $(call SetupHostCommand,install,Please install GNU 'install', \
|
||||
$(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
|
||||
perl --version | grep "perl.*v5"))
|
||||
|
||||
$(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
python3.11 -V 2>&1 | grep 'Python 3', \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
python3.9 -V 2>&1 | grep 'Python 3', \
|
||||
python3.8 -V 2>&1 | grep 'Python 3', \
|
||||
python3.7 -V 2>&1 | grep 'Python 3', \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?'))
|
||||
$(eval $(call CleanupPython2))
|
||||
|
||||
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
python3.11 -V 2>&1 | grep 'Python 3', \
|
||||
$(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
python3.9 -V 2>&1 | grep 'Python 3', \
|
||||
python3.8 -V 2>&1 | grep 'Python 3', \
|
||||
python3.7 -V 2>&1 | grep 'Python 3', \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?'))
|
||||
python3.6 -V 2>&1 | grep 'Python 3', \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
|
||||
|
||||
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \
|
||||
python3.10 -V 2>&1 | grep 'Python 3', \
|
||||
python3.9 -V 2>&1 | grep 'Python 3', \
|
||||
python3.8 -V 2>&1 | grep 'Python 3', \
|
||||
python3.7 -V 2>&1 | grep 'Python 3', \
|
||||
python3.6 -V 2>&1 | grep 'Python 3', \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.[6-9]\.?'))
|
||||
|
||||
$(eval $(call TestHostCommand,python3-distutils, \
|
||||
Please install the Python3 distutils module, \
|
||||
printf 'from sys import version_info\nif version_info < (3, 12):\n\tfrom distutils import util' | \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -))
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import distutils'))
|
||||
|
||||
$(eval $(call TestHostCommand,python3-stdlib, \
|
||||
Please install the Python3 stdlib module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import ntpath'))
|
||||
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
|
||||
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
|
||||
|
||||
$(eval $(call SetupHostCommand,file,Please install the 'file' package, \
|
||||
file --version 2>&1 | grep file))
|
||||
|
||||
$(eval $(call SetupHostCommand,rsync,Please install 'rsync', \
|
||||
rsync --version </dev/null))
|
||||
|
||||
$(eval $(call SetupHostCommand,which,Please install 'which', \
|
||||
/usr/bin/which which, \
|
||||
/bin/which which, \
|
||||
which which))
|
||||
|
||||
ifeq ($(HOST_OS),Linux)
|
||||
$(eval $(call RequireCHeader,argp.h, \
|
||||
Missing argp.h Please install the argp-standalone package if musl libc))
|
||||
|
||||
$(eval $(call RequireCHeader,fts.h, \
|
||||
Missing fts.h Please install the musl-fts-dev package if musl libc))
|
||||
|
||||
$(eval $(call RequireCHeader,obstack.h, \
|
||||
Missing obstack.h Please install the musl-obstack-dev package if musl libc))
|
||||
|
||||
$(eval $(call RequireCHeader,libintl.h, \
|
||||
Missing libintl.h Please install the musl-libintl package if musl libc))
|
||||
endif
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/xxd: $(SCRIPT_DIR)/xxdi.pl
|
||||
$(LN) $< $@
|
||||
|
||||
prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
|
||||
prereq: $(STAGING_DIR_HOST)/bin/mkhash
|
||||
|
||||
# Install ldconfig stub
|
||||
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
|
||||
$(LN) $(SCRIPT_DIR)/noop.sh $(STAGING_DIR_HOST)/bin/ldconfig))
|
||||
$(LN) /bin/true $(STAGING_DIR_HOST)/bin/ldconfig))
|
||||
|
@ -28,10 +28,8 @@ define Require
|
||||
|
||||
prereq-$(1): $(if $(PREREQ_PREV),prereq-$(PREREQ_PREV)) FORCE
|
||||
printf "Checking '$(1)'... "
|
||||
if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) PATH="$(ORIG_PATH)" >/dev/null 2>/dev/null; then \
|
||||
if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
|
||||
echo 'ok.'; \
|
||||
elif $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) PATH="$(ORIG_PATH)" >/dev/null 2>/dev/null; then \
|
||||
echo 'updated.'; \
|
||||
else \
|
||||
echo 'failed.'; \
|
||||
echo "$(PKG_NAME): $(strip $(2))" >> $(TMP_DIR)/.prereq-error; \
|
||||
@ -51,7 +49,7 @@ endef
|
||||
|
||||
define RequireCommand
|
||||
define Require/$(1)
|
||||
command -v $(1)
|
||||
which $(1)
|
||||
endef
|
||||
|
||||
$$(eval $$(call Require,$(1),$(2)))
|
||||
@ -65,16 +63,16 @@ define RequireHeader
|
||||
$$(eval $$(call Require,$(1),$(2)))
|
||||
endef
|
||||
|
||||
# 1: header to test
|
||||
# 2: failure message
|
||||
# 3: optional compile time test
|
||||
# 4: optional link library test (example -lncurses)
|
||||
define RequireCHeader
|
||||
define Require/$(1)
|
||||
echo 'int main(int argc, char **argv) { $(3); return 0; }' | gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4)
|
||||
define CleanupPython2
|
||||
define Require/python2-cleanup
|
||||
if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
|
||||
$(STAGING_DIR_HOST)/bin/python -V 2>&1 | \
|
||||
grep -q 'Python 2'; then \
|
||||
rm $(STAGING_DIR_HOST)/bin/python; \
|
||||
fi
|
||||
endef
|
||||
|
||||
$$(eval $$(call Require,$(1),$(2)))
|
||||
$$(eval $$(call Require,python2-cleanup))
|
||||
endef
|
||||
|
||||
define QuoteHostCommand
|
||||
@ -97,24 +95,19 @@ endef
|
||||
# 3+: candidates
|
||||
define SetupHostCommand
|
||||
define Require/$(1)
|
||||
mkdir -p "$(STAGING_DIR_HOST)/bin"; \
|
||||
[ -f "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0; \
|
||||
for cmd in $(call QuoteHostCommand,$(3)) $(call QuoteHostCommand,$(4)) \
|
||||
$(call QuoteHostCommand,$(5)) $(call QuoteHostCommand,$(6)) \
|
||||
$(call QuoteHostCommand,$(7)) $(call QuoteHostCommand,$(8)) \
|
||||
$(call QuoteHostCommand,$(9)) $(call QuoteHostCommand,$(10)) \
|
||||
$(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \
|
||||
if [ -n "$$$$$$$$cmd" ]; then \
|
||||
bin="$$$$$$$$(command -v "$$$$$$$${cmd%% *}")"; \
|
||||
bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
|
||||
which "$$$$$$$${cmd%% *}")"; \
|
||||
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
|
||||
case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \
|
||||
"-"* | \
|
||||
*" -> $$$$$$$$bin"* | \
|
||||
*" -> "[!/]*) \
|
||||
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
|
||||
;; \
|
||||
esac; \
|
||||
mkdir -p "$(STAGING_DIR_HOST)/bin"; \
|
||||
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
|
||||
exit 1; \
|
||||
exit 0; \
|
||||
fi; \
|
||||
fi; \
|
||||
done; \
|
||||
|
@ -34,8 +34,8 @@ endif
|
||||
ifneq ($(if $(DUMP),1,$(__quilt_inc)),1)
|
||||
__quilt_inc:=1
|
||||
|
||||
PATCH_DIR?=$(CURDIR)/patches
|
||||
FILES_DIR?=$(CURDIR)/files
|
||||
PATCH_DIR?=./patches
|
||||
FILES_DIR?=./files
|
||||
HOST_PATCH_DIR?=$(PATCH_DIR)
|
||||
HOST_FILES_DIR?=$(FILES_DIR)
|
||||
|
||||
@ -106,14 +106,13 @@ define Kernel/Patch/Default
|
||||
endef
|
||||
|
||||
define Quilt/RefreshDir
|
||||
-rm -rf $(2) 2>/dev/null >/dev/null
|
||||
[ -f $(1)/.quilt_no_patch ] || mkdir -p $(2)
|
||||
@[ -f $(1)/.quilt_no_patch ] || { \
|
||||
mkdir -p $(2)
|
||||
-rm -f $(2)/* 2>/dev/null >/dev/null
|
||||
@( \
|
||||
for patch in $$$$($(if $(3),grep "^$(3)",cat) $(1)/patches/series | awk '{print $$$$1}'); do \
|
||||
$(CP) -v "$(1)/patches/$$$$patch" $(2); \
|
||||
done; \
|
||||
}
|
||||
@-rm -f $(1)/.quilt_no_patch 2>/dev/null >/dev/null;
|
||||
)
|
||||
endef
|
||||
|
||||
define Quilt/Refresh/Host
|
||||
@ -157,7 +156,7 @@ define Quilt/Template
|
||||
}
|
||||
@[ -f "$(1)/patches/series" ] || { \
|
||||
echo "The source directory contains no quilt patches."; \
|
||||
touch $(1)/patches/series $(1)/.quilt_no_patch; \
|
||||
false; \
|
||||
}
|
||||
@[ -n "$$$$(ls $(1)/patches/series)" -o \
|
||||
"$$$$(cat $(1)/patches/series | $(MKHASH) md5)" = "$$(sort $(1)/patches/series | $(MKHASH) md5)" ] || { \
|
||||
@ -166,12 +165,10 @@ define Quilt/Template
|
||||
}
|
||||
|
||||
$(3)refresh: $(3)quilt-check
|
||||
@[ -f $(1)/.quilt_no_patch ] || { \
|
||||
cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null; \
|
||||
while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \
|
||||
QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \
|
||||
done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null; \
|
||||
}
|
||||
@cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null
|
||||
@cd "$(1)"; while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \
|
||||
QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \
|
||||
done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null
|
||||
$(Quilt/Refresh/$(4))
|
||||
|
||||
$(3)update: $(3)quilt-check
|
||||
|
@ -43,14 +43,6 @@ opkg = \
|
||||
--add-arch all:100 \
|
||||
--add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
|
||||
|
||||
apk = \
|
||||
IPKG_INSTROOT=$(1) \
|
||||
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk \
|
||||
--root $(1) \
|
||||
--keys-dir $(if $(APK_KEYS),$(APK_KEYS),$(TOPDIR)) \
|
||||
--no-logfile \
|
||||
--preserve-env
|
||||
|
||||
TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
|
||||
|
||||
ifdef CONFIG_CLEAN_IPKG
|
||||
@ -76,29 +68,14 @@ define prepare_rootfs
|
||||
@mkdir -p $(1)/var/lock
|
||||
@( \
|
||||
cd $(1); \
|
||||
if [ -n "$(CONFIG_USE_APK)" ]; then \
|
||||
IPKG_POSTINST_PATH=./lib/apk/db/*.post-install; \
|
||||
$(STAGING_DIR_HOST)/bin/tar -C ./lib/apk/db/ -xf ./lib/apk/db/scripts.tar --wildcards "*.post-install"; \
|
||||
else \
|
||||
IPKG_POSTINST_PATH=./usr/lib/opkg/info/*.postinst; \
|
||||
fi; \
|
||||
for script in $$IPKG_POSTINST_PATH; do \
|
||||
for script in ./usr/lib/opkg/info/*.postinst; do \
|
||||
IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
|
||||
ret=$$?; \
|
||||
if [ $$ret -ne 0 ]; then \
|
||||
echo "postinst script $$script has failed with exit code $$ret" >&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
[ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/tar --delete -f ./lib/apk/db/scripts.tar $$(basename $$script); \
|
||||
done; \
|
||||
if [ -z "$(CONFIG_USE_APK)" ]; then \
|
||||
$(if $(IB),,awk -i inplace \
|
||||
'/^Status:/ { \
|
||||
if ($$3 == "user") { $$3 = "ok" } \
|
||||
else { sub(/,\<user\>|\<user\>,/, "", $$3) } \
|
||||
}1' $(1)/usr/lib/opkg/status) ; \
|
||||
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status ;) \
|
||||
fi; \
|
||||
for script in ./etc/init.d/*; do \
|
||||
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
|
||||
if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \
|
||||
@ -110,12 +87,11 @@ define prepare_rootfs
|
||||
fi; \
|
||||
done || true \
|
||||
)
|
||||
|
||||
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status)
|
||||
@-find $(1) -name CVS -o -name .svn -o -name .git -o -name '.#*' | $(XARGS) rm -rf
|
||||
rm -rf \
|
||||
$(1)/boot \
|
||||
$(1)/tmp/* \
|
||||
$(1)/lib/apk/db/*.post-install* \
|
||||
$(1)/usr/lib/opkg/info/*.postinst* \
|
||||
$(1)/usr/lib/opkg/lists/* \
|
||||
$(1)/var/lock/*.lock
|
||||
|
@ -11,8 +11,7 @@ TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp
|
||||
FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE)
|
||||
OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
|
||||
|
||||
export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH))
|
||||
export PATH:=$(STAGING_DIR_HOST)/bin:$(PATH)
|
||||
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
|
||||
|
||||
define feedname
|
||||
$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1))))
|
||||
@ -50,8 +49,7 @@ define PackageDir
|
||||
$$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \
|
||||
echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \
|
||||
$(if $(3),echo Override: $(3),true); \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),$(MAKE),$(NO_TRACE_MAKE) --no-print-dir) -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),,2>/dev/null) || { \
|
||||
$(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \
|
||||
mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \
|
||||
$(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \
|
||||
$$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \
|
||||
@ -74,7 +72,7 @@ endif
|
||||
|
||||
$(FILELIST): $(OVERRIDELIST)
|
||||
rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-*
|
||||
find -L $(SCAN_DIR) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) $(SCAN_EXTRA) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
|
||||
find -L $(SCAN_DIR) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
|
||||
|
||||
$(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
|
||||
( \
|
||||
|
0
include/shell.sh
Normal file → Executable file
0
include/shell.sh
Normal file → Executable file
@ -37,7 +37,7 @@ ac_cv_func_rindex=yes
|
||||
ac_cv_func_setlocale=yes
|
||||
ac_cv_func_setgrent_void=yes
|
||||
ac_cv_func_setpgrp_void=yes
|
||||
ac_cv_func_setresuid=yes
|
||||
ac_cv_func_setresuid=no
|
||||
ac_cv_func_setvbuf_reversed=no
|
||||
ac_cv_func_stat_empty_string_bug=no
|
||||
ac_cv_func_stat_ignores_trailing_slash=no
|
||||
@ -53,6 +53,7 @@ ac_cv_have_control_in_msghdr=yes
|
||||
ac_cv_have_decl_sys_siglist=no
|
||||
ac_cv_have_openpty_ctty_bug=yes
|
||||
ac_cv_have_space_d_name_in_struct_dirent=yes
|
||||
ac_cv_header_netinet_sctp_h=no
|
||||
ac_cv_header_netinet_sctp_uio_h=no
|
||||
ac_cv_int64_t=yes
|
||||
ac_cv_lbl_unaligned_fail=no
|
||||
@ -65,12 +66,9 @@ ac_cv_sctp=no
|
||||
ac_cv_sys_restartable_syscalls=yes
|
||||
ac_cv_time_r_type=POSIX
|
||||
ac_cv_type_suseconds_t=yes
|
||||
ac_cv_size_t=yes
|
||||
ac_cv_ssize_t=yes
|
||||
ac_cv_uchar=no
|
||||
ac_cv_uint=yes
|
||||
ac_cv_uint64_t=yes
|
||||
ac_cv_uintptr_t=yes
|
||||
ac_cv_ulong=yes
|
||||
ac_cv_ushort=yes
|
||||
ac_cv_va_copy=C99
|
||||
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
. $TOPDIR/include/site/linux
|
||||
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
|
||||
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
|
||||
|
||||
ac_cv_sizeof___int64=0
|
||||
ac_cv_sizeof_char=1
|
||||
ac_cv_sizeof_int=4
|
||||
ac_cv_sizeof_int16_t=2
|
||||
ac_cv_sizeof_int32_t=4
|
||||
ac_cv_sizeof_int64_t=8
|
||||
ac_cv_sizeof_long_int=8
|
||||
ac_cv_sizeof_long_long=8
|
||||
ac_cv_sizeof_long=8
|
||||
ac_cv_sizeof_off_t=8
|
||||
ac_cv_sizeof_short_int=2
|
||||
ac_cv_sizeof_short=2
|
||||
ac_cv_sizeof_size_t=8
|
||||
ac_cv_sizeof_ssize_t=8
|
||||
ac_cv_sizeof_u_int16_t=2
|
||||
ac_cv_sizeof_u_int32_t=4
|
||||
ac_cv_sizeof_u_int64_t=8
|
||||
ac_cv_sizeof_uint16_t=2
|
||||
ac_cv_sizeof_uint32_t=4
|
||||
ac_cv_sizeof_uint64_t=8
|
||||
ac_cv_sizeof_unsigned_int=4
|
||||
ac_cv_sizeof_unsigned_long=8
|
||||
ac_cv_sizeof_unsigned_long_long=8
|
||||
ac_cv_sizeof_unsigned_short=2
|
||||
ac_cv_sizeof_void_p=8
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
. $TOPDIR/include/site/linux
|
||||
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
|
||||
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
|
||||
|
||||
ac_cv_sizeof___int64=8
|
||||
ac_cv_sizeof_char=1
|
||||
ac_cv_sizeof_int=4
|
||||
ac_cv_sizeof_int16_t=2
|
||||
ac_cv_sizeof_int32_t=4
|
||||
ac_cv_sizeof_int64_t=8
|
||||
ac_cv_sizeof_long_int=8
|
||||
ac_cv_sizeof_long_long=8
|
||||
ac_cv_sizeof_long=8
|
||||
ac_cv_sizeof_off_t=8
|
||||
ac_cv_sizeof_short_int=2
|
||||
ac_cv_sizeof_short=2
|
||||
ac_cv_sizeof_size_t=8
|
||||
ac_cv_sizeof_ssize_t=8
|
||||
ac_cv_sizeof_u_int16_t=2
|
||||
ac_cv_sizeof_u_int32_t=4
|
||||
ac_cv_sizeof_u_int64_t=8
|
||||
ac_cv_sizeof_uint16_t=2
|
||||
ac_cv_sizeof_uint32_t=4
|
||||
ac_cv_sizeof_uint64_t=8
|
||||
ac_cv_sizeof_unsigned_int=4
|
||||
ac_cv_sizeof_unsigned_long=8
|
||||
ac_cv_sizeof_unsigned_long_long=8
|
||||
ac_cv_sizeof_unsigned_short=2
|
||||
ac_cv_sizeof_void_p=8
|
@ -5,9 +5,6 @@
|
||||
ifeq ($(MAKECMDGOALS),prereq)
|
||||
SUBTARGETS:=prereq
|
||||
PREREQ_ONLY:=1
|
||||
# For target/linux related target add dtb to selectively compile dtbs
|
||||
else ifneq ($(filter target/linux/%,$(MAKECMDGOALS)),)
|
||||
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) dtb
|
||||
else
|
||||
SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
|
||||
endif
|
||||
|
@ -6,18 +6,10 @@
|
||||
ifneq ($(__target_inc),1)
|
||||
__target_inc=1
|
||||
|
||||
|
||||
##@
|
||||
# @brief Default device type ( basic | nas | router ).
|
||||
##
|
||||
# default device type
|
||||
DEVICE_TYPE?=router
|
||||
|
||||
##@
|
||||
# @brief Default packages.
|
||||
#
|
||||
# The really basic set. Additional packages are added based on @DEVICE_TYPE and
|
||||
# @CONFIG_* values.
|
||||
##
|
||||
# Default packages - the really basic set
|
||||
DEFAULT_PACKAGES:=\
|
||||
base-files \
|
||||
ca-bundle \
|
||||
@ -29,47 +21,45 @@ DEFAULT_PACKAGES:=\
|
||||
logd \
|
||||
mtd \
|
||||
netifd \
|
||||
opkg \
|
||||
uci \
|
||||
uclient-fetch \
|
||||
urandom-seed \
|
||||
urngd
|
||||
|
||||
##@
|
||||
# @brief Default packages for @DEVICE_TYPE basic.
|
||||
##
|
||||
ifneq ($(CONFIG_SELINUX),)
|
||||
DEFAULT_PACKAGES+=busybox-selinux procd-selinux
|
||||
else
|
||||
DEFAULT_PACKAGES+=busybox procd
|
||||
endif
|
||||
|
||||
# For the basic set
|
||||
DEFAULT_PACKAGES.basic:=
|
||||
##@
|
||||
# @brief Default packages for @DEVICE_TYPE nas.
|
||||
##
|
||||
# For nas targets
|
||||
DEFAULT_PACKAGES.nas:=\
|
||||
block-mount \
|
||||
fdisk \
|
||||
lsblk \
|
||||
mdadm
|
||||
##@
|
||||
# @brief Default packages for @DEVICE_TYPE router.
|
||||
##
|
||||
# For router targets
|
||||
DEFAULT_PACKAGES.router:=\
|
||||
dnsmasq-full \
|
||||
firewall4 \
|
||||
nftables \
|
||||
kmod-nft-offload \
|
||||
odhcp6c \
|
||||
odhcpd-ipv6only \
|
||||
firewall \
|
||||
iptables \
|
||||
ppp \
|
||||
ppp-mod-pppoe
|
||||
# For easy usage
|
||||
DEFAULT_PACKAGES.tweak:=\
|
||||
autocore \
|
||||
block-mount \
|
||||
default-settings-chn \
|
||||
kmod-ipt-raw \
|
||||
kmod-nf-nathelper \
|
||||
kmod-nf-nathelper-extra \
|
||||
luci-light \
|
||||
luci \
|
||||
luci-app-cpufreq \
|
||||
luci-app-package-manager \
|
||||
luci-compat \
|
||||
luci-lib-base \
|
||||
luci-app-filetransfer \
|
||||
luci-app-turboacc \
|
||||
luci-lib-fs \
|
||||
luci-lib-ipkg
|
||||
|
||||
ifneq ($(DUMP),)
|
||||
@ -78,7 +68,7 @@ endif
|
||||
|
||||
target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
|
||||
ifeq ($(DUMP),)
|
||||
PLATFORM_DIR:=$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(BOARD) $(TOPDIR)/target/linux/$(BOARD)))
|
||||
PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
|
||||
SUBTARGET:=$(strip $(foreach subdir,$(patsubst $(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if $(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir))))
|
||||
else
|
||||
PLATFORM_DIR:=${CURDIR}
|
||||
@ -103,29 +93,13 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# include ujail on systems with enough storage
|
||||
ifeq ($(filter small_flash,$(FEATURES)),)
|
||||
DEFAULT_PACKAGES+=procd-ujail
|
||||
endif
|
||||
# Add tweaked packages
|
||||
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.tweak)
|
||||
|
||||
# Add device specific packages (here below to allow device type set from subtarget)
|
||||
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
|
||||
|
||||
# Add tweaked packages
|
||||
# DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.tweak)
|
||||
|
||||
##@
|
||||
# @brief Filter out packages, prepended with `-`.
|
||||
#
|
||||
# @param 1: Package list.
|
||||
##
|
||||
filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1))
|
||||
|
||||
##@
|
||||
# @brief Append extra package dependencies.
|
||||
#
|
||||
# @param 1: Package list.
|
||||
##
|
||||
extra_packages = $(if $(filter wpad wpad-% nas,$(1)),iwinfo)
|
||||
|
||||
define ProfileDefault
|
||||
@ -202,30 +176,22 @@ USE_SUBTARGET_CONFIG = $(if $(wildcard $(LINUX_TARGET_CONFIG)),,$(if $(LINUX_SUB
|
||||
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG)))
|
||||
LINUX_RECONFIG_TARGET = $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG),$(LINUX_TARGET_CONFIG))
|
||||
|
||||
CFG_TARGET = $(CONFIG_TARGET)
|
||||
ifeq ($(CFG_TARGET),platform)
|
||||
CFG_TARGET = target
|
||||
$(warning Deprecation warning: use CONFIG_TARGET=target instead.)
|
||||
else ifeq ($(CFG_TARGET),subtarget_platform)
|
||||
CFG_TARGET = subtarget_target
|
||||
$(warning Deprecation warning: use CONFIG_TARGET=subtarget_target instead.)
|
||||
endif
|
||||
|
||||
# select the config file to be changed by kernel_menuconfig/kernel_oldconfig
|
||||
ifeq ($(CFG_TARGET),target)
|
||||
ifeq ($(CONFIG_TARGET),platform)
|
||||
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG))
|
||||
LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG)
|
||||
else ifeq ($(CFG_TARGET),subtarget)
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET),subtarget)
|
||||
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(LINUX_SUBTARGET_CONFIG))
|
||||
LINUX_RECONFIG_TARGET = $(LINUX_SUBTARGET_CONFIG)
|
||||
else ifeq ($(CFG_TARGET),subtarget_target)
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET),subtarget_platform)
|
||||
LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_SUBTARGET_CONFIG) $(LINUX_TARGET_CONFIG))
|
||||
LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG)
|
||||
else ifeq ($(CFG_TARGET),env)
|
||||
endif
|
||||
ifeq ($(CONFIG_TARGET),env)
|
||||
LINUX_RECONFIG_LIST = $(LINUX_KCONFIG_LIST)
|
||||
LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config
|
||||
else ifneq ($(strip $(CFG_TARGET)),)
|
||||
$(error CONFIG_TARGET=$(CFG_TARGET) is invalid. Valid: target|subtarget|subtarget_target|env)
|
||||
endif
|
||||
|
||||
__linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)
|
||||
@ -264,7 +230,6 @@ ifeq ($(DUMP),1)
|
||||
ifeq ($(ARCH),powerpc)
|
||||
CPU_CFLAGS_603e:=-mcpu=603e
|
||||
CPU_CFLAGS_8540:=-mcpu=8540
|
||||
CPU_CFLAGS_8548:=-mcpu=8548
|
||||
CPU_CFLAGS_405:=-mcpu=405
|
||||
CPU_CFLAGS_440:=-mcpu=440
|
||||
CPU_CFLAGS_464fp:=-mcpu=464fp
|
||||
@ -289,15 +254,6 @@ ifeq ($(DUMP),1)
|
||||
CPU_CFLAGS_arc700 = -mcpu=arc700
|
||||
CPU_CFLAGS_archs = -mcpu=archs
|
||||
endif
|
||||
ifeq ($(ARCH),riscv64)
|
||||
CPU_TYPE ?= riscv64
|
||||
CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc
|
||||
endif
|
||||
ifeq ($(ARCH),loongarch64)
|
||||
CPU_TYPE ?= generic
|
||||
CPU_CFLAGS := -O2 -pipe
|
||||
CPU_CFLAGS_generic:=-march=loongarch64
|
||||
endif
|
||||
ifneq ($(CPU_TYPE),)
|
||||
ifndef CPU_CFLAGS_$(CPU_TYPE)
|
||||
$(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type)
|
||||
@ -350,15 +306,7 @@ ifeq ($(DUMP),1)
|
||||
ifneq ($(CONFIG_CPU_MIPS32_R2),)
|
||||
FEATURES += mips16
|
||||
endif
|
||||
ifneq ($(CONFIG_CPU_V6),)
|
||||
FEATURES += arm_v6
|
||||
endif
|
||||
ifneq ($(CONFIG_CPU_V6K),)
|
||||
FEATURES += arm_v6
|
||||
endif
|
||||
ifneq ($(CONFIG_CPU_V7),)
|
||||
FEATURES += arm_v7
|
||||
endif
|
||||
FEATURES += $(foreach v,6 7,$(if $(CONFIG_CPU_V$(v)),arm_v$(v)))
|
||||
|
||||
# remove duplicates
|
||||
FEATURES:=$(sort $(FEATURES))
|
||||
@ -391,7 +339,6 @@ define BuildTargets/DumpCurrent
|
||||
echo 'Target-Description:'; \
|
||||
echo "$$$$DESCRIPTION"; \
|
||||
echo '@@'; \
|
||||
$(if $(DEFAULT_PROFILE),echo 'Target-Default-Profile: $(DEFAULT_PROFILE)';) \
|
||||
echo 'Default-Packages: $(DEFAULT_PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES))'; \
|
||||
$(DUMPINFO)
|
||||
$(if $(CUR_SUBTARGET),$(SUBMAKE) -r --no-print-directory -C image -s DUMP=1 SUBTARGET=$(CUR_SUBTARGET))
|
||||
|
@ -50,14 +50,12 @@ space:= $(empty) $(empty)
|
||||
path:=$(subst :,$(space),$(PATH))
|
||||
path:=$(filter-out .%,$(path))
|
||||
path:=$(subst $(space),:,$(path))
|
||||
export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH))
|
||||
export PATH:=$(path)
|
||||
export STAGING_DIR_HOST:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host),$(TOPDIR)/staging_dir/host)
|
||||
|
||||
unexport TAR_OPTIONS
|
||||
|
||||
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
|
||||
|
||||
SCAN_COOKIE?=$(shell echo $$$$)
|
||||
@ -67,7 +65,7 @@ SUBMAKE:=umask 022; $(SUBMAKE)
|
||||
|
||||
ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024;
|
||||
|
||||
prepare-mk: $(STAGING_DIR_HOST)/.prereq-build FORCE ;
|
||||
prepare-mk: staging_dir/host/.prereq-build FORCE ;
|
||||
|
||||
ifdef SDK
|
||||
IGNORE_PACKAGES = linux
|
||||
@ -76,11 +74,10 @@ endif
|
||||
_ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))
|
||||
|
||||
prepare-tmpinfo: FORCE
|
||||
@+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK)
|
||||
mkdir -p tmp/info feeds
|
||||
[ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base
|
||||
@+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK)
|
||||
mkdir -p tmp/info
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA=""
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=3 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
|
||||
for type in package target; do \
|
||||
f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
|
||||
[ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
|
||||
@ -154,7 +151,7 @@ xconfig: scripts/config/qconf prepare-tmpinfo FORCE
|
||||
|
||||
prepare_kernel_conf: .config toolchain/install FORCE
|
||||
|
||||
ifeq ($(wildcard $(STAGING_DIR_HOST)/bin/quilt),)
|
||||
ifeq ($(wildcard staging_dir/host/bin/quilt),)
|
||||
prepare_kernel_conf:
|
||||
@+$(SUBMAKE) -r tools/quilt/compile
|
||||
else
|
||||
@ -178,7 +175,7 @@ kernel_nconfig: prepare_kernel_conf
|
||||
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
|
||||
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
|
||||
echo "Prerequisite check failed. Use FORCE=1 to override."; \
|
||||
@ -201,7 +198,7 @@ else
|
||||
DOWNLOAD_DIRS = package/download
|
||||
endif
|
||||
|
||||
download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile)
|
||||
download: .config FORCE $(if $(wildcard $(TOPDIR)/staging_dir/host/bin/flock),,tools/flock/compile)
|
||||
@+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);)
|
||||
|
||||
clean dirclean: .config
|
||||
@ -213,7 +210,7 @@ prereq:: prepare-tmpinfo .config
|
||||
check: .config FORCE
|
||||
@+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s
|
||||
|
||||
val.% var.%: FORCE
|
||||
val.%: FORCE
|
||||
@+$(NO_TRACE_MAKE) -r -s $@ QUIET= V=s
|
||||
|
||||
WARN_PARALLEL_ERROR = $(if $(BUILD_LOG),,$(and $(filter -j,$(MAKEFLAGS)),$(findstring s,$(OPENWRT_VERBOSE))))
|
||||
@ -261,11 +258,11 @@ help:
|
||||
cat README.md
|
||||
|
||||
distclean:
|
||||
rm -rf bin build_dir .ccache .config* dl feeds key-build* logs package/feeds target/linux/feeds staging_dir tmp
|
||||
rm -rf bin build_dir .ccache .config* dl feeds key-build* logs package/feeds staging_dir tmp
|
||||
@$(_SINGLE)$(SUBMAKE) -C scripts/config clean
|
||||
|
||||
ifeq ($(findstring v,$(DEBUG)),)
|
||||
.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig $(STAGING_DIR_HOST)/.prereq-build tmp/.prereq-package prepare-tmpinfo
|
||||
.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig staging_dir/host/.prereq-build tmp/.prereq-package prepare-tmpinfo
|
||||
endif
|
||||
.PHONY: help FORCE
|
||||
.NOTPARALLEL:
|
||||
|
@ -1,9 +1,9 @@
|
||||
PKG_NAME ?= trusted-firmware-a
|
||||
PKG_CPE_ID ?= cpe:/a:arm: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://codeload.github.com/TrustedFirmware-A/trusted-firmware-a/tar.gz/v$(PKG_VERSION)?
|
||||
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)
|
||||
@ -63,27 +63,21 @@ define Build/Trusted-Firmware-A/Target
|
||||
URL:=https://www.trustedfirmware.org/projects/tf-a/
|
||||
endef
|
||||
|
||||
ifndef Package/trusted-firmware-a-$(1)/install
|
||||
define Package/trusted-firmware-a-$(1)/install
|
||||
define Package/trusted-firmware-a-$(1)/install
|
||||
$$(Package/trusted-firmware-a/install)
|
||||
endef
|
||||
endif
|
||||
endef
|
||||
endef
|
||||
|
||||
define Build/Configure/Trusted-Firmware-A
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
|
||||
endef
|
||||
|
||||
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
||||
|
||||
define Build/Compile/Trusted-Firmware-A
|
||||
+unset CC; \
|
||||
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) \
|
||||
OPENSSL_DIR=$(STAGING_DIR_HOST) \
|
||||
$(if $(DTC),DTC="$(DTC)") \
|
||||
PLAT=$(PLAT) \
|
||||
BUILD_STRING="ImmortalWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
|
||||
BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
|
||||
$(TFA_MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
include $(INCLUDE_DIR)/prereq.mk
|
||||
|
||||
PKG_NAME ?= u-boot
|
||||
|
||||
ifndef PKG_SOURCE_PROTO
|
||||
@ -18,32 +16,7 @@ PKG_FLAGS:=nonshared
|
||||
PKG_LICENSE:=GPL-2.0 GPL-2.0+
|
||||
PKG_LICENSE_FILES:=Licenses/README
|
||||
|
||||
PKG_BUILD_PARALLEL ?= 1
|
||||
|
||||
ifdef UBOOT_USE_BINMAN
|
||||
$(eval $(call TestHostCommand,python3-pyelftools, \
|
||||
Please install the Python3 elftools module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import elftools'))
|
||||
endif
|
||||
|
||||
ifdef UBOOT_USE_INTREE_DTC
|
||||
$(eval $(call TestHostCommand,python3-dev, \
|
||||
Please install the python3-dev package, \
|
||||
python3.11-config --includes 2>&1 | grep 'python3', \
|
||||
python3.10-config --includes 2>&1 | grep 'python3', \
|
||||
python3.9-config --includes 2>&1 | grep 'python3', \
|
||||
python3.8-config --includes 2>&1 | grep 'python3', \
|
||||
python3.7-config --includes 2>&1 | grep 'python3', \
|
||||
python3-config --includes 2>&1 | grep -E 'python3\.([7-9]|[0-9][0-9])\.?'))
|
||||
|
||||
$(eval $(call TestHostCommand,python3-setuptools, \
|
||||
Please install the Python3 setuptools module, \
|
||||
$(STAGING_DIR_HOST)/bin/python3 -c 'import setuptools'))
|
||||
|
||||
$(eval $(call TestHostCommand,swig, \
|
||||
Please install the swig package, \
|
||||
swig -version))
|
||||
endif
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
export GCC_HONOUR_COPTS=s
|
||||
|
||||
@ -69,7 +42,6 @@ endef
|
||||
TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
|
||||
|
||||
UBOOT_MAKE_FLAGS = \
|
||||
PATH=$(STAGING_DIR_HOST)/bin:$(PATH) \
|
||||
HOSTCC="$(HOSTCC)" \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
|
||||
@ -110,15 +82,10 @@ define Build/U-Boot/Target
|
||||
endef
|
||||
|
||||
define Build/Configure/U-Boot
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
|
||||
$(if $(strip $(UBOOT_CUSTOMIZE_CONFIG)),
|
||||
$(PKG_BUILD_DIR)/scripts/config --file $(PKG_BUILD_DIR)/.config $(UBOOT_CUSTOMIZE_CONFIG)
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) $(UBOOT_CONFIGURE_VARS) oldconfig)
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
|
||||
endef
|
||||
|
||||
ifndef UBOOT_USE_INTREE_DTC
|
||||
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
||||
endif
|
||||
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
||||
|
||||
define Build/Compile/U-Boot
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
|
@ -18,7 +18,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
|
||||
|
||||
ifeq ($(filter gz tgz,$(EXT)),$(EXT))
|
||||
EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
|
||||
DECOMPRESS_CMD:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc $(DL_DIR)/$(PKG_SOURCE) |
|
||||
DECOMPRESS_CMD:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) |
|
||||
endif
|
||||
ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT))
|
||||
EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
|
||||
@ -40,7 +40,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
|
||||
UNPACK_CMD=$(DECOMPRESS_CMD) $(TAR_CMD)
|
||||
endif
|
||||
ifeq ($(EXT),cpio)
|
||||
UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; $(STAGING_DIR_HOST)/bin/cpio -i -d)
|
||||
UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; cpio -i -d)
|
||||
endif
|
||||
ifeq ($(EXT),zip)
|
||||
UNPACK_CMD=$(UNZIP_CMD)
|
||||
@ -56,7 +56,7 @@ ifeq ($(strip $(UNPACK_CMD)),)
|
||||
endif
|
||||
# replace zcat with $(ZCAT), because some system don't support it properly
|
||||
ifeq ($(PKG_CAT),zcat)
|
||||
UNPACK_CMD=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD)
|
||||
UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -29,19 +29,13 @@ ifeq ($(IS_TTY),1)
|
||||
endif
|
||||
endif
|
||||
|
||||
define ERROR_MESSAGE
|
||||
{ \
|
||||
printf "$(_R)%s$(_N)\n" "$(1)" >&9 || \
|
||||
printf "$(_R)%s$(_N)\n" "$(1)"; \
|
||||
} >&2 2>/dev/null
|
||||
endef
|
||||
|
||||
ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
|
||||
define MESSAGE
|
||||
{ \
|
||||
printf "$(_Y)%s$(_N)\n" "$(1)" >&8 || \
|
||||
printf "$(_Y)%s$(_N)\n" "$(1)"; \
|
||||
} 2>/dev/null
|
||||
printf "$(_Y)%s$(_N)\n" "$(1)" >&8
|
||||
endef
|
||||
|
||||
define ERROR_MESSAGE
|
||||
printf "$(_R)%s$(_N)\n" "$(1)" >&8
|
||||
endef
|
||||
|
||||
ifeq ($(QUIET),1)
|
||||
@ -50,12 +44,9 @@ ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
|
||||
else
|
||||
_DIR:=
|
||||
endif
|
||||
_MESSAGE:=$(if $(MAKECMDGOALS),$(shell \
|
||||
_NULL:=$(if $(MAKECMDGOALS),$(shell \
|
||||
$(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
|
||||
))
|
||||
ifneq ($(strip $(_MESSAGE)),)
|
||||
$(info $(_MESSAGE))
|
||||
endif
|
||||
SUBMAKE=$(MAKE)
|
||||
else
|
||||
SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1)
|
||||
@ -69,4 +60,5 @@ else
|
||||
define MESSAGE
|
||||
printf "%s\n" "$(1)"
|
||||
endef
|
||||
ERROR_MESSAGE=$(MESSAGE)
|
||||
endif
|
||||
|
@ -6,9 +6,6 @@
|
||||
# Substituted by SDK, do not remove
|
||||
# REVISION:=x
|
||||
# SOURCE_DATE_EPOCH:=x
|
||||
# BASE_FILES_VERSION:=x
|
||||
# KERNEL_VERSION:=x
|
||||
# LIBC_VERSION:=x
|
||||
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_VERSION_HOME_URL \
|
||||
@ -21,19 +18,18 @@ PKG_CONFIG_DEPENDS += \
|
||||
CONFIG_VERSION_MANUFACTURER_URL \
|
||||
CONFIG_VERSION_PRODUCT \
|
||||
CONFIG_VERSION_SUPPORT_URL \
|
||||
CONFIG_VERSION_FIRMWARE_URL \
|
||||
CONFIG_VERSION_HWREV \
|
||||
|
||||
sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
|
||||
|
||||
VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
|
||||
VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),18.06-k5.4-SNAPSHOT)
|
||||
|
||||
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
|
||||
|
||||
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.immortalwrt.org/snapshots)
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.immortalwrt.org/releases/18.06-k5.4-SNAPSHOT)
|
||||
|
||||
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
|
||||
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),ImmortalWrt)
|
||||
@ -54,9 +50,6 @@ VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://immortalw
|
||||
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
|
||||
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://github.com/immortalwrt/immortalwrt/discussions)
|
||||
|
||||
VERSION_FIRMWARE_URL:=$(call qstrip,$(CONFIG_VERSION_FIRMWARE_URL))
|
||||
VERSION_FIRMWARE_URL:=$(if $(VERSION_FIRMWARE_URL),$(VERSION_FIRMWARE_URL),https://downloads.immortalwrt.org/)
|
||||
|
||||
VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
|
||||
VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
|
||||
|
||||
@ -102,7 +95,7 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
|
||||
-e 's,%d,\L$(call sed_escape,$(subst $(space),_,$(VERSION_DIST))),g' \
|
||||
-e 's,%R,$(call sed_escape,$(REVISION)),g' \
|
||||
-e 's,%T,$(call sed_escape,$(BOARD)),g' \
|
||||
-e 's,%S,$(call sed_escape,$(BOARD)/$(SUBTARGET)),g' \
|
||||
-e 's,%S,$(call sed_escape,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)),g' \
|
||||
-e 's,%A,$(call sed_escape,$(ARCH_PACKAGES)),g' \
|
||||
-e 's,%t,$(call sed_escape,$(VERSION_TAINTS)),g' \
|
||||
-e 's,%M,$(call sed_escape,$(VERSION_MANUFACTURER)),g' \
|
||||
@ -110,7 +103,6 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
|
||||
-e 's,%b,$(call sed_escape,$(VERSION_BUG_URL)),g' \
|
||||
-e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \
|
||||
-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
|
||||
-e 's,%f,$(call sed_escape,$(VERSION_FIRMWARE_URL)),g' \
|
||||
-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
|
||||
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' \
|
||||
-e 's,%B,$(call sed_escape,$(SOURCE_DATE_EPOCH)),g'
|
||||
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'
|
||||
|
||||
|
@ -53,60 +53,19 @@ $(curdir)/cleanup: $(TMP_DIR)/.build
|
||||
$(curdir)/merge:
|
||||
rm -rf $(PACKAGE_DIR_ALL)
|
||||
mkdir -p $(PACKAGE_DIR_ALL)
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
-$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.apk),ln -s $(pdir)/*.apk $(PACKAGE_DIR_ALL);))
|
||||
else
|
||||
-$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.ipk),ln -s $(pdir)/*.ipk $(PACKAGE_DIR_ALL);))
|
||||
endif
|
||||
|
||||
$(BUILD_KEY_APK_SEC):
|
||||
$(STAGING_DIR_HOST)/bin/openssl ecparam -name prime256v1 -genkey -noout -out $(BUILD_KEY_APK_SEC)
|
||||
|
||||
$(BUILD_KEY_APK_PUB): $(BUILD_KEY_APK_SEC)
|
||||
$(STAGING_DIR_HOST)/bin/openssl ec -in $(BUILD_KEY_APK_SEC) -pubout > $(BUILD_KEY_APK_PUB)
|
||||
|
||||
$(curdir)/merge-index: $(curdir)/merge
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
(cd $(PACKAGE_DIR_ALL) && $(STAGING_DIR_HOST)/bin/apk mkndx \
|
||||
--root $(TOPDIR) \
|
||||
--keys-dir $(TOPDIR) \
|
||||
--sign $(BUILD_KEY_APK_SEC) \
|
||||
--output packages.adb \
|
||||
*.apk; \
|
||||
)
|
||||
else
|
||||
(cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; )
|
||||
endif
|
||||
|
||||
ifndef SDK
|
||||
$(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR)
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
$(curdir)//compile += $(curdir)/system/apk/host/compile $(BUILD_KEY_APK_SEC) $(BUILD_KEY_APK_PUB)
|
||||
else
|
||||
$(curdir)/compile: $(curdir)/system/opkg/host/compile
|
||||
endif
|
||||
else
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
$(curdir)//compile += $(BUILD_KEY_APK_SEC) $(BUILD_KEY_APK_PUB)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(curdir)/merge-index
|
||||
$(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
|
||||
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
|
||||
rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
|
||||
mkdir -p $(TARGET_DIR)/tmp
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
$(file >$(TMP_DIR)/apk_install_list,\
|
||||
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
|
||||
$(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \
|
||||
--repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
|
||||
$$(cat $(TMP_DIR)/apk_install_list) \
|
||||
"base-files=$(shell cat $(TMP_DIR)/base-files.version)" \
|
||||
"libc=$(shell cat $(TMP_DIR)/libc.version)" \
|
||||
"kernel=$(shell cat $(TMP_DIR)/kernel.version)"
|
||||
|
||||
rm -rf $(TARGET_DIR)/run
|
||||
else
|
||||
$(file >$(TMP_DIR)/opkg_install_list,\
|
||||
$(call opkg_package_files,\
|
||||
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))))
|
||||
@ -117,7 +76,6 @@ else
|
||||
$(call opkg,$(TARGET_DIR)) flag $$flag `cat $$file`; \
|
||||
done; \
|
||||
done || true
|
||||
endif
|
||||
|
||||
$(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG)
|
||||
|
||||
@ -125,24 +83,6 @@ endif
|
||||
|
||||
$(curdir)/index: FORCE
|
||||
@echo Generating package index...
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
@for d in $(PACKAGE_SUBDIRS); do \
|
||||
mkdir -p $$d; \
|
||||
cd $$d || continue; \
|
||||
ls *.apk >/dev/null 2>&1 || continue; \
|
||||
$(STAGING_DIR_HOST)/bin/apk mkndx \
|
||||
--root $(TOPDIR) \
|
||||
--keys-dir $(TOPDIR) \
|
||||
--sign $(BUILD_KEY_APK_SEC) \
|
||||
--output packages.adb \
|
||||
*.apk; \
|
||||
echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
|
||||
$(STAGING_DIR_HOST)/bin/apk adbdump packages.adb | \
|
||||
awk '/- name: / {pkg = $$NF} ; / version: / {printf "\"%s\": \"%s\", ", pkg, $$NF}' | \
|
||||
sed 's/, $$//' >> index.json; \
|
||||
echo '}}' >> index.json; \
|
||||
done
|
||||
else
|
||||
@for d in $(PACKAGE_SUBDIRS); do ( \
|
||||
mkdir -p $$d; \
|
||||
cd $$d || continue; \
|
||||
@ -152,10 +92,6 @@ else
|
||||
$(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
|
||||
{ echo ""; echo ""; } >> Packages;; \
|
||||
esac; \
|
||||
echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
|
||||
sed -n -e 's/^Package: \(.*\)$$/"\1":/p' -e 's/^Version: \(.*\)$$/"\1",/p' Packages | tr '\n' ' ' >> index.json; \
|
||||
echo '}}' >> index.json; \
|
||||
sed -i 's/, }}/}}/' index.json; \
|
||||
gzip -9nc Packages > Packages.gz; \
|
||||
); done
|
||||
ifdef CONFIG_SIGNED_PACKAGES
|
||||
@ -166,15 +102,6 @@ ifdef CONFIG_SIGNED_PACKAGES
|
||||
$(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
|
||||
); done
|
||||
endif
|
||||
ifdef CONFIG_JSON_CYCLONEDX_SBOM
|
||||
@echo Creating CycloneDX package SBOMs...
|
||||
@for d in $(PACKAGE_SUBDIRS); do ( \
|
||||
[ -d $$d ] && \
|
||||
cd $$d || continue; \
|
||||
$(SCRIPT_DIR)/package-metadata.pl pkgcyclonedxsbom Packages.manifest > Packages.bom.cdx.json || true; \
|
||||
); done
|
||||
endif
|
||||
endif
|
||||
|
||||
$(curdir)/flags-install:= -j1
|
||||
|
||||
|
@ -39,14 +39,10 @@ endif
|
||||
define Package/base-files
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:= \
|
||||
+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring \
|
||||
+NAND_SUPPORT:ubi-utils +fstools +fwtool \
|
||||
+SELINUX:procd-selinux +!SELINUX:procd +USE_SECCOMP:procd-seccomp \
|
||||
+SELINUX:busybox-selinux +!SELINUX:busybox
|
||||
DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool
|
||||
TITLE:=Base filesystem for OpenWrt
|
||||
URL:=http://openwrt.org/
|
||||
VERSION:=$(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION)))
|
||||
VERSION:=$(PKG_RELEASE)-$(REVISION)
|
||||
endef
|
||||
|
||||
define Package/base-files/conffiles
|
||||
@ -81,7 +77,7 @@ endef
|
||||
define ImageConfigOptions
|
||||
mkdir -p $(1)/lib/preinit
|
||||
echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),4)' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_path="$(TARGET_INIT_PATH)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf
|
||||
@ -93,41 +89,17 @@ define ImageConfigOptions
|
||||
echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
echo 'pi_preinit_no_failsafe="$(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE)"' >>$(1)/lib/preinit/00_preinit.conf
|
||||
ifeq ($(CONFIG_TARGET_DEFAULT_LAN_IP_FROM_PREINIT),y)
|
||||
mkdir -p $(1)/etc/board.d
|
||||
echo '. /lib/functions/uci-defaults.sh' >$(1)/etc/board.d/99-lan-ip
|
||||
echo 'logger -t 99-lan-ip "setting custom default LAN IP"' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'board_config_update' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select network' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select lan' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_add_string ipaddr $(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_add_string netmask $(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select ..' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'json_select ..' >>$(1)/etc/board.d/99-lan-ip
|
||||
echo 'board_config_flush' >>$(1)/etc/board.d/99-lan-ip
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Quilt
|
||||
endef
|
||||
|
||||
define Build/Compile/Default
|
||||
|
||||
endef
|
||||
Build/Compile = $(Build/Compile/Default)
|
||||
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
ifndef CONFIG_BUILDBOT
|
||||
define Package/base-files/install-key
|
||||
mkdir -p $(1)/etc/apk/keys
|
||||
$(CP) $(BUILD_KEY_APK_PUB) $(1)/etc/apk/keys/
|
||||
endef
|
||||
endif
|
||||
else
|
||||
ifdef CONFIG_SIGNED_PACKAGES
|
||||
define Build/Configure
|
||||
[ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \
|
||||
@ -138,14 +110,12 @@ ifdef CONFIG_SIGNED_PACKAGES
|
||||
|
||||
endef
|
||||
|
||||
ifndef CONFIG_BUILDBOT
|
||||
define Package/base-files/install-key
|
||||
mkdir -p $(1)/etc/opkg/keys
|
||||
$(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub`
|
||||
|
||||
endef
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NAND_SUPPORT),)
|
||||
define Package/base-files/nand-support
|
||||
@ -211,8 +181,7 @@ define Package/base-files/install
|
||||
$(1)/usr/lib \
|
||||
$(1)/usr/bin \
|
||||
$(1)/sys \
|
||||
$(1)/www
|
||||
mkdir -p -m 750 \
|
||||
$(1)/www \
|
||||
$(1)/root
|
||||
|
||||
$(LN) /proc/mounts $(1)/etc/mtab
|
||||
@ -242,29 +211,12 @@ endif
|
||||
|
||||
$(if $(CONFIG_INCLUDE_CONFIG), \
|
||||
echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.config; \
|
||||
cat $(BIN_DIR)/config.buildinfo >>$(1)/etc/build.config; \
|
||||
cat $(BIN_DIR)/feeds.buildinfo >>$(1)/etc/build.feeds; \
|
||||
cat $(BIN_DIR)/version.buildinfo >>$(1)/etc/build.version)
|
||||
cat $(BIN_DIR)/config.seed >>$(1)/etc/build.config)
|
||||
|
||||
$(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \
|
||||
rm -f $(1)/etc/banner.failsafe,)
|
||||
|
||||
ifneq ($(CONFIG_USE_APK),)
|
||||
mkdir -p $(1)/etc/apk/repositories.d
|
||||
$(call FeedSourcesAppendAPK,$(1)/etc/apk/repositories.d/distfeeds.list)
|
||||
$(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories.d/distfeeds.list
|
||||
|
||||
rm -f $(1)/etc/uci-defaults/13_fix-group-user
|
||||
rm -f $(1)/sbin/pkg_check
|
||||
echo $(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION))) >$(TMP_DIR)/base-files.version
|
||||
else
|
||||
$(if $(CONFIG_CLEAN_IPKG),, \
|
||||
mkdir -p $(1)/etc/opkg; \
|
||||
$(call FeedSourcesAppendOPKG,$(1)/etc/opkg/distfeeds.conf); \
|
||||
$(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf); \
|
||||
$(VERSION_SED_SCRIPT) $(1)/etc/opkg/distfeeds.conf)
|
||||
$(if $(CONFIG_IPK_FILES_CHECKSUMS),, \
|
||||
rm -f $(1)/sbin/pkg_check)
|
||||
endif
|
||||
endef
|
||||
|
||||
ifneq ($(DUMP),1)
|
||||
|
@ -6,7 +6,7 @@ CFG=$1
|
||||
|
||||
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && {
|
||||
for a in $(ls /etc/board.d/*); do
|
||||
[ -s $a ] || continue;
|
||||
[ -x $a ] || continue;
|
||||
$(. $a)
|
||||
done
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ generate_static_network() {
|
||||
uci -q batch <<-EOF
|
||||
delete network.loopback
|
||||
set network.loopback='interface'
|
||||
set network.loopback.device='lo'
|
||||
set network.loopback.ifname='lo'
|
||||
set network.loopback.proto='static'
|
||||
set network.loopback.ipaddr='127.0.0.1'
|
||||
set network.loopback.netmask='255.0.0.0'
|
||||
@ -91,73 +91,58 @@ generate_static_network() {
|
||||
|
||||
addr_offset=2
|
||||
generate_network() {
|
||||
local ports device macaddr protocol type ipaddr netmask vlan
|
||||
local ports ifname macaddr protocol type ipaddr netmask vlan
|
||||
local bridge=$2
|
||||
|
||||
json_select network
|
||||
json_select "$1"
|
||||
json_get_vars device macaddr metric protocol ipaddr netmask vlan
|
||||
json_get_values ports ports
|
||||
json_get_vars ifname macaddr protocol ipaddr netmask vlan
|
||||
json_select ..
|
||||
json_select ..
|
||||
|
||||
[ -n "$device" -o -n "$ports" ] || return
|
||||
[ -n "$ifname" -o -n "$ports" ] || return
|
||||
|
||||
# Force bridge for "lan" as it may have other devices (e.g. wireless)
|
||||
# bridged
|
||||
[ "$1" = "lan" -a -z "$ports" ] && {
|
||||
ports="$device"
|
||||
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'
|
||||
EOF
|
||||
for port in $ports; do uci add_list network.@device[-1].ports="$port"; done
|
||||
[ -n "$macaddr" ] && {
|
||||
for port in $ports; do
|
||||
uci -q batch <<-EOF
|
||||
add network device
|
||||
set network.@device[-1].name='$port'
|
||||
set network.@device[-1].macaddr='$macaddr'
|
||||
EOF
|
||||
done
|
||||
}
|
||||
device=br-$1
|
||||
type=
|
||||
macaddr=""
|
||||
[ -n "$ports" ] && {
|
||||
type="bridge"
|
||||
ifname="$ports"
|
||||
}
|
||||
|
||||
[ -n "$bridge" ] && {
|
||||
[ -z "$ports" ] && ports="$device"
|
||||
if [ -z "$vlan" ]; then
|
||||
bridge_vlan_id=$((bridge_vlan_id + 1))
|
||||
vlan=$bridge_vlan_id
|
||||
fi
|
||||
generate_bridge_vlan $1 $bridge "$ports" $vlan
|
||||
device=$bridge.$vlan
|
||||
generate_bridge_vlan $1 $bridge "$ifname" $vlan
|
||||
ifname=$bridge.$vlan
|
||||
type=""
|
||||
}
|
||||
|
||||
if [ -n "$macaddr" ]; then
|
||||
uci -q batch <<-EOF
|
||||
add network device
|
||||
set network.@device[-1].name='$device'
|
||||
set network.@device[-1].macaddr='$macaddr'
|
||||
EOF
|
||||
fi
|
||||
|
||||
uci -q batch <<-EOF
|
||||
delete network.$1
|
||||
set network.$1='interface'
|
||||
set network.$1.type='$type'
|
||||
set network.$1.device='$device'
|
||||
set network.$1.metric='$metric'
|
||||
set network.$1.ifname='$ifname'
|
||||
set network.$1.proto='none'
|
||||
EOF
|
||||
|
||||
if [ -n "$macaddr" ]; then
|
||||
for name in $ifname; do
|
||||
uci -q batch <<-EOF
|
||||
delete network.$1_${name/./_}_dev
|
||||
set network.$1_${name/./_}_dev='device'
|
||||
set network.$1_${name/./_}_dev.name='$name'
|
||||
set network.$1_${name/./_}_dev.macaddr='$macaddr'
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
|
||||
case "$protocol" in
|
||||
static)
|
||||
local ipad
|
||||
@ -178,14 +163,14 @@ generate_network() {
|
||||
|
||||
dhcp)
|
||||
# fixup IPv6 slave interface if parent is a bridge
|
||||
[ "$type" = "bridge" ] && device="br-$1"
|
||||
[ "$type" = "bridge" ] && ifname="br-$1"
|
||||
|
||||
uci set network.$1.proto='dhcp'
|
||||
[ -e /proc/sys/net/ipv6 ] && {
|
||||
uci -q batch <<-EOF
|
||||
delete network.${1}6
|
||||
set network.${1}6='interface'
|
||||
set network.${1}6.device='$device'
|
||||
set network.${1}6.ifname='$ifname'
|
||||
set network.${1}6.proto='dhcpv6'
|
||||
EOF
|
||||
}
|
||||
@ -202,20 +187,11 @@ generate_network() {
|
||||
set network.$1.ipv6='1'
|
||||
delete network.${1}6
|
||||
set network.${1}6='interface'
|
||||
set network.${1}6.device='@${1}'
|
||||
set network.${1}6.ifname='@${1}'
|
||||
set network.${1}6.proto='dhcpv6'
|
||||
EOF
|
||||
}
|
||||
;;
|
||||
|
||||
ncm|\
|
||||
qmi|\
|
||||
mbim)
|
||||
uci -q batch <<-EOF
|
||||
set network.$1.proto='${protocol}'
|
||||
set network.$1.pdptype='ipv4'
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -312,10 +288,9 @@ generate_static_system() {
|
||||
delete system.@system[0]
|
||||
add system system
|
||||
set system.@system[-1].hostname='ImmortalWrt'
|
||||
set system.@system[-1].timezone='GMT0'
|
||||
set system.@system[-1].zonename='UTC'
|
||||
set system.@system[-1].timezone='UTC'
|
||||
set system.@system[-1].ttylogin='0'
|
||||
set system.@system[-1].log_size='128'
|
||||
set system.@system[-1].log_size='64'
|
||||
set system.@system[-1].urandom_seed='0'
|
||||
|
||||
delete system.ntp
|
||||
@ -335,18 +310,6 @@ generate_static_system() {
|
||||
uci -q set "system.@system[-1].hostname=$hostname"
|
||||
fi
|
||||
|
||||
local compat_version
|
||||
if json_get_var compat_version compat_version; then
|
||||
uci -q set "system.@system[-1].compat_version=$compat_version"
|
||||
else
|
||||
uci -q set "system.@system[-1].compat_version=1.0"
|
||||
fi
|
||||
|
||||
local timezone
|
||||
if json_get_var timezone timezone; then
|
||||
uci -q set "system.@system[-1].timezone=$timezone"
|
||||
fi
|
||||
|
||||
if json_is_a ntpserver array; then
|
||||
local keys key
|
||||
json_get_keys keys ntpserver
|
||||
@ -509,8 +472,6 @@ generate_gpioswitch() {
|
||||
json_init
|
||||
json_load "$(cat ${CFG})"
|
||||
|
||||
umask 077
|
||||
|
||||
if [ ! -s /etc/config/network ]; then
|
||||
bridge_name=""
|
||||
touch /etc/config/network
|
||||
|
@ -1,143 +1,71 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/ipv4.sh
|
||||
|
||||
PROG="$(basename "$0")"
|
||||
|
||||
# wrapper to convert an integer to an address, unless we're using
|
||||
# decimal output format.
|
||||
# hook for library function
|
||||
_ip2str() {
|
||||
local var="$1" n="$2"
|
||||
assert_uint32 "$n" || exit 1
|
||||
|
||||
if [ "$decimal" -ne 0 ]; then
|
||||
export -- "$var=$n"
|
||||
elif [ "$hexadecimal" -ne 0 ]; then
|
||||
export -- "$var=$(printf "%x" "$n")"
|
||||
else
|
||||
ip2str "$@"
|
||||
fi
|
||||
awk -f - $* <<EOF
|
||||
function bitcount(c) {
|
||||
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
|
||||
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
|
||||
c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
|
||||
c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
|
||||
c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
|
||||
return c
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage: $PROG [ -d | -x ] address/prefix [ start limit ]" >&2
|
||||
exit 1
|
||||
function ip2int(ip) {
|
||||
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
|
||||
return ret
|
||||
}
|
||||
|
||||
decimal=0
|
||||
hexadecimal=0
|
||||
if [ "$1" = "-d" ]; then
|
||||
decimal=1
|
||||
shift
|
||||
elif [ "$1" = "-x" ]; then
|
||||
hexadecimal=1
|
||||
shift
|
||||
fi
|
||||
function int2ip(ip,ret,x) {
|
||||
ret=and(ip,255)
|
||||
ip=rshift(ip,8)
|
||||
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
|
||||
return ret
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
fi
|
||||
function compl32(v) {
|
||||
ret=xor(v, 0xffffffff)
|
||||
return ret
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*/*.*)
|
||||
# data is n.n.n.n/m.m.m.m format, like on a Cisco router
|
||||
str2ip ipaddr "${1%/*}" || exit 1
|
||||
str2ip netmask "${1#*/}" || exit 1
|
||||
netmask2prefix prefix "$netmask" || exit 1
|
||||
shift
|
||||
;;
|
||||
*/*)
|
||||
# more modern prefix notation of n.n.n.n/p
|
||||
str2ip ipaddr "${1%/*}" || exit 1
|
||||
prefix="${1#*/}"
|
||||
assert_uint32 "$prefix" || exit 1
|
||||
if [ "$prefix" -gt 32 ]; then
|
||||
printf "Prefix out of range (%s)\n" "$prefix" >&2
|
||||
exit 1
|
||||
fi
|
||||
prefix2netmask netmask "$prefix" || exit 1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# address and netmask as two separate arguments
|
||||
str2ip ipaddr "$1" || exit 1
|
||||
str2ip netmask "$2" || exit 1
|
||||
netmask2prefix prefix "$netmask" || exit 1
|
||||
shift 2
|
||||
;;
|
||||
esac
|
||||
BEGIN {
|
||||
slpos=index(ARGV[1],"/")
|
||||
if (slpos == 0) {
|
||||
ipaddr=ip2int(ARGV[1])
|
||||
dotpos=index(ARGV[2],".")
|
||||
if (dotpos == 0)
|
||||
netmask=compl32(2**(32-int(ARGV[2]))-1)
|
||||
else
|
||||
netmask=ip2int(ARGV[2])
|
||||
} else {
|
||||
ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
|
||||
netmask=compl32(2**(32-int(substr(ARGV[1],slpos+1)))-1)
|
||||
ARGV[4]=ARGV[3]
|
||||
ARGV[3]=ARGV[2]
|
||||
}
|
||||
|
||||
# we either have no arguments left, or we have a range start and length
|
||||
if [ $# -ne 0 ] && [ $# -ne 2 ]; then
|
||||
usage
|
||||
fi
|
||||
network=and(ipaddr,netmask)
|
||||
broadcast=or(network,compl32(netmask))
|
||||
|
||||
# complement of the netmask, i.e. the hostmask
|
||||
hostmask=$((netmask ^ 0xffffffff))
|
||||
network=$((ipaddr & netmask))
|
||||
broadcast=$((network | hostmask))
|
||||
count=$((hostmask + 1))
|
||||
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
|
||||
limit=network+1
|
||||
if (start<limit) start=limit
|
||||
|
||||
_ip2str IP "$ipaddr"
|
||||
_ip2str NETMASK "$netmask"
|
||||
_ip2str NETWORK "$network"
|
||||
end=start+ARGV[4]
|
||||
limit=or(network,compl32(netmask))-1
|
||||
if (end>limit) end=limit
|
||||
|
||||
echo "IP=$IP"
|
||||
echo "NETMASK=$NETMASK"
|
||||
# don't include this-network or broadcast addresses
|
||||
if [ "$prefix" -le 30 ]; then
|
||||
_ip2str BROADCAST "$broadcast"
|
||||
echo "BROADCAST=$BROADCAST"
|
||||
fi
|
||||
echo "NETWORK=$NETWORK"
|
||||
echo "PREFIX=$prefix"
|
||||
echo "COUNT=$count"
|
||||
print "IP="int2ip(ipaddr)
|
||||
print "NETMASK="int2ip(netmask)
|
||||
print "BROADCAST="int2ip(broadcast)
|
||||
print "NETWORK="int2ip(network)
|
||||
print "PREFIX="32-bitcount(compl32(netmask))
|
||||
|
||||
# if there's no range, we're done
|
||||
[ $# -eq 0 ] && exit 0
|
||||
[ -z "$1$2" ] && exit 0
|
||||
# range calculations:
|
||||
# ipcalc <ip> <netmask> <start> <num>
|
||||
|
||||
if [ "$prefix" -le 30 ]; then
|
||||
lower=$((network + 1))
|
||||
else
|
||||
lower="$network"
|
||||
fi
|
||||
|
||||
start="$1"
|
||||
assert_uint32 "$start" || exit 1
|
||||
start=$((network | (start & hostmask)))
|
||||
[ "$start" -lt "$lower" ] && start="$lower"
|
||||
[ "$start" -eq "$ipaddr" ] && start=$((start + 1))
|
||||
|
||||
if [ "$prefix" -le 30 ]; then
|
||||
upper=$(((network | hostmask) - 1))
|
||||
elif [ "$prefix" -eq 31 ]; then
|
||||
upper=$((network | hostmask))
|
||||
else
|
||||
upper="$network"
|
||||
fi
|
||||
|
||||
range="$2"
|
||||
assert_uint32 "$range" || exit 1
|
||||
end=$((start + range - 1))
|
||||
[ "$end" -gt "$upper" ] && end="$upper"
|
||||
[ "$end" -eq "$ipaddr" ] && end=$((end - 1))
|
||||
|
||||
if [ "$start" -gt "$end" ]; then
|
||||
echo "network ($NETWORK/$prefix) too small" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_ip2str START "$start"
|
||||
_ip2str END "$end"
|
||||
|
||||
if [ "$start" -le "$ipaddr" ] && [ "$ipaddr" -le "$end" ]; then
|
||||
echo "error: address $IP inside range $START..$END" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "START=$START"
|
||||
echo "END=$END"
|
||||
|
||||
exit 0
|
||||
if (ARGC > 3) {
|
||||
print "START="int2ip(start)
|
||||
print "END="int2ip(end)
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
0
package/base-files/files/etc/bench.log
Normal file
0
package/base-files/files/etc/bench.log
Normal file
1
package/base-files/files/etc/board.d/99-default_network
Normal file → Executable file
1
package/base-files/files/etc/board.d/99-default_network
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2015 OpenWrt.org
|
||||
#
|
||||
|
0
package/base-files/files/etc/diag.sh
Normal file → Executable file
0
package/base-files/files/etc/diag.sh
Normal file → Executable file
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = "add" ] && /etc/init.d/led start "$DEVICENAME"
|
0
package/base-files/files/etc/hotplug.d/net/00-sysctl
Normal file → Executable file
0
package/base-files/files/etc/hotplug.d/net/00-sysctl
Normal file → Executable file
@ -10,6 +10,7 @@ uci_apply_defaults() {
|
||||
cd /etc/uci-defaults || return 0
|
||||
files="$(ls)"
|
||||
[ -z "$files" ] && return 0
|
||||
mkdir -p /tmp/.uci
|
||||
for file in $files; do
|
||||
( . "./$(basename $file)" ) && rm -f "$file"
|
||||
done
|
||||
@ -24,8 +25,6 @@ boot() {
|
||||
chmod 1777 /var/lock
|
||||
mkdir -p /var/log
|
||||
mkdir -p /var/run
|
||||
ln -s /var/run /run
|
||||
ln -s /var/lock /run/lock
|
||||
mkdir -p /var/state
|
||||
mkdir -p /var/tmp
|
||||
mkdir -p /tmp/.uci
|
||||
@ -34,14 +33,13 @@ boot() {
|
||||
touch /var/log/lastlog
|
||||
mkdir -p /tmp/resolv.conf.d
|
||||
touch /tmp/resolv.conf.d/resolv.conf.auto
|
||||
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf.auto
|
||||
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
|
||||
grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug
|
||||
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf.auto
|
||||
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
||||
grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
|
||||
grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore
|
||||
grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore
|
||||
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
||||
|
||||
touch /tmp/.config_pending
|
||||
/sbin/kmodloader
|
||||
|
||||
[ ! -f /etc/config/wireless ] && {
|
||||
@ -49,11 +47,7 @@ boot() {
|
||||
sleep 1
|
||||
}
|
||||
|
||||
mkdir -p /tmp/.uci
|
||||
[ -f /etc/uci-defaults/30_uboot-envtools ] && (. /etc/uci-defaults/30_uboot-envtools)
|
||||
/bin/config_generate
|
||||
rm -f /tmp/.config_pending
|
||||
/sbin/wifi config
|
||||
uci_apply_defaults
|
||||
sync
|
||||
|
||||
|
@ -5,7 +5,6 @@ START=95
|
||||
boot() {
|
||||
mount_root done
|
||||
rm -f /sysupgrade.tgz && sync
|
||||
rm -f /tmp/sysupgrade.tar && sync
|
||||
|
||||
# process user commands
|
||||
[ -f /etc/rc.local ] && {
|
||||
|
@ -3,43 +3,6 @@
|
||||
|
||||
START=96
|
||||
|
||||
extra_command "turnon" "Put the LEDs into their default state"
|
||||
extra_command "turnoff" "Turn all LEDs off"
|
||||
extra_command "blink" "Blink all LEDs"
|
||||
|
||||
led_color_set() {
|
||||
local cfg="$1"
|
||||
local sysfs="$2"
|
||||
|
||||
local max_b
|
||||
local colors
|
||||
local color
|
||||
local multi_intensity
|
||||
local value
|
||||
local write
|
||||
|
||||
[ -e /sys/class/leds/${sysfs}/multi_intensity ] || return
|
||||
[ -e /sys/class/leds/${sysfs}/multi_index ] || return
|
||||
|
||||
max_b="$(cat /sys/class/leds/${sysfs}/max_brightness)"
|
||||
colors="$(cat /sys/class/leds/${sysfs}/multi_index | tr " " "\n")"
|
||||
multi_intensity=""
|
||||
for color in $colors; do
|
||||
config_get value $1 "color_${color}" "0"
|
||||
[ "$value" -gt 0 ] && write=1
|
||||
[ "$value" -gt "$max_b" ] && value="$max_b"
|
||||
multi_intensity="${multi_intensity}${value} "
|
||||
done
|
||||
|
||||
# Check if any color is configured
|
||||
[ "$write" = 1 ] || return
|
||||
# Remove last whitespace
|
||||
multi_intensity="${multi_intensity:0:-1}"
|
||||
|
||||
echo "setting '${name}' led color to '${multi_intensity}'"
|
||||
echo "${multi_intensity}" > /sys/class/leds/${sysfs}/multi_intensity
|
||||
}
|
||||
|
||||
load_led() {
|
||||
local name
|
||||
local sysfs
|
||||
@ -51,7 +14,6 @@ load_led() {
|
||||
local delayon
|
||||
local delayoff
|
||||
local interval
|
||||
local brightness
|
||||
|
||||
config_get sysfs $1 sysfs
|
||||
config_get name $1 name "$sysfs"
|
||||
@ -67,10 +29,7 @@ load_led() {
|
||||
config_get delay $1 delay "150"
|
||||
config_get message $1 message ""
|
||||
config_get gpio $1 gpio "0"
|
||||
config_get_bool inverted $1 inverted "0"
|
||||
config_get brightness $1 brightness
|
||||
|
||||
[ "$2" ] && [ "$sysfs" != "$2" ] && return
|
||||
config_get inverted $1 inverted "0"
|
||||
|
||||
# execute application led trigger
|
||||
[ -f "/usr/libexec/led-trigger/${trigger}" ] && {
|
||||
@ -90,40 +49,26 @@ load_led() {
|
||||
[ -e /sys/class/leds/${sysfs}/brightness ] && {
|
||||
echo "setting up led ${name}"
|
||||
|
||||
printf "%s %s %d" \
|
||||
printf "%s %s %d\n" \
|
||||
"$sysfs" \
|
||||
"$(sed -ne 's/^.*\[\(.*\)\].*$/\1/p' /sys/class/leds/${sysfs}/trigger)" \
|
||||
"$(cat /sys/class/leds/${sysfs}/brightness)" \
|
||||
>> /var/run/led.state
|
||||
# Save default color if supported
|
||||
[ -e /sys/class/leds/${sysfs}/multi_intensity ] && {
|
||||
printf " %s" \
|
||||
"$(sed 's/\ /:/g' /sys/class/leds/${sysfs}/multi_intensity)" \
|
||||
>> /var/run/led.state
|
||||
}
|
||||
printf "\n" >> /var/run/led.state
|
||||
|
||||
[ "$default" = 0 ] &&
|
||||
echo 0 >/sys/class/leds/${sysfs}/brightness
|
||||
|
||||
[ "$default" = 1 ] && {
|
||||
[ -z "$brightness" ] && brightness="$(cat /sys/class/leds/${sysfs}/max_brightness)"
|
||||
echo "$brightness" > /sys/class/leds/${sysfs}/brightness
|
||||
}
|
||||
|
||||
led_color_set "$1" "$sysfs"
|
||||
|
||||
echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null
|
||||
ret="$?"
|
||||
|
||||
[ $default = 1 ] &&
|
||||
cat /sys/class/leds/${sysfs}/max_brightness > /sys/class/leds/${sysfs}/brightness
|
||||
|
||||
[ $ret = 0 ] || {
|
||||
echo >&2 "Skipping trigger '$trigger' for led '$name' due to missing kernel module"
|
||||
return 1
|
||||
}
|
||||
case "$trigger" in
|
||||
"heartbeat")
|
||||
echo "${inverted}" > "/sys/class/leds/${sysfs}/invert"
|
||||
;;
|
||||
|
||||
"netdev")
|
||||
[ -n "$dev" ] && {
|
||||
echo $dev > /sys/class/leds/${sysfs}/device_name
|
||||
@ -131,7 +76,7 @@ load_led() {
|
||||
[ -e "/sys/class/leds/${sysfs}/$m" ] && \
|
||||
echo 1 > /sys/class/leds/${sysfs}/$m
|
||||
done
|
||||
echo $interval > /sys/class/leds/${sysfs}/interval 2>/dev/null
|
||||
echo $interval > /sys/class/leds/${sysfs}/interval
|
||||
}
|
||||
;;
|
||||
|
||||
@ -176,55 +121,21 @@ load_led() {
|
||||
}
|
||||
}
|
||||
|
||||
turnoff() {
|
||||
for led in `ls /sys/class/leds/`; do
|
||||
echo 0 > /sys/class/leds/$led/brightness
|
||||
done
|
||||
}
|
||||
|
||||
turnon() {
|
||||
turnoff
|
||||
. /etc/diag.sh
|
||||
set_state done
|
||||
start
|
||||
}
|
||||
|
||||
blink() {
|
||||
for led in `ls /sys/class/leds/`; do
|
||||
echo 0 > /sys/class/leds/$led/brightness
|
||||
echo timer > /sys/class/leds/$led/trigger
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
[ "$(uci -q get system.@system[-1].leds_off)" = '1' ] && {
|
||||
turnoff
|
||||
exit 0
|
||||
}
|
||||
[ -e /sys/class/leds/ ] && {
|
||||
[ -s /var/run/led.state ] && {
|
||||
local led trigger brightness color
|
||||
while read led trigger brightness color; do
|
||||
[ "$1" ] && [ "$1" != "$led" ] && continue
|
||||
local led trigger brightness
|
||||
while read led trigger brightness; do
|
||||
[ -e "/sys/class/leds/$led/trigger" ] && \
|
||||
echo "$trigger" > "/sys/class/leds/$led/trigger"
|
||||
|
||||
[ -e "/sys/class/leds/$led/brightness" ] && \
|
||||
echo "$brightness" > "/sys/class/leds/$led/brightness"
|
||||
|
||||
[ -e "/sys/class/leds/$led/multi_intensity" ] && \
|
||||
echo "$color" | sed 's/:/\ /g' > \
|
||||
"/sys/class/leds/$led/multi_intensity"
|
||||
done < /var/run/led.state
|
||||
if [ "$1" ]; then
|
||||
grep -v "^$1 " /var/run/led.state > /var/run/led.state.new
|
||||
mv /var/run/led.state.new /var/run/led.state
|
||||
else
|
||||
rm /var/run/led.state
|
||||
fi
|
||||
rm /var/run/led.state
|
||||
}
|
||||
|
||||
config_load system
|
||||
config_foreach load_led led "$1"
|
||||
config_foreach load_led led
|
||||
}
|
||||
}
|
||||
|
@ -8,33 +8,23 @@ RTC_DEV=/dev/rtc0
|
||||
HWCLOCK=/sbin/hwclock
|
||||
|
||||
boot() {
|
||||
hwclock_load
|
||||
local maxtime="$(find_max_time)"
|
||||
start && exit 0
|
||||
|
||||
local maxtime="$(maxtime)"
|
||||
local curtime="$(date +%s)"
|
||||
if [ $curtime -lt $maxtime ]; then
|
||||
date -s @$maxtime
|
||||
hwclock_save
|
||||
fi
|
||||
[ $curtime -lt $maxtime ] && date -s @$maxtime
|
||||
}
|
||||
|
||||
start() {
|
||||
hwclock_load
|
||||
}
|
||||
|
||||
stop() {
|
||||
hwclock_save
|
||||
}
|
||||
|
||||
hwclock_load() {
|
||||
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV
|
||||
}
|
||||
|
||||
hwclock_save(){
|
||||
stop() {
|
||||
[ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \
|
||||
logger -t sysfixtime "saved '$(date)' to $RTC_DEV"
|
||||
}
|
||||
|
||||
find_max_time() {
|
||||
maxtime() {
|
||||
local file newest
|
||||
|
||||
for file in $( find /etc -type f ) ; do
|
||||
|
@ -9,8 +9,8 @@ validate_system_section() {
|
||||
'hostname:string:OpenWrt' \
|
||||
'conloglevel:uinteger' \
|
||||
'buffersize:uinteger' \
|
||||
'timezone:string:GMT0' \
|
||||
'zonename:string:UTC'
|
||||
'timezone:string:UTC' \
|
||||
'zonename:string'
|
||||
}
|
||||
|
||||
system_config() {
|
||||
|
@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
[ -e /tmp/.failsafe ] && export FAILSAFE=1
|
||||
|
||||
[ -f /etc/banner ] && cat /etc/banner
|
||||
[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
|
||||
|
||||
grep -Fsq '/ overlay ro,' /proc/mounts && {
|
||||
fgrep -sq '/ overlay ro,' /proc/mounts && {
|
||||
echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
|
||||
echo 'Please try to remove files from /overlay/upper/... and reboot!'
|
||||
}
|
||||
@ -12,7 +13,6 @@ export PATH="%PATH%"
|
||||
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
||||
export HOME=${HOME:-/root}
|
||||
export PS1='\u@\h:\w\$ '
|
||||
export ENV=/etc/shinit
|
||||
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
@ -20,13 +20,10 @@ case "$TERM" in
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -x /bin/more ] || alias more='less'
|
||||
[ -x /usr/bin/vim ] && alias vi='vim' || alias vim='vi'
|
||||
[ -x /bin/more ] || alias more=less
|
||||
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
|
||||
|
||||
alias l='ls -lF'
|
||||
alias la='ls -a'
|
||||
alias ll='ls -alF'
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -alF --color=auto'
|
||||
|
||||
[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
|
||||
|
||||
@ -51,24 +48,3 @@ in order to prevent unauthorized SSH logins.
|
||||
--------------------------------------------------
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/apk ]; then
|
||||
cat << EOF
|
||||
|
||||
OpenWrt recently switched to the "apk" package manager!
|
||||
|
||||
OPKG Command APK Equivalent Description
|
||||
------------------------------------------------------------------
|
||||
opkg install <pkg> apk add <pkg> Install a package
|
||||
opkg remove <pkg> apk del <pkg> Remove a package
|
||||
opkg upgrade apk upgrade Upgrade all packages
|
||||
opkg files <pkg> apk info -L <pkg> List package contents
|
||||
opkg list-installed apk info List installed packages
|
||||
opkg update apk update Update package lists
|
||||
opkg search <pkg> apk search <pkg> Search for packages
|
||||
------------------------------------------------------------------
|
||||
|
||||
For more https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
@ -23,7 +23,7 @@ released)
|
||||
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
|
||||
then
|
||||
echo "FACTORY RESET" > /dev/console
|
||||
factoryreset -y && reboot &
|
||||
jffs2reset -y && reboot &
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@ -100,10 +100,14 @@ service_triggers() {
|
||||
return 0
|
||||
}
|
||||
|
||||
service_running() {
|
||||
local instance="${1:-*}"
|
||||
service_data() {
|
||||
return 0
|
||||
}
|
||||
|
||||
procd_running "$(basename $initscript)" "$instance"
|
||||
service_running() {
|
||||
local service="${1:-$(basename $initscript)}"
|
||||
local instance="${2:-*}"
|
||||
procd_running "$service" "$instance" "$@"
|
||||
}
|
||||
|
||||
${INIT_TRACE:+set -x}
|
||||
|
0
package/base-files/files/etc/rc.local
Normal file → Executable file
0
package/base-files/files/etc/rc.local
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
root:::0:99999:7:::
|
||||
root::0:0:99999:7:::
|
||||
daemon:*:0:0:99999:7:::
|
||||
ftp:*:0:0:99999:7:::
|
||||
network:*:0:0:99999:7:::
|
||||
|
0
package/base-files/files/etc/shinit
Normal file → Executable file
0
package/base-files/files/etc/shinit
Normal file → Executable file
@ -1,2 +1 @@
|
||||
# User defined entries should be added to this file not to /etc/sysctl.d/* as
|
||||
# that directory is not backed-up by default and will not survive a reimage
|
||||
# Defaults are configured in /etc/sysctl.d/* and can be customized in this file
|
||||
|
@ -8,9 +8,6 @@ fs.suid_dumpable=2
|
||||
fs.protected_hardlinks=1
|
||||
fs.protected_symlinks=1
|
||||
|
||||
net.core.bpf_jit_enable=1
|
||||
net.core.bpf_jit_kallsyms=1
|
||||
|
||||
net.ipv4.conf.default.arp_ignore=1
|
||||
net.ipv4.conf.all.arp_ignore=1
|
||||
net.ipv4.ip_forward=1
|
||||
|
0
package/base-files/files/etc/uci-defaults/10_migrate-shadow
Normal file → Executable file
0
package/base-files/files/etc/uci-defaults/10_migrate-shadow
Normal file → Executable file
@ -1,49 +0,0 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
migrate_ports() {
|
||||
local config="$1"
|
||||
local type ports ifname
|
||||
|
||||
config_get type "$config" type
|
||||
[ "$type" != "bridge" ] && return
|
||||
|
||||
config_get ports "$config" ports
|
||||
[ -n "$ports" ] && return
|
||||
|
||||
config_get ifname "$config" ifname
|
||||
[ -z "$ifname" ] && return
|
||||
|
||||
for port in $ifname; do
|
||||
uci add_list network.$config.ports="$port"
|
||||
done
|
||||
uci delete network.$config.ifname
|
||||
}
|
||||
|
||||
migrate_bridge() {
|
||||
local config="$1"
|
||||
local type ifname
|
||||
|
||||
config_get type "$config" type
|
||||
[ "$type" != "bridge" ] && return
|
||||
|
||||
config_get ifname "$config" ifname
|
||||
|
||||
uci -q batch <<-EOF
|
||||
add network device
|
||||
set network.@device[-1].name='br-$config'
|
||||
set network.@device[-1].type='bridge'
|
||||
EOF
|
||||
for port in $ifname; do
|
||||
uci add_list network.@device[-1].ports="$port"
|
||||
done
|
||||
|
||||
uci -q batch <<-EOF
|
||||
delete network.$config.type
|
||||
delete network.$config.ifname
|
||||
set network.$config.device='br-$config'
|
||||
EOF
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach migrate_ports device
|
||||
config_foreach migrate_bridge interface
|
6
package/base-files/files/etc/uci-defaults/12_network-generate-ula
Normal file → Executable file
6
package/base-files/files/etc/uci-defaults/12_network-generate-ula
Normal file → Executable file
@ -1,7 +1,11 @@
|
||||
[ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
|
||||
|
||||
r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"')
|
||||
r2=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"')
|
||||
r3=$(dd if=/dev/urandom bs=2 count=1 |hexdump -e '2/1 "%02x"')
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.ula_prefix="$(hexdump -vn 5 -e '"fd" 1/1 "%02x:" 2/2 "%x:"' /dev/urandom):/48"
|
||||
set network.globals.ula_prefix=fd$r1:$r2:$r3::/48
|
||||
commit network
|
||||
EOF
|
||||
|
||||
|
3
package/base-files/files/etc/uci-defaults/13_fix-group-user
Normal file → Executable file
3
package/base-files/files/etc/uci-defaults/13_fix-group-user
Normal file → Executable file
@ -1,8 +1,5 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
# Skip if we don't have /usr/lib/opkg/info (APK installation)
|
||||
[ -d /usr/lib/opkg/info ] || exit 0
|
||||
|
||||
for file in $(grep -sl Require-User /usr/lib/opkg/info/*.control); do
|
||||
file="${file##*/}"
|
||||
file="${file%.control}"
|
||||
|
@ -1,18 +0,0 @@
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
json_init
|
||||
json_load "$(cat /etc/board.json)"
|
||||
|
||||
if json_is_a credentials object; then
|
||||
json_select credentials
|
||||
json_get_vars root_password_hash root_password_hash
|
||||
if [ -n "$root_password_hash" ]; then
|
||||
sed -i "s|^root:[^:]*|root:$root_password_hash|g" /etc/shadow
|
||||
fi
|
||||
|
||||
json_get_vars root_password_plain root_password_plain
|
||||
if [ -n "$root_password_plain" ]; then
|
||||
(echo "$root_password_plain"; sleep 1; echo "$root_password_plain") | passwd root
|
||||
fi
|
||||
json_select ..
|
||||
fi
|
@ -32,30 +32,6 @@ xor() {
|
||||
printf "%0${retlen}x" "$ret"
|
||||
}
|
||||
|
||||
data_2bin() {
|
||||
local data=$1
|
||||
local len=${#1}
|
||||
local bin_data
|
||||
|
||||
for i in $(seq 0 2 $(($len - 1))); do
|
||||
bin_data="${bin_data}\x${data:i:2}"
|
||||
done
|
||||
|
||||
echo -ne $bin_data
|
||||
}
|
||||
|
||||
data_2xor_val() {
|
||||
local data=$1
|
||||
local len=${#1}
|
||||
local xor_data
|
||||
|
||||
for i in $(seq 0 4 $(($len - 1))); do
|
||||
xor_data="${xor_data}${data:i:4} "
|
||||
done
|
||||
|
||||
echo -n ${xor_data:0:-1}
|
||||
}
|
||||
|
||||
append() {
|
||||
local var="$1"
|
||||
local value="$2"
|
||||
@ -64,14 +40,6 @@ append() {
|
||||
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
|
||||
}
|
||||
|
||||
prepend() {
|
||||
local var="$1"
|
||||
local value="$2"
|
||||
local sep="${3:- }"
|
||||
|
||||
eval "export ${NO_EXPORT:+-n} -- \"$var=\$value\${$var:+\${sep}\${$var}}\""
|
||||
}
|
||||
|
||||
list_contains() {
|
||||
local var="$1"
|
||||
local str="$2"
|
||||
@ -101,7 +69,7 @@ config () {
|
||||
local cfgtype="$1"
|
||||
local name="$2"
|
||||
|
||||
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$((CONFIG_NUM_SECTIONS + 1))
|
||||
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
|
||||
name="${name:-cfg$CONFIG_NUM_SECTIONS}"
|
||||
append CONFIG_SECTIONS "$name"
|
||||
export ${NO_EXPORT:+-n} CONFIG_SECTION="$name"
|
||||
@ -124,7 +92,7 @@ list() {
|
||||
|
||||
config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0
|
||||
[ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}"
|
||||
len=$((len + 1))
|
||||
len=$(($len + 1))
|
||||
config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
|
||||
config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
|
||||
append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
|
||||
@ -138,14 +106,9 @@ config_unset() {
|
||||
# config_get <variable> <section> <option> [<default>]
|
||||
# config_get <section> <option>
|
||||
config_get() {
|
||||
case "$2${3:-$1}" in
|
||||
*[!A-Za-z0-9_]*) : ;;
|
||||
*)
|
||||
case "$3" in
|
||||
"") eval echo "\"\${CONFIG_${1}_${2}:-\${4}}\"";;
|
||||
*) eval export ${NO_EXPORT:+-n} -- "${1}=\${CONFIG_${2}_${3}:-\${4}}";;
|
||||
esac
|
||||
;;
|
||||
case "$3" in
|
||||
"") eval echo "\${CONFIG_${1}_${2}:-\${4}}";;
|
||||
*) eval export ${NO_EXPORT:+-n} -- "${1}=\${CONFIG_${2}_${3}:-\${4}}";;
|
||||
esac
|
||||
}
|
||||
|
||||
@ -186,7 +149,7 @@ config_foreach() {
|
||||
[ -z "$CONFIG_SECTIONS" ] && return 0
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ -n "$___type" ] && [ "x$cfgtype" != "x$___type" ] && continue
|
||||
[ -n "$___type" -a "x$cfgtype" != "x$___type" ] && continue
|
||||
eval "$___function \"\$section\" \"\$@\""
|
||||
done
|
||||
}
|
||||
@ -205,16 +168,14 @@ config_list_foreach() {
|
||||
while [ $c -le "$len" ]; do
|
||||
config_get val "${section}" "${option}_ITEM$c"
|
||||
eval "$function \"\$val\" \"\$@\""
|
||||
c="$((c + 1))"
|
||||
c="$(($c + 1))"
|
||||
done
|
||||
}
|
||||
|
||||
default_prerm() {
|
||||
local root="${IPKG_INSTROOT}"
|
||||
[ -z "$pkgname" ] && local pkgname="$(basename ${1%.*})"
|
||||
local pkgname="$(basename ${1%.*})"
|
||||
local ret=0
|
||||
local filelist="${root}/usr/lib/opkg/info/${pkgname}.list"
|
||||
[ -f "$root/lib/apk/packages/${pkgname}.list" ] && filelist="$root/lib/apk/packages/${pkgname}.list"
|
||||
|
||||
if [ -f "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" ]; then
|
||||
( . "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" )
|
||||
@ -222,7 +183,7 @@ default_prerm() {
|
||||
fi
|
||||
|
||||
local shell="$(command -v bash)"
|
||||
for i in $(grep -s "^/etc/init.d/" "$filelist"); do
|
||||
for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
|
||||
if [ -n "$root" ]; then
|
||||
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
|
||||
else
|
||||
@ -237,11 +198,8 @@ default_prerm() {
|
||||
}
|
||||
|
||||
add_group_and_user() {
|
||||
[ -z "$pkgname" ] && local pkgname="$(basename ${1%.*})"
|
||||
local pkgname="$1"
|
||||
local rusers="$(sed -ne 's/^Require-User: *//p' $root/usr/lib/opkg/info/${pkgname}.control 2>/dev/null)"
|
||||
if [ -f "$root/lib/apk/packages/${pkgname}.rusers" ]; then
|
||||
local rusers="$(cat $root/lib/apk/packages/${pkgname}.rusers)"
|
||||
fi
|
||||
|
||||
if [ -n "$rusers" ]; then
|
||||
local tuple oIFS="$IFS"
|
||||
@ -291,70 +249,16 @@ add_group_and_user() {
|
||||
fi
|
||||
}
|
||||
|
||||
update_alternatives() {
|
||||
local root="${IPKG_INSTROOT}"
|
||||
local action="$1"
|
||||
local pkgname="$2"
|
||||
|
||||
if [ -f "$root/lib/apk/packages/${pkgname}.alternatives" ]; then
|
||||
for pkg_alt in $(cat $root/lib/apk/packages/${pkgname}.alternatives); do
|
||||
local best_prio=0;
|
||||
local best_src="/bin/busybox";
|
||||
pkg_prio=${pkg_alt%%:*};
|
||||
pkg_target=${pkg_alt#*:};
|
||||
pkg_target=${pkg_target%:*};
|
||||
pkg_src=${pkg_alt##*:};
|
||||
|
||||
if [ -e "$root/$target" ]; then
|
||||
for alts in $root/lib/apk/packages/*.alternatives; do
|
||||
for alt in $(cat $alts); do
|
||||
prio=${alt%%:*};
|
||||
target=${alt#*:};
|
||||
target=${target%:*};
|
||||
src=${alt##*:};
|
||||
|
||||
if [ "$target" = "$pkg_target" ] &&
|
||||
[ "$src" != "$pkg_src" ] &&
|
||||
[ "$best_prio" -lt "$prio" ]; then
|
||||
best_prio=$prio;
|
||||
best_src=$src;
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
case "$action" in
|
||||
install)
|
||||
if [ "$best_prio" -lt "$pkg_prio" ]; then
|
||||
ln -sf "$pkg_src" "$root/$pkg_target"
|
||||
echo "add alternative: $pkg_target -> $pkg_src"
|
||||
fi
|
||||
;;
|
||||
remove)
|
||||
if [ "$best_prio" -lt "$pkg_prio" ]; then
|
||||
ln -sf "$best_src" "$root/$pkg_target"
|
||||
echo "add alternative: $pkg_target -> $best_src"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
default_postinst() {
|
||||
local root="${IPKG_INSTROOT}"
|
||||
[ -z "$pkgname" ] && local pkgname="$(basename ${1%.*})"
|
||||
local filelist="${root}/usr/lib/opkg/info/${pkgname}.list"
|
||||
[ -f "$root/lib/apk/packages/${pkgname}.list" ] && filelist="$root/lib/apk/packages/${pkgname}.list"
|
||||
local pkgname="$(basename ${1%.*})"
|
||||
local ret=0
|
||||
|
||||
if [ -e "${root}/usr/lib/opkg/info/${pkgname}.list" ]; then
|
||||
filelist="${root}/usr/lib/opkg/info/${pkgname}.list"
|
||||
add_group_and_user "${pkgname}"
|
||||
fi
|
||||
add_group_and_user "${pkgname}"
|
||||
|
||||
if [ -e "${root}/lib/apk/packages/${pkgname}.list" ]; then
|
||||
filelist="${root}/lib/apk/packages/${pkgname}.list"
|
||||
update_alternatives install "${pkgname}"
|
||||
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
|
||||
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
if [ -d "$root/rootfs-overlay" ]; then
|
||||
@ -362,33 +266,23 @@ default_postinst() {
|
||||
rm -fR $root/rootfs-overlay/
|
||||
fi
|
||||
|
||||
if [ -z "$root" ]; then
|
||||
if grep -m1 -q -s "^/etc/modules.d/" "$filelist"; then
|
||||
kmodloader
|
||||
fi
|
||||
|
||||
if grep -m1 -q -s "^/etc/sysctl.d/" "$filelist"; then
|
||||
/etc/init.d/sysctl restart
|
||||
fi
|
||||
|
||||
if grep -m1 -q -s "^/etc/uci-defaults/" "$filelist"; then
|
||||
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
|
||||
for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do
|
||||
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
|
||||
done
|
||||
uci commit
|
||||
fi
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
if [ -z "$root" ] && grep -q -s "^/etc/modules.d/" "/usr/lib/opkg/info/${pkgname}.list"; then
|
||||
kmodloader
|
||||
fi
|
||||
|
||||
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
|
||||
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
|
||||
ret=$?
|
||||
if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
|
||||
. /lib/functions/system.sh
|
||||
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
|
||||
for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do
|
||||
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
|
||||
done
|
||||
uci commit
|
||||
fi
|
||||
|
||||
[ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
||||
|
||||
local shell="$(command -v bash)"
|
||||
for i in $(grep -s "^/etc/init.d/" "$filelist"); do
|
||||
for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
|
||||
if [ -n "$root" ]; then
|
||||
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
|
||||
else
|
||||
@ -410,11 +304,6 @@ include() {
|
||||
done
|
||||
}
|
||||
|
||||
ipcalc() {
|
||||
set -- $(ipcalc.sh "$@")
|
||||
[ $? -eq 0 ] && export -- "$@"
|
||||
}
|
||||
|
||||
find_mtd_index() {
|
||||
local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
|
||||
local INDEX="${PART##mtd}"
|
||||
@ -470,9 +359,9 @@ group_add_next() {
|
||||
echo $gid
|
||||
return
|
||||
fi
|
||||
gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group)
|
||||
gid=32768
|
||||
while echo "$gids" | grep -q "^$gid$"; do
|
||||
gids=$(cat ${IPKG_INSTROOT}/etc/group | cut -d: -f3)
|
||||
gid=65536
|
||||
while [ -n "$(echo "$gids" | grep "^$gid$")" ] ; do
|
||||
gid=$((gid + 1))
|
||||
done
|
||||
group_add $1 $gid
|
||||
@ -482,8 +371,8 @@ group_add_next() {
|
||||
group_add_user() {
|
||||
local grp delim=","
|
||||
grp=$(grep -s "^${1}:" ${IPKG_INSTROOT}/etc/group)
|
||||
echo "$grp" | cut -d: -f4 | grep -q $2 && return
|
||||
echo "$grp" | grep -q ":$" && delim=""
|
||||
[ -z "$(echo $grp | cut -d: -f4 | grep $2)" ] || return
|
||||
[ -n "$(echo $grp | grep ":$")" ] && delim=""
|
||||
[ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd
|
||||
sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group
|
||||
if [ -z "$IPKG_INSTROOT" ] && [ -x /usr/sbin/selinuxenabled ] && selinuxenabled; then
|
||||
@ -501,9 +390,9 @@ user_add() {
|
||||
local shell="${6:-/bin/false}"
|
||||
local rc
|
||||
[ -z "$uid" ] && {
|
||||
uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd)
|
||||
uid=32768
|
||||
while echo "$uids" | grep -q "^$uid$"; do
|
||||
uids=$(cat ${IPKG_INSTROOT}/etc/passwd | cut -d: -f3)
|
||||
uid=65536
|
||||
while [ -n "$(echo "$uids" | grep "^$uid$")" ] ; do
|
||||
uid=$((uid + 1))
|
||||
done
|
||||
}
|
||||
@ -533,4 +422,4 @@ cmdline_get_var() {
|
||||
done
|
||||
}
|
||||
|
||||
[ -z "$IPKG_INSTROOT" ] && [ -f /lib/config/uci.sh ] && . /lib/config/uci.sh || true
|
||||
[ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh
|
||||
|
@ -70,7 +70,7 @@ caldata_extract_reverse() {
|
||||
local caldata
|
||||
|
||||
mtd=$(find_mtd_chardev "$part")
|
||||
reversed=$(hexdump -v -s $offset -n $count -e '1/1 "%02x "' $mtd)
|
||||
reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
|
||||
|
||||
for byte in $reversed; do
|
||||
caldata="\x${byte}${caldata}"
|
||||
@ -122,43 +122,49 @@ caldata_valid() {
|
||||
return $?
|
||||
}
|
||||
|
||||
caldata_patch_data() {
|
||||
local data=$1
|
||||
local data_count=$((${#1} / 2))
|
||||
[ -n "$2" ] && local data_offset=$(($2))
|
||||
[ -n "$3" ] && local chksum_offset=$(($3))
|
||||
caldata_patch_chksum() {
|
||||
local mac=$1
|
||||
local mac_offset=$(($2))
|
||||
local chksum_offset=$(($3))
|
||||
local target=$4
|
||||
local fw_data
|
||||
local fw_chksum
|
||||
local xor_mac
|
||||
local xor_fw_mac
|
||||
local xor_fw_chksum
|
||||
|
||||
[ -z "$data" -o -z "$data_offset" ] && return
|
||||
xor_mac=${mac//:/}
|
||||
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
||||
|
||||
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
||||
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
||||
|
||||
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
||||
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
||||
|
||||
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
||||
dd of=$target conv=notrunc bs=1 seek=$chksum_offset count=2
|
||||
}
|
||||
|
||||
caldata_patch_mac() {
|
||||
local mac=$1
|
||||
local mac_offset=$(($2))
|
||||
local chksum_offset=$3
|
||||
local target=$4
|
||||
|
||||
[ -z "$mac" -o -z "$mac_offset" ] && return
|
||||
|
||||
[ -n "$target" ] || target=/lib/firmware/$FIRMWARE
|
||||
|
||||
fw_data=$(hexdump -v -n $data_count -s $data_offset -e '1/1 "%02x"' $target)
|
||||
[ -n "$chksum_offset" ] && caldata_patch_chksum "$mac" "$mac_offset" "$chksum_offset" "$target"
|
||||
|
||||
if [ "$data" != "$fw_data" ]; then
|
||||
|
||||
if [ -n "$chksum_offset" ]; then
|
||||
fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '1/1 "%02x"' $target)
|
||||
fw_chksum=$(xor $fw_chksum $(data_2xor_val $fw_data) $(data_2xor_val $data))
|
||||
|
||||
data_2bin $fw_chksum | \
|
||||
dd of=$target conv=notrunc bs=1 seek=$chksum_offset count=2 || \
|
||||
caldata_die "failed to write chksum to eeprom file"
|
||||
fi
|
||||
|
||||
data_2bin $data | \
|
||||
dd of=$target conv=notrunc bs=1 seek=$data_offset count=$data_count || \
|
||||
caldata_die "failed to write data to eeprom file"
|
||||
fi
|
||||
macaddr_2bin $mac | dd of=$target conv=notrunc oflag=seek_bytes bs=6 seek=$mac_offset count=1 || \
|
||||
caldata_die "failed to write MAC address to eeprom file"
|
||||
}
|
||||
|
||||
ath9k_patch_mac() {
|
||||
local mac=$1
|
||||
local target=$2
|
||||
|
||||
caldata_patch_data "${mac//:/}" 0x2 "" "$target"
|
||||
caldata_patch_mac "$mac" 0x2 "" "$target"
|
||||
}
|
||||
|
||||
ath9k_patch_mac_crc() {
|
||||
@ -167,52 +173,12 @@ ath9k_patch_mac_crc() {
|
||||
local chksum_offset=$((mac_offset - 10))
|
||||
local target=$4
|
||||
|
||||
caldata_patch_data "${mac//:/}" "$mac_offset" "$chksum_offset" "$target"
|
||||
caldata_patch_mac "$mac" "$mac_offset" "$chksum_offset" "$target"
|
||||
}
|
||||
|
||||
ath10k_patch_mac() {
|
||||
local mac=$1
|
||||
local target=$2
|
||||
|
||||
caldata_patch_data "${mac//:/}" 0x6 0x2 "$target"
|
||||
}
|
||||
|
||||
ath11k_patch_mac() {
|
||||
local mac=$1
|
||||
# mac_id from 0 to 5
|
||||
local mac_id=$2
|
||||
local target=$3
|
||||
|
||||
[ -z "$mac_id" ] && return
|
||||
|
||||
caldata_patch_data "${mac//:/}" $(printf "0x%x" $(($mac_id * 0x6 + 0xe))) 0xa "$target"
|
||||
}
|
||||
|
||||
ath10k_remove_regdomain() {
|
||||
local target=$1
|
||||
|
||||
caldata_patch_data "0000" 0xc 0x2 "$target"
|
||||
}
|
||||
|
||||
ath11k_remove_regdomain() {
|
||||
local target=$1
|
||||
local regdomain
|
||||
local regdomain_data
|
||||
|
||||
regdomain=$(hexdump -v -n 2 -s 0x34 -e '1/1 "%02x"' $target)
|
||||
caldata_patch_data "0000" 0x34 0xa "$target"
|
||||
|
||||
for offset in 0x450 0x458 0x500 0x5a8; do
|
||||
regdomain_data=$(hexdump -v -n 2 -s $offset -e '1/1 "%02x"' $target)
|
||||
|
||||
if [ "$regdomain" == "$regdomain_data" ]; then
|
||||
caldata_patch_data "0000" $offset 0xa "$target"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
ath11k_set_macflag() {
|
||||
local target=$1
|
||||
|
||||
caldata_patch_data "0100" 0x3e 0xa "$target"
|
||||
caldata_patch_mac "$mac" 0x6 0x2 "$target"
|
||||
}
|
||||
|
@ -1,268 +0,0 @@
|
||||
uint_max=4294967295
|
||||
|
||||
d_10_0_0_0=167772160
|
||||
d_10_255_255_255=184549375
|
||||
|
||||
d_172_16_0_0=2886729728
|
||||
d_172_31_255_255=2887778303
|
||||
|
||||
d_192_168_0_0=3232235520
|
||||
d_192_168_255_255=3232301055
|
||||
|
||||
d_169_254_0_0=2851995648
|
||||
d_169_254_255_255=2852061183
|
||||
|
||||
d_127_0_0_0=2130706432
|
||||
d_127_255_255_255=2147483647
|
||||
|
||||
d_224_0_0_0=3758096384
|
||||
d_239_255_255_255=4026531839
|
||||
|
||||
# check that $1 is only base 10 digits, and that it doesn't
|
||||
# exceed 2^32-1
|
||||
assert_uint32() {
|
||||
local __n="$1"
|
||||
|
||||
if [ -z "$__n" -o -n "${__n//[0-9]/}" ]; then
|
||||
printf "Not a decimal integer (%s)\n" "$__n ">&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$__n" -gt $uint_max ]; then
|
||||
printf "Out of range (%s)\n" "$__n" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$((__n + 0))" != "$__n" ]; then
|
||||
printf "Not normalized notation (%s)\n" "$__n" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# return a count of the number of bits set in $1
|
||||
bitcount() {
|
||||
local __var="$1" __c="$2"
|
||||
assert_uint32 "$__c" || return 1
|
||||
|
||||
__c=$((((__c >> 1) & 0x55555555) + (__c & 0x55555555)))
|
||||
__c=$((((__c >> 2) & 0x33333333) + (__c & 0x33333333)))
|
||||
__c=$((((__c >> 4) & 0x0f0f0f0f) + (__c & 0x0f0f0f0f)))
|
||||
__c=$((((__c >> 8) & 0x00ff00ff) + (__c & 0x00ff00ff)))
|
||||
__c=$((((__c >> 16) & 0x0000ffff) + (__c & 0x0000ffff)))
|
||||
|
||||
export -- "$__var=$__c"
|
||||
}
|
||||
|
||||
# tedious but portable with busybox's limited shell
|
||||
# we check each octet to be in the range of 0..255,
|
||||
# and also make sure there's no extaneous characters.
|
||||
str2ip() {
|
||||
local __var="$1" __ip="$2" __n __val=0
|
||||
|
||||
case "$__ip" in
|
||||
[0-9].*)
|
||||
__n="${__ip:0:1}"
|
||||
__ip="${__ip:2}"
|
||||
;;
|
||||
[1-9][0-9].*)
|
||||
__n="${__ip:0:2}"
|
||||
__ip="${__ip:3}"
|
||||
;;
|
||||
1[0-9][0-9].*|2[0-4][0-9].*|25[0-5].*)
|
||||
__n="${__ip:0:3}"
|
||||
__ip="${__ip:4}"
|
||||
;;
|
||||
*)
|
||||
printf "Not a dotted quad (%s)\n" "$2" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
__val=$((__n << 24))
|
||||
|
||||
case "$__ip" in
|
||||
[0-9].*)
|
||||
__n="${__ip:0:1}"
|
||||
__ip="${__ip:2}"
|
||||
;;
|
||||
[1-9][0-9].*)
|
||||
__n="${__ip:0:2}"
|
||||
__ip="${__ip:3}"
|
||||
;;
|
||||
1[0-9][0-9].*|2[0-4][0-9].*|25[0-5].*)
|
||||
__n="${__ip:0:3}"
|
||||
__ip="${__ip:4}"
|
||||
;;
|
||||
*)
|
||||
printf "Not a dotted quad (%s)\n" "$2" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
__val=$((__val + (__n << 16)))
|
||||
|
||||
case "$__ip" in
|
||||
[0-9].*)
|
||||
__n="${__ip:0:1}"
|
||||
__ip="${__ip:2}"
|
||||
;;
|
||||
[1-9][0-9].*)
|
||||
__n="${__ip:0:2}"
|
||||
__ip="${__ip:3}"
|
||||
;;
|
||||
1[0-9][0-9].*|2[0-4][0-9].*|25[0-5].*)
|
||||
__n="${__ip:0:3}"
|
||||
__ip="${__ip:4}"
|
||||
;;
|
||||
*)
|
||||
printf "Not a dotted quad (%s)\n" "$2" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
__val=$((__val + (__n << 8)))
|
||||
|
||||
case "$__ip" in
|
||||
[0-9])
|
||||
__n="${__ip:0:1}"
|
||||
__ip="${__ip:1}"
|
||||
;;
|
||||
[1-9][0-9])
|
||||
__n="${__ip:0:2}"
|
||||
__ip="${__ip:2}"
|
||||
;;
|
||||
1[0-9][0-9]|2[0-4][0-9]|25[0-5])
|
||||
__n="${__ip:0:3}"
|
||||
__ip="${__ip:3}"
|
||||
;;
|
||||
*)
|
||||
printf "Not a dotted quad (%s)\n" "$2" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
__val=$((__val + __n))
|
||||
|
||||
if [ -n "$__ip" ]; then
|
||||
printf "Not a dotted quad (%s)\n" "$2" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
export -- "$__var=$__val"
|
||||
return 0
|
||||
}
|
||||
|
||||
# convert back from an integer to dotted-quad.
|
||||
ip2str() {
|
||||
local __var="$1" __n="$2"
|
||||
assert_uint32 "$__n" || return 1
|
||||
|
||||
export -- "$__var=$((__n >> 24)).$(((__n >> 16) & 255)).$(((__n >> 8) & 255)).$((__n & 255))"
|
||||
}
|
||||
|
||||
# convert prefix into an integer bitmask
|
||||
prefix2netmask() {
|
||||
local __var="$1" __n="$2"
|
||||
assert_uint32 "$__n" || return 1
|
||||
|
||||
if [ "$__n" -gt 32 ]; then
|
||||
printf "Prefix out-of-range (%s)" "$__n" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
export -- "$__var=$(((~(uint_max >> __n)) & uint_max))"
|
||||
}
|
||||
|
||||
_is_contiguous() {
|
||||
local __x="$1" # no checking done
|
||||
local __y=$((~__x & uint_max))
|
||||
local __z=$(((__y + 1) & uint_max))
|
||||
|
||||
[ $((__z & __y)) -eq 0 ]
|
||||
}
|
||||
|
||||
# check argument as being contiguous upper bits (and yes,
|
||||
# 0 doesn't have any discontiguous bits).
|
||||
is_contiguous() {
|
||||
local __var="$1" __x="$2" __val=0
|
||||
assert_uint32 "$__x" || return 1
|
||||
|
||||
local __y=$((~__x & uint_max))
|
||||
local __z=$(((__y + 1) & uint_max))
|
||||
|
||||
[ $((__z & __y)) -eq 0 ] && __val=1
|
||||
|
||||
export -- "$__var=$__val"
|
||||
}
|
||||
|
||||
# convert mask to prefix, validating that it's a conventional
|
||||
# (contiguous) netmask.
|
||||
netmask2prefix() {
|
||||
local __var="$1" __n="$2" __cont __bits
|
||||
assert_uint32 "$__n" || return 1
|
||||
|
||||
is_contiguous __cont "$__n" || return 1
|
||||
if [ $__cont -eq 0 ]; then
|
||||
printf "Not a contiguous netmask (%08x)\n" "$__n" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
bitcount __bits "$__n" # already checked
|
||||
|
||||
export -- "$__var=$__bits"
|
||||
}
|
||||
|
||||
# check the argument as being an rfc-1918 address
|
||||
is_rfc1918() {
|
||||
local __var="$1" __x="$2" __val=0
|
||||
assert_uint32 "$__x" || return 1
|
||||
|
||||
if [ $d_10_0_0_0 -le $__x ] && [ $__x -le $d_10_255_255_255 ]; then
|
||||
__val=1
|
||||
elif [ $d_172_16_0_0 -le $__x ] && [ $__x -le $d_172_31_255_255 ]; then
|
||||
__val=1
|
||||
elif [ $d_192_168_0_0 -le $__x ] && [ $__x -le $d_192_168_255_255 ]; then
|
||||
__val=1
|
||||
fi
|
||||
|
||||
export -- "$__var=$__val"
|
||||
}
|
||||
|
||||
# check the argument as being an rfc-3927 address
|
||||
is_rfc3927() {
|
||||
local __var="$1" __x="$2" __val=0
|
||||
assert_uint32 "$__x" || return 1
|
||||
|
||||
if [ $d_169_254_0_0 -le $__x ] && [ $__x -le $d_169_254_255_255 ]; then
|
||||
__val=1
|
||||
fi
|
||||
|
||||
export -- "$__var=$__val"
|
||||
}
|
||||
|
||||
# check the argument as being an rfc-1122 loopback address
|
||||
is_loopback() {
|
||||
local __var="$1" __x="$2" __val=0
|
||||
assert_uint32 "$__x" || return 1
|
||||
|
||||
if [ $d_127_0_0_0 -le $__x ] && [ $__x -le $d_127_255_255_255 ]; then
|
||||
__val=1
|
||||
fi
|
||||
|
||||
export -- "$__var=$__val"
|
||||
}
|
||||
|
||||
# check the argument as being a multicast address
|
||||
is_multicast() {
|
||||
local __var="$1" __x="$2" __val=0
|
||||
assert_uint32 "$__x" || return 1
|
||||
|
||||
if [ $d_224_0_0_0 -le $__x ] && [ $__x -le $d_239_255_255_255 ]; then
|
||||
__val=1
|
||||
fi
|
||||
|
||||
export -- "$__var=$__val"
|
||||
}
|
||||
|
31
package/base-files/files/lib/functions/leds.sh
Normal file → Executable file
31
package/base-files/files/lib/functions/leds.sh
Normal file → Executable file
@ -11,36 +11,6 @@ get_dt_led_path() {
|
||||
echo "$ledpath"
|
||||
}
|
||||
|
||||
get_dt_led_color_func() {
|
||||
local enum
|
||||
local func
|
||||
local idx
|
||||
local label
|
||||
|
||||
[ -e "$1/function" ] && func=$(cat "$1/function")
|
||||
[ -e "$1/color" ] && idx=$((0x$(hexdump -n 4 -e '4/1 "%02x"' "$1/color")))
|
||||
[ -e "$1/function-enumerator" ] && \
|
||||
enum=$((0x$(hexdump -n 4 -e '4/1 "%02x"' "$1/function-enumerator")))
|
||||
|
||||
[ -z "$idx" ] && [ -z "$func" ] && return 2
|
||||
|
||||
if [ -n "$idx" ]; then
|
||||
for color in "white" "red" "green" "blue" "amber" \
|
||||
"violet" "yellow" "ir" "multicolor" "rgb" \
|
||||
"purple" "orange" "pink" "cyan" "lime"
|
||||
do
|
||||
[ $idx -eq 0 ] && label="$color" && break
|
||||
idx=$((idx-1))
|
||||
done
|
||||
fi
|
||||
|
||||
label="$label:$func"
|
||||
[ -n "$enum" ] && label="$label-$enum"
|
||||
echo "$label"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
get_dt_led() {
|
||||
local label
|
||||
local ledpath=$(get_dt_led_path $1)
|
||||
@ -48,7 +18,6 @@ get_dt_led() {
|
||||
[ -n "$ledpath" ] && \
|
||||
label=$(cat "$ledpath/label" 2>/dev/null) || \
|
||||
label=$(cat "$ledpath/chan-name" 2>/dev/null) || \
|
||||
label=$(get_dt_led_color_func "$ledpath") || \
|
||||
label=$(basename "$ledpath")
|
||||
|
||||
echo "$label"
|
||||
|
14
package/base-files/files/lib/functions/network.sh
Normal file → Executable file
14
package/base-files/files/lib/functions/network.sh
Normal file → Executable file
@ -90,13 +90,6 @@ network_get_prefix6() {
|
||||
__network_ifstatus "$1" "$2" "['ipv6-prefix'][0]['address','mask']" "/"
|
||||
}
|
||||
|
||||
# determine first IPv6 prefix assignment of given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
network_get_prefix_assignment6() {
|
||||
__network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][0]['address','mask']" "/"
|
||||
}
|
||||
|
||||
# determine all IPv4 addresses of given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
@ -194,13 +187,6 @@ network_get_prefixes6() {
|
||||
__network_ifstatus "$1" "$2" "['ipv6-prefix'][*]['address','mask']" "/ "
|
||||
}
|
||||
|
||||
# determine all IPv6 prefix assignments of given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
network_get_prefix_assignments6() {
|
||||
__network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][*]['address','mask']" "/ "
|
||||
}
|
||||
|
||||
# determine IPv4 gateway of given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
|
0
package/base-files/files/lib/functions/preinit.sh
Normal file → Executable file
0
package/base-files/files/lib/functions/preinit.sh
Normal file → Executable file
0
package/base-files/files/lib/functions/service.sh
Normal file → Executable file
0
package/base-files/files/lib/functions/service.sh
Normal file → Executable file
120
package/base-files/files/lib/functions/system.sh
Normal file → Executable file
120
package/base-files/files/lib/functions/system.sh
Normal file → Executable file
@ -61,21 +61,11 @@ find_mtd_chardev() {
|
||||
echo "${INDEX:+$PREFIX$INDEX}"
|
||||
}
|
||||
|
||||
get_mac_ascii() {
|
||||
local part="$1"
|
||||
local key="$2"
|
||||
local mac_dirty
|
||||
|
||||
mac_dirty=$(strings "$part" | tr -d ' \t' | sed -n 's/^'"$key"'=//p' | head -n 1)
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
}
|
||||
|
||||
mtd_get_mac_ascii() {
|
||||
local mtdname="$1"
|
||||
local key="$2"
|
||||
local part
|
||||
local mac_dirty
|
||||
|
||||
part=$(find_mtd_part "$mtdname")
|
||||
if [ -z "$part" ]; then
|
||||
@ -83,75 +73,17 @@ mtd_get_mac_ascii() {
|
||||
return
|
||||
fi
|
||||
|
||||
get_mac_ascii "$part" "$key"
|
||||
}
|
||||
|
||||
mtd_get_mac_encrypted_arcadyan() {
|
||||
local iv="00000000000000000000000000000000"
|
||||
local key="2A4B303D7644395C3B2B7053553C5200"
|
||||
local mac_dirty
|
||||
local mtdname="$1"
|
||||
local part
|
||||
local size
|
||||
|
||||
part=$(find_mtd_part "$mtdname")
|
||||
if [ -z "$part" ]; then
|
||||
echo "mtd_get_mac_encrypted_arcadyan: partition $mtdname not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
# Config decryption and getting mac. Trying uencrypt and openssl utils.
|
||||
size=$((0x$(dd if=$part skip=9 bs=1 count=4 2>/dev/null | hexdump -v -e '1/4 "%08x"')))
|
||||
if [[ -f "/usr/bin/uencrypt" ]]; then
|
||||
mac_dirty=$(dd if=$part bs=1 count=$size skip=$((0x100)) 2>/dev/null | \
|
||||
uencrypt -d -n -k $key -i $iv | grep mac | cut -c 5-)
|
||||
elif [[ -f "/usr/bin/openssl" ]]; then
|
||||
mac_dirty=$(dd if=$part bs=1 count=$size skip=$((0x100)) 2>/dev/null | \
|
||||
openssl aes-128-cbc -d -nopad -K $key -iv $iv | grep mac | cut -c 5-)
|
||||
else
|
||||
echo "mtd_get_mac_encrypted_arcadyan: Neither uencrypt nor openssl was found!" >&2
|
||||
return
|
||||
fi
|
||||
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
}
|
||||
|
||||
mtd_get_mac_encrypted_deco() {
|
||||
local mtdname="$1"
|
||||
|
||||
if ! [ -e "$mtdname" ]; then
|
||||
echo "mtd_get_mac_encrypted_deco: file $mtdname not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
tplink_key="3336303032384339"
|
||||
|
||||
key=$(dd if=$mtdname bs=1 skip=16 count=8 2>/dev/null | \
|
||||
uencrypt -n -d -k $tplink_key -c des-ecb | hexdump -v -n 8 -e '1/1 "%02x"')
|
||||
|
||||
macaddr=$(dd if=$mtdname bs=1 skip=32 count=8 2>/dev/null | \
|
||||
uencrypt -n -d -k $key -c des-ecb | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"')
|
||||
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
mtd_get_mac_uci_config_ubi() {
|
||||
local volumename="$1"
|
||||
|
||||
. /lib/upgrade/nand.sh
|
||||
|
||||
local ubidev=$(nand_attach_ubi $CI_UBIPART)
|
||||
local part=$(nand_find_volume $ubidev $volumename)
|
||||
|
||||
cat "/dev/$part" | sed -n 's/^\s*option macaddr\s*'"'"'\?\([0-9A-F:]\+\)'"'"'\?/\1/Ip'
|
||||
}
|
||||
|
||||
mtd_get_mac_text() {
|
||||
local mtdname="$1"
|
||||
local offset=$((${2:-0}))
|
||||
local length="${3:-17}"
|
||||
local mtdname=$1
|
||||
local offset=$(($2))
|
||||
local part
|
||||
local mac_dirty
|
||||
|
||||
part=$(find_mtd_part "$mtdname")
|
||||
if [ -z "$part" ]; then
|
||||
@ -159,9 +91,15 @@ mtd_get_mac_text() {
|
||||
return
|
||||
fi
|
||||
|
||||
[ $((offset + length)) -le $(mtd_get_part_size "$mtdname") ] || return
|
||||
if [ -z "$offset" ]; then
|
||||
echo "mtd_get_mac_text: offset missing!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
macaddr_canonicalize $(dd bs=1 if="$part" skip="$offset" count="$length" 2>/dev/null)
|
||||
mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null)
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
}
|
||||
|
||||
mtd_get_mac_binary() {
|
||||
@ -197,20 +135,6 @@ mtd_get_part_size() {
|
||||
done < /proc/mtd
|
||||
}
|
||||
|
||||
mmc_get_mac_ascii() {
|
||||
local part_name="$1"
|
||||
local key="$2"
|
||||
local part
|
||||
|
||||
part=$(find_mmc_part "$part_name")
|
||||
if [ -z "$part" ]; then
|
||||
echo "mmc_get_mac_ascii: partition $part_name not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
get_mac_ascii "$part" "$key"
|
||||
}
|
||||
|
||||
mmc_get_mac_binary() {
|
||||
local part_name="$1"
|
||||
local offset="$2"
|
||||
@ -230,14 +154,6 @@ macaddr_add() {
|
||||
echo $oui:$nic
|
||||
}
|
||||
|
||||
macaddr_generate_from_mmc_cid() {
|
||||
local mmc_dev=$1
|
||||
|
||||
local sd_hash=$(sha256sum /sys/class/block/$mmc_dev/device/cid)
|
||||
local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 2>/dev/null)")
|
||||
echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
|
||||
}
|
||||
|
||||
macaddr_geteui() {
|
||||
local mac=$1
|
||||
local sep=$2
|
||||
@ -279,6 +195,12 @@ macaddr_random() {
|
||||
echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${randsrc}")")"
|
||||
}
|
||||
|
||||
macaddr_2bin() {
|
||||
local mac=$1
|
||||
|
||||
echo -ne \\x${mac//:/\\x}
|
||||
}
|
||||
|
||||
macaddr_canonicalize() {
|
||||
local mac="$1"
|
||||
local canon=""
|
||||
@ -311,7 +233,3 @@ macaddr_canonicalize() {
|
||||
|
||||
printf "%02x:%02x:%02x:%02x:%02x:%02x" 0x${canon// / 0x} 2>/dev/null
|
||||
}
|
||||
|
||||
dt_is_enabled() {
|
||||
grep -q okay "/proc/device-tree/$1/status"
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user