Compare commits
228 Commits
master
...
v23.05.0-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55ae516f61 | ||
|
|
cd17d8df2a | ||
|
|
106c83a1ea | ||
|
|
51c397c33f | ||
|
|
b1b829ad6a | ||
|
|
fca03ea458 | ||
|
|
0a63e72fbb | ||
|
|
02a37dee1b | ||
|
|
2cef1c3277 | ||
|
|
e962f866b2 | ||
|
|
b6f2c58dd6 | ||
|
|
aa256ab580 | ||
|
|
09322f3c0c | ||
|
|
ac6832110a | ||
|
|
43746c4c5a | ||
|
|
6d3770501d | ||
|
|
8a0746955d | ||
|
|
63942b569e | ||
|
|
e9d2ff8045 | ||
|
|
a46e5ce4ad | ||
|
|
1b6f2af148 | ||
|
|
1de5f74062 | ||
|
|
81979018e0 | ||
|
|
68bc059c55 | ||
|
|
6f9495b896 | ||
|
|
11ad38f0bb | ||
|
|
55993f1fc1 | ||
|
|
7390068e4f | ||
|
|
dee8ca626c | ||
|
|
66e1bef8f7 | ||
|
|
b073d6cf7a | ||
|
|
3d66e7f1db | ||
|
|
b8bbe0d800 | ||
|
|
40966d612e | ||
|
|
e6acfe03dd | ||
|
|
70afa8e6b6 | ||
|
|
25f6252620 | ||
|
|
3506efe29c | ||
|
|
18a85ecc29 | ||
|
|
753be3837f | ||
|
|
4a281a7789 | ||
|
|
a11f2e6044 | ||
|
|
0f30f47d61 | ||
|
|
cd650f1e91 | ||
|
|
08247ffeda | ||
|
|
341e312ada | ||
|
|
848759c236 | ||
|
|
c05c0699d4 | ||
|
|
8d557d4744 | ||
|
|
ded67a320c | ||
|
|
e9ea571657 | ||
|
|
23a828f230 | ||
|
|
4b48f8a3e7 | ||
|
|
a6afb3a7bc | ||
|
|
7198185e3a | ||
|
|
963ce6990f | ||
|
|
86b50228c0 | ||
|
|
bacc385dc5 | ||
|
|
067f252331 | ||
|
|
4177b69b46 | ||
|
|
bbd1676cd2 | ||
|
|
4d13a09ba0 | ||
|
|
a86b74cbfe | ||
|
|
a80eeec96d | ||
|
|
3eb25435af | ||
|
|
2bec445c1d | ||
|
|
f1a02ba135 | ||
|
|
182fb97d8f | ||
|
|
23ca9a1677 | ||
|
|
0bedcbb9ff | ||
|
|
04d2f8f11f | ||
|
|
b0e724e49c | ||
|
|
84f566b00c | ||
|
|
ddb8845bd6 | ||
|
|
f48985861a | ||
|
|
649d3a75e2 | ||
|
|
3f72d24a04 | ||
|
|
7c223a881f | ||
|
|
1e7fa539ae | ||
|
|
41af35cf6b | ||
|
|
7e6403a966 | ||
|
|
793b9cddd2 | ||
|
|
f8d26ece25 | ||
|
|
0928545f3b | ||
|
|
f307129561 | ||
|
|
ea22a1f4da | ||
|
|
e972e4f2a9 | ||
|
|
43b92ff6ce | ||
|
|
c7bd7a9c51 | ||
|
|
948dc515dc | ||
|
|
145d485d51 | ||
|
|
03455e79d7 | ||
|
|
c6531042da | ||
|
|
bc6bf2a0d0 | ||
|
|
7baa1573eb | ||
|
|
802e99a7fe | ||
|
|
e7aae81d03 | ||
|
|
61c1b9a0f6 | ||
|
|
fc87a8f2ec | ||
|
|
b1114c1a7a | ||
|
|
ee7a223433 | ||
|
|
8f1251a951 | ||
|
|
f3ec4a2790 | ||
|
|
774ca0c0e9 | ||
|
|
16d06a15d8 | ||
|
|
cfdcf4b4d9 | ||
|
|
8b20b8fe2a | ||
|
|
0880d5d194 | ||
|
|
bb1f3ebd56 | ||
|
|
b6c9312f4b | ||
|
|
0ea4866d65 | ||
|
|
13579e6441 | ||
|
|
df34f71be4 | ||
|
|
bc7362fbce | ||
|
|
7d48684612 | ||
|
|
04ddeb85e7 | ||
|
|
f25afae0b5 | ||
|
|
725319ad38 | ||
|
|
8a77ffc971 | ||
|
|
e827f8f702 | ||
|
|
703a5519cb | ||
|
|
4bb75f6f40 | ||
|
|
49bd38f01a | ||
|
|
a65ec9fea7 | ||
|
|
bca04036ff | ||
|
|
5f3c5848e3 | ||
|
|
dc778190bc | ||
|
|
d05d886d22 | ||
|
|
d46e13d864 | ||
|
|
4494791fc7 | ||
|
|
c4c14e9ce8 | ||
|
|
e1d59497e9 | ||
|
|
c78ba8a695 | ||
|
|
436e477430 | ||
|
|
11677aa44c | ||
|
|
081dfcfb0f | ||
|
|
3f3586a06d | ||
|
|
3b8564f9aa | ||
|
|
c11115b5cf | ||
|
|
ecfcc47f0c | ||
|
|
417b76b1f1 | ||
|
|
2804fff57f | ||
|
|
91221d9e74 | ||
|
|
a48d0bdb77 | ||
|
|
b99b89da52 | ||
|
|
ef1effdefc | ||
|
|
76cabb95da | ||
|
|
47437563aa | ||
|
|
0c15f45fa7 | ||
|
|
ea11b6ea03 | ||
|
|
1e4f9db138 | ||
|
|
0c885c1542 | ||
|
|
bb03069691 | ||
|
|
3bdefae5f8 | ||
|
|
42976b1c97 | ||
|
|
b42ee4df5d | ||
|
|
38f8f56c7a | ||
|
|
b059aaf039 | ||
|
|
5db2d6d009 | ||
|
|
f29f876bfa | ||
|
|
e2701e0f33 | ||
|
|
f949dd5c90 | ||
|
|
d4d94a1ff3 | ||
|
|
dd97954772 | ||
|
|
f2a13cf10e | ||
|
|
c734a399cc | ||
|
|
65b5b72cb7 | ||
|
|
14cbf041ea | ||
|
|
20295c071a | ||
|
|
9c45c58c7c | ||
|
|
478a3e609f | ||
|
|
e2e7dd4450 | ||
|
|
e8231a43e0 | ||
|
|
570618b844 | ||
|
|
3d05d54679 | ||
|
|
6fc6ea4d3a | ||
|
|
94884f3904 | ||
|
|
cd36c6f52b | ||
|
|
e018afcfc6 | ||
|
|
99c94c6696 | ||
|
|
f588da89a3 | ||
|
|
c55bcf7772 | ||
|
|
5d0d04e238 | ||
|
|
7f0e1373f4 | ||
|
|
dc2841045d | ||
|
|
912974cc15 | ||
|
|
afe2722f6d | ||
|
|
3a1cb63336 | ||
|
|
4174768d9f | ||
|
|
ec6bbc5255 | ||
|
|
962334bc82 | ||
|
|
7666503f68 | ||
|
|
8f2dcd0c3d | ||
|
|
f54bea12b6 | ||
|
|
e996c6eb19 | ||
|
|
e458cfc214 | ||
|
|
670dedbbd7 | ||
|
|
fd17917951 | ||
|
|
84e3d27355 | ||
|
|
98e6233202 | ||
|
|
f7d0a4797f | ||
|
|
5970f5d027 | ||
|
|
d5dc84f44e | ||
|
|
d74c3d8895 | ||
|
|
918c0e5f41 | ||
|
|
3ff5e9e8de | ||
|
|
5df84814bb | ||
|
|
34b19a8520 | ||
|
|
d4b4926320 | ||
|
|
ea9a7f1250 | ||
|
|
f1fbf61fcf | ||
|
|
60b6220028 | ||
|
|
22d7148689 | ||
|
|
b79ed14dd1 | ||
|
|
bf82648bf7 | ||
|
|
635d5488c9 | ||
|
|
f0b2fdb82e | ||
|
|
84a4601ca6 | ||
|
|
7613efde8e | ||
|
|
e22fba1694 | ||
|
|
6b9f405324 | ||
|
|
4a6847ce4e | ||
|
|
7df43979d1 | ||
|
|
7d226e13e2 | ||
|
|
56ffc5a866 | ||
|
|
7f0db09513 | ||
|
|
fdfb848402 | ||
|
|
8192380288 |
@@ -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
|
||||
|
||||
11
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
11
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -2,8 +2,6 @@ name: Bug report
|
||||
description: Create a bug report to help us improve
|
||||
labels:
|
||||
- bug
|
||||
- bug-report
|
||||
- to-triage
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
@@ -21,15 +19,6 @@ body:
|
||||
```. /etc/openwrt_release && echo $DISTRIB_REVISION```
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: release
|
||||
attributes:
|
||||
label: OpenWrt release
|
||||
description: |
|
||||
The OpenWrt 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:
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
blank_issues_enabled: true
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Feature request
|
||||
url: https://forum.openwrt.org/c/feature-requests
|
||||
|
||||
295
.github/labeler.yml
vendored
295
.github/labeler.yml
vendored
@@ -1,255 +1,138 @@
|
||||
# target/*
|
||||
"target/airoha":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/airoha/**"
|
||||
- "target/linux/airoha/**"
|
||||
"target/apm821xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/apm821xx/**"
|
||||
- "target/linux/apm821xx/**"
|
||||
"target/archs38":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/archs38/**"
|
||||
- "target/linux/archs38/**"
|
||||
"target/armsr":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/armsr/**"
|
||||
- "target/linux/armsr/**"
|
||||
"target/at91":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/at91/**"
|
||||
- "package/boot/at91bootstrap/**"
|
||||
- "package/boot/uboot-at91/**"
|
||||
- "target/linux/at91/**"
|
||||
- "package/boot/at91bootstrap/**"
|
||||
- "package/boot/uboot-at91/**"
|
||||
"target/ath25":
|
||||
- "target/linux/ath25/**"
|
||||
"target/ath79":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/ath79/**"
|
||||
- "target/linux/ath79/**"
|
||||
"target/bcm27xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/bcm27xx/**"
|
||||
- "package/kernel/bcm27xx-gpu-fw/**"
|
||||
- "package/utils/bcm27xx-utils/**"
|
||||
- "target/linux/bcm27xx/**"
|
||||
- "package/kernel/bcm27xx-gpu-fw/**"
|
||||
"target/bcm47xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/bcm47xx/**"
|
||||
- "target/linux/bcm47xx/**"
|
||||
"target/bcm4908":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/bcm4908/**"
|
||||
- "package/boot/uboot-bcm4908/**"
|
||||
- "package/boot/arm-trusted-firmware-bcm63xx/**"
|
||||
- "target/linux/bcm4908/**"
|
||||
- "package/boot/uboot-bcm4908/**"
|
||||
"target/bcm53xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/bcm53xx/**"
|
||||
- "package/boot/uboot-bcm53xx/**"
|
||||
- "target/linux/bcm53xx/**"
|
||||
"target/bcm63xx":
|
||||
- "target/linux/bcm63xx/**"
|
||||
- "package/kernel/bcm63xx-cfe/**"
|
||||
- "package/boot/arm-trusted-firmware-bcm63xx/**"
|
||||
"target/bmips":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/bmips/**"
|
||||
- "package/boot/uboot-bmips/**"
|
||||
- "package/kernel/bcm63xx-cfe/**"
|
||||
"target/d1":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/d1/**"
|
||||
- "package/boot/uboot-d1/**"
|
||||
- "package/boot/opensbi/**"
|
||||
- "target/linux/bmips/**"
|
||||
"target/gemini":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/gemini/**"
|
||||
- "target/linux/gemini/**"
|
||||
"target/imx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/imx/**"
|
||||
- "package/boot/imx-bootlets/**"
|
||||
- "package/boot/uboot-imx/**"
|
||||
- "target/linux/imx/**"
|
||||
- "package/boot/imx-bootlets/**"
|
||||
- "package/boot/uboot-imx/**"
|
||||
"target/ipq40xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/ipq40xx/**"
|
||||
- "target/linux/ipq40xx/**"
|
||||
"target/ipq806x":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/ipq806x/**"
|
||||
"target/qualcommax":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/qualcommax/**"
|
||||
- "package/kernel/qca-ssdk/**"
|
||||
- "package/kernel/qca-nss-dp/**"
|
||||
"target/qualcommbe":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/qualcommbe/**"
|
||||
"target/ixp4xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/ixp4xx/**"
|
||||
- "package/boot/apex/Makefile/**"
|
||||
- "package/firmware/ixp4xx-microcode/**"
|
||||
- "target/linux/ipq806x/**"
|
||||
"target/ipq807x":
|
||||
- "target/linux/ipq807x/**"
|
||||
"target/kirkwood":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/kirkwood/**"
|
||||
- "package/boot/uboot-kirkwood/**"
|
||||
- "target/linux/kirkwood/**"
|
||||
- "package/boot/uboot-kirkwood/**"
|
||||
"target/lantiq":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/lantiq/**"
|
||||
- "package/kernel/lantiq/**"
|
||||
- "package/firmware/lantiq/**"
|
||||
- "package/boot/uboot-lantiq/**"
|
||||
- "target/linux/lantiq/**"
|
||||
- "package/kernel/lantiq/**"
|
||||
- "package/firmware/lantiq/**"
|
||||
- "package/boot/uboot-lantiq/**"
|
||||
"target/layerscape":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/layerscape/**"
|
||||
- "package/firmware/layerscape/**"
|
||||
- "package/boot/tfa-layerscape/**"
|
||||
- "package/boot/uboot-layerscape/**"
|
||||
- "package/network/utils/layerscape/**"
|
||||
"target/loongarch64":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/loongarch64/**"
|
||||
- "target/linux/layerscape/**"
|
||||
- "package/firmware/layerscape/**"
|
||||
- "package/boot/tfa-layerscape/**"
|
||||
- "package/boot/uboot-layerscape/**"
|
||||
- "package/network/utils/layerscape/**"
|
||||
"target/malta":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/malta/**"
|
||||
- "target/linux/malta/**"
|
||||
"target/mediatek":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/mediatek/**"
|
||||
- "package/boot/arm-trusted-firmware-mediatek/**"
|
||||
- "package/boot/uboot-mediatek/**"
|
||||
- "target/linux/mediatek/**"
|
||||
- "package/boot/arm-trusted-firmware-mediatek/**"
|
||||
- "package/boot/uboot-mediatek/**"
|
||||
"target/mpc85xx":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/mpc85xx/**"
|
||||
- "target/linux/mpc85xx/**"
|
||||
"target/mvebu":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/mvebu/**"
|
||||
- "package/boot/arm-trusted-firmware-mvebu/**"
|
||||
- "package/boot/uboot-mvebu/**"
|
||||
- "target/linux/mvebu/**"
|
||||
- "package/boot/arm-trusted-firmware-mvebu/**"
|
||||
- "package/boot/uboot-mvebu/**"
|
||||
"target/mxs":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/mxs/**"
|
||||
- "package/boot/uboot-mxs/**"
|
||||
- "target/linux/mxs/**"
|
||||
- "package/boot/uboot-mxs/**"
|
||||
"target/octeon":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/octeon/**"
|
||||
- "target/linux/octeon/**"
|
||||
"target/octeontx":
|
||||
- "target/linux/octeontx/**"
|
||||
"target/omap":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/omap/**"
|
||||
- "package/boot/uboot-omap/**"
|
||||
- "target/linux/omap/**"
|
||||
- "package/boot/uboot-omap/**"
|
||||
"target/oxnas":
|
||||
- "target/linux/oxnas/**"
|
||||
- "package/boot/uboot-oxnas/**"
|
||||
"target/pistachio":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/pistachio/**"
|
||||
- "target/linux/pistachio/**"
|
||||
"target/qoriq":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/qoriq/**"
|
||||
- "target/linux/qoriq/**"
|
||||
"target/ramips":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/ramips/**"
|
||||
- "target/linux/ramips/**"
|
||||
"target/realtek":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/realtek/**"
|
||||
- "target/linux/realtek/**"
|
||||
"target/rockchip":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/rockchip/**"
|
||||
- "package/boot/arm-trusted-firmware-rockchip/**"
|
||||
- "package/boot/uboot-rockchip/**"
|
||||
- "target/linux/rockchip/**"
|
||||
- "package/boot/arm-trusted-firmware-rockchip/**"
|
||||
- "package/boot/uboot-rockchip/**"
|
||||
"target/sifiveu":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/sifiveu/**"
|
||||
- "package/boot/uboot-sifiveu/**"
|
||||
- "package/boot/opensbi/**"
|
||||
"target/siflower":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/siflower/**"
|
||||
"target/starfive":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/starfive/**"
|
||||
"target/stm32":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/stm32/**"
|
||||
- "package/boot/arm-trusted-firmware-stm32/**"
|
||||
- "package/boot/optee-os-stm32/**"
|
||||
- "package/boot/uboot-stm32/**"
|
||||
- "target/linux/sifiveu/**"
|
||||
- "package/boot/uboot-sifiveu/**"
|
||||
- "package/boot/opensbi/**"
|
||||
"target/sunxi":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/sunxi/**"
|
||||
- "package/boot/arm-trusted-firmware-sunxi/**"
|
||||
- "package/boot/uboot-sunxi/**"
|
||||
- "target/linux/sunxi/**"
|
||||
- "package/boot/arm-trusted-firmware-sunxi/**"
|
||||
- "package/boot/uboot-sunxi/**"
|
||||
"target/tegra":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/tegra/**"
|
||||
- "package/boot/uboot-tegra/**"
|
||||
- "target/linux/tegra/**"
|
||||
- "package/boot/uboot-tegra/**"
|
||||
"target/uml":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/uml/**"
|
||||
- "target/linux/uml/**"
|
||||
"target/x86":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/x86/**"
|
||||
- "target/linux/x86/**"
|
||||
"target/zynq":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/zynq/**"
|
||||
- "package/boot/uboot-zynq/**"
|
||||
- "target/linux/zynq/**"
|
||||
- "package/boot/uboot-zynq/**"
|
||||
# target/imagebuilder
|
||||
"target/imagebuilder":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/imagebuilder/**"
|
||||
- "target/imagebuilder/**"
|
||||
# kernel
|
||||
"kernel":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "target/linux/generic/**"
|
||||
- "target/linux/**/config-*"
|
||||
- "target/linux/**/patches-*"
|
||||
- "target/linux/**/files/**"
|
||||
- "package/kernel/linux/**"
|
||||
- "target/linux/generic/**"
|
||||
- "target/linux/**/config-*"
|
||||
- "target/linux/**/patches-*"
|
||||
- "target/linux/**/files/**"
|
||||
- "package/kernel/linux/**"
|
||||
# core packages
|
||||
"core packages":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "package/**"
|
||||
- "package/**"
|
||||
# build/scripts/tools
|
||||
"build/scripts/tools":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "include/**"
|
||||
- "scripts/**"
|
||||
- "tools/**"
|
||||
- "include/**"
|
||||
- "scripts/**"
|
||||
- "tools/**"
|
||||
# toolchain
|
||||
"toolchain":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "toolchain/**"
|
||||
- "toolchain/**"
|
||||
# GitHub/CI
|
||||
"GitHub/CI":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- ".github/**"
|
||||
- ".github/**"
|
||||
|
||||
4
.github/workflows/Dockerfile.tools
vendored
Normal file
4
.github/workflows/Dockerfile.tools
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v2
|
||||
|
||||
COPY --chown=buildbot staging_dir/host /prebuilt_tools/staging_dir/host
|
||||
COPY --chown=buildbot build_dir/host /prebuilt_tools/build_dir/host
|
||||
72
.github/workflows/build-tools.yml
vendored
Normal file
72
.github/workflows/build-tools.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
name: Build host tools
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
generate_prebuilt_artifacts:
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build tools
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v2
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: openwrt
|
||||
|
||||
- name: Fix permission
|
||||
run: chown -R buildbot:buildbot openwrt
|
||||
|
||||
- name: Set configs for tools container
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
touch .config
|
||||
echo CONFIG_DEVEL=y >> .config
|
||||
echo CONFIG_AUTOREMOVE=y >> .config
|
||||
echo CONFIG_CCACHE=y >> .config
|
||||
|
||||
- name: Make prereq
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make defconfig
|
||||
|
||||
- name: Build tools
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-buildbot-logs
|
||||
path: openwrt/logs
|
||||
|
||||
- name: Upload config
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-buildbot-config
|
||||
path: openwrt/.config
|
||||
|
||||
- name: Archive prebuilt tools
|
||||
if: inputs.generate_prebuilt_artifacts == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: tar -cf tools.tar staging_dir/host build_dir/host
|
||||
|
||||
- name: Upload prebuilt tools
|
||||
if: inputs.generate_prebuilt_artifacts == true
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux-buildbot-prebuilt-tools
|
||||
path: openwrt/tools.tar
|
||||
retention-days: 1
|
||||
435
.github/workflows/build.yml
vendored
Normal file
435
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,435 @@
|
||||
name: Build sub target
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
coverity_api_token:
|
||||
inputs:
|
||||
target:
|
||||
required: true
|
||||
type: string
|
||||
subtarget:
|
||||
required: true
|
||||
type: string
|
||||
testing:
|
||||
type: boolean
|
||||
build_toolchain:
|
||||
type: boolean
|
||||
include_feeds:
|
||||
type: boolean
|
||||
build_full:
|
||||
type: boolean
|
||||
build_kernel:
|
||||
type: boolean
|
||||
build_all_modules:
|
||||
type: boolean
|
||||
build_all_kmods:
|
||||
type: boolean
|
||||
build_all_boards:
|
||||
type: boolean
|
||||
use_openwrt_container:
|
||||
type: boolean
|
||||
default: true
|
||||
coverity_project_name:
|
||||
type: string
|
||||
default: OpenWrt
|
||||
coverity_check_packages:
|
||||
type: string
|
||||
coverity_compiler_template_list:
|
||||
type: string
|
||||
default: >-
|
||||
arm-openwrt-linux-gcc
|
||||
coverity_force_compile_packages:
|
||||
type: string
|
||||
default: >-
|
||||
curl
|
||||
libnl
|
||||
mbedtls
|
||||
wolfssl
|
||||
openssl
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
setup_build:
|
||||
name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }}
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
|
||||
ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }}
|
||||
container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set lower case owner name
|
||||
id: lower_owner
|
||||
run: |
|
||||
OWNER_LC=$(echo "${{ github.repository_owner }}" \
|
||||
| tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [ ${{ inputs.use_openwrt_container }} == "true" ]; then
|
||||
OWNER_LC=openwrt
|
||||
fi
|
||||
|
||||
echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate ccache hash
|
||||
id: ccache_hash
|
||||
run: |
|
||||
CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \
|
||||
| md5sum | awk '{ print $1 }')
|
||||
echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT
|
||||
|
||||
# Per branch tools container tag
|
||||
# By default stick to latest
|
||||
# For official test targetting openwrt stable branch
|
||||
# Get the branch or parse the tag and push dedicated tools containers
|
||||
# For local test to use the correct container for stable release testing
|
||||
# you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]-
|
||||
- name: Determine tools container tag
|
||||
id: determine_tools_container
|
||||
run: |
|
||||
CONTAINER_TAG=latest
|
||||
if [ -n "${{ github.base_ref }}" ]; then
|
||||
if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
||||
CONTAINER_TAG="${{ github.base_ref }}"
|
||||
fi
|
||||
elif [ ${{ github.ref_type }} == "branch" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
||||
CONTAINER_TAG=${{ github.ref_name }}
|
||||
elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
|
||||
CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
|
||||
fi
|
||||
elif [ ${{ github.ref_type }} == "tag" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
|
||||
CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
|
||||
fi
|
||||
fi
|
||||
echo "Tools container to use tools:$CONTAINER_TAG"
|
||||
echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
name: Build ${{ inputs.target }}/${{ inputs.subtarget }}
|
||||
needs: setup_build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
|
||||
steps:
|
||||
- name: Checkout master directory
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: openwrt
|
||||
|
||||
- name: Checkout packages feed
|
||||
if: inputs.include_feeds == true
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: openwrt/packages
|
||||
path: openwrt/feeds/packages
|
||||
|
||||
- name: Checkout luci feed
|
||||
if: inputs.include_feeds == true
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: openwrt/luci
|
||||
path: openwrt/feeds/luci
|
||||
|
||||
- name: Checkout routing feed
|
||||
if: inputs.include_feeds == true
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: openwrt/routing
|
||||
path: openwrt/feeds/routing
|
||||
|
||||
- name: Checkout telephony feed
|
||||
if: inputs.include_feeds == true
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: openwrt/telephony
|
||||
path: openwrt/feeds/telephony
|
||||
|
||||
- name: Parse toolchain file
|
||||
if: inputs.build_toolchain == false
|
||||
id: parse-toolchain
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
TOOLCHAIN_PATH=snapshots
|
||||
|
||||
if [ -n "${{ github.base_ref }}" ]; then
|
||||
if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
||||
major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')"
|
||||
fi
|
||||
elif [ "${{ github.ref_type }}" = "branch" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
||||
major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')"
|
||||
elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
|
||||
major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')"
|
||||
fi
|
||||
elif [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
|
||||
major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$major_ver" ]; then
|
||||
git fetch --tags -f
|
||||
latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)"
|
||||
if [ -n "$latest_tag" ]; then
|
||||
TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//')
|
||||
fi
|
||||
fi
|
||||
|
||||
SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums"
|
||||
if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then
|
||||
TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")"
|
||||
TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p')
|
||||
|
||||
echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT
|
||||
elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then
|
||||
TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")"
|
||||
TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p')
|
||||
|
||||
echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "toolchain-type=internal" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV"
|
||||
echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Fix permission
|
||||
run: |
|
||||
chown -R buildbot:buildbot openwrt
|
||||
|
||||
- name: Prepare prebuilt tools
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
mkdir -p staging_dir build_dir
|
||||
ln -s /prebuilt_tools/staging_dir/host staging_dir/host
|
||||
ln -s /prebuilt_tools/build_dir/host build_dir/host
|
||||
|
||||
./scripts/ext-tools.sh --refresh
|
||||
|
||||
- name: Update & Install feeds
|
||||
if: inputs.include_feeds == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
./scripts/feeds update -a
|
||||
./scripts/feeds install -a
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: openwrt/.ccache
|
||||
key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ needs.setup_build.outputs.ccache_hash }}
|
||||
restore-keys: |
|
||||
ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-
|
||||
|
||||
- name: Download external toolchain/sdk
|
||||
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal'
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \
|
||||
| tar --xz -xf -
|
||||
|
||||
- name: Configure testing kernel
|
||||
if: inputs.testing == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_TESTING_KERNEL=y >> .config
|
||||
|
||||
- name: Configure all kernel modules
|
||||
if: inputs.build_all_kmods == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_ALL_KMODS=y >> .config
|
||||
|
||||
- name: Configure all modules
|
||||
if: inputs.build_all_modules == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_ALL=y >> .config
|
||||
|
||||
- name: Configure all boards
|
||||
if: inputs.build_all_boards == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_TARGET_MULTI_PROFILE=y >> .config
|
||||
echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config
|
||||
echo CONFIG_TARGET_ALL_PROFILES=y >> .config
|
||||
|
||||
- name: Configure external toolchain
|
||||
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain'
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_DEVEL=y >> .config
|
||||
echo CONFIG_AUTOREMOVE=y >> .config
|
||||
echo CONFIG_CCACHE=y >> .config
|
||||
|
||||
./scripts/ext-toolchain.sh \
|
||||
--toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \
|
||||
--overwrite-config \
|
||||
--config ${{ inputs.target }}/${{ inputs.subtarget }}
|
||||
|
||||
- name: Adapt external sdk to external toolchain format
|
||||
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk'
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain)
|
||||
TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin
|
||||
OPENWRT_DIR=$(pwd)
|
||||
|
||||
# Find target name from toolchain info.mk
|
||||
GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/')
|
||||
|
||||
cd $TOOLCHAIN_BIN
|
||||
|
||||
# Revert sdk wrapper scripts applied to all the bins
|
||||
for app in $(find . -name "*.bin"); do
|
||||
TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/')
|
||||
rm $TARGET_APP
|
||||
mv .$TARGET_APP.bin $TARGET_APP
|
||||
done
|
||||
|
||||
# Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build
|
||||
cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh
|
||||
for app in cc gcc g++ c++ cpp ld as ; do
|
||||
[ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin
|
||||
ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app
|
||||
done
|
||||
|
||||
- name: Configure external toolchain with sdk
|
||||
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk'
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_DEVEL=y >> .config
|
||||
echo CONFIG_AUTOREMOVE=y >> .config
|
||||
echo CONFIG_CCACHE=y >> .config
|
||||
|
||||
./scripts/ext-toolchain.sh \
|
||||
--toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \
|
||||
--overwrite-config \
|
||||
--config ${{ inputs.target }}/${{ inputs.subtarget }}
|
||||
|
||||
- name: Configure internal toolchain
|
||||
if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal'
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_DEVEL=y >> .config
|
||||
echo CONFIG_AUTOREMOVE=y >> .config
|
||||
echo CONFIG_CCACHE=y >> .config
|
||||
|
||||
echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
|
||||
echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
|
||||
|
||||
make defconfig
|
||||
|
||||
- name: Show configuration
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: ./scripts/diffconfig.sh
|
||||
|
||||
- name: Build tools
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Build toolchain
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Build Kernel
|
||||
if: inputs.build_kernel == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Build Kernel Kmods
|
||||
if: inputs.build_kernel == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Build everything
|
||||
if: inputs.build_full == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Coverity prepare toolchain
|
||||
if: inputs.coverity_check_packages != ''
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}" -O coverity.tar.gz
|
||||
wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}&md5=1" -O coverity.tar.gz.md5
|
||||
echo ' coverity.tar.gz' >> coverity.tar.gz.md5
|
||||
md5sum -c coverity.tar.gz.md5
|
||||
|
||||
mkdir cov-analysis-linux64
|
||||
tar xzf coverity.tar.gz --strip 1 -C cov-analysis-linux64
|
||||
export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH
|
||||
|
||||
for template in ${{ inputs.coverity_compiler_template_list }}; do
|
||||
cov-configure --template --comptype gcc --compiler "$template"
|
||||
done
|
||||
|
||||
- name: Clean and recompile packages with Coverity toolchain
|
||||
if: inputs.coverity_check_packages != ''
|
||||
shell: su buildbot -c "bash {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
set -o pipefail -o errexit
|
||||
|
||||
coverity_check_packages=(${{ inputs.coverity_check_packages }})
|
||||
printf -v clean_packages "package/%s/clean " "${coverity_check_packages[@]}"
|
||||
make -j$(nproc) BUILD_LOG=1 $clean_packages || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
coverity_force_compile_packages=(${{ inputs.coverity_force_compile_packages }})
|
||||
printf -v force_compile_packages "package/%s/compile " "${coverity_force_compile_packages[@]}"
|
||||
make -j$(nproc) BUILD_LOG=1 $force_compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
printf -v compile_packages "package/%s/compile " "${coverity_check_packages[@]}"
|
||||
export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH
|
||||
cov-build --dir cov-int make -j $(nproc) BUILD_LOG=1 $compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Upload build to Coverity for analysis
|
||||
if: inputs.coverity_check_packages != ''
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
tar czf cov-int.tar.gz ./cov-int
|
||||
curl \
|
||||
--form token="${{ secrets.coverity_api_token }}" \
|
||||
--form email="contact@openwrt.org" \
|
||||
--form file=@cov-int.tar.gz \
|
||||
--form version="${{ github.ref_name }}-${{ github.sha }}" \
|
||||
--form description="OpenWrt ${{ github.ref_name }}-${{ github.sha }}" \
|
||||
"https://scan.coverity.com/builds?project=${{ inputs.coverity_project_name }}"
|
||||
|
||||
- name: Upload logs
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs
|
||||
path: "openwrt/logs"
|
||||
155
.github/workflows/check-kernel-patches.yml
vendored
Normal file
155
.github/workflows/check-kernel-patches.yml
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
name: Refresh kernel for target
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
target:
|
||||
required: true
|
||||
type: string
|
||||
subtarget:
|
||||
required: true
|
||||
type: string
|
||||
testing:
|
||||
type: boolean
|
||||
use_openwrt_container:
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
setup_build:
|
||||
name: Setup build
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
|
||||
container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
|
||||
|
||||
steps:
|
||||
- name: Set lower case owner name
|
||||
id: lower_owner
|
||||
run: |
|
||||
OWNER_LC=$(echo "${{ github.repository_owner }}" \
|
||||
| tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [ ${{ inputs.use_openwrt_container }} == "true" ]; then
|
||||
OWNER_LC=openwrt
|
||||
fi
|
||||
|
||||
echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
|
||||
|
||||
# Per branch tools container tag
|
||||
# By default stick to latest
|
||||
# For official test targetting openwrt stable branch
|
||||
# Get the branch or parse the tag and push dedicated tools containers
|
||||
# For local test to use the correct container for stable release testing
|
||||
# you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]-
|
||||
- name: Determine tools container tag
|
||||
id: determine_tools_container
|
||||
run: |
|
||||
CONTAINER_TAG=latest
|
||||
if [ -n "${{ github.base_ref }}" ]; then
|
||||
if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
||||
CONTAINER_TAG="${{ github.base_ref }}"
|
||||
fi
|
||||
elif [ ${{ github.ref_type }} == "branch" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
||||
CONTAINER_TAG=${{ github.ref_name }}
|
||||
elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
|
||||
CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
|
||||
fi
|
||||
elif [ ${{ github.ref_type }} == "tag" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
|
||||
CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
|
||||
fi
|
||||
fi
|
||||
echo "Tools container to use tools:$CONTAINER_TAG"
|
||||
echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
check-patch:
|
||||
name: Check Kernel patches
|
||||
needs: setup_build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
|
||||
steps:
|
||||
- name: Checkout master directory
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: openwrt
|
||||
|
||||
- name: Fix permission
|
||||
run: |
|
||||
chown -R buildbot:buildbot openwrt
|
||||
|
||||
- name: Prepare prebuilt tools
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
mkdir -p staging_dir build_dir
|
||||
ln -sf /prebuilt_tools/staging_dir/host staging_dir/host
|
||||
ln -sf /prebuilt_tools/build_dir/host build_dir/host
|
||||
|
||||
./scripts/ext-tools.sh --refresh
|
||||
|
||||
- name: Configure testing kernel
|
||||
if: inputs.testing == true
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_TESTING_KERNEL=y >> .config
|
||||
|
||||
- name: Configure system
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
echo CONFIG_ALL_KMODS=y >> .config
|
||||
echo CONFIG_DEVEL=y >> .config
|
||||
echo CONFIG_AUTOREMOVE=y >> .config
|
||||
echo CONFIG_CCACHE=y >> .config
|
||||
|
||||
echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
|
||||
echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
|
||||
|
||||
make defconfig
|
||||
|
||||
- name: Build tools
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Refresh Kernel patches
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: make target/linux/refresh V=s
|
||||
|
||||
- name: Validate Refreshed Kernel Patches
|
||||
shell: su buildbot -c "sh -e {0}"
|
||||
working-directory: openwrt
|
||||
run: |
|
||||
. .github/workflows/scripts/ci_helpers.sh
|
||||
|
||||
if git diff --name-only --exit-code; then
|
||||
success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok"
|
||||
else
|
||||
err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)"
|
||||
err "You can also check the provided artifacts with the refreshed patch from this CI run."
|
||||
mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
|
||||
for f in $(git diff --name-only); do
|
||||
cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload Refreshed Patches
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
|
||||
path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
|
||||
50
.github/workflows/coverity.yml
vendored
50
.github/workflows/coverity.yml
vendored
@@ -15,5 +15,51 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
actions: write
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/coverity.yml@main
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
target: x86
|
||||
subtarget: 64
|
||||
build_full: true
|
||||
include_feeds: true
|
||||
coverity_compiler_template_list: >-
|
||||
x86_64-openwrt-linux-gcc
|
||||
x86_64-openwrt-linux-musl-gcc
|
||||
# qosify fails to build with cov-build
|
||||
coverity_check_packages: >-
|
||||
cgi-io
|
||||
dnsmasq
|
||||
dropbear
|
||||
firewall
|
||||
fstools
|
||||
fwtool
|
||||
iwinfo
|
||||
jsonfilter
|
||||
libnl-tiny
|
||||
libubox
|
||||
mtd
|
||||
netifd
|
||||
odhcp6c
|
||||
odhcpd
|
||||
opkg
|
||||
procd
|
||||
relayd
|
||||
rpcd
|
||||
swconfig
|
||||
ubox
|
||||
ubus
|
||||
ucert
|
||||
uci
|
||||
uclient
|
||||
ucode
|
||||
ugps
|
||||
uhttpd
|
||||
umbim
|
||||
umdns
|
||||
unetd
|
||||
uqmi
|
||||
urngd
|
||||
usbmode
|
||||
usign
|
||||
usteer
|
||||
ustp
|
||||
ustream-ssl
|
||||
|
||||
63
.github/workflows/formal.yml
vendored
63
.github/workflows/formal.yml
vendored
@@ -9,4 +9,65 @@ permissions:
|
||||
jobs:
|
||||
build:
|
||||
name: Test Formalities
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/formal.yml@main
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Determine branch name
|
||||
run: |
|
||||
BRANCH="${GITHUB_BASE_REF#refs/heads/}"
|
||||
echo "Building for $BRANCH"
|
||||
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
||||
|
||||
- name: Test formalities
|
||||
run: |
|
||||
source .github/workflows/scripts/ci_helpers.sh
|
||||
|
||||
RET=0
|
||||
for commit in $(git rev-list HEAD ^origin/$BRANCH); do
|
||||
info "=== Checking commit '$commit'"
|
||||
if git show --format='%P' -s $commit | grep -qF ' '; then
|
||||
err "Pull request should not include merge commits"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
author="$(git show -s --format=%aN $commit)"
|
||||
if echo $author | grep -q '\S\+\s\+\S\+'; then
|
||||
success "Author name ($author) seems ok"
|
||||
else
|
||||
err "Author name ($author) need to be your real name 'firstname lastname'"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
subject="$(git show -s --format=%s $commit)"
|
||||
if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_\.-]\+: ' -e '^Revert '; then
|
||||
success "Commit subject line seems ok ($subject)"
|
||||
else
|
||||
err "Commit subject line MUST start with '<area>: ' ($subject)"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
body="$(git show -s --format=%b $commit)"
|
||||
sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
|
||||
if echo "$body" | grep -qF "$sob"; then
|
||||
success "Signed-off-by match author"
|
||||
else
|
||||
err "Signed-off-by is missing or doesn't match author (should be '$sob')"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
if echo "$body" | grep -v "Signed-off-by:"; then
|
||||
success "A commit message exists"
|
||||
else
|
||||
err "Missing commit message. Please describe your changes"
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
||||
|
||||
24
.github/workflows/github-release.yml
vendored
24
.github/workflows/github-release.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: Create GitHub release
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
draft: true
|
||||
prerelease: true
|
||||
11
.github/workflows/issue-labeller.yml
vendored
11
.github/workflows/issue-labeller.yml
vendored
@@ -1,11 +0,0 @@
|
||||
name: Issue Labeller
|
||||
on:
|
||||
issues:
|
||||
types: [ opened ]
|
||||
|
||||
jobs:
|
||||
label-component:
|
||||
name: Validate and Tag Bug Report
|
||||
permissions:
|
||||
issues: write
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/issue-labeller.yml@main
|
||||
111
.github/workflows/kernel.yml
vendored
111
.github/workflows/kernel.yml
vendored
@@ -17,8 +17,6 @@ on:
|
||||
- 'include/kernel*'
|
||||
- 'package/kernel/**'
|
||||
- 'target/linux/**'
|
||||
branches-ignore:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -28,15 +26,106 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build-kernels:
|
||||
name: Build all affected Kernels
|
||||
determine_targets:
|
||||
name: Set targets
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }}
|
||||
targets: ${{ steps.find_targets.outputs.targets }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
|
||||
- name: Set targets
|
||||
id: find_targets
|
||||
run: |
|
||||
ALL_TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null)"
|
||||
CHANGED_FILES="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n')"
|
||||
|
||||
TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')"
|
||||
TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')"
|
||||
|
||||
# On testing non-specific target, skip testing each subtarget
|
||||
if echo "$CHANGED_FILES" | grep -v -q target/linux ||
|
||||
echo "$CHANGED_FILES" | grep -q target/linux/generic; then
|
||||
TARGETS_SUBTARGETS=$TARGETS
|
||||
fi
|
||||
|
||||
JSON_TARGETS_SUBTARGETS='['
|
||||
FIRST=1
|
||||
for TARGET in $TARGETS_SUBTARGETS; do
|
||||
if echo "$CHANGED_FILES" | grep -v -q target/linux ||
|
||||
echo "$CHANGED_FILES" | grep -q target/linux/generic ||
|
||||
echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
|
||||
TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
|
||||
[[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
|
||||
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE"
|
||||
FIRST=0
|
||||
fi
|
||||
done
|
||||
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']'
|
||||
|
||||
JSON_TARGETS='['
|
||||
FIRST=1
|
||||
for TARGET in $TARGETS; do
|
||||
if echo "$CHANGED_FILES" | grep -v -q target/linux ||
|
||||
echo "$CHANGED_FILES" | grep -q target/linux/generic ||
|
||||
echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
|
||||
TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
|
||||
[[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
|
||||
JSON_TARGETS="$JSON_TARGETS""$TUPLE"
|
||||
FIRST=0
|
||||
fi
|
||||
done
|
||||
JSON_TARGETS="$JSON_TARGETS"']'
|
||||
|
||||
echo -e "\n---- targets to build ----\n"
|
||||
echo "$JSON_TARGETS_SUBTARGETS"
|
||||
echo -e "\n---- targets to build ----\n"
|
||||
|
||||
echo -e "\n---- targets to check patch ----\n"
|
||||
echo "$JSON_TARGETS"
|
||||
echo -e "\n---- targets to check patch ----\n"
|
||||
|
||||
echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT
|
||||
echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
name: Build Kernel with external toolchain
|
||||
needs: determine_targets
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
actions: write
|
||||
secrets:
|
||||
ccache_s3_endpoint: ${{ secrets.CCACHE_S3_ENDPOINT }}
|
||||
ccache_s3_bucket: ${{ secrets.CCACHE_S3_BUCKET }}
|
||||
ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }}
|
||||
ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }}
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/kernel.yml@main
|
||||
strategy:
|
||||
fail-fast: False
|
||||
matrix:
|
||||
include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
subtarget: ${{ matrix.subtarget }}
|
||||
build_kernel: true
|
||||
build_all_kmods: true
|
||||
|
||||
check-kernel-patches:
|
||||
name: Check Kernel patches
|
||||
needs: determine_targets
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
strategy:
|
||||
fail-fast: False
|
||||
matrix:
|
||||
include: ${{fromJson(needs.determine_targets.outputs.targets)}}
|
||||
uses: ./.github/workflows/check-kernel-patches.yml
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
subtarget: ${{ matrix.subtarget }}
|
||||
|
||||
|
||||
42
.github/workflows/label-kernel.yml
vendored
42
.github/workflows/label-kernel.yml
vendored
@@ -7,10 +7,44 @@ on:
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
build-kernels-label:
|
||||
name: Build all affected Kernels from defined label
|
||||
set_target:
|
||||
if: startsWith(github.event.label.name, 'ci:kernel:')
|
||||
name: Set target
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
target: ${{ steps.set_target.outputs.target }}
|
||||
subtarget: ${{ steps.set_target.outputs.subtarget }}
|
||||
|
||||
steps:
|
||||
- name: Set target
|
||||
id: set_target
|
||||
env:
|
||||
CI_EVENT_LABEL_NAME: ${{ github.event.label.name }}
|
||||
run: |
|
||||
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT
|
||||
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT
|
||||
|
||||
build_kernel:
|
||||
name: Build Kernel with external toolchain
|
||||
needs: set_target
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
actions: write
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/label-kernel.yml@main
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
container_name: toolchain
|
||||
target: ${{ needs.set_target.outputs.target }}
|
||||
subtarget: ${{ needs.set_target.outputs.subtarget }}
|
||||
build_kernel: true
|
||||
build_all_kmods: true
|
||||
|
||||
check-kernel-patches:
|
||||
name: Check Kernel patches
|
||||
needs: set_target
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
uses: ./.github/workflows/check-kernel-patches.yml
|
||||
with:
|
||||
target: ${{ needs.set_target.outputs.target }}
|
||||
subtarget: ${{ needs.set_target.outputs.subtarget }}
|
||||
|
||||
33
.github/workflows/label-target.yml
vendored
33
.github/workflows/label-target.yml
vendored
@@ -7,10 +7,35 @@ on:
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
build-target-label:
|
||||
name: Build target from defined label
|
||||
set_target:
|
||||
if: startsWith(github.event.label.name, 'ci:target:')
|
||||
name: Set target
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
target: ${{ steps.set_target.outputs.target }}
|
||||
subtarget: ${{ steps.set_target.outputs.subtarget }}
|
||||
|
||||
steps:
|
||||
- name: Set target
|
||||
id: set_target
|
||||
env:
|
||||
CI_EVENT_LABEL_NAME: ${{ github.event.label.name }}
|
||||
run: |
|
||||
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT
|
||||
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT
|
||||
|
||||
build_target:
|
||||
name: Build target
|
||||
needs: set_target
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
actions: write
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/label-target.yml@main
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
container_name: toolchain
|
||||
target: ${{ needs.set_target.outputs.target }}
|
||||
subtarget: ${{ needs.set_target.outputs.subtarget }}
|
||||
build_full: true
|
||||
build_all_kmods: true
|
||||
build_all_boards: true
|
||||
build_all_modules: true
|
||||
|
||||
4
.github/workflows/labeler.yml
vendored
4
.github/workflows/labeler.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
name: Pull Request Labeler
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
echo "release-tag=$(echo ${{ github.base_ref }} | sed 's/openwrt-/release\//')" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- uses: buildsville/add-remove-label@v2.0.1
|
||||
- uses: buildsville/add-remove-label@v2.0.0
|
||||
if: ${{ steps.check-branch.outputs.release-tag }}
|
||||
with:
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
32
.github/workflows/packages.yml
vendored
32
.github/workflows/packages.yml
vendored
@@ -3,6 +3,7 @@ name: Build all core packages
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- '.github/workflows/packages.yml'
|
||||
- 'config/**'
|
||||
- 'include/**'
|
||||
@@ -11,14 +12,13 @@ on:
|
||||
- 'toolchain/**'
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- '.github/workflows/packages.yml'
|
||||
- 'config/**'
|
||||
- 'include/**'
|
||||
- 'package/**'
|
||||
- 'target/linux/generic/**'
|
||||
- 'toolchain/**'
|
||||
branches-ignore:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -28,15 +28,25 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build-packages:
|
||||
name: Build all core packages for selected target
|
||||
build:
|
||||
name: Build Packages with external toolchain
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
actions: write
|
||||
secrets:
|
||||
ccache_s3_endpoint: ${{ secrets.CCACHE_S3_ENDPOINT }}
|
||||
ccache_s3_bucket: ${{ secrets.CCACHE_S3_BUCKET }}
|
||||
ccache_s3_access_key: ${{ secrets.CCACHE_S3_ACCESS_KEY }}
|
||||
ccache_s3_secret_key: ${{ secrets.CCACHE_S3_SECRET_KEY }}
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/packages.yml@main
|
||||
strategy:
|
||||
fail-fast: False
|
||||
matrix:
|
||||
include:
|
||||
- target: malta
|
||||
subtarget: be
|
||||
- target: x86
|
||||
subtarget: 64
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
subtarget: ${{ matrix.subtarget }}
|
||||
build_kernel: true
|
||||
build_all_kmods: true
|
||||
build_all_modules: true
|
||||
build_full: true
|
||||
|
||||
|
||||
87
.github/workflows/push-containers.yml
vendored
87
.github/workflows/push-containers.yml
vendored
@@ -4,25 +4,94 @@ on:
|
||||
push:
|
||||
paths:
|
||||
- 'include/version.mk'
|
||||
- 'include/cmake.mk'
|
||||
- 'tools/**'
|
||||
- '.github/workflows/build-tools.yml'
|
||||
- '.github/workflows/push-containers.yml'
|
||||
- 'toolchain/**'
|
||||
branches-ignore:
|
||||
- master
|
||||
- '.github/workflows/Dockerfile.tools'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-push-containers:
|
||||
name: Build and Push all prebuilt containers
|
||||
build-linux-buildbot:
|
||||
name: Build tools with buildbot container
|
||||
if: ${{ github.repository_owner == 'openwrt' }}
|
||||
uses: ./.github/workflows/build-tools.yml
|
||||
with:
|
||||
generate_prebuilt_artifacts: true
|
||||
|
||||
push-tools-container:
|
||||
needs: build-linux-buildbot
|
||||
name: Push prebuilt tools container
|
||||
if: ${{ github.repository_owner == 'openwrt' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
actions: write
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/push-containers.yml@main
|
||||
|
||||
steps:
|
||||
- name: Set lower case owner name
|
||||
env:
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
run: |
|
||||
echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
|
||||
|
||||
# Per branch tools container tag
|
||||
# By default stick to latest
|
||||
# For official test targetting openwrt stable branch
|
||||
# Get the branch or parse the tag and push dedicated tools containers
|
||||
# Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9]
|
||||
# will refresh the tools container with the matching tag.
|
||||
# (example branch openwrt-22.03 -> tools:openwrt-22.03)
|
||||
# (example branch openwrt-22.03-test -> tools:openwrt-22.03)
|
||||
- name: Determine tools container tag
|
||||
run: |
|
||||
CONTAINER_TAG=latest
|
||||
|
||||
if [ ${{ github.ref_type }} == "branch" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
|
||||
CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')"
|
||||
fi
|
||||
elif [ ${{ github.ref_type }} == "tag" ]; then
|
||||
if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
|
||||
CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Tools container to push tools:$CONTAINER_TAG"
|
||||
echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: 'openwrt'
|
||||
|
||||
- name: Download prebuilt tools from build job
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: linux-buildbot-prebuilt-tools
|
||||
path: openwrt
|
||||
|
||||
- name: Extract prebuild tools
|
||||
working-directory: openwrt
|
||||
run: tar -xf tools.tar
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: openwrt
|
||||
push: true
|
||||
tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }}
|
||||
file: openwrt/.github/workflows/Dockerfile.tools
|
||||
|
||||
53
.github/workflows/toolchain.yml
vendored
53
.github/workflows/toolchain.yml
vendored
@@ -3,14 +3,14 @@ name: Build Toolchains
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- '.github/workflows/toolchain.yml'
|
||||
- 'toolchain/**'
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- '.github/workflows/toolchain.yml'
|
||||
- 'toolchain/**'
|
||||
branches-ignore:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -20,10 +20,51 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build-toolchains:
|
||||
name: Build Toolchains for each target
|
||||
determine_targets:
|
||||
name: Set targets
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
target: ${{ steps.find_targets.outputs.target }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set targets
|
||||
id: find_targets
|
||||
run: |
|
||||
export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \
|
||||
| sort -u -t '/' -k1,1 \
|
||||
| awk '{ print $1 }')"
|
||||
|
||||
JSON='['
|
||||
FIRST=1
|
||||
for TARGET in $TARGETS; do
|
||||
TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}'
|
||||
[[ $FIRST -ne 1 ]] && JSON="$JSON"','
|
||||
JSON="$JSON""$TUPLE"
|
||||
FIRST=0
|
||||
done
|
||||
JSON="$JSON"']'
|
||||
|
||||
echo -e "\n---- targets ----\n"
|
||||
echo "$JSON"
|
||||
echo -e "\n---- targets ----\n"
|
||||
|
||||
echo "target=$JSON" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
name: Build Target Toolchain
|
||||
needs: determine_targets
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
actions: write
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/toolchain.yml@main
|
||||
strategy:
|
||||
fail-fast: False
|
||||
matrix:
|
||||
include: ${{fromJson(needs.determine_targets.outputs.target)}}
|
||||
uses: ./.github/workflows/build.yml
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
subtarget: ${{ matrix.subtarget }}
|
||||
build_toolchain: true
|
||||
|
||||
76
.github/workflows/tools.yml
vendored
76
.github/workflows/tools.yml
vendored
@@ -5,14 +5,14 @@ on:
|
||||
paths:
|
||||
- 'include/**'
|
||||
- 'tools/**'
|
||||
- '.github/workflows/build-tools.yml'
|
||||
- '.github/workflows/tools.yml'
|
||||
push:
|
||||
paths:
|
||||
- 'include/**'
|
||||
- 'tools/**'
|
||||
- '.github/workflows/build-tools.yml'
|
||||
- '.github/workflows/tools.yml'
|
||||
branches-ignore:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -22,6 +22,72 @@ concurrency:
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build-tools:
|
||||
name: Build host tools for linux and macos based systems
|
||||
uses: openwrt/actions-shared-workflows/.github/workflows/tools.yml@main
|
||||
build-macos-latest:
|
||||
name: Build tools with macos latest
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: openwrt
|
||||
|
||||
- name: Setup MacOS
|
||||
run: |
|
||||
echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV"
|
||||
hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
|
||||
hdiutil attach OpenWrt.sparseimage
|
||||
mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/
|
||||
|
||||
- name: Install required prereq on MacOS
|
||||
working-directory: ${{ env.WORKPATH }}/openwrt
|
||||
run: |
|
||||
brew install \
|
||||
automake \
|
||||
coreutils \
|
||||
diffutils \
|
||||
findutils \
|
||||
gawk \
|
||||
git-extras \
|
||||
gnu-getopt \
|
||||
gnu-sed \
|
||||
grep \
|
||||
make
|
||||
|
||||
echo "/bin" >> "$GITHUB_PATH"
|
||||
echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH"
|
||||
echo "/usr/bin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/bin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
|
||||
echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
|
||||
echo "/usr/sbin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Make prereq
|
||||
working-directory: ${{ env.WORKPATH }}/openwrt
|
||||
run: make defconfig
|
||||
|
||||
- name: Build tools MacOS
|
||||
working-directory: ${{ env.WORKPATH }}/openwrt
|
||||
run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
||||
|
||||
- name: Upload logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: macos-latest-logs
|
||||
path: ${{ env.WORKPATH }}/openwrt/logs
|
||||
|
||||
- name: Upload config
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: macos-latest-config
|
||||
path: ${{ env.WORKPATH }}/openwrt/.config
|
||||
|
||||
build-linux-buildbot:
|
||||
name: Build tools with buildbot container
|
||||
uses: ./.github/workflows/build-tools.yml
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -14,15 +14,12 @@
|
||||
/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
|
||||
}
|
||||
5
Makefile
5
Makefile
@@ -14,7 +14,7 @@ $(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)
|
||||
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -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)
|
||||
@@ -40,9 +40,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)
|
||||
|
||||
@@ -31,7 +31,7 @@ An advanced user may require additional or specific package. (Toolchain, SDK, ..
|
||||
|
||||
## Development
|
||||
|
||||
To build your own firmware you need a GNU/Linux, BSD or macOS system (case
|
||||
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.
|
||||
|
||||
@@ -44,7 +44,7 @@ documentation.
|
||||
|
||||
```
|
||||
binutils bzip2 diff find flex gawk gcc-6+ getopt grep install libc-dev libz-dev
|
||||
make4.1+ perl python3.7+ rsync subversion unzip which
|
||||
make4.1+ perl python3.6+ rsync subversion unzip which
|
||||
```
|
||||
|
||||
### Quickstart
|
||||
|
||||
@@ -26,14 +26,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
|
||||
@@ -68,11 +60,6 @@ menu "Global build settings"
|
||||
bool "Enable TLS certificate verification during package download"
|
||||
default y
|
||||
|
||||
config USE_APK
|
||||
imply PACKAGE_apk-mbedtls
|
||||
bool "Use APK instead of OPKG to build distribution"
|
||||
default y
|
||||
|
||||
comment "General build options"
|
||||
|
||||
config TESTING_KERNEL
|
||||
@@ -115,7 +102,6 @@ menu "Global build settings"
|
||||
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.
|
||||
@@ -173,19 +159,6 @@ menu "Global build settings"
|
||||
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
|
||||
|
||||
@@ -209,6 +182,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 +199,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 +270,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 +283,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,10 +377,11 @@ menu "Global build settings"
|
||||
|
||||
endchoice
|
||||
|
||||
config USE_SECCOMP
|
||||
config SECCOMP
|
||||
bool "Enable SECCOMP"
|
||||
select KERNEL_SECCOMP
|
||||
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || loongarch64 || powerpc || x86_64)
|
||||
select PACKAGE_procd-seccomp
|
||||
depends on (aarch64 || arm || armeb || mips || mipsel || mips64 || mips64el || i386 || powerpc || x86_64)
|
||||
depends on !TARGET_uml
|
||||
default y
|
||||
help
|
||||
|
||||
@@ -17,7 +17,7 @@ menu "Target Images"
|
||||
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_ZSTD if TARGET_ipq807x
|
||||
default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS
|
||||
default TARGET_INITRAMFS_COMPRESSION_NONE
|
||||
depends on TARGET_ROOTFS_INITRAMFS
|
||||
@@ -127,7 +127,6 @@ menu "Target Images"
|
||||
config TARGET_EXT4_JOURNAL
|
||||
bool "Create a journaling filesystem"
|
||||
depends on TARGET_ROOTFS_EXT4FS
|
||||
default y
|
||||
help
|
||||
Create an ext4 filesystem with a journal.
|
||||
|
||||
@@ -204,14 +203,13 @@ 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 || TARGET_armsr
|
||||
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_kmod-fs-vfat
|
||||
default y
|
||||
|
||||
@@ -220,6 +218,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 +231,7 @@ 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 != ""
|
||||
|
||||
config GRUB_BOOTOPTS
|
||||
string "Extra kernel boot options"
|
||||
@@ -275,14 +277,9 @@ menu "Target Images"
|
||||
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
|
||||
select PACKAGE_kmod-e1000
|
||||
|
||||
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 || TARGET_armsr || TARGET_malta
|
||||
default y
|
||||
|
||||
comment "Image Options"
|
||||
@@ -301,8 +298,6 @@ menu "Target Images"
|
||||
config TARGET_ROOTFS_PARTSIZE
|
||||
int "Root filesystem partition size (in MiB)"
|
||||
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
|
||||
default 232 if TARGET_loongarch64
|
||||
default 448 if TARGET_mediatek
|
||||
default 104
|
||||
help
|
||||
Select the root filesystem partition size.
|
||||
|
||||
@@ -47,23 +47,8 @@ config KERNEL_MIPS_FP_SUPPORT
|
||||
|
||||
config KERNEL_ARM_PMU
|
||||
bool
|
||||
default y if TARGET_armsr_armv8
|
||||
depends on (arm || aarch64)
|
||||
|
||||
config KERNEL_ARM_PMUV3
|
||||
bool
|
||||
default y if TARGET_armsr_armv8
|
||||
depends on (arm_v7 || aarch64) && LINUX_6_6
|
||||
|
||||
config KERNEL_RISCV_PMU
|
||||
bool
|
||||
select KERNEL_RISCV_PMU_SBI
|
||||
depends on riscv64
|
||||
|
||||
config KERNEL_RISCV_PMU_SBI
|
||||
bool
|
||||
depends on riscv64
|
||||
|
||||
config KERNEL_X86_VSYSCALL_EMULATION
|
||||
bool "Enable vsyscall emulation"
|
||||
depends on x86_64
|
||||
@@ -84,8 +69,6 @@ config KERNEL_X86_VSYSCALL_EMULATION
|
||||
config KERNEL_PERF_EVENTS
|
||||
bool "Compile the kernel with performance events and counters"
|
||||
select KERNEL_ARM_PMU if (arm || aarch64)
|
||||
select KERNEL_ARM_PMUV3 if (arm_v7 || aarch64) && LINUX_6_6
|
||||
select KERNEL_RISCV_PMU if riscv64
|
||||
|
||||
config KERNEL_PROFILING
|
||||
bool "Compile the kernel with profiling enabled"
|
||||
@@ -160,7 +143,7 @@ config KERNEL_UBSAN_TRAP
|
||||
config KERNEL_KASAN
|
||||
bool "Compile the kernel with KASan: runtime memory debugger"
|
||||
select KERNEL_SLUB_DEBUG
|
||||
depends on (x86_64 || aarch64 || arm || powerpc || riscv64)
|
||||
depends on (x86_64 || aarch64)
|
||||
help
|
||||
Enables kernel address sanitizer - runtime memory debugger,
|
||||
designed to find out-of-bounds accesses and use-after-free bugs.
|
||||
@@ -173,6 +156,16 @@ config KERNEL_KASAN
|
||||
Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
|
||||
(the resulting kernel does not boot).
|
||||
|
||||
config KERNEL_KASAN_EXTRA
|
||||
bool "KAsan: extra checks"
|
||||
depends on KERNEL_KASAN && KERNEL_DEBUG_KERNEL
|
||||
help
|
||||
This enables further checks in the kernel address sanitizer, for now
|
||||
it only includes the address-use-after-scope check that can lead
|
||||
to excessive kernel stack usage, frame size warnings and longer
|
||||
compile time.
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more
|
||||
|
||||
config KERNEL_KASAN_VMALLOC
|
||||
bool "Back mappings in vmalloc space with real shadow memory"
|
||||
depends on KERNEL_KASAN
|
||||
@@ -191,73 +184,16 @@ config KERNEL_KASAN_VMALLOC
|
||||
will have no effect.
|
||||
|
||||
if KERNEL_KASAN
|
||||
choice
|
||||
prompt "KASAN mode"
|
||||
depends on KERNEL_KASAN
|
||||
default KERNEL_KASAN_GENERIC
|
||||
help
|
||||
KASAN has three modes:
|
||||
|
||||
1. Generic KASAN (supported by many architectures, enabled with
|
||||
CONFIG_KASAN_GENERIC, similar to userspace ASan),
|
||||
2. Software Tag-Based KASAN (arm64 only, based on software memory
|
||||
tagging, enabled with CONFIG_KASAN_SW_TAGS, similar to userspace
|
||||
HWASan), and
|
||||
3. Hardware Tag-Based KASAN (arm64 only, based on hardware memory
|
||||
tagging, enabled with CONFIG_KASAN_HW_TAGS).
|
||||
|
||||
config KERNEL_KASAN_GENERIC
|
||||
bool "Generic KASAN"
|
||||
select KERNEL_SLUB_DEBUG
|
||||
help
|
||||
Enables Generic KASAN.
|
||||
|
||||
Consumes about 1/8th of available memory at kernel start and adds an
|
||||
overhead of ~50% for dynamic allocations.
|
||||
The performance slowdown is ~x3.
|
||||
|
||||
config KERNEL_KASAN_SW_TAGS
|
||||
bool "Software Tag-Based KASAN"
|
||||
depends on aarch64
|
||||
select KERNEL_SLUB_DEBUG
|
||||
help
|
||||
Enables Software Tag-Based KASAN.
|
||||
|
||||
Supported only on arm64 CPUs and relies on Top Byte Ignore.
|
||||
|
||||
Consumes about 1/16th of available memory at kernel start and
|
||||
add an overhead of ~20% for dynamic allocations.
|
||||
|
||||
May potentially introduce problems related to pointer casting and
|
||||
comparison, as it embeds a tag into the top byte of each pointer.
|
||||
|
||||
config KERNEL_KASAN_HW_TAGS
|
||||
bool "Hardware Tag-Based KASAN"
|
||||
depends on aarch64
|
||||
select KERNEL_SLUB_DEBUG
|
||||
select KERNEL_ARM64_MTE
|
||||
help
|
||||
Enables Hardware Tag-Based KASAN.
|
||||
|
||||
Supported only on arm64 CPUs starting from ARMv8.5 and relies on
|
||||
Memory Tagging Extension and Top Byte Ignore.
|
||||
|
||||
Consumes about 1/32nd of available memory.
|
||||
|
||||
May potentially introduce problems related to pointer casting and
|
||||
comparison, as it embeds a tag into the top byte of each pointer.
|
||||
|
||||
endchoice
|
||||
|
||||
config KERNEL_ARM64_MTE
|
||||
def_bool n
|
||||
config KERNEL_KASAN_GENERIC
|
||||
def_bool y
|
||||
|
||||
config KERNEL_KASAN_SW_TAGS
|
||||
def_bool n
|
||||
endif
|
||||
|
||||
choice
|
||||
prompt "Instrumentation type"
|
||||
depends on KERNEL_KASAN
|
||||
depends on !KERNEL_KASAN_HW_TAGS
|
||||
default KERNEL_KASAN_OUTLINE
|
||||
|
||||
config KERNEL_KASAN_OUTLINE
|
||||
@@ -333,25 +269,6 @@ if KERNEL_TASKSTATS
|
||||
|
||||
endif
|
||||
|
||||
config KERNEL_PSI
|
||||
bool "Compile the kernel with pressure stall information tracking"
|
||||
help
|
||||
Collect metrics that indicate how overcommitted the CPU, memory,
|
||||
and IO capacity are in the system.
|
||||
|
||||
If you say Y here, the kernel will create /proc/pressure/ with the
|
||||
pressure statistics files cpu, memory, and io. These will indicate
|
||||
the share of walltime in which some or all tasks in the system are
|
||||
delayed due to contention of the respective resource.
|
||||
|
||||
In kernels with cgroup support, cgroups (cgroup2 only) will
|
||||
have cpu.pressure, memory.pressure, and io.pressure files,
|
||||
which aggregate pressure stalls for the grouped tasks only.
|
||||
|
||||
For more details see Documentation/accounting/psi.rst.
|
||||
|
||||
Say N if unsure.
|
||||
|
||||
config KERNEL_KALLSYMS
|
||||
bool "Compile the kernel with symbol table information"
|
||||
default y if !SMALL_FLASH
|
||||
@@ -444,6 +361,7 @@ config KERNEL_DEBUG_INFO
|
||||
This will compile your kernel and modules with debug information.
|
||||
|
||||
config KERNEL_DEBUG_INFO_BTF
|
||||
|
||||
bool "Enable additional BTF type information"
|
||||
depends on !HOST_OS_MACOS
|
||||
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
|
||||
@@ -455,20 +373,6 @@ config KERNEL_DEBUG_INFO_BTF
|
||||
|
||||
Required to run BPF CO-RE applications.
|
||||
|
||||
config KERNEL_DEBUG_INFO_BTF_MODULES
|
||||
def_bool y
|
||||
depends on KERNEL_DEBUG_INFO_BTF
|
||||
|
||||
config KERNEL_MODULE_ALLOW_BTF_MISMATCH
|
||||
bool "Allow loading modules with non-matching BTF type info"
|
||||
depends on KERNEL_DEBUG_INFO_BTF_MODULES
|
||||
help
|
||||
For modules whose split BTF does not match vmlinux, load without
|
||||
BTF rather than refusing to load. The default behavior with
|
||||
module BTF enabled is to reject modules with such mismatches;
|
||||
this option will still load module BTF where possible but ignore
|
||||
it when a mismatch is found.
|
||||
|
||||
config KERNEL_DEBUG_INFO_REDUCED
|
||||
bool "Reduce debugging information"
|
||||
default y
|
||||
@@ -565,10 +469,6 @@ config KERNEL_BPF_EVENTS
|
||||
for sending data from BPF programs to user-space for post-processing
|
||||
or logging.
|
||||
|
||||
config KERNEL_PROBE_EVENTS_BTF_ARGS
|
||||
bool "Support BTF function arguments for probe events"
|
||||
depends on KERNEL_DEBUG_INFO_BTF && KERNEL_KPROBE_EVENTS && LINUX_6_6
|
||||
|
||||
config KERNEL_BPF_KPROBE_OVERRIDE
|
||||
bool
|
||||
depends on KERNEL_KPROBES
|
||||
@@ -714,23 +614,10 @@ config KERNEL_PRINTK_TIME
|
||||
default y
|
||||
|
||||
config KERNEL_SLUB_DEBUG
|
||||
bool "Enable SLUB debugging support"
|
||||
help
|
||||
This enables various debugging features:
|
||||
- Accepts "slub_debug" kernel parameter
|
||||
- Provides caches debugging options (e.g. tracing, validating)
|
||||
- Adds /sys/kernel/slab/ attrs for reading amounts of *objects*
|
||||
- Enables /proc/slabinfo support
|
||||
- Prints info when running out of memory
|
||||
|
||||
Enabling this can result in a significant increase of code size.
|
||||
bool
|
||||
|
||||
config KERNEL_SLUB_DEBUG_ON
|
||||
depends on KERNEL_SLUB_DEBUG
|
||||
bool "Boot kernel with basic caches debugging enabled"
|
||||
help
|
||||
This enables by default sanity_checks, red_zone, poison and store_user
|
||||
debugging options for all caches.
|
||||
bool
|
||||
|
||||
config KERNEL_SLABINFO
|
||||
select KERNEL_SLUB_DEBUG
|
||||
@@ -1206,17 +1093,24 @@ endif
|
||||
|
||||
config KERNEL_NET_L3_MASTER_DEV
|
||||
bool "L3 Master device support"
|
||||
default y if !SMALL_FLASH
|
||||
help
|
||||
This module provides glue between core networking code and device
|
||||
drivers to support L3 master devices like VRF.
|
||||
Increases the compressed kernel size by ~4kB (as of Linux 6.6).
|
||||
|
||||
config KERNEL_XDP_SOCKETS
|
||||
bool "XDP sockets support"
|
||||
help
|
||||
XDP sockets allows a channel between XDP programs and
|
||||
userspace applications.
|
||||
config KERNEL_WIRELESS_EXT
|
||||
def_bool n
|
||||
|
||||
config KERNEL_WEXT_CORE
|
||||
def_bool KERNEL_WIRELESS_EXT
|
||||
|
||||
config KERNEL_WEXT_PRIV
|
||||
def_bool KERNEL_WIRELESS_EXT
|
||||
|
||||
config KERNEL_WEXT_PROC
|
||||
def_bool KERNEL_WIRELESS_EXT
|
||||
|
||||
config KERNEL_WEXT_SPY
|
||||
def_bool KERNEL_WIRELESS_EXT
|
||||
|
||||
config KERNEL_PAGE_POOL
|
||||
def_bool n
|
||||
@@ -1225,27 +1119,6 @@ config KERNEL_PAGE_POOL_STATS
|
||||
bool "Page pool stats support"
|
||||
depends on KERNEL_PAGE_POOL
|
||||
|
||||
config KERNEL_MPTCP
|
||||
bool "Multi-Path TCP support"
|
||||
default y if !SMALL_FLASH
|
||||
help
|
||||
Select this option to enable support for Multi-Path TCP.
|
||||
Increases the compressed kernel size by ~214kB (as of Linux 6.6).
|
||||
|
||||
if KERNEL_IPV6
|
||||
config KERNEL_MPTCP_IPV6
|
||||
bool "IPv6 support for Multipath TCP"
|
||||
depends on KERNEL_MPTCP
|
||||
default KERNEL_MPTCP
|
||||
endif
|
||||
|
||||
config KERNEL_NF_CONNTRACK_TIMEOUT
|
||||
bool "Per-connection connection tracking timeout"
|
||||
default y if !SMALL_FLASH
|
||||
help
|
||||
Select this option to enable support for per-connection conntrack timeouts.
|
||||
Increases the (uncompressed) size of nf_conntrack.ko by ~8kB.
|
||||
|
||||
#
|
||||
# NFS related symbols
|
||||
#
|
||||
@@ -1280,20 +1153,13 @@ if KERNEL_IP_PNP
|
||||
|
||||
endif
|
||||
|
||||
config KERNEL_BTRFS_FS
|
||||
bool "Compile the kernel with built-in BTRFS support"
|
||||
help
|
||||
Say Y here if you want to make the kernel to be able to boot off a
|
||||
BTRFS partition.
|
||||
|
||||
menu "Filesystem ACL and attr support options"
|
||||
config USE_FS_ACL_ATTR
|
||||
bool "Use filesystem ACL and attr support by default"
|
||||
default y if !SMALL_FLASH
|
||||
help
|
||||
Make using ACLs (e.g. POSIX ACL, NFSv4 ACL) the default
|
||||
for kernel and packages, except old NFS.
|
||||
Also enable userspace extended attribute support
|
||||
for kernel and packages, except tmpfs, flash filesystems,
|
||||
and old NFS. Also enable userspace extended attribute support
|
||||
by default. (OpenWrt already has an expection it will be
|
||||
present in the kernel).
|
||||
|
||||
@@ -1314,17 +1180,14 @@ menu "Filesystem ACL and attr support options"
|
||||
config KERNEL_F2FS_FS_POSIX_ACL
|
||||
bool "Enable POSIX ACL for F2FS Filesystems"
|
||||
select KERNEL_FS_POSIX_ACL
|
||||
default y if USE_FS_ACL_ATTR
|
||||
|
||||
config KERNEL_JFFS2_FS_POSIX_ACL
|
||||
bool "Enable POSIX ACL for JFFS2 Filesystems"
|
||||
select KERNEL_FS_POSIX_ACL
|
||||
default y if USE_FS_ACL_ATTR
|
||||
|
||||
config KERNEL_TMPFS_POSIX_ACL
|
||||
bool "Enable POSIX ACL for TMPFS Filesystems"
|
||||
select KERNEL_FS_POSIX_ACL
|
||||
default y if USE_FS_ACL_ATTR
|
||||
|
||||
config KERNEL_CIFS_ACL
|
||||
bool "Enable CIFS ACLs"
|
||||
@@ -1461,30 +1324,12 @@ config KERNEL_LSM
|
||||
|
||||
config KERNEL_EXT4_FS_SECURITY
|
||||
bool "Ext4 Security Labels"
|
||||
default y if !SMALL_FLASH
|
||||
|
||||
config KERNEL_F2FS_FS_SECURITY
|
||||
bool "F2FS Security Labels"
|
||||
default y if !SMALL_FLASH
|
||||
|
||||
config KERNEL_UBIFS_FS_SECURITY
|
||||
bool "UBIFS Security Labels"
|
||||
default y if !SMALL_FLASH
|
||||
|
||||
config KERNEL_JFFS2_FS_SECURITY
|
||||
bool "JFFS2 Security Labels"
|
||||
default y if !SMALL_FLASH
|
||||
|
||||
config KERNEL_WERROR
|
||||
bool "Compile the kernel with warnings as errors"
|
||||
help
|
||||
A kernel build should not cause any compiler warnings, and this
|
||||
enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags
|
||||
to enforce that rule by default. Certain warnings from other tools
|
||||
such as the linker may be upgraded to errors with this option as
|
||||
well.
|
||||
|
||||
However, if you have a new (or very old) compiler or linker with odd
|
||||
and unusual warnings, or you have some architecture with problems,
|
||||
you may need to disable this config option in order to
|
||||
successfully build the kernel.
|
||||
|
||||
@@ -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,8 +1,4 @@
|
||||
src-git packages https://git.openwrt.org/feed/packages.git
|
||||
src-git luci https://git.openwrt.org/project/luci.git
|
||||
src-git routing https://git.openwrt.org/feed/routing.git
|
||||
src-git telephony https://git.openwrt.org/feed/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://git.openwrt.org/feed/packages.git^8939b43659dabe9b737feee02976949ad0355adc
|
||||
src-git luci https://git.openwrt.org/project/luci.git^3e14e055a177dec4bd3a4bd40883b56a6930fd7c
|
||||
src-git routing https://git.openwrt.org/feed/routing.git^6bbcdd7f1fda46a370226ad1fc794e690974339c
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git^129c8e0a9d68a39ad2dd550cf79dc8fc678f4a38
|
||||
|
||||
@@ -44,7 +44,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)) \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN
|
||||
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
|
||||
LLVM_VER:=
|
||||
|
||||
CLANG_MIN_VER:=12
|
||||
@@ -33,8 +33,7 @@ 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)) \
|
||||
-nostdinc -isystem $(TOOLCHAIN_DIR)/include \
|
||||
-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 \
|
||||
@@ -66,7 +65,7 @@ BPF_CFLAGS := \
|
||||
|
||||
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:=$(shell $(CLANG) -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))
|
||||
|
||||
@@ -22,7 +22,7 @@ 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))
|
||||
endif
|
||||
@@ -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-mbedtls
|
||||
else
|
||||
DEFAULT_PACKAGES += opkg
|
||||
endif
|
||||
@@ -10,10 +10,10 @@ 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)
|
||||
@@ -168,7 +168,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 +184,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="`svn info -r$(VERSION) --show-item last-changed-date $(URL)`" && \
|
||||
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
||||
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
||||
rm -rf $(SUBDIR); \
|
||||
@@ -205,21 +205,15 @@ 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 && \
|
||||
@@ -227,17 +221,11 @@ define DownloadMethod/rawgit
|
||||
rm -rf $(SUBDIR) && \
|
||||
[ \! -d $(SUBDIR) ] && \
|
||||
git clone $(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)) && \
|
||||
(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 +238,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 +254,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 +271,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 +281,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 +299,8 @@ define Download/Defaults
|
||||
MIRROR:=1
|
||||
MIRROR_HASH=$$(MIRROR_MD5SUM)
|
||||
MIRROR_MD5SUM:=x
|
||||
SOURCE_VERSION:=
|
||||
VERSION:=
|
||||
OPTS:=
|
||||
SUBMODULES:=
|
||||
endef
|
||||
|
||||
define Download/default
|
||||
@@ -322,11 +309,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
|
||||
|
||||
@@ -26,7 +26,7 @@ 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))) )
|
||||
HOST_STAMP_PROGRAMS:=$(foreach program,$(PKG_PROGRAMS),$(subst $(PKG_NAME),$(program),$(HOST_STAMP_INSTALLED)) )
|
||||
|
||||
override MAKEFLAGS=
|
||||
|
||||
@@ -35,25 +35,18 @@ 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)" \
|
||||
@@ -76,10 +69,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 +100,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
|
||||
|
||||
@@ -46,7 +46,7 @@ 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
|
||||
@@ -54,7 +54,7 @@ define Build/append-image-stage
|
||||
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" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)"
|
||||
dd if="$@.stripmeta" >> "$@"
|
||||
rm "$@.stripmeta"
|
||||
endef
|
||||
@@ -133,8 +133,6 @@ define Build/append-md5sum-ascii-salted
|
||||
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) \
|
||||
@@ -148,22 +146,6 @@ define Build/append-ubi
|
||||
$(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
|
||||
@@ -231,30 +213,9 @@ 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)
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/check-size
|
||||
@imagesize="$$(stat -c%s $@)"; \
|
||||
limitsize="$$(($(call exp_units,$(if $(1),$(1),$(IMAGE_SIZE)))))"; \
|
||||
limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \
|
||||
[ $$limitsize -ge $$imagesize ] || { \
|
||||
$(call ERROR_MESSAGE, WARNING: Image file $@ is too big: $$imagesize > $$limitsize); \
|
||||
rm -f $@; \
|
||||
@@ -265,48 +226,6 @@ 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 $@
|
||||
@@ -316,12 +235,12 @@ 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)
|
||||
) > $(fw).new
|
||||
mv $(fw).new $(fw)
|
||||
endef
|
||||
|
||||
define Build/elecom-wrc-gs-factory
|
||||
@@ -351,10 +270,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
|
||||
@@ -373,7 +292,7 @@ define Build/initrd_compression
|
||||
endef
|
||||
|
||||
define Build/fit
|
||||
$(call locked,$(TOPDIR)/scripts/mkits.sh \
|
||||
$(TOPDIR)/scripts/mkits.sh \
|
||||
-D $(DEVICE_NAME) -o $@.its -k $@ \
|
||||
-C $(word 1,$(1)) \
|
||||
$(if $(word 2,$(1)),\
|
||||
@@ -383,16 +302,16 @@ define Build/fit
|
||||
$(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)))) \
|
||||
-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_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)
|
||||
-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
|
||||
|
||||
@@ -438,32 +357,25 @@ 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)) && \
|
||||
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 \
|
||||
$(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 $@
|
||||
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
|
||||
@@ -472,17 +384,10 @@ define Build/kernel-bin
|
||||
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" \
|
||||
$(TOPDIR)/scripts/linksys-image.sh \
|
||||
"$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
|
||||
"$$(cksum $@ | cut -d ' ' -f1)" \
|
||||
"0" "K0000000F0246434" >> $@
|
||||
dd if=/dev/zero bs=192 count=1 >> $@
|
||||
$@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/lzma
|
||||
@@ -494,15 +399,6 @@ define Build/lzma-no-dict
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/moxa-encode-fw
|
||||
$(TOPDIR)/scripts/moxa-encode-fw.py \
|
||||
--input $@ \
|
||||
--output $@ \
|
||||
--magic $(MOXA_MAGIC) \
|
||||
--hwid $(MOXA_HWID) \
|
||||
--buildid 00000000
|
||||
endef
|
||||
|
||||
define Build/netgear-chk
|
||||
$(STAGING_DIR_HOST)/bin/mkchkimg \
|
||||
-o $@.new \
|
||||
@@ -527,8 +423,6 @@ define Build/netgear-encrypted-factory
|
||||
--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" \
|
||||
@@ -556,8 +450,8 @@ 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="$(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
|
||||
@@ -615,8 +509,8 @@ define Build/seama-seal
|
||||
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
|
||||
@@ -627,14 +521,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) \
|
||||
@@ -675,22 +561,23 @@ 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
|
||||
|
||||
define Build/uImage
|
||||
@@ -709,26 +596,9 @@ 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 $@
|
||||
endef
|
||||
|
||||
define Build/xor-image
|
||||
-$(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1) \
|
||||
&& mv $@.xor $@ || rm -f $@
|
||||
$(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1)
|
||||
mv $@.xor $@
|
||||
endef
|
||||
|
||||
define Build/zip
|
||||
@@ -741,13 +611,9 @@ define Build/zip
|
||||
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))"; \
|
||||
newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
|
||||
$(STAGING_DIR_HOST)/bin/mkrasimage \
|
||||
-b $(RAS_BOARD) \
|
||||
-v $(RAS_VERSION) \
|
||||
|
||||
170
include/image.mk
170
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
|
||||
@@ -175,31 +147,27 @@ endif
|
||||
|
||||
# Disable noisy checks by default as in upstream
|
||||
DTC_WARN_FLAGS := \
|
||||
-Wno-interrupt_provider \
|
||||
-Wno-unique_unit_address \
|
||||
-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)))
|
||||
@@ -215,7 +183,6 @@ define Image/BuildDTB/sub
|
||||
-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 \
|
||||
@@ -308,19 +275,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
|
||||
@@ -355,7 +311,7 @@ ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
|
||||
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 +319,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 +333,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
|
||||
@@ -404,7 +346,6 @@ define Device/InitProfile
|
||||
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 :=
|
||||
@@ -423,60 +364,29 @@ define Device/InitProfile
|
||||
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 :=
|
||||
@@ -530,7 +440,7 @@ DEFAULT_DEVICE_VARS := \
|
||||
DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \
|
||||
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 \
|
||||
UBOOT_PATH IMAGE_SIZE \
|
||||
FACTORY_IMG_NAME FACTORY_SIZE \
|
||||
DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \
|
||||
DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \
|
||||
@@ -538,8 +448,7 @@ DEFAULT_DEVICE_VARS := \
|
||||
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_ALT4_VENDOR DEVICE_ALT4_MODEL DEVICE_ALT4_VARIANT
|
||||
|
||||
define Device/ExportVar
|
||||
$(1) : $(2):=$$($(2))
|
||||
@@ -553,10 +462,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 +500,11 @@ 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)
|
||||
|
||||
$(1)-images: $$(if $$(KERNEL_INITRAMFS),$(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))
|
||||
|
||||
@@ -637,13 +537,10 @@ define Device/Build/initramfs
|
||||
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)" \
|
||||
@@ -667,7 +564,7 @@ define Device/Build/dtb
|
||||
$(KDIR)/image-$(1).dtb: FORCE
|
||||
$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
|
||||
|
||||
compile-dtb: $(KDIR)/image-$(1).dtb
|
||||
image_prepare: $(KDIR)/image-$(1).dtb
|
||||
endif
|
||||
|
||||
endef
|
||||
@@ -678,7 +575,7 @@ define Device/Build/dtbo
|
||||
$(KDIR)/image-$(1).dtbo: FORCE
|
||||
$(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@)
|
||||
|
||||
compile-dtb: $(KDIR)/image-$(1).dtbo
|
||||
image_prepare: $(KDIR)/image-$(1).dtbo
|
||||
endif
|
||||
|
||||
endef
|
||||
@@ -731,7 +628,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))))
|
||||
@@ -771,13 +668,10 @@ define Device/Build/image
|
||||
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 +684,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) $(2)-images
|
||||
@rm -f $$@
|
||||
$$(call concat_cmd,$(ARTIFACT/$(1)))
|
||||
|
||||
@@ -825,13 +719,10 @@ define Device/Build/artifact
|
||||
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 +731,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), \
|
||||
@@ -871,7 +762,6 @@ $(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
|
||||
@@ -897,10 +787,6 @@ 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,20 +812,18 @@ 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)
|
||||
|
||||
2
include/kernel-5.15
Normal file
2
include/kernel-5.15
Normal file
@@ -0,0 +1,2 @@
|
||||
LINUX_VERSION-5.15 = .118
|
||||
LINUX_KERNEL_HASH-5.15.118 = 4e6bf4dadb04d5d11d1d4cc37c0eabcf33bc333b7dd3dc2143c3099a823eb5b3
|
||||
@@ -1,2 +0,0 @@
|
||||
LINUX_VERSION-6.6 = .79
|
||||
LINUX_KERNEL_HASH-6.6.79 = 07a6f904470da1a099aa1683e3025a999dd82f2438f78b006b80c6ae2e9dfe8d
|
||||
@@ -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,11 +154,7 @@ 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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -131,7 +122,7 @@ define Kernel/Configure/Default
|
||||
endef
|
||||
|
||||
define Kernel/Configure/Initramfs
|
||||
$(call Kernel/SetInitramfs,$(1),$(2))
|
||||
$(call Kernel/SetInitramfs)
|
||||
endef
|
||||
|
||||
define Kernel/CompileModules/Default
|
||||
@@ -150,16 +141,14 @@ 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
|
||||
@@ -170,53 +159,29 @@ define Kernel/CompileImage/Default
|
||||
$(call Kernel/CopyImage)
|
||||
endef
|
||||
|
||||
define Kernel/PrepareConfigPerRootfs
|
||||
{ \
|
||||
[ ! -d "$(1)" ] || rm -rf $(1); \
|
||||
mkdir $(1) && $(CP) -T $(LINUX_DIR) $(1); \
|
||||
touch $(1)/.config; \
|
||||
}
|
||||
endef
|
||||
|
||||
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) $(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 . | LC_ALL=C sort | $(STAGING_DIR_HOST)/bin/cpio --reproducible -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio )
|
||||
endif
|
||||
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(KERNEL_BUILD_DIR)/initrd.cpio)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),$(STAGING_DIR_HOST)/bin/bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),$(STAGING_DIR_HOST)/bin/libdeflate-gzip -n -f -S .gzip -12 $(KERNEL_BUILD_DIR)/initrd.cpio)
|
||||
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),$(STAGING_DIR_HOST)/bin/lz4c -l -c1 -fz --favor-decSpeed $(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),$(STAGING_DIR_HOST)/bin/lzop -9 -f $(KERNEL_BUILD_DIR)/initrd.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.cpio)
|
||||
$(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)
|
||||
$(call Kernel/CopyImage,-initramfs)
|
||||
endef
|
||||
else
|
||||
define Kernel/CompileImage/Initramfs
|
||||
|
||||
@@ -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,8 +86,6 @@ 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 ))
|
||||
@@ -121,10 +119,6 @@ KERNEL_MAKE_FLAGS = \
|
||||
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))
|
||||
|
||||
@@ -206,19 +200,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 +236,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
|
||||
|
||||
@@ -131,6 +131,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))
|
||||
@@ -183,7 +186,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 +207,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))
|
||||
@@ -252,6 +253,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
|
||||
|
||||
@@ -368,6 +371,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)
|
||||
|
||||
@@ -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
|
||||
@@ -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:=
|
||||
@@ -151,7 +151,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) $(STAGING_DIR_HOST)/bin/bash $(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
|
||||
@@ -24,7 +24,7 @@ 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))
|
||||
__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto,$(PKG_BUILD_FLAGS))
|
||||
ifneq ($(__unknown_flags),)
|
||||
$(error unknown PKG_BUILD_FLAGS: $(__unknown_flags))
|
||||
endif
|
||||
@@ -55,11 +55,6 @@ ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1)
|
||||
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
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/hardening.mk
|
||||
include $(INCLUDE_DIR)/prereq.mk
|
||||
@@ -136,7 +131,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
|
||||
|
||||
@@ -343,7 +338,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,)
|
||||
|
||||
@@ -32,30 +32,28 @@ $(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, \
|
||||
@@ -96,10 +94,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, \
|
||||
@@ -181,28 +175,27 @@ $(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', \
|
||||
$(eval $(call SetupHostCommand,python,Please install Python >= 3.6, \
|
||||
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])\.?'))
|
||||
python3.6 -V 2>&1 | grep 'Python 3', \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|[0-9][0-9])\.?'))
|
||||
|
||||
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \
|
||||
python3.12 -V 2>&1 | grep 'Python 3', \
|
||||
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.6, \
|
||||
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])\.?'))
|
||||
python3.6 -V 2>&1 | grep 'Python 3', \
|
||||
python3 -V 2>&1 | grep -E 'Python 3\.([6-9]|[0-9][0-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 'from distutils import util'))
|
||||
|
||||
$(eval $(call TestHostCommand,python3-stdlib, \
|
||||
Please install the Python3 stdlib module, \
|
||||
@@ -241,4 +234,4 @@ prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
|
||||
|
||||
# Install ldconfig stub
|
||||
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
|
||||
$(LN) $(SCRIPT_DIR)/noop.sh $(STAGING_DIR_HOST)/bin/ldconfig))
|
||||
$(LN) $(firstword $(wildcard /bin/true /usr/bin/true)) $(STAGING_DIR_HOST)/bin/ldconfig))
|
||||
|
||||
@@ -107,14 +107,21 @@ define SetupHostCommand
|
||||
bin="$$$$$$$$(command -v "$$$$$$$${cmd%% *}")"; \
|
||||
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
|
||||
case "$$$$$$$$(ls -dl -- $(STAGING_DIR_HOST)/bin/$(strip $(1)))" in \
|
||||
"-"* | \
|
||||
*" -> $$$$$$$$bin"* | \
|
||||
*" -> "[!/]*) \
|
||||
*" -> $$$$$$$$bin"*) \
|
||||
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
|
||||
;; \
|
||||
"-"*) \
|
||||
find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \
|
||||
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
|
||||
;; \
|
||||
*" -> /"*) \
|
||||
;; \
|
||||
*" -> "*) \
|
||||
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
|
||||
;; \
|
||||
esac; \
|
||||
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
|
||||
|
||||
@@ -50,8 +50,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) \
|
||||
|
||||
@@ -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
|
||||
@@ -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,26 +21,37 @@ 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
|
||||
|
||||
# include ujail on systems with enough storage
|
||||
ifeq ($(CONFIG_SMALL_FLASH),)
|
||||
DEFAULT_PACKAGES+=procd-ujail
|
||||
endif
|
||||
|
||||
# include seccomp ld-preload hooks if kernel supports it
|
||||
ifneq ($(CONFIG_SECCOMP),)
|
||||
DEFAULT_PACKAGES+=procd-seccomp
|
||||
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 \
|
||||
firewall4 \
|
||||
@@ -90,26 +93,10 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# include ujail on systems with enough storage
|
||||
ifeq ($(filter small_flash,$(FEATURES)),)
|
||||
DEFAULT_PACKAGES+=procd-ujail
|
||||
endif
|
||||
|
||||
# Add device specific packages (here below to allow device type set from subtarget)
|
||||
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
|
||||
|
||||
##@
|
||||
# @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
|
||||
@@ -277,11 +264,6 @@ ifeq ($(DUMP),1)
|
||||
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)
|
||||
@@ -334,15 +316,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))
|
||||
@@ -375,7 +349,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))
|
||||
|
||||
@@ -77,8 +77,7 @@ _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
|
||||
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"
|
||||
for type in package target; do \
|
||||
@@ -213,7 +212,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,7 +260,7 @@ 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)),)
|
||||
|
||||
@@ -3,7 +3,7 @@ PKG_CPE_ID ?= cpe:/a:arm:trusted_firmware-a
|
||||
|
||||
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,11 +63,9 @@ 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
|
||||
@@ -77,13 +75,13 @@ 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="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \
|
||||
$(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \
|
||||
$(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,13 @@ 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
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(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) oldconfig)
|
||||
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) \
|
||||
|
||||
@@ -30,18 +30,12 @@ ifeq ($(IS_TTY),1)
|
||||
endif
|
||||
|
||||
define ERROR_MESSAGE
|
||||
{ \
|
||||
printf "$(_R)%s$(_N)\n" "$(1)" >&9 || \
|
||||
printf "$(_R)%s$(_N)\n" "$(1)"; \
|
||||
} >&2 2>/dev/null
|
||||
printf "$(_R)%s$(_N)\n" "$(1)" >&8
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
@@ -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),23.05.0-rc2)
|
||||
|
||||
VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
|
||||
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23228-cd17d8df2a)
|
||||
|
||||
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
|
||||
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.0-rc2)
|
||||
|
||||
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
|
||||
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
|
||||
@@ -54,9 +50,6 @@ VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://openwrt.o
|
||||
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
|
||||
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://forum.openwrt.org/)
|
||||
|
||||
VERSION_FIRMWARE_URL:=$(call qstrip,$(CONFIG_VERSION_FIRMWARE_URL))
|
||||
VERSION_FIRMWARE_URL:=$(if $(VERSION_FIRMWARE_URL),$(VERSION_FIRMWARE_URL),https://downloads.openwrt.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; \
|
||||
@@ -166,15 +106,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
|
||||
@@ -112,22 +108,11 @@ 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 ] || \
|
||||
@@ -142,10 +127,10 @@ 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 +196,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
|
||||
@@ -246,25 +230,15 @@ endif
|
||||
cat $(BIN_DIR)/feeds.buildinfo >>$(1)/etc/build.feeds; \
|
||||
cat $(BIN_DIR)/version.buildinfo >>$(1)/etc/build.version)
|
||||
|
||||
$(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
|
||||
|
||||
$(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \
|
||||
rm -f $(1)/etc/banner.failsafe,)
|
||||
endef
|
||||
|
||||
ifneq ($(DUMP),1)
|
||||
|
||||
@@ -312,10 +312,9 @@ generate_static_system() {
|
||||
delete system.@system[0]
|
||||
add system system
|
||||
set system.@system[-1].hostname='OpenWrt'
|
||||
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
|
||||
@@ -342,11 +341,6 @@ generate_static_system() {
|
||||
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
|
||||
|
||||
@@ -1,143 +1,89 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
. /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
|
||||
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) {
|
||||
ret=0
|
||||
n=split(ip,a,"\\.")
|
||||
for (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;x++) {
|
||||
ret=and(ip,255)"."ret
|
||||
ip=rshift(ip,8)
|
||||
}
|
||||
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)
|
||||
prefix=32-bitcount(compl32(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))
|
||||
print "IP="int2ip(ipaddr)
|
||||
print "NETMASK="int2ip(netmask)
|
||||
print "BROADCAST="int2ip(broadcast)
|
||||
print "NETWORK="int2ip(network)
|
||||
print "PREFIX="prefix
|
||||
|
||||
_ip2str IP "$ipaddr"
|
||||
_ip2str NETMASK "$netmask"
|
||||
_ip2str NETWORK "$network"
|
||||
# range calculations:
|
||||
# ipcalc <ip> <netmask> <start> <num>
|
||||
|
||||
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"
|
||||
if (ARGC <= 3)
|
||||
exit(0)
|
||||
|
||||
# if there's no range, we're done
|
||||
[ $# -eq 0 ] && exit 0
|
||||
[ -z "$1$2" ] && exit 0
|
||||
start=or(network,and(ip2int(ARGV[3]),compl32(netmask)))
|
||||
limit=network+1
|
||||
if (start<limit) start=limit
|
||||
if (start==ipaddr) start=ipaddr+1
|
||||
|
||||
if [ "$prefix" -le 30 ]; then
|
||||
lower=$((network + 1))
|
||||
else
|
||||
lower="$network"
|
||||
fi
|
||||
end=start+ARGV[4]
|
||||
limit=or(network,compl32(netmask))-1
|
||||
if (end>limit) end=limit
|
||||
if (end==ipaddr) end=ipaddr-1
|
||||
|
||||
start="$1"
|
||||
assert_uint32 "$start" || exit 1
|
||||
start=$((network | (start & hostmask)))
|
||||
[ "$start" -lt "$lower" ] && start="$lower"
|
||||
[ "$start" -eq "$ipaddr" ] && start=$((start + 1))
|
||||
if (start>end) {
|
||||
print "network ("int2ip(network)"/"prefix") too small" > "/dev/stderr"
|
||||
exit(1)
|
||||
}
|
||||
|
||||
if [ "$prefix" -le 30 ]; then
|
||||
upper=$(((network | hostmask) - 1))
|
||||
elif [ "$prefix" -eq 31 ]; then
|
||||
upper=$((network | hostmask))
|
||||
else
|
||||
upper="$network"
|
||||
fi
|
||||
if (ipaddr > start && ipaddr < end) {
|
||||
print "ipaddr inside range" > "/dev/stderr"
|
||||
exit(1)
|
||||
}
|
||||
|
||||
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
|
||||
print "START="int2ip(start)
|
||||
print "END="int2ip(end)
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = "add" ] && /etc/init.d/led start "$DEVICENAME"
|
||||
@@ -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
|
||||
@@ -35,12 +34,11 @@ boot() {
|
||||
mkdir -p /tmp/resolv.conf.d
|
||||
touch /tmp/resolv.conf.d/resolv.conf.auto
|
||||
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
|
||||
grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug
|
||||
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
||||
grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf
|
||||
grep -q pstore /proc/filesystems && /bin/mount -o 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 ] && {
|
||||
@@ -48,11 +46,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"
|
||||
@@ -68,9 +30,6 @@ load_led() {
|
||||
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
|
||||
|
||||
# execute application led trigger
|
||||
[ -f "/usr/libexec/led-trigger/${trigger}" ] && {
|
||||
@@ -90,31 +49,21 @@ 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
|
||||
@@ -131,7 +80,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 +125,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -38,24 +38,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,6 +100,10 @@ service_triggers() {
|
||||
return 0
|
||||
}
|
||||
|
||||
service_data() {
|
||||
return 0
|
||||
}
|
||||
|
||||
service_running() {
|
||||
local instance="${1:-*}"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -211,10 +179,8 @@ config_list_foreach() {
|
||||
|
||||
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 +188,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 +203,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 +254,17 @@ 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 filelist="/usr/lib/opkg/info/${pkgname}.list"
|
||||
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
|
||||
@@ -382,13 +292,8 @@ default_postinst() {
|
||||
rm -f /tmp/luci-indexcache
|
||||
fi
|
||||
|
||||
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
|
||||
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )
|
||||
ret=$?
|
||||
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$filelist"); do
|
||||
if [ -n "$root" ]; then
|
||||
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
|
||||
else
|
||||
@@ -410,11 +315,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}"
|
||||
@@ -471,7 +371,7 @@ group_add_next() {
|
||||
return
|
||||
fi
|
||||
gids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/group)
|
||||
gid=32768
|
||||
gid=65536
|
||||
while echo "$gids" | grep -q "^$gid$"; do
|
||||
gid=$((gid + 1))
|
||||
done
|
||||
@@ -502,7 +402,7 @@ user_add() {
|
||||
local rc
|
||||
[ -z "$uid" ] && {
|
||||
uids=$(cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd)
|
||||
uid=32768
|
||||
uid=65536
|
||||
while echo "$uids" | grep -q "^$uid$"; do
|
||||
uid=$((uid + 1))
|
||||
done
|
||||
@@ -533,4 +433,4 @@ cmdline_get_var() {
|
||||
done
|
||||
}
|
||||
|
||||
[ -z "$IPKG_INSTROOT" ] && [ -f /lib/config/uci.sh ] && . /lib/config/uci.sh || true
|
||||
[ -z "$IPKG_INSTROOT" ] && [ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,7 +73,10 @@ mtd_get_mac_ascii() {
|
||||
return
|
||||
fi
|
||||
|
||||
get_mac_ascii "$part" "$key"
|
||||
mac_dirty=$(strings "$part" | sed -n 's/^'"$key"'=//p')
|
||||
|
||||
# "canonicalize" mac
|
||||
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
|
||||
}
|
||||
|
||||
mtd_get_mac_encrypted_arcadyan() {
|
||||
@@ -197,20 +190,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"
|
||||
@@ -279,6 +258,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=""
|
||||
|
||||
@@ -106,33 +106,20 @@ ucidef_set_bridge_mac() {
|
||||
json_select ..
|
||||
}
|
||||
|
||||
_ucidef_set_network_device_common() {
|
||||
json_select_object "network_device"
|
||||
json_select_object "${1}"
|
||||
json_add_string "${2}" "${3}"
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_network_device_mac() {
|
||||
_ucidef_set_network_device_common $1 macaddr $2
|
||||
json_select_object "network-device"
|
||||
json_select_object "${1}"
|
||||
json_add_string macaddr "${2}"
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_network_device_path() {
|
||||
_ucidef_set_network_device_common $1 path $2
|
||||
}
|
||||
|
||||
ucidef_set_network_device_path_port() {
|
||||
_ucidef_set_network_device_common $1 path $2
|
||||
_ucidef_set_network_device_common $1 port $3
|
||||
}
|
||||
|
||||
ucidef_set_network_device_gro() {
|
||||
_ucidef_set_network_device_common $1 gro $2
|
||||
}
|
||||
|
||||
ucidef_set_network_device_conduit() {
|
||||
_ucidef_set_network_device_common $1 conduit $2
|
||||
json_select_object "network_device"
|
||||
json_select_object "$1"
|
||||
json_add_string path "$2"
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
_ucidef_add_switch_port() {
|
||||
@@ -647,92 +634,6 @@ ucidef_set_hostname() {
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_timezone() {
|
||||
local timezone="$1"
|
||||
json_select_object system
|
||||
json_add_string timezone "$timezone"
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_wireless() {
|
||||
local band="$1"
|
||||
local ssid="$2"
|
||||
local encryption="$3"
|
||||
local key="$4"
|
||||
|
||||
case "$band" in
|
||||
all|2g|5g|6g) ;;
|
||||
*) return;;
|
||||
esac
|
||||
[ -z "$ssid" ] && return
|
||||
|
||||
json_select_object wlan
|
||||
json_select_object defaults
|
||||
json_select_object ssids
|
||||
json_select_object "$band"
|
||||
json_add_string ssid "$ssid"
|
||||
[ -n "$encryption" ] && json_add_string encryption "$encryption"
|
||||
[ -n "$key" ] && json_add_string key "$key"
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_country() {
|
||||
local country="$1"
|
||||
|
||||
json_select_object wlan
|
||||
json_select_object defaults
|
||||
json_add_string country "$country"
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_wireless_mac_count() {
|
||||
local band="$1"
|
||||
local mac_count="$2"
|
||||
|
||||
case "$band" in
|
||||
2g|5g|6g) ;;
|
||||
*) return;;
|
||||
esac
|
||||
[ -z "$mac_count" ] && return
|
||||
|
||||
json_select_object wlan
|
||||
json_select_object defaults
|
||||
json_select_object ssids
|
||||
json_select_object "$band"
|
||||
json_add_string mac_count "$mac_count"
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_root_password_plain() {
|
||||
local passwd="$1"
|
||||
json_select_object credentials
|
||||
json_add_string root_password_plain "$passwd"
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_root_password_hash() {
|
||||
local passwd="$1"
|
||||
json_select_object credentials
|
||||
json_add_string root_password_hash "$passwd"
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_ssh_authorized_key() {
|
||||
local ssh_key="$1"
|
||||
json_select_object credentials
|
||||
json_select_array ssh_authorized_keys
|
||||
json_add_string "" "$ssh_key"
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_ntpserver() {
|
||||
local server
|
||||
|
||||
@@ -745,17 +646,6 @@ ucidef_set_ntpserver() {
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_set_poe() {
|
||||
json_select_object poe
|
||||
json_add_string "budget" "$1"
|
||||
json_select_array ports
|
||||
for port in $2; do
|
||||
json_add_string "" "$port"
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
}
|
||||
|
||||
ucidef_add_wlan() {
|
||||
local path="$1"; shift
|
||||
|
||||
|
||||
@@ -9,14 +9,9 @@ indicate_failsafe_led () {
|
||||
|
||||
indicate_failsafe() {
|
||||
[ "$pi_preinit_no_failsafe" = "y" ] && return
|
||||
local consoles="$(cat /sys/class/tty/console/active)"
|
||||
[ -n "$consoles" ] || consoles=console
|
||||
for console in $consoles; do
|
||||
[ -c "/dev/$console" ] && echo "- failsafe -" >"/dev/$console"
|
||||
done
|
||||
echo "- failsafe -"
|
||||
preinit_net_echo "Entering Failsafe!\n"
|
||||
indicate_failsafe_led
|
||||
echo OpenWrt-failsafe > /proc/sys/kernel/hostname
|
||||
}
|
||||
|
||||
boot_hook_add failsafe indicate_failsafe
|
||||
|
||||
@@ -65,27 +65,12 @@ preinit_config_switch() {
|
||||
|
||||
preinit_config_port() {
|
||||
local original
|
||||
local dev_port
|
||||
|
||||
local netdev="$1"
|
||||
local path="$2"
|
||||
local port="$3"
|
||||
|
||||
[ -d "/sys/devices/$path/net" ] || return
|
||||
|
||||
if [ -z "$port" ]; then
|
||||
original="$(ls "/sys/devices/$path/net" | head -1)"
|
||||
else
|
||||
for device in /sys/devices/$path/net/*; do
|
||||
dev_port="$(cat "$device/dev_port")"
|
||||
if [ "$dev_port" = "$port" ]; then
|
||||
original="${device##*/}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -z "$original" ] && return
|
||||
fi
|
||||
original="$(ls "/sys/devices/$path/net" | head -1)"
|
||||
|
||||
[ "$netdev" = "$original" ] && return
|
||||
|
||||
@@ -124,8 +109,7 @@ preinit_config_board() {
|
||||
json_select "network_device"
|
||||
json_select "$netdev"
|
||||
json_get_vars path path
|
||||
json_get_vars port port
|
||||
[ -n "$path" ] && preinit_config_port "$netdev" "$path" "$port"
|
||||
[ -n "$path" ] && preinit_config_port "$netdev" "$path"
|
||||
json_select ..
|
||||
json_select ..
|
||||
done
|
||||
|
||||
@@ -40,7 +40,7 @@ fs_wait_for_key () {
|
||||
rm -f $keypress_wait
|
||||
} &
|
||||
|
||||
local consoles="$(cat /sys/class/tty/console/active)"
|
||||
local consoles="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | sed -e 's/^console=//' -e 's/,.*//')"
|
||||
[ -n "$consoles" ] || consoles=console
|
||||
for console in $consoles; do
|
||||
[ -c "/dev/$console" ] || continue
|
||||
@@ -78,9 +78,6 @@ fs_wait_for_key () {
|
||||
keypressed=1
|
||||
[ "$(cat $keypress_true)" = "true" ] && keypressed=0
|
||||
|
||||
trap - INT
|
||||
trap - USR1
|
||||
|
||||
rm -f $keypress_true
|
||||
rm -f $keypress_wait
|
||||
rm -f $keypress_sec
|
||||
|
||||
@@ -9,32 +9,13 @@ missing_lines() {
|
||||
IFS=":"
|
||||
while read line; do
|
||||
set -- $line
|
||||
grep -q "^$1:" "$file2" || echo "$line"
|
||||
grep -q "^$1:" "$file2" || echo "$*"
|
||||
done < "$file1"
|
||||
IFS="$oIFS"
|
||||
}
|
||||
|
||||
# Rootfs mount options can be passed by declaring in the kernel
|
||||
# cmdline as much options as needed prefixed with "rootfs_mount_options."
|
||||
#
|
||||
# Example:
|
||||
# rootfs_mount_options.compress_algorithm=zstd rootfs_mount_options.noinline_data
|
||||
#
|
||||
compose_rootfs_mount_options() {
|
||||
local mount_options
|
||||
local cmdlinevar
|
||||
|
||||
for cmdlinevar in $(cat /proc/cmdline); do
|
||||
if [ "$cmdlinevar" != "${cmdlinevar#rootfs_mount_options\.}" ]; then
|
||||
append mount_options "${cmdlinevar#rootfs_mount_options\.}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo $mount_options
|
||||
}
|
||||
|
||||
do_mount_root() {
|
||||
mount_root start "$(compose_rootfs_mount_options)"
|
||||
mount_root
|
||||
boot_run_hook preinit_mount_root
|
||||
[ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && {
|
||||
echo "- config restore -"
|
||||
|
||||
@@ -2,22 +2,14 @@
|
||||
# Copyright (C) 2010 Vertical Communications
|
||||
|
||||
failsafe_shell() {
|
||||
local consoles="$(cat /sys/class/tty/console/active)"
|
||||
local consoles="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | sed -e 's/^console=//' -e 's/,.*//')"
|
||||
[ -n "$consoles" ] || consoles=console
|
||||
for console in $consoles; do
|
||||
case "$console" in
|
||||
console|tty[0-9]*)
|
||||
term=${TERM:-linux}
|
||||
;;
|
||||
*)
|
||||
term=vt102
|
||||
;;
|
||||
esac
|
||||
# Running asynchronously via the shell's & would ignore SIGINT,
|
||||
# breaking ^C. Use start-stop-daemon instead.
|
||||
[ -c "/dev/$console" ] && start-stop-daemon -Sb -p /dev/null -- env -i ash -c "while true; do setsid -c env -i USER=root LOGNAME=root SHELL=/bin/ash TERM="$term" ash --login <\"/dev/$console\" >\"/dev/$console\" 2>\"/dev/$console\"; sleep 1; done"
|
||||
[ -c "/dev/$console" ] && while true; do
|
||||
ash --login <"/dev/$console" >"/dev/$console" 2>"/dev/$console"
|
||||
sleep 1
|
||||
done &
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
boot_hook_add failsafe failsafe_shell
|
||||
|
||||
@@ -16,22 +16,15 @@ emmc_upgrade_tar() {
|
||||
tar tf "$tar_file" ${board_dir}/kernel 1>/dev/null 2>/dev/null && has_kernel=1
|
||||
tar tf "$tar_file" ${board_dir}/root 1>/dev/null 2>/dev/null && has_rootfs=1
|
||||
|
||||
[ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] && {
|
||||
# Invalidate kernel image while rootfs is being written
|
||||
[ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] && {
|
||||
dd if=/dev/zero of="$EMMC_KERN_DEV" bs=512 count=8
|
||||
sync
|
||||
}
|
||||
[ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] &&
|
||||
export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
|
||||
[ "$has_rootfs" = 1 -a "$EMMC_ROOT_DEV" ] && {
|
||||
export EMMC_ROOTFS_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/root -O | dd of="$EMMC_ROOT_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
# Account for 64KiB ROOTDEV_OVERLAY_ALIGN in libfstools
|
||||
EMMC_ROOTFS_BLOCKS=$(((EMMC_ROOTFS_BLOCKS + 127) & ~127))
|
||||
sync
|
||||
}
|
||||
|
||||
[ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] &&
|
||||
export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1)))
|
||||
|
||||
if [ -z "$UPGRADE_BACKUP" ]; then
|
||||
if [ "$EMMC_DATA_DEV" ]; then
|
||||
dd if=/dev/zero of="$EMMC_DATA_DEV" bs=512 count=8
|
||||
|
||||
@@ -57,11 +57,11 @@ nand_find_ubi() {
|
||||
}
|
||||
|
||||
nand_get_magic_long() {
|
||||
($2 < "$1" | dd bs=4 "skip=${3:-0}" count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
(${3}cat "$1" | dd bs=4 "skip=${2:-0}" count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
}
|
||||
|
||||
get_magic_long_tar() {
|
||||
($2 < "$1" | tar xOf - "$3" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
(tar xO${3}f "$1" "$2" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null
|
||||
}
|
||||
|
||||
identify() {
|
||||
@@ -73,7 +73,7 @@ identify_tar() {
|
||||
}
|
||||
|
||||
identify_if_gzip() {
|
||||
if [ "$(identify "$1" "cat")" = gzip ]; then echo -n z; fi
|
||||
if [ "$(identify "$1")" = gzip ]; then echo -n z; fi
|
||||
}
|
||||
|
||||
nand_restore_config() {
|
||||
@@ -111,7 +111,7 @@ nand_remove_ubiblock() {
|
||||
|
||||
local ubiblk="ubiblock${ubivol:3}"
|
||||
if [ -e "/dev/$ubiblk" ]; then
|
||||
umount "/dev/$ubiblk" 2>/dev/null && echo "unmounted /dev/$ubiblk" || :
|
||||
umount "/dev/$ubiblk" && echo "unmounted /dev/$ubiblk" || :
|
||||
if ! ubiblock -r "/dev/$ubivol"; then
|
||||
echo "cannot remove $ubiblk"
|
||||
return 1
|
||||
@@ -259,64 +259,64 @@ nand_upgrade_prepare_ubi() {
|
||||
# Write the UBI image to MTD ubi partition
|
||||
nand_upgrade_ubinized() {
|
||||
local ubi_file="$1"
|
||||
local cmd="$2"
|
||||
local gz="$2"
|
||||
|
||||
local ubi_length=$( ($cmd < "$ubi_file" | wc -c) 2> /dev/null)
|
||||
local ubi_length=$( (${gz}cat "$ubi_file" | wc -c) 2> /dev/null)
|
||||
|
||||
nand_detach_ubi "$CI_UBIPART" || return 1
|
||||
|
||||
local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
|
||||
$cmd < "$ubi_file" | ubiformat "/dev/mtd$mtdnum" -S "$ubi_length" -y -f - && ubiattach -m "$mtdnum"
|
||||
${gz}cat "$ubi_file" | ubiformat "/dev/mtd$mtdnum" -S "$ubi_length" -y -f - && ubiattach -m "$mtdnum"
|
||||
}
|
||||
|
||||
# Write the UBIFS image to UBI rootfs volume
|
||||
nand_upgrade_ubifs() {
|
||||
local ubifs_file="$1"
|
||||
local cmd="$2"
|
||||
local gz="$2"
|
||||
|
||||
local ubifs_length=$( ($cmd < "$ubifs_file" | wc -c) 2> /dev/null)
|
||||
local ubifs_length=$( (${gz}cat "$ubifs_file" | wc -c) 2> /dev/null)
|
||||
|
||||
nand_upgrade_prepare_ubi "$ubifs_length" "ubifs" "" "" || return 1
|
||||
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
local root_ubivol="$(nand_find_volume $ubidev "$CI_ROOTPART")"
|
||||
$cmd < "$ubifs_file" | ubiupdatevol /dev/$root_ubivol -s "$ubifs_length" -
|
||||
${gz}cat "$ubifs_file" | ubiupdatevol /dev/$root_ubivol -s "$ubifs_length" -
|
||||
}
|
||||
|
||||
# Write the FIT image to UBI kernel volume
|
||||
nand_upgrade_fit() {
|
||||
local fit_file="$1"
|
||||
local cmd="$2"
|
||||
local gz="$2"
|
||||
|
||||
local fit_length=$( ($cmd < "$fit_file" | wc -c) 2> /dev/null)
|
||||
local fit_length=$( (${gz}cat "$fit_file" | wc -c) 2> /dev/null)
|
||||
|
||||
nand_upgrade_prepare_ubi "" "" "$fit_length" "1" || return 1
|
||||
|
||||
local fit_ubidev="$(nand_find_ubi "$CI_UBIPART")"
|
||||
local fit_ubivol="$(nand_find_volume $fit_ubidev "$CI_KERNPART")"
|
||||
$cmd < "$fit_file" | ubiupdatevol /dev/$fit_ubivol -s "$fit_length" -
|
||||
${gz}cat "$fit_file" | ubiupdatevol /dev/$fit_ubivol -s "$fit_length" -
|
||||
}
|
||||
|
||||
# Write images in the TAR file to MTD partitions and/or UBI volumes as required
|
||||
nand_upgrade_tar() {
|
||||
local tar_file="$1"
|
||||
local cmd="${2:-cat}"
|
||||
local gz="$2"
|
||||
local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}"
|
||||
|
||||
# WARNING: This fails if tar contains more than one 'sysupgrade-*' directory.
|
||||
local board_dir="$($cmd < "$tar_file" | tar tf - | grep -m 1 '^sysupgrade-.*/$')"
|
||||
local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')"
|
||||
board_dir="${board_dir%/}"
|
||||
|
||||
local kernel_mtd kernel_length
|
||||
if [ "$CI_KERNPART" != "none" ]; then
|
||||
kernel_mtd="$(find_mtd_index "$CI_KERNPART")"
|
||||
kernel_length=$( ($cmd < "$tar_file" | tar xOf - "$board_dir/kernel" | wc -c) 2> /dev/null)
|
||||
kernel_length=$( (tar xO${gz}f "$tar_file" "$board_dir/kernel" | wc -c) 2> /dev/null)
|
||||
[ "$kernel_length" = 0 ] && kernel_length=
|
||||
fi
|
||||
local rootfs_length=$( ($cmd < "$tar_file" | tar xOf - "$board_dir/root" | wc -c) 2> /dev/null)
|
||||
local rootfs_length=$( (tar xO${gz}f "$tar_file" "$board_dir/root" | wc -c) 2> /dev/null)
|
||||
[ "$rootfs_length" = 0 ] && rootfs_length=
|
||||
local rootfs_type
|
||||
[ "$rootfs_length" ] && rootfs_type="$(identify_tar "$tar_file" "$cmd" "$board_dir/root")"
|
||||
[ "$rootfs_length" ] && rootfs_type="$(identify_tar "$tar_file" "$board_dir/root" "$gz")"
|
||||
|
||||
local ubi_kernel_length
|
||||
if [ "$kernel_length" ]; then
|
||||
@@ -337,23 +337,23 @@ nand_upgrade_tar() {
|
||||
if [ "$rootfs_length" ]; then
|
||||
local ubidev="$( nand_find_ubi "${CI_ROOT_UBIPART:-$CI_UBIPART}" )"
|
||||
local root_ubivol="$( nand_find_volume $ubidev "$CI_ROOTPART" )"
|
||||
$cmd < "$tar_file" | tar xOf - "$board_dir/root" | \
|
||||
tar xO${gz}f "$tar_file" "$board_dir/root" | \
|
||||
ubiupdatevol /dev/$root_ubivol -s "$rootfs_length" -
|
||||
fi
|
||||
if [ "$kernel_length" ]; then
|
||||
if [ "$kernel_mtd" ]; then
|
||||
if [ "$jffs2_markers" = 1 ]; then
|
||||
flash_erase -j "/dev/mtd${kernel_mtd}" 0 0
|
||||
$cmd < "$tar_file" | tar xOf - "$board_dir/kernel" | \
|
||||
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
|
||||
nandwrite "/dev/mtd${kernel_mtd}" -
|
||||
else
|
||||
$cmd < "$tar_file" | tar xOf - "$board_dir/kernel" | \
|
||||
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
|
||||
mtd write - "$CI_KERNPART"
|
||||
fi
|
||||
else
|
||||
local ubidev="$( nand_find_ubi "${CI_KERN_UBIPART:-$CI_UBIPART}" )"
|
||||
local kern_ubivol="$( nand_find_volume $ubidev "$CI_KERNPART" )"
|
||||
$cmd < "$tar_file" | tar xOf - "$board_dir/kernel" | \
|
||||
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
|
||||
ubiupdatevol /dev/$kern_ubivol -s "$kernel_length" -
|
||||
fi
|
||||
fi
|
||||
@@ -363,9 +363,9 @@ nand_upgrade_tar() {
|
||||
|
||||
nand_verify_if_gzip_file() {
|
||||
local file="$1"
|
||||
local cmd="$2"
|
||||
local gz="$2"
|
||||
|
||||
if [ "$cmd" = zcat ]; then
|
||||
if [ "$gz" = z ]; then
|
||||
echo "verifying compressed sysupgrade file integrity"
|
||||
if ! gzip -t "$file"; then
|
||||
echo "corrupted compressed sysupgrade file"
|
||||
@@ -376,10 +376,10 @@ nand_verify_if_gzip_file() {
|
||||
|
||||
nand_verify_tar_file() {
|
||||
local file="$1"
|
||||
local cmd="$2"
|
||||
local gz="$2"
|
||||
|
||||
echo "verifying sysupgrade tar file integrity"
|
||||
if ! $cmd < "$file" | tar xOf - > /dev/null; then
|
||||
if ! tar xO${gz}f "$file" > /dev/null; then
|
||||
echo "corrupted sysupgrade tar file"
|
||||
return 1
|
||||
fi
|
||||
@@ -387,30 +387,28 @@ nand_verify_tar_file() {
|
||||
|
||||
nand_do_flash_file() {
|
||||
local file="$1"
|
||||
local cmd="$2"
|
||||
local file_type
|
||||
|
||||
[ -z "$cmd" ] && cmd="$(identify_if_gzip "$file")cat"
|
||||
file_type="$(identify "$file" "$cmd" "")"
|
||||
local gz="$(identify_if_gzip "$file")"
|
||||
local file_type="$(identify "$file" "" "$gz")"
|
||||
|
||||
[ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART=rootfs
|
||||
|
||||
case "$file_type" in
|
||||
"fit")
|
||||
nand_verify_if_gzip_file "$file" "$cmd" || return 1
|
||||
nand_upgrade_fit "$file" "$cmd"
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
nand_upgrade_fit "$file" "$gz"
|
||||
;;
|
||||
"ubi")
|
||||
nand_verify_if_gzip_file "$file" "$cmd" || return 1
|
||||
nand_upgrade_ubinized "$file" "$cmd"
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
nand_upgrade_ubinized "$file" "$gz"
|
||||
;;
|
||||
"ubifs")
|
||||
nand_verify_if_gzip_file "$file" "$cmd" || return 1
|
||||
nand_upgrade_ubifs "$file" "$cmd"
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
nand_upgrade_ubifs "$file" "$gz"
|
||||
;;
|
||||
*)
|
||||
nand_verify_tar_file "$file" "$cmd" || return 1
|
||||
nand_upgrade_tar "$file" "$cmd"
|
||||
nand_verify_tar_file "$file" "$gz" || return 1
|
||||
nand_upgrade_tar "$file" "$gz"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -421,26 +419,11 @@ nand_do_restore_config() {
|
||||
}
|
||||
|
||||
# Recognize type of passed file and start the upgrade process
|
||||
#
|
||||
# Supported firmware containers:
|
||||
# 1. Raw file
|
||||
# 2. Gzip
|
||||
# 3. Custom (requires passing extracting command)
|
||||
#
|
||||
# Supported data formats:
|
||||
# 1. Tar with kernel/rootfs
|
||||
# 2. UBI image (built using "ubinized")
|
||||
# 3. UBIFS image (to update UBI volume with)
|
||||
# 4. FIT image (to update UBI volume with)
|
||||
#
|
||||
# $(1): firmware file path
|
||||
# $(2): (optional) pipe command to extract firmware
|
||||
nand_do_upgrade() {
|
||||
local file="$1"
|
||||
local cmd="$2"
|
||||
|
||||
sync
|
||||
nand_do_flash_file "$file" "$cmd" && nand_do_upgrade_success
|
||||
nand_do_flash_file "$file" && nand_do_upgrade_success
|
||||
nand_do_upgrade_failed
|
||||
}
|
||||
|
||||
@@ -477,18 +460,18 @@ nand_do_platform_check() {
|
||||
local board_name="$1"
|
||||
local file="$2"
|
||||
|
||||
local cmd="$(identify_if_gzip "$file")cat"
|
||||
local file_type="$(identify "$file" "$cmd" "")"
|
||||
local control_length=$( ($cmd < "$file" | tar xOf - "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null)
|
||||
local gz="$(identify_if_gzip "$file")"
|
||||
local file_type="$(identify "$file" "" "$gz")"
|
||||
local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null)
|
||||
|
||||
if [ "$control_length" = 0 ]; then
|
||||
control_length=$( ($cmd < "$file" | tar xOf - "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null)
|
||||
control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null)
|
||||
fi
|
||||
|
||||
if [ "$control_length" != 0 ]; then
|
||||
nand_verify_tar_file "$file" "$cmd" || return 1
|
||||
nand_verify_tar_file "$file" "$gz" || return 1
|
||||
else
|
||||
nand_verify_if_gzip_file "$file" "$cmd" || return 1
|
||||
nand_verify_if_gzip_file "$file" "$gz" || return 1
|
||||
if [ "$file_type" != "fit" -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ]; then
|
||||
echo "invalid sysupgrade file"
|
||||
return 1
|
||||
|
||||
@@ -121,7 +121,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
|
||||
v "Sending signal $sig to $name ($pid)"
|
||||
kill -$sig $pid 2>/dev/null
|
||||
|
||||
[ $loop -eq 1 ] && sleep 2 && run=true
|
||||
[ $loop -eq 1 ] && run=true
|
||||
done
|
||||
|
||||
let loop_limit--
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
# Example usage:
|
||||
#
|
||||
# {
|
||||
# tar_print_member "date.txt" "It's $(date +"%Y")"
|
||||
# tar_print_trailer
|
||||
# } > test.tar
|
||||
|
||||
__tar_print_padding() {
|
||||
dd if=/dev/zero bs=1 count=$1 2>/dev/null
|
||||
}
|
||||
|
||||
tar_print_member() {
|
||||
local name="$1"
|
||||
local content="$2"
|
||||
local mtime="${3:-$(date +%s)}"
|
||||
local mode=644
|
||||
local uid=0
|
||||
local gid=0
|
||||
local size=${#content}
|
||||
local type=0
|
||||
local link=""
|
||||
local username="root"
|
||||
local groupname="root"
|
||||
|
||||
# 100 byte of padding bytes, using 0x01 since the shell does not tolerate null bytes in strings
|
||||
local pad=$'\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1'
|
||||
|
||||
# validate name (strip leading slash if present)
|
||||
name=${name#/}
|
||||
|
||||
# truncate string header values to their maximum length
|
||||
name=${name:0:100}
|
||||
link=${link:0:100}
|
||||
username=${username:0:32}
|
||||
groupname=${groupname:0:32}
|
||||
|
||||
# construct header part before checksum field
|
||||
local header1="${name}${pad:0:$((100 - ${#name}))}"
|
||||
header1="${header1}$(printf '%07d\1' $mode)"
|
||||
header1="${header1}$(printf '%07o\1' $uid)"
|
||||
header1="${header1}$(printf '%07o\1' $gid)"
|
||||
header1="${header1}$(printf '%011o\1' $size)"
|
||||
header1="${header1}$(printf '%011o\1' $mtime)"
|
||||
|
||||
# construct header part after checksum field
|
||||
local header2="$(printf '%d' $type)"
|
||||
header2="${header2}${link}${pad:0:$((100 - ${#link}))}"
|
||||
header2="${header2}ustar ${pad:0:1}"
|
||||
header2="${header2}${username}${pad:0:$((32 - ${#username}))}"
|
||||
header2="${header2}${groupname}${pad:0:$((32 - ${#groupname}))}"
|
||||
|
||||
# calculate checksum over header fields
|
||||
local checksum=0
|
||||
for byte in $(printf '%s%8s%s' "$header1" "" "$header2" | tr '\1' '\0' | hexdump -ve '1/1 "%u "'); do
|
||||
checksum=$((checksum + byte))
|
||||
done
|
||||
|
||||
# print member header, padded to 512 byte
|
||||
printf '%s%06o\0 %s' "$header1" $checksum "$header2" | tr '\1' '\0'
|
||||
__tar_print_padding 183
|
||||
|
||||
# print content data, padded to multiple of 512 byte
|
||||
printf "%s" "$content"
|
||||
__tar_print_padding $((512 - (size % 512)))
|
||||
}
|
||||
|
||||
tar_print_trailer() {
|
||||
__tar_print_padding 1024
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
/sbin/factoryreset $@
|
||||
/sbin/jffs2reset $@
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user