mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add kernel 6.7 support for generic and x86_64 bases on mptcp_net-next tree
This commit is contained in:
parent
eb899ee09f
commit
b2a933513f
153 changed files with 32655 additions and 16 deletions
1
6.7/include/kernel-6.7
Normal file
1
6.7/include/kernel-6.7
Normal file
|
@ -0,0 +1 @@
|
||||||
|
LINUX_VERSION-6.7 =
|
195
6.7/include/kernel-defaults.mk
Normal file
195
6.7/include/kernel-defaults.mk
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
#
|
||||||
|
# Copyright (C) 2006-2020 OpenWrt.org
|
||||||
|
|
||||||
|
ifdef CONFIG_STRIP_KERNEL_EXPORTS
|
||||||
|
KERNEL_MAKEOPTS_IMAGE += \
|
||||||
|
EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h"
|
||||||
|
endif
|
||||||
|
|
||||||
|
INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
|
||||||
|
|
||||||
|
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
|
||||||
|
|
||||||
|
# defined in quilt.mk
|
||||||
|
Kernel/Patch:=$(Kernel/Patch/Default)
|
||||||
|
|
||||||
|
ifneq (,$(findstring .xz,$(LINUX_SOURCE)))
|
||||||
|
LINUX_CAT:=xzcat
|
||||||
|
else
|
||||||
|
LINUX_CAT:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
|
||||||
|
ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
|
||||||
|
define Kernel/Prepare/Default
|
||||||
|
$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
|
||||||
|
$(Kernel/Patch)
|
||||||
|
$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define Kernel/Prepare/Default
|
||||||
|
$(LINUX_CAT) $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
|
||||||
|
$(Kernel/Patch)
|
||||||
|
$(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
define Kernel/Prepare/Default
|
||||||
|
mkdir -p $(KERNEL_BUILD_DIR)
|
||||||
|
if [ -d $(LINUX_DIR) ]; then \
|
||||||
|
rmdir $(LINUX_DIR); \
|
||||||
|
fi
|
||||||
|
ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
|
||||||
|
if [ -d $(LINUX_DIR)/user_headers ]; then \
|
||||||
|
rm -rf $(LINUX_DIR)/user_headers; \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
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 $(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 $(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 $(LINUX_DIR)/.config.prev
|
||||||
|
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
|
||||||
|
$(call Kernel/SetInitramfs/PreConfigure)
|
||||||
|
echo "# CONFIG_INITRAMFS_PRESERVE_MTIME is not set" >> $(LINUX_DIR)/.config
|
||||||
|
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
|
||||||
|
|
||||||
|
define Kernel/SetNoInitramfs
|
||||||
|
mv $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.old
|
||||||
|
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
|
||||||
|
rm -f $(LINUX_DIR)/localversion
|
||||||
|
$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
|
||||||
|
# copy CONFIG_KERNEL_* settings over to .config.target
|
||||||
|
awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_DIR)/.config.target
|
||||||
|
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target
|
||||||
|
echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target
|
||||||
|
echo "CONFIG_KALLSYMS_UNCOMPRESSED=y" >> $(LINUX_DIR)/.config.target
|
||||||
|
$(SCRIPT_DIR)/package-metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config $(KERNEL_PATCHVER) > $(LINUX_DIR)/.config.override
|
||||||
|
$(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config.set
|
||||||
|
$(call Kernel/SetNoInitramfs)
|
||||||
|
rm -rf $(KERNEL_BUILD_DIR)/modules
|
||||||
|
cmp -s $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev || { \
|
||||||
|
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \
|
||||||
|
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
|
||||||
|
}
|
||||||
|
$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
|
||||||
|
grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Kernel/Configure/Initramfs
|
||||||
|
$(call Kernel/SetInitramfs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Kernel/CompileModules/Default
|
||||||
|
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
|
||||||
|
+$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
|
||||||
|
# If .config did not change, use the previous timestamp to avoid package rebuilds
|
||||||
|
cmp -s $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save && \
|
||||||
|
mv $(LINUX_DIR)/.config.modules.save $(LINUX_DIR)/.config; \
|
||||||
|
$(CP) $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save
|
||||||
|
endef
|
||||||
|
|
||||||
|
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
|
||||||
|
|
||||||
|
# AMD64 shares the location with x86
|
||||||
|
ifeq ($(LINUX_KARCH),x86_64)
|
||||||
|
IMAGES_DIR:=../../x86/boot
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Kernel/CopyImage
|
||||||
|
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)/arch/$(LINUX_KARCH)/boot/$(IMAGES_DIR)/$(k) $(KERNEL_BUILD_DIR)/$(k)$(1); \
|
||||||
|
) \
|
||||||
|
}
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Kernel/CompileImage/Default
|
||||||
|
rm -f $(TARGET_DIR)/init
|
||||||
|
+$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||||
|
$(call Kernel/CopyImage)
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
||||||
|
define Kernel/CompileImage/Initramfs
|
||||||
|
$(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 ($(call 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
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Kernel/Clean/Default
|
||||||
|
rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
|
||||||
|
rm -f $(LINUX_KERNEL)
|
||||||
|
$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
||||||
|
endef
|
303
6.7/package/firmware/linux-firmware/intel.mk
Normal file
303
6.7/package/firmware/linux-firmware/intel.mk
Normal file
|
@ -0,0 +1,303 @@
|
||||||
|
Package/ibt-firmware = $(call Package/firmware-default,Intel bluetooth firmware)
|
||||||
|
define Package/ibt-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/intel
|
||||||
|
$(CP) \
|
||||||
|
$(PKG_BUILD_DIR)/intel/*.bseq \
|
||||||
|
$(1)/lib/firmware/intel
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,ibt-firmware))
|
||||||
|
|
||||||
|
Package/iwl3945-firmware = $(call Package/firmware-default,Intel IWL3945 firmware)
|
||||||
|
define Package/iwl3945-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwl3945-firmware))
|
||||||
|
|
||||||
|
Package/iwl4965-firmware = $(call Package/firmware-default,Intel IWL4965 firmware)
|
||||||
|
define Package/iwl4965-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwl4965-firmware))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl100 = $(call Package/firmware-default,Intel Centrino Wireless-N 100 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl100/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl100))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl1000 = $(call Package/firmware-default,Intel Centrino Wireless-N 1000 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl1000/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl1000))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl105 = $(call Package/firmware-default,Intel Centrino Wireless-N 105 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl105/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl105))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl135 = $(call Package/firmware-default,Intel Centrino Wireless-N 135 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl135/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl135))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl2000 = $(call Package/firmware-default,Intel Centrino Wireless-N 2200 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl2000/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl2000))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl2030 = $(call Package/firmware-default,Intel Centrino Wireless-N 2230 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl2030/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl2030))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl3160 = $(call Package/firmware-default,Intel Wireless 3160 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl3160/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3160-17.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl3160))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl3168 = $(call Package/firmware-default,Intel Wireless 3168 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl3168/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3168-29.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl3168))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl5000 = $(call Package/firmware-default,Intel Wireless 5100AGN 5300AGN and 5350AGN firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl5000/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl5000))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl5150 = $(call Package/firmware-default,Intel Wireless Wi-Fi 5150AGN firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl5150/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl5150))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl6000g2 = $(call Package/firmware-default,Intel Centrino 6300 and 6200 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl6000g2/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl6000g2))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl6000g2a = $(call Package/firmware-default,Intel Centrino 6205 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl6000g2a/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl6000g2a))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl6000g2b = $(call Package/firmware-default,Intel Centrino 6230 1030 130 and 6235 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl6000g2b/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl6000g2b))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl6050 = $(call Package/firmware-default,Intel Centrino 6150 and 6250 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl6050/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl6050))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl7260 = $(call Package/firmware-default,Intel Wireless 7260 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl7260/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7260-17.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl7260))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl7265 = $(call Package/firmware-default,Intel Wireless 7265 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl7265/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7265-17.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl7265))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl7265d = $(call Package/firmware-default,Intel Wireless 7265D and 3165 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl7265d/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7265D-29.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl7265d))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl8260c = $(call Package/firmware-default,Intel Wireless 8260 and 4165 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl8260c/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8000C-36.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl8260c))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl8265 = $(call Package/firmware-default,Intel Wireless 8265 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl8265/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8265-36.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl8265))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl9000 = $(call Package/firmware-default,Intel Wireless 9000 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl9000/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9000-pu-b0-jf-b0-46.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl9000))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-iwl9260 = $(call Package/firmware-default,Intel Wireless 9260 firmware)
|
||||||
|
define Package/iwlwifi-firmware-iwl9260/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9260-th-b0-jf-b0-46.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-iwl9260))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-ax200 = $(call Package/firmware-default,Intel AX200 firmware)
|
||||||
|
define Package/iwlwifi-firmware-ax200/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-cc-a0-66.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-ax200))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-ax201 = $(call Package/firmware-default,Intel AX201 firmware)
|
||||||
|
define Package/iwlwifi-firmware-ax201/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-so-a0-hr-b0-72.ucode $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-ax201))
|
||||||
|
|
||||||
|
Package/iwlwifi-firmware-ax210 = $(call Package/firmware-default,Intel AX210 firmware)
|
||||||
|
define Package/iwlwifi-firmware-ax210/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0-66.ucode $(1)/lib/firmware
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0.pnvm $(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,iwlwifi-firmware-ax210))
|
||||||
|
|
||||||
|
Package/e100-firmware = $(call Package/firmware-default,Intel e100)
|
||||||
|
define Package/e100-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/e100
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/e100/d101m_ucode.bin $(1)/lib/firmware/e100/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/e100/d101s_ucode.bin $(1)/lib/firmware/e100/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/e100/d102e_ucode.bin $(1)/lib/firmware/e100/
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,e100-firmware))
|
||||||
|
|
||||||
|
Package/i915-firmware = $(call Package/firmware-default,Intel GPU firmware)
|
||||||
|
define Package/i915-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/i915
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_dmc_ver1_09.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_09.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_10.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_12.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_14.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_16.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_62.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_69.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_70.1.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_70.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adls_dmc_ver2_01.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_dmc_ver1_07.bin $(1)/lib/firmware/i915/
|
||||||
|
ln -s /lib/firmware/i915/bxt_dmc_ver1_07.bin $(1)/lib/firmware/i915/bxt_dmc_ver1.bin
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_32.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_33.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_ver8_7.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_ver9_29.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_huc_2.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_huc_ver01_07_1398.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_huc_ver01_8_2893.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_guc_33.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_huc_4.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cnl_dmc_ver1_06.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cnl_dmc_ver1_07.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_dmc_ver2_02.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_huc_7.7.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_huc_7.9.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_33.0.4.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_69.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_70.1.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_huc_9.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_dmc_ver1_04.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_32.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_33.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_70.1.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_huc_4.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_huc_ver03_01_2893.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_dmc_ver1_07.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_dmc_ver1_09.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_32.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_33.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_huc_9.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_huc_ver8_4_3238.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_dmc_ver1_01.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_dmc_ver1_04.bin $(1)/lib/firmware/i915/
|
||||||
|
ln -s /lib/firmware/i915/kbl_dmc_ver1_04.bin $(1)/lib/firmware/i915/kbl_dmc_ver1.bin
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_32.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_33.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_70.1.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_ver9_14.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_ver9_39.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_huc_4.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_huc_ver02_00_1810.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/rkl_dmc_ver2_02.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/rkl_dmc_ver2_03.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_dmc_ver1_23.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_dmc_ver1_26.bin $(1)/lib/firmware/i915/
|
||||||
|
ln -s /lib/firmware/i915/skl_dmc_ver1_26.bin $(1)/lib/firmware/i915/skl_dmc_ver1.bin
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_dmc_ver1_27.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_32.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_33.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver4.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver6_1.bin $(1)/lib/firmware/i915/
|
||||||
|
ln -s /lib/firmware/i915/skl_guc_ver6_1.bin $(1)/lib/firmware/i915/skl_guc_ver6.bin
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver9_33.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_huc_2.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_huc_ver01_07_1398.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_04.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_06.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_08.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_12.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_35.2.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_49.0.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_62.0.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_70.1.1.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.0.12.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.0.3.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.5.0.bin $(1)/lib/firmware/i915/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.9.3.bin $(1)/lib/firmware/i915/
|
||||||
|
endef
|
||||||
|
$(eval $(call BuildPackage,i915-firmware))
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- a/ath10k-6.4/debug.c 2023-12-22 20:15:58.689480802 +0100
|
||||||
|
+++ b/ath10k-6.4/debug.c 2023-12-22 20:16:29.156946389 +0100
|
||||||
|
@@ -3961,7 +3961,7 @@
|
||||||
|
|
||||||
|
buf[buf_size] = '\0';
|
||||||
|
|
||||||
|
- if (strtobool(buf, &val) != 0)
|
||||||
|
+ if (kstrtobool(buf, &val) != 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
ar->debug.use_ofdm_peak_power = val;
|
1071
6.7/package/kernel/linux/modules/crypto.mk
Normal file
1071
6.7/package/kernel/linux/modules/crypto.mk
Normal file
File diff suppressed because it is too large
Load diff
721
6.7/package/kernel/linux/modules/fs.mk
Normal file
721
6.7/package/kernel/linux/modules/fs.mk
Normal file
|
@ -0,0 +1,721 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
FS_MENU:=Filesystems
|
||||||
|
|
||||||
|
define KernelPackage/fs-9p
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Plan 9 Resource Sharing Support
|
||||||
|
DEPENDS:=+kmod-9pnet +LINUX_6_1:kmod-fs-netfs
|
||||||
|
KCONFIG:=\
|
||||||
|
CONFIG_9P_FS \
|
||||||
|
CONFIG_9P_FS_POSIX_ACL=n \
|
||||||
|
CONFIG_9P_FS_SECURITY=n \
|
||||||
|
CONFIG_9P_FSCACHE=n
|
||||||
|
FILES:=$(LINUX_DIR)/fs/9p/9p.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,9p)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-9p/description
|
||||||
|
Kernel module for Plan 9 Resource Sharing Support support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-9p))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-afs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Andrew FileSystem client
|
||||||
|
DEFAULT:=n
|
||||||
|
DEPENDS:=+kmod-rxrpc +kmod-dnsresolver +kmod-fs-fscache
|
||||||
|
KCONFIG:=\
|
||||||
|
CONFIG_AFS_FS=m \
|
||||||
|
CONFIG_AFS_DEBUG=n \
|
||||||
|
CONFIG_AFS_FSCACHE=y
|
||||||
|
FILES:=$(LINUX_DIR)/fs/afs/kafs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,kafs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-afs/description
|
||||||
|
Kernel module for Andrew FileSystem client support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-afs))
|
||||||
|
|
||||||
|
define KernelPackage/fs-autofs4
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=AUTOFS4 filesystem support
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_AUTOFS4_FS \
|
||||||
|
CONFIG_AUTOFS_FS
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/autofs/autofs4.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,autofs4)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-autofs4/description
|
||||||
|
Kernel module for AutoFS4 support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-autofs4))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-btrfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=BTRFS filesystem support
|
||||||
|
DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor +kmod-lib-zstd
|
||||||
|
KCONFIG:=\
|
||||||
|
CONFIG_BTRFS_FS \
|
||||||
|
CONFIG_BTRFS_FS_CHECK_INTEGRITY=n
|
||||||
|
FILES:=\
|
||||||
|
$(LINUX_DIR)/fs/btrfs/btrfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,btrfs,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-btrfs/description
|
||||||
|
Kernel module for BTRFS support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-btrfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-smbfs-common
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=SMBFS common dependencies support
|
||||||
|
HIDDEN:=1
|
||||||
|
KCONFIG:=\
|
||||||
|
CONFIG_SMBFS_COMMON@lt6.1 \
|
||||||
|
CONFIG_SMBFS@ge6.1
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/smbfs_common/cifs_arc4.ko@lt6.1 \
|
||||||
|
$(LINUX_DIR)/fs/smbfs_common/cifs_md4.ko@lt6.1 \
|
||||||
|
$(LINUX_DIR)/fs/smb/common/cifs_arc4.ko@ge6.1 \
|
||||||
|
$(LINUX_DIR)/fs/smb/common/cifs_md4.ko@ge6.1
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-smbfs-common/description
|
||||||
|
Kernel module dependency for CIFS or SMB_SERVER support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-smbfs-common))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-cifs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=CIFS support
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_CIFS \
|
||||||
|
CONFIG_CIFS_DFS_UPCALL=n \
|
||||||
|
CONFIG_CIFS_UPCALL=n
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/cifs/cifs.ko@lt6.1 \
|
||||||
|
$(LINUX_DIR)/fs/smb/client/cifs.ko@ge6.1
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,cifs)
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
DEPENDS+= \
|
||||||
|
+kmod-fs-smbfs-common \
|
||||||
|
+kmod-crypto-md5 \
|
||||||
|
+kmod-crypto-sha256 \
|
||||||
|
+kmod-crypto-sha512 \
|
||||||
|
+kmod-crypto-cmac \
|
||||||
|
+kmod-crypto-hmac \
|
||||||
|
+kmod-crypto-aead \
|
||||||
|
+kmod-crypto-ccm \
|
||||||
|
+kmod-crypto-ecb \
|
||||||
|
+kmod-crypto-des \
|
||||||
|
+kmod-asn1-decoder \
|
||||||
|
+kmod-oid-registry \
|
||||||
|
+kmod-dnsresolver
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-cifs/description
|
||||||
|
Kernel module for CIFS support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-cifs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-configfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Configuration filesystem support
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_CONFIGFS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/configfs/configfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,configfs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-configfs/description
|
||||||
|
Kernel module for configfs support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-configfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-cramfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Compressed RAM/ROM filesystem support
|
||||||
|
DEPENDS:=+kmod-lib-zlib-inflate
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_CRAMFS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/cramfs/cramfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,cramfs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-cramfs/description
|
||||||
|
Kernel module for cramfs support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-cramfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-efivarfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=efivar filesystem support
|
||||||
|
KCONFIG:=CONFIG_EFIVAR_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/efivarfs/efivarfs.ko
|
||||||
|
DEPENDS:=@(x86_64||x86)
|
||||||
|
AUTOLOAD:=$(call Autoload,90,efivarfs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-efivarfs/description
|
||||||
|
Kernel module to support efivarfs file system mountpoint.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-efivarfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-exfat
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=exFAT filesystem support
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_EXFAT_FS \
|
||||||
|
CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
|
||||||
|
FILES:= $(LINUX_DIR)/fs/exfat/exfat.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,exfat,1)
|
||||||
|
DEPENDS:=+kmod-nls-base
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-exfat/description
|
||||||
|
Kernel module for exFAT filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-exfat))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-exportfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=exportfs kernel server support
|
||||||
|
KCONFIG:=CONFIG_EXPORTFS
|
||||||
|
FILES=$(LINUX_DIR)/fs/exportfs/exportfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,20,exportfs,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-exportfs/description
|
||||||
|
Kernel module for exportfs. Needed for some other modules.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-exportfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-ext4
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=EXT4 filesystem support
|
||||||
|
DEPENDS := \
|
||||||
|
+kmod-lib-crc16 \
|
||||||
|
+kmod-crypto-hash \
|
||||||
|
+kmod-crypto-crc32c
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_EXT4_FS \
|
||||||
|
CONFIG_EXT4_ENCRYPTION=n \
|
||||||
|
CONFIG_JBD2
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/ext4/ext4.ko \
|
||||||
|
$(LINUX_DIR)/fs/jbd2/jbd2.ko \
|
||||||
|
$(LINUX_DIR)/fs/mbcache.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,mbcache jbd2 ext4,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-ext4/description
|
||||||
|
Kernel module for EXT4 filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-ext4))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-f2fs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=F2FS filesystem support
|
||||||
|
DEPENDS:= +kmod-crypto-hash +kmod-crypto-crc32 +kmod-nls-base
|
||||||
|
KCONFIG:=CONFIG_F2FS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/f2fs/f2fs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,f2fs,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-f2fs/description
|
||||||
|
Kernel module for F2FS filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-f2fs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-fscache
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=General filesystem local cache manager
|
||||||
|
DEPENDS:=+kmod-fs-netfs
|
||||||
|
KCONFIG:=\
|
||||||
|
CONFIG_FSCACHE \
|
||||||
|
CONFIG_FSCACHE_STATS=y \
|
||||||
|
CONFIG_FSCACHE_HISTOGRAM=n \
|
||||||
|
CONFIG_FSCACHE_DEBUG=n \
|
||||||
|
CONFIG_FSCACHE_OBJECT_LIST=n \
|
||||||
|
CONFIG_CACHEFILES \
|
||||||
|
CONFIG_CACHEFILES_DEBUG=n \
|
||||||
|
CONFIG_CACHEFILES_HISTOGRAM=n \
|
||||||
|
CONFIG_CACHEFILES_ERROR_INJECTION=n@ge5.17 \
|
||||||
|
CONFIG_CACHEFILES_ONDEMAND=n@ge5.19
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/fscache/fscache.ko \
|
||||||
|
$(LINUX_DIR)/fs/cachefiles/cachefiles.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,29,fscache cachefiles)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-fscache))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-hfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=HFS filesystem support
|
||||||
|
DEPENDS:=+kmod-cdrom
|
||||||
|
KCONFIG:=CONFIG_HFS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/hfs/hfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,hfs)
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-hfs/description
|
||||||
|
Kernel module for HFS filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-hfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-hfsplus
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=HFS+ filesystem support
|
||||||
|
DEPENDS:=+kmod-cdrom
|
||||||
|
KCONFIG:=CONFIG_HFSPLUS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/hfsplus/hfsplus.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,hfsplus)
|
||||||
|
$(call AddDepends/nls,utf8)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-hfsplus/description
|
||||||
|
Kernel module for HFS+ filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-hfsplus))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-isofs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=ISO9660 filesystem support
|
||||||
|
DEPENDS:=+kmod-lib-zlib-inflate +kmod-cdrom
|
||||||
|
KCONFIG:=CONFIG_ISO9660_FS CONFIG_JOLIET=y CONFIG_ZISOFS=n
|
||||||
|
FILES:=$(LINUX_DIR)/fs/isofs/isofs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,isofs)
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-isofs/description
|
||||||
|
Kernel module for ISO9660 filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-isofs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-jfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=JFS filesystem support
|
||||||
|
KCONFIG:=CONFIG_JFS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/jfs/jfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,jfs,1)
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-jfs/description
|
||||||
|
Kernel module for JFS support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-jfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-ksmbd
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=SMB kernel server support
|
||||||
|
DEPENDS:= \
|
||||||
|
+kmod-nls-base \
|
||||||
|
+kmod-nls-utf8 \
|
||||||
|
+kmod-crypto-md4 \
|
||||||
|
+kmod-crypto-md5 \
|
||||||
|
+kmod-crypto-hmac \
|
||||||
|
+kmod-crypto-ecb \
|
||||||
|
+kmod-crypto-des \
|
||||||
|
+kmod-crypto-sha256 \
|
||||||
|
+kmod-crypto-cmac \
|
||||||
|
+kmod-crypto-sha512 \
|
||||||
|
+kmod-crypto-aead \
|
||||||
|
+kmod-crypto-ccm \
|
||||||
|
+kmod-crypto-gcm \
|
||||||
|
+kmod-asn1-decoder \
|
||||||
|
+kmod-oid-registry \
|
||||||
|
+kmod-fs-smbfs-common
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_SMB_SERVER \
|
||||||
|
CONFIG_SMB_SERVER_SMBDIRECT=n \
|
||||||
|
CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN=n \
|
||||||
|
CONFIG_SMB_SERVER_KERBEROS5=n
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/ksmbd/ksmbd.ko@lt6.1 \
|
||||||
|
$(LINUX_DIR)/fs/smb/server/ksmbd.ko@ge6.1
|
||||||
|
AUTOLOAD:=$(call AutoLoad,41,ksmbd)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-ksmbd/description
|
||||||
|
Kernel module for SMB kernel server support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-ksmbd))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-minix
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Minix filesystem support
|
||||||
|
KCONFIG:=CONFIG_MINIX_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/minix/minix.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,minix)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-minix/description
|
||||||
|
Kernel module for Minix filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-minix))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-msdos
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=MSDOS filesystem support
|
||||||
|
DEPENDS:=+kmod-fs-vfat
|
||||||
|
KCONFIG:=CONFIG_MSDOS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/fat/msdos.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,40,msdos)
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-msdos/description
|
||||||
|
Kernel module for MSDOS filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-msdos))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-netfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Network Filesystems support
|
||||||
|
KCONFIG:= CONFIG_NETFS_SUPPORT
|
||||||
|
FILES:=$(LINUX_DIR)/fs/netfs/netfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,28,netfs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-netfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NFS filesystem client support
|
||||||
|
DEPENDS:=+kmod-fs-nfs-common +kmod-dnsresolver
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_NFS_FS \
|
||||||
|
CONFIG_NFS_USE_LEGACY_DNS=n \
|
||||||
|
CONFIG_NFS_USE_NEW_IDMAPPER=n
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/nfs/nfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,40,nfs)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs/description
|
||||||
|
Kernel module for NFS client support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-nfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-common
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Common NFS filesystem modules
|
||||||
|
DEPENDS:=+kmod-oid-registry
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_LOCKD \
|
||||||
|
CONFIG_SUNRPC \
|
||||||
|
CONFIG_GRACE_PERIOD \
|
||||||
|
CONFIG_NFS_V4=y \
|
||||||
|
CONFIG_NFS_V4_1=y \
|
||||||
|
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" \
|
||||||
|
CONFIG_NFS_V4_1_MIGRATION=n \
|
||||||
|
CONFIG_NFS_V4_2=y \
|
||||||
|
CONFIG_NFS_V4_2_READ_PLUS=n
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/lockd/lockd.ko \
|
||||||
|
$(LINUX_DIR)/net/sunrpc/sunrpc.ko \
|
||||||
|
$(LINUX_DIR)/fs/nfs_common/grace.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,grace sunrpc lockd)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-nfs-common))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-common-rpcsec
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NFS Secure RPC
|
||||||
|
DEPENDS:= \
|
||||||
|
+kmod-fs-nfs-common \
|
||||||
|
+kmod-crypto-des \
|
||||||
|
+kmod-crypto-cbc \
|
||||||
|
+kmod-crypto-cts \
|
||||||
|
+kmod-crypto-md5 \
|
||||||
|
+kmod-crypto-sha1 \
|
||||||
|
+kmod-crypto-hmac \
|
||||||
|
+kmod-crypto-ecb \
|
||||||
|
+kmod-crypto-arc4
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_SUNRPC_GSS \
|
||||||
|
CONFIG_RPCSEC_GSS_KRB5
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/net/sunrpc/auth_gss/auth_rpcgss.ko \
|
||||||
|
$(LINUX_DIR)/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,31,auth_rpcgss rpcsec_gss_krb5)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-common-rpcsec/description
|
||||||
|
Kernel modules for NFS Secure RPC
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-nfs-common-rpcsec))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-v3
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NFS3 filesystem client support
|
||||||
|
DEPENDS:=+kmod-fs-nfs
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/nfs/nfsv3.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,41,nfsv3)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-v3/description
|
||||||
|
Kernel module for NFS v3 client support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-nfs-v3))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-v4
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NFS4 filesystem client support
|
||||||
|
DEPENDS:=+kmod-fs-nfs
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_NFS_V4=y
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/nfs/nfsv4.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,41,nfsv4)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfs-v4/description
|
||||||
|
Kernel module for NFS v4 client support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-nfs-v4))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfsd
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NFS kernel server support
|
||||||
|
DEPENDS:=+kmod-fs-nfs-common +kmod-fs-exportfs +kmod-fs-nfs-common-rpcsec
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_NFSD \
|
||||||
|
CONFIG_NFSD_V4=y \
|
||||||
|
CONFIG_NFSD_V4_SECURITY_LABEL=n \
|
||||||
|
CONFIG_NFSD_BLOCKLAYOUT=n \
|
||||||
|
CONFIG_NFSD_SCSILAYOUT=n \
|
||||||
|
CONFIG_NFSD_FLEXFILELAYOUT=n \
|
||||||
|
CONFIG_NFSD_FAULT_INJECTION=n \
|
||||||
|
CONFIG_NFSD_V4_2_INTER_SSC=n
|
||||||
|
FILES:=$(LINUX_DIR)/fs/nfsd/nfsd.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,40,nfsd)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-nfsd/description
|
||||||
|
Kernel module for NFS kernel server support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-nfsd))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-ntfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NTFS filesystem read-only (old driver) support
|
||||||
|
KCONFIG:=CONFIG_NTFS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/ntfs/ntfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,ntfs)
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-ntfs/description
|
||||||
|
Kernel module for limited NTFS filesystem support. Support for writing
|
||||||
|
is extremely limited and disabled as a result.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-ntfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-ntfs3
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=NTFS filesystem read & write (new driver) support
|
||||||
|
KCONFIG:= CONFIG_NTFS3_FS CONFIG_NTFS3_FS_POSIX_ACL=y
|
||||||
|
FILES:=$(LINUX_DIR)/fs/ntfs3/ntfs3.ko
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
AUTOLOAD:=$(call AutoLoad,80,ntfs3)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-ntfs3/description
|
||||||
|
Kernel module for fully functional NTFS filesystem support. It allows
|
||||||
|
reading as well as writing.
|
||||||
|
|
||||||
|
It supports NTFS versions up to 3.1.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-ntfs3))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-reiserfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=ReiserFS filesystem support
|
||||||
|
KCONFIG:=CONFIG_REISERFS_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/reiserfs/reiserfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,reiserfs,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-reiserfs/description
|
||||||
|
Kernel module for ReiserFS support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-reiserfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-squashfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=SquashFS 4.0 filesystem support
|
||||||
|
KCONFIG:=CONFIG_SQUASHFS \
|
||||||
|
CONFIG_SQUASHFS_XZ=y
|
||||||
|
FILES:=$(LINUX_DIR)/fs/squashfs/squashfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,squashfs,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-squashfs/description
|
||||||
|
Kernel module for SquashFS 4.0 support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-squashfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-udf
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=UDF filesystem support
|
||||||
|
KCONFIG:=CONFIG_UDF_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/udf/udf.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,udf)
|
||||||
|
DEPENDS:=+kmod-lib-crc-itu-t +kmod-cdrom
|
||||||
|
$(call AddDepends/nls)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-udf/description
|
||||||
|
Kernel module for UDF filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-udf))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-vfat
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=VFAT filesystem support
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_FAT_FS \
|
||||||
|
CONFIG_VFAT_FS
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/fs/fat/fat.ko \
|
||||||
|
$(LINUX_DIR)/fs/fat/vfat.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,fat vfat,1)
|
||||||
|
$(call AddDepends/nls,cp437 iso8859-1 utf8)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-vfat/description
|
||||||
|
Kernel module for VFAT filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-vfat))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fs-xfs
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=XFS filesystem support
|
||||||
|
KCONFIG:=CONFIG_XFS_FS
|
||||||
|
DEPENDS:= +kmod-fs-exportfs +kmod-lib-crc32c
|
||||||
|
FILES:=$(LINUX_DIR)/fs/xfs/xfs.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,xfs,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fs-xfs/description
|
||||||
|
Kernel module for XFS support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fs-xfs))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/fuse
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=FUSE (Filesystem in Userspace) support
|
||||||
|
KCONFIG:= CONFIG_FUSE_FS
|
||||||
|
FILES:=$(LINUX_DIR)/fs/fuse/fuse.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,80,fuse)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/fuse/description
|
||||||
|
Kernel module for userspace filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,fuse))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/pstore
|
||||||
|
SUBMENU:=$(FS_MENU)
|
||||||
|
TITLE:=Pstore file system
|
||||||
|
DEFAULT:=m if ALL_KMODS
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_PSTORE \
|
||||||
|
CONFIG_PSTORE_COMPRESS=y \
|
||||||
|
CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" \
|
||||||
|
CONFIG_PSTORE_DEFLATE_COMPRESS=y \
|
||||||
|
CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
|
||||||
|
FILES:= $(LINUX_DIR)/fs/pstore/pstore.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,pstore,1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/pstore/description
|
||||||
|
Kernel module for pstore filesystem support
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,pstore))
|
1739
6.7/package/kernel/linux/modules/netdevices.mk
Normal file
1739
6.7/package/kernel/linux/modules/netdevices.mk
Normal file
File diff suppressed because it is too large
Load diff
1601
6.7/package/kernel/linux/modules/netsupport.mk
Normal file
1601
6.7/package/kernel/linux/modules/netsupport.mk
Normal file
File diff suppressed because it is too large
Load diff
1360
6.7/package/kernel/linux/modules/other.mk
Normal file
1360
6.7/package/kernel/linux/modules/other.mk
Normal file
File diff suppressed because it is too large
Load diff
140
6.7/package/kernel/linux/modules/virt.mk
Normal file
140
6.7/package/kernel/linux/modules/virt.mk
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
define KernelPackage/irqbypass
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=IRQ offload/bypass manager
|
||||||
|
KCONFIG:=CONFIG_IRQ_BYPASS_MANAGER
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:= $(LINUX_DIR)/virt/lib/irqbypass.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,irqbypass.ko)
|
||||||
|
endef
|
||||||
|
$(eval $(call KernelPackage,irqbypass))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/kvm-x86
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=Kernel-based Virtual Machine (KVM) support
|
||||||
|
DEPENDS:=@TARGET_x86_generic||TARGET_x86_64 +kmod-irqbypass
|
||||||
|
KCONFIG:=\
|
||||||
|
CONFIG_KVM \
|
||||||
|
CONFIG_KVM_MMU_AUDIT=n \
|
||||||
|
CONFIG_VIRTUALIZATION=y
|
||||||
|
FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,kvm.ko)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/kvm-x86/description
|
||||||
|
Support hosting fully virtualized guest machines using hardware
|
||||||
|
virtualization extensions. You will need a fairly recent
|
||||||
|
processor equipped with virtualization extensions. You will also
|
||||||
|
need to select one or more of the processor modules.
|
||||||
|
|
||||||
|
This module provides access to the hardware capabilities through
|
||||||
|
a character device node named /dev/kvm.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,kvm-x86))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/kvm-intel
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=KVM for Intel processors support
|
||||||
|
DEPENDS:=+kmod-kvm-x86
|
||||||
|
KCONFIG:=CONFIG_KVM_INTEL
|
||||||
|
FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-intel.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,kvm-intel.ko)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/kvm-intel/description
|
||||||
|
Provides support for KVM on Intel processors equipped with the VT
|
||||||
|
extensions.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,kvm-intel))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/kvm-amd
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=KVM for AMD processors support
|
||||||
|
DEPENDS:=+kmod-kvm-x86
|
||||||
|
KCONFIG:=CONFIG_KVM_AMD
|
||||||
|
FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-amd.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,kvm-amd.ko)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/kvm-amd/description
|
||||||
|
Provides support for KVM on AMD processors equipped with the AMD-V
|
||||||
|
(SVM) extensions.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,kvm-amd))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/vfio
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=VFIO Non-Privileged userspace driver framework
|
||||||
|
DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_VFIO \
|
||||||
|
CONFIG_VFIO_NOIOMMU=n \
|
||||||
|
CONFIG_VFIO_MDEV=n
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/drivers/vfio/vfio.ko \
|
||||||
|
$(LINUX_DIR)/drivers/vfio/vfio_iommu_type1.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,vfio vfio_iommu_type1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/vfio/description
|
||||||
|
VFIO provides a framework for secure userspace device drivers.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,vfio))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/vfio-pci
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=Generic VFIO support for any PCI device
|
||||||
|
DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 @PCI_SUPPORT +kmod-vfio +kmod-irqbypass
|
||||||
|
KCONFIG:= \
|
||||||
|
CONFIG_VFIO_PCI \
|
||||||
|
CONFIG_VFIO_PCI_IGD=n
|
||||||
|
FILES:= \
|
||||||
|
$(LINUX_DIR)/drivers/vfio/pci/vfio-pci-core.ko \
|
||||||
|
$(LINUX_DIR)/drivers/vfio/pci/vfio-pci.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,vfio-pci)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/vfio-pci/description
|
||||||
|
Support for the generic PCI VFIO bus driver which can connect any PCI
|
||||||
|
device to the VFIO framework.
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,vfio-pci))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/vhost
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=Host kernel accelerator for virtio (base)
|
||||||
|
KCONFIG:=CONFIG_VHOST
|
||||||
|
FILES:=$(LINUX_DIR)/drivers/vhost/vhost.ko \
|
||||||
|
$(LINUX_DIR)/drivers/vhost/vhost_iotlb.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,vhost vhost_iotlb)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,vhost))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/vhost-net
|
||||||
|
SUBMENU:=Virtualization
|
||||||
|
TITLE:=Host kernel accelerator for virtio-net
|
||||||
|
DEPENDS:=+kmod-tun +kmod-vhost
|
||||||
|
KCONFIG:=CONFIG_VHOST_NET
|
||||||
|
FILES:=$(LINUX_DIR)/drivers/vhost/vhost_net.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,vhost_net)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,vhost-net))
|
|
@ -0,0 +1,14 @@
|
||||||
|
--- a/drivers/net/wireless/ath/ath10k/pci.c 2023-12-22 19:22:13.061853464 +0100
|
||||||
|
+++ b/drivers/net/wireless/ath/ath10k/pci.c 2023-12-22 19:23:22.184610463 +0100
|
||||||
|
@@ -3163,7 +3163,11 @@
|
||||||
|
* immediate servicing.
|
||||||
|
*/
|
||||||
|
if (ath10k_ce_interrupt_summary(ar)) {
|
||||||
|
+#if LINUX_VERSION_IS_LESS(6,7,0)
|
||||||
|
napi_reschedule(ctx);
|
||||||
|
+#else
|
||||||
|
+ napi_schedule(ctx);
|
||||||
|
+#endif
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
ath10k_pci_enable_legacy_irq(ar);
|
31
6.7/package/kernel/mac80211/patches/build/900-userhdr.patch
Normal file
31
6.7/package/kernel/mac80211/patches/build/900-userhdr.patch
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
--- a/backport-include/net/genetlink.h 2023-10-19 17:24:48.721119999 +0200
|
||||||
|
+++ b/backport-include/net/genetlink.h 2023-10-19 17:35:11.810569190 +0200
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
#include_next <net/genetlink.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
|
+#if LINUX_VERSION_IS_LESS(6,5,0)
|
||||||
|
static inline void __bp_genl_info_userhdr_set(struct genl_info *info,
|
||||||
|
void *userhdr)
|
||||||
|
{
|
||||||
|
@@ -13,6 +14,7 @@
|
||||||
|
{
|
||||||
|
return info->userhdr;
|
||||||
|
}
|
||||||
|
+#endif /* < 6.5.0 */
|
||||||
|
|
||||||
|
#if LINUX_VERSION_IS_LESS(4,12,0)
|
||||||
|
#define GENL_SET_ERR_MSG(info, msg) NL_SET_ERR_MSG(genl_info_extack(info), msg)
|
||||||
|
@@ -47,10 +47,12 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this gets put in place of info->userhdr, since we use that above */
|
||||||
|
+#if LINUX_VERSION_IS_LESS(6,5,0)
|
||||||
|
static inline void *genl_info_userhdr(struct genl_info *info)
|
||||||
|
{
|
||||||
|
return (u8 *)info->genlhdr + GENL_HDRLEN;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#if LINUX_VERSION_IS_LESS(4,10,0)
|
||||||
|
#define __genl_ro_after_init
|
587
6.7/package/kernel/mt76/Makefile
Normal file
587
6.7/package/kernel/mt76/Makefile
Normal file
|
@ -0,0 +1,587 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=mt76
|
||||||
|
PKG_RELEASE=5
|
||||||
|
|
||||||
|
PKG_LICENSE:=GPLv2
|
||||||
|
PKG_LICENSE_FILES:=
|
||||||
|
|
||||||
|
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_DATE:=2023-05-13
|
||||||
|
PKG_SOURCE_VERSION:=969b7b5ebd129068ca56e4b0d831593a2f92382f
|
||||||
|
PKG_MIRROR_HASH:=d28869591d1cb9a967b72f5cd8215c7b2c3388b7b31147b7b18c797018ab8ffb
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||||
|
PKG_USE_NINJA:=0
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
|
||||||
|
PKG_CONFIG_DEPENDS += \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76-usb \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76x02-common \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76x0-common \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76x0u \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76x2-common \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76x2 \
|
||||||
|
CONFIG_PACKAGE_kmod-mt76x2u \
|
||||||
|
CONFIG_PACKAGE_kmod-mt7603 \
|
||||||
|
CONFIG_PACKAGE_CFG80211_TESTMODE
|
||||||
|
|
||||||
|
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(INCLUDE_DIR)/cmake.mk
|
||||||
|
|
||||||
|
CMAKE_SOURCE_DIR:=$(PKG_BUILD_DIR)/tools
|
||||||
|
CMAKE_BINARY_DIR:=$(PKG_BUILD_DIR)/tools
|
||||||
|
|
||||||
|
define KernelPackage/mt76-default
|
||||||
|
SUBMENU:=Wireless Drivers
|
||||||
|
DEPENDS:= \
|
||||||
|
+kmod-mac80211 \
|
||||||
|
+@DRIVER_11AC_SUPPORT \
|
||||||
|
+@KERNEL_PAGE_POOL
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76
|
||||||
|
SUBMENU:=Wireless Drivers
|
||||||
|
TITLE:=MediaTek MT76x2/MT7603 wireless driver (metapackage)
|
||||||
|
DEPENDS:= \
|
||||||
|
+kmod-mt76-core +kmod-mt76x2 +kmod-mt7603
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76-core
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76xx wireless driver
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt76.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76-usb
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76xx wireless driver USB support
|
||||||
|
DEPENDS += +kmod-usb-core +kmod-mt76-core
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt76-usb.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x02-usb
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x0/MT76x2 USB wireless driver common code
|
||||||
|
DEPENDS+=+kmod-mt76-usb +kmod-mt76x02-common
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/mt76x02-usb.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x02-common
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x0/MT76x2 wireless driver common code
|
||||||
|
DEPENDS+=+kmod-mt76-core
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/mt76x02-lib.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x0-common
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x0 wireless driver common code
|
||||||
|
DEPENDS+=+kmod-mt76x02-common
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/mt76x0/mt76x0-common.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x0e
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x0E wireless driver
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt76x0-common
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt76x0/mt76x0e.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt76x0e)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x0u
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x0U wireless driver
|
||||||
|
DEPENDS+=+kmod-mt76x0-common +kmod-mt76x02-usb
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt76x0/mt76x0u.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt76x0u)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x2-common
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x2 wireless driver common code
|
||||||
|
DEPENDS+=+kmod-mt76-core +kmod-mt76x02-common
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/mt76x2/mt76x2-common.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x2u
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x2U wireless driver
|
||||||
|
DEPENDS+=+kmod-mt76x2-common +kmod-mt76x02-usb
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt76x2/mt76x2u.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt76x2u)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x2
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT76x2 wireless driver
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt76x2-common
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt76x2/mt76x2e.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt76x2e)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7603
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7603 wireless driver
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt76-core
|
||||||
|
FILES:=\
|
||||||
|
$(PKG_BUILD_DIR)/mt7603/mt7603e.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7603e)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76-connac
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7615/MT79xx wireless driver common code
|
||||||
|
HIDDEN:=1
|
||||||
|
DEPENDS+=+kmod-mt76-core
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt76-connac-lib.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76-sdio
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7615/MT79xx SDIO driver common code
|
||||||
|
HIDDEN:=1
|
||||||
|
DEPENDS+=+kmod-mt76-core +kmod-mmc
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt76-sdio.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7615-common
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7615 wireless driver common code
|
||||||
|
HIDDEN:=1
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt76-core +kmod-mt76-connac +kmod-hwmon-core
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615-common.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7615-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7615e firmware
|
||||||
|
DEPENDS+=+kmod-mt7615e
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7615e
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7615e wireless driver
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7615/mt7615e.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7615e)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7622-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7622 firmware
|
||||||
|
DEPENDS+=+kmod-mt7615e
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663-firmware-ap
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7663e firmware (optimized for AP)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663-firmware-sta
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7663e firmware (client mode offload)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663-usb-sdio
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7663 USB/SDIO shared code
|
||||||
|
DEPENDS+=+kmod-mt7615-common
|
||||||
|
HIDDEN:=1
|
||||||
|
FILES:= \
|
||||||
|
$(PKG_BUILD_DIR)/mt7615/mt7663-usb-sdio-common.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663s
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7663s wireless driver
|
||||||
|
DEPENDS+=+kmod-mt76-sdio +kmod-mt7615-common +kmod-mt7663-usb-sdio
|
||||||
|
FILES:= \
|
||||||
|
$(PKG_BUILD_DIR)/mt7615/mt7663s.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7663s)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663u
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7663u wireless driver
|
||||||
|
DEPENDS+=+kmod-mt76-usb +kmod-mt7615-common +kmod-mt7663-usb-sdio
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7615/mt7663u.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7663u)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7915-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7915 firmware
|
||||||
|
DEPENDS+=+kmod-mt7915e
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7915e
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7915e wireless driver
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7915/mt7915e.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7915e)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7916-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
DEPENDS+=+kmod-mt7915e
|
||||||
|
TITLE:=MediaTek MT7916 firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7981-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
DEPENDS:=@TARGET_mediatek_filogic
|
||||||
|
TITLE:=MediaTek MT7981 firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7986-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
DEPENDS:=@TARGET_mediatek_filogic
|
||||||
|
TITLE:=MediaTek MT7986 firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7921-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7921 firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7922-firmware
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
DEPENDS+=+kmod-mt7921-common
|
||||||
|
TITLE:=MediaTek MT7922 firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7921-common
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7615 wireless driver common code
|
||||||
|
HIDDEN:=1
|
||||||
|
DEPENDS+=+kmod-mt76-connac +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7921u
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7921U wireless driver
|
||||||
|
DEPENDS+=+kmod-mt76-usb +kmod-mt7921-common
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921u.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7921u)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7921s
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7921S wireless driver
|
||||||
|
DEPENDS+=+kmod-mt76-sdio +kmod-mt7921-common
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921s.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7921s)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7921e
|
||||||
|
$(KernelPackage/mt76-default)
|
||||||
|
TITLE:=MediaTek MT7921e wireless driver
|
||||||
|
DEPENDS+=@PCI_SUPPORT +kmod-mt7921-common
|
||||||
|
FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921e.ko
|
||||||
|
AUTOLOAD:=$(call AutoProbe,mt7921e)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/mt76-test
|
||||||
|
SECTION:=devel
|
||||||
|
CATEGORY:=Development
|
||||||
|
TITLE:=mt76 testmode CLI
|
||||||
|
DEPENDS:=kmod-mt76-core +libnl-tiny
|
||||||
|
endef
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
|
||||||
|
|
||||||
|
NOSTDINC_FLAGS := \
|
||||||
|
$(KERNEL_NOSTDINC_FLAGS) \
|
||||||
|
-I$(PKG_BUILD_DIR) \
|
||||||
|
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||||
|
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||||
|
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||||
|
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||||
|
-include backport/autoconf.h \
|
||||||
|
-include backport/backport.h
|
||||||
|
|
||||||
|
ifdef CONFIG_PACKAGE_MAC80211_MESH
|
||||||
|
NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_PACKAGE_CFG80211_TESTMODE
|
||||||
|
NOSTDINC_FLAGS += -DCONFIG_NL80211_TESTMODE
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_NL80211_TESTMODE=y
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76-usb
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76_USB=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x02-common
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x02_LIB=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x02_USB=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x0-common
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x0_COMMON=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x0e
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x0E=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x0u
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x0U=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x2-common
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x2_COMMON=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x2
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x2E=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76x2u
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76x2U=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7603
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7603E=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76-connac
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76_CONNAC_LIB=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt76-sdio
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT76_SDIO=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7615-common
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7615_COMMON=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7615e
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7615E=m
|
||||||
|
ifdef CONFIG_TARGET_mediatek_mt7622
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7622_WMAC=y
|
||||||
|
NOSTDINC_FLAGS += -DCONFIG_MT7622_WMAC
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7663-usb-sdio
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7663_USB_SDIO_COMMON=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7663s
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7663S=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7663u
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7663U=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7915e
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7915E=m
|
||||||
|
ifdef CONFIG_TARGET_mediatek_filogic
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT798X_WMAC=y
|
||||||
|
NOSTDINC_FLAGS += -DCONFIG_MT798X_WMAC
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7921-common
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7921_COMMON=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7921u
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7921U=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7921s
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7921S=m
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_PACKAGE_kmod-mt7921e
|
||||||
|
PKG_MAKE_FLAGS += CONFIG_MT7921E=m
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||||
|
$(PKG_MAKE_FLAGS) \
|
||||||
|
M="$(PKG_BUILD_DIR)" \
|
||||||
|
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||||
|
modules
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR)/tools
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Install
|
||||||
|
:
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/kmod-mt76/install
|
||||||
|
true
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x0-common/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7610e.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x2-common/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7662.bin \
|
||||||
|
$(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x0u/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
ln -sf mt7610e.bin $(1)/lib/firmware/mediatek/mt7610u.bin
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt76x2u/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
ln -sf ../mt7662.bin $(1)/lib/firmware/mediatek/mt7662u.bin
|
||||||
|
ln -sf ../mt7662_rom_patch.bin $(1)/lib/firmware/mediatek/mt7662u_rom_patch.bin
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7603/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware
|
||||||
|
cp $(if $(CONFIG_TARGET_ramips_mt76x8), \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
|
||||||
|
,\
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
|
||||||
|
) \
|
||||||
|
$(1)/lib/firmware
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7615-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7622-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663-firmware-ap/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7663_n9_rebb.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7663pr2h_rebb.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7663-firmware-sta/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7663_n9_v3.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7663pr2h.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7915-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7915_wm.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7915_rom_patch.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7916-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7916_wa.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7916_wm.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7916_rom_patch.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7981-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7981_wa.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7981_wm.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7981_rom_patch.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7986-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7986_wa.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7986_wm_mt7975.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7986_wm.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7986_rom_patch_mt7975.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/mt7986_rom_patch.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7921-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7961_1.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/mt7922-firmware/install
|
||||||
|
$(INSTALL_DIR) $(1)/lib/firmware/mediatek
|
||||||
|
cp \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \
|
||||||
|
$(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \
|
||||||
|
$(1)/lib/firmware/mediatek
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/mt76-test/install
|
||||||
|
mkdir -p $(1)/usr/sbin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mt76-test $(1)/usr/sbin
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,mt76-core))
|
||||||
|
$(eval $(call KernelPackage,mt76-usb))
|
||||||
|
$(eval $(call KernelPackage,mt76x02-usb))
|
||||||
|
$(eval $(call KernelPackage,mt76x02-common))
|
||||||
|
$(eval $(call KernelPackage,mt76x0-common))
|
||||||
|
$(eval $(call KernelPackage,mt76x0e))
|
||||||
|
$(eval $(call KernelPackage,mt76x0u))
|
||||||
|
$(eval $(call KernelPackage,mt76x2-common))
|
||||||
|
$(eval $(call KernelPackage,mt76x2u))
|
||||||
|
$(eval $(call KernelPackage,mt76x2))
|
||||||
|
$(eval $(call KernelPackage,mt7603))
|
||||||
|
$(eval $(call KernelPackage,mt76-connac))
|
||||||
|
$(eval $(call KernelPackage,mt76-sdio))
|
||||||
|
$(eval $(call KernelPackage,mt7615-common))
|
||||||
|
$(eval $(call KernelPackage,mt7615-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7622-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7615e))
|
||||||
|
$(eval $(call KernelPackage,mt7663-firmware-ap))
|
||||||
|
$(eval $(call KernelPackage,mt7663-firmware-sta))
|
||||||
|
$(eval $(call KernelPackage,mt7663-usb-sdio))
|
||||||
|
$(eval $(call KernelPackage,mt7663u))
|
||||||
|
$(eval $(call KernelPackage,mt7663s))
|
||||||
|
$(eval $(call KernelPackage,mt7915-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7915e))
|
||||||
|
$(eval $(call KernelPackage,mt7916-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7981-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7986-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7921-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7922-firmware))
|
||||||
|
$(eval $(call KernelPackage,mt7921-common))
|
||||||
|
$(eval $(call KernelPackage,mt7921u))
|
||||||
|
$(eval $(call KernelPackage,mt7921s))
|
||||||
|
$(eval $(call KernelPackage,mt7921e))
|
||||||
|
$(eval $(call KernelPackage,mt76))
|
||||||
|
$(eval $(call BuildPackage,mt76-test))
|
59
6.7/package/kernel/mt76/patches/001-allow-vht-on-2g.patch
Normal file
59
6.7/package/kernel/mt76/patches/001-allow-vht-on-2g.patch
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
From ed0b9c38becdbf9379787ca0b4db557f03a31dd7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
|
||||||
|
Date: Mon, 23 Nov 2020 10:46:37 +0800
|
||||||
|
Subject: [PATCH] mt76: allow VHT rate on 2.4GHz
|
||||||
|
|
||||||
|
Allow chips that support 11ac to use 256QAM on 2.4GHz
|
||||||
|
|
||||||
|
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
|
||||||
|
---
|
||||||
|
mac80211.c | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mac80211.c b/mac80211.c
|
||||||
|
index 766681a4..06aa4228 100644
|
||||||
|
--- a/mac80211.c
|
||||||
|
+++ b/mac80211.c
|
||||||
|
@@ -282,7 +282,7 @@ static void mt76_init_stream_cap(struct mt76_phy *phy,
|
||||||
|
void mt76_set_stream_caps(struct mt76_phy *phy, bool vht)
|
||||||
|
{
|
||||||
|
if (phy->cap.has_2ghz)
|
||||||
|
- mt76_init_stream_cap(phy, &phy->sband_2g.sband, false);
|
||||||
|
+ mt76_init_stream_cap(phy, &phy->sband_2g.sband, vht);
|
||||||
|
if (phy->cap.has_5ghz)
|
||||||
|
mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht);
|
||||||
|
if (phy->cap.has_6ghz)
|
||||||
|
@@ -349,13 +349,13 @@ mt76_init_sband(struct mt76_phy *phy, struct mt76_sband *msband,
|
||||||
|
|
||||||
|
static int
|
||||||
|
mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates,
|
||||||
|
- int n_rates)
|
||||||
|
+ int n_rates, bool vht)
|
||||||
|
{
|
||||||
|
phy->hw->wiphy->bands[NL80211_BAND_2GHZ] = &phy->sband_2g.sband;
|
||||||
|
|
||||||
|
return mt76_init_sband(phy, &phy->sband_2g, mt76_channels_2ghz,
|
||||||
|
ARRAY_SIZE(mt76_channels_2ghz), rates,
|
||||||
|
- n_rates, true, false);
|
||||||
|
+ n_rates, true, vht);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
@@ -508,7 +508,7 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht,
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (phy->cap.has_2ghz) {
|
||||||
|
- ret = mt76_init_sband_2g(phy, rates, n_rates);
|
||||||
|
+ ret = mt76_init_sband_2g(phy, rates, n_rates, vht);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@@ -691,7 +691,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (phy->cap.has_2ghz) {
|
||||||
|
- ret = mt76_init_sband_2g(phy, rates, n_rates);
|
||||||
|
+ ret = mt76_init_sband_2g(phy, rates, n_rates, vht);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
33
6.7/package/kernel/r2ec/Makefile
Normal file
33
6.7/package/kernel/r2ec/Makefile
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2008-2012 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
|
PKG_NAME:=r2ec
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define KernelPackage/r2ec
|
||||||
|
SUBMENU:=Other modules
|
||||||
|
TITLE:=STM32 R2EC (Router to Embedded board Communication) Driver
|
||||||
|
FILES:=$(PKG_BUILD_DIR)/r2ec.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,30,r2ec,1)
|
||||||
|
# DEPENDS:=@TARGET_ipq40xx @LINUX_5_4
|
||||||
|
DEPENDS:=@TARGET_ipq40xx
|
||||||
|
KCONFIG:=
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKE_OPTS:= $(KERNEL_MAKE_FLAGS) M="$(PKG_BUILD_DIR)"
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
$(MAKE) -C "$(LINUX_DIR)" $(MAKE_OPTS) modules
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,r2ec))
|
1
6.7/package/kernel/r2ec/src/Makefile
Normal file
1
6.7/package/kernel/r2ec/src/Makefile
Normal file
|
@ -0,0 +1 @@
|
||||||
|
obj-m += r2ec.o
|
60
6.7/package/kernel/r2ec/src/io.h
Normal file
60
6.7/package/kernel/r2ec/src/io.h
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#ifndef R2EC_IO_H
|
||||||
|
#define R2EC_IO_H
|
||||||
|
|
||||||
|
#define NO_OF_GPIOS 37
|
||||||
|
|
||||||
|
enum proto_version {
|
||||||
|
PROTO_VERSION_1 = 0x01,
|
||||||
|
PROTO_VERSION_2 = 0x02
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cmd_type_id {
|
||||||
|
CMD_GPIO = 0x06,
|
||||||
|
CMD_PROTO = 0xFC,
|
||||||
|
CMD_FW = 0xFD,
|
||||||
|
CMD_BOOT = 0xFE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum proto_id {
|
||||||
|
PROTO_GET_SUPPORTED = 0x03
|
||||||
|
};
|
||||||
|
|
||||||
|
enum boot_id {
|
||||||
|
BOOT_START_APP = 0x03,
|
||||||
|
BOOT_STATE = 0xFD,
|
||||||
|
BOOT_VERSION = 0xFE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum state_id {
|
||||||
|
NO_IMAGE_FOUND = 0x17,
|
||||||
|
BOOT_STARTED = 0x18,
|
||||||
|
WATCHDOG_RESET = 0x1B,
|
||||||
|
APPLICATION_START_FAIL = 0x99,
|
||||||
|
HARD_FAULT_ERROR = 0x9A,
|
||||||
|
APP_STARTED = 0xFC,
|
||||||
|
NO_DATA_AVAILABLE = 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ack_id {
|
||||||
|
STATUS_ACK = 0x7D,
|
||||||
|
STATUS_NACK = 0x7E
|
||||||
|
};
|
||||||
|
|
||||||
|
enum gpio_state {
|
||||||
|
GPIO_STATE_HIGH = 0x1E,
|
||||||
|
GPIO_STATE_LOW = 0x9F
|
||||||
|
};
|
||||||
|
|
||||||
|
enum gpio_mode {
|
||||||
|
GPIO_VALUE_SET_LOW = 0x00,
|
||||||
|
GPIO_VALUE_SET_HIGH = 0x01,
|
||||||
|
GPIO_VALUE_GET = 0x02,
|
||||||
|
GPIO_MODE_SET_OUTPUT = 0x04,
|
||||||
|
GPIO_MODE_SET_INPUT = 0x05
|
||||||
|
};
|
||||||
|
|
||||||
|
enum fw_id {
|
||||||
|
FW_VERSION = 0x01
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // R2EC_IO_H
|
752
6.7/package/kernel/r2ec/src/r2ec.c
Normal file
752
6.7/package/kernel/r2ec/src/r2ec.c
Normal file
|
@ -0,0 +1,752 @@
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/gpio/driver.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
|
||||||
|
#include "io.h"
|
||||||
|
|
||||||
|
static const struct i2c_device_id r2ec_id[] = {
|
||||||
|
{ "stm32v1", NO_OF_GPIOS },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(i2c, r2ec_id);
|
||||||
|
|
||||||
|
static const struct of_device_id r2ec_of_table[] = {
|
||||||
|
{ .compatible = "tlt,stm32v1" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, r2ec_of_table);
|
||||||
|
|
||||||
|
static uint8_t g_proto;
|
||||||
|
|
||||||
|
struct r2ec {
|
||||||
|
struct gpio_chip chip;
|
||||||
|
struct irq_chip irqchip;
|
||||||
|
struct i2c_client *client;
|
||||||
|
struct mutex i2c_lock;
|
||||||
|
struct mutex irq_lock;
|
||||||
|
int ic_ready;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct r2ec_platform_data {
|
||||||
|
unsigned gpio_base;
|
||||||
|
|
||||||
|
int (*setup)(struct i2c_client *client, int gpio, unsigned ngpio,
|
||||||
|
void *context);
|
||||||
|
|
||||||
|
int (*teardown)(struct i2c_client *client, int gpio, unsigned ngpio,
|
||||||
|
void *context);
|
||||||
|
|
||||||
|
void *context;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct i2c_request {
|
||||||
|
uint8_t version;
|
||||||
|
uint16_t length;
|
||||||
|
uint8_t command;
|
||||||
|
uint8_t data[1];
|
||||||
|
// uint8_t checksum; // invisible
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
struct i2c_response {
|
||||||
|
uint8_t version;
|
||||||
|
uint8_t length;
|
||||||
|
uint8_t command;
|
||||||
|
uint8_t data[7];
|
||||||
|
uint8_t checksum;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
static uint8_t calc_crc8(const uint8_t *data, size_t len)
|
||||||
|
{
|
||||||
|
uint8_t crc = 0xFF;
|
||||||
|
int i = 0;
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
for (j = 0; j < len; j++) {
|
||||||
|
crc ^= data[j];
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++) {
|
||||||
|
crc = (crc & 0x80) ? (crc ^ 0xD5) << 1 : crc << 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate outcoming mesage checksum and write i2c data
|
||||||
|
static int stm32_write(struct i2c_client *client, uint8_t ver, uint8_t cmd, uint8_t *data, size_t len)
|
||||||
|
{
|
||||||
|
struct i2c_request *req = NULL;
|
||||||
|
const int tmp_len = sizeof(struct i2c_request) + 1;
|
||||||
|
uint8_t tmp[sizeof(struct i2c_request) + 1];
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if (!client) {
|
||||||
|
printk(KERN_ERR "R2EC I2C client is not ready!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
req = (struct i2c_request *)tmp;
|
||||||
|
req->version = ver;
|
||||||
|
req->length = 2 + len; // 2 + data_len
|
||||||
|
req->command = cmd;
|
||||||
|
|
||||||
|
memcpy(req->data, data, len);
|
||||||
|
|
||||||
|
req->data[len] = calc_crc8(tmp, tmp_len - 1);
|
||||||
|
|
||||||
|
if ((err = i2c_master_send(client, tmp, tmp_len)) < 0) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// attempt to read i2c data
|
||||||
|
static int stm32_read(struct i2c_client *client, uint8_t *data, size_t len)
|
||||||
|
{
|
||||||
|
char buffer[64] = { 0 };
|
||||||
|
uint8_t checksum;
|
||||||
|
int err;
|
||||||
|
unsigned i, cnt = 0;
|
||||||
|
|
||||||
|
if (!client) {
|
||||||
|
printk(KERN_ERR "R2EC I2C client is not ready!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
retry:
|
||||||
|
if ((err = i2c_master_recv(client, data, len)) < 0) {
|
||||||
|
if (err == -ETIMEDOUT && cnt < 10) {
|
||||||
|
cnt++;
|
||||||
|
msleep(10);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore checksum on partial i2c response
|
||||||
|
if (len == sizeof(struct i2c_response) - 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0xFF - no data available
|
||||||
|
if (*(data + 3) == 0xFF) {
|
||||||
|
return -ENODATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate checksum and verify
|
||||||
|
checksum = calc_crc8(data, len - 1);
|
||||||
|
|
||||||
|
if (checksum != *(data + len - 1)) {
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
snprintf(buffer + strlen(buffer), sizeof(buffer),
|
||||||
|
"%02X ", *(data + i));
|
||||||
|
}
|
||||||
|
|
||||||
|
dev_err(&client->dev, "Checksum of incoming message "
|
||||||
|
"does not match!\n"
|
||||||
|
"Received: %s\n", buffer);
|
||||||
|
|
||||||
|
// for some reason checksum might appear as 1st byte in the
|
||||||
|
// data buffer, and actual checksum byte is zero
|
||||||
|
// apply quirk - discard first byte, skip checksum checking
|
||||||
|
if (!*(data + len - 1)) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"Applying wrong-checksum quirk...\n");
|
||||||
|
memmove(data, data + 1, len - 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EBADE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// attempt to retrieve supported protocol version, then retrieve device state
|
||||||
|
// and boot into application state
|
||||||
|
// this is done without interrupt, so there should be delay after writing
|
||||||
|
// request and before reading response for protocol versions up until v2
|
||||||
|
static int stm32_prepare(struct r2ec *gpio, struct i2c_client *client)
|
||||||
|
{
|
||||||
|
struct i2c_response rsp;
|
||||||
|
uint8_t data[1], recv[1];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
memset(&rsp, 0, sizeof(rsp));
|
||||||
|
|
||||||
|
data[0] = PROTO_GET_SUPPORTED;
|
||||||
|
|
||||||
|
if ((ret = stm32_write(client, 1, CMD_PROTO, data, 1))) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"stm32_prepare: proto version write failed (%d)\n",
|
||||||
|
ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// due compatibility reasons delay is needed between write/read
|
||||||
|
// operations
|
||||||
|
msleep(10);
|
||||||
|
|
||||||
|
if ((ret = stm32_read(client, (uint8_t *)&rsp, sizeof(rsp)))) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"stm32_prepare: proto version read failed (%d)\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_proto = rsp.data[1];
|
||||||
|
|
||||||
|
// fallback to version 1
|
||||||
|
if (g_proto != PROTO_VERSION_1 && g_proto != PROTO_VERSION_2) {
|
||||||
|
printk("STM32 fallback protocol: %u\n", g_proto);
|
||||||
|
g_proto = PROTO_VERSION_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printk("STM32 supported protocol: %u\n", g_proto);
|
||||||
|
|
||||||
|
data[0] = BOOT_STATE;
|
||||||
|
|
||||||
|
if ((ret = stm32_write(client, g_proto, CMD_BOOT, data, 1))) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"stm32_prepare: boot state write failed (%d)\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ret = stm32_read(client, recv, 1))) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"stm32_prepare: boot state read failed (%d)\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// device might be not ready aka in bootloader state
|
||||||
|
// we might need to ignore gpio_write status value
|
||||||
|
gpio->ic_ready = 0;
|
||||||
|
|
||||||
|
// handle the following possible states reported either from
|
||||||
|
// bootloader or system:
|
||||||
|
switch (recv[0]) {
|
||||||
|
case NO_IMAGE_FOUND:
|
||||||
|
case APP_STARTED:
|
||||||
|
// device is ready, no need to ignore gpio_write status value
|
||||||
|
// note: on no_image_found, user-space flasher will reflash
|
||||||
|
// firmware and device will be rebooted
|
||||||
|
gpio->ic_ready = 1;
|
||||||
|
return 0;
|
||||||
|
case BOOT_STARTED:
|
||||||
|
case WATCHDOG_RESET:
|
||||||
|
case APPLICATION_START_FAIL:
|
||||||
|
case HARD_FAULT_ERROR:
|
||||||
|
case NO_DATA_AVAILABLE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(&client->dev, "Device did not responded with correct "
|
||||||
|
"state! Actual response was 0x%02X. "
|
||||||
|
"Unable to get device state!\n", recv[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
data[0] = BOOT_START_APP;
|
||||||
|
|
||||||
|
if ((ret = stm32_write(client, g_proto, CMD_BOOT, data, 1))) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"stm32_prepare: boot start write failed (%d)\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ret = stm32_read(client, recv, 1))) {
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"stm32_prepare: boot start read failed (%d)\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recv[0] != STATUS_ACK && recv[0] != NO_DATA_AVAILABLE) {
|
||||||
|
dev_err(&client->dev, "Device did not responded with ACK. "
|
||||||
|
"Actual response was 0x%02X. "
|
||||||
|
"Unable to set device state!\n", recv[0]);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stm32_gpio_write(struct r2ec *gpio, int pin, int val)
|
||||||
|
{
|
||||||
|
struct i2c_request *req;
|
||||||
|
size_t len = 2;
|
||||||
|
uint8_t tmp[sizeof(struct i2c_request) + 2];
|
||||||
|
//int err;
|
||||||
|
|
||||||
|
if (!gpio->client) {
|
||||||
|
printk(KERN_ERR "R2EC I2C client is not ready!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
req = (struct i2c_request *)tmp;
|
||||||
|
req->version = PROTO_VERSION_2;
|
||||||
|
req->length = 2 + len; // command + crc + data
|
||||||
|
req->command = CMD_GPIO;
|
||||||
|
req->data[0] = pin;
|
||||||
|
req->data[1] = val;
|
||||||
|
|
||||||
|
i2c_master_send(gpio->client, tmp, sizeof(tmp));
|
||||||
|
// if ((err = i2c_master_send(gpio->client, tmp, sizeof(tmp))) < 0) {
|
||||||
|
// if (err != -ENXIO) {
|
||||||
|
// return err;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// we need to ignore errors while device is not ready
|
||||||
|
// otherwise none of GPIOs/LEDs will be probed by the kernel
|
||||||
|
// if (!gpio->ic_ready) {
|
||||||
|
// err = 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return err;
|
||||||
|
// }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stm32_gpio_read(struct r2ec *gpio, int pin, int val)
|
||||||
|
{
|
||||||
|
struct i2c_request *req;
|
||||||
|
size_t len = 2;
|
||||||
|
uint8_t tmp[sizeof(struct i2c_request) + 2];
|
||||||
|
uint8_t recv[1];
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (!gpio->client) {
|
||||||
|
printk(KERN_ERR "R2EC I2C client is not ready!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
req = (struct i2c_request *)tmp;
|
||||||
|
req->version = PROTO_VERSION_2;
|
||||||
|
req->length = 2 + len; // command + crc + data
|
||||||
|
req->command = CMD_GPIO;
|
||||||
|
req->data[0] = pin;
|
||||||
|
req->data[1] = val;
|
||||||
|
|
||||||
|
if ((err = i2c_master_send(gpio->client, tmp, sizeof(tmp))) < 0) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err = i2c_master_recv(gpio->client, recv, sizeof(recv))) < 0) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (recv[0]) {
|
||||||
|
case GPIO_STATE_HIGH:
|
||||||
|
return 1;
|
||||||
|
case GPIO_STATE_LOW:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int r2ec_get(struct gpio_chip *chip, unsigned offset)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = gpiochip_get_data(chip);
|
||||||
|
int value;
|
||||||
|
|
||||||
|
mutex_lock(&gpio->i2c_lock);
|
||||||
|
value = stm32_gpio_read(gpio, offset, GPIO_VALUE_GET);
|
||||||
|
mutex_unlock(&gpio->i2c_lock);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r2ec_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = gpiochip_get_data(chip);
|
||||||
|
int val = value ? GPIO_VALUE_SET_HIGH : GPIO_VALUE_SET_LOW;
|
||||||
|
|
||||||
|
mutex_lock(&gpio->i2c_lock);
|
||||||
|
stm32_gpio_write(gpio, offset, val);
|
||||||
|
mutex_unlock(&gpio->i2c_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int r2ec_input(struct gpio_chip *chip, unsigned offset)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = gpiochip_get_data(chip);
|
||||||
|
int status;
|
||||||
|
|
||||||
|
mutex_lock(&gpio->i2c_lock);
|
||||||
|
status = stm32_gpio_write(gpio, offset, GPIO_MODE_SET_INPUT);
|
||||||
|
mutex_unlock(&gpio->i2c_lock);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int r2ec_output(struct gpio_chip *chip, unsigned offset, int value)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = gpiochip_get_data(chip);
|
||||||
|
int status;
|
||||||
|
|
||||||
|
mutex_lock(&gpio->i2c_lock);
|
||||||
|
status = stm32_gpio_write(gpio, offset, GPIO_MODE_SET_OUTPUT);
|
||||||
|
mutex_unlock(&gpio->i2c_lock);
|
||||||
|
|
||||||
|
r2ec_set(chip, offset, value);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void noop(struct irq_data *data) { }
|
||||||
|
|
||||||
|
static int noop_wake(struct irq_data *data, unsigned on)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static irqreturn_t r2ec_irq(int irq, void *data)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = data;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < gpio->chip.ngpio; i++) {
|
||||||
|
handle_nested_irq(irq_find_mapping(gpio->chip.irq.domain, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r2ec_irq_bus_lock(struct irq_data *data)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = irq_data_get_irq_chip_data(data);
|
||||||
|
mutex_lock(&gpio->irq_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r2ec_irq_bus_sync_unlock(struct irq_data *data)
|
||||||
|
{
|
||||||
|
struct r2ec *gpio = irq_data_get_irq_chip_data(data);
|
||||||
|
mutex_unlock(&gpio->irq_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int chip_label_match(struct gpio_chip *chip, void *data)
|
||||||
|
{
|
||||||
|
return !strcmp(chip->label, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_stm32_version(struct device *dev, uint8_t type, char *buffer)
|
||||||
|
{
|
||||||
|
struct gpio_chip *chip;
|
||||||
|
struct r2ec *gpio;
|
||||||
|
uint8_t recv[sizeof(struct i2c_response)];
|
||||||
|
uint8_t data[1];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
struct pt_fw_get_ver {
|
||||||
|
unsigned char command_ex;
|
||||||
|
unsigned char major;
|
||||||
|
unsigned char middle;
|
||||||
|
unsigned char minor;
|
||||||
|
unsigned char rev;
|
||||||
|
} __attribute__((packed)) *res;
|
||||||
|
|
||||||
|
chip = gpiochip_find("stm32v1", chip_label_match);
|
||||||
|
if (!chip) {
|
||||||
|
printk(KERN_ERR "Unable to find R2EC gpio chip!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpio = gpiochip_get_data(chip);
|
||||||
|
|
||||||
|
if (!gpio->client) {
|
||||||
|
printk(KERN_ERR "R2EC I2C client is not ready!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
data[0] = (type == CMD_FW) ? FW_VERSION : BOOT_VERSION;
|
||||||
|
|
||||||
|
mutex_lock(&gpio->i2c_lock);
|
||||||
|
|
||||||
|
if ((ret = stm32_write(gpio->client, g_proto, type, data, 1))) {
|
||||||
|
printk("%s: firmware version write failed (%d)\n",
|
||||||
|
__func__, ret);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prevent possible I2C bus lockup when master requests more than 1 byte
|
||||||
|
// and slave only sends a couple of bytes, but master is still waiting
|
||||||
|
// and SCL line is down; there is no recovery except power cycle
|
||||||
|
// first read 1 byte and compare with supported protocol versions
|
||||||
|
// if they match, then full messsage can be read, otherwise drop
|
||||||
|
// everything to not introduce bus lockup
|
||||||
|
if ((ret = stm32_read(gpio->client, data, 1))) {
|
||||||
|
printk("%s: firmware version read failed (%d)\n",
|
||||||
|
__func__, ret);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data[0] != PROTO_VERSION_1 && data[0] != PROTO_VERSION_2) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
recv[0] = data[0];
|
||||||
|
|
||||||
|
if ((ret = stm32_read(gpio->client, &recv[1], sizeof(recv) - 1))) {
|
||||||
|
printk("%s: firmware version read failed (%d)\n",
|
||||||
|
__func__, ret);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
// device is ready now, running in application-mode
|
||||||
|
// this is called by autoflasher script first time
|
||||||
|
if (!gpio->ic_ready) {
|
||||||
|
gpio->ic_ready = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = (struct pt_fw_get_ver *)(&recv[3]);
|
||||||
|
|
||||||
|
sprintf(buffer, "%02d.%02d.%02d rev. %02d\n",
|
||||||
|
res->major, res->middle, res->minor, res->rev);
|
||||||
|
|
||||||
|
done:
|
||||||
|
mutex_unlock(&gpio->i2c_lock);
|
||||||
|
return strlen(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t app_version_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buffer)
|
||||||
|
{
|
||||||
|
return get_stm32_version(dev, CMD_FW, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t boot_version_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buffer)
|
||||||
|
{
|
||||||
|
return get_stm32_version(dev, CMD_BOOT, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
|
||||||
|
const char *buff, size_t count)
|
||||||
|
{
|
||||||
|
struct gpio_chip *chip;
|
||||||
|
struct r2ec *gpio;
|
||||||
|
uint8_t data[1];
|
||||||
|
|
||||||
|
chip = gpiochip_find("stm32v1", chip_label_match);
|
||||||
|
if (!chip) {
|
||||||
|
printk(KERN_ERR "Unable to find R2EC gpio chip!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpio = gpiochip_get_data(chip);
|
||||||
|
|
||||||
|
if (!gpio->client) {
|
||||||
|
printk(KERN_ERR "R2EC I2C client is not ready!\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
data[0] = BOOT_START_APP;
|
||||||
|
|
||||||
|
mutex_lock(&gpio->i2c_lock);
|
||||||
|
if (stm32_write(gpio->client, g_proto, CMD_BOOT, data, 1)) {
|
||||||
|
printk(KERN_ERR "Unable transmit R2EC data!\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
mutex_unlock(&gpio->i2c_lock);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct device_attribute g_r2ec_kobj_attr[] = {
|
||||||
|
__ATTR_RO(app_version),
|
||||||
|
__ATTR_RO(boot_version),
|
||||||
|
__ATTR_WO(reset)
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute *g_r2ec_attrs[] = {
|
||||||
|
&g_r2ec_kobj_attr[0].attr,
|
||||||
|
&g_r2ec_kobj_attr[1].attr,
|
||||||
|
&g_r2ec_kobj_attr[2].attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute_group g_r2ec_attr_group = { .attrs = g_r2ec_attrs };
|
||||||
|
static struct kobject *g_r2ec_kobj;
|
||||||
|
|
||||||
|
static int r2ec_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
|
{
|
||||||
|
struct r2ec_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||||
|
// dev_err(&client->dev,
|
||||||
|
// "r2ec_probe: dev_get_platdata(0x%x, %s): 0x%x\n",
|
||||||
|
// client->addr, client->name, pdata);
|
||||||
|
struct r2ec *gpio;
|
||||||
|
struct gpio_irq_chip *girq;
|
||||||
|
int status, i;
|
||||||
|
|
||||||
|
gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL);
|
||||||
|
if (!gpio) {
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++) {
|
||||||
|
if (!(status = stm32_prepare(gpio, client))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev_err(&client->dev,
|
||||||
|
"Unable to initialize device, retrying...\n");
|
||||||
|
|
||||||
|
// give some time for next interation...
|
||||||
|
msleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
dev_err(&client->dev, "Unable to initialize device!\n");
|
||||||
|
devm_kfree(&client->dev, gpio);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
mutex_init(&gpio->irq_lock);
|
||||||
|
mutex_init(&gpio->i2c_lock);
|
||||||
|
|
||||||
|
lockdep_set_subclass(&gpio->i2c_lock,
|
||||||
|
i2c_adapter_depth(client->adapter));
|
||||||
|
|
||||||
|
gpio->chip.base = pdata ? pdata->gpio_base : -1;
|
||||||
|
gpio->chip.can_sleep = true;
|
||||||
|
gpio->chip.parent = &client->dev;
|
||||||
|
gpio->chip.owner = THIS_MODULE;
|
||||||
|
gpio->chip.get = r2ec_get;
|
||||||
|
gpio->chip.set = r2ec_set;
|
||||||
|
gpio->chip.direction_input = r2ec_input;
|
||||||
|
gpio->chip.direction_output = r2ec_output;
|
||||||
|
gpio->chip.ngpio = id->driver_data;
|
||||||
|
gpio->chip.label = client->name;
|
||||||
|
gpio->client = client;
|
||||||
|
|
||||||
|
i2c_set_clientdata(client, gpio);
|
||||||
|
|
||||||
|
if (client->irq) {
|
||||||
|
gpio->irqchip.name = "r2ec";
|
||||||
|
gpio->irqchip.irq_enable = noop,
|
||||||
|
gpio->irqchip.irq_disable = noop,
|
||||||
|
gpio->irqchip.irq_ack = noop,
|
||||||
|
gpio->irqchip.irq_mask = noop,
|
||||||
|
gpio->irqchip.irq_unmask = noop,
|
||||||
|
gpio->irqchip.irq_set_wake = noop_wake,
|
||||||
|
gpio->irqchip.irq_bus_lock = r2ec_irq_bus_lock;
|
||||||
|
gpio->irqchip.irq_bus_sync_unlock = r2ec_irq_bus_sync_unlock;
|
||||||
|
|
||||||
|
girq = &gpio->chip.irq;
|
||||||
|
girq->chip = &gpio->irqchip;
|
||||||
|
/* This will let us handle the parent IRQ in the driver */
|
||||||
|
girq->parent_handler = NULL;
|
||||||
|
girq->num_parents = 0;
|
||||||
|
girq->parents = NULL;
|
||||||
|
girq->default_type = IRQ_TYPE_NONE;
|
||||||
|
girq->handler = handle_bad_irq;
|
||||||
|
girq->threaded = true;
|
||||||
|
|
||||||
|
status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
dev_err(&client->dev, "cannot add irqchip\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = devm_request_threaded_irq(&client->dev, client->irq,
|
||||||
|
NULL, r2ec_irq,
|
||||||
|
IRQF_ONESHOT |
|
||||||
|
IRQF_TRIGGER_FALLING |
|
||||||
|
IRQF_SHARED,
|
||||||
|
dev_name(&client->dev),
|
||||||
|
gpio);
|
||||||
|
if (status) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pdata && pdata->setup) {
|
||||||
|
status = pdata->setup(client, gpio->chip.base, gpio->chip.ngpio,
|
||||||
|
pdata->context);
|
||||||
|
|
||||||
|
if (status < 0) {
|
||||||
|
dev_warn(&client->dev, "setup --> %d\n", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dev_info(&client->dev, "probed\n");
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
devm_kfree(&client->dev, gpio);
|
||||||
|
dev_dbg(&client->dev, "probe error %d for %s\n", status, client->name);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r2ec_remove(struct i2c_client *client)
|
||||||
|
{
|
||||||
|
struct r2ec_platform_data *pdata = dev_get_platdata(&client->dev);
|
||||||
|
struct r2ec *gpio = i2c_get_clientdata(client);
|
||||||
|
int status = 0;
|
||||||
|
|
||||||
|
if (pdata && pdata->teardown) {
|
||||||
|
status = pdata->teardown(client, gpio->chip.base, gpio->chip.ngpio,
|
||||||
|
pdata->context);
|
||||||
|
|
||||||
|
if (status < 0) {
|
||||||
|
dev_err(&client->dev, "%s --> %d\n", "teardown", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct i2c_driver r2ec_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "r2ec",
|
||||||
|
.of_match_table = of_match_ptr(r2ec_of_table),
|
||||||
|
},
|
||||||
|
.probe = r2ec_probe,
|
||||||
|
.remove = r2ec_remove,
|
||||||
|
.id_table = r2ec_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init r2ec_init(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = i2c_add_driver(&r2ec_driver);
|
||||||
|
if (ret) {
|
||||||
|
printk(KERN_ERR "Unable to initialize `r2ec` driver!\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_r2ec_kobj = kobject_create_and_add("r2ec", NULL);
|
||||||
|
if (!g_r2ec_kobj) {
|
||||||
|
i2c_del_driver(&r2ec_driver);
|
||||||
|
printk(KERN_ERR "Unable to create `r2ec` kobject!\n");
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sysfs_create_group(g_r2ec_kobj, &g_r2ec_attr_group)) {
|
||||||
|
kobject_put(g_r2ec_kobj);
|
||||||
|
i2c_del_driver(&r2ec_driver);
|
||||||
|
printk(KERN_ERR "Unable to create `r2ec` sysfs group!\n");
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit r2ec_exit(void)
|
||||||
|
{
|
||||||
|
kobject_put(g_r2ec_kobj);
|
||||||
|
i2c_del_driver(&r2ec_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(r2ec_init);
|
||||||
|
module_exit(r2ec_exit);
|
||||||
|
|
||||||
|
MODULE_AUTHOR("Jokubas Maciulaitis <jokubas.maciulaitis@teltonika.lt>");
|
||||||
|
MODULE_DESCRIPTION("STM32F0 (R2EC) I2C GPIO Expander driver");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
76
6.7/package/libs/libnftnl/Makefile
Normal file
76
6.7/package/libs/libnftnl/Makefile
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=libnftnl
|
||||||
|
PKG_CPE_ID:=cpe:/a:netfilter:libnftnl
|
||||||
|
PKG_VERSION:=1.2.6
|
||||||
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
|
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
|
||||||
|
PKG_HASH:=ceeaea2cd92147da19f13a35a7f1a4bc2767ff897e838e4b479cf54b59c777f4
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
|
||||||
|
PKG_LICENSE:=GPL-2.0-or-later
|
||||||
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
||||||
|
PKG_INSTALL:=1
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_BUILD_FLAGS:=lto
|
||||||
|
PKG_FIXUP:=autoreconf
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
DISABLE_NLS:=
|
||||||
|
|
||||||
|
define Package/libnftnl
|
||||||
|
SECTION:=libs
|
||||||
|
CATEGORY:=Libraries
|
||||||
|
DEPENDS:=+libmnl
|
||||||
|
TITLE:=Low-level netlink library for the nf_tables subsystem
|
||||||
|
URL:=http://www.netfilter.org/projects/libnftnl
|
||||||
|
ABI_VERSION:=11
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libnftnl/description
|
||||||
|
libnftnl is a userspace library providing a low-level netlink
|
||||||
|
programming interface (API) to the in-kernel nf_tables subsystem.
|
||||||
|
endef
|
||||||
|
|
||||||
|
TARGET_CFLAGS += $(FPIC)
|
||||||
|
|
||||||
|
CONFIGURE_ARGS += \
|
||||||
|
--enable-static \
|
||||||
|
--enable-shared
|
||||||
|
|
||||||
|
define Build/InstallDev
|
||||||
|
$(INSTALL_DIR) $(1)/usr/include/libnftnl
|
||||||
|
$(CP) \
|
||||||
|
$(PKG_INSTALL_DIR)/usr/include/libnftnl/*.h \
|
||||||
|
$(1)/usr/include/libnftnl/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) \
|
||||||
|
$(PKG_INSTALL_DIR)/usr/lib/libnftnl.{so*,a,la} \
|
||||||
|
$(1)/usr/lib/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||||
|
$(CP) \
|
||||||
|
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnftnl.pc \
|
||||||
|
$(1)/usr/lib/pkgconfig/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libnftnl/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) \
|
||||||
|
$(PKG_INSTALL_DIR)/usr/lib/libnftnl.so.* \
|
||||||
|
$(1)/usr/lib/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,libnftnl))
|
|
@ -0,0 +1,254 @@
|
||||||
|
From 6c39f04febd7cfdbd474233379416babcd0fc341 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Syrone Wong <wong.syrone@gmail.com>
|
||||||
|
Date: Fri, 8 Apr 2022 23:52:11 +0800
|
||||||
|
Subject: [PATCH] libnftnl: add fullcone expression support
|
||||||
|
|
||||||
|
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
|
||||||
|
---
|
||||||
|
include/libnftnl/expr.h | 6 +
|
||||||
|
include/linux/netfilter/nf_tables.h | 16 +++
|
||||||
|
src/Makefile.am | 1 +
|
||||||
|
src/expr/fullcone.c | 167 ++++++++++++++++++++++++++++
|
||||||
|
src/expr_ops.c | 2 +
|
||||||
|
5 files changed, 192 insertions(+)
|
||||||
|
create mode 100644 src/expr/fullcone.c
|
||||||
|
|
||||||
|
--- a/include/libnftnl/expr.h
|
||||||
|
+++ b/include/libnftnl/expr.h
|
||||||
|
@@ -245,6 +245,12 @@ enum {
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
+ NFTNL_EXPR_FULLCONE_FLAGS = NFTNL_EXPR_BASE,
|
||||||
|
+ NFTNL_EXPR_FULLCONE_REG_PROTO_MIN,
|
||||||
|
+ NFTNL_EXPR_FULLCONE_REG_PROTO_MAX,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum {
|
||||||
|
NFTNL_EXPR_REDIR_REG_PROTO_MIN = NFTNL_EXPR_BASE,
|
||||||
|
NFTNL_EXPR_REDIR_REG_PROTO_MAX,
|
||||||
|
NFTNL_EXPR_REDIR_FLAGS,
|
||||||
|
--- a/include/linux/netfilter/nf_tables.h
|
||||||
|
+++ b/include/linux/netfilter/nf_tables.h
|
||||||
|
@@ -1434,6 +1434,22 @@ enum nft_masq_attributes {
|
||||||
|
#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
+ * enum nft_fullcone_attributes - nf_tables fullcone expression attributes
|
||||||
|
+ *
|
||||||
|
+ * @NFTA_FULLCONE_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
|
||||||
|
+ * @NFTA_FULLCONE_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
|
||||||
|
+ * @NFTA_FULLCONE_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
|
||||||
|
+ */
|
||||||
|
+enum nft_fullcone_attributes {
|
||||||
|
+ NFTA_FULLCONE_UNSPEC,
|
||||||
|
+ NFTA_FULLCONE_FLAGS,
|
||||||
|
+ NFTA_FULLCONE_REG_PROTO_MIN,
|
||||||
|
+ NFTA_FULLCONE_REG_PROTO_MAX,
|
||||||
|
+ __NFTA_FULLCONE_MAX
|
||||||
|
+};
|
||||||
|
+#define NFTA_FULLCONE_MAX (__NFTA_FULLCONE_MAX - 1)
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
* enum nft_redir_attributes - nf_tables redirect expression netlink attributes
|
||||||
|
*
|
||||||
|
* @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
|
||||||
|
--- a/src/Makefile.am
|
||||||
|
+++ b/src/Makefile.am
|
||||||
|
@@ -54,6 +54,7 @@ libnftnl_la_SOURCES = utils.c \
|
||||||
|
expr/target.c \
|
||||||
|
expr/tunnel.c \
|
||||||
|
expr/masq.c \
|
||||||
|
+ expr/fullcone.c \
|
||||||
|
expr/redir.c \
|
||||||
|
expr/hash.c \
|
||||||
|
expr/socket.c \
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/expr/fullcone.c
|
||||||
|
@@ -0,0 +1,168 @@
|
||||||
|
+/*
|
||||||
|
+ * (C) 2022 wongsyrone
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU General Public License as published
|
||||||
|
+ * by the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+ * (at your option) any later version.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
+#include <arpa/inet.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <inttypes.h>
|
||||||
|
+
|
||||||
|
+#include <linux/netfilter/nf_tables.h>
|
||||||
|
+
|
||||||
|
+#include "internal.h"
|
||||||
|
+#include <libmnl/libmnl.h>
|
||||||
|
+#include <libnftnl/expr.h>
|
||||||
|
+#include <libnftnl/rule.h>
|
||||||
|
+
|
||||||
|
+struct nftnl_expr_fullcone {
|
||||||
|
+ uint32_t flags;
|
||||||
|
+ enum nft_registers sreg_proto_min;
|
||||||
|
+ enum nft_registers sreg_proto_max;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+nftnl_expr_fullcone_set(struct nftnl_expr *e, uint16_t type,
|
||||||
|
+ const void *data, uint32_t data_len)
|
||||||
|
+{
|
||||||
|
+ struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
|
||||||
|
+
|
||||||
|
+ switch (type) {
|
||||||
|
+ case NFTNL_EXPR_FULLCONE_FLAGS:
|
||||||
|
+ memcpy(&fullcone->flags, data, sizeof(fullcone->flags));
|
||||||
|
+ break;
|
||||||
|
+ case NFTNL_EXPR_FULLCONE_REG_PROTO_MIN:
|
||||||
|
+ memcpy(&fullcone->sreg_proto_min, data, sizeof(fullcone->sreg_proto_min));
|
||||||
|
+ break;
|
||||||
|
+ case NFTNL_EXPR_FULLCONE_REG_PROTO_MAX:
|
||||||
|
+ memcpy(&fullcone->sreg_proto_max, data, sizeof(fullcone->sreg_proto_max));
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const void *
|
||||||
|
+nftnl_expr_fullcone_get(const struct nftnl_expr *e, uint16_t type,
|
||||||
|
+ uint32_t *data_len)
|
||||||
|
+{
|
||||||
|
+ struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
|
||||||
|
+
|
||||||
|
+ switch (type) {
|
||||||
|
+ case NFTNL_EXPR_FULLCONE_FLAGS:
|
||||||
|
+ *data_len = sizeof(fullcone->flags);
|
||||||
|
+ return &fullcone->flags;
|
||||||
|
+ case NFTNL_EXPR_FULLCONE_REG_PROTO_MIN:
|
||||||
|
+ *data_len = sizeof(fullcone->sreg_proto_min);
|
||||||
|
+ return &fullcone->sreg_proto_min;
|
||||||
|
+ case NFTNL_EXPR_FULLCONE_REG_PROTO_MAX:
|
||||||
|
+ *data_len = sizeof(fullcone->sreg_proto_max);
|
||||||
|
+ return &fullcone->sreg_proto_max;
|
||||||
|
+ }
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int nftnl_expr_fullcone_cb(const struct nlattr *attr, void *data)
|
||||||
|
+{
|
||||||
|
+ const struct nlattr **tb = data;
|
||||||
|
+ int type = mnl_attr_get_type(attr);
|
||||||
|
+
|
||||||
|
+ if (mnl_attr_type_valid(attr, NFTA_FULLCONE_MAX) < 0)
|
||||||
|
+ return MNL_CB_OK;
|
||||||
|
+
|
||||||
|
+ switch (type) {
|
||||||
|
+ case NFTA_FULLCONE_REG_PROTO_MIN:
|
||||||
|
+ case NFTA_FULLCONE_REG_PROTO_MAX:
|
||||||
|
+ case NFTA_FULLCONE_FLAGS:
|
||||||
|
+ if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0)
|
||||||
|
+ abi_breakage();
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ tb[type] = attr;
|
||||||
|
+ return MNL_CB_OK;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+nftnl_expr_fullcone_build(struct nlmsghdr *nlh, const struct nftnl_expr *e)
|
||||||
|
+{
|
||||||
|
+ struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
|
||||||
|
+
|
||||||
|
+ if (e->flags & (1 << NFTNL_EXPR_FULLCONE_FLAGS))
|
||||||
|
+ mnl_attr_put_u32(nlh, NFTA_FULLCONE_FLAGS, htobe32(fullcone->flags));
|
||||||
|
+ if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MIN))
|
||||||
|
+ mnl_attr_put_u32(nlh, NFTA_FULLCONE_REG_PROTO_MIN,
|
||||||
|
+ htobe32(fullcone->sreg_proto_min));
|
||||||
|
+ if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MAX))
|
||||||
|
+ mnl_attr_put_u32(nlh, NFTA_FULLCONE_REG_PROTO_MAX,
|
||||||
|
+ htobe32(fullcone->sreg_proto_max));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+nftnl_expr_fullcone_parse(struct nftnl_expr *e, struct nlattr *attr)
|
||||||
|
+{
|
||||||
|
+ struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
|
||||||
|
+ struct nlattr *tb[NFTA_FULLCONE_MAX+1] = {};
|
||||||
|
+
|
||||||
|
+ if (mnl_attr_parse_nested(attr, nftnl_expr_fullcone_cb, tb) < 0)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ if (tb[NFTA_FULLCONE_FLAGS]) {
|
||||||
|
+ fullcone->flags = be32toh(mnl_attr_get_u32(tb[NFTA_FULLCONE_FLAGS]));
|
||||||
|
+ e->flags |= (1 << NFTNL_EXPR_FULLCONE_FLAGS);
|
||||||
|
+ }
|
||||||
|
+ if (tb[NFTA_FULLCONE_REG_PROTO_MIN]) {
|
||||||
|
+ fullcone->sreg_proto_min =
|
||||||
|
+ be32toh(mnl_attr_get_u32(tb[NFTA_FULLCONE_REG_PROTO_MIN]));
|
||||||
|
+ e->flags |= (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MIN);
|
||||||
|
+ }
|
||||||
|
+ if (tb[NFTA_FULLCONE_REG_PROTO_MAX]) {
|
||||||
|
+ fullcone->sreg_proto_max =
|
||||||
|
+ be32toh(mnl_attr_get_u32(tb[NFTA_FULLCONE_REG_PROTO_MAX]));
|
||||||
|
+ e->flags |= (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MAX);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int nftnl_expr_fullcone_snprintf(char *buf, size_t remain,
|
||||||
|
+ uint32_t flags, const struct nftnl_expr *e)
|
||||||
|
+{
|
||||||
|
+ struct nftnl_expr_fullcone *fullcone = nftnl_expr_data(e);
|
||||||
|
+ int offset = 0, ret = 0;
|
||||||
|
+
|
||||||
|
+ if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MIN)) {
|
||||||
|
+ ret = snprintf(buf + offset, remain, "proto_min reg %u ",
|
||||||
|
+ fullcone->sreg_proto_min);
|
||||||
|
+ SNPRINTF_BUFFER_SIZE(ret, remain, offset);
|
||||||
|
+ }
|
||||||
|
+ if (e->flags & (1 << NFTNL_EXPR_FULLCONE_REG_PROTO_MAX)) {
|
||||||
|
+ ret = snprintf(buf + offset, remain, "proto_max reg %u ",
|
||||||
|
+ fullcone->sreg_proto_max);
|
||||||
|
+ SNPRINTF_BUFFER_SIZE(ret, remain, offset);
|
||||||
|
+ }
|
||||||
|
+ if (e->flags & (1 << NFTNL_EXPR_FULLCONE_FLAGS)) {
|
||||||
|
+ ret = snprintf(buf + offset, remain, "flags 0x%x ", fullcone->flags);
|
||||||
|
+ SNPRINTF_BUFFER_SIZE(ret, remain, offset);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return offset;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+struct expr_ops expr_ops_fullcone = {
|
||||||
|
+ .name = "fullcone",
|
||||||
|
+ .alloc_len = sizeof(struct nftnl_expr_fullcone),
|
||||||
|
+ .max_attr = NFTA_FULLCONE_MAX,
|
||||||
|
+ .set = nftnl_expr_fullcone_set,
|
||||||
|
+ .get = nftnl_expr_fullcone_get,
|
||||||
|
+ .parse = nftnl_expr_fullcone_parse,
|
||||||
|
+ .build = nftnl_expr_fullcone_build,
|
||||||
|
+ .output = nftnl_expr_fullcone_snprintf,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
--- a/src/expr_ops.c
|
||||||
|
+++ b/src/expr_ops.c
|
||||||
|
@@ -19,6 +19,7 @@ extern struct expr_ops expr_ops_limit;
|
||||||
|
extern struct expr_ops expr_ops_log;
|
||||||
|
extern struct expr_ops expr_ops_lookup;
|
||||||
|
extern struct expr_ops expr_ops_masq;
|
||||||
|
+extern struct expr_ops expr_ops_fullcone;
|
||||||
|
extern struct expr_ops expr_ops_match;
|
||||||
|
extern struct expr_ops expr_ops_meta;
|
||||||
|
extern struct expr_ops expr_ops_ng;
|
||||||
|
@@ -63,6 +64,7 @@ static struct expr_ops *expr_ops[] = {
|
||||||
|
&expr_ops_log,
|
||||||
|
&expr_ops_lookup,
|
||||||
|
&expr_ops_masq,
|
||||||
|
+ &expr_ops_fullcone,
|
||||||
|
&expr_ops_match,
|
||||||
|
&expr_ops_meta,
|
||||||
|
&expr_ops_ng,
|
|
@ -0,0 +1,22 @@
|
||||||
|
--- a/root/usr/share/firewall4/templates/ruleset.uc 2023-07-28 18:55:05.492297782 +0200
|
||||||
|
+++ b/root/usr/share/firewall4/templates/ruleset.uc 2023-07-28 18:58:52.300598623 +0200
|
||||||
|
@@ -218,9 +218,7 @@
|
||||||
|
{% for (let rule in fw4.rules(`input_${zone.name}`)): %}
|
||||||
|
{%+ include("rule.uc", { fw4, rule }) %}
|
||||||
|
{% endfor %}
|
||||||
|
-{% if (zone.dflags.dnat): %}
|
||||||
|
ct status dnat accept comment "!fw4: Accept port redirections"
|
||||||
|
-{% endif %}
|
||||||
|
{% fw4.includes('chain-append', `input_${zone.name}`) %}
|
||||||
|
jump {{ zone.input }}_from_{{ zone.name }}
|
||||||
|
}
|
||||||
|
@@ -239,9 +237,7 @@
|
||||||
|
{% for (let rule in fw4.rules(`forward_${zone.name}`)): %}
|
||||||
|
{%+ include("rule.uc", { fw4, rule }) %}
|
||||||
|
{% endfor %}
|
||||||
|
-{% if (zone.dflags.dnat): %}
|
||||||
|
ct status dnat accept comment "!fw4: Accept port forwards"
|
||||||
|
-{% endif %}
|
||||||
|
{% fw4.includes('chain-append', `forward_${zone.name}`) %}
|
||||||
|
jump {{ zone.forward }}_to_{{ zone.name }}
|
||||||
|
{% if (fw4.forward_policy() != "accept" && (zone.log & 1)): %}
|
|
@ -0,0 +1,248 @@
|
||||||
|
From d4081c498ddca184578903fe5199d390bbc0707b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Syrone Wong <wong.syrone@gmail.com>
|
||||||
|
Date: Sat, 9 Apr 2022 13:24:19 +0800
|
||||||
|
Subject: [PATCH] firewall4: add fullcone support
|
||||||
|
|
||||||
|
fullcone is drop-in replacement of masq for non-udp traffic
|
||||||
|
|
||||||
|
add runtime fullcone rule check, disable it globally if fullcone expr is
|
||||||
|
invalid
|
||||||
|
|
||||||
|
defaults.fullcone is the global switch, while zone.fullcone4 and
|
||||||
|
zone.fullcone6 are switches for IPv4 and IPv6 respectively, most
|
||||||
|
IPv6 traffic do NOT need this FullCone NAT functionality.
|
||||||
|
---
|
||||||
|
root/etc/config/firewall | 3 +
|
||||||
|
root/usr/share/firewall4/templates/ruleset.uc | 16 +++-
|
||||||
|
.../firewall4/templates/zone-fullcone.uc | 4 +
|
||||||
|
root/usr/share/ucode/fw4.uc | 76 ++++++++++++++++++-
|
||||||
|
4 files changed, 96 insertions(+), 3 deletions(-)
|
||||||
|
create mode 100644 root/usr/share/firewall4/templates/zone-fullcone.uc
|
||||||
|
|
||||||
|
diff --git a/root/etc/config/firewall b/root/etc/config/firewall
|
||||||
|
index b9a4647..7187723 100644
|
||||||
|
--- a/root/etc/config/firewall
|
||||||
|
+++ b/root/etc/config/firewall
|
||||||
|
@@ -5,6 +5,7 @@ config defaults
|
||||||
|
option forward REJECT
|
||||||
|
# Uncomment this line to disable ipv6 rules
|
||||||
|
# option disable_ipv6 1
|
||||||
|
+ option fullcone '0'
|
||||||
|
|
||||||
|
config zone
|
||||||
|
option name lan
|
||||||
|
@@ -20,6 +21,8 @@ config zone
|
||||||
|
option input REJECT
|
||||||
|
option output ACCEPT
|
||||||
|
option forward REJECT
|
||||||
|
+ option fullcone4 '0'
|
||||||
|
+ option fullcone6 '0'
|
||||||
|
option masq 1
|
||||||
|
option mtu_fix 1
|
||||||
|
|
||||||
|
diff --git a/root/usr/share/firewall4/templates/ruleset.uc b/root/usr/share/firewall4/templates/ruleset.uc
|
||||||
|
index eaa1f04..e29eae6 100644
|
||||||
|
--- a/root/usr/share/firewall4/templates/ruleset.uc
|
||||||
|
+++ b/root/usr/share/firewall4/templates/ruleset.uc
|
||||||
|
@@ -310,6 +310,12 @@ table inet fw4 {
|
||||||
|
{% for (let redirect in fw4.redirects(`dstnat_${zone.name}`)): %}
|
||||||
|
{%+ include("redirect.uc", { fw4, redirect }) %}
|
||||||
|
{% endfor %}
|
||||||
|
+{% if (zone.fullcone4): %}
|
||||||
|
+ {%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "dstnat" }) %}
|
||||||
|
+{% endif %}
|
||||||
|
+{% if (zone.fullcone6): %}
|
||||||
|
+ {%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "dstnat" }) %}
|
||||||
|
+{% endif %}
|
||||||
|
{% fw4.includes('chain-append', `dstnat_${zone.name}`) %}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -320,20 +326,26 @@ table inet fw4 {
|
||||||
|
{% for (let redirect in fw4.redirects(`srcnat_${zone.name}`)): %}
|
||||||
|
{%+ include("redirect.uc", { fw4, redirect }) %}
|
||||||
|
{% endfor %}
|
||||||
|
-{% if (zone.masq): %}
|
||||||
|
+{% if (zone.masq && !zone.fullcone4): %}
|
||||||
|
{% for (let saddrs in zone.masq4_src_subnets): %}
|
||||||
|
{% for (let daddrs in zone.masq4_dest_subnets): %}
|
||||||
|
{%+ include("zone-masq.uc", { fw4, zone, family: 4, saddrs, daddrs }) %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
-{% if (zone.masq6): %}
|
||||||
|
+{% if (zone.masq6 && !zone.fullcone6): %}
|
||||||
|
{% for (let saddrs in zone.masq6_src_subnets): %}
|
||||||
|
{% for (let daddrs in zone.masq6_dest_subnets): %}
|
||||||
|
{%+ include("zone-masq.uc", { fw4, zone, family: 6, saddrs, daddrs }) %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
+{% if (zone.fullcone4): %}
|
||||||
|
+ {%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "srcnat" }) %}
|
||||||
|
+{% endif %}
|
||||||
|
+{% if (zone.fullcone6): %}
|
||||||
|
+ {%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "srcnat" }) %}
|
||||||
|
+{% endif %}
|
||||||
|
{% fw4.includes('chain-append', `srcnat_${zone.name}`) %}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/root/usr/share/firewall4/templates/zone-fullcone.uc b/root/usr/share/firewall4/templates/zone-fullcone.uc
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..77d9806
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/root/usr/share/firewall4/templates/zone-fullcone.uc
|
||||||
|
@@ -0,0 +1,4 @@
|
||||||
|
+{# /usr/share/firewall4/templates/zone-fullcone.uc #}
|
||||||
|
+ meta nfproto {{ fw4.nfproto(family) }} fullcone comment "!fw4: Handle {{
|
||||||
|
+ zone.name
|
||||||
|
+}} {{ fw4.nfproto(family, true) }} fullcone NAT {{ direction }} traffic"
|
||||||
|
diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc
|
||||||
|
index 1b4764c..c5716da 100644
|
||||||
|
--- a/root/usr/share/ucode/fw4.uc
|
||||||
|
+++ b/root/usr/share/ucode/fw4.uc
|
||||||
|
@@ -1,3 +1,5 @@
|
||||||
|
+// /usr/share/ucode/fw4.uc
|
||||||
|
+
|
||||||
|
const fs = require("fs");
|
||||||
|
const uci = require("uci");
|
||||||
|
const ubus = require("ubus");
|
||||||
|
@@ -428,6 +430,25 @@ function nft_try_hw_offload(devices) {
|
||||||
|
return (rc == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
+function nft_try_fullcone() {
|
||||||
|
+ let nft_test =
|
||||||
|
+ 'add table inet fw4-fullcone-test; ' +
|
||||||
|
+ 'add chain inet fw4-fullcone-test dstnat { ' +
|
||||||
|
+ 'type nat hook prerouting priority -100; policy accept; ' +
|
||||||
|
+ 'fullcone; ' +
|
||||||
|
+ '}; ' +
|
||||||
|
+ 'add chain inet fw4-fullcone-test srcnat { ' +
|
||||||
|
+ 'type nat hook postrouting priority -100; policy accept; ' +
|
||||||
|
+ 'fullcone; ' +
|
||||||
|
+ '}; ';
|
||||||
|
+ let cmd = sprintf("/usr/sbin/nft -c '%s' 2>/dev/null", replace(nft_test, "'", "'\\''"));
|
||||||
|
+ let ok = system(cmd) == 0;
|
||||||
|
+ //if (!ok) {
|
||||||
|
+ // warn("nft_try_fullcone: cmd "+ cmd + "\n");
|
||||||
|
+ //}
|
||||||
|
+ return ok;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
|
||||||
|
return {
|
||||||
|
read_kernel_version: function() {
|
||||||
|
@@ -765,6 +786,18 @@ return {
|
||||||
|
warn(`[!] ${msg}\n`);
|
||||||
|
},
|
||||||
|
|
||||||
|
+ myinfo: function(fmt, ...args) {
|
||||||
|
+ if (getenv("QUIET"))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ let msg = sprintf(fmt, ...args);
|
||||||
|
+
|
||||||
|
+ if (getenv("TTY"))
|
||||||
|
+ warn(`\033[32m${msg}\033[m\n`);
|
||||||
|
+ else
|
||||||
|
+ warn(`[I] ${msg}\n`);
|
||||||
|
+ },
|
||||||
|
+
|
||||||
|
get: function(sid, opt) {
|
||||||
|
return this.cursor.get("firewall", sid, opt);
|
||||||
|
},
|
||||||
|
@@ -946,6 +979,21 @@ return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
+ myinfo_section: function(s, msg) {
|
||||||
|
+ if (s[".name"]) {
|
||||||
|
+ if (s.name)
|
||||||
|
+ this.myinfo("Section %s (%s) %s", this.section_id(s[".name"]), s.name, msg);
|
||||||
|
+ else
|
||||||
|
+ this.myinfo("Section %s %s", this.section_id(s[".name"]), msg);
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ if (s.name)
|
||||||
|
+ this.myinfo("ubus %s (%s) %s", s.type || "rule", s.name, msg);
|
||||||
|
+ else
|
||||||
|
+ this.myinfo("ubus %s %s", s.type || "rule", msg);
|
||||||
|
+ }
|
||||||
|
+ },
|
||||||
|
+
|
||||||
|
parse_policy: function(val) {
|
||||||
|
return this.parse_enum(val, [
|
||||||
|
"accept",
|
||||||
|
@@ -1385,6 +1433,7 @@ return {
|
||||||
|
"dnat",
|
||||||
|
"snat",
|
||||||
|
"masquerade",
|
||||||
|
+ "fullcone",
|
||||||
|
"accept",
|
||||||
|
"reject",
|
||||||
|
"drop"
|
||||||
|
@@ -1852,6 +1901,7 @@ return {
|
||||||
|
}
|
||||||
|
|
||||||
|
let defs = this.parse_options(data, {
|
||||||
|
+ fullcone: [ "bool", "0" ],
|
||||||
|
input: [ "policy", "drop" ],
|
||||||
|
output: [ "policy", "drop" ],
|
||||||
|
forward: [ "policy", "drop" ],
|
||||||
|
@@ -1884,6 +1934,11 @@ return {
|
||||||
|
|
||||||
|
delete defs.syn_flood;
|
||||||
|
|
||||||
|
+ if (!nft_try_fullcone()) {
|
||||||
|
+ delete defs.fullcone;
|
||||||
|
+ //warn("nft_try_fullcone failed, disable fullcone globally\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
this.state.defaults = defs;
|
||||||
|
},
|
||||||
|
|
||||||
|
@@ -1908,6 +1963,8 @@ return {
|
||||||
|
masq_dest: [ "network", null, PARSE_LIST ],
|
||||||
|
|
||||||
|
masq6: [ "bool" ],
|
||||||
|
+ fullcone4: [ "bool", "0" ],
|
||||||
|
+ fullcone6: [ "bool", "0" ],
|
||||||
|
|
||||||
|
extra: [ "string", null, UNSUPPORTED ],
|
||||||
|
extra_src: [ "string", null, UNSUPPORTED ],
|
||||||
|
@@ -1940,6 +1997,18 @@ return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (this.state.defaults && !this.state.defaults.fullcone) {
|
||||||
|
+ this.warn_section(data, "fullcone in defaults not enabled, ignore zone fullcone settings");
|
||||||
|
+ zone.fullcone4 = false;
|
||||||
|
+ zone.fullcone6 = false;
|
||||||
|
+ }
|
||||||
|
+ if (zone.fullcone4) {
|
||||||
|
+ this.myinfo_section(data, "IPv4 fullcone enabled for zone '" + zone.name + "'");
|
||||||
|
+ }
|
||||||
|
+ if (zone.fullcone6) {
|
||||||
|
+ this.myinfo_section(data, "IPv6 fullcone enabled for zone '" + zone.name + "'");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (zone.mtu_fix && this.kernel < 0x040a0000) {
|
||||||
|
this.warn_section(data, "option 'mtu_fix' requires kernel 4.10 or later");
|
||||||
|
return;
|
||||||
|
@@ -2110,10 +2179,15 @@ return {
|
||||||
|
zone.related_subnets = related_subnets;
|
||||||
|
zone.related_physdevs = related_physdevs;
|
||||||
|
|
||||||
|
+ if (zone.fullcone4 || zone.fullcone6) {
|
||||||
|
+ zone.dflags.snat = true;
|
||||||
|
+ zone.dflags.dnat = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (zone.masq || zone.masq6)
|
||||||
|
zone.dflags.snat = true;
|
||||||
|
|
||||||
|
- if ((zone.auto_helper && !(zone.masq || zone.masq6)) || length(zone.helper)) {
|
||||||
|
+ if ((zone.auto_helper && !(zone.masq || zone.masq6 || zone.fullcone4 || zone.fullcone6)) || length(zone.helper)) {
|
||||||
|
zone.dflags.helper = true;
|
||||||
|
|
||||||
|
for (let helper in (length(zone.helper) ? zone.helper : this.state.helpers)) {
|
119
6.7/package/network/utils/iwinfo/Makefile
Normal file
119
6.7/package/network/utils/iwinfo/Makefile
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2010-2016 Jo-Philipp Wich <jo@mein.io>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GPL 2 license.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=libiwinfo
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git
|
||||||
|
PKG_SOURCE_DATE:=2023-02-06
|
||||||
|
PKG_SOURCE_VERSION:=c7eb8ebe33de2ff2d08064258edb047e5ac09f29
|
||||||
|
PKG_MIRROR_HASH:=f1124cf305710b0f04e2ea6dd42ba96ba4a3367da4d4afb4c19d5af9905b1cc2
|
||||||
|
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
|
||||||
|
IWINFO_ABI_VERSION:=20230121
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
|
||||||
|
define Package/libiwinfo
|
||||||
|
SECTION:=libs
|
||||||
|
CATEGORY:=Libraries
|
||||||
|
TITLE:=Generalized Wireless Information Library (iwinfo)
|
||||||
|
DEPENDS:=+libnl-tiny +libuci +libubus +libiwinfo-data
|
||||||
|
ABI_VERSION:=$(IWINFO_ABI_VERSION)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libiwinfo/description
|
||||||
|
Wireless information library with simplified API for nl80211
|
||||||
|
and wext driver interfaces.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Package/libiwinfo-lua
|
||||||
|
SUBMENU:=Lua
|
||||||
|
SECTION:=lang
|
||||||
|
CATEGORY:=Languages
|
||||||
|
TITLE:=libiwinfo Lua binding
|
||||||
|
DEPENDS:=+libiwinfo +liblua
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libiwinfo-lua/description
|
||||||
|
This is the Lua binding for the iwinfo library. It provides access to all enabled
|
||||||
|
backends.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Package/libiwinfo-data
|
||||||
|
TITLE:=libiwinfo Lua binding
|
||||||
|
HIDDEN:=1
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Package/iwinfo
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
TITLE:=Generalized Wireless Information utility
|
||||||
|
DEPENDS:=+libiwinfo
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/iwinfo/description
|
||||||
|
Command line frontend for the wireless information library.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Build/Configure
|
||||||
|
endef
|
||||||
|
|
||||||
|
TARGET_CFLAGS += \
|
||||||
|
-I$(STAGING_DIR)/usr/include/libnl-tiny \
|
||||||
|
-I$(STAGING_DIR)/usr/include \
|
||||||
|
-D_GNU_SOURCE
|
||||||
|
|
||||||
|
MAKE_FLAGS += \
|
||||||
|
FPIC="$(FPIC)" \
|
||||||
|
CFLAGS="$(TARGET_CFLAGS)" \
|
||||||
|
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||||
|
BACKENDS="nl80211" \
|
||||||
|
SOVERSION="$(IWINFO_ABI_VERSION)"
|
||||||
|
|
||||||
|
define Build/InstallDev
|
||||||
|
$(INSTALL_DIR) $(1)/usr/include/iwinfo
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/include/iwinfo.h $(1)/usr/include/
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/include/iwinfo/* $(1)/usr/include/iwinfo/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) $(PKG_BUILD_DIR)/libiwinfo.so* $(1)/usr/lib/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libiwinfo/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so.$(IWINFO_ABI_VERSION) $(1)/usr/lib/libiwinfo.so.$(IWINFO_ABI_VERSION)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libiwinfo-lua/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/libiwinfo-data/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/share/libiwinfo
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/devices.txt $(1)/usr/share/libiwinfo/devices.txt
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/iwinfo/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo $(1)/usr/bin/iwinfo
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,libiwinfo))
|
||||||
|
$(eval $(call BuildPackage,libiwinfo-lua))
|
||||||
|
$(eval $(call BuildPackage,libiwinfo-data))
|
||||||
|
$(eval $(call BuildPackage,iwinfo))
|
85
6.7/package/network/utils/nftables/Makefile
Normal file
85
6.7/package/network/utils/nftables/Makefile
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
#
|
||||||
|
# Copyright (C) 2015 OpenWrt.org
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=nftables
|
||||||
|
PKG_VERSION:=1.0.7
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
|
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
|
||||||
|
PKG_HASH:=c12ac941fff9adaedf17367d5ce213789b98a0d314277bc22b3d71e10891f412
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
||||||
|
PKG_FIXUP:=autoreconf
|
||||||
|
PKG_INSTALL:=1
|
||||||
|
|
||||||
|
PKG_BUILD_FLAGS:=lto
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
DISABLE_NLS:=
|
||||||
|
|
||||||
|
CONFIGURE_ARGS += \
|
||||||
|
--disable-debug \
|
||||||
|
--disable-man-doc \
|
||||||
|
--with-mini-gmp \
|
||||||
|
--without-cli \
|
||||||
|
--disable-python
|
||||||
|
|
||||||
|
define Package/nftables/Default
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
SUBMENU:=Firewall
|
||||||
|
TITLE:=nftables userspace utility
|
||||||
|
DEPENDS:=+kmod-nft-core +libnftnl
|
||||||
|
URL:=http://netfilter.org/projects/nftables/
|
||||||
|
PROVIDES:=nftables
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/nftables-nojson
|
||||||
|
$(Package/nftables/Default)
|
||||||
|
TITLE+= no JSON support
|
||||||
|
VARIANT:=nojson
|
||||||
|
DEFAULT_VARIANT:=1
|
||||||
|
CONFLICTS:=nftables-json
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/nftables-json
|
||||||
|
$(Package/nftables/Default)
|
||||||
|
TITLE+= with JSON support
|
||||||
|
VARIANT:=json
|
||||||
|
DEPENDS+=+jansson
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(BUILD_VARIANT),json)
|
||||||
|
CONFIGURE_ARGS += --with-json
|
||||||
|
endif
|
||||||
|
|
||||||
|
define Build/InstallDev
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/nftables $(1)/usr/include/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnftables.pc \
|
||||||
|
$(1)/usr/lib/pkgconfig/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/nftables/install/Default
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
|
||||||
|
endef
|
||||||
|
|
||||||
|
Package/nftables-nojson/install = $(Package/nftables/install/Default)
|
||||||
|
Package/nftables-json/install = $(Package/nftables/install/Default)
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,nftables-nojson))
|
||||||
|
$(eval $(call BuildPackage,nftables-json))
|
|
@ -0,0 +1,223 @@
|
||||||
|
From 58c89e8768711a959fdc6e953df3ea2254ff93c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Syrone Wong <wong.syrone@gmail.com>
|
||||||
|
Date: Sat, 9 Apr 2022 00:38:51 +0800
|
||||||
|
Subject: [PATCH] nftables: add fullcone expression support
|
||||||
|
|
||||||
|
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
|
||||||
|
---
|
||||||
|
include/linux/netfilter/nf_tables.h | 16 ++++++++++
|
||||||
|
include/statement.h | 1 +
|
||||||
|
src/netlink_delinearize.c | 48 +++++++++++++++++++++++++++++
|
||||||
|
src/netlink_linearize.c | 7 +++++
|
||||||
|
src/parser_bison.y | 28 +++++++++++++++--
|
||||||
|
src/scanner.l | 1 +
|
||||||
|
src/statement.c | 1 +
|
||||||
|
7 files changed, 100 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/linux/netfilter/nf_tables.h b/include/linux/netfilter/nf_tables.h
|
||||||
|
index 75df968..beab9d8 100644
|
||||||
|
--- a/include/linux/netfilter/nf_tables.h
|
||||||
|
+++ b/include/linux/netfilter/nf_tables.h
|
||||||
|
@@ -1409,6 +1409,22 @@ enum nft_masq_attributes {
|
||||||
|
};
|
||||||
|
#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ * enum nft_fullcone_attributes - nf_tables fullcone expression attributes
|
||||||
|
+ *
|
||||||
|
+ * @NFTA_FULLCONE_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
|
||||||
|
+ * @NFTA_FULLCONE_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
|
||||||
|
+ * @NFTA_FULLCONE_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
|
||||||
|
+ */
|
||||||
|
+enum nft_fullcone_attributes {
|
||||||
|
+ NFTA_FULLCONE_UNSPEC,
|
||||||
|
+ NFTA_FULLCONE_FLAGS,
|
||||||
|
+ NFTA_FULLCONE_REG_PROTO_MIN,
|
||||||
|
+ NFTA_FULLCONE_REG_PROTO_MAX,
|
||||||
|
+ __NFTA_FULLCONE_MAX
|
||||||
|
+};
|
||||||
|
+#define NFTA_FULLCONE_MAX (__NFTA_FULLCONE_MAX - 1)
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* enum nft_redir_attributes - nf_tables redirect expression netlink attributes
|
||||||
|
*
|
||||||
|
diff --git a/include/statement.h b/include/statement.h
|
||||||
|
index 2a2d300..cbd48dd 100644
|
||||||
|
--- a/include/statement.h
|
||||||
|
+++ b/include/statement.h
|
||||||
|
@@ -122,6 +122,7 @@ enum nft_nat_etypes {
|
||||||
|
__NFT_NAT_SNAT = NFT_NAT_SNAT,
|
||||||
|
__NFT_NAT_DNAT = NFT_NAT_DNAT,
|
||||||
|
NFT_NAT_MASQ,
|
||||||
|
+ NFT_NAT_FULLCONE,
|
||||||
|
NFT_NAT_REDIR,
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
|
||||||
|
index 068c3bb..8513113 100644
|
||||||
|
--- a/src/netlink_delinearize.c
|
||||||
|
+++ b/src/netlink_delinearize.c
|
||||||
|
@@ -1369,6 +1369,53 @@ static void netlink_parse_masq(struct netlink_parse_ctx *ctx,
|
||||||
|
stmt_free(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void netlink_parse_fullcone(struct netlink_parse_ctx *ctx,
|
||||||
|
+ const struct location *loc,
|
||||||
|
+ const struct nftnl_expr *nle)
|
||||||
|
+{
|
||||||
|
+ enum nft_registers reg1, reg2;
|
||||||
|
+ struct expr *proto;
|
||||||
|
+ struct stmt *stmt;
|
||||||
|
+ uint32_t flags = 0;
|
||||||
|
+
|
||||||
|
+ if (nftnl_expr_is_set(nle, NFTNL_EXPR_FULLCONE_FLAGS))
|
||||||
|
+ flags = nftnl_expr_get_u32(nle, NFTNL_EXPR_FULLCONE_FLAGS);
|
||||||
|
+
|
||||||
|
+ stmt = nat_stmt_alloc(loc, NFT_NAT_FULLCONE);
|
||||||
|
+ stmt->nat.flags = flags;
|
||||||
|
+
|
||||||
|
+ reg1 = netlink_parse_register(nle, NFTNL_EXPR_FULLCONE_REG_PROTO_MIN);
|
||||||
|
+ if (reg1) {
|
||||||
|
+ proto = netlink_get_register(ctx, loc, reg1);
|
||||||
|
+ if (proto == NULL) {
|
||||||
|
+ netlink_error(ctx, loc,
|
||||||
|
+ "fullcone statement has no proto expression");
|
||||||
|
+ goto out_err;
|
||||||
|
+ }
|
||||||
|
+ expr_set_type(proto, &inet_service_type, BYTEORDER_BIG_ENDIAN);
|
||||||
|
+ stmt->nat.proto = proto;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ reg2 = netlink_parse_register(nle, NFTNL_EXPR_FULLCONE_REG_PROTO_MAX);
|
||||||
|
+ if (reg2 && reg2 != reg1) {
|
||||||
|
+ proto = netlink_get_register(ctx, loc, reg2);
|
||||||
|
+ if (proto == NULL) {
|
||||||
|
+ netlink_error(ctx, loc,
|
||||||
|
+ "fullcone statement has no proto expression");
|
||||||
|
+ goto out_err;
|
||||||
|
+ }
|
||||||
|
+ expr_set_type(proto, &inet_service_type, BYTEORDER_BIG_ENDIAN);
|
||||||
|
+ if (stmt->nat.proto != NULL)
|
||||||
|
+ proto = range_expr_alloc(loc, stmt->nat.proto, proto);
|
||||||
|
+ stmt->nat.proto = proto;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ctx->stmt = stmt;
|
||||||
|
+ return;
|
||||||
|
+out_err:
|
||||||
|
+ stmt_free(stmt);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void netlink_parse_redir(struct netlink_parse_ctx *ctx,
|
||||||
|
const struct location *loc,
|
||||||
|
const struct nftnl_expr *nle)
|
||||||
|
@@ -1787,6 +1834,7 @@ static const struct expr_handler netlink_parsers[] = {
|
||||||
|
{ .name = "tproxy", .parse = netlink_parse_tproxy },
|
||||||
|
{ .name = "notrack", .parse = netlink_parse_notrack },
|
||||||
|
{ .name = "masq", .parse = netlink_parse_masq },
|
||||||
|
+ { .name = "fullcone", .parse = netlink_parse_fullcone },
|
||||||
|
{ .name = "redir", .parse = netlink_parse_redir },
|
||||||
|
{ .name = "dup", .parse = netlink_parse_dup },
|
||||||
|
{ .name = "queue", .parse = netlink_parse_queue },
|
||||||
|
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
|
||||||
|
index c8bbcb7..505eafa 100644
|
||||||
|
--- a/src/netlink_linearize.c
|
||||||
|
+++ b/src/netlink_linearize.c
|
||||||
|
@@ -1140,6 +1140,13 @@ static void netlink_gen_nat_stmt(struct netlink_linearize_ctx *ctx,
|
||||||
|
nftnl_reg_pmin = NFTNL_EXPR_MASQ_REG_PROTO_MIN;
|
||||||
|
nftnl_reg_pmax = NFTNL_EXPR_MASQ_REG_PROTO_MAX;
|
||||||
|
break;
|
||||||
|
+ case NFT_NAT_FULLCONE:
|
||||||
|
+ nle = alloc_nft_expr("fullcone");
|
||||||
|
+
|
||||||
|
+ nftnl_flag_attr = NFTNL_EXPR_FULLCONE_FLAGS;
|
||||||
|
+ nftnl_reg_pmin = NFTNL_EXPR_FULLCONE_REG_PROTO_MIN;
|
||||||
|
+ nftnl_reg_pmax = NFTNL_EXPR_FULLCONE_REG_PROTO_MAX;
|
||||||
|
+ break;
|
||||||
|
case NFT_NAT_REDIR:
|
||||||
|
nle = alloc_nft_expr("redir");
|
||||||
|
|
||||||
|
diff --git a/src/parser_bison.y b/src/parser_bison.y
|
||||||
|
index ca5c488..ec9fc9b 100644
|
||||||
|
--- a/src/parser_bison.y
|
||||||
|
+++ b/src/parser_bison.y
|
||||||
|
@@ -571,6 +571,7 @@ int nft_lex(void *, void *, void *);
|
||||||
|
%token SNAT "snat"
|
||||||
|
%token DNAT "dnat"
|
||||||
|
%token MASQUERADE "masquerade"
|
||||||
|
+%token FULLCONE "fullcone"
|
||||||
|
%token REDIRECT "redirect"
|
||||||
|
%token RANDOM "random"
|
||||||
|
%token FULLY_RANDOM "fully-random"
|
||||||
|
@@ -703,8 +704,8 @@ int nft_lex(void *, void *, void *);
|
||||||
|
%type <val> limit_burst_pkts limit_burst_bytes limit_mode limit_bytes time_unit quota_mode
|
||||||
|
%type <stmt> reject_stmt reject_stmt_alloc
|
||||||
|
%destructor { stmt_free($$); } reject_stmt reject_stmt_alloc
|
||||||
|
-%type <stmt> nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc redir_stmt redir_stmt_alloc
|
||||||
|
-%destructor { stmt_free($$); } nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc redir_stmt redir_stmt_alloc
|
||||||
|
+%type <stmt> nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc fullcone_stmt fullcone_stmt_alloc redir_stmt redir_stmt_alloc
|
||||||
|
+%destructor { stmt_free($$); } nat_stmt nat_stmt_alloc masq_stmt masq_stmt_alloc fullcone_stmt fullcone_stmt_alloc redir_stmt redir_stmt_alloc
|
||||||
|
%type <val> nf_nat_flags nf_nat_flag offset_opt
|
||||||
|
%type <stmt> tproxy_stmt
|
||||||
|
%destructor { stmt_free($$); } tproxy_stmt
|
||||||
|
@@ -2853,6 +2854,7 @@ stmt : verdict_stmt
|
||||||
|
| queue_stmt
|
||||||
|
| ct_stmt
|
||||||
|
| masq_stmt close_scope_nat
|
||||||
|
+ | fullcone_stmt close_scope_nat
|
||||||
|
| redir_stmt close_scope_nat
|
||||||
|
| dup_stmt close_scope_dup
|
||||||
|
| fwd_stmt close_scope_fwd
|
||||||
|
@@ -3753,6 +3755,28 @@ masq_stmt_args : TO COLON stmt_expr
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
+fullcone_stmt : fullcone_stmt_alloc fullcone_stmt_args
|
||||||
|
+ | fullcone_stmt_alloc
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+fullcone_stmt_alloc : FULLCONE { $$ = nat_stmt_alloc(&@$, NFT_NAT_FULLCONE); }
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+fullcone_stmt_args : TO COLON stmt_expr
|
||||||
|
+ {
|
||||||
|
+ $<stmt>0->nat.proto = $3;
|
||||||
|
+ }
|
||||||
|
+ | TO COLON stmt_expr nf_nat_flags
|
||||||
|
+ {
|
||||||
|
+ $<stmt>0->nat.proto = $3;
|
||||||
|
+ $<stmt>0->nat.flags = $4;
|
||||||
|
+ }
|
||||||
|
+ | nf_nat_flags
|
||||||
|
+ {
|
||||||
|
+ $<stmt>0->nat.flags = $1;
|
||||||
|
+ }
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
redir_stmt : redir_stmt_alloc redir_stmt_arg
|
||||||
|
| redir_stmt_alloc
|
||||||
|
;
|
||||||
|
diff --git a/src/scanner.l b/src/scanner.l
|
||||||
|
index 2154281..c389860 100644
|
||||||
|
--- a/src/scanner.l
|
||||||
|
+++ b/src/scanner.l
|
||||||
|
@@ -453,6 +453,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
|
||||||
|
"snat" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return SNAT; }
|
||||||
|
"dnat" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return DNAT; }
|
||||||
|
"masquerade" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return MASQUERADE; }
|
||||||
|
+"fullcone" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return FULLCONE; }
|
||||||
|
"redirect" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_NAT); return REDIRECT; }
|
||||||
|
"random" { return RANDOM; }
|
||||||
|
<SCANSTATE_STMT_NAT>{
|
||||||
|
diff --git a/src/statement.c b/src/statement.c
|
||||||
|
index 30caf9c..f4866c2 100644
|
||||||
|
--- a/src/statement.c
|
||||||
|
+++ b/src/statement.c
|
||||||
|
@@ -650,6 +650,7 @@ const char *nat_etype2str(enum nft_nat_etypes type)
|
||||||
|
[NFT_NAT_SNAT] = "snat",
|
||||||
|
[NFT_NAT_DNAT] = "dnat",
|
||||||
|
[NFT_NAT_MASQ] = "masquerade",
|
||||||
|
+ [NFT_NAT_FULLCONE] = "fullcone",
|
||||||
|
[NFT_NAT_REDIR] = "redirect",
|
||||||
|
};
|
||||||
|
|
8170
6.7/target/linux/generic/config-6.7
Normal file
8170
6.7/target/linux/generic/config-6.7
Normal file
File diff suppressed because it is too large
Load diff
571
6.7/target/linux/generic/files/drivers/net/phy/swconfig_leds.c
Normal file
571
6.7/target/linux/generic/files/drivers/net/phy/swconfig_leds.c
Normal file
|
@ -0,0 +1,571 @@
|
||||||
|
/*
|
||||||
|
* swconfig_led.c: LED trigger support for the switch configuration API
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SWCONFIG_LEDS
|
||||||
|
|
||||||
|
#include <linux/leds.h>
|
||||||
|
#include <linux/ctype.h>
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/workqueue.h>
|
||||||
|
|
||||||
|
#define SWCONFIG_LED_TIMER_INTERVAL (HZ / 10)
|
||||||
|
#define SWCONFIG_LED_NUM_PORTS 32
|
||||||
|
|
||||||
|
#define SWCONFIG_LED_PORT_SPEED_NA 0x01 /* unknown speed */
|
||||||
|
#define SWCONFIG_LED_PORT_SPEED_10 0x02 /* 10 Mbps */
|
||||||
|
#define SWCONFIG_LED_PORT_SPEED_100 0x04 /* 100 Mbps */
|
||||||
|
#define SWCONFIG_LED_PORT_SPEED_1000 0x08 /* 1000 Mbps */
|
||||||
|
#define SWCONFIG_LED_PORT_SPEED_ALL (SWCONFIG_LED_PORT_SPEED_NA | \
|
||||||
|
SWCONFIG_LED_PORT_SPEED_10 | \
|
||||||
|
SWCONFIG_LED_PORT_SPEED_100 | \
|
||||||
|
SWCONFIG_LED_PORT_SPEED_1000)
|
||||||
|
|
||||||
|
#define SWCONFIG_LED_MODE_LINK 0x01
|
||||||
|
#define SWCONFIG_LED_MODE_TX 0x02
|
||||||
|
#define SWCONFIG_LED_MODE_RX 0x04
|
||||||
|
#define SWCONFIG_LED_MODE_TXRX (SWCONFIG_LED_MODE_TX | \
|
||||||
|
SWCONFIG_LED_MODE_RX)
|
||||||
|
#define SWCONFIG_LED_MODE_ALL (SWCONFIG_LED_MODE_LINK | \
|
||||||
|
SWCONFIG_LED_MODE_TX | \
|
||||||
|
SWCONFIG_LED_MODE_RX)
|
||||||
|
|
||||||
|
struct switch_led_trigger {
|
||||||
|
struct led_trigger trig;
|
||||||
|
struct switch_dev *swdev;
|
||||||
|
|
||||||
|
struct delayed_work sw_led_work;
|
||||||
|
u32 port_mask;
|
||||||
|
u32 port_link;
|
||||||
|
unsigned long long port_tx_traffic[SWCONFIG_LED_NUM_PORTS];
|
||||||
|
unsigned long long port_rx_traffic[SWCONFIG_LED_NUM_PORTS];
|
||||||
|
u8 link_speed[SWCONFIG_LED_NUM_PORTS];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct swconfig_trig_data {
|
||||||
|
struct led_classdev *led_cdev;
|
||||||
|
struct switch_dev *swdev;
|
||||||
|
|
||||||
|
rwlock_t lock;
|
||||||
|
u32 port_mask;
|
||||||
|
|
||||||
|
bool prev_link;
|
||||||
|
unsigned long prev_traffic;
|
||||||
|
enum led_brightness prev_brightness;
|
||||||
|
u8 mode;
|
||||||
|
u8 speed_mask;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
swconfig_trig_set_brightness(struct swconfig_trig_data *trig_data,
|
||||||
|
enum led_brightness brightness)
|
||||||
|
{
|
||||||
|
led_set_brightness(trig_data->led_cdev, brightness);
|
||||||
|
trig_data->prev_brightness = brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
swconfig_trig_update_port_mask(struct led_trigger *trigger)
|
||||||
|
{
|
||||||
|
struct list_head *entry;
|
||||||
|
struct switch_led_trigger *sw_trig;
|
||||||
|
u32 port_mask;
|
||||||
|
|
||||||
|
if (!trigger)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sw_trig = (void *) trigger;
|
||||||
|
|
||||||
|
port_mask = 0;
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
||||||
|
spin_lock(&trigger->leddev_list_lock);
|
||||||
|
#else
|
||||||
|
read_lock(&trigger->leddev_list_lock);
|
||||||
|
#endif
|
||||||
|
list_for_each(entry, &trigger->led_cdevs) {
|
||||||
|
struct led_classdev *led_cdev;
|
||||||
|
struct swconfig_trig_data *trig_data;
|
||||||
|
|
||||||
|
led_cdev = list_entry(entry, struct led_classdev, trig_list);
|
||||||
|
trig_data = led_cdev->trigger_data;
|
||||||
|
if (trig_data) {
|
||||||
|
read_lock(&trig_data->lock);
|
||||||
|
port_mask |= trig_data->port_mask;
|
||||||
|
read_unlock(&trig_data->lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
||||||
|
spin_unlock(&trigger->leddev_list_lock);
|
||||||
|
#else
|
||||||
|
read_unlock(&trigger->leddev_list_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sw_trig->port_mask = port_mask;
|
||||||
|
|
||||||
|
if (port_mask)
|
||||||
|
schedule_delayed_work(&sw_trig->sw_led_work,
|
||||||
|
SWCONFIG_LED_TIMER_INTERVAL);
|
||||||
|
else
|
||||||
|
cancel_delayed_work_sync(&sw_trig->sw_led_work);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
swconfig_trig_port_mask_store(struct device *dev, struct device_attribute *attr,
|
||||||
|
const char *buf, size_t size)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct swconfig_trig_data *trig_data = led_cdev->trigger_data;
|
||||||
|
unsigned long port_mask;
|
||||||
|
int ret;
|
||||||
|
bool changed;
|
||||||
|
|
||||||
|
ret = kstrtoul(buf, 0, &port_mask);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
write_lock(&trig_data->lock);
|
||||||
|
changed = (trig_data->port_mask != port_mask);
|
||||||
|
trig_data->port_mask = port_mask;
|
||||||
|
write_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
if (port_mask == 0)
|
||||||
|
swconfig_trig_set_brightness(trig_data, LED_OFF);
|
||||||
|
|
||||||
|
swconfig_trig_update_port_mask(led_cdev->trigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
swconfig_trig_port_mask_show(struct device *dev, struct device_attribute *attr,
|
||||||
|
char *buf)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct swconfig_trig_data *trig_data = led_cdev->trigger_data;
|
||||||
|
u32 port_mask;
|
||||||
|
|
||||||
|
read_lock(&trig_data->lock);
|
||||||
|
port_mask = trig_data->port_mask;
|
||||||
|
read_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
sprintf(buf, "%#x\n", port_mask);
|
||||||
|
|
||||||
|
return strlen(buf) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEVICE_ATTR(port_mask, 0644, swconfig_trig_port_mask_show,
|
||||||
|
swconfig_trig_port_mask_store);
|
||||||
|
|
||||||
|
/* speed_mask file handler - display value */
|
||||||
|
static ssize_t swconfig_trig_speed_mask_show(struct device *dev,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
char *buf)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct swconfig_trig_data *trig_data = led_cdev->trigger_data;
|
||||||
|
u8 speed_mask;
|
||||||
|
|
||||||
|
read_lock(&trig_data->lock);
|
||||||
|
speed_mask = trig_data->speed_mask;
|
||||||
|
read_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
sprintf(buf, "%#x\n", speed_mask);
|
||||||
|
|
||||||
|
return strlen(buf) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* speed_mask file handler - store value */
|
||||||
|
static ssize_t swconfig_trig_speed_mask_store(struct device *dev,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buf, size_t size)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct swconfig_trig_data *trig_data = led_cdev->trigger_data;
|
||||||
|
u8 speed_mask;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = kstrtou8(buf, 0, &speed_mask);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
write_lock(&trig_data->lock);
|
||||||
|
trig_data->speed_mask = speed_mask & SWCONFIG_LED_PORT_SPEED_ALL;
|
||||||
|
write_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* speed_mask special file */
|
||||||
|
static DEVICE_ATTR(speed_mask, 0644, swconfig_trig_speed_mask_show,
|
||||||
|
swconfig_trig_speed_mask_store);
|
||||||
|
|
||||||
|
static ssize_t swconfig_trig_mode_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct swconfig_trig_data *trig_data = led_cdev->trigger_data;
|
||||||
|
u8 mode;
|
||||||
|
|
||||||
|
read_lock(&trig_data->lock);
|
||||||
|
mode = trig_data->mode;
|
||||||
|
read_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
if (mode == 0) {
|
||||||
|
strcpy(buf, "none\n");
|
||||||
|
} else {
|
||||||
|
if (mode & SWCONFIG_LED_MODE_LINK)
|
||||||
|
strcat(buf, "link ");
|
||||||
|
if (mode & SWCONFIG_LED_MODE_TX)
|
||||||
|
strcat(buf, "tx ");
|
||||||
|
if (mode & SWCONFIG_LED_MODE_RX)
|
||||||
|
strcat(buf, "rx ");
|
||||||
|
strcat(buf, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return strlen(buf)+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t swconfig_trig_mode_store(struct device *dev,
|
||||||
|
struct device_attribute *attr, const char *buf, size_t size)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct swconfig_trig_data *trig_data = led_cdev->trigger_data;
|
||||||
|
char copybuf[128];
|
||||||
|
int new_mode = -1;
|
||||||
|
char *p, *token;
|
||||||
|
|
||||||
|
/* take a copy since we don't want to trash the inbound buffer when using strsep */
|
||||||
|
strncpy(copybuf, buf, sizeof(copybuf));
|
||||||
|
copybuf[sizeof(copybuf) - 1] = 0;
|
||||||
|
p = copybuf;
|
||||||
|
|
||||||
|
while ((token = strsep(&p, " \t\n")) != NULL) {
|
||||||
|
if (!*token)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (new_mode < 0)
|
||||||
|
new_mode = 0;
|
||||||
|
|
||||||
|
if (!strcmp(token, "none"))
|
||||||
|
new_mode = 0;
|
||||||
|
else if (!strcmp(token, "tx"))
|
||||||
|
new_mode |= SWCONFIG_LED_MODE_TX;
|
||||||
|
else if (!strcmp(token, "rx"))
|
||||||
|
new_mode |= SWCONFIG_LED_MODE_RX;
|
||||||
|
else if (!strcmp(token, "link"))
|
||||||
|
new_mode |= SWCONFIG_LED_MODE_LINK;
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new_mode < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
write_lock(&trig_data->lock);
|
||||||
|
trig_data->mode = (u8)new_mode;
|
||||||
|
write_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mode special file */
|
||||||
|
static DEVICE_ATTR(mode, 0644, swconfig_trig_mode_show,
|
||||||
|
swconfig_trig_mode_store);
|
||||||
|
|
||||||
|
static int
|
||||||
|
swconfig_trig_activate(struct led_classdev *led_cdev)
|
||||||
|
{
|
||||||
|
struct switch_led_trigger *sw_trig;
|
||||||
|
struct swconfig_trig_data *trig_data;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
trig_data = kzalloc(sizeof(struct swconfig_trig_data), GFP_KERNEL);
|
||||||
|
if (!trig_data)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
sw_trig = (void *) led_cdev->trigger;
|
||||||
|
|
||||||
|
rwlock_init(&trig_data->lock);
|
||||||
|
trig_data->led_cdev = led_cdev;
|
||||||
|
trig_data->swdev = sw_trig->swdev;
|
||||||
|
trig_data->speed_mask = SWCONFIG_LED_PORT_SPEED_ALL;
|
||||||
|
trig_data->mode = SWCONFIG_LED_MODE_ALL;
|
||||||
|
led_cdev->trigger_data = trig_data;
|
||||||
|
|
||||||
|
err = device_create_file(led_cdev->dev, &dev_attr_port_mask);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
err = device_create_file(led_cdev->dev, &dev_attr_speed_mask);
|
||||||
|
if (err)
|
||||||
|
goto err_dev_free;
|
||||||
|
|
||||||
|
err = device_create_file(led_cdev->dev, &dev_attr_mode);
|
||||||
|
if (err)
|
||||||
|
goto err_mode_free;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_mode_free:
|
||||||
|
device_remove_file(led_cdev->dev, &dev_attr_speed_mask);
|
||||||
|
|
||||||
|
err_dev_free:
|
||||||
|
device_remove_file(led_cdev->dev, &dev_attr_port_mask);
|
||||||
|
|
||||||
|
err_free:
|
||||||
|
led_cdev->trigger_data = NULL;
|
||||||
|
kfree(trig_data);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
swconfig_trig_deactivate(struct led_classdev *led_cdev)
|
||||||
|
{
|
||||||
|
struct swconfig_trig_data *trig_data;
|
||||||
|
|
||||||
|
swconfig_trig_update_port_mask(led_cdev->trigger);
|
||||||
|
|
||||||
|
trig_data = (void *) led_cdev->trigger_data;
|
||||||
|
if (trig_data) {
|
||||||
|
device_remove_file(led_cdev->dev, &dev_attr_port_mask);
|
||||||
|
device_remove_file(led_cdev->dev, &dev_attr_speed_mask);
|
||||||
|
device_remove_file(led_cdev->dev, &dev_attr_mode);
|
||||||
|
kfree(trig_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* link off -> led off (can't be any other reason to turn it on)
|
||||||
|
* link on:
|
||||||
|
* mode link: led on by default only if speed matches, else off
|
||||||
|
* mode txrx: blink only if speed matches, else off
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
swconfig_trig_led_event(struct switch_led_trigger *sw_trig,
|
||||||
|
struct led_classdev *led_cdev)
|
||||||
|
{
|
||||||
|
struct swconfig_trig_data *trig_data;
|
||||||
|
u32 port_mask;
|
||||||
|
bool link;
|
||||||
|
u8 speed_mask, mode;
|
||||||
|
enum led_brightness led_base, led_blink;
|
||||||
|
|
||||||
|
trig_data = led_cdev->trigger_data;
|
||||||
|
if (!trig_data)
|
||||||
|
return;
|
||||||
|
|
||||||
|
read_lock(&trig_data->lock);
|
||||||
|
port_mask = trig_data->port_mask;
|
||||||
|
speed_mask = trig_data->speed_mask;
|
||||||
|
mode = trig_data->mode;
|
||||||
|
read_unlock(&trig_data->lock);
|
||||||
|
|
||||||
|
link = !!(sw_trig->port_link & port_mask);
|
||||||
|
if (!link) {
|
||||||
|
if (trig_data->prev_brightness != LED_OFF)
|
||||||
|
swconfig_trig_set_brightness(trig_data, LED_OFF); /* and stop */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
unsigned long traffic;
|
||||||
|
int speedok; /* link speed flag */
|
||||||
|
int i;
|
||||||
|
|
||||||
|
led_base = LED_FULL;
|
||||||
|
led_blink = LED_OFF;
|
||||||
|
traffic = 0;
|
||||||
|
speedok = 0;
|
||||||
|
for (i = 0; i < SWCONFIG_LED_NUM_PORTS; i++) {
|
||||||
|
if (port_mask & (1 << i)) {
|
||||||
|
if (sw_trig->link_speed[i] & speed_mask) {
|
||||||
|
traffic += ((mode & SWCONFIG_LED_MODE_TX) ?
|
||||||
|
sw_trig->port_tx_traffic[i] : 0) +
|
||||||
|
((mode & SWCONFIG_LED_MODE_RX) ?
|
||||||
|
sw_trig->port_rx_traffic[i] : 0);
|
||||||
|
speedok = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (speedok) {
|
||||||
|
/* At least one port speed matches speed_mask */
|
||||||
|
if (!(mode & SWCONFIG_LED_MODE_LINK)) {
|
||||||
|
led_base = LED_OFF;
|
||||||
|
led_blink = LED_FULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trig_data->prev_brightness != led_base)
|
||||||
|
swconfig_trig_set_brightness(trig_data,
|
||||||
|
led_base);
|
||||||
|
else if (traffic != trig_data->prev_traffic)
|
||||||
|
swconfig_trig_set_brightness(trig_data,
|
||||||
|
led_blink);
|
||||||
|
} else if (trig_data->prev_brightness != LED_OFF)
|
||||||
|
swconfig_trig_set_brightness(trig_data, LED_OFF);
|
||||||
|
|
||||||
|
trig_data->prev_traffic = traffic;
|
||||||
|
}
|
||||||
|
|
||||||
|
trig_data->prev_link = link;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
swconfig_trig_update_leds(struct switch_led_trigger *sw_trig)
|
||||||
|
{
|
||||||
|
struct list_head *entry;
|
||||||
|
struct led_trigger *trigger;
|
||||||
|
|
||||||
|
trigger = &sw_trig->trig;
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
||||||
|
spin_lock(&trigger->leddev_list_lock);
|
||||||
|
#else
|
||||||
|
read_lock(&trigger->leddev_list_lock);
|
||||||
|
#endif
|
||||||
|
list_for_each(entry, &trigger->led_cdevs) {
|
||||||
|
struct led_classdev *led_cdev;
|
||||||
|
|
||||||
|
led_cdev = list_entry(entry, struct led_classdev, trig_list);
|
||||||
|
swconfig_trig_led_event(sw_trig, led_cdev);
|
||||||
|
}
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
||||||
|
spin_unlock(&trigger->leddev_list_lock);
|
||||||
|
#else
|
||||||
|
read_unlock(&trigger->leddev_list_lock);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
swconfig_led_work_func(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct switch_led_trigger *sw_trig;
|
||||||
|
struct switch_dev *swdev;
|
||||||
|
u32 port_mask;
|
||||||
|
u32 link;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sw_trig = container_of(work, struct switch_led_trigger,
|
||||||
|
sw_led_work.work);
|
||||||
|
|
||||||
|
port_mask = sw_trig->port_mask;
|
||||||
|
swdev = sw_trig->swdev;
|
||||||
|
|
||||||
|
link = 0;
|
||||||
|
for (i = 0; i < SWCONFIG_LED_NUM_PORTS; i++) {
|
||||||
|
u32 port_bit;
|
||||||
|
|
||||||
|
sw_trig->link_speed[i] = 0;
|
||||||
|
|
||||||
|
port_bit = BIT(i);
|
||||||
|
if ((port_mask & port_bit) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (swdev->ops->get_port_link) {
|
||||||
|
struct switch_port_link port_link;
|
||||||
|
|
||||||
|
memset(&port_link, '\0', sizeof(port_link));
|
||||||
|
swdev->ops->get_port_link(swdev, i, &port_link);
|
||||||
|
|
||||||
|
if (port_link.link) {
|
||||||
|
link |= port_bit;
|
||||||
|
switch (port_link.speed) {
|
||||||
|
case SWITCH_PORT_SPEED_UNKNOWN:
|
||||||
|
sw_trig->link_speed[i] =
|
||||||
|
SWCONFIG_LED_PORT_SPEED_NA;
|
||||||
|
break;
|
||||||
|
case SWITCH_PORT_SPEED_10:
|
||||||
|
sw_trig->link_speed[i] =
|
||||||
|
SWCONFIG_LED_PORT_SPEED_10;
|
||||||
|
break;
|
||||||
|
case SWITCH_PORT_SPEED_100:
|
||||||
|
sw_trig->link_speed[i] =
|
||||||
|
SWCONFIG_LED_PORT_SPEED_100;
|
||||||
|
break;
|
||||||
|
case SWITCH_PORT_SPEED_1000:
|
||||||
|
sw_trig->link_speed[i] =
|
||||||
|
SWCONFIG_LED_PORT_SPEED_1000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swdev->ops->get_port_stats) {
|
||||||
|
struct switch_port_stats port_stats;
|
||||||
|
|
||||||
|
memset(&port_stats, '\0', sizeof(port_stats));
|
||||||
|
swdev->ops->get_port_stats(swdev, i, &port_stats);
|
||||||
|
sw_trig->port_tx_traffic[i] = port_stats.tx_bytes;
|
||||||
|
sw_trig->port_rx_traffic[i] = port_stats.rx_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sw_trig->port_link = link;
|
||||||
|
|
||||||
|
swconfig_trig_update_leds(sw_trig);
|
||||||
|
|
||||||
|
schedule_delayed_work(&sw_trig->sw_led_work,
|
||||||
|
SWCONFIG_LED_TIMER_INTERVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
swconfig_create_led_trigger(struct switch_dev *swdev)
|
||||||
|
{
|
||||||
|
struct switch_led_trigger *sw_trig;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (!swdev->ops->get_port_link)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
sw_trig = kzalloc(sizeof(struct switch_led_trigger), GFP_KERNEL);
|
||||||
|
if (!sw_trig)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
sw_trig->swdev = swdev;
|
||||||
|
sw_trig->trig.name = swdev->devname;
|
||||||
|
sw_trig->trig.activate = swconfig_trig_activate;
|
||||||
|
sw_trig->trig.deactivate = swconfig_trig_deactivate;
|
||||||
|
|
||||||
|
INIT_DELAYED_WORK(&sw_trig->sw_led_work, swconfig_led_work_func);
|
||||||
|
|
||||||
|
err = led_trigger_register(&sw_trig->trig);
|
||||||
|
if (err)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
swdev->led_trigger = sw_trig;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_free:
|
||||||
|
kfree(sw_trig);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
swconfig_destroy_led_trigger(struct switch_dev *swdev)
|
||||||
|
{
|
||||||
|
struct switch_led_trigger *sw_trig;
|
||||||
|
|
||||||
|
sw_trig = swdev->led_trigger;
|
||||||
|
if (sw_trig) {
|
||||||
|
cancel_delayed_work_sync(&sw_trig->sw_led_work);
|
||||||
|
led_trigger_unregister(&sw_trig->trig);
|
||||||
|
kfree(sw_trig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* SWCONFIG_LEDS */
|
||||||
|
static inline int
|
||||||
|
swconfig_create_led_trigger(struct switch_dev *swdev) { return 0; }
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
swconfig_destroy_led_trigger(struct switch_dev *swdev) { }
|
||||||
|
#endif /* CONFIG_SWCONFIG_LEDS */
|
210
6.7/target/linux/generic/hack-6.7/204-module_strip.patch
Normal file
210
6.7/target/linux/generic/hack-6.7/204-module_strip.patch
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
From a779a482fb9b9f8fcdf8b2519c789b4b9bb5dd05 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Fri, 7 Jul 2017 16:56:48 +0200
|
||||||
|
Subject: build: add a hack for removing non-essential module info
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
include/linux/module.h | 13 ++++++++-----
|
||||||
|
include/linux/moduleparam.h | 15 ++++++++++++---
|
||||||
|
init/Kconfig | 7 +++++++
|
||||||
|
kernel/module.c | 5 ++++-
|
||||||
|
scripts/mod/modpost.c | 12 ++++++++++++
|
||||||
|
5 files changed, 43 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
--- a/include/linux/module.h
|
||||||
|
+++ b/include/linux/module.h
|
||||||
|
@@ -163,6 +163,7 @@ extern void cleanup_module(void);
|
||||||
|
|
||||||
|
/* Generic info of form tag = "info" */
|
||||||
|
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
|
||||||
|
+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info)
|
||||||
|
|
||||||
|
/* For userspace: you can also call me... */
|
||||||
|
#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
|
||||||
|
@@ -232,12 +233,12 @@ extern void cleanup_module(void);
|
||||||
|
* Author(s), use "Name <email>" or just "Name", for multiple
|
||||||
|
* authors use multiple MODULE_AUTHOR() statements/lines.
|
||||||
|
*/
|
||||||
|
-#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
|
||||||
|
+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author)
|
||||||
|
|
||||||
|
/* What your module does. */
|
||||||
|
-#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
|
||||||
|
+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description)
|
||||||
|
|
||||||
|
-#ifdef MODULE
|
||||||
|
+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED)
|
||||||
|
/* Creates an alias so file2alias.c can find device table. */
|
||||||
|
#define MODULE_DEVICE_TABLE(type, name) \
|
||||||
|
extern typeof(name) __mod_##type##__##name##_device_table \
|
||||||
|
@@ -264,7 +265,9 @@ extern typeof(name) __mod_##type##__##na
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(MODULE) || !defined(CONFIG_SYSFS)
|
||||||
|
-#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
|
||||||
|
+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version)
|
||||||
|
+#elif defined(CONFIG_MODULE_STRIPPED)
|
||||||
|
+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version)
|
||||||
|
#else
|
||||||
|
#define MODULE_VERSION(_version) \
|
||||||
|
MODULE_INFO(version, _version); \
|
||||||
|
@@ -287,7 +290,7 @@ extern typeof(name) __mod_##type##__##na
|
||||||
|
/* Optional firmware file (or files) needed by the module
|
||||||
|
* format is simply firmware file name. Multiple firmware
|
||||||
|
* files require multiple MODULE_FIRMWARE() specifiers */
|
||||||
|
-#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
|
||||||
|
+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware)
|
||||||
|
|
||||||
|
#define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, __stringify(ns))
|
||||||
|
|
||||||
|
--- a/include/linux/moduleparam.h
|
||||||
|
+++ b/include/linux/moduleparam.h
|
||||||
|
@@ -20,6 +20,16 @@
|
||||||
|
/* Chosen so that structs with an unsigned long line up. */
|
||||||
|
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
|
||||||
|
|
||||||
|
+/* This struct is here for syntactic coherency, it is not used */
|
||||||
|
+#define __MODULE_INFO_DISABLED(name) \
|
||||||
|
+ struct __UNIQUE_ID(name) {}
|
||||||
|
+
|
||||||
|
+#ifdef CONFIG_MODULE_STRIPPED
|
||||||
|
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name)
|
||||||
|
+#else
|
||||||
|
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define __MODULE_INFO(tag, name, info) \
|
||||||
|
static const char __UNIQUE_ID(name)[] \
|
||||||
|
__used __section(".modinfo") __aligned(1) \
|
||||||
|
@@ -31,7 +41,7 @@
|
||||||
|
/* One for each parameter, describing how to use it. Some files do
|
||||||
|
multiple of these per line, so can't just use MODULE_INFO. */
|
||||||
|
#define MODULE_PARM_DESC(_parm, desc) \
|
||||||
|
- __MODULE_INFO(parm, _parm, #_parm ":" desc)
|
||||||
|
+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc)
|
||||||
|
|
||||||
|
struct kernel_param;
|
||||||
|
|
||||||
|
--- a/kernel/module/Kconfig
|
||||||
|
+++ b/kernel/module/Kconfig
|
||||||
|
@@ -290,4 +290,11 @@ config MODULES_TREE_LOOKUP
|
||||||
|
def_bool y
|
||||||
|
depends on PERF_EVENTS || TRACING || CFI_CLANG
|
||||||
|
|
||||||
|
+config MODULE_STRIPPED
|
||||||
|
+ bool "Reduce module size"
|
||||||
|
+ depends on MODULES
|
||||||
|
+ help
|
||||||
|
+ Remove module parameter descriptions, author info, version, aliases,
|
||||||
|
+ device tables, etc.
|
||||||
|
+
|
||||||
|
endif # MODULES
|
||||||
|
--- a/kernel/module/main.c
|
||||||
|
+++ b/kernel/module/main.c
|
||||||
|
@@ -988,6 +988,7 @@ size_t modinfo_attrs_count = ARRAY_SIZE(
|
||||||
|
|
||||||
|
static const char vermagic[] = VERMAGIC_STRING;
|
||||||
|
|
||||||
|
+#if defined(CONFIG_MODVERSIONS) || !defined(CONFIG_MODULE_STRIPPED)
|
||||||
|
int try_to_force_load(struct module *mod, const char *reason)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_MODULE_FORCE_LOAD
|
||||||
|
@@ -999,6 +1000,7 @@ int try_to_force_load(struct module *mod
|
||||||
|
return -ENOEXEC;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
static char *get_modinfo(const struct load_info *info, const char *tag);
|
||||||
|
static char *get_next_modinfo(const struct load_info *info, const char *tag,
|
||||||
|
@@ -1958,9 +1960,11 @@ static int setup_load_info(struct load_i
|
||||||
|
|
||||||
|
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
|
||||||
|
{
|
||||||
|
- const char *modmagic = get_modinfo(info, "vermagic");
|
||||||
|
int err;
|
||||||
|
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
+ const char *modmagic = get_modinfo(info, "vermagic");
|
||||||
|
+
|
||||||
|
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
|
||||||
|
modmagic = NULL;
|
||||||
|
|
||||||
|
@@ -1981,6 +1985,7 @@ static int check_modinfo(struct module *
|
||||||
|
mod->name);
|
||||||
|
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
check_modinfo_retpoline(mod, info);
|
||||||
|
|
||||||
|
--- a/scripts/mod/modpost.c
|
||||||
|
+++ b/scripts/mod/modpost.c
|
||||||
|
@@ -1781,7 +1781,9 @@ static void read_symbols(const char *mod
|
||||||
|
symname = remove_dot(info.strtab + sym->st_name);
|
||||||
|
|
||||||
|
handle_symbol(mod, &info, sym, symname);
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
handle_moddevtable(mod, &info, sym, symname);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
||||||
|
@@ -1944,8 +1946,10 @@ static void add_header(struct buffer *b,
|
||||||
|
buf_printf(b, "BUILD_SALT;\n");
|
||||||
|
buf_printf(b, "BUILD_LTO_INFO;\n");
|
||||||
|
buf_printf(b, "\n");
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
|
||||||
|
buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
|
||||||
|
+#endif
|
||||||
|
buf_printf(b, "\n");
|
||||||
|
buf_printf(b, "__visible struct module __this_module\n");
|
||||||
|
buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n");
|
||||||
|
@@ -1959,8 +1963,10 @@ static void add_header(struct buffer *b,
|
||||||
|
buf_printf(b, "\t.arch = MODULE_ARCH_INIT,\n");
|
||||||
|
buf_printf(b, "};\n");
|
||||||
|
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
if (!external_module)
|
||||||
|
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
buf_printf(b,
|
||||||
|
"\n"
|
||||||
|
@@ -1968,8 +1974,10 @@ static void add_header(struct buffer *b,
|
||||||
|
"MODULE_INFO(retpoline, \"Y\");\n"
|
||||||
|
"#endif\n");
|
||||||
|
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
if (strstarts(mod->name, "drivers/staging"))
|
||||||
|
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (strstarts(mod->name, "tools/testing"))
|
||||||
|
buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n");
|
||||||
|
@@ -2065,11 +2073,13 @@ static void add_depends(struct buffer *b
|
||||||
|
|
||||||
|
static void add_srcversion(struct buffer *b, struct module *mod)
|
||||||
|
{
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
if (mod->srcversion[0]) {
|
||||||
|
buf_printf(b, "\n");
|
||||||
|
buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n",
|
||||||
|
mod->srcversion);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void write_buf(struct buffer *b, const char *fname)
|
||||||
|
@@ -2155,7 +2165,9 @@ static void write_mod_c_file(struct modu
|
||||||
|
add_exported_symbols(&buf, mod);
|
||||||
|
add_versions(&buf, mod);
|
||||||
|
add_depends(&buf, mod);
|
||||||
|
+#ifndef CONFIG_MODULE_STRIPPED
|
||||||
|
add_moddevtable(&buf, mod);
|
||||||
|
+#endif
|
||||||
|
add_srcversion(&buf, mod);
|
||||||
|
|
||||||
|
ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name);
|
|
@ -0,0 +1,41 @@
|
||||||
|
From 310e8e04a05d9eb43fa9dd7f00143300afcaa37a Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Bauer <mail@david-bauer.net>
|
||||||
|
Date: Fri, 11 Nov 2022 13:33:44 +0100
|
||||||
|
Subject: [PATCH] kconfig: abort configuration on unset symbol
|
||||||
|
|
||||||
|
When a target configuration has unset Kconfig symbols, the build will
|
||||||
|
fail when OpenWrt is compiled with V=s and stdin is connected to a tty.
|
||||||
|
|
||||||
|
In case OpenWrt is compiled without either of these preconditions, the
|
||||||
|
build will succeed with the symbols in question being unset.
|
||||||
|
|
||||||
|
Modify the kernel configuration in a way it fails on unset symbols
|
||||||
|
regardless of the aforementioned preconditions.
|
||||||
|
|
||||||
|
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||||
|
---
|
||||||
|
scripts/kconfig/conf.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
--- a/scripts/kconfig/conf.c
|
||||||
|
+++ b/scripts/kconfig/conf.c
|
||||||
|
@@ -338,6 +338,9 @@ static int conf_askvalue(struct symbol *
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
default:
|
||||||
|
+ if (!tty_stdio && getenv("FAIL_ON_UNCONFIGURED")) {
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
fflush(stdout);
|
||||||
|
xfgets(line, sizeof(line), stdin);
|
||||||
|
break;
|
||||||
|
@@ -520,6 +523,9 @@ static int conf_choice(struct menu *menu
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
case oldaskconfig:
|
||||||
|
+ if (!tty_stdio && getenv("FAIL_ON_UNCONFIGURED")) {
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
fflush(stdout);
|
||||||
|
xfgets(line, sizeof(line), stdin);
|
||||||
|
strip(line);
|
|
@ -0,0 +1,93 @@
|
||||||
|
From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Fri, 7 Jul 2017 17:03:16 +0200
|
||||||
|
Subject: fix portability of some includes files in tools/ used on the host
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
tools/include/tools/be_byteshift.h | 4 ++++
|
||||||
|
tools/include/tools/le_byteshift.h | 4 ++++
|
||||||
|
tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++
|
||||||
|
3 files changed, 30 insertions(+)
|
||||||
|
create mode 100644 tools/include/tools/linux_types.h
|
||||||
|
|
||||||
|
--- a/tools/include/tools/be_byteshift.h
|
||||||
|
+++ b/tools/include/tools/be_byteshift.h
|
||||||
|
@@ -2,6 +2,10 @@
|
||||||
|
#ifndef _TOOLS_BE_BYTESHIFT_H
|
||||||
|
#define _TOOLS_BE_BYTESHIFT_H
|
||||||
|
|
||||||
|
+#ifndef __linux__
|
||||||
|
+#include "linux_types.h"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
static inline uint16_t __get_unaligned_be16(const uint8_t *p)
|
||||||
|
--- a/tools/include/tools/le_byteshift.h
|
||||||
|
+++ b/tools/include/tools/le_byteshift.h
|
||||||
|
@@ -2,6 +2,10 @@
|
||||||
|
#ifndef _TOOLS_LE_BYTESHIFT_H
|
||||||
|
#define _TOOLS_LE_BYTESHIFT_H
|
||||||
|
|
||||||
|
+#ifndef __linux__
|
||||||
|
+#include "linux_types.h"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
static inline uint16_t __get_unaligned_le16(const uint8_t *p)
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tools/include/tools/linux_types.h
|
||||||
|
@@ -0,0 +1,26 @@
|
||||||
|
+#ifndef __LINUX_TYPES_H
|
||||||
|
+#define __LINUX_TYPES_H
|
||||||
|
+
|
||||||
|
+#include <stdint.h>
|
||||||
|
+
|
||||||
|
+typedef int8_t __s8;
|
||||||
|
+typedef uint8_t __u8;
|
||||||
|
+typedef uint8_t __be8;
|
||||||
|
+typedef uint8_t __le8;
|
||||||
|
+
|
||||||
|
+typedef int16_t __s16;
|
||||||
|
+typedef uint16_t __u16;
|
||||||
|
+typedef uint16_t __be16;
|
||||||
|
+typedef uint16_t __le16;
|
||||||
|
+
|
||||||
|
+typedef int32_t __s32;
|
||||||
|
+typedef uint32_t __u32;
|
||||||
|
+typedef uint32_t __be32;
|
||||||
|
+typedef uint32_t __le32;
|
||||||
|
+
|
||||||
|
+typedef int64_t __s64;
|
||||||
|
+typedef uint64_t __u64;
|
||||||
|
+typedef uint64_t __be64;
|
||||||
|
+typedef uint64_t __le64;
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
--- a/tools/include/linux/types.h
|
||||||
|
+++ b/tools/include/linux/types.h
|
||||||
|
@@ -10,8 +10,12 @@
|
||||||
|
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifndef __linux__
|
||||||
|
+#include <tools/linux_types.h>
|
||||||
|
+#else
|
||||||
|
#include <asm/types.h>
|
||||||
|
#include <asm/posix_types.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
struct page;
|
||||||
|
struct kmem_cache;
|
||||||
|
--- a/tools/perf/pmu-events/jevents.py
|
||||||
|
+++ b/tools/perf/pmu-events/jevents.py
|
||||||
|
@@ -684,6 +684,7 @@ def main() -> None:
|
||||||
|
#include "util/header.h"
|
||||||
|
#include "util/pmu.h"
|
||||||
|
#include <string.h>
|
||||||
|
+#include <strings.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
struct compact_pmu_event {
|
|
@ -0,0 +1,24 @@
|
||||||
|
From be9be95ff10e16a5b4ad36f903978d0cc5747024 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Fri, 7 Jul 2017 17:04:08 +0200
|
||||||
|
Subject: kernel: fix linux/spi/spidev.h portability issues with musl
|
||||||
|
|
||||||
|
Felix will try to get this define included into musl
|
||||||
|
|
||||||
|
lede-commit: 795e7cf60de19e7a076a46874fab7bb88b43bbff
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
include/uapi/linux/spi/spidev.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/include/uapi/linux/spi/spidev.h
|
||||||
|
+++ b/include/uapi/linux/spi/spidev.h
|
||||||
|
@@ -93,7 +93,7 @@ struct spi_ioc_transfer {
|
||||||
|
|
||||||
|
/* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */
|
||||||
|
#define SPI_MSGSIZE(N) \
|
||||||
|
- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \
|
||||||
|
+ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \
|
||||||
|
? ((N)*(sizeof (struct spi_ioc_transfer))) : 0)
|
||||||
|
#define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)])
|
||||||
|
|
123
6.7/target/linux/generic/hack-6.7/220-arm-gc_sections.patch
Normal file
123
6.7/target/linux/generic/hack-6.7/220-arm-gc_sections.patch
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
From e3d8676f5722b7622685581e06e8f53e6138e3ab Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Sat, 15 Jul 2017 23:42:36 +0200
|
||||||
|
Subject: use -ffunction-sections, -fdata-sections and --gc-sections
|
||||||
|
|
||||||
|
In combination with kernel symbol export stripping this significantly reduces
|
||||||
|
the kernel image size. Used on both ARM and MIPS architectures.
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||||
|
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
---
|
||||||
|
--- a/arch/arm/Kconfig
|
||||||
|
+++ b/arch/arm/Kconfig
|
||||||
|
@@ -124,6 +124,7 @@ config ARM
|
||||||
|
select HAVE_VIRT_CPU_ACCOUNTING_GEN
|
||||||
|
select IRQ_FORCED_THREADING
|
||||||
|
select LOCK_MM_AND_FIND_VMA
|
||||||
|
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
|
||||||
|
select MODULES_USE_ELF_REL
|
||||||
|
select NEED_DMA_MAP_STATE
|
||||||
|
select OF_EARLY_FLATTREE if OF
|
||||||
|
--- a/arch/arm/boot/compressed/Makefile
|
||||||
|
+++ b/arch/arm/boot/compressed/Makefile
|
||||||
|
@@ -91,6 +91,7 @@ endif
|
||||||
|
ifeq ($(CONFIG_USE_OF),y)
|
||||||
|
OBJS += $(libfdt_objs) fdt_check_mem_start.o
|
||||||
|
endif
|
||||||
|
+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL))
|
||||||
|
|
||||||
|
OBJS += lib1funcs.o ashldi3.o bswapsdi2.o
|
||||||
|
|
||||||
|
--- a/arch/arm/kernel/vmlinux.lds.S
|
||||||
|
+++ b/arch/arm/kernel/vmlinux.lds.S
|
||||||
|
@@ -75,7 +75,7 @@ SECTIONS
|
||||||
|
. = ALIGN(4);
|
||||||
|
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
|
||||||
|
__start___ex_table = .;
|
||||||
|
- ARM_MMU_KEEP(*(__ex_table))
|
||||||
|
+ KEEP(*(__ex_table))
|
||||||
|
__stop___ex_table = .;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -100,24 +100,24 @@ SECTIONS
|
||||||
|
}
|
||||||
|
.init.arch.info : {
|
||||||
|
__arch_info_begin = .;
|
||||||
|
- *(.arch.info.init)
|
||||||
|
+ KEEP(*(.arch.info.init))
|
||||||
|
__arch_info_end = .;
|
||||||
|
}
|
||||||
|
.init.tagtable : {
|
||||||
|
__tagtable_begin = .;
|
||||||
|
- *(.taglist.init)
|
||||||
|
+ KEEP(*(.taglist.init))
|
||||||
|
__tagtable_end = .;
|
||||||
|
}
|
||||||
|
#ifdef CONFIG_SMP_ON_UP
|
||||||
|
.init.smpalt : {
|
||||||
|
__smpalt_begin = .;
|
||||||
|
- *(.alt.smp.init)
|
||||||
|
+ KEEP(*(.alt.smp.init))
|
||||||
|
__smpalt_end = .;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
.init.pv_table : {
|
||||||
|
__pv_table_begin = .;
|
||||||
|
- *(.pv_table)
|
||||||
|
+ KEEP(*(.pv_table))
|
||||||
|
__pv_table_end = .;
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/arch/arm/include/asm/vmlinux.lds.h
|
||||||
|
+++ b/arch/arm/include/asm/vmlinux.lds.h
|
||||||
|
@@ -42,13 +42,13 @@
|
||||||
|
#define PROC_INFO \
|
||||||
|
. = ALIGN(4); \
|
||||||
|
__proc_info_begin = .; \
|
||||||
|
- *(.proc.info.init) \
|
||||||
|
+ KEEP(*(.proc.info.init)) \
|
||||||
|
__proc_info_end = .;
|
||||||
|
|
||||||
|
#define IDMAP_TEXT \
|
||||||
|
ALIGN_FUNCTION(); \
|
||||||
|
__idmap_text_start = .; \
|
||||||
|
- *(.idmap.text) \
|
||||||
|
+ KEEP(*(.idmap.text)) \
|
||||||
|
__idmap_text_end = .; \
|
||||||
|
|
||||||
|
#define ARM_DISCARD \
|
||||||
|
@@ -109,12 +109,12 @@
|
||||||
|
. = ALIGN(8); \
|
||||||
|
.ARM.unwind_idx : { \
|
||||||
|
__start_unwind_idx = .; \
|
||||||
|
- *(.ARM.exidx*) \
|
||||||
|
+ KEEP(*(.ARM.exidx*)) \
|
||||||
|
__stop_unwind_idx = .; \
|
||||||
|
} \
|
||||||
|
.ARM.unwind_tab : { \
|
||||||
|
__start_unwind_tab = .; \
|
||||||
|
- *(.ARM.extab*) \
|
||||||
|
+ KEEP(*(.ARM.extab*)) \
|
||||||
|
__stop_unwind_tab = .; \
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -126,7 +126,7 @@
|
||||||
|
__vectors_lma = .; \
|
||||||
|
OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \
|
||||||
|
.vectors { \
|
||||||
|
- *(.vectors) \
|
||||||
|
+ KEEP(*(.vectors)) \
|
||||||
|
} \
|
||||||
|
.vectors.bhb.loop8 { \
|
||||||
|
*(.vectors.bhb.loop8) \
|
||||||
|
@@ -144,7 +144,7 @@
|
||||||
|
\
|
||||||
|
__stubs_lma = .; \
|
||||||
|
.stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \
|
||||||
|
- *(.stubs) \
|
||||||
|
+ KEEP(*(.stubs)) \
|
||||||
|
} \
|
||||||
|
ARM_LMA(__stubs, .stubs); \
|
||||||
|
. = __stubs_lma + SIZEOF(.stubs); \
|
|
@ -0,0 +1,38 @@
|
||||||
|
From b3d00b452467f621317953d9e4c6f9ae8dcfd271 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Imre Kaloz <kaloz@openwrt.org>
|
||||||
|
Date: Fri, 7 Jul 2017 17:06:55 +0200
|
||||||
|
Subject: use the openwrt lzma options for now
|
||||||
|
|
||||||
|
lede-commit: 548de949f392049420a6a1feeef118b30ab8ea8c
|
||||||
|
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
||||||
|
---
|
||||||
|
lib/decompress.c | 1 +
|
||||||
|
scripts/Makefile.lib | 2 +-
|
||||||
|
usr/gen_initramfs_list.sh | 10 +++++-----
|
||||||
|
3 files changed, 7 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
--- a/lib/decompress.c
|
||||||
|
+++ b/lib/decompress.c
|
||||||
|
@@ -53,6 +53,7 @@ static const struct compress_format comp
|
||||||
|
{ {0x1f, 0x9e}, "gzip", gunzip },
|
||||||
|
{ {0x42, 0x5a}, "bzip2", bunzip2 },
|
||||||
|
{ {0x5d, 0x00}, "lzma", unlzma },
|
||||||
|
+ { {0x6d, 0x00}, "lzma-openwrt", unlzma },
|
||||||
|
{ {0xfd, 0x37}, "xz", unxz },
|
||||||
|
{ {0x89, 0x4c}, "lzo", unlzo },
|
||||||
|
{ {0x02, 0x21}, "lz4", unlz4 },
|
||||||
|
--- a/scripts/Makefile.lib
|
||||||
|
+++ b/scripts/Makefile.lib
|
||||||
|
@@ -443,10 +443,10 @@ quiet_cmd_bzip2_with_size = BZIP2 $@
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
quiet_cmd_lzma = LZMA $@
|
||||||
|
- cmd_lzma = cat $(real-prereqs) | $(LZMA) -9 > $@
|
||||||
|
+ cmd_lzma = cat $(real-prereqs) | $(LZMA) e -d20 -lc1 -lp2 -pb2 -eos -si -so > $@
|
||||||
|
|
||||||
|
quiet_cmd_lzma_with_size = LZMA $@
|
||||||
|
- cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
|
||||||
|
+ cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) e -d20 -lc1 -lp2 -pb2 -eos -si -so; $(size_append); } > $@
|
||||||
|
|
||||||
|
quiet_cmd_lzo = LZO $@
|
||||||
|
cmd_lzo = cat $(real-prereqs) | $(KLZOP) -9 > $@
|
|
@ -0,0 +1,27 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: hack: net: remove bogus netfilter dependencies
|
||||||
|
|
||||||
|
lede-commit: 589d2a377dee27d206fc3725325309cf649e4df6
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
net/netfilter/Kconfig | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/net/netfilter/Kconfig
|
||||||
|
+++ b/net/netfilter/Kconfig
|
||||||
|
@@ -253,7 +253,6 @@ config NF_CONNTRACK_FTP
|
||||||
|
|
||||||
|
config NF_CONNTRACK_H323
|
||||||
|
tristate "H.323 protocol support"
|
||||||
|
- depends on IPV6 || IPV6=n
|
||||||
|
depends on NETFILTER_ADVANCED
|
||||||
|
help
|
||||||
|
H.323 is a VoIP signalling protocol from ITU-T. As one of the most
|
||||||
|
@@ -1118,7 +1117,6 @@ config NETFILTER_XT_TARGET_SECMARK
|
||||||
|
|
||||||
|
config NETFILTER_XT_TARGET_TCPMSS
|
||||||
|
tristate '"TCPMSS" target support'
|
||||||
|
- depends on IPV6 || IPV6=n
|
||||||
|
default m if NETFILTER_ADVANCED=n
|
||||||
|
help
|
||||||
|
This option adds a `TCPMSS' target, which allows you to alter the
|
210
6.7/target/linux/generic/hack-6.7/251-kconfig.patch
Normal file
210
6.7/target/linux/generic/hack-6.7/251-kconfig.patch
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
From da3c50704f14132f4adf80d48e9a4cd5d46e54c9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Crispin <john@phrozen.org>
|
||||||
|
Date: Fri, 7 Jul 2017 17:09:21 +0200
|
||||||
|
Subject: kconfig: owrt specifc dependencies
|
||||||
|
|
||||||
|
Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
|
---
|
||||||
|
crypto/Kconfig | 10 +++++-----
|
||||||
|
drivers/bcma/Kconfig | 1 +
|
||||||
|
drivers/ssb/Kconfig | 3 ++-
|
||||||
|
lib/Kconfig | 8 ++++----
|
||||||
|
net/netfilter/Kconfig | 2 +-
|
||||||
|
net/wireless/Kconfig | 17 ++++++++++-------
|
||||||
|
sound/core/Kconfig | 4 ++--
|
||||||
|
7 files changed, 25 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
--- a/crypto/Kconfig
|
||||||
|
+++ b/crypto/Kconfig
|
||||||
|
@@ -55,7 +55,7 @@ config CRYPTO_FIPS_VERSION
|
||||||
|
By default the KERNELRELEASE value is used.
|
||||||
|
|
||||||
|
config CRYPTO_ALGAPI
|
||||||
|
- tristate
|
||||||
|
+ tristate "ALGAPI"
|
||||||
|
select CRYPTO_ALGAPI2
|
||||||
|
help
|
||||||
|
This option provides the API for cryptographic algorithms.
|
||||||
|
@@ -64,7 +64,7 @@ config CRYPTO_ALGAPI2
|
||||||
|
tristate
|
||||||
|
|
||||||
|
config CRYPTO_AEAD
|
||||||
|
- tristate
|
||||||
|
+ tristate "AEAD"
|
||||||
|
select CRYPTO_AEAD2
|
||||||
|
select CRYPTO_ALGAPI
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ config CRYPTO_AEAD2
|
||||||
|
select CRYPTO_RNG2
|
||||||
|
|
||||||
|
config CRYPTO_SKCIPHER
|
||||||
|
- tristate
|
||||||
|
+ tristate "SKCIPHER"
|
||||||
|
select CRYPTO_SKCIPHER2
|
||||||
|
select CRYPTO_ALGAPI
|
||||||
|
|
||||||
|
@@ -85,7 +85,7 @@ config CRYPTO_SKCIPHER2
|
||||||
|
select CRYPTO_RNG2
|
||||||
|
|
||||||
|
config CRYPTO_HASH
|
||||||
|
- tristate
|
||||||
|
+ tristate "HASH"
|
||||||
|
select CRYPTO_HASH2
|
||||||
|
select CRYPTO_ALGAPI
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ config CRYPTO_HASH2
|
||||||
|
select CRYPTO_ALGAPI2
|
||||||
|
|
||||||
|
config CRYPTO_RNG
|
||||||
|
- tristate
|
||||||
|
+ tristate "RNG"
|
||||||
|
select CRYPTO_RNG2
|
||||||
|
select CRYPTO_ALGAPI
|
||||||
|
|
||||||
|
--- a/drivers/bcma/Kconfig
|
||||||
|
+++ b/drivers/bcma/Kconfig
|
||||||
|
@@ -16,6 +16,7 @@ if BCMA
|
||||||
|
# Support for Block-I/O. SELECT this from the driver that needs it.
|
||||||
|
config BCMA_BLOCKIO
|
||||||
|
bool
|
||||||
|
+ default y
|
||||||
|
|
||||||
|
config BCMA_HOST_PCI_POSSIBLE
|
||||||
|
bool
|
||||||
|
--- a/drivers/ssb/Kconfig
|
||||||
|
+++ b/drivers/ssb/Kconfig
|
||||||
|
@@ -29,6 +29,7 @@ config SSB_SPROM
|
||||||
|
config SSB_BLOCKIO
|
||||||
|
bool
|
||||||
|
depends on SSB
|
||||||
|
+ default y
|
||||||
|
|
||||||
|
config SSB_PCIHOST_POSSIBLE
|
||||||
|
bool
|
||||||
|
@@ -49,7 +50,7 @@ config SSB_PCIHOST
|
||||||
|
config SSB_B43_PCI_BRIDGE
|
||||||
|
bool
|
||||||
|
depends on SSB_PCIHOST
|
||||||
|
- default n
|
||||||
|
+ default y
|
||||||
|
|
||||||
|
config SSB_PCMCIAHOST_POSSIBLE
|
||||||
|
bool
|
||||||
|
--- a/lib/Kconfig
|
||||||
|
+++ b/lib/Kconfig
|
||||||
|
@@ -457,16 +457,16 @@ config BCH_CONST_T
|
||||||
|
# Textsearch support is select'ed if needed
|
||||||
|
#
|
||||||
|
config TEXTSEARCH
|
||||||
|
- bool
|
||||||
|
+ bool "Textsearch support"
|
||||||
|
|
||||||
|
config TEXTSEARCH_KMP
|
||||||
|
- tristate
|
||||||
|
+ tristate "Textsearch KMP"
|
||||||
|
|
||||||
|
config TEXTSEARCH_BM
|
||||||
|
- tristate
|
||||||
|
+ tristate "Textsearch BM"
|
||||||
|
|
||||||
|
config TEXTSEARCH_FSM
|
||||||
|
- tristate
|
||||||
|
+ tristate "Textsearch FSM"
|
||||||
|
|
||||||
|
config BTREE
|
||||||
|
bool
|
||||||
|
--- a/net/netfilter/Kconfig
|
||||||
|
+++ b/net/netfilter/Kconfig
|
||||||
|
@@ -22,7 +22,7 @@ config NETFILTER_SKIP_EGRESS
|
||||||
|
def_bool NETFILTER_EGRESS && (NET_CLS_ACT || IFB)
|
||||||
|
|
||||||
|
config NETFILTER_NETLINK
|
||||||
|
- tristate
|
||||||
|
+ tristate "Netfilter NFNETLINK interface"
|
||||||
|
|
||||||
|
config NETFILTER_FAMILY_BRIDGE
|
||||||
|
bool
|
||||||
|
--- a/net/wireless/Kconfig
|
||||||
|
+++ b/net/wireless/Kconfig
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
config WIRELESS_EXT
|
||||||
|
- bool
|
||||||
|
+ bool "Wireless extensions"
|
||||||
|
|
||||||
|
config WEXT_CORE
|
||||||
|
def_bool y
|
||||||
|
@@ -12,10 +12,10 @@ config WEXT_PROC
|
||||||
|
depends on WEXT_CORE
|
||||||
|
|
||||||
|
config WEXT_SPY
|
||||||
|
- bool
|
||||||
|
+ bool "WEXT_SPY"
|
||||||
|
|
||||||
|
config WEXT_PRIV
|
||||||
|
- bool
|
||||||
|
+ bool "WEXT_PRIV"
|
||||||
|
|
||||||
|
config CFG80211
|
||||||
|
tristate "cfg80211 - wireless configuration API"
|
||||||
|
@@ -208,7 +208,7 @@ config CFG80211_WEXT_EXPORT
|
||||||
|
endif # CFG80211
|
||||||
|
|
||||||
|
config LIB80211
|
||||||
|
- tristate
|
||||||
|
+ tristate "LIB80211"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
This options enables a library of common routines used
|
||||||
|
@@ -217,17 +217,17 @@ config LIB80211
|
||||||
|
Drivers should select this themselves if needed.
|
||||||
|
|
||||||
|
config LIB80211_CRYPT_WEP
|
||||||
|
- tristate
|
||||||
|
+ tristate "LIB80211_CRYPT_WEP"
|
||||||
|
select CRYPTO_LIB_ARC4
|
||||||
|
|
||||||
|
config LIB80211_CRYPT_CCMP
|
||||||
|
- tristate
|
||||||
|
+ tristate "LIB80211_CRYPT_CCMP"
|
||||||
|
select CRYPTO
|
||||||
|
select CRYPTO_AES
|
||||||
|
select CRYPTO_CCM
|
||||||
|
|
||||||
|
config LIB80211_CRYPT_TKIP
|
||||||
|
- tristate
|
||||||
|
+ tristate "LIB80211_CRYPT_TKIP"
|
||||||
|
select CRYPTO_LIB_ARC4
|
||||||
|
|
||||||
|
config LIB80211_DEBUG
|
||||||
|
--- a/sound/core/Kconfig
|
||||||
|
+++ b/sound/core/Kconfig
|
||||||
|
@@ -17,7 +17,7 @@ config SND_DMAENGINE_PCM
|
||||||
|
tristate
|
||||||
|
|
||||||
|
config SND_HWDEP
|
||||||
|
- tristate
|
||||||
|
+ tristate "Sound hardware support"
|
||||||
|
|
||||||
|
config SND_SEQ_DEVICE
|
||||||
|
tristate
|
||||||
|
@@ -27,7 +27,7 @@ config SND_RAWMIDI
|
||||||
|
select SND_SEQ_DEVICE if SND_SEQUENCER != n
|
||||||
|
|
||||||
|
config SND_COMPRESS_OFFLOAD
|
||||||
|
- tristate
|
||||||
|
+ tristate "Compression offloading support"
|
||||||
|
|
||||||
|
config SND_JACK
|
||||||
|
bool
|
||||||
|
--- a/net/Kconfig
|
||||||
|
+++ b/net/Kconfig
|
||||||
|
@@ -430,7 +430,7 @@ config NET_DEVLINK
|
||||||
|
default n
|
||||||
|
|
||||||
|
config PAGE_POOL
|
||||||
|
- bool
|
||||||
|
+ bool "Page pool support"
|
||||||
|
|
||||||
|
config PAGE_POOL_STATS
|
||||||
|
default n
|
32
6.7/target/linux/generic/hack-6.7/253-ksmbd-config.patch
Normal file
32
6.7/target/linux/generic/hack-6.7/253-ksmbd-config.patch
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
From dcd966fa7ca63f38cf7147e1184d13d66e2ca340 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:33:30 +0200
|
||||||
|
Subject: [PATCH] Kconfig: add tristate for OID and ASNI string
|
||||||
|
|
||||||
|
---
|
||||||
|
init/Kconfig | 2 +-
|
||||||
|
lib/Kconfig | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/init/Kconfig
|
||||||
|
+++ b/init/Kconfig
|
||||||
|
@@ -2004,7 +2004,7 @@ config PADATA
|
||||||
|
bool
|
||||||
|
|
||||||
|
config ASN1
|
||||||
|
- tristate
|
||||||
|
+ tristate "ASN1"
|
||||||
|
help
|
||||||
|
Build a simple ASN.1 grammar compiler that produces a bytecode output
|
||||||
|
that can be interpreted by the ASN.1 stream decoder and used to
|
||||||
|
--- a/lib/Kconfig
|
||||||
|
+++ b/lib/Kconfig
|
||||||
|
@@ -637,7 +637,7 @@ config LIBFDT
|
||||||
|
bool
|
||||||
|
|
||||||
|
config OID_REGISTRY
|
||||||
|
- tristate
|
||||||
|
+ tristate "OID"
|
||||||
|
help
|
||||||
|
Enable fast lookup object identifier registry.
|
||||||
|
|
24
6.7/target/linux/generic/hack-6.7/261-lib-arc4-unhide.patch
Normal file
24
6.7/target/linux/generic/hack-6.7/261-lib-arc4-unhide.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
From 241e5d3f7b0dd3c01f8c7fa83cbc9a3882286d53 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:35:18 +0200
|
||||||
|
Subject: [PATCH] lib/crypto: add tristate string for ARC4
|
||||||
|
|
||||||
|
This makes it possible to select CONFIG_CRYPTO_LIB_ARC4 directly. We
|
||||||
|
need this to be able to compile this into the kernel and make use of it
|
||||||
|
from backports.
|
||||||
|
|
||||||
|
---
|
||||||
|
lib/crypto/Kconfig | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/lib/crypto/Kconfig
|
||||||
|
+++ b/lib/crypto/Kconfig
|
||||||
|
@@ -9,7 +9,7 @@ config CRYPTO_LIB_AES
|
||||||
|
tristate
|
||||||
|
|
||||||
|
config CRYPTO_LIB_ARC4
|
||||||
|
- tristate
|
||||||
|
+ tristate "ARC4 cipher library"
|
||||||
|
|
||||||
|
config CRYPTO_ARCH_HAVE_LIB_BLAKE2S
|
||||||
|
bool
|
84
6.7/target/linux/generic/hack-6.7/280-rfkill-stubs.patch
Normal file
84
6.7/target/linux/generic/hack-6.7/280-rfkill-stubs.patch
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
From 236c1acdfef5958010ac9814a9872e0a46fd78ee Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Crispin <john@phrozen.org>
|
||||||
|
Date: Fri, 7 Jul 2017 17:13:44 +0200
|
||||||
|
Subject: rfkill: add fake rfkill support
|
||||||
|
|
||||||
|
allow building of modules depending on RFKILL even if RFKILL is not enabled.
|
||||||
|
|
||||||
|
Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
|
---
|
||||||
|
include/linux/rfkill.h | 2 +-
|
||||||
|
net/Makefile | 2 +-
|
||||||
|
net/rfkill/Kconfig | 14 +++++++++-----
|
||||||
|
net/rfkill/Makefile | 2 +-
|
||||||
|
4 files changed, 12 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
--- a/include/linux/rfkill.h
|
||||||
|
+++ b/include/linux/rfkill.h
|
||||||
|
@@ -64,7 +64,7 @@ struct rfkill_ops {
|
||||||
|
int (*set_block)(void *data, bool blocked);
|
||||||
|
};
|
||||||
|
|
||||||
|
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
|
||||||
|
+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE)
|
||||||
|
/**
|
||||||
|
* rfkill_alloc - Allocate rfkill structure
|
||||||
|
* @name: name of the struct -- the string is not copied internally
|
||||||
|
--- a/net/Makefile
|
||||||
|
+++ b/net/Makefile
|
||||||
|
@@ -52,7 +52,7 @@ obj-$(CONFIG_TIPC) += tipc/
|
||||||
|
obj-$(CONFIG_NETLABEL) += netlabel/
|
||||||
|
obj-$(CONFIG_IUCV) += iucv/
|
||||||
|
obj-$(CONFIG_SMC) += smc/
|
||||||
|
-obj-$(CONFIG_RFKILL) += rfkill/
|
||||||
|
+obj-$(CONFIG_RFKILL_FULL) += rfkill/
|
||||||
|
obj-$(CONFIG_NET_9P) += 9p/
|
||||||
|
obj-$(CONFIG_CAIF) += caif/
|
||||||
|
obj-$(CONFIG_DCB) += dcb/
|
||||||
|
--- a/net/rfkill/Kconfig
|
||||||
|
+++ b/net/rfkill/Kconfig
|
||||||
|
@@ -2,7 +2,11 @@
|
||||||
|
#
|
||||||
|
# RF switch subsystem configuration
|
||||||
|
#
|
||||||
|
-menuconfig RFKILL
|
||||||
|
+config RFKILL
|
||||||
|
+ bool
|
||||||
|
+ default y
|
||||||
|
+
|
||||||
|
+menuconfig RFKILL_FULL
|
||||||
|
tristate "RF switch subsystem support"
|
||||||
|
help
|
||||||
|
Say Y here if you want to have control over RF switches
|
||||||
|
@@ -14,19 +18,19 @@ menuconfig RFKILL
|
||||||
|
# LED trigger support
|
||||||
|
config RFKILL_LEDS
|
||||||
|
bool
|
||||||
|
- depends on RFKILL
|
||||||
|
+ depends on RFKILL_FULL
|
||||||
|
depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS
|
||||||
|
default y
|
||||||
|
|
||||||
|
config RFKILL_INPUT
|
||||||
|
bool "RF switch input support" if EXPERT
|
||||||
|
- depends on RFKILL
|
||||||
|
+ depends on RFKILL_FULL
|
||||||
|
depends on INPUT = y || RFKILL = INPUT
|
||||||
|
default y if !EXPERT
|
||||||
|
|
||||||
|
config RFKILL_GPIO
|
||||||
|
tristate "GPIO RFKILL driver"
|
||||||
|
- depends on RFKILL
|
||||||
|
+ depends on RFKILL_FULL
|
||||||
|
depends on GPIOLIB || COMPILE_TEST
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
--- a/net/rfkill/Makefile
|
||||||
|
+++ b/net/rfkill/Makefile
|
||||||
|
@@ -5,5 +5,5 @@
|
||||||
|
|
||||||
|
rfkill-y += core.o
|
||||||
|
rfkill-$(CONFIG_RFKILL_INPUT) += input.o
|
||||||
|
-obj-$(CONFIG_RFKILL) += rfkill.o
|
||||||
|
+obj-$(CONFIG_RFKILL_FULL) += rfkill.o
|
||||||
|
obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o
|
|
@ -0,0 +1,64 @@
|
||||||
|
From: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
|
||||||
|
Date: Fri, 7 Jun 2013 18:35:22 -0500
|
||||||
|
Subject: MIPS: r4k_cache: use more efficient cache blast
|
||||||
|
|
||||||
|
Optimize the compiler output for larger cache blast cases that are
|
||||||
|
common for DMA-based networking.
|
||||||
|
|
||||||
|
Signed-off-by: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
--- a/arch/mips/include/asm/r4kcache.h
|
||||||
|
+++ b/arch/mips/include/asm/r4kcache.h
|
||||||
|
@@ -286,14 +286,46 @@ static inline void prot##extra##blast_##
|
||||||
|
unsigned long end) \
|
||||||
|
{ \
|
||||||
|
unsigned long lsize = cpu_##desc##_line_size(); \
|
||||||
|
+ unsigned long lsize_2 = lsize * 2; \
|
||||||
|
+ unsigned long lsize_3 = lsize * 3; \
|
||||||
|
+ unsigned long lsize_4 = lsize * 4; \
|
||||||
|
+ unsigned long lsize_5 = lsize * 5; \
|
||||||
|
+ unsigned long lsize_6 = lsize * 6; \
|
||||||
|
+ unsigned long lsize_7 = lsize * 7; \
|
||||||
|
+ unsigned long lsize_8 = lsize * 8; \
|
||||||
|
unsigned long addr = start & ~(lsize - 1); \
|
||||||
|
- unsigned long aend = (end - 1) & ~(lsize - 1); \
|
||||||
|
+ unsigned long aend = (end + lsize - 1) & ~(lsize - 1); \
|
||||||
|
+ int lines = (aend - addr) / lsize; \
|
||||||
|
\
|
||||||
|
- while (1) { \
|
||||||
|
+ while (lines >= 8) { \
|
||||||
|
+ prot##cache_op(hitop, addr); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_2); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_3); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_4); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_5); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_6); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_7); \
|
||||||
|
+ addr += lsize_8; \
|
||||||
|
+ lines -= 8; \
|
||||||
|
+ } \
|
||||||
|
+ \
|
||||||
|
+ if (lines & 0x4) { \
|
||||||
|
+ prot##cache_op(hitop, addr); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_2); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize_3); \
|
||||||
|
+ addr += lsize_4; \
|
||||||
|
+ } \
|
||||||
|
+ \
|
||||||
|
+ if (lines & 0x2) { \
|
||||||
|
+ prot##cache_op(hitop, addr); \
|
||||||
|
+ prot##cache_op(hitop, addr + lsize); \
|
||||||
|
+ addr += lsize_2; \
|
||||||
|
+ } \
|
||||||
|
+ \
|
||||||
|
+ if (lines & 0x1) { \
|
||||||
|
prot##cache_op(hitop, addr); \
|
||||||
|
- if (addr == aend) \
|
||||||
|
- break; \
|
||||||
|
- addr += lsize; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
From 0bccc3722bdd88e8ae995e77ef9f7b77ee4cbdee Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Date: Wed, 7 Apr 2021 22:45:54 +0100
|
||||||
|
Subject: [PATCH 2/2] mtd: blktrans: call add disks after mtd device
|
||||||
|
To: linux-mtd@lists.infradead.org
|
||||||
|
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
|
||||||
|
Richard Weinberger <richard@nod.at>,
|
||||||
|
Miquel Raynal <miquel.raynal@bootlin.com>,
|
||||||
|
David Woodhouse <dwmw2@infradead.org>
|
||||||
|
|
||||||
|
Calling device_add_disk while holding mtd_table_mutex leads
|
||||||
|
to deadlock in case part_bits!=0 as block partition parsers
|
||||||
|
will try to open the newly created disks, trying to acquire
|
||||||
|
mutex once again.
|
||||||
|
Move device_add_disk to additional function called after
|
||||||
|
add partitions of an MTD device have been added and locks
|
||||||
|
have been released.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
---
|
||||||
|
drivers/mtd/mtd_blkdevs.c | 33 ++++++++++++++++++++++++++-------
|
||||||
|
drivers/mtd/mtdcore.c | 3 +++
|
||||||
|
include/linux/mtd/blktrans.h | 1 +
|
||||||
|
3 files changed, 30 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/mtd_blkdevs.c
|
||||||
|
+++ b/drivers/mtd/mtd_blkdevs.c
|
||||||
|
@@ -386,19 +386,8 @@ int add_mtd_blktrans_dev(struct mtd_blkt
|
||||||
|
if (new->readonly)
|
||||||
|
set_disk_ro(gd, 1);
|
||||||
|
|
||||||
|
- ret = device_add_disk(&new->mtd->dev, gd, NULL);
|
||||||
|
- if (ret)
|
||||||
|
- goto out_cleanup_disk;
|
||||||
|
-
|
||||||
|
- if (new->disk_attributes) {
|
||||||
|
- ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
|
||||||
|
- new->disk_attributes);
|
||||||
|
- WARN_ON(ret);
|
||||||
|
- }
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
-out_cleanup_disk:
|
||||||
|
- put_disk(new->disk);
|
||||||
|
out_free_tag_set:
|
||||||
|
blk_mq_free_tag_set(new->tag_set);
|
||||||
|
out_kfree_tag_set:
|
||||||
|
@@ -408,6 +397,35 @@ out_list_del:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void register_mtd_blktrans_devs(void)
|
||||||
|
+{
|
||||||
|
+ struct mtd_blktrans_ops *tr;
|
||||||
|
+ struct mtd_blktrans_dev *dev, *next;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ list_for_each_entry(tr, &blktrans_majors, list) {
|
||||||
|
+ list_for_each_entry_safe(dev, next, &tr->devs, list) {
|
||||||
|
+ if (disk_live(dev->disk))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ ret = device_add_disk(&dev->mtd->dev, dev->disk, NULL);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto out_cleanup_disk;
|
||||||
|
+
|
||||||
|
+ if (dev->disk_attributes) {
|
||||||
|
+ ret = sysfs_create_group(&disk_to_dev(dev->disk)->kobj,
|
||||||
|
+ dev->disk_attributes);
|
||||||
|
+ WARN_ON(ret);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+out_cleanup_disk:
|
||||||
|
+ put_disk(dev->disk);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
--- a/drivers/mtd/mtdcore.c
|
||||||
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
|
||||||
|
#include <linux/mtd/mtd.h>
|
||||||
|
#include <linux/mtd/partitions.h>
|
||||||
|
+#include <linux/mtd/blktrans.h>
|
||||||
|
|
||||||
|
#include "mtdcore.h"
|
||||||
|
|
||||||
|
@@ -1074,6 +1075,8 @@ int mtd_device_parse_register(struct mtd
|
||||||
|
register_reboot_notifier(&mtd->reboot_notifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ register_mtd_blktrans_devs();
|
||||||
|
+
|
||||||
|
out:
|
||||||
|
if (ret) {
|
||||||
|
nvmem_unregister(mtd->otp_user_nvmem);
|
||||||
|
--- a/include/linux/mtd/blktrans.h
|
||||||
|
+++ b/include/linux/mtd/blktrans.h
|
||||||
|
@@ -76,6 +76,7 @@ extern int deregister_mtd_blktrans(struc
|
||||||
|
extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
|
||||||
|
extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
|
||||||
|
extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
|
||||||
|
+extern void register_mtd_blktrans_devs(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* module_mtd_blktrans() - Helper macro for registering a mtd blktrans driver
|
|
@ -0,0 +1,217 @@
|
||||||
|
From 69357074558daf6ff24c9f58714935e9e095a865 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:37:33 +0200
|
||||||
|
Subject: [PATCH] kernel: add block fit partition parser
|
||||||
|
|
||||||
|
---
|
||||||
|
block/blk.h | 2 ++
|
||||||
|
block/partitions/Kconfig | 7 +++++++
|
||||||
|
block/partitions/Makefile | 1 +
|
||||||
|
block/partitions/check.h | 3 +++
|
||||||
|
block/partitions/core.c | 17 +++++++++++++++++
|
||||||
|
block/partitions/efi.c | 8 ++++++++
|
||||||
|
block/partitions/efi.h | 3 +++
|
||||||
|
block/partitions/msdos.c | 10 ++++++++++
|
||||||
|
drivers/mtd/mtd_blkdevs.c | 2 ++
|
||||||
|
drivers/mtd/ubi/block.c | 3 +++
|
||||||
|
include/linux/msdos_partition.h | 1 +
|
||||||
|
11 files changed, 57 insertions(+)
|
||||||
|
|
||||||
|
--- a/block/blk.h
|
||||||
|
+++ b/block/blk.h
|
||||||
|
@@ -414,6 +414,8 @@ void blk_free_ext_minor(unsigned int min
|
||||||
|
#define ADDPART_FLAG_NONE 0
|
||||||
|
#define ADDPART_FLAG_RAID 1
|
||||||
|
#define ADDPART_FLAG_WHOLEDISK 2
|
||||||
|
+#define ADDPART_FLAG_READONLY 4
|
||||||
|
+#define ADDPART_FLAG_ROOTDEV 8
|
||||||
|
int bdev_add_partition(struct gendisk *disk, int partno, sector_t start,
|
||||||
|
sector_t length);
|
||||||
|
int bdev_del_partition(struct gendisk *disk, int partno);
|
||||||
|
--- a/block/partitions/Kconfig
|
||||||
|
+++ b/block/partitions/Kconfig
|
||||||
|
@@ -103,6 +103,13 @@ config ATARI_PARTITION
|
||||||
|
Say Y here if you would like to use hard disks under Linux which
|
||||||
|
were partitioned under the Atari OS.
|
||||||
|
|
||||||
|
+config FIT_PARTITION
|
||||||
|
+ bool "Flattened-Image-Tree (FIT) partition support" if PARTITION_ADVANCED
|
||||||
|
+ default n
|
||||||
|
+ help
|
||||||
|
+ Say Y here if your system needs to mount the filesystem part of
|
||||||
|
+ a Flattened-Image-Tree (FIT) image commonly used with Das U-Boot.
|
||||||
|
+
|
||||||
|
config IBM_PARTITION
|
||||||
|
bool "IBM disk label and partition support"
|
||||||
|
depends on PARTITION_ADVANCED && S390
|
||||||
|
--- a/block/partitions/Makefile
|
||||||
|
+++ b/block/partitions/Makefile
|
||||||
|
@@ -8,6 +8,7 @@ obj-$(CONFIG_ACORN_PARTITION) += acorn.o
|
||||||
|
obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
|
||||||
|
obj-$(CONFIG_ATARI_PARTITION) += atari.o
|
||||||
|
obj-$(CONFIG_AIX_PARTITION) += aix.o
|
||||||
|
+obj-$(CONFIG_FIT_PARTITION) += fit.o
|
||||||
|
obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o
|
||||||
|
obj-$(CONFIG_MAC_PARTITION) += mac.o
|
||||||
|
obj-$(CONFIG_LDM_PARTITION) += ldm.o
|
||||||
|
--- a/block/partitions/check.h
|
||||||
|
+++ b/block/partitions/check.h
|
||||||
|
@@ -57,6 +57,7 @@ int amiga_partition(struct parsed_partit
|
||||||
|
int atari_partition(struct parsed_partitions *state);
|
||||||
|
int cmdline_partition(struct parsed_partitions *state);
|
||||||
|
int efi_partition(struct parsed_partitions *state);
|
||||||
|
+int fit_partition(struct parsed_partitions *state);
|
||||||
|
int ibm_partition(struct parsed_partitions *);
|
||||||
|
int karma_partition(struct parsed_partitions *state);
|
||||||
|
int ldm_partition(struct parsed_partitions *state);
|
||||||
|
@@ -67,3 +68,5 @@ int sgi_partition(struct parsed_partitio
|
||||||
|
int sun_partition(struct parsed_partitions *state);
|
||||||
|
int sysv68_partition(struct parsed_partitions *state);
|
||||||
|
int ultrix_partition(struct parsed_partitions *state);
|
||||||
|
+
|
||||||
|
+int parse_fit_partitions(struct parsed_partitions *state, u64 start_sector, u64 nr_sectors, int *slot, int add_remain);
|
||||||
|
--- a/block/partitions/core.c
|
||||||
|
+++ b/block/partitions/core.c
|
||||||
|
@@ -10,6 +10,10 @@
|
||||||
|
#include <linux/ctype.h>
|
||||||
|
#include <linux/vmalloc.h>
|
||||||
|
#include <linux/raid/detect.h>
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+#include <linux/root_dev.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
static int (*check_part[])(struct parsed_partitions *) = {
|
||||||
|
@@ -46,6 +50,9 @@ static int (*check_part[])(struct parsed
|
||||||
|
#ifdef CONFIG_EFI_PARTITION
|
||||||
|
efi_partition, /* this must come before msdos */
|
||||||
|
#endif
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+ fit_partition,
|
||||||
|
+#endif
|
||||||
|
#ifdef CONFIG_SGI_PARTITION
|
||||||
|
sgi_partition,
|
||||||
|
#endif
|
||||||
|
@@ -398,6 +405,11 @@ static struct block_device *add_partitio
|
||||||
|
goto out_del;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+ if (flags & ADDPART_FLAG_READONLY)
|
||||||
|
+ bdev->bd_read_only = true;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* everything is up and running, commence */
|
||||||
|
err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL);
|
||||||
|
if (err)
|
||||||
|
@@ -585,6 +597,11 @@ static bool blk_add_partition(struct gen
|
||||||
|
(state->parts[p].flags & ADDPART_FLAG_RAID))
|
||||||
|
md_autodetect_dev(part->bd_dev);
|
||||||
|
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+ if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0)
|
||||||
|
+ ROOT_DEV = part->bd_dev;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/block/partitions/efi.c
|
||||||
|
+++ b/block/partitions/efi.c
|
||||||
|
@@ -716,6 +716,9 @@ int efi_partition(struct parsed_partitio
|
||||||
|
gpt_entry *ptes = NULL;
|
||||||
|
u32 i;
|
||||||
|
unsigned ssz = queue_logical_block_size(state->disk->queue) / 512;
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+ u32 extra_slot = 64;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
|
||||||
|
kfree(gpt);
|
||||||
|
@@ -749,6 +752,11 @@ int efi_partition(struct parsed_partitio
|
||||||
|
ARRAY_SIZE(ptes[i].partition_name));
|
||||||
|
utf16_le_to_7bit(ptes[i].partition_name, label_max, info->volname);
|
||||||
|
state->parts[i + 1].has_info = true;
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+ /* If this is a U-Boot FIT volume it may have subpartitions */
|
||||||
|
+ if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_FIT_GUID))
|
||||||
|
+ (void) parse_fit_partitions(state, start * ssz, size * ssz, &extra_slot, 1);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
kfree(ptes);
|
||||||
|
kfree(gpt);
|
||||||
|
--- a/block/partitions/efi.h
|
||||||
|
+++ b/block/partitions/efi.h
|
||||||
|
@@ -51,6 +51,9 @@
|
||||||
|
#define PARTITION_LINUX_LVM_GUID \
|
||||||
|
EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \
|
||||||
|
0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
|
||||||
|
+#define PARTITION_LINUX_FIT_GUID \
|
||||||
|
+ EFI_GUID( 0xcae9be83, 0xb15f, 0x49cc, \
|
||||||
|
+ 0x86, 0x3f, 0x08, 0x1b, 0x74, 0x4a, 0x2d, 0x93)
|
||||||
|
|
||||||
|
typedef struct _gpt_header {
|
||||||
|
__le64 signature;
|
||||||
|
--- a/block/partitions/msdos.c
|
||||||
|
+++ b/block/partitions/msdos.c
|
||||||
|
@@ -564,6 +564,15 @@ static void parse_minix(struct parsed_pa
|
||||||
|
#endif /* CONFIG_MINIX_SUBPARTITION */
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void parse_fit_mbr(struct parsed_partitions *state,
|
||||||
|
+ sector_t offset, sector_t size, int origin)
|
||||||
|
+{
|
||||||
|
+#ifdef CONFIG_FIT_PARTITION
|
||||||
|
+ u32 extra_slot = 64;
|
||||||
|
+ (void) parse_fit_partitions(state, offset, size, &extra_slot, 1);
|
||||||
|
+#endif /* CONFIG_FIT_PARTITION */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static struct {
|
||||||
|
unsigned char id;
|
||||||
|
void (*parse)(struct parsed_partitions *, sector_t, sector_t, int);
|
||||||
|
@@ -575,6 +584,7 @@ static struct {
|
||||||
|
{UNIXWARE_PARTITION, parse_unixware},
|
||||||
|
{SOLARIS_X86_PARTITION, parse_solaris_x86},
|
||||||
|
{NEW_SOLARIS_X86_PARTITION, parse_solaris_x86},
|
||||||
|
+ {FIT_PARTITION, parse_fit_mbr},
|
||||||
|
{0, NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
--- a/drivers/mtd/mtd_blkdevs.c
|
||||||
|
+++ b/drivers/mtd/mtd_blkdevs.c
|
||||||
|
@@ -359,7 +359,9 @@ int add_mtd_blktrans_dev(struct mtd_blkt
|
||||||
|
} else {
|
||||||
|
snprintf(gd->disk_name, sizeof(gd->disk_name),
|
||||||
|
"%s%d", tr->name, new->devnum);
|
||||||
|
- gd->flags |= GENHD_FL_NO_PART;
|
||||||
|
+
|
||||||
|
+ if (!IS_ENABLED(CONFIG_FIT_PARTITION) || mtd_type_is_nand(new->mtd))
|
||||||
|
+ gd->flags |= GENHD_FL_NO_PART;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_capacity(gd, ((u64)new->size * tr->blksize) >> 9);
|
||||||
|
--- a/drivers/mtd/ubi/block.c
|
||||||
|
+++ b/drivers/mtd/ubi/block.c
|
||||||
|
@@ -431,7 +431,9 @@ int ubiblock_create(struct ubi_volume_in
|
||||||
|
ret = -ENODEV;
|
||||||
|
goto out_cleanup_disk;
|
||||||
|
}
|
||||||
|
- gd->flags |= GENHD_FL_NO_PART;
|
||||||
|
+ if (!IS_ENABLED(CONFIG_FIT_PARTITION))
|
||||||
|
+ gd->flags |= GENHD_FL_NO_PART;
|
||||||
|
+
|
||||||
|
gd->private_data = dev;
|
||||||
|
sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
|
||||||
|
set_capacity(gd, disk_capacity);
|
||||||
|
--- a/include/linux/msdos_partition.h
|
||||||
|
+++ b/include/linux/msdos_partition.h
|
||||||
|
@@ -31,6 +31,7 @@ enum msdos_sys_ind {
|
||||||
|
LINUX_LVM_PARTITION = 0x8e,
|
||||||
|
LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
|
||||||
|
|
||||||
|
+ FIT_PARTITION = 0x2e, /* U-Boot uImage.FIT */
|
||||||
|
SOLARIS_X86_PARTITION = 0x82, /* also Linux swap partitions */
|
||||||
|
NEW_SOLARIS_X86_PARTITION = 0xbf,
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
From 6fa9e3678eb002246df1280322b6a024853950a5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||||
|
Date: Mon, 11 Oct 2021 00:53:14 +0200
|
||||||
|
Subject: [PATCH] drivers: mtd: parsers: add nvmem support to cmdlinepart
|
||||||
|
|
||||||
|
Assuming cmdlinepart is only one level deep partition scheme and that
|
||||||
|
static partition are also defined in DTS, we can assign an of_node for
|
||||||
|
partition declared from bootargs. cmdlinepart have priority than
|
||||||
|
fiexed-partition parser so in this specific case the parser doesn't
|
||||||
|
assign an of_node. Fix this by searching a defined of_node using a
|
||||||
|
similar fixed_partition parser and if a partition is found with the same
|
||||||
|
label, check that it has the same offset and size and return the DT
|
||||||
|
of_node to correctly use NVMEM cells.
|
||||||
|
|
||||||
|
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/mtd/parsers/cmdlinepart.c | 71 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 71 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/cmdlinepart.c
|
||||||
|
+++ b/drivers/mtd/parsers/cmdlinepart.c
|
||||||
|
@@ -43,6 +43,7 @@
|
||||||
|
#include <linux/mtd/partitions.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/err.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
|
||||||
|
/* debug macro */
|
||||||
|
#if 0
|
||||||
|
@@ -323,6 +324,68 @@ static int mtdpart_setup_real(char *s)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int search_fixed_partition(struct mtd_info *master,
|
||||||
|
+ struct mtd_partition *target_part,
|
||||||
|
+ struct mtd_partition *fixed_part)
|
||||||
|
+{
|
||||||
|
+ struct device_node *mtd_node;
|
||||||
|
+ struct device_node *ofpart_node;
|
||||||
|
+ struct device_node *pp;
|
||||||
|
+ struct mtd_partition part;
|
||||||
|
+ const char *partname;
|
||||||
|
+
|
||||||
|
+ mtd_node = mtd_get_of_node(master);
|
||||||
|
+ if (!mtd_node)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ ofpart_node = of_get_child_by_name(mtd_node, "partitions");
|
||||||
|
+
|
||||||
|
+ for_each_child_of_node(ofpart_node, pp) {
|
||||||
|
+ const __be32 *reg;
|
||||||
|
+ int len;
|
||||||
|
+ int a_cells, s_cells;
|
||||||
|
+
|
||||||
|
+ reg = of_get_property(pp, "reg", &len);
|
||||||
|
+ if (!reg) {
|
||||||
|
+ pr_debug("%s: ofpart partition %pOF (%pOF) missing reg property.\n",
|
||||||
|
+ master->name, pp,
|
||||||
|
+ mtd_node);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ a_cells = of_n_addr_cells(pp);
|
||||||
|
+ s_cells = of_n_size_cells(pp);
|
||||||
|
+ if (len / 4 != a_cells + s_cells) {
|
||||||
|
+ pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
|
||||||
|
+ master->name, pp,
|
||||||
|
+ mtd_node);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ part.offset = of_read_number(reg, a_cells);
|
||||||
|
+ part.size = of_read_number(reg + a_cells, s_cells);
|
||||||
|
+ part.of_node = pp;
|
||||||
|
+
|
||||||
|
+ partname = of_get_property(pp, "label", &len);
|
||||||
|
+ if (!partname)
|
||||||
|
+ partname = of_get_property(pp, "name", &len);
|
||||||
|
+ part.name = partname;
|
||||||
|
+
|
||||||
|
+ if (!strncmp(target_part->name, part.name, len)) {
|
||||||
|
+ if (part.offset != target_part->offset)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ if (part.size != target_part->size)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ memcpy(fixed_part, &part, sizeof(struct mtd_partition));
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return -EINVAL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Main function to be called from the MTD mapping driver/device to
|
||||||
|
* obtain the partitioning information. At this point the command line
|
||||||
|
@@ -338,6 +401,7 @@ static int parse_cmdline_partitions(stru
|
||||||
|
int i, err;
|
||||||
|
struct cmdline_mtd_partition *part;
|
||||||
|
const char *mtd_id = master->name;
|
||||||
|
+ struct mtd_partition fixed_part;
|
||||||
|
|
||||||
|
/* parse command line */
|
||||||
|
if (!cmdline_parsed) {
|
||||||
|
@@ -382,6 +446,13 @@ static int parse_cmdline_partitions(stru
|
||||||
|
sizeof(*part->parts) * (part->num_parts - i));
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ err = search_fixed_partition(master, &part->parts[i], &fixed_part);
|
||||||
|
+ if (!err) {
|
||||||
|
+ part->parts[i].of_node = fixed_part.of_node;
|
||||||
|
+ pr_info("Found partition defined in DT for %s. Assigning OF node to support nvmem.",
|
||||||
|
+ part->parts[i].name);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
*pparts = kmemdup(part->parts, sizeof(*part->parts) * part->num_parts,
|
33
6.7/target/linux/generic/hack-6.7/430-mtk-bmt-support.patch
Normal file
33
6.7/target/linux/generic/hack-6.7/430-mtk-bmt-support.patch
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
From ac84397efb3b3868c71c10ad7521161773228a17 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:41:44 +0200
|
||||||
|
Subject: [PATCH] mtd/nand: add MediaTek NAND bad block managment table
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/mtd/nand/Kconfig | 4 ++++
|
||||||
|
drivers/mtd/nand/Makefile | 1 +
|
||||||
|
2 files changed, 5 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/nand/Kconfig
|
||||||
|
+++ b/drivers/mtd/nand/Kconfig
|
||||||
|
@@ -46,6 +46,10 @@ config MTD_NAND_ECC_SW_BCH
|
||||||
|
ECC codes. They are used with NAND devices requiring more than 1 bit
|
||||||
|
of error correction.
|
||||||
|
|
||||||
|
+config MTD_NAND_MTK_BMT
|
||||||
|
+ bool "Support MediaTek NAND Bad-block Management Table"
|
||||||
|
+ default n
|
||||||
|
+
|
||||||
|
config MTD_NAND_ECC_MXIC
|
||||||
|
bool "Macronix external hardware ECC engine"
|
||||||
|
depends on HAS_IOMEM
|
||||||
|
--- a/drivers/mtd/nand/Makefile
|
||||||
|
+++ b/drivers/mtd/nand/Makefile
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
nandcore-objs := core.o bbt.o
|
||||||
|
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
|
||||||
|
obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
|
||||||
|
+obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o mtk_bmt_v2.o mtk_bmt_bbt.o mtk_bmt_nmbm.o
|
||||||
|
|
||||||
|
obj-y += onenand/
|
||||||
|
obj-y += raw/
|
|
@ -0,0 +1,214 @@
|
||||||
|
From eda40b8c8c82e0f2789d6bc8bf63846dce2e8f32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||||
|
Date: Sat, 23 Mar 2019 09:29:49 +0000
|
||||||
|
Subject: [PATCH] netfilter: connmark: introduce set-dscpmark
|
||||||
|
|
||||||
|
set-dscpmark is a method of storing the DSCP of an ip packet into
|
||||||
|
conntrack mark. In combination with a suitable tc filter action
|
||||||
|
(act_ctinfo) DSCP values are able to be stored in the mark on egress and
|
||||||
|
restored on ingress across links that otherwise alter or bleach DSCP.
|
||||||
|
|
||||||
|
This is useful for qdiscs such as CAKE which are able to shape according
|
||||||
|
to policies based on DSCP.
|
||||||
|
|
||||||
|
Ingress classification is traditionally a challenging task since
|
||||||
|
iptables rules haven't yet run and tc filter/eBPF programs are pre-NAT
|
||||||
|
lookups, hence are unable to see internal IPv4 addresses as used on the
|
||||||
|
typical home masquerading gateway.
|
||||||
|
|
||||||
|
x_tables CONNMARK set-dscpmark target solves the problem of storing the
|
||||||
|
DSCP to the conntrack mark in a way suitable for the new act_ctinfo tc
|
||||||
|
action to restore.
|
||||||
|
|
||||||
|
The set-dscpmark option accepts 2 parameters, a 32bit 'dscpmask' and a
|
||||||
|
32bit 'statemask'. The dscp mask must be 6 contiguous bits and
|
||||||
|
represents the area where the DSCP will be stored in the connmark. The
|
||||||
|
state mask is a minimum 1 bit length mask that must not overlap with the
|
||||||
|
dscpmask. It represents a flag which is set when the DSCP has been
|
||||||
|
stored in the conntrack mark. This is useful to implement a 'one shot'
|
||||||
|
iptables based classification where the 'complicated' iptables rules are
|
||||||
|
only run once to classify the connection on initial (egress) packet and
|
||||||
|
subsequent packets are all marked/restored with the same DSCP. A state
|
||||||
|
mask of zero disables the setting of a status bit/s.
|
||||||
|
|
||||||
|
example syntax with a suitably modified iptables user space application:
|
||||||
|
|
||||||
|
iptables -A QOS_MARK_eth0 -t mangle -j CONNMARK --set-dscpmark 0xfc000000/0x01000000
|
||||||
|
|
||||||
|
Would store the DSCP in the top 6 bits of the 32bit mark field, and use
|
||||||
|
the LSB of the top byte as the 'DSCP has been stored' marker.
|
||||||
|
|
||||||
|
|----0xFC----conntrack mark----000000---|
|
||||||
|
| Bits 31-26 | bit 25 | bit24 |~~~ Bit 0|
|
||||||
|
| DSCP | unused | flag |unused |
|
||||||
|
|-----------------------0x01---000000---|
|
||||||
|
^ ^
|
||||||
|
| |
|
||||||
|
---| Conditional flag
|
||||||
|
| set this when dscp
|
||||||
|
|-ip diffserv-| stored in mark
|
||||||
|
| 6 bits |
|
||||||
|
|-------------|
|
||||||
|
|
||||||
|
an identically configured tc action to restore looks like:
|
||||||
|
|
||||||
|
tc filter show dev eth0 ingress
|
||||||
|
filter parent ffff: protocol all pref 10 u32 chain 0
|
||||||
|
filter parent ffff: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1
|
||||||
|
filter parent ffff: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1: not_in_hw
|
||||||
|
match 00000000/00000000 at 0
|
||||||
|
action order 1: ctinfo zone 0 pipe
|
||||||
|
index 2 ref 1 bind 1 dscp 0xfc000000/0x1000000
|
||||||
|
|
||||||
|
action order 2: mirred (Egress Redirect to device ifb4eth0) stolen
|
||||||
|
index 1 ref 1 bind 1
|
||||||
|
|
||||||
|
|----0xFC----conntrack mark----000000---|
|
||||||
|
| Bits 31-26 | bit 25 | bit24 |~~~ Bit 0|
|
||||||
|
| DSCP | unused | flag |unused |
|
||||||
|
|-----------------------0x01---000000---|
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
---| Conditional flag
|
||||||
|
v only restore if set
|
||||||
|
|-ip diffserv-|
|
||||||
|
| 6 bits |
|
||||||
|
|-------------|
|
||||||
|
|
||||||
|
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||||
|
---
|
||||||
|
include/uapi/linux/netfilter/xt_connmark.h | 10 ++++
|
||||||
|
net/netfilter/xt_connmark.c | 55 ++++++++++++++++++----
|
||||||
|
2 files changed, 57 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
--- a/include/uapi/linux/netfilter/xt_connmark.h
|
||||||
|
+++ b/include/uapi/linux/netfilter/xt_connmark.h
|
||||||
|
@@ -15,6 +15,11 @@ enum {
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
+ XT_CONNMARK_VALUE = (1 << 0),
|
||||||
|
+ XT_CONNMARK_DSCP = (1 << 1)
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum {
|
||||||
|
D_SHIFT_LEFT = 0,
|
||||||
|
D_SHIFT_RIGHT,
|
||||||
|
};
|
||||||
|
@@ -29,6 +34,11 @@ struct xt_connmark_tginfo2 {
|
||||||
|
__u8 shift_dir, shift_bits, mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct xt_connmark_tginfo3 {
|
||||||
|
+ __u32 ctmark, ctmask, nfmask;
|
||||||
|
+ __u8 shift_dir, shift_bits, mode, func;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct xt_connmark_mtinfo1 {
|
||||||
|
__u32 mark, mask;
|
||||||
|
__u8 invert;
|
||||||
|
--- a/net/netfilter/xt_connmark.c
|
||||||
|
+++ b/net/netfilter/xt_connmark.c
|
||||||
|
@@ -24,13 +24,13 @@ MODULE_ALIAS("ipt_connmark");
|
||||||
|
MODULE_ALIAS("ip6t_connmark");
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
-connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo2 *info)
|
||||||
|
+connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo3 *info)
|
||||||
|
{
|
||||||
|
enum ip_conntrack_info ctinfo;
|
||||||
|
u_int32_t new_targetmark;
|
||||||
|
struct nf_conn *ct;
|
||||||
|
u_int32_t newmark;
|
||||||
|
- u_int32_t oldmark;
|
||||||
|
+ u_int8_t dscp;
|
||||||
|
|
||||||
|
ct = nf_ct_get(skb, &ctinfo);
|
||||||
|
if (ct == NULL)
|
||||||
|
@@ -38,13 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c
|
||||||
|
|
||||||
|
switch (info->mode) {
|
||||||
|
case XT_CONNMARK_SET:
|
||||||
|
- oldmark = READ_ONCE(ct->mark);
|
||||||
|
- newmark = (oldmark & ~info->ctmask) ^ info->ctmark;
|
||||||
|
- if (info->shift_dir == D_SHIFT_RIGHT)
|
||||||
|
- newmark >>= info->shift_bits;
|
||||||
|
- else
|
||||||
|
- newmark <<= info->shift_bits;
|
||||||
|
+ newmark = READ_ONCE(ct->mark);
|
||||||
|
+ if (info->func & XT_CONNMARK_VALUE) {
|
||||||
|
+ newmark = (newmark & ~info->ctmask) ^ info->ctmark;
|
||||||
|
+ if (info->shift_dir == D_SHIFT_RIGHT)
|
||||||
|
+ newmark >>= info->shift_bits;
|
||||||
|
+ else
|
||||||
|
+ newmark <<= info->shift_bits;
|
||||||
|
+ } else if (info->func & XT_CONNMARK_DSCP) {
|
||||||
|
+ if (skb->protocol == htons(ETH_P_IP))
|
||||||
|
+ dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2;
|
||||||
|
+ else if (skb->protocol == htons(ETH_P_IPV6))
|
||||||
|
+ dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;
|
||||||
|
+ else /* protocol doesn't have diffserv */
|
||||||
|
+ break;
|
||||||
|
|
||||||
|
+ newmark = (newmark & ~info->ctmark) |
|
||||||
|
+ (info->ctmask | (dscp << info->shift_bits));
|
||||||
|
+ }
|
||||||
|
if (READ_ONCE(ct->mark) != newmark) {
|
||||||
|
WRITE_ONCE(ct->mark, newmark);
|
||||||
|
nf_conntrack_event_cache(IPCT_MARK, ct);
|
||||||
|
@@ -83,20 +94,36 @@ static unsigned int
|
||||||
|
connmark_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||||
|
{
|
||||||
|
const struct xt_connmark_tginfo1 *info = par->targinfo;
|
||||||
|
- const struct xt_connmark_tginfo2 info2 = {
|
||||||
|
+ const struct xt_connmark_tginfo3 info3 = {
|
||||||
|
.ctmark = info->ctmark,
|
||||||
|
.ctmask = info->ctmask,
|
||||||
|
.nfmask = info->nfmask,
|
||||||
|
.mode = info->mode,
|
||||||
|
+ .func = XT_CONNMARK_VALUE
|
||||||
|
};
|
||||||
|
|
||||||
|
- return connmark_tg_shift(skb, &info2);
|
||||||
|
+ return connmark_tg_shift(skb, &info3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
connmark_tg_v2(struct sk_buff *skb, const struct xt_action_param *par)
|
||||||
|
{
|
||||||
|
const struct xt_connmark_tginfo2 *info = par->targinfo;
|
||||||
|
+ const struct xt_connmark_tginfo3 info3 = {
|
||||||
|
+ .ctmark = info->ctmark,
|
||||||
|
+ .ctmask = info->ctmask,
|
||||||
|
+ .nfmask = info->nfmask,
|
||||||
|
+ .mode = info->mode,
|
||||||
|
+ .func = XT_CONNMARK_VALUE
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ return connmark_tg_shift(skb, &info3);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static unsigned int
|
||||||
|
+connmark_tg_v3(struct sk_buff *skb, const struct xt_action_param *par)
|
||||||
|
+{
|
||||||
|
+ const struct xt_connmark_tginfo3 *info = par->targinfo;
|
||||||
|
|
||||||
|
return connmark_tg_shift(skb, info);
|
||||||
|
}
|
||||||
|
@@ -167,6 +194,16 @@ static struct xt_target connmark_tg_reg[
|
||||||
|
.targetsize = sizeof(struct xt_connmark_tginfo2),
|
||||||
|
.destroy = connmark_tg_destroy,
|
||||||
|
.me = THIS_MODULE,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .name = "CONNMARK",
|
||||||
|
+ .revision = 3,
|
||||||
|
+ .family = NFPROTO_UNSPEC,
|
||||||
|
+ .checkentry = connmark_tg_check,
|
||||||
|
+ .target = connmark_tg_v3,
|
||||||
|
+ .targetsize = sizeof(struct xt_connmark_tginfo3),
|
||||||
|
+ .destroy = connmark_tg_destroy,
|
||||||
|
+ .me = THIS_MODULE,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
From 6d3bc769657b0ee7c7506dad9911111c4226a7ea Mon Sep 17 00:00:00 2001
|
||||||
|
From: Imre Kaloz <kaloz@openwrt.org>
|
||||||
|
Date: Fri, 7 Jul 2017 17:21:05 +0200
|
||||||
|
Subject: mac80211: increase wireless mesh header size
|
||||||
|
|
||||||
|
lede-commit 3d4466cfd8f75f717efdb1f96fdde3c70d865fc1
|
||||||
|
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
||||||
|
---
|
||||||
|
include/linux/netdevice.h | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/include/linux/netdevice.h
|
||||||
|
+++ b/include/linux/netdevice.h
|
||||||
|
@@ -149,8 +149,8 @@ static inline bool dev_xmit_complete(int
|
||||||
|
|
||||||
|
#if defined(CONFIG_HYPERV_NET)
|
||||||
|
# define LL_MAX_HEADER 128
|
||||||
|
-#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
|
||||||
|
-# if defined(CONFIG_MAC80211_MESH)
|
||||||
|
+#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) || 1
|
||||||
|
+# if defined(CONFIG_MAC80211_MESH) || 1
|
||||||
|
# define LL_MAX_HEADER 128
|
||||||
|
# else
|
||||||
|
# define LL_MAX_HEADER 96
|
|
@ -0,0 +1,27 @@
|
||||||
|
From a6ccb238939b25851474a279b20367fd24a0e816 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Fri, 7 Jul 2017 17:21:53 +0200
|
||||||
|
Subject: hack: net: fq_codel: tune defaults for small devices
|
||||||
|
|
||||||
|
Assume that x86_64 devices always have a big memory and do not need this
|
||||||
|
optimization compared to devices with only 32 MB or 64 MB RAM.
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
net/sched/sch_fq_codel.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/net/sched/sch_fq_codel.c
|
||||||
|
+++ b/net/sched/sch_fq_codel.c
|
||||||
|
@@ -471,7 +471,11 @@ static int fq_codel_init(struct Qdisc *s
|
||||||
|
|
||||||
|
sch->limit = 10*1024;
|
||||||
|
q->flows_cnt = 1024;
|
||||||
|
+#ifdef CONFIG_X86_64
|
||||||
|
q->memory_limit = 32 << 20; /* 32 MBytes */
|
||||||
|
+#else
|
||||||
|
+ q->memory_limit = 4 << 20; /* 4 MBytes */
|
||||||
|
+#endif
|
||||||
|
q->drop_batch_size = 64;
|
||||||
|
q->quantum = psched_mtu(qdisc_dev(sch));
|
||||||
|
INIT_LIST_HEAD(&q->new_flows);
|
|
@ -0,0 +1,25 @@
|
||||||
|
From 804fbb3f2ec9283f7b778e057a68bfff440a0be6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||||
|
Date: Wed, 30 Mar 2022 22:51:55 +0100
|
||||||
|
Subject: [PATCH] kernel: ct: size the hashtable more adequately
|
||||||
|
|
||||||
|
To set the default size of the connection tracking hash table, a divider of
|
||||||
|
16384 becomes inadequate for a router handling lots of connections. Divide by
|
||||||
|
2048 instead, making the default size scale better with the available RAM.
|
||||||
|
|
||||||
|
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||||
|
---
|
||||||
|
net/netfilter/nf_conntrack_core.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/net/netfilter/nf_conntrack_core.c
|
||||||
|
+++ b/net/netfilter/nf_conntrack_core.c
|
||||||
|
@@ -2705,7 +2705,7 @@ int nf_conntrack_init_start(void)
|
||||||
|
|
||||||
|
if (!nf_conntrack_htable_size) {
|
||||||
|
nf_conntrack_htable_size
|
||||||
|
- = (((nr_pages << PAGE_SHIFT) / 16384)
|
||||||
|
+ = (((nr_pages << PAGE_SHIFT) / 2048)
|
||||||
|
/ sizeof(struct hlist_head));
|
||||||
|
if (BITS_PER_LONG >= 64 &&
|
||||||
|
nr_pages > (4 * (1024 * 1024 * 1024 / PAGE_SIZE)))
|
|
@ -0,0 +1,131 @@
|
||||||
|
From 36e516290611e613aa92996cb4339561452695b4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Fri, 7 Jul 2017 17:24:23 +0200
|
||||||
|
Subject: net: swconfig: adds openwrt switch layer
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
drivers/net/phy/Kconfig | 83 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
drivers/net/phy/Makefile | 15 +++++++++
|
||||||
|
include/uapi/linux/Kbuild | 1 +
|
||||||
|
3 files changed, 99 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/net/phy/Kconfig
|
||||||
|
+++ b/drivers/net/phy/Kconfig
|
||||||
|
@@ -69,6 +69,80 @@ config SFP
|
||||||
|
depends on HWMON || HWMON=n
|
||||||
|
select MDIO_I2C
|
||||||
|
|
||||||
|
+comment "Switch configuration API + drivers"
|
||||||
|
+
|
||||||
|
+config SWCONFIG
|
||||||
|
+ tristate "Switch configuration API"
|
||||||
|
+ help
|
||||||
|
+ Switch configuration API using netlink. This allows
|
||||||
|
+ you to configure the VLAN features of certain switches.
|
||||||
|
+
|
||||||
|
+config SWCONFIG_LEDS
|
||||||
|
+ bool "Switch LED trigger support"
|
||||||
|
+ depends on (SWCONFIG && LEDS_TRIGGERS)
|
||||||
|
+
|
||||||
|
+config ADM6996_PHY
|
||||||
|
+ tristate "Driver for ADM6996 switches"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+ help
|
||||||
|
+ Currently supports the ADM6996FC and ADM6996M switches.
|
||||||
|
+ Support for FC is very limited.
|
||||||
|
+
|
||||||
|
+config AR8216_PHY
|
||||||
|
+ tristate "Driver for Atheros AR8216/8327 switches"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+ select ETHERNET_PACKET_MANGLE
|
||||||
|
+
|
||||||
|
+config AR8216_PHY_LEDS
|
||||||
|
+ bool "Atheros AR8216 switch LED support"
|
||||||
|
+ depends on (AR8216_PHY && LEDS_CLASS)
|
||||||
|
+
|
||||||
|
+source "drivers/net/phy/b53/Kconfig"
|
||||||
|
+
|
||||||
|
+config IP17XX_PHY
|
||||||
|
+ tristate "Driver for IC+ IP17xx switches"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+config PSB6970_PHY
|
||||||
|
+ tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+config RTL8306_PHY
|
||||||
|
+ tristate "Driver for Realtek RTL8306S switches"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+config RTL8366_SMI
|
||||||
|
+ tristate "Driver for the RTL8366 SMI interface"
|
||||||
|
+ depends on GPIOLIB
|
||||||
|
+ help
|
||||||
|
+ This module implements the SMI interface protocol which is used
|
||||||
|
+ by some RTL8366 ethernet switch devices via the generic GPIO API.
|
||||||
|
+
|
||||||
|
+if RTL8366_SMI
|
||||||
|
+
|
||||||
|
+config RTL8366_SMI_DEBUG_FS
|
||||||
|
+ bool "RTL8366 SMI interface debugfs support"
|
||||||
|
+ depends on DEBUG_FS
|
||||||
|
+ default n
|
||||||
|
+
|
||||||
|
+config RTL8366S_PHY
|
||||||
|
+ tristate "Driver for the Realtek RTL8366S switch"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+config RTL8366RB_PHY
|
||||||
|
+ tristate "Driver for the Realtek RTL8366RB switch"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+config RTL8367_PHY
|
||||||
|
+ tristate "Driver for the Realtek RTL8367R/M switches"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+config RTL8367B_PHY
|
||||||
|
+ tristate "Driver fot the Realtek RTL8367R-VB switch"
|
||||||
|
+ select SWCONFIG
|
||||||
|
+
|
||||||
|
+endif # RTL8366_SMI
|
||||||
|
+
|
||||||
|
comment "MII PHY device drivers"
|
||||||
|
|
||||||
|
config AMD_PHY
|
||||||
|
--- a/drivers/net/phy/Makefile
|
||||||
|
+++ b/drivers/net/phy/Makefile
|
||||||
|
@@ -24,6 +24,21 @@ libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_
|
||||||
|
obj-$(CONFIG_PHYLINK) += phylink.o
|
||||||
|
obj-$(CONFIG_PHYLIB) += libphy.o
|
||||||
|
|
||||||
|
+obj-$(CONFIG_SWCONFIG) += swconfig.o
|
||||||
|
+obj-$(CONFIG_ADM6996_PHY) += adm6996.o
|
||||||
|
+obj-$(CONFIG_AR8216_PHY) += ar8xxx.o
|
||||||
|
+ar8xxx-y += ar8216.o
|
||||||
|
+ar8xxx-y += ar8327.o
|
||||||
|
+obj-$(CONFIG_SWCONFIG_B53) += b53/
|
||||||
|
+obj-$(CONFIG_IP17XX_PHY) += ip17xx.o
|
||||||
|
+obj-$(CONFIG_PSB6970_PHY) += psb6970.o
|
||||||
|
+obj-$(CONFIG_RTL8306_PHY) += rtl8306.o
|
||||||
|
+obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o
|
||||||
|
+obj-$(CONFIG_RTL8366S_PHY) += rtl8366s.o
|
||||||
|
+obj-$(CONFIG_RTL8366RB_PHY) += rtl8366rb.o
|
||||||
|
+obj-$(CONFIG_RTL8367_PHY) += rtl8367.o
|
||||||
|
+obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o
|
||||||
|
+
|
||||||
|
obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += mii_timestamper.o
|
||||||
|
|
||||||
|
obj-$(CONFIG_SFP) += sfp.o
|
||||||
|
--- a/include/linux/platform_data/b53.h
|
||||||
|
+++ b/include/linux/platform_data/b53.h
|
||||||
|
@@ -29,6 +29,9 @@ struct b53_platform_data {
|
||||||
|
u32 chip_id;
|
||||||
|
u16 enabled_ports;
|
||||||
|
|
||||||
|
+ /* allow to specify an ethX alias */
|
||||||
|
+ const char *alias;
|
||||||
|
+
|
||||||
|
/* only used by MMAP'd driver */
|
||||||
|
unsigned big_endian:1;
|
||||||
|
void __iomem *regs;
|
|
@ -0,0 +1,21 @@
|
||||||
|
From ebd924d773223593142d417c41d4ee6fa16f1805 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:45:56 +0200
|
||||||
|
Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/net/dsa/mv88e6xxx/chip.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
||||||
|
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
||||||
|
@@ -3486,6 +3486,9 @@ static int mv88e6xxx_setup_port(struct m
|
||||||
|
else
|
||||||
|
reg = 1 << port;
|
||||||
|
|
||||||
|
+ /* Disable ATU member violation interrupt */
|
||||||
|
+ reg |= MV88E6XXX_PORT_ASSOC_VECTOR_IGNORE_WRONG;
|
||||||
|
+
|
||||||
|
err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_ASSOC_VECTOR,
|
||||||
|
reg);
|
||||||
|
if (err)
|
|
@ -0,0 +1,74 @@
|
||||||
|
From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Bauer <mail@david-bauer.net>
|
||||||
|
Date: Sun, 26 Jul 2020 02:38:31 +0200
|
||||||
|
Subject: [PATCH] net: usb: r8152: add LED configuration from OF
|
||||||
|
|
||||||
|
This adds the ability to configure the LED configuration register using
|
||||||
|
OF. This way, the correct value for board specific LED configuration can
|
||||||
|
be determined.
|
||||||
|
|
||||||
|
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||||
|
---
|
||||||
|
drivers/net/usb/r8152.c | 23 +++++++++++++++++++++++
|
||||||
|
1 file changed, 23 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/net/usb/r8152.c
|
||||||
|
+++ b/drivers/net/usb/r8152.c
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
#include <linux/mii.h>
|
||||||
|
#include <linux/ethtool.h>
|
||||||
|
#include <linux/usb.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
#include <linux/crc32.h>
|
||||||
|
#include <linux/if_vlan.h>
|
||||||
|
#include <linux/uaccess.h>
|
||||||
|
@@ -6896,6 +6897,22 @@ static void rtl_tally_reset(struct r8152
|
||||||
|
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int r8152_led_configuration(struct r8152 *tp)
|
||||||
|
+{
|
||||||
|
+ u32 led_data;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data",
|
||||||
|
+ &led_data);
|
||||||
|
+
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void r8152b_init(struct r8152 *tp)
|
||||||
|
{
|
||||||
|
u32 ocp_data;
|
||||||
|
@@ -6937,6 +6954,8 @@ static void r8152b_init(struct r8152 *tp
|
||||||
|
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
|
||||||
|
ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
|
||||||
|
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
|
||||||
|
+
|
||||||
|
+ r8152_led_configuration(tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r8153_init(struct r8152 *tp)
|
||||||
|
@@ -7077,6 +7096,8 @@ static void r8153_init(struct r8152 *tp)
|
||||||
|
tp->coalesce = COALESCE_SLOW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ r8152_led_configuration(tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r8153b_init(struct r8152 *tp)
|
||||||
|
@@ -7159,6 +7180,8 @@ static void r8153b_init(struct r8152 *tp
|
||||||
|
rtl_tally_reset(tp);
|
||||||
|
|
||||||
|
tp->coalesce = 15000; /* 15 us */
|
||||||
|
+
|
||||||
|
+ r8152_led_configuration(tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r8153c_init(struct r8152 *tp)
|
|
@ -0,0 +1,54 @@
|
||||||
|
From 3ee05f4aa64fc86af3be5bc176ba5808de9260a7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Bauer <mail@david-bauer.net>
|
||||||
|
Date: Sun, 26 Jul 2020 15:30:33 +0200
|
||||||
|
Subject: [PATCH] dt-bindings: net: add RTL8152 binding documentation
|
||||||
|
|
||||||
|
Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
|
||||||
|
adapters.
|
||||||
|
|
||||||
|
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||||
|
---
|
||||||
|
.../bindings/net/realtek,rtl8152.yaml | 36 +++++++++++++++++++
|
||||||
|
1 file changed, 36 insertions(+)
|
||||||
|
create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
|
||||||
|
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
|
||||||
|
@@ -0,0 +1,36 @@
|
||||||
|
+# SPDX-License-Identifier: GPL-2.0
|
||||||
|
+%YAML 1.2
|
||||||
|
+---
|
||||||
|
+$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
|
||||||
|
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||||
|
+
|
||||||
|
+title: Realtek RTL8152/RTL8153 series USB ethernet
|
||||||
|
+
|
||||||
|
+maintainers:
|
||||||
|
+ - David Bauer <mail@david-bauer.net>
|
||||||
|
+
|
||||||
|
+properties:
|
||||||
|
+ compatible:
|
||||||
|
+ oneOf:
|
||||||
|
+ - items:
|
||||||
|
+ - enum:
|
||||||
|
+ - realtek,rtl8152
|
||||||
|
+ - realtek,rtl8153
|
||||||
|
+
|
||||||
|
+ reg:
|
||||||
|
+ description: The device number on the USB bus
|
||||||
|
+
|
||||||
|
+ realtek,led-data:
|
||||||
|
+ description: Value to be written to the LED configuration register.
|
||||||
|
+
|
||||||
|
+required:
|
||||||
|
+ - compatible
|
||||||
|
+ - reg
|
||||||
|
+
|
||||||
|
+examples:
|
||||||
|
+ - |
|
||||||
|
+ usb-eth@2 {
|
||||||
|
+ compatible = "realtek,rtl8153";
|
||||||
|
+ reg = <2>;
|
||||||
|
+ realtek,led-data = <0x87>;
|
||||||
|
+ };
|
||||||
|
\ No newline at end of file
|
|
@ -0,0 +1,72 @@
|
||||||
|
From cc225d163b5a4f7a0d1968298bf7927306646a47 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Bauer <mail@david-bauer.net>
|
||||||
|
Date: Fri, 28 Apr 2023 01:53:01 +0200
|
||||||
|
Subject: [PATCH] net: phy: mediatek-ge: add LED configuration interface
|
||||||
|
|
||||||
|
This adds a small hack similar to the one used for ar8xxx switches to
|
||||||
|
read a reg:value map for configuring the LED configuration registers.
|
||||||
|
|
||||||
|
This allows OpenWrt to write device-specific LED action as well as blink
|
||||||
|
configurations. It is unlikely to be accepted upstream, as upstream
|
||||||
|
plans on integrating their own framework for handling these LEDs.
|
||||||
|
|
||||||
|
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||||
|
---
|
||||||
|
drivers/net/phy/mediatek-ge.c | 33 +++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 33 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/net/phy/mediatek-ge.c
|
||||||
|
+++ b/drivers/net/phy/mediatek-ge.c
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
+#include <linux/of.h>
|
||||||
|
#include <linux/bitfield.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/phy.h>
|
||||||
|
@@ -53,6 +54,36 @@ static int mt7530_phy_config_init(struct
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int mt7530_led_config_of(struct phy_device *phydev)
|
||||||
|
+{
|
||||||
|
+ struct device_node *np = phydev->mdio.dev.of_node;
|
||||||
|
+ const __be32 *paddr;
|
||||||
|
+ int len;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ paddr = of_get_property(np, "mediatek,led-config", &len);
|
||||||
|
+ if (!paddr)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (len < (2 * sizeof(*paddr)))
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ len /= sizeof(*paddr);
|
||||||
|
+
|
||||||
|
+ phydev_warn(phydev, "Configure LED registers (num=%d)\n", len);
|
||||||
|
+ for (i = 0; i < len - 1; i += 2) {
|
||||||
|
+ u32 reg;
|
||||||
|
+ u32 val;
|
||||||
|
+
|
||||||
|
+ reg = be32_to_cpup(paddr + i);
|
||||||
|
+ val = be32_to_cpup(paddr + i + 1);
|
||||||
|
+
|
||||||
|
+ phy_write_mmd(phydev, MDIO_MMD_VEND2, reg, val);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int mt7531_phy_config_init(struct phy_device *phydev)
|
||||||
|
{
|
||||||
|
mtk_gephy_config_init(phydev);
|
||||||
|
@@ -65,6 +96,9 @@ static int mt7531_phy_config_init(struct
|
||||||
|
phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x13, 0x404);
|
||||||
|
phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x14, 0x404);
|
||||||
|
|
||||||
|
+ /* LED Config*/
|
||||||
|
+ mt7530_led_config_of(phydev);
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
From 3cb240533ab787899dc7f17aa7d6c5b4810e2e58 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||||
|
Date: Fri, 7 Jul 2017 17:26:01 +0200
|
||||||
|
Subject: bcm53xx: bgmac: use srab switch driver
|
||||||
|
|
||||||
|
use the srab switch driver on these SoCs.
|
||||||
|
|
||||||
|
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 +
|
||||||
|
drivers/net/ethernet/broadcom/bgmac.c | 24 ++++++++++++++++++++++++
|
||||||
|
drivers/net/ethernet/broadcom/bgmac.h | 4 ++++
|
||||||
|
3 files changed, 29 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||||
|
@@ -280,6 +280,7 @@ static int bgmac_probe(struct bcma_devic
|
||||||
|
bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
|
||||||
|
bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
|
||||||
|
bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
|
||||||
|
+ bgmac->feature_flags |= BGMAC_FEAT_SRAB;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bgmac.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bgmac.c
|
||||||
|
@@ -12,6 +12,7 @@
|
||||||
|
#include <linux/bcma/bcma.h>
|
||||||
|
#include <linux/etherdevice.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
+#include <linux/platform_data/b53.h>
|
||||||
|
#include <linux/bcm47xx_nvram.h>
|
||||||
|
#include <linux/phy.h>
|
||||||
|
#include <linux/phy_fixed.h>
|
||||||
|
@@ -1408,6 +1409,17 @@ static const struct ethtool_ops bgmac_et
|
||||||
|
.set_link_ksettings = phy_ethtool_set_link_ksettings,
|
||||||
|
};
|
||||||
|
|
||||||
|
+static struct b53_platform_data bgmac_b53_pdata = {
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct platform_device bgmac_b53_dev = {
|
||||||
|
+ .name = "b53-srab-switch",
|
||||||
|
+ .id = -1,
|
||||||
|
+ .dev = {
|
||||||
|
+ .platform_data = &bgmac_b53_pdata,
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
/**************************************************
|
||||||
|
* MII
|
||||||
|
**************************************************/
|
||||||
|
@@ -1546,6 +1558,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
|
||||||
|
|
||||||
|
bgmac->in_init = false;
|
||||||
|
|
||||||
|
+ if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
|
||||||
|
+ bgmac_b53_pdata.regs = ioremap(0x18007000, 0x1000);
|
||||||
|
+
|
||||||
|
+ err = platform_device_register(&bgmac_b53_dev);
|
||||||
|
+ if (!err)
|
||||||
|
+ bgmac->b53_device = &bgmac_b53_dev;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
err = register_netdev(bgmac->net_dev);
|
||||||
|
if (err) {
|
||||||
|
dev_err(bgmac->dev, "Cannot register net device\n");
|
||||||
|
@@ -1568,6 +1588,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
|
||||||
|
|
||||||
|
void bgmac_enet_remove(struct bgmac *bgmac)
|
||||||
|
{
|
||||||
|
+ if (bgmac->b53_device)
|
||||||
|
+ platform_device_unregister(&bgmac_b53_dev);
|
||||||
|
+ bgmac->b53_device = NULL;
|
||||||
|
+
|
||||||
|
unregister_netdev(bgmac->net_dev);
|
||||||
|
phy_disconnect(bgmac->net_dev->phydev);
|
||||||
|
netif_napi_del(&bgmac->napi);
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bgmac.h
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bgmac.h
|
||||||
|
@@ -388,6 +388,7 @@
|
||||||
|
#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18)
|
||||||
|
#define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19)
|
||||||
|
#define BGMAC_FEAT_IDM_MASK BIT(20)
|
||||||
|
+#define BGMAC_FEAT_SRAB BIT(21)
|
||||||
|
|
||||||
|
struct bgmac_slot_info {
|
||||||
|
union {
|
||||||
|
@@ -495,6 +496,9 @@ struct bgmac {
|
||||||
|
void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
|
||||||
|
u32 set);
|
||||||
|
int (*phy_connect)(struct bgmac *bgmac);
|
||||||
|
+
|
||||||
|
+ /* platform device for associated switch */
|
||||||
|
+ struct platform_device *b53_device;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bgmac *bgmac_alloc(struct device *dev);
|
|
@ -0,0 +1,43 @@
|
||||||
|
From f81700b6bb2eda3756247bce472d8eaf6f466f61 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:49:26 +0200
|
||||||
|
Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/net/usb/qmi_wwan.c | 1 +
|
||||||
|
drivers/usb/serial/option.c | 7 +++++++
|
||||||
|
2 files changed, 8 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/net/usb/qmi_wwan.c
|
||||||
|
+++ b/drivers/net/usb/qmi_wwan.c
|
||||||
|
@@ -1088,6 +1088,7 @@ static const struct usb_device_id produc
|
||||||
|
{QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */
|
||||||
|
{QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */
|
||||||
|
{QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */
|
||||||
|
+ {QMI_MATCH_FF_FF_FF(0x05c6, 0xf601)}, /* MeigLink SLM750 */
|
||||||
|
|
||||||
|
/* 3. Combined interface devices matching on interface number */
|
||||||
|
{QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
|
||||||
|
--- a/drivers/usb/serial/option.c
|
||||||
|
+++ b/drivers/usb/serial/option.c
|
||||||
|
@@ -244,6 +244,8 @@ static void option_instat_callback(struc
|
||||||
|
#define UBLOX_PRODUCT_R410M 0x90b2
|
||||||
|
/* These Yuga products use Qualcomm's vendor ID */
|
||||||
|
#define YUGA_PRODUCT_CLM920_NC5 0x9625
|
||||||
|
+/* These MeigLink products use Qualcomm's vendor ID */
|
||||||
|
+#define MEIGLINK_PRODUCT_SLM750 0xf601
|
||||||
|
|
||||||
|
#define QUECTEL_VENDOR_ID 0x2c7c
|
||||||
|
/* These Quectel products use Quectel's vendor ID */
|
||||||
|
@@ -1180,6 +1182,11 @@ static const struct usb_device_id option
|
||||||
|
.driver_info = ZLP },
|
||||||
|
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
|
||||||
|
.driver_info = RSVD(4) },
|
||||||
|
+ /* Meiglink products using Qualcomm vendor ID */
|
||||||
|
+ // Works OK. In case of some issues check macros that are used by Quectel Products
|
||||||
|
+ { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, MEIGLINK_PRODUCT_SLM750, 0xff, 0xff, 0xff),
|
||||||
|
+ .driver_info = NUMEP2 },
|
||||||
|
+ { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, MEIGLINK_PRODUCT_SLM750, 0xff, 0, 0) },
|
||||||
|
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
|
||||||
|
.driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
|
||||||
|
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
|
|
@ -0,0 +1,187 @@
|
||||||
|
From e4d708702e6c98f2111e33201a264d6788564cb2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Fri, 12 May 2023 11:08:43 +0200
|
||||||
|
Subject: [PATCH] ssb_sprom: add generic kernel support for Broadcom Fallback SPROMs
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/bcma/Kconfig | 4 ++++
|
||||||
|
drivers/bcma/Makefile | 1 +
|
||||||
|
drivers/bcma/bcma_private.h | 4 ++++
|
||||||
|
drivers/bcma/main.c | 8 ++++++++
|
||||||
|
drivers/bcma/sprom.c | 23 ++++++++++++++---------
|
||||||
|
drivers/ssb/Kconfig | 5 +++++
|
||||||
|
drivers/ssb/Makefile | 1 +
|
||||||
|
drivers/ssb/main.c | 8 ++++++++
|
||||||
|
drivers/ssb/sprom.c | 12 +++++++++++-
|
||||||
|
drivers/ssb/ssb_private.h | 4 ++++
|
||||||
|
10 files changed, 60 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/bcma/Kconfig
|
||||||
|
+++ b/drivers/bcma/Kconfig
|
||||||
|
@@ -18,6 +18,10 @@ config BCMA_BLOCKIO
|
||||||
|
bool
|
||||||
|
default y
|
||||||
|
|
||||||
|
+config BCMA_FALLBACK_SPROM
|
||||||
|
+ bool
|
||||||
|
+ default y
|
||||||
|
+
|
||||||
|
config BCMA_HOST_PCI_POSSIBLE
|
||||||
|
bool
|
||||||
|
depends on PCI = y
|
||||||
|
--- a/drivers/bcma/Makefile
|
||||||
|
+++ b/drivers/bcma/Makefile
|
||||||
|
@@ -11,6 +11,7 @@ bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE)
|
||||||
|
bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
|
||||||
|
bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o
|
||||||
|
bcma-$(CONFIG_BCMA_DRIVER_GPIO) += driver_gpio.o
|
||||||
|
+bcma-$(CONFIG_BCMA_FALLBACK_SPROM) += fallback-sprom.o
|
||||||
|
bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
|
||||||
|
bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o
|
||||||
|
obj-$(CONFIG_BCMA) += bcma.o
|
||||||
|
--- a/drivers/bcma/bcma_private.h
|
||||||
|
+++ b/drivers/bcma/bcma_private.h
|
||||||
|
@@ -38,6 +38,10 @@ int bcma_bus_resume(struct bcma_bus *bus
|
||||||
|
void bcma_detect_chip(struct bcma_bus *bus);
|
||||||
|
int bcma_bus_scan(struct bcma_bus *bus);
|
||||||
|
|
||||||
|
+/* fallback-sprom.c */
|
||||||
|
+int __init bcma_fbs_register(void);
|
||||||
|
+int bcma_get_fallback_sprom(struct bcma_bus *dev, struct ssb_sprom *out);
|
||||||
|
+
|
||||||
|
/* sprom.c */
|
||||||
|
int bcma_sprom_get(struct bcma_bus *bus);
|
||||||
|
|
||||||
|
--- a/drivers/bcma/main.c
|
||||||
|
+++ b/drivers/bcma/main.c
|
||||||
|
@@ -668,6 +668,14 @@ static int __init bcma_modinit(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
+#ifdef CONFIG_BCMA_FALLBACK_SPROM
|
||||||
|
+ err = bcma_fbs_register();
|
||||||
|
+ if (err) {
|
||||||
|
+ pr_err("Fallback SPROM initialization failed\n");
|
||||||
|
+ err = 0;
|
||||||
|
+ }
|
||||||
|
+#endif /* CONFIG_BCMA_FALLBACK_SPROM */
|
||||||
|
+
|
||||||
|
err = bcma_init_bus_register();
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
--- a/drivers/bcma/sprom.c
|
||||||
|
+++ b/drivers/bcma/sprom.c
|
||||||
|
@@ -51,21 +51,26 @@ static int bcma_fill_sprom_with_fallback
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
- if (!get_fallback_sprom) {
|
||||||
|
+ if (get_fallback_sprom)
|
||||||
|
+ err = get_fallback_sprom(bus, out);
|
||||||
|
+
|
||||||
|
+#ifdef CONFIG_BCMA_FALLBACK_SPROM
|
||||||
|
+ if (!get_fallback_sprom || err)
|
||||||
|
+ err = bcma_get_fallback_sprom(bus, out);
|
||||||
|
+#else
|
||||||
|
+ if (!get_fallback_sprom)
|
||||||
|
err = -ENOENT;
|
||||||
|
- goto fail;
|
||||||
|
- }
|
||||||
|
+#endif /* CONFIG_BCMA_FALLBACK_SPROM */
|
||||||
|
|
||||||
|
- err = get_fallback_sprom(bus, out);
|
||||||
|
- if (err)
|
||||||
|
- goto fail;
|
||||||
|
+ if (err) {
|
||||||
|
+ bcma_warn(bus, "Using fallback SPROM failed (err %d)\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
bcma_debug(bus, "Using SPROM revision %d provided by platform.\n",
|
||||||
|
bus->sprom.revision);
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
-fail:
|
||||||
|
- bcma_warn(bus, "Using fallback SPROM failed (err %d)\n", err);
|
||||||
|
- return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************
|
||||||
|
--- a/drivers/ssb/Kconfig
|
||||||
|
+++ b/drivers/ssb/Kconfig
|
||||||
|
@@ -25,6 +25,11 @@ if SSB
|
||||||
|
config SSB_SPROM
|
||||||
|
bool
|
||||||
|
|
||||||
|
+config SSB_FALLBACK_SPROM
|
||||||
|
+ bool
|
||||||
|
+ depends on SSB_PCIHOST
|
||||||
|
+ default y
|
||||||
|
+
|
||||||
|
# Support for Block-I/O. SELECT this from the driver that needs it.
|
||||||
|
config SSB_BLOCKIO
|
||||||
|
bool
|
||||||
|
--- a/drivers/ssb/Makefile
|
||||||
|
+++ b/drivers/ssb/Makefile
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
# core
|
||||||
|
ssb-y += main.o scan.o
|
||||||
|
ssb-$(CONFIG_SSB_EMBEDDED) += embedded.o
|
||||||
|
+ssb-$(CONFIG_SSB_FALLBACK_SPROM) += fallback-sprom.o
|
||||||
|
ssb-$(CONFIG_SSB_SPROM) += sprom.o
|
||||||
|
|
||||||
|
# host support
|
||||||
|
--- a/drivers/ssb/main.c
|
||||||
|
+++ b/drivers/ssb/main.c
|
||||||
|
@@ -1287,6 +1287,14 @@ static int __init ssb_modinit(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
+#ifdef CONFIG_SSB_FALLBACK_SPROM
|
||||||
|
+ err = ssb_fbs_register();
|
||||||
|
+ if (err) {
|
||||||
|
+ pr_err("Fallback SPROM initialization failed\n");
|
||||||
|
+ err = 0;
|
||||||
|
+ }
|
||||||
|
+#endif /* CONFIG_SSB_FALLBACK_SPROM */
|
||||||
|
+
|
||||||
|
/* See the comment at the ssb_is_early_boot definition */
|
||||||
|
ssb_is_early_boot = 0;
|
||||||
|
err = bus_register(&ssb_bustype);
|
||||||
|
--- a/drivers/ssb/sprom.c
|
||||||
|
+++ b/drivers/ssb/sprom.c
|
||||||
|
@@ -180,10 +180,20 @@ int ssb_arch_register_fallback_sprom(int
|
||||||
|
|
||||||
|
int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out)
|
||||||
|
{
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ if (get_fallback_sprom)
|
||||||
|
+ err = get_fallback_sprom(bus, out);
|
||||||
|
+
|
||||||
|
+#ifdef CONFIG_SSB_FALLBACK_SPROM
|
||||||
|
+ if (!get_fallback_sprom || err)
|
||||||
|
+ err = ssb_get_fallback_sprom(bus, out);
|
||||||
|
+#else
|
||||||
|
if (!get_fallback_sprom)
|
||||||
|
return -ENOENT;
|
||||||
|
+#endif /* CONFIG_SSB_FALLBACK_SPROM */
|
||||||
|
|
||||||
|
- return get_fallback_sprom(bus, out);
|
||||||
|
+ return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* https://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
|
||||||
|
--- a/drivers/ssb/ssb_private.h
|
||||||
|
+++ b/drivers/ssb/ssb_private.h
|
||||||
|
@@ -143,6 +143,10 @@ extern int ssb_bus_scan(struct ssb_bus *
|
||||||
|
extern void ssb_iounmap(struct ssb_bus *ssb);
|
||||||
|
|
||||||
|
|
||||||
|
+/* fallback-sprom.c */
|
||||||
|
+int __init ssb_fbs_register(void);
|
||||||
|
+int ssb_get_fallback_sprom(struct ssb_bus *dev, struct ssb_sprom *out);
|
||||||
|
+
|
||||||
|
/* sprom.c */
|
||||||
|
extern
|
||||||
|
ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf,
|
408
6.7/target/linux/generic/hack-6.7/902-debloat_proc.patch
Normal file
408
6.7/target/linux/generic/hack-6.7/902-debloat_proc.patch
Normal file
|
@ -0,0 +1,408 @@
|
||||||
|
From 9e3f1d0805b2d919904dd9a4ff0d956314cc3cba Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Sat, 8 Jul 2017 08:20:09 +0200
|
||||||
|
Subject: debloat: procfs
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
fs/locks.c | 2 ++
|
||||||
|
fs/proc/Kconfig | 5 +++++
|
||||||
|
fs/proc/consoles.c | 3 +++
|
||||||
|
fs/proc/proc_tty.c | 11 ++++++++++-
|
||||||
|
include/net/snmp.h | 18 +++++++++++++++++-
|
||||||
|
ipc/msg.c | 3 +++
|
||||||
|
ipc/sem.c | 2 ++
|
||||||
|
ipc/shm.c | 2 ++
|
||||||
|
ipc/util.c | 3 +++
|
||||||
|
kernel/exec_domain.c | 2 ++
|
||||||
|
kernel/irq/proc.c | 9 +++++++++
|
||||||
|
kernel/time/timer_list.c | 2 ++
|
||||||
|
mm/vmalloc.c | 2 ++
|
||||||
|
mm/vmstat.c | 8 +++++---
|
||||||
|
net/8021q/vlanproc.c | 6 ++++++
|
||||||
|
net/core/net-procfs.c | 18 ++++++++++++------
|
||||||
|
net/core/sock.c | 2 ++
|
||||||
|
net/ipv4/fib_trie.c | 18 ++++++++++++------
|
||||||
|
net/ipv4/proc.c | 3 +++
|
||||||
|
net/ipv4/route.c | 3 +++
|
||||||
|
20 files changed, 105 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
--- a/fs/locks.c
|
||||||
|
+++ b/fs/locks.c
|
||||||
|
@@ -2909,6 +2909,8 @@ static const struct seq_operations locks
|
||||||
|
|
||||||
|
static int __init proc_locks_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
proc_create_seq_private("locks", 0, NULL, &locks_seq_operations,
|
||||||
|
sizeof(struct locks_iterator), NULL);
|
||||||
|
return 0;
|
||||||
|
--- a/fs/proc/Kconfig
|
||||||
|
+++ b/fs/proc/Kconfig
|
||||||
|
@@ -101,6 +101,11 @@ config PROC_CHILDREN
|
||||||
|
Say Y if you are running any user-space software which takes benefit from
|
||||||
|
this interface. For example, rkt is such a piece of software.
|
||||||
|
|
||||||
|
+config PROC_STRIPPED
|
||||||
|
+ default n
|
||||||
|
+ depends on EXPERT
|
||||||
|
+ bool "Strip non-essential /proc functionality to reduce code size"
|
||||||
|
+
|
||||||
|
config PROC_PID_ARCH_STATUS
|
||||||
|
def_bool n
|
||||||
|
depends on PROC_FS
|
||||||
|
--- a/fs/proc/consoles.c
|
||||||
|
+++ b/fs/proc/consoles.c
|
||||||
|
@@ -92,6 +92,9 @@ static const struct seq_operations conso
|
||||||
|
|
||||||
|
static int __init proc_consoles_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
proc_create_seq("consoles", 0, NULL, &consoles_op);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--- a/fs/proc/proc_tty.c
|
||||||
|
+++ b/fs/proc/proc_tty.c
|
||||||
|
@@ -131,7 +131,10 @@ static const struct seq_operations tty_d
|
||||||
|
void proc_tty_register_driver(struct tty_driver *driver)
|
||||||
|
{
|
||||||
|
struct proc_dir_entry *ent;
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (!driver->driver_name || driver->proc_entry ||
|
||||||
|
!driver->ops->proc_show)
|
||||||
|
return;
|
||||||
|
@@ -148,6 +151,9 @@ void proc_tty_unregister_driver(struct t
|
||||||
|
{
|
||||||
|
struct proc_dir_entry *ent;
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
ent = driver->proc_entry;
|
||||||
|
if (!ent)
|
||||||
|
return;
|
||||||
|
@@ -162,6 +168,9 @@ void proc_tty_unregister_driver(struct t
|
||||||
|
*/
|
||||||
|
void __init proc_tty_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (!proc_mkdir("tty", NULL))
|
||||||
|
return;
|
||||||
|
proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */
|
||||||
|
--- a/include/net/snmp.h
|
||||||
|
+++ b/include/net/snmp.h
|
||||||
|
@@ -124,6 +124,21 @@ struct linux_tls_mib {
|
||||||
|
#define DECLARE_SNMP_STAT(type, name) \
|
||||||
|
extern __typeof__(type) __percpu *name
|
||||||
|
|
||||||
|
+#ifdef CONFIG_PROC_STRIPPED
|
||||||
|
+#define __SNMP_STATS_DUMMY(mib) \
|
||||||
|
+ do { (void) mib->mibs[0]; } while(0)
|
||||||
|
+
|
||||||
|
+#define __SNMP_INC_STATS(mib, field) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define SNMP_INC_STATS(mib, field) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define SNMP_DEC_STATS(mib, field) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define __SNMP_ADD_STATS(mib, field, addend) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define SNMP_ADD_STATS(mib, field, addend) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define SNMP_UPD_PO_STATS(mib, basefield, addend) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+#define __SNMP_UPD_PO_STATS(mib, basefield, addend) __SNMP_STATS_DUMMY(mib)
|
||||||
|
+
|
||||||
|
+#else
|
||||||
|
+
|
||||||
|
#define __SNMP_INC_STATS(mib, field) \
|
||||||
|
__this_cpu_inc(mib->mibs[field])
|
||||||
|
|
||||||
|
@@ -154,8 +169,9 @@ struct linux_tls_mib {
|
||||||
|
__this_cpu_add(ptr[basefield##OCTETS], addend); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
-#if BITS_PER_LONG==32
|
||||||
|
+#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED)
|
||||||
|
|
||||||
|
#define __SNMP_ADD_STATS64(mib, field, addend) \
|
||||||
|
do { \
|
||||||
|
--- a/ipc/msg.c
|
||||||
|
+++ b/ipc/msg.c
|
||||||
|
@@ -1370,6 +1370,9 @@ void __init msg_init(void)
|
||||||
|
{
|
||||||
|
msg_init_ns(&init_ipc_ns);
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
ipc_init_proc_interface("sysvipc/msg",
|
||||||
|
" key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
|
||||||
|
IPC_MSG_IDS, sysvipc_msg_proc_show);
|
||||||
|
--- a/ipc/sem.c
|
||||||
|
+++ b/ipc/sem.c
|
||||||
|
@@ -268,6 +268,8 @@ void sem_exit_ns(struct ipc_namespace *n
|
||||||
|
void __init sem_init(void)
|
||||||
|
{
|
||||||
|
sem_init_ns(&init_ipc_ns);
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
ipc_init_proc_interface("sysvipc/sem",
|
||||||
|
" key semid perms nsems uid gid cuid cgid otime ctime\n",
|
||||||
|
IPC_SEM_IDS, sysvipc_sem_proc_show);
|
||||||
|
--- a/ipc/shm.c
|
||||||
|
+++ b/ipc/shm.c
|
||||||
|
@@ -154,6 +154,8 @@ pure_initcall(ipc_ns_init);
|
||||||
|
|
||||||
|
void __init shm_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
ipc_init_proc_interface("sysvipc/shm",
|
||||||
|
#if BITS_PER_LONG <= 32
|
||||||
|
" key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n",
|
||||||
|
--- a/ipc/util.c
|
||||||
|
+++ b/ipc/util.c
|
||||||
|
@@ -141,6 +141,9 @@ void __init ipc_init_proc_interface(cons
|
||||||
|
struct proc_dir_entry *pde;
|
||||||
|
struct ipc_proc_iface *iface;
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
iface = kmalloc(sizeof(*iface), GFP_KERNEL);
|
||||||
|
if (!iface)
|
||||||
|
return;
|
||||||
|
--- a/kernel/exec_domain.c
|
||||||
|
+++ b/kernel/exec_domain.c
|
||||||
|
@@ -29,6 +29,8 @@ static int execdomains_proc_show(struct
|
||||||
|
|
||||||
|
static int __init proc_execdomains_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
proc_create_single("execdomains", 0, NULL, execdomains_proc_show);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--- a/kernel/irq/proc.c
|
||||||
|
+++ b/kernel/irq/proc.c
|
||||||
|
@@ -341,6 +341,9 @@ void register_irq_proc(unsigned int irq,
|
||||||
|
void __maybe_unused *irqp = (void *)(unsigned long) irq;
|
||||||
|
char name [MAX_NAMELEN];
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip))
|
||||||
|
return;
|
||||||
|
|
||||||
|
@@ -394,6 +397,9 @@ void unregister_irq_proc(unsigned int ir
|
||||||
|
{
|
||||||
|
char name [MAX_NAMELEN];
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (!root_irq_dir || !desc->dir)
|
||||||
|
return;
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
@@ -432,6 +438,9 @@ void init_irq_proc(void)
|
||||||
|
unsigned int irq;
|
||||||
|
struct irq_desc *desc;
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED) && !IS_ENABLED(CONFIG_SMP))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
/* create /proc/irq */
|
||||||
|
root_irq_dir = proc_mkdir("irq", NULL);
|
||||||
|
if (!root_irq_dir)
|
||||||
|
--- a/kernel/time/timer_list.c
|
||||||
|
+++ b/kernel/time/timer_list.c
|
||||||
|
@@ -350,6 +350,8 @@ static int __init init_timer_list_procfs
|
||||||
|
{
|
||||||
|
struct proc_dir_entry *pe;
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
pe = proc_create_seq_private("timer_list", 0400, NULL, &timer_list_sops,
|
||||||
|
sizeof(struct timer_list_iter), NULL);
|
||||||
|
if (!pe)
|
||||||
|
--- a/mm/vmalloc.c
|
||||||
|
+++ b/mm/vmalloc.c
|
||||||
|
@@ -4205,6 +4205,8 @@ static const struct seq_operations vmall
|
||||||
|
|
||||||
|
static int __init proc_vmalloc_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
if (IS_ENABLED(CONFIG_NUMA))
|
||||||
|
proc_create_seq_private("vmallocinfo", 0400, NULL,
|
||||||
|
&vmalloc_op,
|
||||||
|
--- a/mm/vmstat.c
|
||||||
|
+++ b/mm/vmstat.c
|
||||||
|
@@ -2109,10 +2109,12 @@ void __init init_mm_internals(void)
|
||||||
|
start_shepherd_timer();
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_PROC_FS
|
||||||
|
- proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
|
||||||
|
- proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) {
|
||||||
|
+ proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
|
||||||
|
+ proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
|
||||||
|
+ proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
|
||||||
|
+ }
|
||||||
|
proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
|
||||||
|
- proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/net/8021q/vlanproc.c
|
||||||
|
+++ b/net/8021q/vlanproc.c
|
||||||
|
@@ -93,6 +93,9 @@ void vlan_proc_cleanup(struct net *net)
|
||||||
|
{
|
||||||
|
struct vlan_net *vn = net_generic(net, vlan_net_id);
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (vn->proc_vlan_conf)
|
||||||
|
remove_proc_entry(name_conf, vn->proc_vlan_dir);
|
||||||
|
|
||||||
|
@@ -112,6 +115,9 @@ int __net_init vlan_proc_init(struct net
|
||||||
|
{
|
||||||
|
struct vlan_net *vn = net_generic(net, vlan_net_id);
|
||||||
|
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
vn->proc_vlan_dir = proc_net_mkdir(net, name_root, net->proc_net);
|
||||||
|
if (!vn->proc_vlan_dir)
|
||||||
|
goto err;
|
||||||
|
--- a/net/core/net-procfs.c
|
||||||
|
+++ b/net/core/net-procfs.c
|
||||||
|
@@ -319,10 +319,12 @@ static int __net_init dev_proc_net_init(
|
||||||
|
if (!proc_create_net("dev", 0444, net->proc_net, &dev_seq_ops,
|
||||||
|
sizeof(struct seq_net_private)))
|
||||||
|
goto out;
|
||||||
|
- if (!proc_create_seq("softnet_stat", 0444, net->proc_net,
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
|
||||||
|
+ !proc_create_seq("softnet_stat", 0444, net->proc_net,
|
||||||
|
&softnet_seq_ops))
|
||||||
|
goto out_dev;
|
||||||
|
- if (!proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops,
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
|
||||||
|
+ !proc_create_net("ptype", 0444, net->proc_net, &ptype_seq_ops,
|
||||||
|
sizeof(struct seq_net_private)))
|
||||||
|
goto out_softnet;
|
||||||
|
|
||||||
|
@@ -332,9 +334,11 @@ static int __net_init dev_proc_net_init(
|
||||||
|
out:
|
||||||
|
return rc;
|
||||||
|
out_ptype:
|
||||||
|
- remove_proc_entry("ptype", net->proc_net);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ remove_proc_entry("ptype", net->proc_net);
|
||||||
|
out_softnet:
|
||||||
|
- remove_proc_entry("softnet_stat", net->proc_net);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ remove_proc_entry("softnet_stat", net->proc_net);
|
||||||
|
out_dev:
|
||||||
|
remove_proc_entry("dev", net->proc_net);
|
||||||
|
goto out;
|
||||||
|
@@ -344,8 +348,10 @@ static void __net_exit dev_proc_net_exit
|
||||||
|
{
|
||||||
|
wext_proc_exit(net);
|
||||||
|
|
||||||
|
- remove_proc_entry("ptype", net->proc_net);
|
||||||
|
- remove_proc_entry("softnet_stat", net->proc_net);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) {
|
||||||
|
+ remove_proc_entry("ptype", net->proc_net);
|
||||||
|
+ remove_proc_entry("softnet_stat", net->proc_net);
|
||||||
|
+ }
|
||||||
|
remove_proc_entry("dev", net->proc_net);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/net/core/sock.c
|
||||||
|
+++ b/net/core/sock.c
|
||||||
|
@@ -4105,6 +4105,8 @@ static __net_initdata struct pernet_oper
|
||||||
|
|
||||||
|
static int __init proto_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
return register_pernet_subsys(&proto_net_ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/net/ipv4/fib_trie.c
|
||||||
|
+++ b/net/ipv4/fib_trie.c
|
||||||
|
@@ -3032,11 +3032,13 @@ static const struct seq_operations fib_r
|
||||||
|
|
||||||
|
int __net_init fib_proc_init(struct net *net)
|
||||||
|
{
|
||||||
|
- if (!proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops,
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
|
||||||
|
+ !proc_create_net("fib_trie", 0444, net->proc_net, &fib_trie_seq_ops,
|
||||||
|
sizeof(struct fib_trie_iter)))
|
||||||
|
goto out1;
|
||||||
|
|
||||||
|
- if (!proc_create_net_single("fib_triestat", 0444, net->proc_net,
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED) &&
|
||||||
|
+ !proc_create_net_single("fib_triestat", 0444, net->proc_net,
|
||||||
|
fib_triestat_seq_show, NULL))
|
||||||
|
goto out2;
|
||||||
|
|
||||||
|
@@ -3047,17 +3049,21 @@ int __net_init fib_proc_init(struct net
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out3:
|
||||||
|
- remove_proc_entry("fib_triestat", net->proc_net);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ remove_proc_entry("fib_triestat", net->proc_net);
|
||||||
|
out2:
|
||||||
|
- remove_proc_entry("fib_trie", net->proc_net);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ remove_proc_entry("fib_trie", net->proc_net);
|
||||||
|
out1:
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __net_exit fib_proc_exit(struct net *net)
|
||||||
|
{
|
||||||
|
- remove_proc_entry("fib_trie", net->proc_net);
|
||||||
|
- remove_proc_entry("fib_triestat", net->proc_net);
|
||||||
|
+ if (!IS_ENABLED(CONFIG_PROC_STRIPPED)) {
|
||||||
|
+ remove_proc_entry("fib_trie", net->proc_net);
|
||||||
|
+ remove_proc_entry("fib_triestat", net->proc_net);
|
||||||
|
+ }
|
||||||
|
remove_proc_entry("route", net->proc_net);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/net/ipv4/proc.c
|
||||||
|
+++ b/net/ipv4/proc.c
|
||||||
|
@@ -553,5 +553,8 @@ static __net_initdata struct pernet_oper
|
||||||
|
|
||||||
|
int __init ip_misc_proc_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
return register_pernet_subsys(&ip_proc_ops);
|
||||||
|
}
|
||||||
|
--- a/net/ipv4/route.c
|
||||||
|
+++ b/net/ipv4/route.c
|
||||||
|
@@ -380,6 +380,9 @@ static struct pernet_operations ip_rt_pr
|
||||||
|
|
||||||
|
static int __init ip_rt_proc_init(void)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_PROC_STRIPPED))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
return register_pernet_subsys(&ip_rt_proc_ops);
|
||||||
|
}
|
||||||
|
|
93
6.7/target/linux/generic/hack-6.7/904-debloat_dma_buf.patch
Normal file
93
6.7/target/linux/generic/hack-6.7/904-debloat_dma_buf.patch
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
From e3692cb2fcd5ba1244512a0f43b8118f65f1c375 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Sat, 8 Jul 2017 08:20:43 +0200
|
||||||
|
Subject: debloat: dmabuf
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
drivers/base/Kconfig | 2 +-
|
||||||
|
drivers/dma-buf/Makefile | 10 +++++++---
|
||||||
|
drivers/dma-buf/dma-buf.c | 4 +++-
|
||||||
|
kernel/sched/core.c | 1 +
|
||||||
|
4 files changed, 12 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/base/Kconfig
|
||||||
|
+++ b/drivers/base/Kconfig
|
||||||
|
@@ -198,7 +198,7 @@ config SOC_BUS
|
||||||
|
source "drivers/base/regmap/Kconfig"
|
||||||
|
|
||||||
|
config DMA_SHARED_BUFFER
|
||||||
|
- bool
|
||||||
|
+ tristate
|
||||||
|
default n
|
||||||
|
select IRQ_WORK
|
||||||
|
help
|
||||||
|
--- a/drivers/dma-buf/heaps/Makefile
|
||||||
|
+++ b/drivers/dma-buf/heaps/Makefile
|
||||||
|
@@ -1,3 +1,3 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
-obj-$(CONFIG_DMABUF_HEAPS_SYSTEM) += system_heap.o
|
||||||
|
-obj-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
|
||||||
|
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS_SYSTEM) += system_heap.o
|
||||||
|
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
|
||||||
|
--- a/drivers/dma-buf/Makefile
|
||||||
|
+++ b/drivers/dma-buf/Makefile
|
||||||
|
@@ -1,12 +1,14 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
|
||||||
|
+obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o
|
||||||
|
+
|
||||||
|
+dma-buf-objs-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
|
||||||
|
dma-fence-unwrap.o dma-resv.o
|
||||||
|
-obj-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
|
||||||
|
-obj-$(CONFIG_DMABUF_HEAPS) += heaps/
|
||||||
|
-obj-$(CONFIG_SYNC_FILE) += sync_file.o
|
||||||
|
-obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o
|
||||||
|
-obj-$(CONFIG_UDMABUF) += udmabuf.o
|
||||||
|
-obj-$(CONFIG_DMABUF_SYSFS_STATS) += dma-buf-sysfs-stats.o
|
||||||
|
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
|
||||||
|
+obj-$(CONFIG_DMABUF_HEAPS) += heaps/
|
||||||
|
+dma-buf-objs-$(CONFIG_SYNC_FILE) += sync_file.o
|
||||||
|
+dma-buf-objs-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o
|
||||||
|
+dma-buf-objs-$(CONFIG_UDMABUF) += udmabuf.o
|
||||||
|
+dma-buf-objs-$(CONFIG_DMABUF_SYSFS_STATS) += dma-buf-sysfs-stats.o
|
||||||
|
|
||||||
|
dmabuf_selftests-y := \
|
||||||
|
selftest.o \
|
||||||
|
@@ -15,4 +17,6 @@ dmabuf_selftests-y := \
|
||||||
|
st-dma-fence-unwrap.o \
|
||||||
|
st-dma-resv.o
|
||||||
|
|
||||||
|
-obj-$(CONFIG_DMABUF_SELFTESTS) += dmabuf_selftests.o
|
||||||
|
+dma-buf-objs-$(CONFIG_DMABUF_SELFTESTS) += dmabuf_selftests.o
|
||||||
|
+
|
||||||
|
+dma-shared-buffer-objs := $(dma-buf-objs-y)
|
||||||
|
--- a/drivers/dma-buf/dma-buf.c
|
||||||
|
+++ b/drivers/dma-buf/dma-buf.c
|
||||||
|
@@ -1636,4 +1636,5 @@ static void __exit dma_buf_deinit(void)
|
||||||
|
kern_unmount(dma_buf_mnt);
|
||||||
|
dma_buf_uninit_sysfs_statistics();
|
||||||
|
}
|
||||||
|
-__exitcall(dma_buf_deinit);
|
||||||
|
+module_exit(dma_buf_deinit);
|
||||||
|
+MODULE_LICENSE("GPL");
|
||||||
|
--- a/kernel/sched/core.c
|
||||||
|
+++ b/kernel/sched/core.c
|
||||||
|
@@ -4363,6 +4363,7 @@ int wake_up_state(struct task_struct *p,
|
||||||
|
{
|
||||||
|
return try_to_wake_up(p, state, 0);
|
||||||
|
}
|
||||||
|
+EXPORT_SYMBOL_GPL(wake_up_state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Perform scheduler related setup for a newly forked process p.
|
||||||
|
--- a/fs/d_path.c
|
||||||
|
+++ b/fs/d_path.c
|
||||||
|
@@ -313,6 +313,7 @@ char *dynamic_dname(char *buffer, int bu
|
||||||
|
buffer += buflen - sz;
|
||||||
|
return memcpy(buffer, temp, sz);
|
||||||
|
}
|
||||||
|
+EXPORT_SYMBOL_GPL(dynamic_dname);
|
||||||
|
|
||||||
|
char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||||
|
{
|
32
6.7/target/linux/generic/hack-6.7/910-kobject_uevent.patch
Normal file
32
6.7/target/linux/generic/hack-6.7/910-kobject_uevent.patch
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Sun, 16 Jul 2017 16:56:10 +0200
|
||||||
|
Subject: lib: add uevent_next_seqnum()
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
include/linux/kobject.h | 5 +++++
|
||||||
|
lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 42 insertions(+)
|
||||||
|
|
||||||
|
--- a/lib/kobject_uevent.c
|
||||||
|
+++ b/lib/kobject_uevent.c
|
||||||
|
@@ -179,6 +179,18 @@ out:
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
+u64 uevent_next_seqnum(void)
|
||||||
|
+{
|
||||||
|
+ u64 seq;
|
||||||
|
+
|
||||||
|
+ mutex_lock(&uevent_sock_mutex);
|
||||||
|
+ seq = ++uevent_seqnum;
|
||||||
|
+ mutex_unlock(&uevent_sock_mutex);
|
||||||
|
+
|
||||||
|
+ return seq;
|
||||||
|
+}
|
||||||
|
+EXPORT_SYMBOL_GPL(uevent_next_seqnum);
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* kobject_synth_uevent - send synthetic uevent with arguments
|
||||||
|
*
|
|
@ -0,0 +1,76 @@
|
||||||
|
From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Sun, 16 Jul 2017 16:56:10 +0200
|
||||||
|
Subject: lib: add uevent_next_seqnum()
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
include/linux/kobject.h | 5 +++++
|
||||||
|
lib/kobject_uevent.c | 37 +++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 42 insertions(+)
|
||||||
|
|
||||||
|
--- a/include/linux/kobject.h
|
||||||
|
+++ b/include/linux/kobject.h
|
||||||
|
@@ -32,6 +32,8 @@
|
||||||
|
#define UEVENT_NUM_ENVP 64 /* number of env pointers */
|
||||||
|
#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
|
||||||
|
|
||||||
|
+struct sk_buff;
|
||||||
|
+
|
||||||
|
#ifdef CONFIG_UEVENT_HELPER
|
||||||
|
/* path to the userspace helper executed on an event */
|
||||||
|
extern char uevent_helper[];
|
||||||
|
@@ -224,4 +226,7 @@ int kobject_synth_uevent(struct kobject
|
||||||
|
__printf(2, 3)
|
||||||
|
int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...);
|
||||||
|
|
||||||
|
+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
|
||||||
|
+ gfp_t allocation);
|
||||||
|
+
|
||||||
|
#endif /* _KOBJECT_H_ */
|
||||||
|
--- a/lib/kobject_uevent.c
|
||||||
|
+++ b/lib/kobject_uevent.c
|
||||||
|
@@ -691,6 +691,43 @@ int add_uevent_var(struct kobj_uevent_en
|
||||||
|
EXPORT_SYMBOL_GPL(add_uevent_var);
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET)
|
||||||
|
+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
|
||||||
|
+ gfp_t allocation)
|
||||||
|
+{
|
||||||
|
+ struct uevent_sock *ue_sk;
|
||||||
|
+ int err = 0;
|
||||||
|
+
|
||||||
|
+ /* send netlink message */
|
||||||
|
+ mutex_lock(&uevent_sock_mutex);
|
||||||
|
+ list_for_each_entry(ue_sk, &uevent_sock_list, list) {
|
||||||
|
+ struct sock *uevent_sock = ue_sk->sk;
|
||||||
|
+ struct sk_buff *skb2;
|
||||||
|
+
|
||||||
|
+ skb2 = skb_clone(skb, allocation);
|
||||||
|
+ if (!skb2)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ err = netlink_broadcast(uevent_sock, skb2, pid, group,
|
||||||
|
+ allocation);
|
||||||
|
+ if (err)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ mutex_unlock(&uevent_sock_mutex);
|
||||||
|
+
|
||||||
|
+ kfree_skb(skb);
|
||||||
|
+ return err;
|
||||||
|
+}
|
||||||
|
+#else
|
||||||
|
+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
|
||||||
|
+ gfp_t allocation)
|
||||||
|
+{
|
||||||
|
+ kfree_skb(skb);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+EXPORT_SYMBOL_GPL(broadcast_uevent);
|
||||||
|
+
|
||||||
|
+#if defined(CONFIG_NET)
|
||||||
|
static int uevent_net_broadcast(struct sock *usk, struct sk_buff *skb,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
|
{
|
|
@ -0,0 +1,21 @@
|
||||||
|
From e08bcbbaa52fcc41f02743fd2e62a33255ce52da Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 13:52:28 +0200
|
||||||
|
Subject: [PATCH] of/ftd: add device tree cmdline
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/of/fdt.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/of/fdt.c
|
||||||
|
+++ b/drivers/of/fdt.c
|
||||||
|
@@ -1183,6 +1183,9 @@ int __init early_init_dt_scan_chosen(cha
|
||||||
|
p = of_get_flat_dt_prop(node, "bootargs", &l);
|
||||||
|
if (p != NULL && l > 0)
|
||||||
|
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
|
||||||
|
+ p = of_get_flat_dt_prop(node, "bootargs-append", &l);
|
||||||
|
+ if (p != NULL && l > 0)
|
||||||
|
+ strlcat(cmdline, p, min_t(int, strlen(cmdline) + (int)l, COMMAND_LINE_SIZE));
|
||||||
|
|
||||||
|
handle_cmdline:
|
||||||
|
/*
|
|
@ -0,0 +1,30 @@
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Tue, 19 Jul 2022 06:17:48 +0200
|
||||||
|
Subject: [PATCH] Revert "Revert "Revert "driver core: Set fw_devlink=on by
|
||||||
|
default"""
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This reverts commit ea718c699055c8566eb64432388a04974c43b2ea.
|
||||||
|
|
||||||
|
With of_platform_populate() called for MTD partitions that commit breaks
|
||||||
|
probing devices which reference MTD in device tree.
|
||||||
|
|
||||||
|
Link: https://lore.kernel.org/all/696cb2da-20b9-b3dd-46d9-de4bf91a1506@gmail.com/T/#u
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
---
|
||||||
|
drivers/base/core.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/drivers/base/core.c
|
||||||
|
+++ b/drivers/base/core.c
|
||||||
|
@@ -1700,7 +1700,7 @@ static void device_links_purge(struct de
|
||||||
|
#define FW_DEVLINK_FLAGS_RPM (FW_DEVLINK_FLAGS_ON | \
|
||||||
|
DL_FLAG_PM_RUNTIME)
|
||||||
|
|
||||||
|
-static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_ON;
|
||||||
|
+static u32 fw_devlink_flags = FW_DEVLINK_FLAGS_PERMISSIVE;
|
||||||
|
static int __init fw_devlink_setup(char *arg)
|
||||||
|
{
|
||||||
|
if (!arg)
|
81
6.7/target/linux/generic/hack-6.7/998-ndpi-hook.patch
Normal file
81
6.7/target/linux/generic/hack-6.7/998-ndpi-hook.patch
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
diff -urpN linux-6.1.38.old/include/net/netfilter/nf_conntrack.h linux-6.1.38/include/net/netfilter/nf_conntrack.h
|
||||||
|
--- linux-6.1.38.old/include/net/netfilter/nf_conntrack.h 2023-07-05 23:27:38.000000000 +0600
|
||||||
|
+++ linux-6.1.38/include/net/netfilter/nf_conntrack.h 2023-07-14 12:34:56.663750711 +0600
|
||||||
|
@@ -362,6 +362,11 @@ static inline struct nf_conntrack_net *n
|
||||||
|
return net_generic(net, nf_conntrack_net_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
|
||||||
|
+void register_nf_ct_destroy_hook(void (*hook)(struct nf_conn *));
|
||||||
|
+void unregister_nf_ct_destroy_hook(void);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define NF_CT_STAT_INC(net, count) __this_cpu_inc((net)->ct.stat->count)
|
||||||
|
#define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
|
||||||
|
#define NF_CT_STAT_ADD_ATOMIC(net, count, v) this_cpu_add((net)->ct.stat->count, (v))
|
||||||
|
diff -urpN linux-6.1.38.old/net/netfilter/Kconfig linux-6.1.38/net/netfilter/Kconfig
|
||||||
|
--- linux-6.1.38.old/net/netfilter/Kconfig 2023-07-05 23:27:38.000000000 +0600
|
||||||
|
+++ linux-6.1.38/net/netfilter/Kconfig 2023-07-14 12:34:11.966879899 +0600
|
||||||
|
@@ -76,11 +76,15 @@ config NETFILTER_NETLINK_OSF
|
||||||
|
If this option is enabled, the kernel will include support
|
||||||
|
for passive OS fingerprint via NFNETLINK.
|
||||||
|
|
||||||
|
+config NF_CONNTRACK_DESTROY_HOOK
|
||||||
|
+ bool
|
||||||
|
+
|
||||||
|
config NF_CONNTRACK
|
||||||
|
tristate "Netfilter connection tracking support"
|
||||||
|
default m if NETFILTER_ADVANCED=n
|
||||||
|
select NF_DEFRAG_IPV4
|
||||||
|
select NF_DEFRAG_IPV6 if IPV6 != n
|
||||||
|
+ select NF_CONNTRACK_DESTROY_HOOK
|
||||||
|
help
|
||||||
|
Connection tracking keeps a record of what packets have passed
|
||||||
|
through your machine, in order to figure out how they are related
|
||||||
|
diff -urpN linux-6.1.38.old/net/netfilter/nf_conntrack_core.c linux-6.1.38/net/netfilter/nf_conntrack_core.c
|
||||||
|
--- linux-6.1.38.old/net/netfilter/nf_conntrack_core.c 2023-07-05 23:27:38.000000000 +0600
|
||||||
|
+++ linux-6.1.38/net/netfilter/nf_conntrack_core.c 2023-07-14 12:33:45.580092713 +0600
|
||||||
|
@@ -582,9 +582,30 @@ static void destroy_gre_conntrack(struct
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
|
||||||
|
+
|
||||||
|
+static void (*nf_ct_destroy_hook)(struct nf_conn *) __rcu __read_mostly = NULL;
|
||||||
|
+
|
||||||
|
+void register_nf_ct_destroy_hook(void (*hook)(struct nf_conn *))
|
||||||
|
+{
|
||||||
|
+ rcu_assign_pointer(nf_ct_destroy_hook, hook);
|
||||||
|
+}
|
||||||
|
+EXPORT_SYMBOL(register_nf_ct_destroy_hook);
|
||||||
|
+
|
||||||
|
+void unregister_nf_ct_destroy_hook(void)
|
||||||
|
+{
|
||||||
|
+ rcu_assign_pointer(nf_ct_destroy_hook, NULL);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+EXPORT_SYMBOL(unregister_nf_ct_destroy_hook);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
void nf_ct_destroy(struct nf_conntrack *nfct)
|
||||||
|
{
|
||||||
|
struct nf_conn *ct = (struct nf_conn *)nfct;
|
||||||
|
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
|
||||||
|
+ void (*hook)(struct nf_conn *);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
pr_debug("%s(%p)\n", __func__, ct);
|
||||||
|
WARN_ON(refcount_read(&nfct->use) != 0);
|
||||||
|
@@ -594,6 +615,12 @@ void nf_ct_destroy(struct nf_conntrack *
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef CONFIG_NF_CONNTRACK_DESTROY_HOOK
|
||||||
|
+ hook = rcu_dereference(nf_ct_destroy_hook);
|
||||||
|
+ if (hook)
|
||||||
|
+ hook(ct);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if (unlikely(nf_ct_protonum(ct) == IPPROTO_GRE))
|
||||||
|
destroy_gre_conntrack(ct);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Thu, 22 Oct 2020 22:00:03 +0200
|
||||||
|
Subject: [PATCH] compiler.h: only include asm/rwonce.h for kernel code
|
||||||
|
|
||||||
|
This header file is not in uapi, which makes any user space code that includes
|
||||||
|
linux/compiler.h to fail with the error 'asm/rwonce.h: No such file or directory'
|
||||||
|
|
||||||
|
Fixes: e506ea451254 ("compiler.h: Split {READ,WRITE}_ONCE definitions out into rwonce.h")
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/include/linux/compiler.h
|
||||||
|
+++ b/include/linux/compiler.h
|
||||||
|
@@ -203,6 +203,8 @@ void ftrace_likely_update(struct ftrace_
|
||||||
|
__v; \
|
||||||
|
})
|
||||||
|
|
||||||
|
+#include <asm/rwonce.h>
|
||||||
|
+
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -243,6 +245,4 @@ static inline void *offset_to_ptr(const
|
||||||
|
*/
|
||||||
|
#define prevent_tail_call_optimization() mb()
|
||||||
|
|
||||||
|
-#include <asm/rwonce.h>
|
||||||
|
-
|
||||||
|
#endif /* __LINUX_COMPILER_H */
|
|
@ -0,0 +1,57 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Wed, 18 Apr 2018 10:50:05 +0200
|
||||||
|
Subject: [PATCH] MIPS: only process negative stack offsets on stack traces
|
||||||
|
|
||||||
|
Fixes endless back traces in cases where the compiler emits a stack
|
||||||
|
pointer increase in a branch delay slot (probably for some form of
|
||||||
|
function return).
|
||||||
|
|
||||||
|
[ 3.475442] BUG: MAX_STACK_TRACE_ENTRIES too low!
|
||||||
|
[ 3.480070] turning off the locking correctness validator.
|
||||||
|
[ 3.485521] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.34 #0
|
||||||
|
[ 3.491475] Stack : 00000000 00000000 00000000 00000000 80e0fce2 00000034 00000000 00000000
|
||||||
|
[ 3.499764] 87c3838c 80696377 8061047c 00000000 00000001 00000001 87c2d850 6534689f
|
||||||
|
[ 3.508059] 00000000 00000000 80e10000 00000000 00000000 000000cf 0000000f 00000000
|
||||||
|
[ 3.516353] 00000000 806a0000 00076891 00000000 00000000 00000000 ffffffff 00000000
|
||||||
|
[ 3.524648] 806c0000 00000004 80e10000 806a0000 00000003 80690000 00000000 80700000
|
||||||
|
[ 3.532942] ...
|
||||||
|
[ 3.535362] Call Trace:
|
||||||
|
[ 3.537818] [<80010a48>] show_stack+0x58/0x100
|
||||||
|
[ 3.542207] [<804c2f78>] dump_stack+0xe8/0x170
|
||||||
|
[ 3.546613] [<80079f90>] save_trace+0xf0/0x110
|
||||||
|
[ 3.551010] [<8007b1ec>] mark_lock+0x33c/0x78c
|
||||||
|
[ 3.555413] [<8007bf48>] __lock_acquire+0x2ac/0x1a08
|
||||||
|
[ 3.560337] [<8007de60>] lock_acquire+0x64/0x8c
|
||||||
|
[ 3.564846] [<804e1570>] _raw_spin_lock_irqsave+0x54/0x78
|
||||||
|
[ 3.570186] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.574770] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.579257] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.583839] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.588329] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.592911] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.597401] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.601983] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.606473] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.611055] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.615545] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.620125] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.624619] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.629197] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.633691] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
[ 3.638269] [<801b7b10>] sysfs_notify+0x74/0xa0
|
||||||
|
[ 3.642763] [<801b618c>] kernfs_notify+0x94/0xac
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/arch/mips/kernel/process.c
|
||||||
|
+++ b/arch/mips/kernel/process.c
|
||||||
|
@@ -394,6 +394,8 @@ static inline int is_sp_move_ins(union m
|
||||||
|
|
||||||
|
if (ip->i_format.opcode == addiu_op ||
|
||||||
|
ip->i_format.opcode == daddiu_op) {
|
||||||
|
+ if (ip->i_format.simmediate > 0)
|
||||||
|
+ return 0;
|
||||||
|
*frame_size = -ip->i_format.simmediate;
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
From 173019b66dcc9d68ad9333aa744dad1e369b5aa8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Date: Sun, 9 Jul 2017 00:26:53 +0200
|
||||||
|
Subject: [PATCH 34/34] kernel: add compile fix for linux 4.9 on x86
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
Makefile | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -606,7 +606,7 @@ endif
|
||||||
|
# Allows the usage of unstable features in stable compilers.
|
||||||
|
export RUSTC_BOOTSTRAP := 1
|
||||||
|
|
||||||
|
-export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
|
||||||
|
+export ARCH SRCARCH SUBARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
|
||||||
|
export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN CARGO
|
||||||
|
export HOSTRUSTC KBUILD_HOSTRUSTFLAGS
|
||||||
|
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
|
|
@ -0,0 +1,75 @@
|
||||||
|
From bd1b9f66d5134e518419f4c4dacf1884c1616983 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
|
||||||
|
Date: Thu, 28 Apr 2022 11:13:23 +0200
|
||||||
|
Subject: [PATCH] watchdog: max63xx_wdt: Add support for specifying WDI logic
|
||||||
|
via GPIO
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
On some boards is WDI logic of max6370 chip connected via GPIO.
|
||||||
|
So extend max63xx_wdt driver to allow specifying WDI logic via GPIO.
|
||||||
|
|
||||||
|
Signed-off-by: Pali Rohár <pali@kernel.org>
|
||||||
|
---
|
||||||
|
drivers/watchdog/max63xx_wdt.c | 24 ++++++++++++++++++++++++
|
||||||
|
1 file changed, 24 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/watchdog/max63xx_wdt.c
|
||||||
|
+++ b/drivers/watchdog/max63xx_wdt.c
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#include <linux/io.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/property.h>
|
||||||
|
+#include <linux/gpio/consumer.h>
|
||||||
|
|
||||||
|
#define DEFAULT_HEARTBEAT 60
|
||||||
|
#define MAX_HEARTBEAT 60
|
||||||
|
@@ -53,6 +54,9 @@ struct max63xx_wdt {
|
||||||
|
void __iomem *base;
|
||||||
|
spinlock_t lock;
|
||||||
|
|
||||||
|
+ /* GPIOs */
|
||||||
|
+ struct gpio_desc *gpio_wdi;
|
||||||
|
+
|
||||||
|
/* WDI and WSET bits write access routines */
|
||||||
|
void (*ping)(struct max63xx_wdt *wdt);
|
||||||
|
void (*set)(struct max63xx_wdt *wdt, u8 set);
|
||||||
|
@@ -158,6 +162,17 @@ static const struct watchdog_info max63x
|
||||||
|
.identity = "max63xx Watchdog",
|
||||||
|
};
|
||||||
|
|
||||||
|
+static void max63xx_gpio_ping(struct max63xx_wdt *wdt)
|
||||||
|
+{
|
||||||
|
+ spin_lock(&wdt->lock);
|
||||||
|
+
|
||||||
|
+ gpiod_set_value(wdt->gpio_wdi, 1);
|
||||||
|
+ udelay(1);
|
||||||
|
+ gpiod_set_value(wdt->gpio_wdi, 0);
|
||||||
|
+
|
||||||
|
+ spin_unlock(&wdt->lock);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void max63xx_mmap_ping(struct max63xx_wdt *wdt)
|
||||||
|
{
|
||||||
|
u8 val;
|
||||||
|
@@ -225,10 +240,19 @@ static int max63xx_wdt_probe(struct plat
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ wdt->gpio_wdi = devm_gpiod_get(dev, NULL, GPIOD_FLAGS_BIT_DIR_OUT);
|
||||||
|
+ if (IS_ERR(wdt->gpio_wdi) && PTR_ERR(wdt->gpio_wdi) != -ENOENT)
|
||||||
|
+ return dev_err_probe(dev, PTR_ERR(wdt->gpio_wdi),
|
||||||
|
+ "unable to request gpio: %ld\n",
|
||||||
|
+ PTR_ERR(wdt->gpio_wdi));
|
||||||
|
+
|
||||||
|
err = max63xx_mmap_init(pdev, wdt);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
+ if (!IS_ERR(wdt->gpio_wdi))
|
||||||
|
+ wdt->ping = max63xx_gpio_ping;
|
||||||
|
+
|
||||||
|
platform_set_drvdata(pdev, &wdt->wdd);
|
||||||
|
watchdog_set_drvdata(&wdt->wdd, wdt);
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
From: Daniel González Cabanelas <dgcbueu@gmail.com>
|
||||||
|
Subject: [PATCH 1/2] rtc: rs5c372: support alarms up to 1 week
|
||||||
|
|
||||||
|
The Ricoh R2221x, R2223x, RS5C372, RV5C387A chips can handle 1 week
|
||||||
|
alarms.
|
||||||
|
|
||||||
|
Read the "wday" alarm register and convert it to a date to support up 1
|
||||||
|
week in our driver.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/rtc/rtc-rs5c372.c | 48 ++++++++++++++++++++++++++++++++++-----
|
||||||
|
1 file changed, 42 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/rtc/rtc-rs5c372.c
|
||||||
|
+++ b/drivers/rtc/rtc-rs5c372.c
|
||||||
|
@@ -399,7 +399,9 @@ static int rs5c_read_alarm(struct device
|
||||||
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
struct rs5c372 *rs5c = i2c_get_clientdata(client);
|
||||||
|
- int status;
|
||||||
|
+ int status, wday_offs;
|
||||||
|
+ struct rtc_time rtc;
|
||||||
|
+ unsigned long alarm_secs;
|
||||||
|
|
||||||
|
status = rs5c_get_regs(rs5c);
|
||||||
|
if (status < 0)
|
||||||
|
@@ -409,6 +411,30 @@ static int rs5c_read_alarm(struct device
|
||||||
|
t->time.tm_sec = 0;
|
||||||
|
t->time.tm_min = bcd2bin(rs5c->regs[RS5C_REG_ALARM_A_MIN] & 0x7f);
|
||||||
|
t->time.tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C_REG_ALARM_A_HOURS]);
|
||||||
|
+ t->time.tm_wday = ffs(rs5c->regs[RS5C_REG_ALARM_A_WDAY] & 0x7f) - 1;
|
||||||
|
+
|
||||||
|
+ /* determine the day, month and year based on alarm wday, taking as a
|
||||||
|
+ * reference the current time from the rtc
|
||||||
|
+ */
|
||||||
|
+ status = rs5c372_rtc_read_time(dev, &rtc);
|
||||||
|
+ if (status < 0)
|
||||||
|
+ return status;
|
||||||
|
+
|
||||||
|
+ wday_offs = t->time.tm_wday - rtc.tm_wday;
|
||||||
|
+ alarm_secs = mktime64(rtc.tm_year + 1900,
|
||||||
|
+ rtc.tm_mon + 1,
|
||||||
|
+ rtc.tm_mday + wday_offs,
|
||||||
|
+ t->time.tm_hour,
|
||||||
|
+ t->time.tm_min,
|
||||||
|
+ t->time.tm_sec);
|
||||||
|
+
|
||||||
|
+ if (wday_offs < 0 || (wday_offs == 0 &&
|
||||||
|
+ (t->time.tm_hour < rtc.tm_hour ||
|
||||||
|
+ (t->time.tm_hour == rtc.tm_hour &&
|
||||||
|
+ t->time.tm_min <= rtc.tm_min))))
|
||||||
|
+ alarm_secs += 7 * 86400;
|
||||||
|
+
|
||||||
|
+ rtc_time64_to_tm(alarm_secs, &t->time);
|
||||||
|
|
||||||
|
/* ... and status */
|
||||||
|
t->enabled = !!(rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE);
|
||||||
|
@@ -423,12 +449,20 @@ static int rs5c_set_alarm(struct device
|
||||||
|
struct rs5c372 *rs5c = i2c_get_clientdata(client);
|
||||||
|
int status, addr, i;
|
||||||
|
unsigned char buf[3];
|
||||||
|
+ struct rtc_time rtc_tm;
|
||||||
|
+ unsigned long rtc_secs, alarm_secs;
|
||||||
|
|
||||||
|
- /* only handle up to 24 hours in the future, like RTC_ALM_SET */
|
||||||
|
- if (t->time.tm_mday != -1
|
||||||
|
- || t->time.tm_mon != -1
|
||||||
|
- || t->time.tm_year != -1)
|
||||||
|
+ /* chip only can handle alarms up to one week in the future*/
|
||||||
|
+ status = rs5c372_rtc_read_time(dev, &rtc_tm);
|
||||||
|
+ if (status)
|
||||||
|
+ return status;
|
||||||
|
+ rtc_secs = rtc_tm_to_time64(&rtc_tm);
|
||||||
|
+ alarm_secs = rtc_tm_to_time64(&t->time);
|
||||||
|
+ if (alarm_secs >= rtc_secs + 7 * 86400) {
|
||||||
|
+ dev_err(dev, "%s: alarm maximum is one week in the future (%d)\n",
|
||||||
|
+ __func__, status);
|
||||||
|
return -EINVAL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* REVISIT: round up tm_sec */
|
||||||
|
|
||||||
|
@@ -449,7 +483,9 @@ static int rs5c_set_alarm(struct device
|
||||||
|
/* set alarm */
|
||||||
|
buf[0] = bin2bcd(t->time.tm_min);
|
||||||
|
buf[1] = rs5c_hr2reg(rs5c, t->time.tm_hour);
|
||||||
|
- buf[2] = 0x7f; /* any/all days */
|
||||||
|
+ /* each bit is the day of the week, 0x7f means all days */
|
||||||
|
+ buf[2] = (t->time.tm_wday >= 0 && t->time.tm_wday < 7) ?
|
||||||
|
+ BIT(t->time.tm_wday) : 0x7f;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(buf); i++) {
|
||||||
|
addr = RS5C_ADDR(RS5C_REG_ALARM_A_MIN + i);
|
|
@ -0,0 +1,71 @@
|
||||||
|
From: Daniel González Cabanelas <dgcbueu@gmail.com>
|
||||||
|
Subject: [PATCH 2/2] rtc: rs5c372: let the alarm to be used as wakeup source
|
||||||
|
|
||||||
|
Currently there is no use for the interrupts on the rs5c372 RTC and the
|
||||||
|
wakealarm isn't enabled. There are some devices like NASes which use this
|
||||||
|
RTC to wake up from the power off state when the INTR pin is activated by
|
||||||
|
the alarm clock.
|
||||||
|
|
||||||
|
Enable the alarm and let to be used as a wakeup source.
|
||||||
|
|
||||||
|
Tested on a Buffalo LS421DE NAS.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/rtc/rtc-rs5c372.c | 16 ++++++++++++++++
|
||||||
|
1 file changed, 16 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/rtc/rtc-rs5c372.c
|
||||||
|
+++ b/drivers/rtc/rtc-rs5c372.c
|
||||||
|
@@ -833,6 +833,7 @@ static int rs5c372_probe(struct i2c_clie
|
||||||
|
int err = 0;
|
||||||
|
int smbus_mode = 0;
|
||||||
|
struct rs5c372 *rs5c372;
|
||||||
|
+ bool rs5c372_can_wakeup_device = false;
|
||||||
|
|
||||||
|
dev_dbg(&client->dev, "%s\n", __func__);
|
||||||
|
|
||||||
|
@@ -868,6 +869,12 @@ static int rs5c372_probe(struct i2c_clie
|
||||||
|
else
|
||||||
|
rs5c372->type = id->driver_data;
|
||||||
|
|
||||||
|
+#ifdef CONFIG_OF
|
||||||
|
+ if(of_property_read_bool(client->dev.of_node,
|
||||||
|
+ "wakeup-source"))
|
||||||
|
+ rs5c372_can_wakeup_device = true;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* we read registers 0x0f then 0x00-0x0f; skip the first one */
|
||||||
|
rs5c372->regs = &rs5c372->buf[1];
|
||||||
|
rs5c372->smbus = smbus_mode;
|
||||||
|
@@ -901,6 +908,8 @@ static int rs5c372_probe(struct i2c_clie
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ rs5c372->has_irq = 1;
|
||||||
|
+
|
||||||
|
/* if the oscillator lost power and no other software (like
|
||||||
|
* the bootloader) set it up, do it here.
|
||||||
|
*
|
||||||
|
@@ -927,6 +936,10 @@ static int rs5c372_probe(struct i2c_clie
|
||||||
|
);
|
||||||
|
|
||||||
|
/* REVISIT use client->irq to register alarm irq ... */
|
||||||
|
+ if (rs5c372_can_wakeup_device) {
|
||||||
|
+ device_init_wakeup(&client->dev, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
rs5c372->rtc = devm_rtc_device_register(&client->dev,
|
||||||
|
rs5c372_driver.driver.name,
|
||||||
|
&rs5c372_rtc_ops, THIS_MODULE);
|
||||||
|
@@ -940,6 +953,10 @@ static int rs5c372_probe(struct i2c_clie
|
||||||
|
if (err)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
+ /* the rs5c372 alarm only supports a minute accuracy */
|
||||||
|
+ set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rs5c372->rtc->features);
|
||||||
|
+ clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rs5c372->rtc->features);
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
exit:
|
|
@ -0,0 +1,30 @@
|
||||||
|
From: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
Subject: usr: sanitize deps_initramfs list
|
||||||
|
|
||||||
|
If any filename in the intramfs dependency
|
||||||
|
list contains a colon, that causes a kernel
|
||||||
|
build error like this:
|
||||||
|
|
||||||
|
/devel/openwrt/build_dir/linux-ar71xx_generic/linux-3.6.6/usr/Makefile:58: *** multiple target patterns. Stop.
|
||||||
|
make[5]: *** [usr] Error 2
|
||||||
|
|
||||||
|
Fix it by removing such filenames from the
|
||||||
|
deps_initramfs list.
|
||||||
|
|
||||||
|
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
usr/Makefile | 8 +++++---
|
||||||
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
--- a/usr/Makefile
|
||||||
|
+++ b/usr/Makefile
|
||||||
|
@@ -56,6 +56,8 @@ hostprogs := gen_init_cpio
|
||||||
|
# The dependency list is generated by gen_initramfs.sh -l
|
||||||
|
-include $(obj)/.initramfs_data.cpio.d
|
||||||
|
|
||||||
|
+deps_initramfs := $(foreach v,$(deps_initramfs),$(if $(findstring :,$(v)),,$(v)))
|
||||||
|
+
|
||||||
|
# do not try to update files included in initramfs
|
||||||
|
$(deps_initramfs): ;
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
From c2deb5ef01a0ef09088832744cbace9e239a6ee0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= <hacks@slashdirt.org>
|
||||||
|
Date: Sat, 28 Mar 2020 12:11:50 +0100
|
||||||
|
Subject: [PATCH] generic: platform/mikrotik build bits (5.4)
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This patch adds platform/mikrotik kernel build bits
|
||||||
|
|
||||||
|
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
|
||||||
|
---
|
||||||
|
drivers/platform/Kconfig | 2 ++
|
||||||
|
drivers/platform/Makefile | 1 +
|
||||||
|
2 files changed, 3 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/platform/Kconfig
|
||||||
|
+++ b/drivers/platform/Kconfig
|
||||||
|
@@ -16,3 +16,5 @@ source "drivers/platform/olpc/Kconfig"
|
||||||
|
source "drivers/platform/surface/Kconfig"
|
||||||
|
|
||||||
|
source "drivers/platform/x86/Kconfig"
|
||||||
|
+
|
||||||
|
+source "drivers/platform/mikrotik/Kconfig"
|
||||||
|
--- a/drivers/platform/Makefile
|
||||||
|
+++ b/drivers/platform/Makefile
|
||||||
|
@@ -11,3 +11,4 @@ obj-$(CONFIG_OLPC_EC) += olpc/
|
||||||
|
obj-$(CONFIG_GOLDFISH) += goldfish/
|
||||||
|
obj-$(CONFIG_CHROME_PLATFORMS) += chrome/
|
||||||
|
obj-$(CONFIG_SURFACE_PLATFORMS) += surface/
|
||||||
|
+obj-$(CONFIG_MIKROTIK) += mikrotik/
|
|
@ -0,0 +1,40 @@
|
||||||
|
From: Mark Miller <mark@mirell.org>
|
||||||
|
Subject: mips: expose CONFIG_BOOT_RAW
|
||||||
|
|
||||||
|
This exposes the CONFIG_BOOT_RAW symbol in Kconfig. This is needed on
|
||||||
|
certain Broadcom chipsets running CFE in order to load the kernel.
|
||||||
|
|
||||||
|
Signed-off-by: Mark Miller <mark@mirell.org>
|
||||||
|
Acked-by: Rob Landley <rob@landley.net>
|
||||||
|
---
|
||||||
|
--- a/arch/mips/Kconfig
|
||||||
|
+++ b/arch/mips/Kconfig
|
||||||
|
@@ -1034,9 +1034,6 @@ config FW_ARC
|
||||||
|
config ARCH_MAY_HAVE_PC_FDC
|
||||||
|
bool
|
||||||
|
|
||||||
|
-config BOOT_RAW
|
||||||
|
- bool
|
||||||
|
-
|
||||||
|
config CEVT_BCM1480
|
||||||
|
bool
|
||||||
|
|
||||||
|
@@ -3091,6 +3088,18 @@ choice
|
||||||
|
bool "Extend builtin kernel arguments with bootloader arguments"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
+config BOOT_RAW
|
||||||
|
+ bool "Enable the kernel to be executed from the load address"
|
||||||
|
+ default n
|
||||||
|
+ help
|
||||||
|
+ Allow the kernel to be executed from the load address for
|
||||||
|
+ bootloaders which cannot read the ELF format. This places
|
||||||
|
+ a jump to start_kernel at the load address.
|
||||||
|
+
|
||||||
|
+ If unsure, say N.
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
endmenu
|
||||||
|
|
||||||
|
config LOCKDEP_SUPPORT
|
|
@ -0,0 +1,71 @@
|
||||||
|
From e6e6ef4275978823ec3a84133fc91f4ffbef5c84 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Burton <paul.burton@imgtec.com>
|
||||||
|
Date: Mon, 22 Feb 2016 18:09:44 +0000
|
||||||
|
Subject: [PATCH] MIPS: Add barriers between dcache & icache flushes
|
||||||
|
|
||||||
|
Index-based cache operations may be arbitrarily reordered by out of
|
||||||
|
order CPUs. Thus code which writes back the dcache & then invalidates
|
||||||
|
the icache using indexed cache ops must include a barrier between
|
||||||
|
operating on the 2 caches in order to prevent the scenario in which:
|
||||||
|
|
||||||
|
- icache invalidation occurs.
|
||||||
|
|
||||||
|
- icache fetch occurs, due to speculation.
|
||||||
|
|
||||||
|
- dcache writeback occurs.
|
||||||
|
|
||||||
|
If the above were allowed to happen then the icache would contain stale
|
||||||
|
data. Forcing the dcache writeback to complete before the icache
|
||||||
|
invalidation avoids this.
|
||||||
|
|
||||||
|
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
|
||||||
|
Cc: James Hogan <james.hogan@imgtec.com>
|
||||||
|
---
|
||||||
|
arch/mips/mm/c-r4k.c | 13 +++++++++++--
|
||||||
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/arch/mips/mm/c-r4k.c
|
||||||
|
+++ b/arch/mips/mm/c-r4k.c
|
||||||
|
@@ -514,6 +514,7 @@ static inline void local_r4k___flush_cac
|
||||||
|
|
||||||
|
default:
|
||||||
|
r4k_blast_dcache();
|
||||||
|
+ mb(); /* cache instructions may be reordered */
|
||||||
|
r4k_blast_icache();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -594,8 +595,10 @@ static inline void local_r4k_flush_cache
|
||||||
|
if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc))
|
||||||
|
r4k_blast_dcache();
|
||||||
|
/* If executable, blast stale lines from icache */
|
||||||
|
- if (exec)
|
||||||
|
+ if (exec) {
|
||||||
|
+ mb(); /* cache instructions may be reordered */
|
||||||
|
r4k_blast_icache();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void r4k_flush_cache_range(struct vm_area_struct *vma,
|
||||||
|
@@ -696,8 +699,13 @@ static inline void local_r4k_flush_cache
|
||||||
|
if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
|
||||||
|
vaddr ? r4k_blast_dcache_page(addr) :
|
||||||
|
r4k_blast_dcache_user_page(addr);
|
||||||
|
- if (exec && !cpu_icache_snoops_remote_store)
|
||||||
|
+ if (exec)
|
||||||
|
+ mb(); /* cache instructions may be reordered */
|
||||||
|
+
|
||||||
|
+ if (exec && !cpu_icache_snoops_remote_store) {
|
||||||
|
r4k_blast_scache_page(addr);
|
||||||
|
+ mb(); /* cache instructions may be reordered */
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
if (exec) {
|
||||||
|
if (vaddr && cpu_has_vtag_icache && mm == current->active_mm) {
|
||||||
|
@@ -764,6 +772,7 @@ static inline void __local_r4k_flush_ica
|
||||||
|
else
|
||||||
|
blast_dcache_range(start, end);
|
||||||
|
}
|
||||||
|
+ mb(); /* cache instructions may be reordered */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == R4K_INDEX ||
|
370
6.7/target/linux/generic/pending-6.7/305-mips_module_reloc.patch
Normal file
370
6.7/target/linux/generic/pending-6.7/305-mips_module_reloc.patch
Normal file
|
@ -0,0 +1,370 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: mips: replace -mlong-calls with -mno-long-calls to make function calls faster in kernel modules to achieve this, try to
|
||||||
|
|
||||||
|
lede-commit: 3b3d64743ba2a874df9d70cd19e242205b0a788c
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
arch/mips/Makefile | 5 +
|
||||||
|
arch/mips/include/asm/module.h | 5 +
|
||||||
|
arch/mips/kernel/module.c | 279 ++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
3 files changed, 284 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
--- a/arch/mips/Makefile
|
||||||
|
+++ b/arch/mips/Makefile
|
||||||
|
@@ -97,8 +97,18 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
|
||||||
|
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
|
||||||
|
cflags-y += -msoft-float
|
||||||
|
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
|
||||||
|
+ifdef CONFIG_64BIT
|
||||||
|
KBUILD_AFLAGS_MODULE += -mlong-calls
|
||||||
|
KBUILD_CFLAGS_MODULE += -mlong-calls
|
||||||
|
+else
|
||||||
|
+ ifdef CONFIG_DYNAMIC_FTRACE
|
||||||
|
+ KBUILD_AFLAGS_MODULE += -mlong-calls
|
||||||
|
+ KBUILD_CFLAGS_MODULE += -mlong-calls
|
||||||
|
+ else
|
||||||
|
+ KBUILD_AFLAGS_MODULE += -mno-long-calls
|
||||||
|
+ KBUILD_CFLAGS_MODULE += -mno-long-calls
|
||||||
|
+ endif
|
||||||
|
+endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_RELOCATABLE),y)
|
||||||
|
LDFLAGS_vmlinux += --emit-relocs
|
||||||
|
--- a/arch/mips/include/asm/module.h
|
||||||
|
+++ b/arch/mips/include/asm/module.h
|
||||||
|
@@ -12,6 +12,11 @@ struct mod_arch_specific {
|
||||||
|
const struct exception_table_entry *dbe_start;
|
||||||
|
const struct exception_table_entry *dbe_end;
|
||||||
|
struct mips_hi16 *r_mips_hi16_list;
|
||||||
|
+
|
||||||
|
+ void *phys_plt_tbl;
|
||||||
|
+ void *virt_plt_tbl;
|
||||||
|
+ unsigned int phys_plt_offset;
|
||||||
|
+ unsigned int virt_plt_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
|
||||||
|
--- a/arch/mips/kernel/module.c
|
||||||
|
+++ b/arch/mips/kernel/module.c
|
||||||
|
@@ -32,23 +32,261 @@ struct mips_hi16 {
|
||||||
|
static LIST_HEAD(dbe_list);
|
||||||
|
static DEFINE_SPINLOCK(dbe_lock);
|
||||||
|
|
||||||
|
-#ifdef MODULE_START
|
||||||
|
+/*
|
||||||
|
+ * Get the potential max trampolines size required of the init and
|
||||||
|
+ * non-init sections. Only used if we cannot find enough contiguous
|
||||||
|
+ * physically mapped memory to put the module into.
|
||||||
|
+ */
|
||||||
|
+static unsigned int
|
||||||
|
+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
|
||||||
|
+ const char *secstrings, unsigned int symindex, bool is_init)
|
||||||
|
+{
|
||||||
|
+ unsigned long ret = 0;
|
||||||
|
+ unsigned int i, j;
|
||||||
|
+ Elf_Sym *syms;
|
||||||
|
+
|
||||||
|
+ /* Everything marked ALLOC (this includes the exported symbols) */
|
||||||
|
+ for (i = 1; i < hdr->e_shnum; ++i) {
|
||||||
|
+ unsigned int info = sechdrs[i].sh_info;
|
||||||
|
+
|
||||||
|
+ if (sechdrs[i].sh_type != SHT_REL
|
||||||
|
+ && sechdrs[i].sh_type != SHT_RELA)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Not a valid relocation section? */
|
||||||
|
+ if (info >= hdr->e_shnum)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Don't bother with non-allocated sections */
|
||||||
|
+ if (!(sechdrs[info].sh_flags & SHF_ALLOC))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* If it's called *.init*, and we're not init, we're
|
||||||
|
+ not interested */
|
||||||
|
+ if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0)
|
||||||
|
+ != is_init)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ syms = (Elf_Sym *) sechdrs[symindex].sh_addr;
|
||||||
|
+ if (sechdrs[i].sh_type == SHT_REL) {
|
||||||
|
+ Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr;
|
||||||
|
+ unsigned int size = sechdrs[i].sh_size / sizeof(*rel);
|
||||||
|
+
|
||||||
|
+ for (j = 0; j < size; ++j) {
|
||||||
|
+ Elf_Sym *sym;
|
||||||
|
+
|
||||||
|
+ if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ sym = syms + ELF_MIPS_R_SYM(rel[j]);
|
||||||
|
+ if (!is_init && sym->st_shndx != SHN_UNDEF)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ ret += 4 * sizeof(int);
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr;
|
||||||
|
+ unsigned int size = sechdrs[i].sh_size / sizeof(*rela);
|
||||||
|
+
|
||||||
|
+ for (j = 0; j < size; ++j) {
|
||||||
|
+ Elf_Sym *sym;
|
||||||
|
+
|
||||||
|
+ if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ sym = syms + ELF_MIPS_R_SYM(rela[j]);
|
||||||
|
+ if (!is_init && sym->st_shndx != SHN_UNDEF)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ ret += 4 * sizeof(int);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#ifndef MODULE_START
|
||||||
|
+static void *alloc_phys(unsigned long size)
|
||||||
|
+{
|
||||||
|
+ unsigned order;
|
||||||
|
+ struct page *page;
|
||||||
|
+ struct page *p;
|
||||||
|
+
|
||||||
|
+ size = PAGE_ALIGN(size);
|
||||||
|
+ order = get_order(size);
|
||||||
|
+
|
||||||
|
+ page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN |
|
||||||
|
+ __GFP_THISNODE, order);
|
||||||
|
+ if (!page)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ split_page(page, order);
|
||||||
|
+
|
||||||
|
+ /* mark all pages except for the last one */
|
||||||
|
+ for (p = page; p + 1 < page + (size >> PAGE_SHIFT); ++p)
|
||||||
|
+ set_bit(PG_owner_priv_1, &p->flags);
|
||||||
|
+
|
||||||
|
+ for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p)
|
||||||
|
+ __free_page(p);
|
||||||
|
+
|
||||||
|
+ return page_address(page);
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+static void free_phys(void *ptr)
|
||||||
|
+{
|
||||||
|
+ struct page *page;
|
||||||
|
+ bool free;
|
||||||
|
+
|
||||||
|
+ page = virt_to_page(ptr);
|
||||||
|
+ do {
|
||||||
|
+ free = test_and_clear_bit(PG_owner_priv_1, &page->flags);
|
||||||
|
+ __free_page(page);
|
||||||
|
+ page++;
|
||||||
|
+ } while (free);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
void *module_alloc(unsigned long size)
|
||||||
|
{
|
||||||
|
+#ifdef MODULE_START
|
||||||
|
return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
|
||||||
|
GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
|
||||||
|
__builtin_return_address(0));
|
||||||
|
+#else
|
||||||
|
+ void *ptr;
|
||||||
|
+
|
||||||
|
+ if (size == 0)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ ptr = alloc_phys(size);
|
||||||
|
+
|
||||||
|
+ /* If we failed to allocate physically contiguous memory,
|
||||||
|
+ * fall back to regular vmalloc. The module loader code will
|
||||||
|
+ * create jump tables to handle long jumps */
|
||||||
|
+ if (!ptr)
|
||||||
|
+ return vmalloc(size);
|
||||||
|
+
|
||||||
|
+ return ptr;
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static inline bool is_phys_addr(void *ptr)
|
||||||
|
+{
|
||||||
|
+#ifdef CONFIG_64BIT
|
||||||
|
+ return (KSEGX((unsigned long)ptr) == CKSEG0);
|
||||||
|
+#else
|
||||||
|
+ return (KSEGX(ptr) == KSEG0);
|
||||||
|
#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Free memory returned from module_alloc */
|
||||||
|
+void module_memfree(void *module_region)
|
||||||
|
+{
|
||||||
|
+ if (is_phys_addr(module_region))
|
||||||
|
+ free_phys(module_region);
|
||||||
|
+ else
|
||||||
|
+ vfree(module_region);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void *__module_alloc(int size, bool phys)
|
||||||
|
+{
|
||||||
|
+ void *ptr;
|
||||||
|
+
|
||||||
|
+ if (phys)
|
||||||
|
+ ptr = kmalloc(size, GFP_KERNEL);
|
||||||
|
+ else
|
||||||
|
+ ptr = vmalloc(size);
|
||||||
|
+ return ptr;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void __module_free(void *ptr)
|
||||||
|
+{
|
||||||
|
+ if (is_phys_addr(ptr))
|
||||||
|
+ kfree(ptr);
|
||||||
|
+ else
|
||||||
|
+ vfree(ptr);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
|
||||||
|
+ char *secstrings, struct module *mod)
|
||||||
|
+{
|
||||||
|
+ unsigned int symindex = 0;
|
||||||
|
+ unsigned int core_size, init_size;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ mod->arch.phys_plt_offset = 0;
|
||||||
|
+ mod->arch.virt_plt_offset = 0;
|
||||||
|
+ mod->arch.phys_plt_tbl = NULL;
|
||||||
|
+ mod->arch.virt_plt_tbl = NULL;
|
||||||
|
+
|
||||||
|
+ if (IS_ENABLED(CONFIG_64BIT))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ for (i = 1; i < hdr->e_shnum; i++)
|
||||||
|
+ if (sechdrs[i].sh_type == SHT_SYMTAB)
|
||||||
|
+ symindex = i;
|
||||||
|
+
|
||||||
|
+ core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false);
|
||||||
|
+ init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true);
|
||||||
|
+
|
||||||
|
+ if ((core_size + init_size) == 0)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1);
|
||||||
|
+ if (!mod->arch.phys_plt_tbl)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0);
|
||||||
|
+ if (!mod->arch.virt_plt_tbl) {
|
||||||
|
+ __module_free(mod->arch.phys_plt_tbl);
|
||||||
|
+ mod->arch.phys_plt_tbl = NULL;
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
|
||||||
|
static void apply_r_mips_32(u32 *location, u32 base, Elf_Addr v)
|
||||||
|
{
|
||||||
|
*location = base + v;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static Elf_Addr add_plt_entry_to(unsigned *plt_offset,
|
||||||
|
+ void *start, Elf_Addr v)
|
||||||
|
+{
|
||||||
|
+ unsigned *tramp = start + *plt_offset;
|
||||||
|
+ *plt_offset += 4 * sizeof(int);
|
||||||
|
+
|
||||||
|
+ /* adjust carry for addiu */
|
||||||
|
+ if (v & 0x00008000)
|
||||||
|
+ v += 0x10000;
|
||||||
|
+
|
||||||
|
+ tramp[0] = 0x3c190000 | (v >> 16); /* lui t9, hi16 */
|
||||||
|
+ tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */
|
||||||
|
+ tramp[2] = 0x03200008; /* jr t9 */
|
||||||
|
+ tramp[3] = 0x00000000; /* nop */
|
||||||
|
+
|
||||||
|
+ return (Elf_Addr) tramp;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
|
||||||
|
+{
|
||||||
|
+ if (is_phys_addr(location))
|
||||||
|
+ return add_plt_entry_to(&me->arch.phys_plt_offset,
|
||||||
|
+ me->arch.phys_plt_tbl, v);
|
||||||
|
+ else
|
||||||
|
+ return add_plt_entry_to(&me->arch.virt_plt_offset,
|
||||||
|
+ me->arch.virt_plt_tbl, v);
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int apply_r_mips_26(struct module *me, u32 *location, u32 base,
|
||||||
|
Elf_Addr v)
|
||||||
|
{
|
||||||
|
+ u32 ofs = base & 0x03ffffff;
|
||||||
|
+
|
||||||
|
if (v % 4) {
|
||||||
|
pr_err("module %s: dangerous R_MIPS_26 relocation\n",
|
||||||
|
me->name);
|
||||||
|
@@ -56,13 +294,17 @@ static int apply_r_mips_26(struct module
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
|
||||||
|
- pr_err("module %s: relocation overflow\n",
|
||||||
|
- me->name);
|
||||||
|
- return -ENOEXEC;
|
||||||
|
+ v = add_plt_entry(me, location, v + (ofs << 2));
|
||||||
|
+ if (!v) {
|
||||||
|
+ pr_err("module %s: relocation overflow\n",
|
||||||
|
+ me->name);
|
||||||
|
+ return -ENOEXEC;
|
||||||
|
+ }
|
||||||
|
+ ofs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*location = (*location & ~0x03ffffff) |
|
||||||
|
- ((base + (v >> 2)) & 0x03ffffff);
|
||||||
|
+ ((ofs + (v >> 2)) & 0x03ffffff);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -442,9 +684,36 @@ int module_finalize(const Elf_Ehdr *hdr,
|
||||||
|
list_add(&me->arch.dbe_list, &dbe_list);
|
||||||
|
spin_unlock_irq(&dbe_lock);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /* Get rid of the fixup trampoline if we're running the module
|
||||||
|
+ * from physically mapped address space */
|
||||||
|
+ if (me->arch.phys_plt_offset == 0) {
|
||||||
|
+ __module_free(me->arch.phys_plt_tbl);
|
||||||
|
+ me->arch.phys_plt_tbl = NULL;
|
||||||
|
+ }
|
||||||
|
+ if (me->arch.virt_plt_offset == 0) {
|
||||||
|
+ __module_free(me->arch.virt_plt_tbl);
|
||||||
|
+ me->arch.virt_plt_tbl = NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void module_arch_freeing_init(struct module *mod)
|
||||||
|
+{
|
||||||
|
+ if (mod->state == MODULE_STATE_LIVE)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (mod->arch.phys_plt_tbl) {
|
||||||
|
+ __module_free(mod->arch.phys_plt_tbl);
|
||||||
|
+ mod->arch.phys_plt_tbl = NULL;
|
||||||
|
+ }
|
||||||
|
+ if (mod->arch.virt_plt_tbl) {
|
||||||
|
+ __module_free(mod->arch.virt_plt_tbl);
|
||||||
|
+ mod->arch.virt_plt_tbl = NULL;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void module_arch_cleanup(struct module *mod)
|
||||||
|
{
|
||||||
|
spin_lock_irq(&dbe_lock);
|
22
6.7/target/linux/generic/pending-6.7/308-mips32r2_tune.patch
Normal file
22
6.7/target/linux/generic/pending-6.7/308-mips32r2_tune.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: kernel: add -mtune=34kc to MIPS CFLAGS when building for mips32r2
|
||||||
|
|
||||||
|
This provides a good tradeoff across at least 24Kc-74Kc, while also
|
||||||
|
producing smaller code.
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
arch/mips/Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/arch/mips/Makefile
|
||||||
|
+++ b/arch/mips/Makefile
|
||||||
|
@@ -172,7 +172,7 @@ cflags-$(CONFIG_CPU_R4300) += -march=r43
|
||||||
|
cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
|
||||||
|
cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
|
||||||
|
cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
|
||||||
|
-cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
|
||||||
|
+cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -mtune=34kc -Wa,--trap
|
||||||
|
cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg
|
||||||
|
cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg
|
||||||
|
cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap
|
|
@ -0,0 +1,22 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: fix errors in unresolved weak symbols on arm
|
||||||
|
|
||||||
|
lede-commit: 570699d4838a907c3ef9f2819bf19eb72997b32f
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
arch/arm/kernel/module.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
--- a/arch/arm/kernel/module.c
|
||||||
|
+++ b/arch/arm/kernel/module.c
|
||||||
|
@@ -146,6 +146,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons
|
||||||
|
return -ENOEXEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) &&
|
||||||
|
+ ELF_ST_BIND(sym->st_info) == STB_WEAK)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
loc = dstsec->sh_addr + rel->r_offset;
|
||||||
|
|
||||||
|
switch (ELF32_R_TYPE(rel->r_info)) {
|
|
@ -0,0 +1,282 @@
|
||||||
|
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
|
Subject: MIPS: kexec: Accept command line parameters from userspace.
|
||||||
|
|
||||||
|
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
||||||
|
---
|
||||||
|
arch/mips/kernel/machine_kexec.c | 153 +++++++++++++++++++++++++++++++-----
|
||||||
|
arch/mips/kernel/machine_kexec.h | 20 +++++
|
||||||
|
arch/mips/kernel/relocate_kernel.S | 21 +++--
|
||||||
|
3 files changed, 167 insertions(+), 27 deletions(-)
|
||||||
|
create mode 100644 arch/mips/kernel/machine_kexec.h
|
||||||
|
|
||||||
|
--- a/arch/mips/kernel/machine_kexec.c
|
||||||
|
+++ b/arch/mips/kernel/machine_kexec.c
|
||||||
|
@@ -9,14 +9,11 @@
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/libfdt.h>
|
||||||
|
|
||||||
|
+#include <asm/bootinfo.h>
|
||||||
|
#include <asm/cacheflush.h>
|
||||||
|
#include <asm/page.h>
|
||||||
|
-
|
||||||
|
-extern const unsigned char relocate_new_kernel[];
|
||||||
|
-extern const size_t relocate_new_kernel_size;
|
||||||
|
-
|
||||||
|
-extern unsigned long kexec_start_address;
|
||||||
|
-extern unsigned long kexec_indirection_page;
|
||||||
|
+#include <linux/uaccess.h>
|
||||||
|
+#include "machine_kexec.h"
|
||||||
|
|
||||||
|
static unsigned long reboot_code_buffer;
|
||||||
|
|
||||||
|
@@ -30,6 +27,101 @@ void (*_crash_smp_send_stop)(void) = NUL
|
||||||
|
void (*_machine_kexec_shutdown)(void) = NULL;
|
||||||
|
void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
|
||||||
|
|
||||||
|
+static void machine_kexec_print_args(void)
|
||||||
|
+{
|
||||||
|
+ unsigned long argc = (int)kexec_args[0];
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ pr_info("kexec_args[0] (argc): %lu\n", argc);
|
||||||
|
+ pr_info("kexec_args[1] (argv): %p\n", (void *)kexec_args[1]);
|
||||||
|
+ pr_info("kexec_args[2] (env ): %p\n", (void *)kexec_args[2]);
|
||||||
|
+ pr_info("kexec_args[3] (desc): %p\n", (void *)kexec_args[3]);
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < argc; i++) {
|
||||||
|
+ pr_info("kexec_argv[%d] = %p, %s\n",
|
||||||
|
+ i, kexec_argv[i], kexec_argv[i]);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void machine_kexec_init_argv(struct kimage *image)
|
||||||
|
+{
|
||||||
|
+ void __user *buf = NULL;
|
||||||
|
+ size_t bufsz;
|
||||||
|
+ size_t size;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ bufsz = 0;
|
||||||
|
+ for (i = 0; i < image->nr_segments; i++) {
|
||||||
|
+ struct kexec_segment *seg;
|
||||||
|
+
|
||||||
|
+ seg = &image->segment[i];
|
||||||
|
+ if (seg->bufsz < 6)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (strncmp((char *) seg->buf, "kexec ", 6))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ buf = seg->buf;
|
||||||
|
+ bufsz = seg->bufsz;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!buf)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ size = KEXEC_COMMAND_LINE_SIZE;
|
||||||
|
+ size = min(size, bufsz);
|
||||||
|
+ if (size < bufsz)
|
||||||
|
+ pr_warn("kexec command line truncated to %zd bytes\n", size);
|
||||||
|
+
|
||||||
|
+ /* Copy to kernel space */
|
||||||
|
+ if (copy_from_user(kexec_argv_buf, buf, size))
|
||||||
|
+ pr_warn("kexec command line copy to kernel space failed\n");
|
||||||
|
+
|
||||||
|
+ kexec_argv_buf[size - 1] = 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void machine_kexec_parse_argv(struct kimage *image)
|
||||||
|
+{
|
||||||
|
+ char *reboot_code_buffer;
|
||||||
|
+ int reloc_delta;
|
||||||
|
+ char *ptr;
|
||||||
|
+ int argc;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ ptr = kexec_argv_buf;
|
||||||
|
+ argc = 0;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * convert command line string to array of parameters
|
||||||
|
+ * (as bootloader does).
|
||||||
|
+ */
|
||||||
|
+ while (ptr && *ptr && (KEXEC_MAX_ARGC > argc)) {
|
||||||
|
+ if (*ptr == ' ') {
|
||||||
|
+ *ptr++ = '\0';
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ kexec_argv[argc++] = ptr;
|
||||||
|
+ ptr = strchr(ptr, ' ');
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!argc)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ kexec_args[0] = argc;
|
||||||
|
+ kexec_args[1] = (unsigned long)kexec_argv;
|
||||||
|
+ kexec_args[2] = 0;
|
||||||
|
+ kexec_args[3] = 0;
|
||||||
|
+
|
||||||
|
+ reboot_code_buffer = page_address(image->control_code_page);
|
||||||
|
+ reloc_delta = reboot_code_buffer - (char *)kexec_relocate_new_kernel;
|
||||||
|
+
|
||||||
|
+ kexec_args[1] += reloc_delta;
|
||||||
|
+ for (i = 0; i < argc; i++)
|
||||||
|
+ kexec_argv[i] += reloc_delta;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void kexec_image_info(const struct kimage *kimage)
|
||||||
|
{
|
||||||
|
unsigned long i;
|
||||||
|
@@ -99,6 +191,18 @@ machine_kexec_prepare(struct kimage *kim
|
||||||
|
#endif
|
||||||
|
|
||||||
|
kexec_image_info(kimage);
|
||||||
|
+ /*
|
||||||
|
+ * Whenever arguments passed from kexec-tools, Init the arguments as
|
||||||
|
+ * the original ones to try avoiding booting failure.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ kexec_args[0] = fw_arg0;
|
||||||
|
+ kexec_args[1] = fw_arg1;
|
||||||
|
+ kexec_args[2] = fw_arg2;
|
||||||
|
+ kexec_args[3] = fw_arg3;
|
||||||
|
+
|
||||||
|
+ machine_kexec_init_argv(kimage);
|
||||||
|
+ machine_kexec_parse_argv(kimage);
|
||||||
|
|
||||||
|
if (_machine_kexec_prepare)
|
||||||
|
return _machine_kexec_prepare(kimage);
|
||||||
|
@@ -161,7 +265,7 @@ machine_crash_shutdown(struct pt_regs *r
|
||||||
|
void kexec_nonboot_cpu_jump(void)
|
||||||
|
{
|
||||||
|
local_flush_icache_range((unsigned long)relocated_kexec_smp_wait,
|
||||||
|
- reboot_code_buffer + relocate_new_kernel_size);
|
||||||
|
+ reboot_code_buffer + KEXEC_RELOCATE_NEW_KERNEL_SIZE);
|
||||||
|
|
||||||
|
relocated_kexec_smp_wait(NULL);
|
||||||
|
}
|
||||||
|
@@ -199,7 +303,7 @@ void kexec_reboot(void)
|
||||||
|
* machine_kexec() CPU.
|
||||||
|
*/
|
||||||
|
local_flush_icache_range(reboot_code_buffer,
|
||||||
|
- reboot_code_buffer + relocate_new_kernel_size);
|
||||||
|
+ reboot_code_buffer + KEXEC_RELOCATE_NEW_KERNEL_SIZE);
|
||||||
|
|
||||||
|
do_kexec = (void *)reboot_code_buffer;
|
||||||
|
do_kexec();
|
||||||
|
@@ -212,10 +316,12 @@ machine_kexec(struct kimage *image)
|
||||||
|
unsigned long *ptr;
|
||||||
|
|
||||||
|
reboot_code_buffer =
|
||||||
|
- (unsigned long)page_address(image->control_code_page);
|
||||||
|
+ (unsigned long)page_address(image->control_code_page);
|
||||||
|
+ pr_info("reboot_code_buffer = %p\n", (void *)reboot_code_buffer);
|
||||||
|
|
||||||
|
kexec_start_address =
|
||||||
|
(unsigned long) phys_to_virt(image->start);
|
||||||
|
+ pr_info("kexec_start_address = %p\n", (void *)kexec_start_address);
|
||||||
|
|
||||||
|
if (image->type == KEXEC_TYPE_DEFAULT) {
|
||||||
|
kexec_indirection_page =
|
||||||
|
@@ -223,9 +329,19 @@ machine_kexec(struct kimage *image)
|
||||||
|
} else {
|
||||||
|
kexec_indirection_page = (unsigned long)&image->head;
|
||||||
|
}
|
||||||
|
+ pr_info("kexec_indirection_page = %p\n", (void *)kexec_indirection_page);
|
||||||
|
|
||||||
|
- memcpy((void*)reboot_code_buffer, relocate_new_kernel,
|
||||||
|
- relocate_new_kernel_size);
|
||||||
|
+ pr_info("Where is memcpy: %p\n", memcpy);
|
||||||
|
+ pr_info("kexec_relocate_new_kernel = %p, kexec_relocate_new_kernel_end = %p\n",
|
||||||
|
+ (void *)kexec_relocate_new_kernel, &kexec_relocate_new_kernel_end);
|
||||||
|
+ pr_info("Copy %lu bytes from %p to %p\n", KEXEC_RELOCATE_NEW_KERNEL_SIZE,
|
||||||
|
+ (void *)kexec_relocate_new_kernel, (void *)reboot_code_buffer);
|
||||||
|
+ memcpy((void*)reboot_code_buffer, kexec_relocate_new_kernel,
|
||||||
|
+ KEXEC_RELOCATE_NEW_KERNEL_SIZE);
|
||||||
|
+
|
||||||
|
+ pr_info("Before _print_args().\n");
|
||||||
|
+ machine_kexec_print_args();
|
||||||
|
+ pr_info("Before eval loop.\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The generic kexec code builds a page list with physical
|
||||||
|
@@ -256,7 +372,7 @@ machine_kexec(struct kimage *image)
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* All secondary cpus now may jump to kexec_wait cycle */
|
||||||
|
relocated_kexec_smp_wait = reboot_code_buffer +
|
||||||
|
- (void *)(kexec_smp_wait - relocate_new_kernel);
|
||||||
|
+ (void *)(kexec_smp_wait - kexec_relocate_new_kernel);
|
||||||
|
smp_wmb();
|
||||||
|
atomic_set(&kexec_ready_to_reboot, 1);
|
||||||
|
#endif
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/mips/kernel/machine_kexec.h
|
||||||
|
@@ -0,0 +1,20 @@
|
||||||
|
+#ifndef _MACHINE_KEXEC_H
|
||||||
|
+#define _MACHINE_KEXEC_H
|
||||||
|
+
|
||||||
|
+#ifndef __ASSEMBLY__
|
||||||
|
+extern const unsigned char kexec_relocate_new_kernel[];
|
||||||
|
+extern unsigned long kexec_relocate_new_kernel_end;
|
||||||
|
+extern unsigned long kexec_start_address;
|
||||||
|
+extern unsigned long kexec_indirection_page;
|
||||||
|
+
|
||||||
|
+extern char kexec_argv_buf[];
|
||||||
|
+extern char *kexec_argv[];
|
||||||
|
+
|
||||||
|
+#define KEXEC_RELOCATE_NEW_KERNEL_SIZE ((unsigned long)&kexec_relocate_new_kernel_end - (unsigned long)kexec_relocate_new_kernel)
|
||||||
|
+#endif /* !__ASSEMBLY__ */
|
||||||
|
+
|
||||||
|
+#define KEXEC_COMMAND_LINE_SIZE 256
|
||||||
|
+#define KEXEC_ARGV_SIZE (KEXEC_COMMAND_LINE_SIZE / 16)
|
||||||
|
+#define KEXEC_MAX_ARGC (KEXEC_ARGV_SIZE / sizeof(long))
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
--- a/arch/mips/kernel/relocate_kernel.S
|
||||||
|
+++ b/arch/mips/kernel/relocate_kernel.S
|
||||||
|
@@ -10,10 +10,11 @@
|
||||||
|
#include <asm/mipsregs.h>
|
||||||
|
#include <asm/stackframe.h>
|
||||||
|
#include <asm/addrspace.h>
|
||||||
|
+#include "machine_kexec.h"
|
||||||
|
|
||||||
|
#include <kernel-entry-init.h>
|
||||||
|
|
||||||
|
-LEAF(relocate_new_kernel)
|
||||||
|
+LEAF(kexec_relocate_new_kernel)
|
||||||
|
PTR_L a0, arg0
|
||||||
|
PTR_L a1, arg1
|
||||||
|
PTR_L a2, arg2
|
||||||
|
@@ -98,7 +99,7 @@ done:
|
||||||
|
#endif
|
||||||
|
/* jump to kexec_start_address */
|
||||||
|
j s1
|
||||||
|
- END(relocate_new_kernel)
|
||||||
|
+ END(kexec_relocate_new_kernel)
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/*
|
||||||
|
@@ -177,8 +178,15 @@ EXPORT(kexec_indirection_page)
|
||||||
|
PTR_WD 0
|
||||||
|
.size kexec_indirection_page, PTRSIZE
|
||||||
|
|
||||||
|
-relocate_new_kernel_end:
|
||||||
|
+kexec_argv_buf:
|
||||||
|
+ EXPORT(kexec_argv_buf)
|
||||||
|
+ .skip KEXEC_COMMAND_LINE_SIZE
|
||||||
|
+ .size kexec_argv_buf, KEXEC_COMMAND_LINE_SIZE
|
||||||
|
+
|
||||||
|
+kexec_argv:
|
||||||
|
+ EXPORT(kexec_argv)
|
||||||
|
+ .skip KEXEC_ARGV_SIZE
|
||||||
|
+ .size kexec_argv, KEXEC_ARGV_SIZE
|
||||||
|
|
||||||
|
-EXPORT(relocate_new_kernel_size)
|
||||||
|
- PTR_WD relocate_new_kernel_end - relocate_new_kernel
|
||||||
|
- .size relocate_new_kernel_size, PTRSIZE
|
||||||
|
+kexec_relocate_new_kernel_end:
|
||||||
|
+ EXPORT(kexec_relocate_new_kernel_end)
|
|
@ -0,0 +1,84 @@
|
||||||
|
From bb0c3b0175240bf152fd7c644821a0cf9f77c37c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
|
||||||
|
Date: Fri, 15 Mar 2019 18:53:38 +0300
|
||||||
|
Subject: [PATCH] arc add OWRTDTB section
|
||||||
|
|
||||||
|
This change allows OpenWRT to patch resulting kernel binary with
|
||||||
|
external .dtb.
|
||||||
|
|
||||||
|
That allows us to re-use exactky the same vmlinux on different boards
|
||||||
|
given its ARC core configurations match (at least cache line sizes etc).
|
||||||
|
|
||||||
|
""patch-dtb" searches for ASCII "OWRTDTB:" strign and copies external
|
||||||
|
.dtb right after it, keeping the string in place.
|
||||||
|
|
||||||
|
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
|
||||||
|
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
|
||||||
|
Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
|
||||||
|
---
|
||||||
|
arch/arc/kernel/head.S | 10 ++++++++++
|
||||||
|
arch/arc/kernel/setup.c | 4 +++-
|
||||||
|
arch/arc/kernel/vmlinux.lds.S | 13 +++++++++++++
|
||||||
|
3 files changed, 26 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/arch/arc/kernel/head.S
|
||||||
|
+++ b/arch/arc/kernel/head.S
|
||||||
|
@@ -88,6 +88,16 @@
|
||||||
|
DSP_EARLY_INIT
|
||||||
|
.endm
|
||||||
|
|
||||||
|
+ ; Here "patch-dtb" will embed external .dtb
|
||||||
|
+ ; Note "patch-dtb" searches for ASCII "OWRTDTB:" string
|
||||||
|
+ ; and pastes .dtb right after it, hense the string precedes
|
||||||
|
+ ; __image_dtb symbol.
|
||||||
|
+ .section .owrt, "aw",@progbits
|
||||||
|
+ .ascii "OWRTDTB:"
|
||||||
|
+ENTRY(__image_dtb)
|
||||||
|
+ .fill 0x4000
|
||||||
|
+END(__image_dtb)
|
||||||
|
+
|
||||||
|
.section .init.text, "ax",@progbits
|
||||||
|
|
||||||
|
;----------------------------------------------------------------
|
||||||
|
--- a/arch/arc/kernel/setup.c
|
||||||
|
+++ b/arch/arc/kernel/setup.c
|
||||||
|
@@ -495,6 +495,8 @@ static inline bool uboot_arg_invalid(uns
|
||||||
|
/* We always pass 0 as magic from U-boot */
|
||||||
|
#define UBOOT_MAGIC_VALUE 0
|
||||||
|
|
||||||
|
+extern struct boot_param_header __image_dtb;
|
||||||
|
+
|
||||||
|
void __init handle_uboot_args(void)
|
||||||
|
{
|
||||||
|
bool use_embedded_dtb = true;
|
||||||
|
@@ -533,7 +535,7 @@ void __init handle_uboot_args(void)
|
||||||
|
ignore_uboot_args:
|
||||||
|
|
||||||
|
if (use_embedded_dtb) {
|
||||||
|
- machine_desc = setup_machine_fdt(__dtb_start);
|
||||||
|
+ machine_desc = setup_machine_fdt(&__image_dtb);
|
||||||
|
if (!machine_desc)
|
||||||
|
panic("Embedded DT invalid\n");
|
||||||
|
}
|
||||||
|
--- a/arch/arc/kernel/vmlinux.lds.S
|
||||||
|
+++ b/arch/arc/kernel/vmlinux.lds.S
|
||||||
|
@@ -27,6 +27,19 @@ SECTIONS
|
||||||
|
|
||||||
|
. = CONFIG_LINUX_LINK_BASE;
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * In OpenWRT we want to patch built binary embedding .dtb of choice.
|
||||||
|
+ * This is implemented with "patch-dtb" utility which searches for
|
||||||
|
+ * "OWRTDTB:" string in first 16k of image and if it is found
|
||||||
|
+ * copies .dtb right after mentioned string.
|
||||||
|
+ *
|
||||||
|
+ * Note: "OWRTDTB:" won't be overwritten with .dtb, .dtb will follow it.
|
||||||
|
+ */
|
||||||
|
+ .owrt : {
|
||||||
|
+ *(.owrt)
|
||||||
|
+ . = ALIGN(PAGE_SIZE);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
_int_vec_base_lds = .;
|
||||||
|
.vector : {
|
||||||
|
*(.vector)
|
|
@ -0,0 +1,24 @@
|
||||||
|
From: Alexey Brodkin <abrodkin@synopsys.com>
|
||||||
|
Subject: arc: enable unaligned access in kernel mode
|
||||||
|
|
||||||
|
This enables misaligned access handling even in kernel mode.
|
||||||
|
Some wireless drivers (ath9k-htc and mt7601u) use misaligned accesses
|
||||||
|
here and there and to cope with that without fixing stuff in the drivers
|
||||||
|
we're just gracefully handling it on ARC.
|
||||||
|
|
||||||
|
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
|
||||||
|
---
|
||||||
|
arch/arc/kernel/unaligned.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/arch/arc/kernel/unaligned.c
|
||||||
|
+++ b/arch/arc/kernel/unaligned.c
|
||||||
|
@@ -202,7 +202,7 @@ int misaligned_fixup(unsigned long addre
|
||||||
|
char buf[TASK_COMM_LEN];
|
||||||
|
|
||||||
|
/* handle user mode only and only if enabled by sysadmin */
|
||||||
|
- if (!user_mode(regs) || !unaligned_enabled)
|
||||||
|
+ if (!unaligned_enabled)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (no_unaligned_warning) {
|
|
@ -0,0 +1,25 @@
|
||||||
|
From 66770a004afe10df11d3902e16eaa0c2c39436bb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pawel Dembicki <paweldembicki@gmail.com>
|
||||||
|
Date: Fri, 24 May 2019 17:56:19 +0200
|
||||||
|
Subject: [PATCH] powerpc: Enable kernel XZ compression option on PPC_85xx
|
||||||
|
|
||||||
|
Enable kernel XZ compression option on PPC_85xx. Tested with
|
||||||
|
simpleImage on TP-Link TL-WDR4900 (Freescale P1014 processor).
|
||||||
|
|
||||||
|
Suggested-by: Christian Lamparter <chunkeey@gmail.com>
|
||||||
|
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
|
||||||
|
---
|
||||||
|
arch/powerpc/Kconfig | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/arch/powerpc/Kconfig
|
||||||
|
+++ b/arch/powerpc/Kconfig
|
||||||
|
@@ -229,7 +229,7 @@ config PPC
|
||||||
|
select HAVE_KERNEL_GZIP
|
||||||
|
select HAVE_KERNEL_LZMA if DEFAULT_UIMAGE
|
||||||
|
select HAVE_KERNEL_LZO if DEFAULT_UIMAGE
|
||||||
|
- select HAVE_KERNEL_XZ if PPC_BOOK3S || 44x
|
||||||
|
+ select HAVE_KERNEL_XZ if PPC_BOOK3S || 44x || PPC_85xx
|
||||||
|
select HAVE_KPROBES
|
||||||
|
select HAVE_KPROBES_ON_FTRACE
|
||||||
|
select HAVE_KRETPROBES
|
|
@ -0,0 +1,328 @@
|
||||||
|
From 39717277d5c87bdb183cf2f258957b44ba99b4df Mon Sep 17 00:00:00 2001
|
||||||
|
From: OpenWrt community <openwrt-devel@lists.openwrt.org>
|
||||||
|
Date: Wed, 13 Jul 2022 11:47:35 +0200
|
||||||
|
Subject: [PATCH] mtd: mtdsplit support
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/mtd/Kconfig | 19 ++++
|
||||||
|
drivers/mtd/Makefile | 2 +
|
||||||
|
drivers/mtd/mtdpart.c | 169 ++++++++++++++++++++++++++++-----
|
||||||
|
include/linux/mtd/mtd.h | 25 +++++
|
||||||
|
include/linux/mtd/partitions.h | 7 ++
|
||||||
|
5 files changed, 197 insertions(+), 25 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/Kconfig
|
||||||
|
+++ b/drivers/mtd/Kconfig
|
||||||
|
@@ -12,6 +12,25 @@ menuconfig MTD
|
||||||
|
|
||||||
|
if MTD
|
||||||
|
|
||||||
|
+menu "OpenWrt specific MTD options"
|
||||||
|
+
|
||||||
|
+config MTD_ROOTFS_ROOT_DEV
|
||||||
|
+ bool "Automatically set 'rootfs' partition to be root filesystem"
|
||||||
|
+ default y
|
||||||
|
+
|
||||||
|
+config MTD_SPLIT_FIRMWARE
|
||||||
|
+ bool "Automatically split firmware partition for kernel+rootfs"
|
||||||
|
+ default y
|
||||||
|
+
|
||||||
|
+config MTD_SPLIT_FIRMWARE_NAME
|
||||||
|
+ string "Firmware partition name"
|
||||||
|
+ depends on MTD_SPLIT_FIRMWARE
|
||||||
|
+ default "firmware"
|
||||||
|
+
|
||||||
|
+source "drivers/mtd/mtdsplit/Kconfig"
|
||||||
|
+
|
||||||
|
+endmenu
|
||||||
|
+
|
||||||
|
config MTD_TESTS
|
||||||
|
tristate "MTD tests support (DANGEROUS)"
|
||||||
|
depends on m
|
||||||
|
--- a/drivers/mtd/Makefile
|
||||||
|
+++ b/drivers/mtd/Makefile
|
||||||
|
@@ -9,6 +9,8 @@ mtd-y := mtdcore.o mtdsuper.o mtdconc
|
||||||
|
|
||||||
|
obj-y += parsers/
|
||||||
|
|
||||||
|
+obj-$(CONFIG_MTD_SPLIT) += mtdsplit/
|
||||||
|
+
|
||||||
|
# 'Users' - code which presents functionality to userspace.
|
||||||
|
obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o
|
||||||
|
obj-$(CONFIG_MTD_BLOCK) += mtdblock.o
|
||||||
|
--- a/drivers/mtd/mtdpart.c
|
||||||
|
+++ b/drivers/mtd/mtdpart.c
|
||||||
|
@@ -15,11 +15,13 @@
|
||||||
|
#include <linux/kmod.h>
|
||||||
|
#include <linux/mtd/mtd.h>
|
||||||
|
#include <linux/mtd/partitions.h>
|
||||||
|
+#include <linux/magic.h>
|
||||||
|
#include <linux/err.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_platform.h>
|
||||||
|
|
||||||
|
#include "mtdcore.h"
|
||||||
|
+#include "mtdsplit/mtdsplit.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MTD methods which simply translate the effective address and pass through
|
||||||
|
@@ -236,6 +238,147 @@ static int mtd_add_partition_attrs(struc
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static DEFINE_SPINLOCK(part_parser_lock);
|
||||||
|
+static LIST_HEAD(part_parsers);
|
||||||
|
+
|
||||||
|
+static struct mtd_part_parser *mtd_part_parser_get(const char *name)
|
||||||
|
+{
|
||||||
|
+ struct mtd_part_parser *p, *ret = NULL;
|
||||||
|
+
|
||||||
|
+ spin_lock(&part_parser_lock);
|
||||||
|
+
|
||||||
|
+ list_for_each_entry(p, &part_parsers, list)
|
||||||
|
+ if (!strcmp(p->name, name) && try_module_get(p->owner)) {
|
||||||
|
+ ret = p;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ spin_unlock(&part_parser_lock);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline void mtd_part_parser_put(const struct mtd_part_parser *p)
|
||||||
|
+{
|
||||||
|
+ module_put(p->owner);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static struct mtd_part_parser *
|
||||||
|
+get_partition_parser_by_type(enum mtd_parser_type type,
|
||||||
|
+ struct mtd_part_parser *start)
|
||||||
|
+{
|
||||||
|
+ struct mtd_part_parser *p, *ret = NULL;
|
||||||
|
+
|
||||||
|
+ spin_lock(&part_parser_lock);
|
||||||
|
+
|
||||||
|
+ p = list_prepare_entry(start, &part_parsers, list);
|
||||||
|
+ if (start)
|
||||||
|
+ mtd_part_parser_put(start);
|
||||||
|
+
|
||||||
|
+ list_for_each_entry_continue(p, &part_parsers, list) {
|
||||||
|
+ if (p->type == type && try_module_get(p->owner)) {
|
||||||
|
+ ret = p;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ spin_unlock(&part_parser_lock);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int parse_mtd_partitions_by_type(struct mtd_info *master,
|
||||||
|
+ enum mtd_parser_type type,
|
||||||
|
+ const struct mtd_partition **pparts,
|
||||||
|
+ struct mtd_part_parser_data *data)
|
||||||
|
+{
|
||||||
|
+ struct mtd_part_parser *prev = NULL;
|
||||||
|
+ int ret = 0;
|
||||||
|
+
|
||||||
|
+ while (1) {
|
||||||
|
+ struct mtd_part_parser *parser;
|
||||||
|
+
|
||||||
|
+ parser = get_partition_parser_by_type(type, prev);
|
||||||
|
+ if (!parser)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ ret = (*parser->parse_fn)(master, pparts, data);
|
||||||
|
+
|
||||||
|
+ if (ret > 0) {
|
||||||
|
+ mtd_part_parser_put(parser);
|
||||||
|
+ printk(KERN_NOTICE
|
||||||
|
+ "%d %s partitions found on MTD device %s\n",
|
||||||
|
+ ret, parser->name, master->name);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ prev = parser;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+run_parsers_by_type(struct mtd_info *child, enum mtd_parser_type type)
|
||||||
|
+{
|
||||||
|
+ struct mtd_partition *parts;
|
||||||
|
+ int nr_parts;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ nr_parts = parse_mtd_partitions_by_type(child, type, (const struct mtd_partition **)&parts,
|
||||||
|
+ NULL);
|
||||||
|
+ if (nr_parts <= 0)
|
||||||
|
+ return nr_parts;
|
||||||
|
+
|
||||||
|
+ if (WARN_ON(!parts))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < nr_parts; i++) {
|
||||||
|
+ /* adjust partition offsets */
|
||||||
|
+ parts[i].offset += child->part.offset;
|
||||||
|
+
|
||||||
|
+ mtd_add_partition(child->parent,
|
||||||
|
+ parts[i].name,
|
||||||
|
+ parts[i].offset,
|
||||||
|
+ parts[i].size);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ kfree(parts);
|
||||||
|
+
|
||||||
|
+ return nr_parts;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
|
||||||
|
+#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME
|
||||||
|
+#else
|
||||||
|
+#define SPLIT_FIRMWARE_NAME "unused"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+static void split_firmware(struct mtd_info *master, struct mtd_info *part)
|
||||||
|
+{
|
||||||
|
+ run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mtd_partition_split(struct mtd_info *master, struct mtd_info *part)
|
||||||
|
+{
|
||||||
|
+ static int rootfs_found = 0;
|
||||||
|
+
|
||||||
|
+ if (rootfs_found)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (of_find_property(mtd_get_of_node(part), "linux,rootfs", NULL) ||
|
||||||
|
+ !strcmp(part->name, "rootfs")) {
|
||||||
|
+ run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS);
|
||||||
|
+
|
||||||
|
+ rootfs_found = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) &&
|
||||||
|
+ !strcmp(part->name, SPLIT_FIRMWARE_NAME) &&
|
||||||
|
+ !of_find_property(mtd_get_of_node(part), "compatible", NULL))
|
||||||
|
+ split_firmware(master, part);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int mtd_add_partition(struct mtd_info *parent, const char *name,
|
||||||
|
long long offset, long long length)
|
||||||
|
{
|
||||||
|
@@ -274,6 +417,7 @@ int mtd_add_partition(struct mtd_info *p
|
||||||
|
if (ret)
|
||||||
|
goto err_remove_part;
|
||||||
|
|
||||||
|
+ mtd_partition_split(parent, child);
|
||||||
|
mtd_add_partition_attrs(child);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -422,6 +566,7 @@ int add_mtd_partitions(struct mtd_info *
|
||||||
|
goto err_del_partitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ mtd_partition_split(master, child);
|
||||||
|
mtd_add_partition_attrs(child);
|
||||||
|
|
||||||
|
/* Look for subpartitions */
|
||||||
|
@@ -438,31 +583,6 @@ err_del_partitions:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static DEFINE_SPINLOCK(part_parser_lock);
|
||||||
|
-static LIST_HEAD(part_parsers);
|
||||||
|
-
|
||||||
|
-static struct mtd_part_parser *mtd_part_parser_get(const char *name)
|
||||||
|
-{
|
||||||
|
- struct mtd_part_parser *p, *ret = NULL;
|
||||||
|
-
|
||||||
|
- spin_lock(&part_parser_lock);
|
||||||
|
-
|
||||||
|
- list_for_each_entry(p, &part_parsers, list)
|
||||||
|
- if (!strcmp(p->name, name) && try_module_get(p->owner)) {
|
||||||
|
- ret = p;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- spin_unlock(&part_parser_lock);
|
||||||
|
-
|
||||||
|
- return ret;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static inline void mtd_part_parser_put(const struct mtd_part_parser *p)
|
||||||
|
-{
|
||||||
|
- module_put(p->owner);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
/*
|
||||||
|
* Many partition parsers just expected the core to kfree() all their data in
|
||||||
|
* one chunk. Do that by default.
|
||||||
|
--- a/include/linux/mtd/mtd.h
|
||||||
|
+++ b/include/linux/mtd/mtd.h
|
||||||
|
@@ -615,6 +615,24 @@ static inline void mtd_align_erase_req(s
|
||||||
|
req->len += mtd->erasesize - mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline uint64_t mtd_roundup_to_eb(uint64_t sz, struct mtd_info *mtd)
|
||||||
|
+{
|
||||||
|
+ if (mtd_mod_by_eb(sz, mtd) == 0)
|
||||||
|
+ return sz;
|
||||||
|
+
|
||||||
|
+ /* Round up to next erase block */
|
||||||
|
+ return (mtd_div_by_eb(sz, mtd) + 1) * mtd->erasesize;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline uint64_t mtd_rounddown_to_eb(uint64_t sz, struct mtd_info *mtd)
|
||||||
|
+{
|
||||||
|
+ if (mtd_mod_by_eb(sz, mtd) == 0)
|
||||||
|
+ return sz;
|
||||||
|
+
|
||||||
|
+ /* Round down to the start of the current erase block */
|
||||||
|
+ return (mtd_div_by_eb(sz, mtd)) * mtd->erasesize;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd)
|
||||||
|
{
|
||||||
|
if (mtd->writesize_shift)
|
||||||
|
@@ -688,6 +706,13 @@ extern struct mtd_info *of_get_mtd_devic
|
||||||
|
extern struct mtd_info *get_mtd_device_nm(const char *name);
|
||||||
|
extern void put_mtd_device(struct mtd_info *mtd);
|
||||||
|
|
||||||
|
+static inline uint64_t mtdpart_get_offset(const struct mtd_info *mtd)
|
||||||
|
+{
|
||||||
|
+ if (!mtd_is_partition(mtd))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ return mtd->part.offset;
|
||||||
|
+}
|
||||||
|
|
||||||
|
struct mtd_notifier {
|
||||||
|
void (*add)(struct mtd_info *mtd);
|
||||||
|
--- a/include/linux/mtd/partitions.h
|
||||||
|
+++ b/include/linux/mtd/partitions.h
|
||||||
|
@@ -75,6 +75,12 @@ struct mtd_part_parser_data {
|
||||||
|
* Functions dealing with the various ways of partitioning the space
|
||||||
|
*/
|
||||||
|
|
||||||
|
+enum mtd_parser_type {
|
||||||
|
+ MTD_PARSER_TYPE_DEVICE = 0,
|
||||||
|
+ MTD_PARSER_TYPE_ROOTFS,
|
||||||
|
+ MTD_PARSER_TYPE_FIRMWARE,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct mtd_part_parser {
|
||||||
|
struct list_head list;
|
||||||
|
struct module *owner;
|
||||||
|
@@ -83,6 +89,7 @@ struct mtd_part_parser {
|
||||||
|
int (*parse_fn)(struct mtd_info *, const struct mtd_partition **,
|
||||||
|
struct mtd_part_parser_data *);
|
||||||
|
void (*cleanup)(const struct mtd_partition *pparts, int nr_parts);
|
||||||
|
+ enum mtd_parser_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Container for passing around a set of parsed partitions */
|
|
@ -0,0 +1,245 @@
|
||||||
|
From acacdac272927ae1d96e0bca51eb82899671eaea Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Thomson <git@johnthomson.fastmail.com.au>
|
||||||
|
Date: Fri, 25 Dec 2020 18:50:08 +1000
|
||||||
|
Subject: [PATCH] mtd: spi-nor: write support for minor aligned partitions
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Do not prevent writing to mtd partitions where a partition boundary sits
|
||||||
|
on a minor erasesize boundary.
|
||||||
|
This addresses a FIXME that has been present since the start of the
|
||||||
|
linux git history:
|
||||||
|
/* Doesn't start on a boundary of major erase size */
|
||||||
|
/* FIXME: Let it be writable if it is on a boundary of
|
||||||
|
* _minor_ erase size though */
|
||||||
|
|
||||||
|
Allow a uniform erase region spi-nor device to be configured
|
||||||
|
to use the non-uniform erase regions code path for an erase with:
|
||||||
|
CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y
|
||||||
|
|
||||||
|
On supporting hardware (SECT_4K: majority of current SPI-NOR device)
|
||||||
|
provide the facility for an erase to use the least number
|
||||||
|
of SPI-NOR operations, as well as access to 4K erase without
|
||||||
|
requiring CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
|
||||||
|
|
||||||
|
Introduce erasesize_minor to the mtd struct,
|
||||||
|
the smallest erasesize supported by the device
|
||||||
|
|
||||||
|
On existing devices, this is useful where write support is wanted
|
||||||
|
for data on a 4K partition, such as some u-boot-env partitions,
|
||||||
|
or RouterBoot soft_config, while still netting the performance
|
||||||
|
benefits of using 64K sectors
|
||||||
|
|
||||||
|
Performance:
|
||||||
|
time mtd erase firmware
|
||||||
|
OpenWrt 5.10 ramips MT7621 w25q128jv 0xfc0000 partition length
|
||||||
|
|
||||||
|
Without this patch
|
||||||
|
MTD_SPI_NOR_USE_4K_SECTORS=y |n
|
||||||
|
real 2m 11.66s |0m 50.86s
|
||||||
|
user 0m 0.00s |0m 0.00s
|
||||||
|
sys 1m 56.20s |0m 50.80s
|
||||||
|
|
||||||
|
With this patch
|
||||||
|
MTD_SPI_NOR_USE_VARIABLE_ERASE=n|y |4K_SECTORS=y
|
||||||
|
real 0m 51.68s |0m 50.85s |2m 12.89s
|
||||||
|
user 0m 0.00s |0m 0.00s |0m 0.01s
|
||||||
|
sys 0m 46.94s |0m 50.38s |2m 12.46s
|
||||||
|
|
||||||
|
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
|
||||||
|
Signed-off-by: Thibaut VARÈNE <hacks+kernel@slashdirt.org>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
checkpatch does not like the printk(KERN_WARNING
|
||||||
|
these should be changed separately beforehand?
|
||||||
|
|
||||||
|
Changes v1 -> v2:
|
||||||
|
Added mtdcore sysfs for erasesize_minor
|
||||||
|
Removed finding minor erasesize for variable erase regions device,
|
||||||
|
as untested and no responses regarding it.
|
||||||
|
Moved IF_ENABLED for SPINOR variable erase to guard setting
|
||||||
|
erasesize_minor in spi-nor/core.c
|
||||||
|
Removed setting erasesize to minor where partition boundaries require
|
||||||
|
minor erase to be writable
|
||||||
|
Simplified minor boundary check by relying on minor being a factor of
|
||||||
|
major
|
||||||
|
|
||||||
|
Changes RFC -> v1:
|
||||||
|
Fix uninitialized variable smatch warning
|
||||||
|
Reported-by: kernel test robot <lkp@intel.com>
|
||||||
|
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
|
||||||
|
---
|
||||||
|
drivers/mtd/mtdcore.c | 10 ++++++++++
|
||||||
|
drivers/mtd/mtdpart.c | 35 +++++++++++++++++++++++++----------
|
||||||
|
drivers/mtd/spi-nor/Kconfig | 10 ++++++++++
|
||||||
|
drivers/mtd/spi-nor/core.c | 11 +++++++++--
|
||||||
|
include/linux/mtd/mtd.h | 2 ++
|
||||||
|
5 files changed, 56 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/mtdcore.c
|
||||||
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
|
@@ -169,6 +169,15 @@ static ssize_t mtd_erasesize_show(struct
|
||||||
|
}
|
||||||
|
MTD_DEVICE_ATTR_RO(erasesize);
|
||||||
|
|
||||||
|
+static ssize_t mtd_erasesize_minor_show(struct device *dev,
|
||||||
|
+ struct device_attribute *attr, char *buf)
|
||||||
|
+{
|
||||||
|
+ struct mtd_info *mtd = dev_get_drvdata(dev);
|
||||||
|
+
|
||||||
|
+ return sysfs_emit(buf, "%lu\n", (unsigned long)mtd->erasesize_minor);
|
||||||
|
+}
|
||||||
|
+MTD_DEVICE_ATTR_RO(erasesize_minor);
|
||||||
|
+
|
||||||
|
static ssize_t mtd_writesize_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
@@ -314,6 +323,7 @@ static struct attribute *mtd_attrs[] = {
|
||||||
|
&dev_attr_flags.attr,
|
||||||
|
&dev_attr_size.attr,
|
||||||
|
&dev_attr_erasesize.attr,
|
||||||
|
+ &dev_attr_erasesize_minor.attr,
|
||||||
|
&dev_attr_writesize.attr,
|
||||||
|
&dev_attr_subpagesize.attr,
|
||||||
|
&dev_attr_oobsize.attr,
|
||||||
|
--- a/drivers/mtd/mtdpart.c
|
||||||
|
+++ b/drivers/mtd/mtdpart.c
|
||||||
|
@@ -41,6 +41,7 @@ static struct mtd_info *allocate_partiti
|
||||||
|
struct mtd_info *master = mtd_get_master(parent);
|
||||||
|
int wr_alignment = (parent->flags & MTD_NO_ERASE) ?
|
||||||
|
master->writesize : master->erasesize;
|
||||||
|
+ int wr_alignment_minor = 0;
|
||||||
|
u64 parent_size = mtd_is_partition(parent) ?
|
||||||
|
parent->part.size : parent->size;
|
||||||
|
struct mtd_info *child;
|
||||||
|
@@ -165,6 +166,7 @@ static struct mtd_info *allocate_partiti
|
||||||
|
} else {
|
||||||
|
/* Single erase size */
|
||||||
|
child->erasesize = master->erasesize;
|
||||||
|
+ child->erasesize_minor = master->erasesize_minor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -172,26 +174,39 @@ static struct mtd_info *allocate_partiti
|
||||||
|
* exposes several regions with different erasesize. Adjust
|
||||||
|
* wr_alignment accordingly.
|
||||||
|
*/
|
||||||
|
- if (!(child->flags & MTD_NO_ERASE))
|
||||||
|
+ if (!(child->flags & MTD_NO_ERASE)) {
|
||||||
|
wr_alignment = child->erasesize;
|
||||||
|
+ wr_alignment_minor = child->erasesize_minor;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
tmp = mtd_get_master_ofs(child, 0);
|
||||||
|
remainder = do_div(tmp, wr_alignment);
|
||||||
|
if ((child->flags & MTD_WRITEABLE) && remainder) {
|
||||||
|
- /* Doesn't start on a boundary of major erase size */
|
||||||
|
- /* FIXME: Let it be writable if it is on a boundary of
|
||||||
|
- * _minor_ erase size though */
|
||||||
|
- child->flags &= ~MTD_WRITEABLE;
|
||||||
|
- printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n",
|
||||||
|
- part->name);
|
||||||
|
+ if (wr_alignment_minor) {
|
||||||
|
+ /* rely on minor being a factor of major erasesize */
|
||||||
|
+ tmp = remainder;
|
||||||
|
+ remainder = do_div(tmp, wr_alignment_minor);
|
||||||
|
+ }
|
||||||
|
+ if (remainder) {
|
||||||
|
+ child->flags &= ~MTD_WRITEABLE;
|
||||||
|
+ printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n",
|
||||||
|
+ part->name);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = mtd_get_master_ofs(child, 0) + child->part.size;
|
||||||
|
remainder = do_div(tmp, wr_alignment);
|
||||||
|
if ((child->flags & MTD_WRITEABLE) && remainder) {
|
||||||
|
- child->flags &= ~MTD_WRITEABLE;
|
||||||
|
- printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n",
|
||||||
|
- part->name);
|
||||||
|
+ if (wr_alignment_minor) {
|
||||||
|
+ tmp = remainder;
|
||||||
|
+ remainder = do_div(tmp, wr_alignment_minor);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (remainder) {
|
||||||
|
+ child->flags &= ~MTD_WRITEABLE;
|
||||||
|
+ printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n",
|
||||||
|
+ part->name);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
child->size = child->part.size;
|
||||||
|
--- a/drivers/mtd/spi-nor/Kconfig
|
||||||
|
+++ b/drivers/mtd/spi-nor/Kconfig
|
||||||
|
@@ -10,6 +10,16 @@ menuconfig MTD_SPI_NOR
|
||||||
|
|
||||||
|
if MTD_SPI_NOR
|
||||||
|
|
||||||
|
+config MTD_SPI_NOR_USE_VARIABLE_ERASE
|
||||||
|
+ bool "Disable uniform_erase to allow use of all hardware supported erasesizes"
|
||||||
|
+ depends on !MTD_SPI_NOR_USE_4K_SECTORS
|
||||||
|
+ default n
|
||||||
|
+ help
|
||||||
|
+ Allow mixed use of all hardware supported erasesizes,
|
||||||
|
+ by forcing spi_nor to use the multiple eraseregions code path.
|
||||||
|
+ For example: A 68K erase will use one 64K erase, and one 4K erase
|
||||||
|
+ on supporting hardware.
|
||||||
|
+
|
||||||
|
config MTD_SPI_NOR_USE_4K_SECTORS
|
||||||
|
bool "Use small 4096 B erase sectors"
|
||||||
|
default y
|
||||||
|
--- a/drivers/mtd/spi-nor/core.c
|
||||||
|
+++ b/drivers/mtd/spi-nor/core.c
|
||||||
|
@@ -1050,6 +1050,8 @@ static u8 spi_nor_convert_3to4_erase(u8
|
||||||
|
|
||||||
|
static bool spi_nor_has_uniform_erase(const struct spi_nor *nor)
|
||||||
|
{
|
||||||
|
+ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE))
|
||||||
|
+ return false;
|
||||||
|
return !!nor->params->erase_map.uniform_erase_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2158,6 +2160,7 @@ static int spi_nor_select_erase(struct s
|
||||||
|
{
|
||||||
|
struct spi_nor_erase_map *map = &nor->params->erase_map;
|
||||||
|
const struct spi_nor_erase_type *erase = NULL;
|
||||||
|
+ const struct spi_nor_erase_type *erase_minor = NULL;
|
||||||
|
struct mtd_info *mtd = &nor->mtd;
|
||||||
|
u32 wanted_size = nor->info->sector_size;
|
||||||
|
int i;
|
||||||
|
@@ -2190,8 +2193,9 @@ static int spi_nor_select_erase(struct s
|
||||||
|
*/
|
||||||
|
for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) {
|
||||||
|
if (map->erase_type[i].size) {
|
||||||
|
- erase = &map->erase_type[i];
|
||||||
|
- break;
|
||||||
|
+ if (!erase)
|
||||||
|
+ erase = &map->erase_type[i];
|
||||||
|
+ erase_minor = &map->erase_type[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2199,6 +2203,9 @@ static int spi_nor_select_erase(struct s
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
mtd->erasesize = erase->size;
|
||||||
|
+ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE) &&
|
||||||
|
+ erase_minor && erase_minor->size < erase->size)
|
||||||
|
+ mtd->erasesize_minor = erase_minor->size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/include/linux/mtd/mtd.h
|
||||||
|
+++ b/include/linux/mtd/mtd.h
|
||||||
|
@@ -245,6 +245,8 @@ struct mtd_info {
|
||||||
|
* information below if they desire
|
||||||
|
*/
|
||||||
|
uint32_t erasesize;
|
||||||
|
+ /* "Minor" (smallest) erase size supported by the whole device */
|
||||||
|
+ uint32_t erasesize_minor;
|
||||||
|
/* Minimal writable flash unit size. In case of NOR flash it is 1 (even
|
||||||
|
* though individual bits can be cleared), in case of NAND flash it is
|
||||||
|
* one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
|
|
@ -0,0 +1,41 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: add patch for including unpartitioned space in the rootfs partition for redboot devices (if applicable)
|
||||||
|
|
||||||
|
[john@phrozen.org: used by ixp and others]
|
||||||
|
|
||||||
|
lede-commit: 394918851f84e4d00fa16eb900e7700e95091f00
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
drivers/mtd/redboot.c | 19 +++++++++++++------
|
||||||
|
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/redboot.c
|
||||||
|
+++ b/drivers/mtd/parsers/redboot.c
|
||||||
|
@@ -278,14 +278,21 @@ nogood:
|
||||||
|
#endif
|
||||||
|
names += strlen(names) + 1;
|
||||||
|
|
||||||
|
-#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
|
||||||
|
if (fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
|
||||||
|
- i++;
|
||||||
|
- parts[i].offset = parts[i - 1].size + parts[i - 1].offset;
|
||||||
|
- parts[i].size = fl->next->img->flash_base - parts[i].offset;
|
||||||
|
- parts[i].name = nullname;
|
||||||
|
- }
|
||||||
|
+ if (!strcmp(parts[i].name, "rootfs")) {
|
||||||
|
+ parts[i].size = fl->next->img->flash_base;
|
||||||
|
+ parts[i].size &= ~(master->erasesize - 1);
|
||||||
|
+ parts[i].size -= parts[i].offset;
|
||||||
|
+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
|
||||||
|
+ nrparts--;
|
||||||
|
+ } else {
|
||||||
|
+ i++;
|
||||||
|
+ parts[i].offset = parts[i-1].size + parts[i-1].offset;
|
||||||
|
+ parts[i].size = fl->next->img->flash_base - parts[i].offset;
|
||||||
|
+ parts[i].name = nullname;
|
||||||
|
#endif
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
tmp_fl = fl;
|
||||||
|
fl = fl->next;
|
||||||
|
kfree(tmp_fl);
|
|
@ -0,0 +1,229 @@
|
||||||
|
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
Subject: Add myloader partition table parser
|
||||||
|
|
||||||
|
[john@phozen.org: shoud be upstreamable]
|
||||||
|
|
||||||
|
lede-commit: d8bf22859b51faa09d22c056fe221a45d2f7a3b8
|
||||||
|
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||||
|
[adjust for kernel 5.4, add myloader.c to patch]
|
||||||
|
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/Kconfig
|
||||||
|
+++ b/drivers/mtd/parsers/Kconfig
|
||||||
|
@@ -67,6 +67,22 @@ config MTD_CMDLINE_PARTS
|
||||||
|
|
||||||
|
If unsure, say 'N'.
|
||||||
|
|
||||||
|
+config MTD_MYLOADER_PARTS
|
||||||
|
+ tristate "MyLoader partition parsing"
|
||||||
|
+ depends on ADM5120 || ATH25 || ATH79
|
||||||
|
+ help
|
||||||
|
+ MyLoader is a bootloader which allows the user to define partitions
|
||||||
|
+ in flash devices, by putting a table in the second erase block
|
||||||
|
+ on the device, similar to a partition table. This table gives the
|
||||||
|
+ offsets and lengths of the user defined partitions.
|
||||||
|
+
|
||||||
|
+ If you need code which can detect and parse these tables, and
|
||||||
|
+ register MTD 'partitions' corresponding to each image detected,
|
||||||
|
+ enable this option.
|
||||||
|
+
|
||||||
|
+ You will still need the parsing functions to be called by the driver
|
||||||
|
+ for your particular device. It won't happen automatically.
|
||||||
|
+
|
||||||
|
config MTD_OF_PARTS
|
||||||
|
tristate "OpenFirmware (device tree) partitioning parser"
|
||||||
|
default y
|
||||||
|
--- a/drivers/mtd/parsers/Makefile
|
||||||
|
+++ b/drivers/mtd/parsers/Makefile
|
||||||
|
@@ -4,6 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm4
|
||||||
|
obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o
|
||||||
|
obj-$(CONFIG_MTD_BRCM_U_BOOT) += brcm_u-boot.o
|
||||||
|
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
|
||||||
|
+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
|
||||||
|
obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
|
||||||
|
ofpart-y += ofpart_core.o
|
||||||
|
ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/mtd/parsers/myloader.c
|
||||||
|
@@ -0,0 +1,181 @@
|
||||||
|
+/*
|
||||||
|
+ * Parse MyLoader-style flash partition tables and produce a Linux partition
|
||||||
|
+ * array to match.
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2007-2009 Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
+ *
|
||||||
|
+ * This file was based on drivers/mtd/redboot.c
|
||||||
|
+ * Author: Red Hat, Inc. - David Woodhouse <dwmw2@cambridge.redhat.com>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify it
|
||||||
|
+ * under the terms of the GNU General Public License version 2 as published
|
||||||
|
+ * by the Free Software Foundation.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/version.h>
|
||||||
|
+#include <linux/slab.h>
|
||||||
|
+#include <linux/init.h>
|
||||||
|
+#include <linux/vmalloc.h>
|
||||||
|
+#include <linux/mtd/mtd.h>
|
||||||
|
+#include <linux/mtd/partitions.h>
|
||||||
|
+#include <linux/byteorder/generic.h>
|
||||||
|
+#include <linux/myloader.h>
|
||||||
|
+
|
||||||
|
+#define BLOCK_LEN_MIN 0x10000
|
||||||
|
+#define PART_NAME_LEN 32
|
||||||
|
+
|
||||||
|
+struct part_data {
|
||||||
|
+ struct mylo_partition_table tab;
|
||||||
|
+ char names[MYLO_MAX_PARTITIONS][PART_NAME_LEN];
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int myloader_parse_partitions(struct mtd_info *master,
|
||||||
|
+ const struct mtd_partition **pparts,
|
||||||
|
+ struct mtd_part_parser_data *data)
|
||||||
|
+{
|
||||||
|
+ struct part_data *buf;
|
||||||
|
+ struct mylo_partition_table *tab;
|
||||||
|
+ struct mylo_partition *part;
|
||||||
|
+ struct mtd_partition *mtd_parts;
|
||||||
|
+ struct mtd_partition *mtd_part;
|
||||||
|
+ int num_parts;
|
||||||
|
+ int ret, i;
|
||||||
|
+ size_t retlen;
|
||||||
|
+ char *names;
|
||||||
|
+ unsigned long offset;
|
||||||
|
+ unsigned long blocklen;
|
||||||
|
+
|
||||||
|
+ buf = vmalloc(sizeof(*buf));
|
||||||
|
+ if (!buf) {
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+ tab = &buf->tab;
|
||||||
|
+
|
||||||
|
+ blocklen = master->erasesize;
|
||||||
|
+ if (blocklen < BLOCK_LEN_MIN)
|
||||||
|
+ blocklen = BLOCK_LEN_MIN;
|
||||||
|
+
|
||||||
|
+ offset = blocklen;
|
||||||
|
+
|
||||||
|
+ /* Find the partition table */
|
||||||
|
+ for (i = 0; i < 4; i++, offset += blocklen) {
|
||||||
|
+ printk(KERN_DEBUG "%s: searching for MyLoader partition table"
|
||||||
|
+ " at offset 0x%lx\n", master->name, offset);
|
||||||
|
+
|
||||||
|
+ ret = mtd_read(master, offset, sizeof(*buf), &retlen,
|
||||||
|
+ (void *)buf);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto out_free_buf;
|
||||||
|
+
|
||||||
|
+ if (retlen != sizeof(*buf)) {
|
||||||
|
+ ret = -EIO;
|
||||||
|
+ goto out_free_buf;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Check for Partition Table magic number */
|
||||||
|
+ if (tab->magic == le32_to_cpu(MYLO_MAGIC_PARTITIONS))
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (tab->magic != le32_to_cpu(MYLO_MAGIC_PARTITIONS)) {
|
||||||
|
+ printk(KERN_DEBUG "%s: no MyLoader partition table found\n",
|
||||||
|
+ master->name);
|
||||||
|
+ ret = 0;
|
||||||
|
+ goto out_free_buf;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* The MyLoader and the Partition Table is always present */
|
||||||
|
+ num_parts = 2;
|
||||||
|
+
|
||||||
|
+ /* Detect number of used partitions */
|
||||||
|
+ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) {
|
||||||
|
+ part = &tab->partitions[i];
|
||||||
|
+
|
||||||
|
+ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ num_parts++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) +
|
||||||
|
+ num_parts * PART_NAME_LEN), GFP_KERNEL);
|
||||||
|
+
|
||||||
|
+ if (!mtd_parts) {
|
||||||
|
+ ret = -ENOMEM;
|
||||||
|
+ goto out_free_buf;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mtd_part = mtd_parts;
|
||||||
|
+ names = (char *)&mtd_parts[num_parts];
|
||||||
|
+
|
||||||
|
+ strncpy(names, "myloader", PART_NAME_LEN);
|
||||||
|
+ mtd_part->name = names;
|
||||||
|
+ mtd_part->offset = 0;
|
||||||
|
+ mtd_part->size = offset;
|
||||||
|
+ mtd_part->mask_flags = MTD_WRITEABLE;
|
||||||
|
+ mtd_part++;
|
||||||
|
+ names += PART_NAME_LEN;
|
||||||
|
+
|
||||||
|
+ strncpy(names, "partition_table", PART_NAME_LEN);
|
||||||
|
+ mtd_part->name = names;
|
||||||
|
+ mtd_part->offset = offset;
|
||||||
|
+ mtd_part->size = blocklen;
|
||||||
|
+ mtd_part->mask_flags = MTD_WRITEABLE;
|
||||||
|
+ mtd_part++;
|
||||||
|
+ names += PART_NAME_LEN;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < MYLO_MAX_PARTITIONS; i++) {
|
||||||
|
+ part = &tab->partitions[i];
|
||||||
|
+
|
||||||
|
+ if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if ((buf->names[i][0]) && (buf->names[i][0] != '\xff'))
|
||||||
|
+ strncpy(names, buf->names[i], PART_NAME_LEN);
|
||||||
|
+ else
|
||||||
|
+ snprintf(names, PART_NAME_LEN, "partition%d", i);
|
||||||
|
+
|
||||||
|
+ mtd_part->offset = le32_to_cpu(part->addr);
|
||||||
|
+ mtd_part->size = le32_to_cpu(part->size);
|
||||||
|
+ mtd_part->name = names;
|
||||||
|
+ mtd_part++;
|
||||||
|
+ names += PART_NAME_LEN;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *pparts = mtd_parts;
|
||||||
|
+ ret = num_parts;
|
||||||
|
+
|
||||||
|
+ out_free_buf:
|
||||||
|
+ vfree(buf);
|
||||||
|
+ out:
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static struct mtd_part_parser myloader_mtd_parser = {
|
||||||
|
+ .owner = THIS_MODULE,
|
||||||
|
+ .parse_fn = myloader_parse_partitions,
|
||||||
|
+ .name = "MyLoader",
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int __init myloader_mtd_parser_init(void)
|
||||||
|
+{
|
||||||
|
+ register_mtd_parser(&myloader_mtd_parser);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void __exit myloader_mtd_parser_exit(void)
|
||||||
|
+{
|
||||||
|
+ deregister_mtd_parser(&myloader_mtd_parser);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+module_init(myloader_mtd_parser_init);
|
||||||
|
+module_exit(myloader_mtd_parser_exit);
|
||||||
|
+
|
||||||
|
+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
|
||||||
|
+MODULE_DESCRIPTION("Parsing code for MyLoader partition tables");
|
||||||
|
+MODULE_LICENSE("GPL v2");
|
|
@ -0,0 +1,68 @@
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
||||||
|
Subject: [PATCH] mtd: bcm47xxpart: check for bad blocks when calculating offsets
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/parser_trx.c
|
||||||
|
+++ b/drivers/mtd/parsers/parser_trx.c
|
||||||
|
@@ -25,6 +25,33 @@ struct trx_header {
|
||||||
|
uint32_t offset[3];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Calculate real end offset (address) for a given amount of data. It checks
|
||||||
|
+ * all blocks skipping bad ones.
|
||||||
|
+ */
|
||||||
|
+static size_t parser_trx_real_offset(struct mtd_info *mtd, size_t bytes)
|
||||||
|
+{
|
||||||
|
+ size_t real_offset = 0;
|
||||||
|
+
|
||||||
|
+ if (mtd_block_isbad(mtd, real_offset))
|
||||||
|
+ pr_warn("Base offset shouldn't be at bad block");
|
||||||
|
+
|
||||||
|
+ while (bytes >= mtd->erasesize) {
|
||||||
|
+ bytes -= mtd->erasesize;
|
||||||
|
+ real_offset += mtd->erasesize;
|
||||||
|
+ while (mtd_block_isbad(mtd, real_offset)) {
|
||||||
|
+ real_offset += mtd->erasesize;
|
||||||
|
+
|
||||||
|
+ if (real_offset >= mtd->size)
|
||||||
|
+ return real_offset - mtd->erasesize;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ real_offset += bytes;
|
||||||
|
+
|
||||||
|
+ return real_offset;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static const char *parser_trx_data_part_name(struct mtd_info *master,
|
||||||
|
size_t offset)
|
||||||
|
{
|
||||||
|
@@ -86,21 +113,21 @@ static int parser_trx_parse(struct mtd_i
|
||||||
|
if (trx.offset[2]) {
|
||||||
|
part = &parts[curr_part++];
|
||||||
|
part->name = "loader";
|
||||||
|
- part->offset = trx.offset[i];
|
||||||
|
+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trx.offset[i]) {
|
||||||
|
part = &parts[curr_part++];
|
||||||
|
part->name = "linux";
|
||||||
|
- part->offset = trx.offset[i];
|
||||||
|
+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trx.offset[i]) {
|
||||||
|
part = &parts[curr_part++];
|
||||||
|
- part->name = parser_trx_data_part_name(mtd, trx.offset[i]);
|
||||||
|
- part->offset = trx.offset[i];
|
||||||
|
+ part->offset = parser_trx_real_offset(mtd, trx.offset[i]);
|
||||||
|
+ part->name = parser_trx_data_part_name(mtd, part->offset);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
|
||||||
|
Subject: mtd: bcm47xxpart: detect T_Meter partition
|
||||||
|
|
||||||
|
It can be found on many Netgear devices. It consists of many 0x30 blocks
|
||||||
|
starting with 4D 54.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/mtd/bcm47xxpart.c | 10 ++++++++++
|
||||||
|
1 file changed, 10 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/bcm47xxpart.c
|
||||||
|
+++ b/drivers/mtd/parsers/bcm47xxpart.c
|
||||||
|
@@ -35,6 +35,7 @@
|
||||||
|
#define NVRAM_HEADER 0x48534C46 /* FLSH */
|
||||||
|
#define POT_MAGIC1 0x54544f50 /* POTT */
|
||||||
|
#define POT_MAGIC2 0x504f /* OP */
|
||||||
|
+#define T_METER_MAGIC 0x4D540000 /* MT */
|
||||||
|
#define ML_MAGIC1 0x39685a42
|
||||||
|
#define ML_MAGIC2 0x26594131
|
||||||
|
#define TRX_MAGIC 0x30524448
|
||||||
|
@@ -178,6 +179,15 @@ static int bcm47xxpart_parse(struct mtd_
|
||||||
|
MTD_WRITEABLE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /* T_Meter */
|
||||||
|
+ if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC &&
|
||||||
|
+ (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC &&
|
||||||
|
+ (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) {
|
||||||
|
+ bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset,
|
||||||
|
+ MTD_WRITEABLE);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* TRX */
|
||||||
|
if (buf[0x000 / 4] == TRX_MAGIC) {
|
|
@ -0,0 +1,38 @@
|
||||||
|
From 4437e01fb6bca63fccdba5d6c44888b0935885c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= <hacks@slashdirt.org>
|
||||||
|
Date: Tue, 24 Mar 2020 11:45:07 +0100
|
||||||
|
Subject: [PATCH] generic: routerboot partition build bits (5.4)
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This patch adds routerbootpart kernel build bits
|
||||||
|
|
||||||
|
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
|
||||||
|
---
|
||||||
|
drivers/mtd/parsers/Kconfig | 9 +++++++++
|
||||||
|
drivers/mtd/parsers/Makefile | 1 +
|
||||||
|
2 files changed, 10 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/Kconfig
|
||||||
|
+++ b/drivers/mtd/parsers/Kconfig
|
||||||
|
@@ -236,3 +236,12 @@ config MTD_SERCOMM_PARTS
|
||||||
|
partition map. This partition table contains real partition
|
||||||
|
offsets, which may differ from device to device depending on the
|
||||||
|
number and location of bad blocks on NAND.
|
||||||
|
+
|
||||||
|
+config MTD_ROUTERBOOT_PARTS
|
||||||
|
+ tristate "RouterBoot flash partition parser"
|
||||||
|
+ depends on MTD && OF
|
||||||
|
+ help
|
||||||
|
+ MikroTik RouterBoot is implemented as a multi segment system on the
|
||||||
|
+ flash, some of which are fixed and some of which are located at
|
||||||
|
+ variable offsets. This parser handles both cases via properly
|
||||||
|
+ formatted DTS.
|
||||||
|
--- a/drivers/mtd/parsers/Makefile
|
||||||
|
+++ b/drivers/mtd/parsers/Makefile
|
||||||
|
@@ -17,3 +17,4 @@ obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpa
|
||||||
|
obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o
|
||||||
|
obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
|
||||||
|
obj-$(CONFIG_MTD_QCOMSMEM_PARTS) += qcomsmempart.o
|
||||||
|
+obj-$(CONFIG_MTD_ROUTERBOOT_PARTS) += routerbootpart.o
|
|
@ -0,0 +1,25 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: kernel: disable cfi cmdset 0002 erase suspend
|
||||||
|
|
||||||
|
on some platforms, erase suspend leads to data corruption and lockups when write
|
||||||
|
ops collide with erase ops. this has been observed on the buffalo wzr-hp-g300nh.
|
||||||
|
rather than play whack-a-mole with a hard to reproduce issue on a variety of devices,
|
||||||
|
simply disable erase suspend, as it will usually not produce any useful gain on
|
||||||
|
the small filesystems used on embedded hardware.
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
drivers/mtd/chips/cfi_cmdset_0002.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||||
|
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||||
|
@@ -908,7 +908,7 @@ static int get_chip(struct map_info *map
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case FL_ERASING:
|
||||||
|
- if (!cfip || !(cfip->EraseSuspend & (0x1|0x2)) ||
|
||||||
|
+ if (1 /* no suspend */ || !cfip || !(cfip->EraseSuspend & (0x1|0x2)) ||
|
||||||
|
!(mode == FL_READY || mode == FL_POINT ||
|
||||||
|
(mode == FL_WRITING && (cfip->EraseSuspend & 0x2))))
|
||||||
|
goto sleep;
|
|
@ -0,0 +1,17 @@
|
||||||
|
From: George Kashperko <george@znau.edu.ua>
|
||||||
|
Subject: Issue map read after Write Buffer Load command to ensure chip is ready to receive data.
|
||||||
|
|
||||||
|
Signed-off-by: George Kashperko <george@znau.edu.ua>
|
||||||
|
---
|
||||||
|
drivers/mtd/chips/cfi_cmdset_0002.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||||
|
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||||
|
@@ -2052,6 +2052,7 @@ static int __xipram do_write_buffer(stru
|
||||||
|
|
||||||
|
/* Write Buffer Load */
|
||||||
|
map_write(map, CMD(0x25), cmd_adr);
|
||||||
|
+ (void) map_read(map, cmd_adr);
|
||||||
|
|
||||||
|
chip->state = FL_WRITING_TO_BUFFER;
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
From patchwork Thu Feb 6 17:19:41 2020
|
||||||
|
Content-Type: text/plain; charset="utf-8"
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
X-Patchwork-Submitter: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
X-Patchwork-Id: 1234465
|
||||||
|
Date: Thu, 6 Feb 2020 19:19:41 +0200
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
To: linux-mtd@lists.infradead.org
|
||||||
|
Subject: [PATCH v2] mtd: spi-nor: Add support for xt25f128b chip
|
||||||
|
Message-ID: <20200206171941.GA2398@makrotopia.org>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Disposition: inline
|
||||||
|
List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>,
|
||||||
|
<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>
|
||||||
|
Cc: Eitan Cohen <eitan@neot-semadar.com>, Piotr Dymacz <pepe2k@gmail.com>,
|
||||||
|
Tudor Ambarus <tudor.ambarus@microchip.com>
|
||||||
|
Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org>
|
||||||
|
Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org
|
||||||
|
|
||||||
|
Add XT25F128B made by XTX Technology (Shenzhen) Limited.
|
||||||
|
This chip supports dual and quad read and uniform 4K-byte erase.
|
||||||
|
Verified on Teltonika RUT955 which comes with XT25F128B in recent
|
||||||
|
versions of the device.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
drivers/mtd/spi-nor/spi-nor.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/spi-nor/Makefile
|
||||||
|
+++ b/drivers/mtd/spi-nor/Makefile
|
||||||
|
@@ -17,6 +17,7 @@ spi-nor-objs += sst.o
|
||||||
|
spi-nor-objs += winbond.o
|
||||||
|
spi-nor-objs += xilinx.o
|
||||||
|
spi-nor-objs += xmc.o
|
||||||
|
+spi-nor-objs += xtx.o
|
||||||
|
spi-nor-$(CONFIG_DEBUG_FS) += debugfs.o
|
||||||
|
obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o
|
||||||
|
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/mtd/spi-nor/xtx.c
|
||||||
|
@@ -0,0 +1,17 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0
|
||||||
|
+#include <linux/mtd/spi-nor.h>
|
||||||
|
+
|
||||||
|
+#include "core.h"
|
||||||
|
+
|
||||||
|
+static const struct flash_info xtx_parts[] = {
|
||||||
|
+ /* XTX Technology (Shenzhen) Limited */
|
||||||
|
+ { "xt25f128b", INFO(0x0B4018, 0, 64 * 1024, 256)
|
||||||
|
+ NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
|
||||||
|
+ SPI_NOR_QUAD_READ) },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+const struct spi_nor_manufacturer spi_nor_xtx = {
|
||||||
|
+ .name = "xtx",
|
||||||
|
+ .parts = xtx_parts,
|
||||||
|
+ .nparts = ARRAY_SIZE(xtx_parts),
|
||||||
|
+};
|
||||||
|
--- a/drivers/mtd/spi-nor/core.c
|
||||||
|
+++ b/drivers/mtd/spi-nor/core.c
|
||||||
|
@@ -1636,6 +1636,7 @@ static const struct spi_nor_manufacturer
|
||||||
|
&spi_nor_winbond,
|
||||||
|
&spi_nor_xilinx,
|
||||||
|
&spi_nor_xmc,
|
||||||
|
+ &spi_nor_xtx,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,
|
||||||
|
--- a/drivers/mtd/spi-nor/core.h
|
||||||
|
+++ b/drivers/mtd/spi-nor/core.h
|
||||||
|
@@ -633,6 +633,7 @@ extern const struct spi_nor_manufacturer
|
||||||
|
extern const struct spi_nor_manufacturer spi_nor_winbond;
|
||||||
|
extern const struct spi_nor_manufacturer spi_nor_xilinx;
|
||||||
|
extern const struct spi_nor_manufacturer spi_nor_xmc;
|
||||||
|
+extern const struct spi_nor_manufacturer spi_nor_xtx;
|
||||||
|
|
||||||
|
extern const struct attribute_group *spi_nor_sysfs_groups[];
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Subject: ubi: auto-attach mtd device named "ubi" or "data" on boot
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
---
|
||||||
|
drivers/mtd/ubi/build.c | 36 ++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 36 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/ubi/build.c
|
||||||
|
+++ b/drivers/mtd/ubi/build.c
|
||||||
|
@@ -1205,6 +1205,73 @@ static struct mtd_info * __init open_mtd
|
||||||
|
return mtd;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * This function tries attaching mtd partitions named either "ubi" or "data"
|
||||||
|
+ * during boot.
|
||||||
|
+ */
|
||||||
|
+static void __init ubi_auto_attach(void)
|
||||||
|
+{
|
||||||
|
+ int err;
|
||||||
|
+ struct mtd_info *mtd;
|
||||||
|
+ loff_t offset = 0;
|
||||||
|
+ size_t len;
|
||||||
|
+ char magic[4];
|
||||||
|
+
|
||||||
|
+ /* try attaching mtd device named "ubi" or "data" */
|
||||||
|
+ mtd = open_mtd_device("ubi");
|
||||||
|
+ if (IS_ERR(mtd))
|
||||||
|
+ mtd = open_mtd_device("data");
|
||||||
|
+
|
||||||
|
+ if (IS_ERR(mtd))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* get the first not bad block */
|
||||||
|
+ if (mtd_can_have_bb(mtd))
|
||||||
|
+ while (mtd_block_isbad(mtd, offset)) {
|
||||||
|
+ offset += mtd->erasesize;
|
||||||
|
+
|
||||||
|
+ if (offset > mtd->size) {
|
||||||
|
+ pr_err("UBI error: Failed to find a non-bad "
|
||||||
|
+ "block on mtd%d\n", mtd->index);
|
||||||
|
+ goto cleanup;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* check if the read from flash was successful */
|
||||||
|
+ err = mtd_read(mtd, offset, 4, &len, (void *) magic);
|
||||||
|
+ if ((err && !mtd_is_bitflip(err)) || len != 4) {
|
||||||
|
+ pr_err("UBI error: unable to read from mtd%d\n", mtd->index);
|
||||||
|
+ goto cleanup;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* check for a valid ubi magic */
|
||||||
|
+ if (strncmp(magic, "UBI#", 4)) {
|
||||||
|
+ pr_err("UBI error: no valid UBI magic found inside mtd%d\n", mtd->index);
|
||||||
|
+ goto cleanup;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* don't auto-add media types where UBI doesn't makes sense */
|
||||||
|
+ if (mtd->type != MTD_NANDFLASH &&
|
||||||
|
+ mtd->type != MTD_NORFLASH &&
|
||||||
|
+ mtd->type != MTD_DATAFLASH &&
|
||||||
|
+ mtd->type != MTD_MLCNANDFLASH)
|
||||||
|
+ goto cleanup;
|
||||||
|
+
|
||||||
|
+ mutex_lock(&ubi_devices_mutex);
|
||||||
|
+ pr_notice("UBI: auto-attach mtd%d\n", mtd->index);
|
||||||
|
+ err = ubi_attach_mtd_dev(mtd, UBI_DEV_NUM_AUTO, 0, 0, false);
|
||||||
|
+ mutex_unlock(&ubi_devices_mutex);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ pr_err("UBI error: cannot attach mtd%d\n", mtd->index);
|
||||||
|
+ goto cleanup;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+cleanup:
|
||||||
|
+ put_mtd_device(mtd);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int __init ubi_init(void)
|
||||||
|
{
|
||||||
|
int err, i, k;
|
||||||
|
@@ -1289,6 +1356,12 @@ static int __init ubi_init(void)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* auto-attach mtd devices only if built-in to the kernel and no ubi.mtd
|
||||||
|
+ * parameter was given */
|
||||||
|
+ if (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
|
||||||
|
+ !ubi_is_module() && !mtd_devs)
|
||||||
|
+ ubi_auto_attach();
|
||||||
|
+
|
||||||
|
err = ubiblock_init();
|
||||||
|
if (err) {
|
||||||
|
pr_err("UBI error: block: cannot initialize, error %d\n", err);
|
|
@ -0,0 +1,69 @@
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Subject: ubi: auto-create ubiblock device for rootfs
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
---
|
||||||
|
drivers/mtd/ubi/block.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 42 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/ubi/block.c
|
||||||
|
+++ b/drivers/mtd/ubi/block.c
|
||||||
|
@@ -653,6 +653,47 @@ static void __init ubiblock_create_from_
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+#define UBIFS_NODE_MAGIC 0x06101831
|
||||||
|
+static inline int ubi_vol_is_ubifs(struct ubi_volume_desc *desc)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+ uint32_t magic_of, magic;
|
||||||
|
+ ret = ubi_read(desc, 0, (char *)&magic_of, 0, 4);
|
||||||
|
+ if (ret)
|
||||||
|
+ return 0;
|
||||||
|
+ magic = le32_to_cpu(magic_of);
|
||||||
|
+ return magic == UBIFS_NODE_MAGIC;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void __init ubiblock_create_auto_rootfs(void)
|
||||||
|
+{
|
||||||
|
+ int ubi_num, ret, is_ubifs;
|
||||||
|
+ struct ubi_volume_desc *desc;
|
||||||
|
+ struct ubi_volume_info vi;
|
||||||
|
+
|
||||||
|
+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
|
||||||
|
+ desc = ubi_open_volume_nm(ubi_num, "rootfs", UBI_READONLY);
|
||||||
|
+ if (IS_ERR(desc))
|
||||||
|
+ desc = ubi_open_volume_nm(ubi_num, "fit", UBI_READONLY);;
|
||||||
|
+
|
||||||
|
+ if (IS_ERR(desc))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ ubi_get_volume_info(desc, &vi);
|
||||||
|
+ is_ubifs = ubi_vol_is_ubifs(desc);
|
||||||
|
+ ubi_close_volume(desc);
|
||||||
|
+ if (is_ubifs)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ ret = ubiblock_create(&vi);
|
||||||
|
+ if (ret)
|
||||||
|
+ pr_err("UBI error: block: can't add '%s' volume, err=%d\n",
|
||||||
|
+ vi.name, ret);
|
||||||
|
+ /* always break if we get here */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void ubiblock_remove_all(void)
|
||||||
|
{
|
||||||
|
struct ubiblock *next;
|
||||||
|
@@ -685,6 +726,10 @@ int __init ubiblock_init(void)
|
||||||
|
*/
|
||||||
|
ubiblock_create_from_param();
|
||||||
|
|
||||||
|
+ /* auto-attach "rootfs" volume if existing and non-ubifs */
|
||||||
|
+ if (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV))
|
||||||
|
+ ubiblock_create_auto_rootfs();
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Block devices are only created upon user requests, so we ignore
|
||||||
|
* existing volumes.
|
|
@ -0,0 +1,34 @@
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Subject: ubi: set ROOT_DEV to ubiblock "rootfs" if unset
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
---
|
||||||
|
drivers/mtd/ubi/block.c | 10 ++++++++++
|
||||||
|
1 file changed, 10 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/ubi/block.c
|
||||||
|
+++ b/drivers/mtd/ubi/block.c
|
||||||
|
@@ -42,6 +42,7 @@
|
||||||
|
#include <linux/scatterlist.h>
|
||||||
|
#include <linux/idr.h>
|
||||||
|
#include <asm/div64.h>
|
||||||
|
+#include <linux/root_dev.h>
|
||||||
|
|
||||||
|
#include "ubi-media.h"
|
||||||
|
#include "ubi.h"
|
||||||
|
@@ -459,6 +460,15 @@ int ubiblock_create(struct ubi_volume_in
|
||||||
|
dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
|
||||||
|
dev->ubi_num, dev->vol_id, vi->name);
|
||||||
|
mutex_unlock(&devices_mutex);
|
||||||
|
+
|
||||||
|
+ if (!strcmp(vi->name, "rootfs") &&
|
||||||
|
+ IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
|
||||||
|
+ ROOT_DEV == 0) {
|
||||||
|
+ pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
|
||||||
|
+ dev->ubi_num, dev->vol_id, vi->name);
|
||||||
|
+ ROOT_DEV = MKDEV(gd->major, gd->first_minor);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out_destroy_wq:
|
|
@ -0,0 +1,60 @@
|
||||||
|
From: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
Subject: mtd: add EOF marker support to the UBI layer
|
||||||
|
|
||||||
|
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
---
|
||||||
|
drivers/mtd/ubi/attach.c | 25 ++++++++++++++++++++++---
|
||||||
|
drivers/mtd/ubi/ubi.h | 1 +
|
||||||
|
2 files changed, 23 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/ubi/attach.c
|
||||||
|
+++ b/drivers/mtd/ubi/attach.c
|
||||||
|
@@ -926,6 +926,13 @@ static bool vol_ignored(int vol_id)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech)
|
||||||
|
+{
|
||||||
|
+ return ech->padding1[0] == 'E' &&
|
||||||
|
+ ech->padding1[1] == 'O' &&
|
||||||
|
+ ech->padding1[2] == 'F';
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* scan_peb - scan and process UBI headers of a PEB.
|
||||||
|
* @ubi: UBI device description object
|
||||||
|
@@ -958,9 +965,21 @@ static int scan_peb(struct ubi_device *u
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
|
||||||
|
- if (err < 0)
|
||||||
|
- return err;
|
||||||
|
+ if (!ai->eof_found) {
|
||||||
|
+ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
|
||||||
|
+ if (err < 0)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ if (ec_hdr_has_eof(ech)) {
|
||||||
|
+ pr_notice("UBI: EOF marker found, PEBs from %d will be erased\n",
|
||||||
|
+ pnum);
|
||||||
|
+ ai->eof_found = true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ai->eof_found)
|
||||||
|
+ err = UBI_IO_FF_BITFLIPS;
|
||||||
|
+
|
||||||
|
switch (err) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
--- a/drivers/mtd/ubi/ubi.h
|
||||||
|
+++ b/drivers/mtd/ubi/ubi.h
|
||||||
|
@@ -778,6 +778,7 @@ struct ubi_attach_info {
|
||||||
|
int mean_ec;
|
||||||
|
uint64_t ec_sum;
|
||||||
|
int ec_count;
|
||||||
|
+ bool eof_found;
|
||||||
|
struct kmem_cache *aeb_slab_cache;
|
||||||
|
struct ubi_ec_hdr *ech;
|
||||||
|
struct ubi_vid_io_buf *vidb;
|
|
@ -0,0 +1,52 @@
|
||||||
|
From 5734c6669fba7ddb5ef491ccff7159d15dba0b59 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernhard Frauendienst <kernel@nospam.obeliks.de>
|
||||||
|
Date: Wed, 5 Sep 2018 01:32:51 +0200
|
||||||
|
Subject: [PATCH 496/497] dt-bindings: add bindings for mtd-concat devices
|
||||||
|
|
||||||
|
Document virtual mtd-concat device bindings.
|
||||||
|
|
||||||
|
Signed-off-by: Bernhard Frauendienst <kernel@nospam.obeliks.de>
|
||||||
|
---
|
||||||
|
.../devicetree/bindings/mtd/mtd-concat.txt | 36 +++++++++++++++++++
|
||||||
|
1 file changed, 36 insertions(+)
|
||||||
|
create mode 100644 Documentation/devicetree/bindings/mtd/mtd-concat.txt
|
||||||
|
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Documentation/devicetree/bindings/mtd/mtd-concat.txt
|
||||||
|
@@ -0,0 +1,36 @@
|
||||||
|
+Virtual MTD concat device
|
||||||
|
+
|
||||||
|
+Requires properties:
|
||||||
|
+- devices: list of phandles to mtd nodes that should be concatenated
|
||||||
|
+
|
||||||
|
+Example:
|
||||||
|
+
|
||||||
|
+&spi {
|
||||||
|
+ flash0: flash@0 {
|
||||||
|
+ ...
|
||||||
|
+ };
|
||||||
|
+ flash1: flash@1 {
|
||||||
|
+ ...
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+flash {
|
||||||
|
+ compatible = "mtd-concat";
|
||||||
|
+
|
||||||
|
+ devices = <&flash0 &flash1>;
|
||||||
|
+
|
||||||
|
+ partitions {
|
||||||
|
+ compatible = "fixed-partitions";
|
||||||
|
+
|
||||||
|
+ partition@0 {
|
||||||
|
+ label = "boot";
|
||||||
|
+ reg = <0x0000000 0x0040000>;
|
||||||
|
+ read-only;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ partition@40000 {
|
||||||
|
+ label = "firmware";
|
||||||
|
+ reg = <0x0040000 0x1fc0000>;
|
||||||
|
+ };
|
||||||
|
+ }
|
||||||
|
+}
|
|
@ -0,0 +1,216 @@
|
||||||
|
From e53f712d8eac71f54399b61038ccf87d2cee99d7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bernhard Frauendienst <kernel@nospam.obeliks.de>
|
||||||
|
Date: Sat, 25 Aug 2018 12:35:22 +0200
|
||||||
|
Subject: [PATCH 497/497] mtd: mtdconcat: add dt driver for concat devices
|
||||||
|
|
||||||
|
Some mtd drivers like physmap variants have support for concatenating
|
||||||
|
multiple mtd devices, but there is no generic way to define such a
|
||||||
|
concat device from within the device tree.
|
||||||
|
|
||||||
|
This is useful for some SoC boards that use multiple flash chips as
|
||||||
|
memory banks of a single mtd device, with partitions spanning chip
|
||||||
|
borders.
|
||||||
|
|
||||||
|
This commit adds a driver for creating virtual mtd-concat devices. They
|
||||||
|
must have a compatible = "mtd-concat" line, and define a list of devices
|
||||||
|
to concat in the 'devices' property, for example:
|
||||||
|
|
||||||
|
flash {
|
||||||
|
compatible = "mtd-concat";
|
||||||
|
|
||||||
|
devices = <&flash0 &flash1>;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
...
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
The driver is added to the very end of the mtd Makefile to increase the
|
||||||
|
likelyhood of all child devices already being loaded at the time of
|
||||||
|
probing, preventing unnecessary deferred probes.
|
||||||
|
|
||||||
|
Signed-off-by: Bernhard Frauendienst <kernel@nospam.obeliks.de>
|
||||||
|
---
|
||||||
|
drivers/mtd/Kconfig | 2 +
|
||||||
|
drivers/mtd/Makefile | 3 +
|
||||||
|
drivers/mtd/composite/Kconfig | 12 +++
|
||||||
|
drivers/mtd/composite/Makefile | 6 ++
|
||||||
|
drivers/mtd/composite/virt_concat.c | 128 ++++++++++++++++++++++++++++
|
||||||
|
5 files changed, 151 insertions(+)
|
||||||
|
create mode 100644 drivers/mtd/composite/Kconfig
|
||||||
|
create mode 100644 drivers/mtd/composite/Makefile
|
||||||
|
create mode 100644 drivers/mtd/composite/virt_concat.c
|
||||||
|
|
||||||
|
--- a/drivers/mtd/Kconfig
|
||||||
|
+++ b/drivers/mtd/Kconfig
|
||||||
|
@@ -241,4 +241,6 @@ source "drivers/mtd/ubi/Kconfig"
|
||||||
|
|
||||||
|
source "drivers/mtd/hyperbus/Kconfig"
|
||||||
|
|
||||||
|
+source "drivers/mtd/composite/Kconfig"
|
||||||
|
+
|
||||||
|
endif # MTD
|
||||||
|
--- a/drivers/mtd/Makefile
|
||||||
|
+++ b/drivers/mtd/Makefile
|
||||||
|
@@ -33,3 +33,6 @@ obj-y += chips/ lpddr/ maps/ devices/ n
|
||||||
|
obj-$(CONFIG_MTD_SPI_NOR) += spi-nor/
|
||||||
|
obj-$(CONFIG_MTD_UBI) += ubi/
|
||||||
|
obj-$(CONFIG_MTD_HYPERBUS) += hyperbus/
|
||||||
|
+
|
||||||
|
+# Composite drivers must be loaded last
|
||||||
|
+obj-y += composite/
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/mtd/composite/Kconfig
|
||||||
|
@@ -0,0 +1,12 @@
|
||||||
|
+menu "Composite MTD device drivers"
|
||||||
|
+ depends on MTD!=n
|
||||||
|
+
|
||||||
|
+config MTD_VIRT_CONCAT
|
||||||
|
+ tristate "Virtual concat MTD device"
|
||||||
|
+ help
|
||||||
|
+ This driver allows creation of a virtual MTD concat device, which
|
||||||
|
+ concatenates multiple underlying MTD devices to a single device.
|
||||||
|
+ This is required by some SoC boards where multiple memory banks are
|
||||||
|
+ used as one device with partitions spanning across device boundaries.
|
||||||
|
+
|
||||||
|
+endmenu
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/mtd/composite/Makefile
|
||||||
|
@@ -0,0 +1,6 @@
|
||||||
|
+# SPDX-License-Identifier: GPL-2.0
|
||||||
|
+#
|
||||||
|
+# linux/drivers/mtd/composite/Makefile
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+obj-$(CONFIG_MTD_VIRT_CONCAT) += virt_concat.o
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/mtd/composite/virt_concat.c
|
||||||
|
@@ -0,0 +1,128 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
+/*
|
||||||
|
+ * Virtual concat MTD device driver
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2018 Bernhard Frauendienst
|
||||||
|
+ * Author: Bernhard Frauendienst, kernel@nospam.obeliks.de
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/device.h>
|
||||||
|
+#include <linux/mtd/concat.h>
|
||||||
|
+#include <linux/mtd/mtd.h>
|
||||||
|
+#include <linux/mtd/partitions.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
+#include <linux/of_platform.h>
|
||||||
|
+#include <linux/slab.h>
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * struct of_virt_concat - platform device driver data.
|
||||||
|
+ * @cmtd the final mtd_concat device
|
||||||
|
+ * @num_devices the number of devices in @devices
|
||||||
|
+ * @devices points to an array of devices already loaded
|
||||||
|
+ */
|
||||||
|
+struct of_virt_concat {
|
||||||
|
+ struct mtd_info *cmtd;
|
||||||
|
+ int num_devices;
|
||||||
|
+ struct mtd_info **devices;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int virt_concat_remove(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct of_virt_concat *info;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ info = platform_get_drvdata(pdev);
|
||||||
|
+ if (!info)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ // unset data for when this is called after a probe error
|
||||||
|
+ platform_set_drvdata(pdev, NULL);
|
||||||
|
+
|
||||||
|
+ if (info->cmtd) {
|
||||||
|
+ mtd_device_unregister(info->cmtd);
|
||||||
|
+ mtd_concat_destroy(info->cmtd);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (info->devices) {
|
||||||
|
+ for (i = 0; i < info->num_devices; i++)
|
||||||
|
+ put_mtd_device(info->devices[i]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int virt_concat_probe(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct device_node *node = pdev->dev.of_node;
|
||||||
|
+ struct of_phandle_iterator it;
|
||||||
|
+ struct of_virt_concat *info;
|
||||||
|
+ struct mtd_info *mtd;
|
||||||
|
+ int err = 0, count;
|
||||||
|
+
|
||||||
|
+ count = of_count_phandle_with_args(node, "devices", NULL);
|
||||||
|
+ if (count <= 0)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
|
||||||
|
+ if (!info)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ info->devices = devm_kcalloc(&pdev->dev, count,
|
||||||
|
+ sizeof(*(info->devices)), GFP_KERNEL);
|
||||||
|
+ if (!info->devices) {
|
||||||
|
+ err = -ENOMEM;
|
||||||
|
+ goto err_remove;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ platform_set_drvdata(pdev, info);
|
||||||
|
+
|
||||||
|
+ of_for_each_phandle(&it, err, node, "devices", NULL, 0) {
|
||||||
|
+ mtd = of_get_mtd_device_by_node(it.node);
|
||||||
|
+ if (IS_ERR(mtd)) {
|
||||||
|
+ of_node_put(it.node);
|
||||||
|
+ err = -EPROBE_DEFER;
|
||||||
|
+ goto err_remove;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ info->devices[info->num_devices++] = mtd;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ info->cmtd = mtd_concat_create(info->devices, info->num_devices,
|
||||||
|
+ dev_name(&pdev->dev));
|
||||||
|
+ if (!info->cmtd) {
|
||||||
|
+ err = -ENXIO;
|
||||||
|
+ goto err_remove;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ info->cmtd->dev.parent = &pdev->dev;
|
||||||
|
+ mtd_set_of_node(info->cmtd, node);
|
||||||
|
+ mtd_device_register(info->cmtd, NULL, 0);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+err_remove:
|
||||||
|
+ virt_concat_remove(pdev);
|
||||||
|
+
|
||||||
|
+ return err;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct of_device_id virt_concat_of_match[] = {
|
||||||
|
+ { .compatible = "mtd-concat", },
|
||||||
|
+ { /* sentinel */ }
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(of, virt_concat_of_match);
|
||||||
|
+
|
||||||
|
+static struct platform_driver virt_concat_driver = {
|
||||||
|
+ .probe = virt_concat_probe,
|
||||||
|
+ .remove = virt_concat_remove,
|
||||||
|
+ .driver = {
|
||||||
|
+ .name = "virt-mtdconcat",
|
||||||
|
+ .of_match_table = virt_concat_of_match,
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+module_platform_driver(virt_concat_driver);
|
||||||
|
+
|
||||||
|
+MODULE_LICENSE("GPL v2");
|
||||||
|
+MODULE_AUTHOR("Bernhard Frauendienst <kernel@nospam.obeliks.de>");
|
||||||
|
+MODULE_DESCRIPTION("Virtual concat MTD device driver");
|
|
@ -0,0 +1,65 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: fs: jffs2: EOF marker
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
fs/jffs2/build.c | 10 ++++++++++
|
||||||
|
fs/jffs2/scan.c | 21 +++++++++++++++++++--
|
||||||
|
2 files changed, 29 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/fs/jffs2/build.c
|
||||||
|
+++ b/fs/jffs2/build.c
|
||||||
|
@@ -117,6 +117,16 @@ static int jffs2_build_filesystem(struct
|
||||||
|
dbg_fsbuild("scanned flash completely\n");
|
||||||
|
jffs2_dbg_dump_block_lists_nolock(c);
|
||||||
|
|
||||||
|
+ if (c->flags & (1 << 7)) {
|
||||||
|
+ printk("%s(): unlocking the mtd device... ", __func__);
|
||||||
|
+ mtd_unlock(c->mtd, 0, c->mtd->size);
|
||||||
|
+ printk("done.\n");
|
||||||
|
+
|
||||||
|
+ printk("%s(): erasing all blocks after the end marker... ", __func__);
|
||||||
|
+ jffs2_erase_pending_blocks(c, -1);
|
||||||
|
+ printk("done.\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
dbg_fsbuild("pass 1 starting\n");
|
||||||
|
c->flags |= JFFS2_SB_FLAG_BUILDING;
|
||||||
|
/* Now scan the directory tree, increasing nlink according to every dirent found. */
|
||||||
|
--- a/fs/jffs2/scan.c
|
||||||
|
+++ b/fs/jffs2/scan.c
|
||||||
|
@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in
|
||||||
|
/* reset summary info for next eraseblock scan */
|
||||||
|
jffs2_sum_reset_collected(s);
|
||||||
|
|
||||||
|
- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
|
||||||
|
- buf_size, s);
|
||||||
|
+ if (c->flags & (1 << 7)) {
|
||||||
|
+ if (mtd_block_isbad(c->mtd, jeb->offset))
|
||||||
|
+ ret = BLK_STATE_BADBLOCK;
|
||||||
|
+ else
|
||||||
|
+ ret = BLK_STATE_ALLFF;
|
||||||
|
+ } else
|
||||||
|
+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
|
||||||
|
+ buf_size, s);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
goto out;
|
||||||
|
@@ -567,6 +573,17 @@ full_scan:
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if ((buf[0] == 0xde) &&
|
||||||
|
+ (buf[1] == 0xad) &&
|
||||||
|
+ (buf[2] == 0xc0) &&
|
||||||
|
+ (buf[3] == 0xde)) {
|
||||||
|
+ /* end of filesystem. erase everything after this point */
|
||||||
|
+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
|
||||||
|
+ c->flags |= (1 << 7);
|
||||||
|
+
|
||||||
|
+ return BLK_STATE_ALLFF;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
|
||||||
|
ofs = 0;
|
||||||
|
max_ofs = EMPTY_SCAN_SIZE(c->sector_size);
|
|
@ -0,0 +1,90 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: netfilter: add support for flushing conntrack via /proc
|
||||||
|
|
||||||
|
lede-commit 8193bbe59a74d34d6a26d4a8cb857b1952905314
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
net/netfilter/nf_conntrack_standalone.c | 59 ++++++++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 58 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/net/netfilter/nf_conntrack_standalone.c
|
||||||
|
+++ b/net/netfilter/nf_conntrack_standalone.c
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
#include <linux/percpu.h>
|
||||||
|
#include <linux/netdevice.h>
|
||||||
|
#include <linux/security.h>
|
||||||
|
+#include <linux/inet.h>
|
||||||
|
#include <net/net_namespace.h>
|
||||||
|
#ifdef CONFIG_SYSCTL
|
||||||
|
#include <linux/sysctl.h>
|
||||||
|
@@ -465,6 +466,58 @@ static int ct_cpu_seq_show(struct seq_fi
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+struct kill_request {
|
||||||
|
+ u16 family;
|
||||||
|
+ union nf_inet_addr addr;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int kill_matching(struct nf_conn *i, void *data)
|
||||||
|
+{
|
||||||
|
+ struct kill_request *kr = data;
|
||||||
|
+ struct nf_conntrack_tuple *t1 = &i->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
|
||||||
|
+ struct nf_conntrack_tuple *t2 = &i->tuplehash[IP_CT_DIR_REPLY].tuple;
|
||||||
|
+
|
||||||
|
+ if (!kr->family)
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
|
+ if (t1->src.l3num != kr->family)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ return (nf_inet_addr_cmp(&kr->addr, &t1->src.u3) ||
|
||||||
|
+ nf_inet_addr_cmp(&kr->addr, &t1->dst.u3) ||
|
||||||
|
+ nf_inet_addr_cmp(&kr->addr, &t2->src.u3) ||
|
||||||
|
+ nf_inet_addr_cmp(&kr->addr, &t2->dst.u3));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int ct_file_write(struct file *file, char *buf, size_t count)
|
||||||
|
+{
|
||||||
|
+ struct seq_file *seq = file->private_data;
|
||||||
|
+ struct nf_ct_iter_data iter_data;
|
||||||
|
+ struct kill_request kr = { };
|
||||||
|
+
|
||||||
|
+ if (count == 0)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (count >= INET6_ADDRSTRLEN)
|
||||||
|
+ count = INET6_ADDRSTRLEN - 1;
|
||||||
|
+
|
||||||
|
+ if (strnchr(buf, count, ':')) {
|
||||||
|
+ kr.family = AF_INET6;
|
||||||
|
+ if (!in6_pton(buf, count, (void *)&kr.addr, '\n', NULL))
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ } else if (strnchr(buf, count, '.')) {
|
||||||
|
+ kr.family = AF_INET;
|
||||||
|
+ if (!in4_pton(buf, count, (void *)&kr.addr, '\n', NULL))
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ iter_data.net = seq_file_net(seq);
|
||||||
|
+ iter_data.data = &kr;
|
||||||
|
+ nf_ct_iterate_cleanup_net(kill_matching, &iter_data);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static const struct seq_operations ct_cpu_seq_ops = {
|
||||||
|
.start = ct_cpu_seq_start,
|
||||||
|
.next = ct_cpu_seq_next,
|
||||||
|
@@ -478,8 +531,9 @@ static int nf_conntrack_standalone_init_
|
||||||
|
kuid_t root_uid;
|
||||||
|
kgid_t root_gid;
|
||||||
|
|
||||||
|
- pde = proc_create_net("nf_conntrack", 0440, net->proc_net, &ct_seq_ops,
|
||||||
|
- sizeof(struct ct_iter_state));
|
||||||
|
+ pde = proc_create_net_data_write("nf_conntrack", 0440, net->proc_net,
|
||||||
|
+ &ct_seq_ops, &ct_file_write,
|
||||||
|
+ sizeof(struct ct_iter_state), NULL);
|
||||||
|
if (!pde)
|
||||||
|
goto out_nf_conntrack;
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: kernel: add a new version of my netfilter speedup patches for linux 2.6.39 and 3.0
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
include/uapi/linux/netfilter_ipv4/ip_tables.h | 1 +
|
||||||
|
net/ipv4/netfilter/ip_tables.c | 37 +++++++++++++++++++++++++++
|
||||||
|
2 files changed, 38 insertions(+)
|
||||||
|
|
||||||
|
--- a/include/uapi/linux/netfilter_ipv4/ip_tables.h
|
||||||
|
+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h
|
||||||
|
@@ -89,6 +89,7 @@ struct ipt_ip {
|
||||||
|
#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
|
||||||
|
#define IPT_F_GOTO 0x02 /* Set if jump is a goto */
|
||||||
|
#define IPT_F_MASK 0x03 /* All possible flag bits mask. */
|
||||||
|
+#define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */
|
||||||
|
|
||||||
|
/* Values for "inv" field in struct ipt_ip. */
|
||||||
|
#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
|
||||||
|
--- a/net/ipv4/netfilter/ip_tables.c
|
||||||
|
+++ b/net/ipv4/netfilter/ip_tables.c
|
||||||
|
@@ -50,6 +50,9 @@ ip_packet_match(const struct iphdr *ip,
|
||||||
|
{
|
||||||
|
unsigned long ret;
|
||||||
|
|
||||||
|
+ if (ipinfo->flags & IPT_F_NO_DEF_MATCH)
|
||||||
|
+ return true;
|
||||||
|
+
|
||||||
|
if (NF_INVF(ipinfo, IPT_INV_SRCIP,
|
||||||
|
(ip->saddr & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) ||
|
||||||
|
NF_INVF(ipinfo, IPT_INV_DSTIP,
|
||||||
|
@@ -80,6 +83,29 @@ ip_packet_match(const struct iphdr *ip,
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+ip_checkdefault(struct ipt_ip *ip)
|
||||||
|
+{
|
||||||
|
+ static const char iface_mask[IFNAMSIZ] = {};
|
||||||
|
+
|
||||||
|
+ if (ip->invflags || ip->flags & IPT_F_FRAG)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (memcmp(ip->iniface_mask, iface_mask, IFNAMSIZ) != 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (memcmp(ip->outiface_mask, iface_mask, IFNAMSIZ) != 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (ip->smsk.s_addr || ip->dmsk.s_addr)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (ip->proto)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ ip->flags |= IPT_F_NO_DEF_MATCH;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static bool
|
||||||
|
ip_checkentry(const struct ipt_ip *ip)
|
||||||
|
{
|
||||||
|
@@ -525,6 +551,8 @@ find_check_entry(struct ipt_entry *e, st
|
||||||
|
struct xt_mtchk_param mtpar;
|
||||||
|
struct xt_entry_match *ematch;
|
||||||
|
|
||||||
|
+ ip_checkdefault(&e->ip);
|
||||||
|
+
|
||||||
|
if (!xt_percpu_counter_alloc(alloc_state, &e->counters))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@@ -819,6 +847,7 @@ copy_entries_to_user(unsigned int total_
|
||||||
|
const struct xt_table_info *private = table->private;
|
||||||
|
int ret = 0;
|
||||||
|
const void *loc_cpu_entry;
|
||||||
|
+ u8 flags;
|
||||||
|
|
||||||
|
counters = alloc_counters(table);
|
||||||
|
if (IS_ERR(counters))
|
||||||
|
@@ -846,6 +875,14 @@ copy_entries_to_user(unsigned int total_
|
||||||
|
goto free_counters;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ flags = e->ip.flags & IPT_F_MASK;
|
||||||
|
+ if (copy_to_user(userptr + off
|
||||||
|
+ + offsetof(struct ipt_entry, ip.flags),
|
||||||
|
+ &flags, sizeof(flags)) != 0) {
|
||||||
|
+ ret = -EFAULT;
|
||||||
|
+ goto free_counters;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
for (i = sizeof(struct ipt_entry);
|
||||||
|
i < e->target_offset;
|
||||||
|
i += m->u.match_size) {
|
||||||
|
@@ -1223,12 +1260,15 @@ compat_copy_entry_to_user(struct ipt_ent
|
||||||
|
compat_uint_t origsize;
|
||||||
|
const struct xt_entry_match *ematch;
|
||||||
|
int ret = 0;
|
||||||
|
+ u8 flags = e->ip.flags & IPT_F_MASK;
|
||||||
|
|
||||||
|
origsize = *size;
|
||||||
|
ce = *dstptr;
|
||||||
|
if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 ||
|
||||||
|
copy_to_user(&ce->counters, &counters[i],
|
||||||
|
- sizeof(counters[i])) != 0)
|
||||||
|
+ sizeof(counters[i])) != 0 ||
|
||||||
|
+ copy_to_user(&ce->ip.flags, &flags,
|
||||||
|
+ sizeof(flags)) != 0)
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
*dstptr += sizeof(struct compat_ipt_entry);
|
|
@ -0,0 +1,106 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: netfilter: match bypass default table
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
net/ipv4/netfilter/ip_tables.c | 79 +++++++++++++++++++++++++++++++-----------
|
||||||
|
1 file changed, 58 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
--- a/net/ipv4/netfilter/ip_tables.c
|
||||||
|
+++ b/net/ipv4/netfilter/ip_tables.c
|
||||||
|
@@ -246,6 +246,33 @@ struct ipt_entry *ipt_next_entry(const s
|
||||||
|
return (void *)entry + entry->next_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool
|
||||||
|
+ipt_handle_default_rule(struct ipt_entry *e, unsigned int *verdict)
|
||||||
|
+{
|
||||||
|
+ struct xt_entry_target *t;
|
||||||
|
+ struct xt_standard_target *st;
|
||||||
|
+
|
||||||
|
+ if (e->target_offset != sizeof(struct ipt_entry))
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ if (!(e->ip.flags & IPT_F_NO_DEF_MATCH))
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ t = ipt_get_target(e);
|
||||||
|
+ if (t->u.kernel.target->target)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ st = (struct xt_standard_target *) t;
|
||||||
|
+ if (st->verdict == XT_RETURN)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ if (st->verdict >= 0)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ *verdict = (unsigned)(-st->verdict) - 1;
|
||||||
|
+ return true;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Returns one of the generic firewall policies, like NF_ACCEPT. */
|
||||||
|
unsigned int
|
||||||
|
ipt_do_table(void *priv,
|
||||||
|
@@ -267,27 +294,28 @@ ipt_do_table(void *priv,
|
||||||
|
unsigned int addend;
|
||||||
|
|
||||||
|
/* Initialization */
|
||||||
|
+ WARN_ON(!(table->valid_hooks & (1 << hook)));
|
||||||
|
+ local_bh_disable();
|
||||||
|
+ private = READ_ONCE(table->private); /* Address dependency. */
|
||||||
|
+ cpu = smp_processor_id();
|
||||||
|
+ table_base = private->entries;
|
||||||
|
+
|
||||||
|
+ e = get_entry(table_base, private->hook_entry[hook]);
|
||||||
|
+ if (ipt_handle_default_rule(e, &verdict)) {
|
||||||
|
+ struct xt_counters *counter;
|
||||||
|
+
|
||||||
|
+ counter = xt_get_this_cpu_counter(&e->counters);
|
||||||
|
+ ADD_COUNTER(*counter, skb->len, 1);
|
||||||
|
+ local_bh_enable();
|
||||||
|
+ return verdict;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
stackidx = 0;
|
||||||
|
ip = ip_hdr(skb);
|
||||||
|
indev = state->in ? state->in->name : nulldevname;
|
||||||
|
outdev = state->out ? state->out->name : nulldevname;
|
||||||
|
- /* We handle fragments by dealing with the first fragment as
|
||||||
|
- * if it was a normal packet. All other fragments are treated
|
||||||
|
- * normally, except that they will NEVER match rules that ask
|
||||||
|
- * things we don't know, ie. tcp syn flag or ports). If the
|
||||||
|
- * rule is also a fragment-specific rule, non-fragments won't
|
||||||
|
- * match it. */
|
||||||
|
- acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET;
|
||||||
|
- acpar.thoff = ip_hdrlen(skb);
|
||||||
|
- acpar.hotdrop = false;
|
||||||
|
- acpar.state = state;
|
||||||
|
|
||||||
|
- WARN_ON(!(table->valid_hooks & (1 << hook)));
|
||||||
|
- local_bh_disable();
|
||||||
|
addend = xt_write_recseq_begin();
|
||||||
|
- private = READ_ONCE(table->private); /* Address dependency. */
|
||||||
|
- cpu = smp_processor_id();
|
||||||
|
- table_base = private->entries;
|
||||||
|
jumpstack = (struct ipt_entry **)private->jumpstack[cpu];
|
||||||
|
|
||||||
|
/* Switch to alternate jumpstack if we're being invoked via TEE.
|
||||||
|
@@ -300,7 +328,16 @@ ipt_do_table(void *priv,
|
||||||
|
if (static_key_false(&xt_tee_enabled))
|
||||||
|
jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated);
|
||||||
|
|
||||||
|
- e = get_entry(table_base, private->hook_entry[hook]);
|
||||||
|
+ /* We handle fragments by dealing with the first fragment as
|
||||||
|
+ * if it was a normal packet. All other fragments are treated
|
||||||
|
+ * normally, except that they will NEVER match rules that ask
|
||||||
|
+ * things we don't know, ie. tcp syn flag or ports). If the
|
||||||
|
+ * rule is also a fragment-specific rule, non-fragments won't
|
||||||
|
+ * match it. */
|
||||||
|
+ acpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET;
|
||||||
|
+ acpar.thoff = ip_hdrlen(skb);
|
||||||
|
+ acpar.hotdrop = false;
|
||||||
|
+ acpar.state = state;
|
||||||
|
|
||||||
|
do {
|
||||||
|
const struct xt_entry_target *t;
|
|
@ -0,0 +1,22 @@
|
||||||
|
From: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Subject: netfilter: reduce match memory access
|
||||||
|
|
||||||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
---
|
||||||
|
net/ipv4/netfilter/ip_tables.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/net/ipv4/netfilter/ip_tables.c
|
||||||
|
+++ b/net/ipv4/netfilter/ip_tables.c
|
||||||
|
@@ -53,9 +53,9 @@ ip_packet_match(const struct iphdr *ip,
|
||||||
|
if (ipinfo->flags & IPT_F_NO_DEF_MATCH)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
- if (NF_INVF(ipinfo, IPT_INV_SRCIP,
|
||||||
|
+ if (NF_INVF(ipinfo, IPT_INV_SRCIP, ipinfo->smsk.s_addr &&
|
||||||
|
(ip->saddr & ipinfo->smsk.s_addr) != ipinfo->src.s_addr) ||
|
||||||
|
- NF_INVF(ipinfo, IPT_INV_DSTIP,
|
||||||
|
+ NF_INVF(ipinfo, IPT_INV_DSTIP, ipinfo->dmsk.s_addr &&
|
||||||
|
(ip->daddr & ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr))
|
||||||
|
return false;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue