From 685570858dc6b19329594c6efd2c20f1898976f9 Mon Sep 17 00:00:00 2001 From: Piotr Stefaniak Date: Sun, 9 Aug 2020 00:38:21 +0200 Subject: [PATCH 01/10] build: fix typo in cmake patch The variable in the case argument was mistyped, so the case always checked against an empty string and never matched. Fix the variable name. Signed-off-by: Piotr Stefaniak [add commit message] Signed-off-by: Adrian Schmutzler --- tools/cmake/patches/130-bootstrap_parallel_make_flag.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index 7b6198b14b..45ad885953 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -5,7 +5,7 @@ cmake_original_make_flags="${cmake_make_flags}" if [ "x${cmake_parallel_make}" != "x" ]; then - cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}" -+ case "$cmake_paralle_make" in ++ case "$cmake_parallel_make" in + [0-9]*) cmake_parallel_make="-j ${cmake_parallel_make}";; + esac + cmake_make_flags="${cmake_make_flags} ${cmake_parallel_make}" From 982c1f6e42c5b3e0f23eedd825a317a2872aa37b Mon Sep 17 00:00:00 2001 From: Christoph Krapp Date: Sun, 9 Aug 2020 13:40:26 +0200 Subject: [PATCH 02/10] ar71xx: change u-boot-env to read-write for ZyXEL NBG6616 As the ath79 port of this device uses a combined kernel + root partition the uboot bootcmd variable needs to be changed. As using cli/luci is more convenient than opening up the case and using a uart connection, lets unlock the uboot-env partition for write access. Signed-off-by: Christoph Krapp --- target/linux/ar71xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 5098650ec7..27e2a5fc22 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -1067,7 +1067,7 @@ define Device/NBG6616 BOARDNAME := NBG6616 KERNEL_SIZE := 2048k IMAGE_SIZE := 15323k - MTDPARTS := spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware) + MTDPARTS := spi0.0:192k(u-boot)ro,64k(env),64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware) CMDLINE += mem=128M RAS_BOARD := NBG6616 RAS_ROOTFS_SIZE := 14464k From eb95ca3b5c8b33e3212896f906922eba5f72abb3 Mon Sep 17 00:00:00 2001 From: Christoph Krapp Date: Sun, 9 Aug 2020 13:39:05 +0200 Subject: [PATCH 03/10] uboot-envtools: ar71xx: add ZyXEL NBG6616 uboot env support This adds support for ZyXEL NBG6616 uboot-env access Signed-off-by: Christoph Krapp [add "ar71xx" to commit title] Signed-off-by: Adrian Schmutzler --- package/boot/uboot-envtools/files/ar71xx | 1 + 1 file changed, 1 insertion(+) diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx index 9625c6bdd1..04c986ee58 100644 --- a/package/boot/uboot-envtools/files/ar71xx +++ b/package/boot/uboot-envtools/files/ar71xx @@ -47,6 +47,7 @@ mr600v2|\ mr900|\ mr900v2|\ n5q|\ +nbg6616|\ nbg6716|\ om5p|\ om5p-ac|\ From c25c9e98f59357df9e92396aba44220d840dba7d Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 9 Aug 2020 23:59:20 +0200 Subject: [PATCH 04/10] Revert "build: fix typo in cmake patch" This reverts commit 685570858dc6b19329594c6efd2c20f1898976f9. The commit had several formal flaws, revert it and hopefully apply it properly next time. Signed-off-by: Adrian Schmutzler --- tools/cmake/patches/130-bootstrap_parallel_make_flag.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index 45ad885953..7b6198b14b 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -5,7 +5,7 @@ cmake_original_make_flags="${cmake_make_flags}" if [ "x${cmake_parallel_make}" != "x" ]; then - cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}" -+ case "$cmake_parallel_make" in ++ case "$cmake_paralle_make" in + [0-9]*) cmake_parallel_make="-j ${cmake_parallel_make}";; + esac + cmake_make_flags="${cmake_make_flags} ${cmake_parallel_make}" From e27fbae63c3436ce5588ca06b78ea88c7a316fee Mon Sep 17 00:00:00 2001 From: Piotr Stefaniak Date: Sun, 9 Aug 2020 00:38:21 +0200 Subject: [PATCH 05/10] tools/cmake: fix typo in parallel make patch The variable in the case argument was mistyped, so the case always checked against an empty string and never matched. Fix the variable name. Add a PKG_RELEASE to Makefile so we can bump it. Fixes: d6de31310cc1 ("cmake: restore parallel build support for bootstrap") Signed-off-by: Piotr Stefaniak [add commit message, add PKG_RELEASE, fix commit title, add Fixes:] Signed-off-by: Adrian Schmutzler --- tools/cmake/Makefile | 1 + tools/cmake/patches/130-bootstrap_parallel_make_flag.patch | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index ab3d225aa6..fd066da326 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake PKG_VERSION:=3.17.0 +PKG_RELEASE:=2 PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index 7b6198b14b..45ad885953 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -5,7 +5,7 @@ cmake_original_make_flags="${cmake_make_flags}" if [ "x${cmake_parallel_make}" != "x" ]; then - cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}" -+ case "$cmake_paralle_make" in ++ case "$cmake_parallel_make" in + [0-9]*) cmake_parallel_make="-j ${cmake_parallel_make}";; + esac + cmake_make_flags="${cmake_make_flags} ${cmake_parallel_make}" From 9e7ef460652748395c897468af662df6ce2cb8d5 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Fri, 7 Aug 2020 11:12:59 -1000 Subject: [PATCH 06/10] tools: add fakeroot SELinux support requires setting the appropriate SELinux security context to files and directories, which needs to happen at build time in order to support read-only root filesystem scenarios. In order to create these security contexts, we will have to run some SELinux-specific tools on the host machine, but that requires root access. This adds support for fakeroot, which the build process will use to run the SELinux security context creation and the image creation. Signed-off-by: Thomas Petazzoni Apply to current master, and adjust commit message Thomas' original work is available at http://lists.infradead.org/pipermail/openwrt-devel/2019-November/025976.html. Signed-off-by: W. Michael Petullo [add rules.mk FAKEROOT variable] Signed-off-by: Paul Spooren [update, fix macos build] Signed-off-by: Felix Fietkau --- rules.mk | 1 + tools/Makefile | 2 +- tools/fakeroot/Makefile | 20 ++++ tools/fakeroot/patches/100-portability.patch | 112 +++++++++++++++++++ 4 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 tools/fakeroot/Makefile create mode 100644 tools/fakeroot/patches/100-portability.patch diff --git a/rules.mk b/rules.mk index 479172de03..45d96d6be4 100644 --- a/rules.mk +++ b/rules.mk @@ -264,6 +264,7 @@ endif BUILD_KEY=$(TOPDIR)/key-build +FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot TARGET_CC:=$(TARGET_CROSS)gcc TARGET_CXX:=$(TARGET_CROSS)g++ KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh diff --git a/tools/Makefile b/tools/Makefile index 9bae09ece6..f038c90ba9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -26,7 +26,7 @@ tools-y += m4 libtool autoconf autoconf-archive automake flex bison pkgconf mkli tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage tools-y += firmware-utils patch-image quilt padjffs2 tools-y += mm-macros missing-macros cmake bc findutils gengetopt patchelf -tools-y += mtools dosfstools libressl +tools-y += mtools dosfstools libressl fakeroot tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-$(CONFIG_TARGET_x86) += qemu tools-$(CONFIG_TARGET_mxs) += elftosb sdimage diff --git a/tools/fakeroot/Makefile b/tools/fakeroot/Makefile new file mode 100644 index 0000000000..2df893d64d --- /dev/null +++ b/tools/fakeroot/Makefile @@ -0,0 +1,20 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=fakeroot +PKG_VERSION:=1.24 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://deb.debian.org/debian/pool/main/f/fakeroot +PKG_HASH:=2e045b3160370b8ab4d44d1f8d267e5d1d555f1bb522d650e7167b09477266ed + +include $(INCLUDE_DIR)/host-build.mk + +HOST_CONFIGURE_VARS += \ + ac_cv_header_sys_capability_h=no \ + ac_cv_func_capset=no + +$(eval $(call HostBuild)) diff --git a/tools/fakeroot/patches/100-portability.patch b/tools/fakeroot/patches/100-portability.patch new file mode 100644 index 0000000000..3835a7792b --- /dev/null +++ b/tools/fakeroot/patches/100-portability.patch @@ -0,0 +1,112 @@ +--- a/libfakeroot.c ++++ b/libfakeroot.c +@@ -110,8 +110,16 @@ + #define INT_NEXT_FSTATAT(a,b,c,d) NEXT_FSTATAT(_STAT_VER,a,b,c,d) + #define INT_SEND_STAT(a,b) SEND_STAT(a,b,_STAT_VER) + #define INT_SEND_GET_XATTR(a,b) SEND_GET_XATTR(a,b,_STAT_VER) ++ ++/* 10.10 uses id_t in getpriority/setpriority calls, so pretend ++ id_t is used everywhere, just happens to be int on some OSes */ ++#ifndef _ID_T ++#define _ID_T ++typedef int id_t; ++#endif + #endif + ++#include + #include + #include + #include +@@ -123,7 +131,6 @@ + #include + #include + #include +-#include + #ifdef HAVE_SYS_ACL_H + #include + #endif /* HAVE_SYS_ACL_H */ +@@ -1894,7 +1901,7 @@ ssize_t fremovexattr(int fd, const char + } + #endif /* HAVE_FREMOVEXATTR */ + +-int setpriority(int which, int who, int prio){ ++int setpriority(int which, id_t who, int prio){ + if (fakeroot_disabled) + return next_setpriority(which, who, prio); + next_setpriority(which, who, prio); +@@ -2426,3 +2433,19 @@ int sysinfo(int command, char *buf, long + } + } + #endif ++ ++#ifdef HAVE_OPENAT ++int openat(int dir_fd, const char *pathname, int flags, ...) ++{ ++ mode_t mode; ++ ++ if (flags & O_CREAT) { ++ va_list args; ++ va_start(args, flags); ++ mode = va_arg(args, int); ++ va_end(args); ++ } ++ ++ return next_openat(dir_fd, pathname, flags, mode); ++} ++#endif +--- a/wrapfunc.inp ++++ b/wrapfunc.inp +@@ -145,7 +145,7 @@ setfsgid;gid_t;(gid_t fsgid);(fsgid) + #endif /* HAVE_SETFSGID */ + initgroups;int;(const char *user, INITGROUPS_SECOND_ARG group);(user, group) + setgroups;int;(SETGROUPS_SIZE_TYPE size, const gid_t *list);(size, list) +-setpriority;int;(int which, int who, int prio);(which, who, prio) ++setpriority;int;(int which, id_t who, int prio);(which, who, prio) + #ifdef HAVE_CAPSET + capset;int;(cap_user_header_t hdrp, const cap_user_data_t datap);(hdrp, datap) + #endif /* HAVE_CAPSET */ +@@ -197,7 +197,7 @@ fchownat;int;(int dir_fd, const char *pa + mkdirat;int;(int dir_fd, const char *pathname, mode_t mode);(dir_fd, pathname, mode) + #endif /* HAVE_MKDIRAT */ + #ifdef HAVE_OPENAT +-openat;int;(int dir_fd, const char *pathname, int flags);(dir_fd, pathname, flags) ++openat;int;(int dir_fd, const char *pathname, int flags, mode_t mode);(dir_fd, pathname, flags, mode);;(int dir_fd, const char *pathname, int flags, ...) + #endif /* HAVE_OPENAT */ + #ifdef HAVE_RENAMEAT + renameat;int;(int olddir_fd, const char *oldpath, int newdir_fd, const char *newpath);(olddir_fd, oldpath, newdir_fd, newpath) +--- a/wrapawk_macosx ++++ b/wrapawk_macosx +@@ -46,26 +46,30 @@ BEGIN{ + argtype=$3; + argname=$4; + MACRO=$5; ++ argtype_def=$6 ++ if(!argtype_def) { ++ argtype_def = argtype ++ } + if(MACRO){ + print "extern " ret " MY_DEF(" name ")" argtype " __attribute__((visibility(\"hidden\")));" > headerfile; + print "INTERPOSE(MY_DEF(" name "_RAW)," name "_RAW);" > structfile; + print "#undef " name > deffile + print "#define " name " MY_DEF(" name "_RAW)" > deffile + +- print "extern " ret, name, argtype ";" > tmpffile; ++ print "extern " ret, name, argtype_def ";" > tmpffile; + print "static __inline__ " ret " NEXT_" MACRO "_NOARG " argtype " __attribute__((always_inline));" > tmpffile; + print "static __inline__ " ret " NEXT_" MACRO "_NOARG " argtype " {" > tmpffile; + print " return " name, argname ";" > tmpffile; + print "}" > tmpffile; + print "" > tmpffile; + } else { +- print "extern " ret " my_" name, argtype " __attribute__((visibility(\"hidden\")));" > headerfile; ++ print "extern " ret " my_" name, argtype_def " __attribute__((visibility(\"hidden\")));" > headerfile; + print "#undef " name > structfile; + print "INTERPOSE(my_" name "," name ");" > structfile; + print "#define " name " my_" name > structfile + print "#define " name " my_" name > deffile + +- print "extern " ret, name, argtype ";" > tmpffile; ++ print "extern " ret, name, argtype_def ";" > tmpffile; + if(argname){ + print "static __inline__ " ret " next_" name, argtype " __attribute__((always_inline));" > tmpffile; + print "static __inline__ " ret " next_" name, argtype " {" > tmpffile; From cfe235c43686c3bea1479730f0af7ae883180ca8 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 6 Aug 2020 21:03:32 +0100 Subject: [PATCH 07/10] kernel: modules: add package kmod-iosched-bfq Signed-off-by: Daniel Golle --- package/kernel/linux/modules/block.mk | 14 ++++++++++++++ target/linux/generic/config-4.14 | 1 - target/linux/generic/config-4.19 | 1 - target/linux/generic/config-5.4 | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index fbd3c81911..8a7232d8be 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -565,3 +565,17 @@ define KernelPackage/scsi-tape endef $(eval $(call KernelPackage,scsi-tape)) + +define KernelPackage/iosched-bfq + SUBMENU:=$(BLOCK_MENU) + TITLE:=Kernel support for BFQ I/O scheduler + KCONFIG:= \ + CONFIG_IOSCHED_BFQ \ + CONFIG_BFQ_GROUP_IOSCHED=y \ + CONFIG_BFQ_CGROUP_DEBUG=n + FILES:= \ + $(LINUX_DIR)/block/bfq.ko + AUTOLOAD:=$(call AutoLoad,10,bfq) +endef + +$(eval $(call KernelPackage,iosched-bfq)) diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index b3d7d39935..da156d2145 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -2064,7 +2064,6 @@ CONFIG_INPUT_MISC=y # CONFIG_INV_MPU6050_IIO is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_BFQ is not set # CONFIG_IOSCHED_CFQ is not set CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_NOOP=y diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19 index de28c51e3d..2d6d34a83d 100644 --- a/target/linux/generic/config-4.19 +++ b/target/linux/generic/config-4.19 @@ -2186,7 +2186,6 @@ CONFIG_INPUT_MISC=y # CONFIG_INV_MPU6050_IIO is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_BFQ is not set # CONFIG_IOSCHED_CFQ is not set CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_NOOP=y diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 563561859d..ae97a1580e 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -2344,7 +2344,6 @@ CONFIG_INPUT_MISC=y # CONFIG_INV_MPU6050_IIO is not set # CONFIG_INV_MPU6050_SPI is not set # CONFIG_IOMMU_SUPPORT is not set -# CONFIG_IOSCHED_BFQ is not set # CONFIG_IOSCHED_CFQ is not set CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_NOOP=y From 42abe56f1bc0fa20b5f3a35862456d0751c84d51 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 10 Aug 2020 09:40:14 +0100 Subject: [PATCH 08/10] kernel: further clean-up options and defaults Remove `if !SMALL_FLASH` in places which are anyway already augmented by `if !SMALL_FLASH`. Always enable CONFIG_BLK_DEV_THROTTLING on !SMALL_FLASH devices rather than just enabling it on bcm27xx. Enabled CPU bandwidth provisioning for FAIR_GROUP_SCHED on !SMALL_FLASH devices as CONFIG_FAIR_GROUP_SCHED is already enabled and becomes more useful for cgroups with that option enbled as well. Signed-off-by: Daniel Golle --- config/Config-kernel.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 2e80c8f537..496ec887cf 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -616,7 +616,7 @@ if KERNEL_CGROUPS config KERNEL_CPUSETS bool "Cpuset support" - default y if !SMALL_FLASH + default y help This option will let you create and manage CPUSETs which allow dynamically partitioning a system into sets of CPUs and @@ -630,14 +630,14 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_CPUACCT bool "Simple CPU accounting cgroup subsystem" - default y if !SMALL_FLASH + default y help Provides a simple Resource Controller for monitoring the total CPU consumed by the tasks in a cgroup. config KERNEL_RESOURCE_COUNTERS bool "Resource counters" - default y if !SMALL_FLASH + default y help This option enables controller independent resource accounting infrastructure that works with cgroups. @@ -648,7 +648,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG bool "Memory Resource Controller for Control Groups" - default y if !SMALL_FLASH + default y select KERNEL_FREEZER depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18 help @@ -672,7 +672,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG_SWAP bool "Memory Resource Controller Swap Extension" - default y if !SMALL_FLASH + default y depends on KERNEL_MEMCG help Add swap management feature to memory resource controller. When you @@ -707,7 +707,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG_KMEM bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)" - default y if !SMALL_FLASH + default y depends on KERNEL_MEMCG help The Kernel Memory extension for Memory Resource Controller can limit @@ -728,7 +728,7 @@ if KERNEL_CGROUPS menuconfig KERNEL_CGROUP_SCHED bool "Group CPU scheduler" - default y if !SMALL_FLASH + default y help This feature lets CPU scheduler recognize task groups and control CPU bandwidth allocation to such task groups. It uses cgroups to group @@ -738,11 +738,11 @@ if KERNEL_CGROUPS config KERNEL_FAIR_GROUP_SCHED bool "Group scheduling for SCHED_OTHER" - default y if !SMALL_FLASH + default y config KERNEL_CFS_BANDWIDTH bool "CPU bandwidth provisioning for FAIR_GROUP_SCHED" - default n + default y depends on KERNEL_FAIR_GROUP_SCHED help This option allows users to define CPU bandwidth rates (limits) for @@ -753,7 +753,7 @@ if KERNEL_CGROUPS config KERNEL_RT_GROUP_SCHED bool "Group scheduling for SCHED_RR/FIFO" - default y if !SMALL_FLASH + default y help This feature lets you explicitly allocate real CPU bandwidth to task groups. If enabled, it will also make it impossible to @@ -788,7 +788,7 @@ if KERNEL_CGROUPS config KERNEL_BLK_DEV_THROTTLING bool "Enable throttling policy" - default y if TARGET_bcm27xx + default y config KERNEL_BLK_DEV_THROTTLING_LOW bool "Block throttling .low limit interface support (EXPERIMENTAL)" From 12178be465df6821a5a7ff469aa10dac2ac332c6 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sat, 18 Jul 2020 07:52:13 -0500 Subject: [PATCH 09/10] procd: add SELinux support This commit adds a patch to procd to support loading the SELinux policy early at boot time, and adjusts the procd package to use this SELinux support when libselinux is enabled. The procd patch has been submitted separately [1]: obviously the intent is to have it merged in the procd Git repository rather than have it in OpenWrt itself. [1] http://lists.infradead.org/pipermail/openwrt-devel/2019-November/025791.html Signed-off-by: Thomas Petazzoni [rebase, add commit message] Signed-off-by: W. Michael Petullo [split commit into openwrt.git and procd.git] Signed-off-by: Daniel Golle --- package/system/procd/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index ba4af81a1a..17a871b15c 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2020-08-06 -PKG_SOURCE_VERSION:=ab55357dfe5bd0edac0b9556a83e69814df791b1 -PKG_MIRROR_HASH:=38c882e105811bcd10b5ce55f91a16a647ed2ad436aec01cd03fda588b7bfca9 +PKG_SOURCE_DATE:=2020-08-10 +PKG_SOURCE_VERSION:=fad899769e1411cc273785461f073a0f7931b9a0 +PKG_MIRROR_HASH:=f56b621f78f821f7070d85f63448f684af7e2fe0c85233a8d054683cc34f6d06 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 @@ -44,7 +44,7 @@ TARGET_LDFLAGS += -flto define Package/procd SECTION:=base CATEGORY:=Base system - DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +libblobmsg-json +libjson-c + DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +libblobmsg-json +libjson-c +PACKAGE_libselinux:libselinux TITLE:=OpenWrt system process manager USERID:=:dialout=20 :audio=29 endef @@ -108,7 +108,8 @@ ifdef CONFIG_PACKAGE_procd-ujail endif SECCOMP=$(if $(CONFIG_PACKAGE_procd-seccomp),1,0) -CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP) +SELINUX=$(if $(CONFIG_PACKAGE_libselinux),1,0) +CMAKE_OPTIONS += -DSECCOMP_SUPPORT=$(SECCOMP) -DUTRACE_SUPPORT=$(SECCOMP) -DSELINUX=$(SELINUX) define Package/procd/install $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions From ab74def0db93b5b958320ea083de559bc1870537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sun, 15 Mar 2020 00:20:22 +0100 Subject: [PATCH 10/10] ath79: add support for TP-Link TL-WPA8630P v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TL-WPA8630P v2 is a HomePlug AV2 compatible device with a QCA9563 SoC and 2.4GHz and 5GHz WiFi modules. Specifications -------------- - QCA9563 750MHz, 2.4GHz WiFi - QCA9888 5GHz WiFi - 8MiB SPI Flash - 128MiB RAM - 3 GBit Ports (QCA8337) - PLC (QCA7550) MAC address assignment ---------------------- WiFi 2.4GHz and LAN share the same MAC address as printed on the label. 5GHz WiFi uses LAN-1, based on assumptions from similar devices. LAN Port assignment ------------------- While there are 3 physical LAN ports on the device, there will be 4 visible ports in OpenWrt. The fourth port (internal port 5) is used by the PowerLine Communication SoC and thus treated like a regular LAN port. Versions -------- Note that both TL-WPA8630 and TL-WPA8630P, as well as the different country-versions, differ in partitioning, and therefore shouldn't be cross-flashed. This adds support for the two known partitioning variants of the TL-WPA8630P, where the variants can be safely distinguished via the tplink-safeloader SupportList. For the non-P variants (TL-WPA8630), at least two additional partitioning schemes exist, and the same SupportList entry can have different partitioning. Thus, we don't support those officially (yet). Also note that the P version for Germany (DE) requires the international image version, but is properly protected by SupportList. In any case, please check the OpenWrt Wiki pages for the device before flashing anything! Installation ------------ Installation is possible from the OEM web interface. Make sure to install the latest OEM firmware first, so that the PLC firmware is at the latest version. However, please also check the Wiki page for hints according to altered partitioning between OEM firmware revisions. Additional thanks to Jon Davies and Joe Mullally for bringing order into the partitioning mess. Signed-off-by: Andreas Böhler [minor DTS adjustments, add label-mac-device, drop chosen, move common partitions to DTSI, rename de to int, add AU support strings, adjust TPLINK_BOARD_ID, create common node in generic-tp-link.mk, adjust commit message] Signed-off-by: Adrian Schmutzler --- .../dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts | 29 +++ .../dts/qca9563_tplink_tl-wpa8630p-v2-int.dts | 29 +++ .../dts/qca9563_tplink_tl-wpa8630p-v2.dtsi | 165 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 4 + .../generic/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 +- target/linux/ath79/image/generic-tp-link.mk | 22 +++ tools/firmware-utils/src/tplink-safeloader.c | 72 ++++++++ 8 files changed, 330 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts create mode 100644 target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts create mode 100644 target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts new file mode 100644 index 0000000000..afcb471670 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-eu.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "qca9563_tplink_tl-wpa8630p-v2.dtsi" + +/ { + compatible = "tplink,tl-wpa8630p-v2-eu", "qca,qca9563"; + model = "TP-Link WPA8630P v2 (EU)"; +}; + +&partitions { + mac: partition@630000 { + label = "mac"; + reg = <0x630000 0x010000>; + read-only; + }; + + partition@640000 { + label = "tplink"; + reg = <0x640000 0x1b0000>; + read-only; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; +}; diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts new file mode 100644 index 0000000000..8655283f58 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2-int.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "qca9563_tplink_tl-wpa8630p-v2.dtsi" + +/ { + compatible = "tplink,tl-wpa8630p-v2-int", "qca,qca9563"; + model = "TP-Link WPA8630P v2 (Int.)"; +}; + +&partitions { + partition@630000 { + label = "tplink"; + reg = <0x630000 0x1b0000>; + read-only; + }; + + mac: partition@7e0000 { + label = "mac"; + reg = <0x7e0000 0x010000>; + read-only; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; +}; diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi new file mode 100644 index 0000000000..16c055b6d7 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_tl-wpa8630p-v2.dtsi @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include +#include + +#include "qca956x.dtsi" + +/ { + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + label-mac-device = ð0; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "tp-link:green:power"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + + wifi2g { + label = "tp-link:green:wifi2g"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + wifi5g { + label = "tp-link:green:wifi5g"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + lan { + label = "tp-link:green:lan"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + led_control { + gpio-export,name = "tp-link:led:control"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + pair { + label = "Pair button"; + linux,code = ; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + leds { + label = "LED control button"; + linux,code = ; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "WPS button"; + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&spi { + status = "okay"; + + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "factory-uboot"; + reg = <0x000000 0x020000>; + read-only; + }; + + partition@20000 { + label = "u-boot"; + reg = <0x020000 0x020000>; + read-only; + }; + + partition@40000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x040000 0x5e0000>; + }; + + partition@620000 { + label = "partition-table"; + reg = <0x620000 0x010000>; + read-only; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&uart { + status = "okay"; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; + + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; + phy-mode = "sgmii"; + mtd-mac-address = <&mac 0x8>; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&art 0x1000>; + mtd-mac-address = <&mac 0x8>; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 636ff16a17..1dff5acc38 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -296,6 +296,10 @@ tplink,tl-mr6400-v1) ucidef_set_led_netdev "wan" "WAN" "tp-link:white:wan" "eth1" ucidef_set_led_netdev "4g" "4G" "tp-link:white:4g" "usb0" ;; +tplink,tl-wpa8630p-v2-eu|\ +tplink,tl-wpa8630p-v2-int) + ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x3c" + ;; tplink,tl-wr842n-v2) ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1" ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index d99e2ed0eb..b4e1829618 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -293,6 +293,12 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:1" "2:lan:3" "3:lan:2" ;; + tplink,tl-wpa8630p-v2-eu|\ + tplink,tl-wpa8630p-v2-int) + # port 5 (internal) is the power-line port + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "5:lan:4" + ;; tplink,tl-wr842n-v2) ucidef_set_interface_wan "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 9d4306e66b..863fdc842a 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -187,7 +187,9 @@ case "$FIRMWARE" in tplink,archer-c60-v2|\ tplink,archer-c60-v3|\ tplink,archer-c6-v2|\ - tplink,archer-c6-v2-us) + tplink,archer-c6-v2-us|\ + tplink,tl-wpa8630p-v2-eu|\ + tplink,tl-wpa8630p-v2-int) caldata_extract "art" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1) ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index 967eb2a7c3..346944ab6f 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -500,6 +500,28 @@ define Device/tplink_tl-wdr4900-v2 endef TARGET_DEVICES += tplink_tl-wdr4900-v2 +define Device/tplink_tl-wpa8630p-v2 + $(Device/tplink-safeloader) + SOC := qca9563 + DEVICE_MODEL := TL-WPA8630P + IMAGE_SIZE := 6016k + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct +endef + +define Device/tplink_tl-wpa8630p-v2-eu + $(Device/tplink_tl-wpa8630p-v2) + DEVICE_VARIANT := v2 (EU) + TPLINK_BOARD_ID := TL-WPA8630P-V2-EU +endef +TARGET_DEVICES += tplink_tl-wpa8630p-v2-eu + +define Device/tplink_tl-wpa8630p-v2-int + $(Device/tplink_tl-wpa8630p-v2) + DEVICE_VARIANT := v2 (Int.) + TPLINK_BOARD_ID := TL-WPA8630P-V2-INT +endef +TARGET_DEVICES += tplink_tl-wpa8630p-v2-int + define Device/tplink_tl-wr1043nd-v1 $(Device/tplink-8m) SOC := ar9132 diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index 0af1fe4c6e..fa0e0bb62d 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -1380,6 +1380,78 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system" }, + /** Firmware layout for the TL-WPA8630P v2 (EU)*/ + { + .id = "TL-WPA8630P-V2-EU", + .vendor = "", + .support_list = + "SupportList:\n" + "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:45550000}\n", + .support_trail = '\x00', + .soft_ver = NULL, + + .partitions = { + {"factory-uboot", 0x00000, 0x20000}, + {"fs-uboot", 0x20000, 0x20000}, + {"firmware", 0x40000, 0x5e0000}, + {"partition-table", 0x620000, 0x02000}, + {"default-mac", 0x630000, 0x00020}, + {"pin", 0x630100, 0x00020}, + {"device-id", 0x630200, 0x00030}, + {"product-info", 0x631100, 0x01000}, + {"extra-para", 0x632100, 0x01000}, + {"soft-version", 0x640000, 0x01000}, + {"support-list", 0x641000, 0x01000}, + {"profile", 0x642000, 0x08000}, + {"user-config", 0x650000, 0x10000}, + {"default-config", 0x660000, 0x10000}, + {"default-nvm", 0x670000, 0xc0000}, + {"default-pib", 0x730000, 0x40000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + + /** Firmware layout for the TL-WPA8630P v2 (INT)*/ + { + .id = "TL-WPA8630P-V2-INT", + .vendor = "", + .support_list = + "SupportList:\n" + "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:41550000}\n" + "{product_name:TL-WPA8630P,product_ver:2.0.0,special_id:44450000}\n" + "{product_name:TL-WPA8630P,product_ver:2.1.0,special_id:41550000}\n", + .support_trail = '\x00', + .soft_ver = NULL, + + .partitions = { + {"factory-uboot", 0x00000, 0x20000}, + {"fs-uboot", 0x20000, 0x20000}, + {"firmware", 0x40000, 0x5e0000}, + {"partition-table", 0x620000, 0x02000}, + {"extra-para", 0x632100, 0x01000}, + {"soft-version", 0x640000, 0x01000}, + {"support-list", 0x641000, 0x01000}, + {"profile", 0x642000, 0x08000}, + {"user-config", 0x650000, 0x10000}, + {"default-config", 0x660000, 0x10000}, + {"default-nvm", 0x670000, 0xc0000}, + {"default-pib", 0x730000, 0x40000}, + {"default-mac", 0x7e0000, 0x00020}, + {"pin", 0x7e0100, 0x00020}, + {"device-id", 0x7e0200, 0x00030}, + {"product-info", 0x7e1100, 0x01000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + /** Firmware layout for the TL-WR1043 v5 */ { .id = "TLWR1043NV5",