From a26f8da848b17a1d4f201f0b765402382ecf405c Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 15 Jul 2023 16:11:26 +0200 Subject: [PATCH 62/68] ipq807x: prepare tree for old v4.4 kernel Signed-off-by: John Crispin --- config/Config-images.in | 5 +- config/Config-kernel.in | 10 + include/image.mk | 8 +- include/kernel-4.4 | 2 + include/kernel.mk | 7 +- include/netfilter-4.4.mk | 413 ++ include/netfilter.mk | 32 +- include/package.mk | 8 +- include/quilt.mk | 4 + include/target.mk | 25 +- package/kernel/linux/modules/can.mk | 3 +- package/kernel/linux/modules/crypto.mk | 3 +- package/kernel/linux/modules/fs.mk | 3 +- package/kernel/linux/modules/netfilter.mk | 11 +- package/kernel/linux/modules/netsupport.mk | 4 +- package/kernel/linux/modules/other.mk | 16 + package/kernel/linux/modules/video.mk | 16 +- target/linux/generic/config-4.4-qsdk | 4794 +++++++++++++++ target/linux/generic/config-5.4-qsdk | 6189 ++++++++++++++++++++ toolchain/gcc/common.mk | 4 +- toolchain/kernel-headers/Makefile | 13 +- 21 files changed, 11537 insertions(+), 33 deletions(-) create mode 100644 include/kernel-4.4 create mode 100644 include/netfilter-4.4.mk create mode 100644 target/linux/generic/config-4.4-qsdk create mode 100644 target/linux/generic/config-5.4-qsdk diff --git a/config/Config-images.in b/config/Config-images.in index ea7b3d37c3..8413f218a6 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -17,7 +17,10 @@ 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_ipq807x + default TARGET_INITRAMFS_COMPRESSION_GZIP if TARGET_ipq807x + default TARGET_INITRAMFS_COMPRESSION_GZIP if TARGET_ipq60xx + default TARGET_INITRAMFS_COMPRESSION_GZIP if TARGET_ipq50xx + default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq95xx default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS default TARGET_INITRAMFS_COMPRESSION_NONE depends on TARGET_ROOTFS_INITRAMFS diff --git a/config/Config-kernel.in b/config/Config-kernel.in index c1bc7984f7..7bc0fbf9a5 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -2,6 +2,15 @@ # # Copyright (C) 2006-2014 OpenWrt.org +config KERNEL_IPQ_MEM_PROFILE + int "Different memory profile " + range 0 1024 + default 512 + depends on TARGET_ipq807x || TARGET_ipq60xx || TARGET_ipq50xx || TARGET_ipq95xx + help + This option select memory profile to be used,which defines + the reserved memory configuration used in device tree. + config KERNEL_BUILD_USER string "Custom Kernel Build User Name" default "builder" if BUILDBOT diff --git a/include/image.mk b/include/image.mk index fae4d32a8b..74d2adafa7 100644 --- a/include/image.mk +++ b/include/image.mk @@ -173,6 +175,10 @@ define Image/pad-root-squashfs $(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(ROOTFS_PARTSIZE))) endef +ifeq ($(CONFIG_IPQ_MEM_PROFILE),512) +DTC_CFLAGS = -D __IPQ_MEM_PROFILE_512_MB__ +endif + # $(1) source dts file # $(2) target dtb file # $(3) extra CPP flags @@ -183,7 +189,7 @@ define Image/BuildDTB/sub -I$(DTS_DIR) \ -I$(DTS_DIR)/include \ -I$(LINUX_DIR)/include/ \ - -undef -D__DTS__ $(3) \ + -undef -D__DTS__ $(DTC_CFLAGS) $(3) \ -o $(2).tmp $(1) $(LINUX_DIR)/scripts/dtc/dtc -O dtb \ -i$(dir $(1)) $(4) \ diff --git a/include/kernel.mk b/include/kernel.mk index 3012eb8993..d3f3015322 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -44,7 +44,7 @@ else FILES_DIR ?= $(foreach dir,$(wildcard $(CURDIR)/files $(CURDIR)/files-$(KERNEL_PATCHVER)),"$(dir)") endif KERNEL_BUILD_DIR ?= $(BUILD_DIR)/linux-$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)) - LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) + LINUX_DIR ?= $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)$(KERNEL_NAME_SUFFIX) LINUX_UAPI_DIR=uapi/ LINUX_VERMAGIC:=$(strip $(shell cat $(LINUX_DIR)/.vermagic 2>/dev/null)) LINUX_VERMAGIC:=$(if $(LINUX_VERMAGIC),$(LINUX_VERMAGIC),unknown) @@ -59,7 +59,7 @@ else ifneq (,$(findstring -rc,$(LINUX_VERSION))) LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.gz else - LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.xz + LINUX_SOURCE:=linux-$(LINUX_VERSION)$(KERNEL_NAME_SUFFIX).tar.xz endif ifneq (,$(findstring -rc,$(LINUX_VERSION))) diff --git a/include/quilt.mk b/include/quilt.mk index 18cafe60a2..038c974e32 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -99,9 +99,11 @@ define Kernel/Patch/Default echo "generic patches directory is present. please move your patches to the pending directory" ; \ exit 1; \ fi +ifneq ($(CONFIG_TARGET_ipq807x)$(CONFIG_TARGET_ipq60xx)$(CONFIG_TARGET_ipq50xx)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_ipq53xx),y) $(call PatchDir,$(LINUX_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/) $(call PatchDir,$(LINUX_DIR),$(GENERIC_PATCH_DIR),generic/) $(call PatchDir,$(LINUX_DIR),$(GENERIC_HACK_DIR),generic-hack/) +endif $(call PatchDir,$(LINUX_DIR),$(PATCH_DIR),platform/) endef @@ -128,9 +130,11 @@ define Quilt/Refresh/Kernel echo "All kernel patches must start with either generic/ or platform/"; \ false; \ } +ifneq ($(CONFIG_TARGET_ipq807x)$(CONFIG_TARGET_ipq60xx)$(CONFIG_TARGET_ipq50xx)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_ipq53xx),y) $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/) $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(GENERIC_PATCH_DIR),generic/) $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(GENERIC_HACK_DIR),generic-hack/) +endif $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR),platform/) endef diff --git a/include/target.mk b/include/target.mk index 4677ef5c49..3b3081a470 100644 --- a/include/target.mk +++ b/include/target.mk @@ -62,6 +62,18 @@ DEFAULT_PACKAGES.router:=\ ppp \ ppp-mod-pppoe +DEFAULT_PACKAGES.qsdk:=\ + dnsmasq \ + firewall \ + ip6tables \ + iptables \ + kmod-ipt-offload \ + odhcp6c \ + odhcpd-ipv6only \ + ppp \ + ppp-mod-pppoe \ + -procd-ujail + ifneq ($(DUMP),) all: dumpinfo endif @@ -147,16 +159,27 @@ ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),) endif GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic +ifeq ($(CONFIG_TARGET_ipq95xx),y) +GENERIC_BACKPORT_DIR := +GENERIC_PATCH_DIR := +GENERIC_HACK_DIR := +GENERIC_FILES_DIR := +else GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(KERNEL_PATCHVER)),"$(dir)") - +endif __config_name_list = $(1)/config-$(KERNEL_PATCHVER) $(1)/config-default __config_list = $(firstword $(wildcard $(call __config_name_list,$(1)))) find_kernel_config=$(if $(__config_list),$(__config_list),$(lastword $(__config_name_list))) +ifeq ($(CONFIG_TARGET_ipq95xx),y) +GENERIC_LINUX_CONFIG:=$(GENERIC_PLATFORM_DIR)/config-5.4-qsdk +else GENERIC_LINUX_CONFIG = $(call find_kernel_config,$(GENERIC_PLATFORM_DIR)) +endif + LINUX_TARGET_CONFIG = $(call find_kernel_config,$(PLATFORM_DIR)) ifneq ($(PLATFORM_DIR),$(PLATFORM_SUBDIR)) LINUX_SUBTARGET_CONFIG = $(call find_kernel_config,$(PLATFORM_SUBDIR)) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index cd827725bd..1d6b9dfe9a 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -1144,6 +1144,22 @@ endef $(eval $(call KernelPackage,random-core)) +define KernelPackage/random-tpm + SUBMENU:=$(OTHER_MENU) + TITLE:=Hardware Random Number Generator TPM support + KCONFIG:=CONFIG_HW_RANDOM_TPM + FILES:=$(LINUX_DIR)/drivers/char/hw_random/tpm-rng.ko + DEPENDS:= +kmod-random-core +kmod-tpm @LINUX_4_14 + AUTOLOAD:=$(call AutoProbe,tpm-rng) +endef + +define KernelPackage/random-tpm/description + Kernel module for the Random Number Generator + in the Trusted Platform Module. +endef + +$(eval $(call KernelPackage,random-tpm)) + define KernelPackage/thermal SUBMENU:=$(OTHER_MENU) TITLE:=Thermal driver diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile index cd25f8a6de..fa8393db80 100644 --- a/toolchain/kernel-headers/Makefile +++ b/toolchain/kernel-headers/Makefile @@ -14,6 +14,17 @@ override HOST_QUILT:= include $(INCLUDE_DIR)/kernel.mk +# TIP +KERNEL_PATCHVER := 5.15 +KERNEL_NAME_SUFFIX:= +GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) +GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) +GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) +GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(KERNEL_PATCHVER)),"$(dir)") +$(warning GENERIC_BACKPORT_DIR = $(GENERIC_BACKPORT_DIR)) +include $(INCLUDE_DIR)/kernel-version.mk +include $(INCLUDE_DIR)/kernel.mk + PKG_NAME:=linux PKG_VERSION:=$(LINUX_VERSION) PKG_SOURCE:=$(LINUX_SOURCE) @@ -33,7 +44,7 @@ else PKG_SOURCE:=$(LINUX_SOURCE) PKG_SOURCE_URL:=$(LINUX_SITE) endif -HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) +HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)$(KERNEL_NAME_SUFFIX) PKG_HASH:=$(LINUX_KERNEL_HASH) LINUX_DIR := $(HOST_BUILD_DIR) FILES_DIR := diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index 23a07dd60d..f54a5014b8 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -93,7 +93,8 @@ define KernelPackage/vxlan +IPV6:kmod-udptunnel6 KCONFIG:=CONFIG_VXLAN FILES:= \ - $(LINUX_DIR)/drivers/net/vxlan/vxlan.ko + $(LINUX_DIR)/drivers/net/vxlan/vxlan.ko@ge5.5 \ + $(LINUX_DIR)/drivers/net/vxlan.ko@le5.4 AUTOLOAD:=$(call AutoLoad,13,vxlan) endef