mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
files: sync from openwrt v19.07 (#2690)
This commit is contained in:
parent
9b593a88b0
commit
2289184a62
@ -105,6 +105,13 @@ menuconfig DEVEL
|
|||||||
help
|
help
|
||||||
If enabled, log files will be written to the ./log directory.
|
If enabled, log files will be written to the ./log directory.
|
||||||
|
|
||||||
|
config BUILD_LOG_DIR
|
||||||
|
string "Log folder" if DEVEL
|
||||||
|
default ""
|
||||||
|
help
|
||||||
|
Store build logs in this directory.
|
||||||
|
If not set, uses './logs'
|
||||||
|
|
||||||
config SRC_TREE_OVERRIDE
|
config SRC_TREE_OVERRIDE
|
||||||
bool "Enable package source tree override" if DEVEL
|
bool "Enable package source tree override" if DEVEL
|
||||||
help
|
help
|
||||||
|
@ -14,11 +14,12 @@ menu "Target Images"
|
|||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Compression"
|
prompt "Compression"
|
||||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ar71xx
|
|
||||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
|
||||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx
|
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx
|
||||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ar71xx
|
||||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
|
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
|
||||||
|
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq
|
||||||
|
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
||||||
|
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
||||||
default TARGET_INITRAMFS_COMPRESSION_NONE
|
default TARGET_INITRAMFS_COMPRESSION_NONE
|
||||||
depends on TARGET_ROOTFS_INITRAMFS
|
depends on TARGET_ROOTFS_INITRAMFS
|
||||||
help
|
help
|
||||||
@ -194,7 +195,7 @@ menu "Target Images"
|
|||||||
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
|
||||||
select PACKAGE_grub2
|
select PACKAGE_grub2
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config EFI_IMAGES
|
config EFI_IMAGES
|
||||||
bool "Build EFI GRUB images (Linux x86 or x86_64 host only)"
|
bool "Build EFI GRUB images (Linux x86 or x86_64 host only)"
|
||||||
depends on TARGET_x86
|
depends on TARGET_x86
|
||||||
@ -254,6 +255,7 @@ menu "Target Images"
|
|||||||
select GRUB_IMAGES
|
select GRUB_IMAGES
|
||||||
select TARGET_IMAGES_PAD
|
select TARGET_IMAGES_PAD
|
||||||
select PACKAGE_kmod-e1000
|
select PACKAGE_kmod-e1000
|
||||||
|
default n
|
||||||
|
|
||||||
config VMDK_IMAGES
|
config VMDK_IMAGES
|
||||||
bool "Build VMware image files (VMDK)"
|
bool "Build VMware image files (VMDK)"
|
||||||
@ -262,22 +264,22 @@ menu "Target Images"
|
|||||||
select TARGET_IMAGES_PAD
|
select TARGET_IMAGES_PAD
|
||||||
select PACKAGE_kmod-e1000
|
select PACKAGE_kmod-e1000
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config VHD_IMAGES
|
config VHD_IMAGES
|
||||||
bool "Build Hyper-V image files (VHD)"
|
bool "Build Hyper-V image files (VHD)"
|
||||||
depends on TARGET_x86 || TARGET_x86_64
|
depends on TARGET_x86 || TARGET_x86_64
|
||||||
default n
|
|
||||||
depends on GRUB_IMAGES || EFI_IMAGES
|
depends on GRUB_IMAGES || EFI_IMAGES
|
||||||
select TARGET_IMAGES_PAD
|
select TARGET_IMAGES_PAD
|
||||||
select PACKAGE_kmod-tulip
|
select PACKAGE_kmod-tulip
|
||||||
|
default n
|
||||||
|
|
||||||
config QCOW2_IMAGES
|
config QCOW2_IMAGES
|
||||||
bool "Build PVE/KVM image files (QCOW2)"
|
bool "Build PVE/KVM image files (QCOW2)"
|
||||||
depends on TARGET_x86 || TARGET_x86_64
|
depends on TARGET_x86 || TARGET_x86_64
|
||||||
default n
|
|
||||||
depends on GRUB_IMAGES || EFI_IMAGES
|
depends on GRUB_IMAGES || EFI_IMAGES
|
||||||
select TARGET_IMAGES_PAD
|
select TARGET_IMAGES_PAD
|
||||||
select PACKAGE_kmod-e1000
|
select PACKAGE_kmod-e1000
|
||||||
|
default n
|
||||||
|
|
||||||
config TARGET_IMAGES_PAD
|
config TARGET_IMAGES_PAD
|
||||||
bool "Pad images to filesystem size (for JFFS2)"
|
bool "Pad images to filesystem size (for JFFS2)"
|
||||||
@ -286,7 +288,7 @@ menu "Target Images"
|
|||||||
|
|
||||||
config TARGET_IMAGES_GZIP
|
config TARGET_IMAGES_GZIP
|
||||||
bool "GZip images"
|
bool "GZip images"
|
||||||
depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS || TARGET_x86
|
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta
|
||||||
default n
|
default n
|
||||||
|
|
||||||
comment "Image Options"
|
comment "Image Options"
|
||||||
|
@ -46,7 +46,7 @@ config KERNEL_DEBUG_FS
|
|||||||
|
|
||||||
config KERNEL_MIPS_FPU_EMULATOR
|
config KERNEL_MIPS_FPU_EMULATOR
|
||||||
bool "Compile the kernel with MIPS FPU Emulator"
|
bool "Compile the kernel with MIPS FPU Emulator"
|
||||||
default y
|
default y if TARGET_pistachio
|
||||||
depends on (mips || mipsel || mips64 || mips64el)
|
depends on (mips || mipsel || mips64 || mips64el)
|
||||||
|
|
||||||
config KERNEL_ARM_PMU
|
config KERNEL_ARM_PMU
|
||||||
@ -596,7 +596,7 @@ endif
|
|||||||
|
|
||||||
config KERNEL_NAMESPACES
|
config KERNEL_NAMESPACES
|
||||||
bool "Enable kernel namespaces"
|
bool "Enable kernel namespaces"
|
||||||
default n
|
default y if !SMALL_FLASH
|
||||||
|
|
||||||
if KERNEL_NAMESPACES
|
if KERNEL_NAMESPACES
|
||||||
|
|
||||||
@ -665,13 +665,13 @@ config KERNEL_POSIX_MQUEUE
|
|||||||
|
|
||||||
config KERNEL_SECCOMP_FILTER
|
config KERNEL_SECCOMP_FILTER
|
||||||
bool
|
bool
|
||||||
default n
|
default y if !SMALL_FLASH
|
||||||
|
|
||||||
config KERNEL_SECCOMP
|
config KERNEL_SECCOMP
|
||||||
bool "Enable seccomp support"
|
bool "Enable seccomp support"
|
||||||
depends on !(TARGET_uml)
|
depends on !(TARGET_uml)
|
||||||
select KERNEL_SECCOMP_FILTER
|
select KERNEL_SECCOMP_FILTER
|
||||||
default n
|
default y if !SMALL_FLASH
|
||||||
help
|
help
|
||||||
Build kernel with support for seccomp.
|
Build kernel with support for seccomp.
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ define Host/Configure/Default
|
|||||||
-DCMAKE_INSTALL_PREFIX=$(HOST_BUILD_PREFIX) \
|
-DCMAKE_INSTALL_PREFIX=$(HOST_BUILD_PREFIX) \
|
||||||
-DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \
|
-DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \
|
||||||
-DCMAKE_SKIP_RPATH=TRUE \
|
-DCMAKE_SKIP_RPATH=TRUE \
|
||||||
|
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||||
$(CMAKE_HOST_OPTIONS) \
|
$(CMAKE_HOST_OPTIONS) \
|
||||||
$(HOST_CMAKE_SOURCE_DIR) \
|
$(HOST_CMAKE_SOURCE_DIR) \
|
||||||
)
|
)
|
||||||
|
@ -48,4 +48,3 @@ debug_eval:=
|
|||||||
warn_eval = $(4)
|
warn_eval = $(4)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -288,6 +288,7 @@ endef
|
|||||||
define Download/default
|
define Download/default
|
||||||
FILE:=$(PKG_SOURCE)
|
FILE:=$(PKG_SOURCE)
|
||||||
URL:=$(PKG_SOURCE_URL)
|
URL:=$(PKG_SOURCE_URL)
|
||||||
|
URL_FILE:=$(PKG_SOURCE_URL_FILE)
|
||||||
SUBDIR:=$(PKG_SOURCE_SUBDIR)
|
SUBDIR:=$(PKG_SOURCE_SUBDIR)
|
||||||
PROTO:=$(PKG_SOURCE_PROTO)
|
PROTO:=$(PKG_SOURCE_PROTO)
|
||||||
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
|
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
|
||||||
|
@ -61,4 +61,3 @@ ifdef CONFIG_PKG_RELRO_FULL
|
|||||||
TARGET_LDFLAGS += -znow -zrelro
|
TARGET_LDFLAGS += -znow -zrelro
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
IMAGE_KERNEL = $(word 1,$^)
|
IMAGE_KERNEL = $(word 1,$^)
|
||||||
IMAGE_ROOTFS = $(word 2,$^)
|
IMAGE_ROOTFS = $(word 2,$^)
|
||||||
|
|
||||||
|
define rootfs_align
|
||||||
|
$(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/uImage
|
define Build/uImage
|
||||||
mkimage -A $(LINUX_KARCH) \
|
mkimage -A $(LINUX_KARCH) \
|
||||||
-O linux -T kernel \
|
-O linux -T kernel \
|
||||||
@ -271,6 +275,13 @@ define Build/check-size
|
|||||||
}
|
}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Build/check-kernel-size
|
||||||
|
@[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $(IMAGE_KERNEL))" ] || { \
|
||||||
|
echo "WARNING: Kernel for $@ is too big > $(1)" >&2; \
|
||||||
|
rm -f $@; \
|
||||||
|
}
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/combined-image
|
define Build/combined-image
|
||||||
-sh $(TOPDIR)/scripts/combined-image.sh \
|
-sh $(TOPDIR)/scripts/combined-image.sh \
|
||||||
"$(IMAGE_KERNEL)" \
|
"$(IMAGE_KERNEL)" \
|
||||||
@ -308,7 +319,7 @@ endef
|
|||||||
|
|
||||||
define Build/qsdk-ipq-factory-nor
|
define Build/qsdk-ipq-factory-nor
|
||||||
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
|
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
|
||||||
$@.its hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
|
$@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
|
||||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
|
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
|
||||||
@mv $@.new $@
|
@mv $@.new $@
|
||||||
endef
|
endef
|
||||||
@ -335,6 +346,24 @@ define Build/tplink-v1-header
|
|||||||
@mv $@.new $@
|
@mv $@.new $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# combine kernel and rootfs into one image
|
||||||
|
# mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
|
||||||
|
# <type> is "sysupgrade" or "factory"
|
||||||
|
#
|
||||||
|
# -a align the rootfs start on an <align> bytes boundary
|
||||||
|
# -j add jffs2 end-of-filesystem markers
|
||||||
|
# -s strip padding from end of the image
|
||||||
|
# -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
|
||||||
|
define Build/tplink-v1-image
|
||||||
|
-$(STAGING_DIR_HOST)/bin/mktplinkfw \
|
||||||
|
-H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) \
|
||||||
|
-N "$(VERSION_DIST)" -V $(REVISION) -m $(TPLINK_HEADER_VERSION) \
|
||||||
|
-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new -j -X 0x40000 \
|
||||||
|
-a $(call rootfs_align,$(FILESYSTEM)) \
|
||||||
|
$(wordlist 2,$(words $(1)),$(1)) \
|
||||||
|
$(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/tplink-v2-header
|
define Build/tplink-v2-header
|
||||||
$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
|
$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
|
||||||
-c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
|
-c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
|
||||||
|
@ -420,6 +420,7 @@ define Device/Init
|
|||||||
DEVICE_DTS :=
|
DEVICE_DTS :=
|
||||||
DEVICE_DTS_CONFIG :=
|
DEVICE_DTS_CONFIG :=
|
||||||
DEVICE_DTS_DIR :=
|
DEVICE_DTS_DIR :=
|
||||||
|
SOC :=
|
||||||
|
|
||||||
BOARD_NAME :=
|
BOARD_NAME :=
|
||||||
UIMAGE_NAME :=
|
UIMAGE_NAME :=
|
||||||
@ -437,7 +438,7 @@ DEFAULT_DEVICE_VARS := \
|
|||||||
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
|
DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \
|
||||||
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
|
CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \
|
||||||
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
|
VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \
|
||||||
DEVICE_DTS_CONFIG DEVICE_DTS_DIR BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \
|
DEVICE_DTS_CONFIG DEVICE_DTS_DIR SOC BOARD_NAME UIMAGE_NAME SUPPORTED_DEVICES \
|
||||||
IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH DEVICE_VENDOR \
|
IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH DEVICE_VENDOR \
|
||||||
DEVICE_MODEL DEVICE_VARIANT \
|
DEVICE_MODEL DEVICE_VARIANT \
|
||||||
DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
|
DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \
|
||||||
|
@ -160,5 +160,3 @@ define Kernel/Clean/Default
|
|||||||
rm -f $(LINUX_KERNEL)
|
rm -f $(LINUX_KERNEL)
|
||||||
$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ endif
|
|||||||
KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
|
KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
|
||||||
|
|
||||||
KERNEL_MAKE_FLAGS = \
|
KERNEL_MAKE_FLAGS = \
|
||||||
|
KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \
|
||||||
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
|
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
|
||||||
CROSS_COMPILE="$(KERNEL_CROSS)" \
|
CROSS_COMPILE="$(KERNEL_CROSS)" \
|
||||||
ARCH="$(LINUX_KARCH)" \
|
ARCH="$(LINUX_KARCH)" \
|
||||||
@ -113,6 +114,7 @@ KERNEL_MAKE_FLAGS = \
|
|||||||
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
|
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
|
||||||
KBUILD_BUILD_VERSION="0" \
|
KBUILD_BUILD_VERSION="0" \
|
||||||
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
|
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
|
||||||
|
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
|
||||||
CONFIG_SHELL="$(BASH)" \
|
CONFIG_SHELL="$(BASH)" \
|
||||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
|
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
|
||||||
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
|
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
|
||||||
@ -129,6 +131,11 @@ ifdef CONFIG_USE_SPARSE
|
|||||||
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
|
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(HOST_OS),Linux)
|
||||||
|
KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION=
|
||||||
|
export SKIP_STACK_VALIDATION:=1
|
||||||
|
endif
|
||||||
|
|
||||||
PKG_EXTMOD_SUBDIRS ?= .
|
PKG_EXTMOD_SUBDIRS ?= .
|
||||||
|
|
||||||
define populate_module_symvers
|
define populate_module_symvers
|
||||||
@ -294,4 +301,3 @@ kernel_patchver_ge=$(call kernel_version_cmp,-ge,$(KERNEL_PATCHVER),$(1))
|
|||||||
kernel_patchver_eq=$(call kernel_version_cmp,-eq,$(KERNEL_PATCHVER),$(1))
|
kernel_patchver_eq=$(call kernel_version_cmp,-eq,$(KERNEL_PATCHVER),$(1))
|
||||||
kernel_patchver_le=$(call kernel_version_cmp,-le,$(KERNEL_PATCHVER),$(1))
|
kernel_patchver_le=$(call kernel_version_cmp,-le,$(KERNEL_PATCHVER),$(1))
|
||||||
kernel_patchver_lt=$(call kernel_version_cmp,-lt,$(KERNEL_PATCHVER),$(1))
|
kernel_patchver_lt=$(call kernel_version_cmp,-lt,$(KERNEL_PATCHVER),$(1))
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ HOST_BUILD_PREFIX:=$(TOOLCHAIN_DIR)
|
|||||||
BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
|
BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/host-build.mk
|
include $(INCLUDE_DIR)/host-build.mk
|
||||||
|
include $(INCLUDE_DIR)/hardening.mk
|
||||||
|
|
||||||
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared
|
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ PKG_NAME ?= u-boot
|
|||||||
ifndef PKG_SOURCE_PROTO
|
ifndef PKG_SOURCE_PROTO
|
||||||
PKG_SOURCE = $(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE = $(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL = \
|
PKG_SOURCE_URL = \
|
||||||
http://sources.lede-project.org \
|
https://sources.openwrt.org \
|
||||||
ftp://ftp.denx.de/pub/u-boot
|
ftp://ftp.denx.de/pub/u-boot
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -42,16 +42,16 @@ VERSION_MANUFACTURER:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER))
|
|||||||
VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
|
VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
|
||||||
|
|
||||||
VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
|
VERSION_MANUFACTURER_URL:=$(call qstrip,$(CONFIG_VERSION_MANUFACTURER_URL))
|
||||||
VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://openwrt.org/)
|
VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),https://openwrt.org/)
|
||||||
|
|
||||||
VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
|
VERSION_BUG_URL:=$(call qstrip,$(CONFIG_VERSION_BUG_URL))
|
||||||
VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.openwrt.org/)
|
VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),https://bugs.openwrt.org/)
|
||||||
|
|
||||||
VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
|
VERSION_HOME_URL:=$(call qstrip,$(CONFIG_VERSION_HOME_URL))
|
||||||
VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),http://openwrt.org/)
|
VERSION_HOME_URL:=$(if $(VERSION_HOME_URL),$(VERSION_HOME_URL),https://openwrt.org/)
|
||||||
|
|
||||||
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
|
VERSION_SUPPORT_URL:=$(call qstrip,$(CONFIG_VERSION_SUPPORT_URL))
|
||||||
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/)
|
VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),https://forum.openwrt.org/)
|
||||||
|
|
||||||
VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
|
VERSION_PRODUCT:=$(call qstrip,$(CONFIG_VERSION_PRODUCT))
|
||||||
VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
|
VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
|
||||||
@ -108,4 +108,3 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
|
|||||||
-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
|
-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
|
||||||
-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
|
-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
|
||||||
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'
|
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'
|
||||||
|
|
||||||
|
@ -85,12 +85,16 @@ generate_network() {
|
|||||||
set network.$1.proto='none'
|
set network.$1.proto='none'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[ -n "$macaddr" ] && uci -q batch <<-EOF
|
if [ -n "$macaddr" ]; then
|
||||||
delete network.$1_dev
|
for name in $ifname; do
|
||||||
set network.$1_dev='device'
|
uci -q batch <<-EOF
|
||||||
set network.$1_dev.name='$ifname'
|
delete network.$1_${name/./_}_dev
|
||||||
set network.$1_dev.macaddr='$macaddr'
|
set network.$1_${name/./_}_dev='device'
|
||||||
EOF
|
set network.$1_${name/./_}_dev.name='$name'
|
||||||
|
set network.$1_${name/./_}_dev.macaddr='$macaddr'
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
case "$protocol" in
|
case "$protocol" in
|
||||||
static)
|
static)
|
||||||
@ -213,7 +217,8 @@ generate_switch() {
|
|||||||
|
|
||||||
json_select switch
|
json_select switch
|
||||||
json_select "$key"
|
json_select "$key"
|
||||||
json_get_vars enable reset blinkrate cpu_port
|
json_get_vars enable reset blinkrate cpu_port \
|
||||||
|
ar8xxx_mib_type ar8xxx_mib_poll_interval
|
||||||
|
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
add network switch
|
add network switch
|
||||||
@ -221,6 +226,8 @@ generate_switch() {
|
|||||||
set network.@switch[-1].reset='$reset'
|
set network.@switch[-1].reset='$reset'
|
||||||
set network.@switch[-1].enable_vlan='$enable'
|
set network.@switch[-1].enable_vlan='$enable'
|
||||||
set network.@switch[-1].blinkrate='$blinkrate'
|
set network.@switch[-1].blinkrate='$blinkrate'
|
||||||
|
set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type'
|
||||||
|
set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
generate_switch_vlans_ports "$1"
|
generate_switch_vlans_ports "$1"
|
||||||
@ -244,10 +251,10 @@ generate_static_system() {
|
|||||||
set system.ntp='timeserver'
|
set system.ntp='timeserver'
|
||||||
set system.ntp.enabled='1'
|
set system.ntp.enabled='1'
|
||||||
set system.ntp.enable_server='0'
|
set system.ntp.enable_server='0'
|
||||||
add_list system.ntp.server='0.openwrt.pool.ntp.org'
|
add_list system.ntp.server='ntp1.aliyun.com'
|
||||||
add_list system.ntp.server='1.openwrt.pool.ntp.org'
|
add_list system.ntp.server='time1.cloud.tencent.com'
|
||||||
add_list system.ntp.server='2.openwrt.pool.ntp.org'
|
add_list system.ntp.server='time.ustc.edu.cn'
|
||||||
add_list system.ntp.server='3.openwrt.pool.ntp.org'
|
add_list system.ntp.server='pool.ntp.org'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if json_is_a system object; then
|
if json_is_a system object; then
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
root:x:0:
|
root:x:0:
|
||||||
daemon:x:1:
|
daemon:x:1:
|
||||||
adm:x:4:
|
adm:x:4:
|
||||||
tty:x:5:
|
|
||||||
mail:x:8:
|
mail:x:8:
|
||||||
|
dialout:x:20:
|
||||||
audio:x:29:
|
audio:x:29:
|
||||||
www-data:x:33:
|
www-data:x:33:
|
||||||
ftp:x:55:
|
ftp:x:55:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Copyright (C) 2006-2011 OpenWrt.org
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||||||
|
|
||||||
START=10
|
START=10
|
||||||
STOP=98
|
STOP=90
|
||||||
|
|
||||||
uci_apply_defaults() {
|
uci_apply_defaults() {
|
||||||
. /lib/functions/system.sh
|
. /lib/functions/system.sh
|
||||||
@ -31,8 +31,9 @@ boot() {
|
|||||||
chmod 0700 /tmp/.uci
|
chmod 0700 /tmp/.uci
|
||||||
touch /var/log/wtmp
|
touch /var/log/wtmp
|
||||||
touch /var/log/lastlog
|
touch /var/log/lastlog
|
||||||
touch /tmp/resolv.conf.auto
|
mkdir -p /tmp/resolv.conf.d
|
||||||
ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
|
touch /tmp/resolv.conf.d/resolv.conf.auto
|
||||||
|
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf
|
||||||
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
||||||
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
||||||
|
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
# Copyright (C) 2006 OpenWrt.org
|
||||||
|
|
||||||
STOP=99
|
STOP=90
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
sync
|
sync
|
||||||
/bin/umount -a -d -r
|
/bin/umount -a -d -r
|
||||||
|
12
package/base-files/files/etc/rc.button/reboot
Executable file
12
package/base-files/files/etc/rc.button/reboot
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ "${ACTION}" = "released" ] || exit 0
|
||||||
|
|
||||||
|
if [ "$SEEN" -ge 5 ]
|
||||||
|
then
|
||||||
|
echo "REBOOT" > /dev/console
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
@ -8,6 +8,8 @@ fs.suid_dumpable=2
|
|||||||
fs.protected_hardlinks=1
|
fs.protected_hardlinks=1
|
||||||
fs.protected_symlinks=1
|
fs.protected_symlinks=1
|
||||||
|
|
||||||
|
net.core.bpf_jit_enable=1
|
||||||
|
|
||||||
net.ipv4.conf.default.arp_ignore=1
|
net.ipv4.conf.default.arp_ignore=1
|
||||||
net.ipv4.conf.all.arp_ignore=1
|
net.ipv4.conf.all.arp_ignore=1
|
||||||
net.ipv4.ip_forward=1
|
net.ipv4.ip_forward=1
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)"
|
ppwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/passwd)"
|
||||||
spwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/shadow)"
|
spwd="$(sed -ne '/^root:/s/^root:\([^:]*\):.*$/\1/p' /etc/shadow)"
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
[ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
|
[ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
|
||||||
|
|
||||||
r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"')
|
r1=$(dd if=/dev/urandom bs=1 count=1 |hexdump -e '1/1 "%02x"')
|
||||||
@ -12,4 +10,3 @@ uci -q batch <<-EOF >/dev/null
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
for file in `grep -sl Require-User /usr/lib/opkg/info/*.control`; do
|
for file in `grep -sl Require-User /usr/lib/opkg/info/*.control`; do
|
||||||
|
@ -17,6 +17,22 @@ NO_EXPORT=1
|
|||||||
LOAD_STATE=1
|
LOAD_STATE=1
|
||||||
LIST_SEP=" "
|
LIST_SEP=" "
|
||||||
|
|
||||||
|
# xor multiple hex values of the same length
|
||||||
|
xor() {
|
||||||
|
local val
|
||||||
|
local ret="0x$1"
|
||||||
|
local retlen=${#1}
|
||||||
|
|
||||||
|
shift
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
val="0x$1"
|
||||||
|
ret=$((ret ^ val))
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%0${retlen}x" "$ret"
|
||||||
|
}
|
||||||
|
|
||||||
append() {
|
append() {
|
||||||
local var="$1"
|
local var="$1"
|
||||||
local value="$2"
|
local value="$2"
|
||||||
@ -213,6 +229,7 @@ add_group_and_user() {
|
|||||||
default_postinst() {
|
default_postinst() {
|
||||||
local root="${IPKG_INSTROOT}"
|
local root="${IPKG_INSTROOT}"
|
||||||
local pkgname="$(basename ${1%.*})"
|
local pkgname="$(basename ${1%.*})"
|
||||||
|
local filelist="/usr/lib/opkg/info/${pkgname}.list"
|
||||||
local ret=0
|
local ret=0
|
||||||
|
|
||||||
add_group_and_user "${pkgname}"
|
add_group_and_user "${pkgname}"
|
||||||
@ -227,14 +244,14 @@ default_postinst() {
|
|||||||
rm -fR $root/rootfs-overlay/
|
rm -fR $root/rootfs-overlay/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$root" ] && grep -q -s "^/etc/modules.d/" "/usr/lib/opkg/info/${pkgname}.list"; then
|
if [ -z "$root" ] && grep -q -s "^/etc/modules.d/" "$filelist"; then
|
||||||
kmodloader
|
kmodloader
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
|
if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "$filelist"; then
|
||||||
. /lib/functions/system.sh
|
. /lib/functions/system.sh
|
||||||
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
|
[ -d /tmp/.uci ] || mkdir -p /tmp/.uci
|
||||||
for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do
|
for i in $(grep -s "^/etc/uci-defaults/" "$filelist"); do
|
||||||
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
|
( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
|
||||||
done
|
done
|
||||||
uci commit
|
uci commit
|
||||||
@ -243,7 +260,7 @@ default_postinst() {
|
|||||||
[ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
[ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
|
||||||
|
|
||||||
local shell="$(which bash)"
|
local shell="$(which bash)"
|
||||||
for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
|
for i in $(grep -s "^/etc/init.d/" "$root$filelist"); do
|
||||||
if [ -n "$root" ]; then
|
if [ -n "$root" ]; then
|
||||||
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
|
${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
|
||||||
else
|
else
|
||||||
|
128
package/base-files/files/lib/functions/caldata.sh
Normal file
128
package/base-files/files/lib/functions/caldata.sh
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
# Copyright (C) 2019 OpenWrt.org
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
. /lib/functions/system.sh
|
||||||
|
|
||||||
|
caldata_die() {
|
||||||
|
echo "caldata: " "$*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_extract() {
|
||||||
|
local part=$1
|
||||||
|
local offset=$(($2))
|
||||||
|
local count=$(($3))
|
||||||
|
local mtd
|
||||||
|
|
||||||
|
mtd=$(find_mtd_chardev $part)
|
||||||
|
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
|
||||||
|
|
||||||
|
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
||||||
|
caldata_die "failed to extract calibration data from $mtd"
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_extract_ubi() {
|
||||||
|
local part=$1
|
||||||
|
local offset=$(($2))
|
||||||
|
local count=$(($3))
|
||||||
|
local ubidev
|
||||||
|
local ubi
|
||||||
|
|
||||||
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
|
ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||||
|
ubi=$(nand_find_volume $ubidev $part)
|
||||||
|
[ -n "$ubi" ] || caldata_die "no UBI volume found for $part"
|
||||||
|
|
||||||
|
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
||||||
|
caldata_die "failed to extract calibration data from $ubi"
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_extract_reverse() {
|
||||||
|
local part=$1
|
||||||
|
local offset=$2
|
||||||
|
local count=$(($3))
|
||||||
|
local mtd
|
||||||
|
local reversed
|
||||||
|
local caldata
|
||||||
|
|
||||||
|
mtd=$(find_mtd_chardev "$part")
|
||||||
|
reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
|
||||||
|
|
||||||
|
for byte in $reversed; do
|
||||||
|
caldata="\x${byte}${caldata}"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_from_file() {
|
||||||
|
local source=$1
|
||||||
|
local offset=$(($2))
|
||||||
|
local count=$(($3))
|
||||||
|
|
||||||
|
dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
||||||
|
caldata_die "failed to extract calibration data from $source"
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_valid() {
|
||||||
|
local expected="$1"
|
||||||
|
|
||||||
|
magic=$(hexdump -v -n 2 -e '1/1 "%02x"' /lib/firmware/$FIRMWARE)
|
||||||
|
[ "$magic" = "$expected" ]
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_patch_chksum() {
|
||||||
|
local mac=$1
|
||||||
|
local mac_offset=$(($2))
|
||||||
|
local chksum_offset=$(($3))
|
||||||
|
local xor_mac
|
||||||
|
local xor_fw_mac
|
||||||
|
local xor_fw_chksum
|
||||||
|
|
||||||
|
xor_mac=${mac//:/}
|
||||||
|
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
||||||
|
|
||||||
|
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
||||||
|
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
||||||
|
|
||||||
|
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
||||||
|
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
||||||
|
|
||||||
|
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
||||||
|
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
|
||||||
|
}
|
||||||
|
|
||||||
|
caldata_patch_mac() {
|
||||||
|
local mac=$1
|
||||||
|
local mac_offset=$(($2))
|
||||||
|
local chksum_offset=$3
|
||||||
|
|
||||||
|
[ -z "$mac" -o -z "$mac_offset" ] && return
|
||||||
|
|
||||||
|
[ -n "$chksum_offset" ] && caldata_patch_chksum "$mac" "$mac_offset" "$chksum_offset"
|
||||||
|
|
||||||
|
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc oflag=seek_bytes bs=6 seek=$mac_offset count=1 || \
|
||||||
|
caldata_die "failed to write MAC address to eeprom file"
|
||||||
|
}
|
||||||
|
|
||||||
|
ath9k_patch_mac() {
|
||||||
|
local mac=$1
|
||||||
|
|
||||||
|
caldata_patch_mac "$mac" 0x2
|
||||||
|
}
|
||||||
|
|
||||||
|
ath9k_patch_mac_crc() {
|
||||||
|
local mac=$1
|
||||||
|
local mac_offset=$2
|
||||||
|
local chksum_offset=$((mac_offset - 10))
|
||||||
|
|
||||||
|
caldata_patch_mac "$mac" "$mac_offset" "$chksum_offset"
|
||||||
|
}
|
||||||
|
|
||||||
|
ath10k_patch_mac() {
|
||||||
|
local mac=$1
|
||||||
|
|
||||||
|
caldata_patch_mac "$mac" 0x6 0x2
|
||||||
|
}
|
39
package/base-files/files/lib/functions/migrations.sh
Normal file
39
package/base-files/files/lib/functions/migrations.sh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
migrate_led_sysfs() {
|
||||||
|
local cfg="$1"; shift
|
||||||
|
local tuples="$@"
|
||||||
|
local sysfs
|
||||||
|
local name
|
||||||
|
|
||||||
|
config_get sysfs ${cfg} sysfs
|
||||||
|
config_get name ${cfg} name
|
||||||
|
|
||||||
|
[ -z "${sysfs}" ] && return
|
||||||
|
|
||||||
|
for tuple in ${tuples}; do
|
||||||
|
local old=${tuple%=*}
|
||||||
|
local new=${tuple#*=}
|
||||||
|
local new_sysfs
|
||||||
|
|
||||||
|
new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/")
|
||||||
|
|
||||||
|
[ "${new_sysfs}" = "${sysfs}" ] && continue
|
||||||
|
|
||||||
|
uci set system.${cfg}.sysfs="${new_sysfs}"
|
||||||
|
|
||||||
|
logger -t led-migration "sysfs option of LED \"${name}\" updated to ${new_sysfs}"
|
||||||
|
done;
|
||||||
|
}
|
||||||
|
|
||||||
|
migrate_leds() {
|
||||||
|
config_load system
|
||||||
|
config_foreach migrate_led_sysfs led "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
migrations_apply() {
|
||||||
|
local realm="$1"
|
||||||
|
[ -n "$(uci changes ${realm})" ] && uci -q commit ${realm}
|
||||||
|
}
|
@ -271,6 +271,11 @@ network_is_up()
|
|||||||
# 2: interface
|
# 2: interface
|
||||||
network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; }
|
network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; }
|
||||||
|
|
||||||
|
# determine the uptime of the given logical interface
|
||||||
|
# 1: destination variable
|
||||||
|
# 2: interface
|
||||||
|
network_get_uptime() { __network_ifstatus "$1" "$2" ".uptime"; }
|
||||||
|
|
||||||
# determine the metric of the given logical interface
|
# determine the metric of the given logical interface
|
||||||
# 1: destination variable
|
# 1: destination variable
|
||||||
# 2: interface
|
# 2: interface
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# Copyright (C) 2006-2013 OpenWrt.org
|
# Copyright (C) 2006-2013 OpenWrt.org
|
||||||
|
|
||||||
|
. /usr/share/libubox/jshn.sh
|
||||||
|
|
||||||
get_mac_binary() {
|
get_mac_binary() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
local offset="$2"
|
local offset="$2"
|
||||||
|
|
||||||
if [ -z "$path" ]; then
|
if ! [ -e "$path" ]; then
|
||||||
echo "get_mac_binary: file $path not found!" >&2
|
echo "get_mac_binary: file $path not found!" >&2
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -12,6 +14,44 @@ get_mac_binary() {
|
|||||||
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' $path 2>/dev/null
|
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' $path 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_mac_label_dt() {
|
||||||
|
local basepath="/proc/device-tree"
|
||||||
|
local macdevice="$(cat "$basepath/aliases/label-mac-device" 2>/dev/null)"
|
||||||
|
local macaddr
|
||||||
|
|
||||||
|
[ -n "$macdevice" ] || return
|
||||||
|
|
||||||
|
macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null)
|
||||||
|
[ -n "$macaddr" ] || macaddr=$(get_mac_binary "$basepath/$macdevice/local-mac-address" 0 2>/dev/null)
|
||||||
|
|
||||||
|
echo $macaddr
|
||||||
|
}
|
||||||
|
|
||||||
|
get_mac_label_json() {
|
||||||
|
local cfg="/etc/board.json"
|
||||||
|
local macaddr
|
||||||
|
|
||||||
|
[ -s "$cfg" ] || return
|
||||||
|
|
||||||
|
json_init
|
||||||
|
json_load "$(cat $cfg)"
|
||||||
|
if json_is_a system object; then
|
||||||
|
json_select system
|
||||||
|
json_get_var macaddr label_macaddr
|
||||||
|
json_select ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $macaddr
|
||||||
|
}
|
||||||
|
|
||||||
|
get_mac_label() {
|
||||||
|
local macaddr=$(get_mac_label_dt)
|
||||||
|
|
||||||
|
[ -n "$macaddr" ] || macaddr=$(get_mac_label_json)
|
||||||
|
|
||||||
|
echo $macaddr
|
||||||
|
}
|
||||||
|
|
||||||
find_mtd_chardev() {
|
find_mtd_chardev() {
|
||||||
local INDEX=$(find_mtd_index "$1")
|
local INDEX=$(find_mtd_index "$1")
|
||||||
local PREFIX=/dev/mtd
|
local PREFIX=/dev/mtd
|
||||||
@ -40,7 +80,7 @@ mtd_get_mac_ascii() {
|
|||||||
|
|
||||||
mtd_get_mac_text() {
|
mtd_get_mac_text() {
|
||||||
local mtdname=$1
|
local mtdname=$1
|
||||||
local offset=$2
|
local offset=$(($2))
|
||||||
local part
|
local part
|
||||||
local mac_dirty
|
local mac_dirty
|
||||||
|
|
||||||
@ -79,12 +119,7 @@ mtd_get_mac_binary_ubi() {
|
|||||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||||
local part=$(nand_find_volume $ubidev $1)
|
local part=$(nand_find_volume $ubidev $1)
|
||||||
|
|
||||||
if [ -z "$part" ]; then
|
get_mac_binary "/dev/$part" "$offset"
|
||||||
echo "mtd_get_mac_binary: ubi volume $mtdname not found!" >&2
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' /dev/$part 2>/dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mtd_get_part_size() {
|
mtd_get_part_size() {
|
||||||
@ -105,10 +140,17 @@ macaddr_add() {
|
|||||||
local oui=${mac%:*:*:*}
|
local oui=${mac%:*:*:*}
|
||||||
local nic=${mac#*:*:*:}
|
local nic=${mac#*:*:*:}
|
||||||
|
|
||||||
nic=$(printf "%06x" $((0x${nic//:/} + $val & 0xffffff)) | sed 's/^\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1:\2:\3/')
|
nic=$(printf "%06x" $((0x${nic//:/} + val & 0xffffff)) | sed 's/^\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1:\2:\3/')
|
||||||
echo $oui:$nic
|
echo $oui:$nic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macaddr_geteui() {
|
||||||
|
local mac=$1
|
||||||
|
local sep=$2
|
||||||
|
|
||||||
|
echo ${mac:9:2}$sep${mac:12:2}$sep${mac:15:2}
|
||||||
|
}
|
||||||
|
|
||||||
macaddr_setbit_la() {
|
macaddr_setbit_la() {
|
||||||
local mac=$1
|
local mac=$1
|
||||||
|
|
||||||
|
@ -182,6 +182,19 @@ _ucidef_finish_switch_roles() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ucidef_set_ar8xxx_switch_mib() {
|
||||||
|
local name="$1"
|
||||||
|
local type="$2"
|
||||||
|
local interval="$3"
|
||||||
|
|
||||||
|
json_select_object switch
|
||||||
|
json_select_object "$name"
|
||||||
|
json_add_int ar8xxx_mib_type $type
|
||||||
|
json_add_int ar8xxx_mib_poll_interval $interval
|
||||||
|
json_select ..
|
||||||
|
json_select ..
|
||||||
|
}
|
||||||
|
|
||||||
ucidef_add_switch() {
|
ucidef_add_switch() {
|
||||||
local name="$1"; shift
|
local name="$1"; shift
|
||||||
local port num role device index need_tag prev_role
|
local port num role device index need_tag prev_role
|
||||||
@ -294,6 +307,14 @@ ucidef_set_interface_macaddr() {
|
|||||||
ucidef_set_interface "$network" macaddr "$macaddr"
|
ucidef_set_interface "$network" macaddr "$macaddr"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ucidef_set_label_macaddr() {
|
||||||
|
local macaddr="$1"
|
||||||
|
|
||||||
|
json_select_object system
|
||||||
|
json_add_string label_macaddr "$macaddr"
|
||||||
|
json_select ..
|
||||||
|
}
|
||||||
|
|
||||||
ucidef_add_atm_bridge() {
|
ucidef_add_atm_bridge() {
|
||||||
local vpi="$1"
|
local vpi="$1"
|
||||||
local vci="$2"
|
local vci="$2"
|
||||||
@ -463,6 +484,7 @@ _ucidef_set_led_timer() {
|
|||||||
|
|
||||||
_ucidef_set_led_common "$1" "$2" "$3"
|
_ucidef_set_led_common "$1" "$2" "$3"
|
||||||
|
|
||||||
|
json_add_string type "$trigger_name"
|
||||||
json_add_string trigger "$trigger_name"
|
json_add_string trigger "$trigger_name"
|
||||||
json_add_int delayon "$delayon"
|
json_add_int delayon "$delayon"
|
||||||
json_add_int delayoff "$delayoff"
|
json_add_int delayoff "$delayoff"
|
||||||
|
@ -31,6 +31,8 @@ fs_wait_for_key () {
|
|||||||
lock $keypress_wait
|
lock $keypress_wait
|
||||||
{
|
{
|
||||||
while [ $timer -gt 0 ]; do
|
while [ $timer -gt 0 ]; do
|
||||||
|
pi_failsafe_net_message=true \
|
||||||
|
preinit_net_echo "Please press button now to enter failsafe"
|
||||||
echo "$timer" >$keypress_sec
|
echo "$timer" >$keypress_sec
|
||||||
timer=$(($timer - 1))
|
timer=$(($timer - 1))
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -88,9 +90,6 @@ failsafe_wait() {
|
|||||||
}
|
}
|
||||||
grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE
|
grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE
|
||||||
if [ "$FAILSAFE" != "true" ]; then
|
if [ "$FAILSAFE" != "true" ]; then
|
||||||
pi_failsafe_net_message=true
|
|
||||||
preinit_net_echo "Please press button now to enter failsafe"
|
|
||||||
pi_failsafe_net_message=false
|
|
||||||
fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true
|
fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true
|
||||||
[ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "`cat /tmp/failsafe_button`" was pressed -"
|
[ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "`cat /tmp/failsafe_button`" was pressed -"
|
||||||
[ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe
|
[ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe
|
||||||
|
@ -15,4 +15,4 @@ if [ \! -z "$1" -a -d /etc/hotplug.d/$1 ]; then
|
|||||||
for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
|
for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
|
||||||
[ -f $script ] && . $script
|
[ -f $script ] && . $script
|
||||||
); done
|
); done
|
||||||
fi
|
fi
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $0 [config|up|down|reload|status]
|
Usage: $0 [config|up|down|reconf|reload|status]
|
||||||
enables (default), disables or configures devices not yet configured.
|
enables (default), disables or configures devices not yet configured.
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -8,11 +8,11 @@ HOME_URL="%u"
|
|||||||
BUG_URL="%b"
|
BUG_URL="%b"
|
||||||
SUPPORT_URL="%s"
|
SUPPORT_URL="%s"
|
||||||
BUILD_ID="%R"
|
BUILD_ID="%R"
|
||||||
LEDE_BOARD="%S"
|
OPENWRT_BOARD="%S"
|
||||||
LEDE_ARCH="%A"
|
OPENWRT_ARCH="%A"
|
||||||
LEDE_TAINTS="%t"
|
OPENWRT_TAINTS="%t"
|
||||||
LEDE_DEVICE_MANUFACTURER="%M"
|
OPENWRT_DEVICE_MANUFACTURER="%M"
|
||||||
LEDE_DEVICE_MANUFACTURER_URL="%m"
|
OPENWRT_DEVICE_MANUFACTURER_URL="%m"
|
||||||
LEDE_DEVICE_PRODUCT="%P"
|
OPENWRT_DEVICE_PRODUCT="%P"
|
||||||
LEDE_DEVICE_REVISION="%h"
|
OPENWRT_DEVICE_REVISION="%h"
|
||||||
LEDE_RELEASE="%D %V %C"
|
OPENWRT_RELEASE="%D %V %C"
|
||||||
|
@ -183,7 +183,7 @@ if VERSIONOPT
|
|||||||
config VERSION_REPO
|
config VERSION_REPO
|
||||||
string
|
string
|
||||||
prompt "Release repository"
|
prompt "Release repository"
|
||||||
default "http://downloads.lede-project.org/snapshots"
|
default "http://downloads.openwrt.org/snapshots"
|
||||||
help
|
help
|
||||||
This is the repository address embedded in the image, it defaults
|
This is the repository address embedded in the image, it defaults
|
||||||
to the trunk snapshot repo; the url may contain the following placeholders:
|
to the trunk snapshot repo; the url may contain the following placeholders:
|
||||||
|
@ -194,9 +194,11 @@ foreach my $mirror (@ARGV) {
|
|||||||
push @mirrors, "https://downloads.sourceforge.net/$1";
|
push @mirrors, "https://downloads.sourceforge.net/$1";
|
||||||
}
|
}
|
||||||
} elsif ($mirror =~ /^\@APACHE\/(.+)$/) {
|
} elsif ($mirror =~ /^\@APACHE\/(.+)$/) {
|
||||||
|
push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1";
|
||||||
push @mirrors, "https://mirror.netcologne.de/apache.org/$1";
|
push @mirrors, "https://mirror.netcologne.de/apache.org/$1";
|
||||||
push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1";
|
push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1";
|
||||||
push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1";
|
push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1";
|
||||||
|
push @mirrors, "https://archive.apache.org/dist/$1";
|
||||||
push @mirrors, "http://mirror.cogentco.com/pub/apache/$1";
|
push @mirrors, "http://mirror.cogentco.com/pub/apache/$1";
|
||||||
push @mirrors, "http://mirror.navercorp.com/apache/$1";
|
push @mirrors, "http://mirror.navercorp.com/apache/$1";
|
||||||
push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1";
|
push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1";
|
||||||
@ -212,6 +214,7 @@ foreach my $mirror (@ARGV) {
|
|||||||
push @mirrors, "https://raw.githubusercontent.com/$dir";
|
push @mirrors, "https://raw.githubusercontent.com/$dir";
|
||||||
}
|
}
|
||||||
} elsif ($mirror =~ /^\@GNU\/(.+)$/) {
|
} elsif ($mirror =~ /^\@GNU\/(.+)$/) {
|
||||||
|
push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1";
|
||||||
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1";
|
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1";
|
||||||
push @mirrors, "https://mirror.netcologne.de/gnu/$1";
|
push @mirrors, "https://mirror.netcologne.de/gnu/$1";
|
||||||
push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1";
|
push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1";
|
||||||
@ -235,19 +238,20 @@ foreach my $mirror (@ARGV) {
|
|||||||
push @extra, "$extra[0]/testing";
|
push @extra, "$extra[0]/testing";
|
||||||
} elsif ($filename =~ /linux-(\d+\.\d+(?:\.\d+)?)/) {
|
} elsif ($filename =~ /linux-(\d+\.\d+(?:\.\d+)?)/) {
|
||||||
push @extra, "$extra[0]/longterm/v$1";
|
push @extra, "$extra[0]/longterm/v$1";
|
||||||
}
|
}
|
||||||
foreach my $dir (@extra) {
|
foreach my $dir (@extra) {
|
||||||
push @mirrors, "http://mirrors.ustc.edu.cn/kernel.org/$dir";
|
push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir";
|
||||||
push @mirrors, "https://cdn.kernel.org/pub/$dir";
|
push @mirrors, "https://cdn.kernel.org/pub/$dir";
|
||||||
push @mirrors, "https://mirror.rackspace.com/kernel.org/$dir";
|
push @mirrors, "https://mirror.rackspace.com/kernel.org/pub/$dir";
|
||||||
push @mirrors, "http://download.xs4all.nl/ftp.kernel.org/pub/$dir";
|
push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir";
|
||||||
push @mirrors, "http://mirrors.mit.edu/kernel/$dir";
|
push @mirrors, "https://mirrors.mit.edu/kernel/$dir";
|
||||||
push @mirrors, "http://ftp.nara.wide.ad.jp/pub/kernel.org/$dir";
|
push @mirrors, "http://ftp.nara.wide.ad.jp/pub/kernel.org/$dir";
|
||||||
push @mirrors, "http://www.ring.gr.jp/archives/linux/kernel.org/$dir";
|
push @mirrors, "http://www.ring.gr.jp/archives/linux/kernel.org/$dir";
|
||||||
push @mirrors, "ftp://ftp.riken.jp/Linux/kernel.org/$dir";
|
push @mirrors, "ftp://ftp.riken.jp/Linux/kernel.org/$dir";
|
||||||
push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir";
|
push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir";
|
||||||
}
|
}
|
||||||
} elsif ($mirror =~ /^\@GNOME\/(.+)$/) {
|
} elsif ($mirror =~ /^\@GNOME\/(.+)$/) {
|
||||||
|
push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1";
|
||||||
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1";
|
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1";
|
||||||
push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1";
|
push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1";
|
||||||
push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1";
|
push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1";
|
||||||
@ -263,9 +267,8 @@ foreach my $mirror (@ARGV) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#push @mirrors, 'https://mirror1.openwrt.org';
|
#push @mirrors, 'https://mirror1.openwrt.org';
|
||||||
push @mirrors, 'https://sources.lede-project.org';
|
push @mirrors, 'https://sources.openwrt.org';
|
||||||
push @mirrors, 'https://mirror2.openwrt.org/sources';
|
push @mirrors, 'https://mirror2.openwrt.org/sources';
|
||||||
push @mirrors, 'https://downloads.openwrt.org/sources';
|
|
||||||
|
|
||||||
while (!-f "$target/$filename") {
|
while (!-f "$target/$filename") {
|
||||||
my $mirror = shift @mirrors;
|
my $mirror = shift @mirrors;
|
||||||
@ -275,4 +278,3 @@ while (!-f "$target/$filename") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$SIG{INT} = \&cleanup;
|
$SIG{INT} = \&cleanup;
|
||||||
|
|
||||||
|
1179
scripts/json_add_image_info.py
Normal file → Executable file
1179
scripts/json_add_image_info.py
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
@ -2,50 +2,7 @@
|
|||||||
|
|
||||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions/caldata.sh
|
||||||
. /lib/functions/system.sh
|
|
||||||
|
|
||||||
ath9k_eeprom_die() {
|
|
||||||
echo "ath9k eeprom: " "$*"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_eeprom_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local mtd
|
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
|
||||||
[ -n "$mtd" ] || \
|
|
||||||
ath9k_eeprom_die "no mtd device found for partition $part"
|
|
||||||
|
|
||||||
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
|
||||||
ath9k_eeprom_die "failed to extract from $mtd"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_ubi_eeprom_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
|
||||||
local ubi
|
|
||||||
|
|
||||||
ubi=$(nand_find_volume $ubidev $part)
|
|
||||||
[ -n "$ubi" ] || \
|
|
||||||
ath9k_eeprom_die "no UBI volume found for $part"
|
|
||||||
|
|
||||||
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
|
||||||
ath9k_eeprom_die "failed to extract from $ubi"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_patch_firmware_mac() {
|
|
||||||
local mac=$1
|
|
||||||
|
|
||||||
[ -z "$mac" ] && return
|
|
||||||
|
|
||||||
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=2 count=6
|
|
||||||
}
|
|
||||||
|
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
|
|
||||||
@ -56,14 +13,14 @@ case "$FIRMWARE" in
|
|||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 20480 4096
|
caldata_extract_ubi "caldata" 0x5000 0x1000
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "wifi_data" 20480 4096
|
caldata_extract "wifi_data" 0x5000 0x1000
|
||||||
ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 12)
|
ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0xc)
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
caldata_die "board $board is not supported yet"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -74,14 +31,14 @@ case "$FIRMWARE" in
|
|||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 4096 4096
|
caldata_extract_ubi "caldata" 0x1000 0x1000
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "wifi_data" 4096 4096
|
caldata_extract "wifi_data" 0x1000 0x1000
|
||||||
ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0)
|
ath9k_patch_mac $(mtd_get_mac_binary wifi_data 0x0)
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
caldata_die "board $board is not supported yet"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -6,7 +6,7 @@ preinit_set_mac_address() {
|
|||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
meraki,mr24|\
|
meraki,mr24|\
|
||||||
meraki,mx60)
|
meraki,mx60)
|
||||||
mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
|
mac_lan=$(mtd_get_mac_binary_ubi board-config 0x66)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -650,10 +650,58 @@ ar71xx_setup_macs()
|
|||||||
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ar71xx_setup_ar8xxx_switch()
|
||||||
|
{
|
||||||
|
local board="$1"
|
||||||
|
|
||||||
|
case $board in
|
||||||
|
ap147-010|\
|
||||||
|
archer-c25-v1|\
|
||||||
|
archer-c58-v1|\
|
||||||
|
archer-c59-v1|\
|
||||||
|
archer-c59-v2|\
|
||||||
|
archer-c60-v1|\
|
||||||
|
archer-c60-v2|\
|
||||||
|
archer-c7-v4|\
|
||||||
|
archer-c7-v5|\
|
||||||
|
cf-e375ac|\
|
||||||
|
cf-e385ac|\
|
||||||
|
cr3000|\
|
||||||
|
dhp-1565-a1|\
|
||||||
|
mynet-n600|\
|
||||||
|
rb-2011il|\
|
||||||
|
rb-2011ils|\
|
||||||
|
rb-2011l|\
|
||||||
|
rb-2011uas|\
|
||||||
|
rb-2011uas-2hnd|\
|
||||||
|
rb-2011uias|\
|
||||||
|
rb-2011uias-2hnd|\
|
||||||
|
rb-750|\
|
||||||
|
rb-750p-pbr2|\
|
||||||
|
rb-750-r2|\
|
||||||
|
rb-750up-r2|\
|
||||||
|
rb-951ui-2nd|\
|
||||||
|
rb-952ui-5ac2nd|\
|
||||||
|
rb-map-2nd|\
|
||||||
|
tl-wr1043nd-v4|\
|
||||||
|
tl-wr1043n-v5|\
|
||||||
|
wndr3700v4|\
|
||||||
|
wndr4300|\
|
||||||
|
wnr1000-v2|\
|
||||||
|
wnr2000-v3|\
|
||||||
|
wnr2200|\
|
||||||
|
wnr612-v2|\
|
||||||
|
wpn824n)
|
||||||
|
ucidef_set_ar8xxx_switch_mib "switch0" 0 500
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
board_config_update
|
board_config_update
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
ar71xx_setup_interfaces $board
|
ar71xx_setup_interfaces $board
|
||||||
ar71xx_setup_macs $board
|
ar71xx_setup_macs $board
|
||||||
|
ar71xx_setup_ar8xxx_switch $board
|
||||||
board_config_flush
|
board_config_flush
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -12,8 +12,8 @@ ath9k_eeprom_die() {
|
|||||||
|
|
||||||
ath9k_eeprom_extract() {
|
ath9k_eeprom_extract() {
|
||||||
local part=$1
|
local part=$1
|
||||||
local offset=$2
|
local offset=$(($2))
|
||||||
local count=$3
|
local count=$(($3))
|
||||||
local mtd
|
local mtd
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
mtd=$(find_mtd_chardev $part)
|
||||||
@ -26,8 +26,8 @@ ath9k_eeprom_extract() {
|
|||||||
|
|
||||||
ath9k_ubi_eeprom_extract() {
|
ath9k_ubi_eeprom_extract() {
|
||||||
local part=$1
|
local part=$1
|
||||||
local offset=$2
|
local offset=$(($2))
|
||||||
local count=$3
|
local count=$(($3))
|
||||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||||
local ubi
|
local ubi
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ ath9k_ubi_eeprom_extract() {
|
|||||||
ath9k_eeprom_extract_reverse() {
|
ath9k_eeprom_extract_reverse() {
|
||||||
local part=$1
|
local part=$1
|
||||||
local offset=$2
|
local offset=$2
|
||||||
local count=$3
|
local count=$(($3))
|
||||||
local mtd
|
local mtd
|
||||||
local reversed
|
local reversed
|
||||||
local caldata
|
local caldata
|
||||||
@ -72,53 +72,53 @@ case "$FIRMWARE" in
|
|||||||
case $board in
|
case $board in
|
||||||
c-55|\
|
c-55|\
|
||||||
c-60)
|
c-60)
|
||||||
ath9k_eeprom_extract "art" 4096 2048
|
ath9k_eeprom_extract "art" 0x1000 0x800
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +1)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1)
|
||||||
;;
|
;;
|
||||||
fritz4020|\
|
fritz4020|\
|
||||||
fritz450e)
|
fritz450e)
|
||||||
ath9k_eeprom_extract_reverse "urlader" 5441 1088
|
ath9k_eeprom_extract_reverse "urlader" 0x1541 0x440
|
||||||
;;
|
;;
|
||||||
k2t)
|
k2t)
|
||||||
ath9k_eeprom_extract "art" 4096 2048
|
ath9k_eeprom_extract "art" 0x1000 0x800
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +3)
|
ath9k_patch_firmware_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +3)
|
||||||
;;
|
;;
|
||||||
sbr-ac1750)
|
sbr-ac1750)
|
||||||
ath9k_eeprom_extract "art" 4096 2048
|
ath9k_eeprom_extract "art" 0x1000 0x800
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
ath9k_patch_firmware_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
||||||
;;
|
;;
|
||||||
mr18)
|
mr18)
|
||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 4096 2048
|
ath9k_ubi_eeprom_extract "caldata" 0x1000 0x800
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "odm-caldata" 4096 2048
|
ath9k_eeprom_extract "odm-caldata" 0x1000 0x800
|
||||||
fi
|
fi
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +1)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +1)
|
||||||
;;
|
;;
|
||||||
r6100 | \
|
r6100 | \
|
||||||
wndr3700v4 | \
|
wndr3700v4 | \
|
||||||
wndr4300)
|
wndr4300)
|
||||||
ath9k_eeprom_extract "caldata" 4096 2048
|
ath9k_eeprom_extract "caldata" 0x1000 0x800
|
||||||
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0)
|
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0x0)
|
||||||
;;
|
;;
|
||||||
rambutan)
|
rambutan)
|
||||||
ath9k_eeprom_extract "art" 4096 2048
|
ath9k_eeprom_extract "art" 0x1000 0x800
|
||||||
;;
|
;;
|
||||||
wlr8100)
|
wlr8100)
|
||||||
ath9k_eeprom_extract "art" 4096 2048
|
ath9k_eeprom_extract "art" 0x1000 0x800
|
||||||
ath9k_patch_firmware_mac $(mtd_get_mac_ascii u-boot-env "ethaddr")
|
ath9k_patch_firmware_mac $(mtd_get_mac_ascii u-boot-env "ethaddr")
|
||||||
;;
|
;;
|
||||||
z1)
|
z1)
|
||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 4096 2048
|
ath9k_ubi_eeprom_extract "caldata" 0x1000 0x800
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "origcaldata" 4096 2048
|
ath9k_eeprom_extract "origcaldata" 0x1000 0x800
|
||||||
fi
|
fi
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +2)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +2)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
ath9k_eeprom_die "board $board is not supported yet"
|
||||||
@ -129,36 +129,36 @@ case "$FIRMWARE" in
|
|||||||
"pci_wmac0.eeprom")
|
"pci_wmac0.eeprom")
|
||||||
case $board in
|
case $board in
|
||||||
c-55)
|
c-55)
|
||||||
ath9k_eeprom_extract "art" 20480 2048
|
ath9k_eeprom_extract "art" 0x5000 0x800
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0) +2)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2)
|
||||||
;;
|
;;
|
||||||
fritz300e)
|
fritz300e)
|
||||||
ath9k_eeprom_extract_reverse "urloader" 5441 1088
|
ath9k_eeprom_extract_reverse "urloader" 0x1541 0x440
|
||||||
;;
|
;;
|
||||||
mr18)
|
mr18)
|
||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 20480 2048
|
ath9k_ubi_eeprom_extract "caldata" 0x1541 0x440
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "odm-caldata" 20480 2048
|
ath9k_eeprom_extract "odm-caldata" 0x5000 0x800
|
||||||
fi
|
fi
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +2)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +2)
|
||||||
;;
|
;;
|
||||||
wndr3700v4 | \
|
wndr3700v4 | \
|
||||||
wndr4300)
|
wndr4300)
|
||||||
ath9k_eeprom_extract "caldata" 20480 2048
|
ath9k_eeprom_extract "caldata" 0x5000 0x800
|
||||||
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 12)
|
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0xc)
|
||||||
;;
|
;;
|
||||||
z1)
|
z1)
|
||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 86016 4096
|
ath9k_ubi_eeprom_extract "caldata" 0x15000 0x1000
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "origcaldata" 86016 4096
|
ath9k_eeprom_extract "origcaldata" 0x15000 0x1000
|
||||||
fi
|
fi
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +3)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +3)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
ath9k_eeprom_die "board $board is not supported yet"
|
||||||
@ -172,11 +172,11 @@ case "$FIRMWARE" in
|
|||||||
. /lib/upgrade/nand.sh
|
. /lib/upgrade/nand.sh
|
||||||
|
|
||||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||||
ath9k_ubi_eeprom_extract "caldata" 36864 2048
|
ath9k_ubi_eeprom_extract "caldata" 0x9000 0x800
|
||||||
else
|
else
|
||||||
ath9k_eeprom_extract "odm-caldata" 36864 2048
|
ath9k_eeprom_extract "odm-caldata" 0x9000 0x800
|
||||||
fi
|
fi
|
||||||
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) +3)
|
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +3)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
ath9k_eeprom_die "board $board is not supported yet"
|
||||||
|
@ -1,21 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# xor multiple hex values of the same length
|
|
||||||
xor() {
|
|
||||||
local val
|
|
||||||
local ret="0x$1"
|
|
||||||
local retlen=${#1}
|
|
||||||
|
|
||||||
shift
|
|
||||||
while [ -n "$1" ]; do
|
|
||||||
val="0x$1"
|
|
||||||
ret=$((ret ^ val))
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "%0${retlen}x" "$ret"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_die() {
|
ath10kcal_die() {
|
||||||
echo "ath10cal: " "$*"
|
echo "ath10cal: " "$*"
|
||||||
exit 1
|
exit 1
|
||||||
@ -23,8 +7,8 @@ ath10kcal_die() {
|
|||||||
|
|
||||||
ath10kcal_from_file() {
|
ath10kcal_from_file() {
|
||||||
local source=$1
|
local source=$1
|
||||||
local offset=$2
|
local offset=$(($2))
|
||||||
local count=$3
|
local count=$(($3))
|
||||||
|
|
||||||
dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
||||||
ath10kcal_die "failed to extract calibration data from $source"
|
ath10kcal_die "failed to extract calibration data from $source"
|
||||||
@ -32,8 +16,8 @@ ath10kcal_from_file() {
|
|||||||
|
|
||||||
ath10kcal_extract() {
|
ath10kcal_extract() {
|
||||||
local part=$1
|
local part=$1
|
||||||
local offset=$2
|
local offset=$(($2))
|
||||||
local count=$3
|
local count=$(($3))
|
||||||
local mtd cal_size
|
local mtd cal_size
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
mtd=$(find_mtd_chardev $part)
|
||||||
@ -55,30 +39,7 @@ ath10kcal_patch_mac() {
|
|||||||
|
|
||||||
[ -z "$mac" ] && return
|
[ -z "$mac" ] && return
|
||||||
|
|
||||||
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
|
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc oflag=seek_bytes bs=6 seek=6 count=1
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_patch_mac_crc() {
|
|
||||||
local mac=$1
|
|
||||||
local mac_offset=6
|
|
||||||
local chksum_offset=2
|
|
||||||
local xor_mac
|
|
||||||
local xor_fw_mac
|
|
||||||
local xor_fw_chksum
|
|
||||||
|
|
||||||
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
|
||||||
|
|
||||||
ath10kcal_patch_mac "$mac" && {
|
|
||||||
xor_mac=${mac//:/}
|
|
||||||
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
|
||||||
|
|
||||||
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
|
||||||
|
|
||||||
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
|
||||||
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
@ -96,17 +57,17 @@ case "$FIRMWARE" in
|
|||||||
mr1750|\
|
mr1750|\
|
||||||
mr1750v2|\
|
mr1750v2|\
|
||||||
om5p-acv2)
|
om5p-acv2)
|
||||||
ath10kcal_extract "ART" 20480 2116
|
ath10kcal_extract "ART" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
|
||||||
;;
|
;;
|
||||||
archer-c25-v1|\
|
archer-c25-v1|\
|
||||||
tl-wdr6500-v2)
|
tl-wdr6500-v2)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
|
||||||
;;
|
;;
|
||||||
archer-c7-v4|\
|
archer-c7-v4|\
|
||||||
archer-c7-v5)
|
archer-c7-v5)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
||||||
;;
|
;;
|
||||||
cf-e355ac-v1|\
|
cf-e355ac-v1|\
|
||||||
@ -119,64 +80,64 @@ case "$FIRMWARE" in
|
|||||||
oolite-v5.2-dev|\
|
oolite-v5.2-dev|\
|
||||||
sr3200|\
|
sr3200|\
|
||||||
xd3200)
|
xd3200)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
;;
|
;;
|
||||||
dap-2695-a1)
|
dap-2695-a1)
|
||||||
ath10kcal_extract "radiocfg" 20480 2116
|
ath10kcal_extract "radiocfg" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
|
ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
|
||||||
;;
|
;;
|
||||||
dir-869-a1|\
|
dir-869-a1|\
|
||||||
qihoo-c301)
|
qihoo-c301)
|
||||||
ath10kcal_extract "radiocfg" 20480 2116
|
ath10kcal_extract "radiocfg" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
|
ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
|
||||||
;;
|
;;
|
||||||
dw33d)
|
dw33d)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(mtd_get_mac_binary art 18)
|
ath10kcal_patch_mac $(mtd_get_mac_binary art 0x12)
|
||||||
;;
|
;;
|
||||||
sbr-ac1750)
|
sbr-ac1750)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth1/address) +1)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +1)
|
||||||
;;
|
;;
|
||||||
epg5000|\
|
epg5000|\
|
||||||
esr1750)
|
esr1750)
|
||||||
ath10kcal_extract "caldata" 20480 2116
|
ath10kcal_extract "caldata" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
||||||
;;
|
;;
|
||||||
gl-ar750s|\
|
gl-ar750s|\
|
||||||
gl-ar750|\
|
gl-ar750|\
|
||||||
tl-wpa8630)
|
tl-wpa8630)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
||||||
;;
|
;;
|
||||||
koala)
|
koala)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 12) +0)
|
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0xc) +0)
|
||||||
;;
|
;;
|
||||||
mc-mac1200r)
|
mc-mac1200r)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
|
||||||
;;
|
;;
|
||||||
r6100)
|
r6100)
|
||||||
ath10kcal_extract "caldata" 20480 2116
|
ath10kcal_extract "caldata" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2)
|
||||||
;;
|
;;
|
||||||
rb-952ui-5ac2nd|\
|
rb-952ui-5ac2nd|\
|
||||||
rb-wapg-5hact2hnd)
|
rb-wapg-5hact2hnd)
|
||||||
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116
|
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 0x5000 0x844
|
||||||
;;
|
;;
|
||||||
re355|\
|
re355|\
|
||||||
re450|\
|
re450|\
|
||||||
tl-wr902ac-v1)
|
tl-wr902ac-v1)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
||||||
;;
|
;;
|
||||||
unifiac-lite|\
|
unifiac-lite|\
|
||||||
unifiac-pro)
|
unifiac-pro)
|
||||||
ath10kcal_extract "EEPROM" 20480 2116
|
ath10kcal_extract "EEPROM" 0x5000 0x844
|
||||||
;;
|
;;
|
||||||
wi2a-ac200i)
|
wi2a-ac200i)
|
||||||
ath10kcal_extract "ART" 20480 2116
|
ath10kcal_extract "ART" 0x5000 0x844
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -184,25 +145,25 @@ case "$FIRMWARE" in
|
|||||||
case $board in
|
case $board in
|
||||||
archer-c5|\
|
archer-c5|\
|
||||||
archer-c7)
|
archer-c7)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
|
||||||
;;
|
;;
|
||||||
nbg6616|\
|
nbg6616|\
|
||||||
nbg6716)
|
nbg6716)
|
||||||
ath10kcal_extract "RFdata" 20480 2116
|
ath10kcal_extract "RFdata" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
|
||||||
;;
|
;;
|
||||||
om5p-ac)
|
om5p-ac)
|
||||||
ath10kcal_extract "ART" 20480 2116
|
ath10kcal_extract "ART" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
|
||||||
;;
|
;;
|
||||||
rb-911g-5hpacd|\
|
rb-911g-5hpacd|\
|
||||||
rb-921gs-5hpacd-r2|\
|
rb-921gs-5hpacd-r2|\
|
||||||
rb-962uigs-5hact2hnt)
|
rb-962uigs-5hact2hnt)
|
||||||
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116
|
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 0x5000 0x844
|
||||||
;;
|
;;
|
||||||
wlr8100)
|
wlr8100)
|
||||||
ath10kcal_extract "art" 20480 2116
|
ath10kcal_extract "art" 0x5000 0x844
|
||||||
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
|
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -213,24 +174,29 @@ case "$FIRMWARE" in
|
|||||||
archer-c59-v1|\
|
archer-c59-v1|\
|
||||||
archer-c59-v2|\
|
archer-c59-v2|\
|
||||||
archer-c60-v1|\
|
archer-c60-v1|\
|
||||||
archer-c60-v2|\
|
|
||||||
cf-e355ac-v2|\
|
cf-e355ac-v2|\
|
||||||
cf-e375ac)
|
cf-e375ac)
|
||||||
ath10kcal_extract "art" 20480 12064
|
ath10kcal_extract "art" 0x5000 0x2f20
|
||||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||||
;;
|
;;
|
||||||
|
archer-c60-v2)
|
||||||
|
ath10kcal_extract "art" 0x5000 0x2f20
|
||||||
|
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||||
|
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||||
|
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
||||||
|
;;
|
||||||
cf-e385ac)
|
cf-e385ac)
|
||||||
ath10kcal_extract "art" 20480 12064
|
ath10kcal_extract "art" 0x5000 0x2f20
|
||||||
;;
|
;;
|
||||||
k2t)
|
k2t)
|
||||||
ath10kcal_extract "art" 20480 12064
|
ath10kcal_extract "art" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) +2)
|
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) +2)
|
||||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||||
;;
|
;;
|
||||||
tl-wdr6500-v6)
|
tl-wdr6500-v6)
|
||||||
ath10kcal_extract "art" 8192 12064
|
ath10kcal_extract "art" 0x2000 0x2f20
|
||||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||||
;;
|
;;
|
||||||
|
@ -17,7 +17,7 @@ case "$board" in
|
|||||||
archer-c59-v2|\
|
archer-c59-v2|\
|
||||||
archer-c60-v1|\
|
archer-c60-v1|\
|
||||||
archer-c60-v2)
|
archer-c60-v2)
|
||||||
echo $(macaddr_add $(mtd_get_mac_binary mac 8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
|
echo $(macaddr_add $(mtd_get_mac_binary mac 0x8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
|
||||||
;;
|
;;
|
||||||
tl-wdr6500-v6)
|
tl-wdr6500-v6)
|
||||||
echo $(macaddr_add $(mtd_get_mac_binary art 2061) $(($PHYNBR - 2)) ) > /sys${DEVPATH}/macaddress
|
echo $(macaddr_add $(mtd_get_mac_binary art 2061) $(($PHYNBR - 2)) ) > /sys${DEVPATH}/macaddress
|
||||||
@ -25,4 +25,3 @@ case "$board" in
|
|||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
devdir=$(dirname $DEVPATH)
|
devdir=$(dirname $DEVPATH)
|
||||||
devdir=$(dirname $devdir)
|
devdir=$(dirname $devdir)
|
||||||
phydir=/sys$devdir/ieee80211
|
phydir=/sys$devdir/ieee80211
|
||||||
|
|
||||||
|
[ -d $phydir ] || exit 0
|
||||||
|
|
||||||
phyname=$(cat $phydir/phy*/name)
|
phyname=$(cat $phydir/phy*/name)
|
||||||
|
|
||||||
[ -z $phyname -o $ACTION != "add" ] && exit 0
|
[ -z $phyname -o $ACTION != "add" ] && exit 0
|
||||||
|
@ -24,7 +24,7 @@ preinit_set_mac_address() {
|
|||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
c-55|\
|
c-55|\
|
||||||
c-60)
|
c-60)
|
||||||
mac_lan=$(mtd_get_mac_binary art 0)
|
mac_lan=$(mtd_get_mac_binary art 0x0)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
;;
|
;;
|
||||||
dir-615-c1|\
|
dir-615-c1|\
|
||||||
@ -40,28 +40,28 @@ preinit_set_mac_address() {
|
|||||||
;;
|
;;
|
||||||
mr18|\
|
mr18|\
|
||||||
z1)
|
z1)
|
||||||
mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
|
mac_lan=$(mtd_get_mac_binary_ubi board-config 0x66)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
;;
|
;;
|
||||||
r6100)
|
r6100)
|
||||||
mac_lan=$(mtd_get_mac_binary caldata 0)
|
mac_lan=$(mtd_get_mac_binary caldata 0x0)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
|
||||||
mac_wan=$(mtd_get_mac_binary caldata 6)
|
mac_wan=$(mtd_get_mac_binary caldata 0x6)
|
||||||
[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
|
[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
|
||||||
;;
|
;;
|
||||||
rambutan)
|
rambutan)
|
||||||
mac_lan=$(mtd_get_mac_binary art 0)
|
mac_lan=$(mtd_get_mac_binary art 0x0)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
|
||||||
mac_wan=$(mtd_get_mac_binary art 6)
|
mac_wan=$(mtd_get_mac_binary art 0x6)
|
||||||
[ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
|
[ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
|
||||||
;;
|
;;
|
||||||
wrt160nl)
|
wrt160nl)
|
||||||
fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
|
fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
|
||||||
;;
|
;;
|
||||||
sbr-ac1750)
|
sbr-ac1750)
|
||||||
mac_lan=$(mtd_get_mac_binary ft 0)
|
mac_lan=$(mtd_get_mac_binary ft 0x0)
|
||||||
[ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
|
[ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
|
||||||
mac_wan=$(mtd_get_mac_binary ft 18)
|
mac_wan=$(mtd_get_mac_binary ft 0x12)
|
||||||
[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
|
[ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -11,11 +11,6 @@ board=$(board_name)
|
|||||||
boardname="${board##*,}"
|
boardname="${board##*,}"
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
p2w,r619ac |\
|
|
||||||
p2w,r619ac-128m)
|
|
||||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "r619ac:blue:wlan2g" "phy0tpt"
|
|
||||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "r619ac:blue:wlan5g" "phy1tpt"
|
|
||||||
;;
|
|
||||||
asus,rt-ac58u)
|
asus,rt-ac58u)
|
||||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2G" "phy0tpt"
|
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2G" "phy0tpt"
|
||||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5G" "phy1tpt"
|
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5G" "phy1tpt"
|
||||||
@ -46,15 +41,20 @@ engenius,eap1300)
|
|||||||
glinet,gl-b1300)
|
glinet,gl-b1300)
|
||||||
ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wlan" "phy0tpt"
|
ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wlan" "phy0tpt"
|
||||||
;;
|
;;
|
||||||
|
hugo,ac1200)
|
||||||
|
ucidef_set_led_default "green" "GREEN" "${boardname}:green:ctrl1" "1"
|
||||||
|
ucidef_set_led_default "red" "RED" "${boardname}:red:ctrl2" "1"
|
||||||
|
ucidef_set_led_default "blue" "BLUE" "${boardname}:blue:ctrl3" "1"
|
||||||
|
;;
|
||||||
netgear,ex6100v2 |\
|
netgear,ex6100v2 |\
|
||||||
netgear,ex6150v2)
|
netgear,ex6150v2)
|
||||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "ex61x0v2:green:router" "phy0tpt"
|
ucidef_set_led_wlan "wlan2g" "WLAN2G" "ex61x0v2:green:router" "phy0tpt"
|
||||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "ex61x0v2:green:client" "phy1tpt"
|
ucidef_set_led_wlan "wlan5g" "WLAN5G" "ex61x0v2:green:client" "phy1tpt"
|
||||||
;;
|
;;
|
||||||
hugo,ac1200)
|
p2w,r619ac |\
|
||||||
ucidef_set_led_default "green" "GREEN" "${boardname}:green:ctrl1" "1"
|
p2w,r619ac-128m)
|
||||||
ucidef_set_led_default "red" "RED" "${boardname}:red:ctrl2" "1"
|
ucidef_set_led_wlan "wlan2g" "WLAN2G" "r619ac:blue:wlan2g" "phy0tpt"
|
||||||
ucidef_set_led_default "blue" "BLUE" "${boardname}:blue:ctrl3" "1"
|
ucidef_set_led_wlan "wlan5g" "WLAN5G" "r619ac:blue:wlan5g" "phy1tpt"
|
||||||
;;
|
;;
|
||||||
zyxel,nbg6617)
|
zyxel,nbg6617)
|
||||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2G" "phy0tpt"
|
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:green:wlan2G" "phy0tpt"
|
||||||
|
@ -16,24 +16,20 @@ ipq40xx_setup_interfaces()
|
|||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0t@eth0" "4:lan" "5:wan"
|
"0t@eth0" "4:lan" "5:wan"
|
||||||
;;
|
;;
|
||||||
p2w,r619ac|\
|
|
||||||
p2w,r619ac-128m|\
|
|
||||||
zyxel,nbg6617)
|
|
||||||
ucidef_add_switch "switch0" \
|
|
||||||
"0t@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan:5"
|
|
||||||
;;
|
|
||||||
asus,map-ac2200|\
|
asus,map-ac2200|\
|
||||||
openmesh,a42|\
|
openmesh,a42|\
|
||||||
openmesh,a62)
|
openmesh,a62)
|
||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0t@eth0" "5:lan" "4:wan"
|
"0t@eth0" "5:lan" "4:wan"
|
||||||
;;
|
;;
|
||||||
hugo,ac1200)
|
asus,rt-ac58u|\
|
||||||
|
p2w,r619ac|\
|
||||||
|
p2w,r619ac-128m|\
|
||||||
|
zyxel,nbg6617)
|
||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0t@eth0" "5:wan" "3:lan"
|
"0t@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
|
||||||
;;
|
;;
|
||||||
asus,rt-acrh17|\
|
asus,rt-acrh17|\
|
||||||
asus,rt-ac58u|\
|
|
||||||
avm,fritzbox-4040|\
|
avm,fritzbox-4040|\
|
||||||
linksys,ea6350v3)
|
linksys,ea6350v3)
|
||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
@ -53,6 +49,10 @@ ipq40xx_setup_interfaces()
|
|||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0t@eth0" "3:lan" "4:lan" "5:wan"
|
"0t@eth0" "3:lan" "4:lan" "5:wan"
|
||||||
;;
|
;;
|
||||||
|
hugo,ac1200)
|
||||||
|
ucidef_add_switch "switch0" \
|
||||||
|
"0t@eth0" "5:wan" "3:lan"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported hardware. Network interfaces not initialized"
|
echo "Unsupported hardware. Network interfaces not initialized"
|
||||||
;;
|
;;
|
||||||
@ -62,6 +62,9 @@ ipq40xx_setup_interfaces()
|
|||||||
ipq40xx_setup_macs()
|
ipq40xx_setup_macs()
|
||||||
{
|
{
|
||||||
local board="$1"
|
local board="$1"
|
||||||
|
local lan_mac=""
|
||||||
|
local wan_mac=""
|
||||||
|
local label_mac=""
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
asus,rt-acrh17|\
|
asus,rt-acrh17|\
|
||||||
@ -81,8 +84,9 @@ ipq40xx_setup_macs()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
||||||
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
||||||
|
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
||||||
}
|
}
|
||||||
|
|
||||||
board_config_update
|
board_config_update
|
||||||
|
@ -1,126 +1,38 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# xor multiple hex values of the same length
|
|
||||||
xor() {
|
|
||||||
local val
|
|
||||||
local ret="0x$1"
|
|
||||||
local retlen=${#1}
|
|
||||||
|
|
||||||
shift
|
|
||||||
while [ -n "$1" ]; do
|
|
||||||
val="0x$1"
|
|
||||||
ret=$((ret ^ val))
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "%0${retlen}x" "$ret"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_die() {
|
|
||||||
echo "ath10cal: " "$*"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local mtd
|
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
|
||||||
[ -n "$mtd" ] || \
|
|
||||||
ath10kcal_die "no mtd device found for partition $part"
|
|
||||||
|
|
||||||
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
|
||||||
ath10kcal_die "failed to extract calibration data from $mtd"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_ubi_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local ubidev
|
|
||||||
local ubi
|
|
||||||
|
|
||||||
. /lib/upgrade/nand.sh
|
|
||||||
|
|
||||||
ubidev=$(nand_find_ubi $CI_UBIPART)
|
|
||||||
ubi=$(nand_find_volume $ubidev $part)
|
|
||||||
[ -n "$ubi" ] || \
|
|
||||||
ath10kcal_die "no UBI volume found for $part"
|
|
||||||
|
|
||||||
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
|
||||||
ath10kcal_die "failed to extract from $ubi"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_patch_mac_crc() {
|
|
||||||
local mac=$1
|
|
||||||
local mac_offset=6
|
|
||||||
local chksum_offset=2
|
|
||||||
local xor_mac
|
|
||||||
local xor_fw_mac
|
|
||||||
local xor_fw_chksum
|
|
||||||
|
|
||||||
[ -z "$mac" ] && return
|
|
||||||
|
|
||||||
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
|
||||||
|
|
||||||
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
|
|
||||||
|
|
||||||
xor_mac=${mac//:/}
|
|
||||||
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
|
||||||
|
|
||||||
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
|
||||||
|
|
||||||
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
|
||||||
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_is_caldata_valid() {
|
|
||||||
local expected="$1"
|
|
||||||
|
|
||||||
magic=$(hexdump -v -n 2 -e '1/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
[[ "$magic" == "$expected" ]]
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions/caldata.sh
|
||||||
. /lib/functions/system.sh
|
|
||||||
|
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
|
|
||||||
|
|
||||||
case "$FIRMWARE" in
|
case "$FIRMWARE" in
|
||||||
"ath10k/cal-pci-0000:01:00.0.bin")
|
"ath10k/cal-pci-0000:01:00.0.bin")
|
||||||
case "$board" in
|
case "$board" in
|
||||||
meraki,mr33)
|
meraki,mr33)
|
||||||
ath10kcal_ubi_extract "ART" 36864 2116
|
caldata_extract_ubi "ART" 0x9000 0x844
|
||||||
ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 36864 2116
|
caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +1)
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
||||||
case "$board" in
|
case "$board" in
|
||||||
asus,map-ac2200)
|
asus,map-ac2200)
|
||||||
ath10kcal_ubi_extract "Factory" 36864 12064
|
caldata_extract_ubi "Factory" 0x9000 0x2f20
|
||||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||||
;;
|
;;
|
||||||
asus,rt-acrh17)
|
asus,rt-acrh17)
|
||||||
CI_UBIPART=UBI_DEV
|
CI_UBIPART=UBI_DEV
|
||||||
ath10kcal_ubi_extract "Factory" 36864 12064
|
caldata_extract_ubi "Factory" 0x9000 0x2f20
|
||||||
;;
|
;;
|
||||||
openmesh,a62)
|
openmesh,a62)
|
||||||
ath10kcal_extract "0:ART" 36864 12064
|
caldata_extract "0:ART" 0x9000 0x2f20
|
||||||
;;
|
;;
|
||||||
p2w,r619ac |\
|
p2w,r619ac |\
|
||||||
p2w,r619ac-128m)
|
p2w,r619ac-128m)
|
||||||
ath10kcal_extract "ART" 36864 12064
|
caldata_extract "ART" 0x9000 0x2f20
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -132,40 +44,40 @@ case "$FIRMWARE" in
|
|||||||
p2w,r619ac |\
|
p2w,r619ac |\
|
||||||
p2w,r619ac-128m |\
|
p2w,r619ac-128m |\
|
||||||
qcom,ap-dk01.1-c1)
|
qcom,ap-dk01.1-c1)
|
||||||
ath10kcal_extract "ART" 4096 12064
|
caldata_extract "ART" 0x1000 0x2f20
|
||||||
;;
|
;;
|
||||||
asus,map-ac2200)
|
asus,map-ac2200)
|
||||||
ath10kcal_ubi_extract "Factory" 4096 12064
|
caldata_extract_ubi "Factory" 0x1000 0x2f20
|
||||||
;;
|
;;
|
||||||
asus,rt-acrh17|\
|
asus,rt-acrh17|\
|
||||||
asus,rt-ac58u)
|
asus,rt-ac58u)
|
||||||
CI_UBIPART=UBI_DEV
|
CI_UBIPART=UBI_DEV
|
||||||
ath10kcal_ubi_extract "Factory" 4096 12064
|
caldata_extract_ubi "Factory" 0x1000 0x2f20
|
||||||
;;
|
;;
|
||||||
avm,fritzbox-4040)
|
avm,fritzbox-4040)
|
||||||
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
||||||
;;
|
;;
|
||||||
meraki,mr33)
|
|
||||||
ath10kcal_ubi_extract "ART" 4096 12064
|
|
||||||
ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 4096 12064
|
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +2)
|
|
||||||
;;
|
|
||||||
netgear,ex6100v2 |\
|
|
||||||
netgear,ex6150v2)
|
|
||||||
ath10kcal_extract "ART" 4096 12064
|
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0)
|
|
||||||
;;
|
|
||||||
compex,wpj428 |\
|
compex,wpj428 |\
|
||||||
engenius,eap1300 |\
|
engenius,eap1300 |\
|
||||||
hugo,ac1200 |\
|
hugo,ac1200 |\
|
||||||
openmesh,a42 |\
|
openmesh,a42 |\
|
||||||
openmesh,a62)
|
openmesh,a62)
|
||||||
ath10kcal_extract "0:ART" 4096 12064
|
caldata_extract "0:ART" 0x1000 0x2f20
|
||||||
|
;;
|
||||||
|
meraki,mr33)
|
||||||
|
caldata_extract_ubi "ART" 0x1000 0x2f20
|
||||||
|
caldata_valid "202f" || caldata_extract 0x1000 0x2f20
|
||||||
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2)
|
||||||
|
;;
|
||||||
|
netgear,ex6100v2 |\
|
||||||
|
netgear,ex6150v2)
|
||||||
|
caldata_extract "ART" 0x1000 0x2f20
|
||||||
|
ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0)
|
||||||
;;
|
;;
|
||||||
zyxel,nbg6617 |\
|
zyxel,nbg6617 |\
|
||||||
zyxel,wre6606)
|
zyxel,wre6606)
|
||||||
ath10kcal_extract "ART" 4096 12064
|
caldata_extract "ART" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -177,39 +89,39 @@ case "$FIRMWARE" in
|
|||||||
p2w,r619ac |\
|
p2w,r619ac |\
|
||||||
p2w,r619ac-128m |\
|
p2w,r619ac-128m |\
|
||||||
qcom,ap-dk01.1-c1)
|
qcom,ap-dk01.1-c1)
|
||||||
ath10kcal_extract "ART" 20480 12064
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
;;
|
;;
|
||||||
asus,map-ac2200)
|
asus,map-ac2200)
|
||||||
ath10kcal_ubi_extract "Factory" 20480 12064
|
caldata_extract "Factory" 0x5000 0x2f20
|
||||||
;;
|
;;
|
||||||
asus,rt-ac58u)
|
asus,rt-ac58u)
|
||||||
CI_UBIPART=UBI_DEV
|
CI_UBIPART=UBI_DEV
|
||||||
ath10kcal_ubi_extract "Factory" 20480 12064
|
caldata_extract_ubi "Factory" 0x5000 0x2f20
|
||||||
;;
|
;;
|
||||||
avm,fritzbox-4040)
|
avm,fritzbox-4040)
|
||||||
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
||||||
;;
|
;;
|
||||||
meraki,mr33)
|
|
||||||
ath10kcal_ubi_extract "ART" 20480 12064
|
|
||||||
ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 20480 12064
|
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +3)
|
|
||||||
;;
|
|
||||||
netgear,ex6100v2 |\
|
|
||||||
netgear,ex6150v2)
|
|
||||||
ath10kcal_extract "ART" 20480 12064
|
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 12)
|
|
||||||
;;
|
|
||||||
compex,wpj428 |\
|
compex,wpj428 |\
|
||||||
engenius,eap1300 |\
|
engenius,eap1300 |\
|
||||||
hugo,ac1200 |\
|
hugo,ac1200 |\
|
||||||
openmesh,a42 |\
|
openmesh,a42 |\
|
||||||
openmesh,a62)
|
openmesh,a62)
|
||||||
ath10kcal_extract "0:ART" 20480 12064
|
caldata_extract "0:ART" 0x5000 0x2f20
|
||||||
|
;;
|
||||||
|
meraki,mr33)
|
||||||
|
caldata_extract_ubi "ART" 0x5000 0x2f20
|
||||||
|
caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
|
||||||
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
|
||||||
|
;;
|
||||||
|
netgear,ex6100v2 |\
|
||||||
|
netgear,ex6150v2)
|
||||||
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
|
ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc)
|
||||||
;;
|
;;
|
||||||
zyxel,nbg6617 |\
|
zyxel,nbg6617 |\
|
||||||
zyxel,wre6606)
|
zyxel,wre6606)
|
||||||
ath10kcal_extract "ART" 20480 12064
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -5,23 +5,24 @@
|
|||||||
preinit_set_mac_address() {
|
preinit_set_mac_address() {
|
||||||
case $(board_name) in
|
case $(board_name) in
|
||||||
asus,map-ac2200)
|
asus,map-ac2200)
|
||||||
base_mac=$(mtd_get_mac_binary_ubi Factory 4102)
|
base_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
|
||||||
ip link set dev eth0 address $(macaddr_add "$base_mac" +1)
|
ip link set dev eth0 address $(macaddr_add "$base_mac" +1)
|
||||||
ip link set dev eth1 address $(macaddr_add "$base_mac" +3)
|
ip link set dev eth1 address $(macaddr_add "$base_mac" +3)
|
||||||
;;
|
;;
|
||||||
asus,rt-acrh17|\
|
asus,rt-acrh17|\
|
||||||
asus,rt-ac58u)
|
asus,rt-ac58u)
|
||||||
CI_UBIPART=UBI_DEV
|
CI_UBIPART=UBI_DEV
|
||||||
mac=$(macaddr_add $(mtd_get_mac_binary_ubi Factory 4102) +1)
|
mac=$(macaddr_add $(mtd_get_mac_binary_ubi Factory 0x1006) +1)
|
||||||
ifconfig eth0 hw ether $mac 2>/dev/null
|
ifconfig eth0 hw ether $mac 2>/dev/null
|
||||||
;;
|
;;
|
||||||
meraki,mr33)
|
meraki,mr33)
|
||||||
mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102)
|
mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66)
|
||||||
[ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan"
|
[ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan"
|
||||||
;;
|
;;
|
||||||
zyxel,nbg6617)
|
zyxel,nbg6617)
|
||||||
base_mac=$(cat /sys/class/net/eth0/address)
|
base_mac=$(cat /sys/class/net/eth0/address)
|
||||||
ip link set dev eth0 address $(macaddr_add "$base_mac" +2)
|
ip link set dev eth0 address $(macaddr_add "$base_mac" +2)
|
||||||
|
ip link set dev eth1 address $(macaddr_add "$base_mac" +3)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,19 @@ define Device/glinet_gl-b1300
|
|||||||
endef
|
endef
|
||||||
TARGET_DEVICES += glinet_gl-b1300
|
TARGET_DEVICES += glinet_gl-b1300
|
||||||
|
|
||||||
|
define Device/hugo_ac1200
|
||||||
|
$(call Device/FitImage)
|
||||||
|
DEVICE_TITLE := Hugo AC1200
|
||||||
|
BOARD_NAME := hugo_ac1200
|
||||||
|
DEVICE_DTS := qcom-ipq4019-hugo-ac1200
|
||||||
|
KERNEL_SIZE := 4096k
|
||||||
|
IMAGE_SIZE := 31232k
|
||||||
|
IMAGES := sysupgrade.bin
|
||||||
|
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
|
||||||
|
DEVICE_PACKAGES := ipq-wifi-hugo_ac1200
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += hugo_ac1200
|
||||||
|
|
||||||
define Device/linksys_ea6350v3
|
define Device/linksys_ea6350v3
|
||||||
# The Linksys EA6350v3 has a uboot bootloader that does not
|
# The Linksys EA6350v3 has a uboot bootloader that does not
|
||||||
# support either booting lzma kernel images nor booting UBI
|
# support either booting lzma kernel images nor booting UBI
|
||||||
@ -260,22 +273,8 @@ define Device/openmesh_a62
|
|||||||
IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
|
IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
|
||||||
DEVICE_PACKAGES := ath10k-firmware-qca9888-ct uboot-envtools
|
DEVICE_PACKAGES := ath10k-firmware-qca9888-ct uboot-envtools
|
||||||
endef
|
endef
|
||||||
|
|
||||||
TARGET_DEVICES += openmesh_a62
|
TARGET_DEVICES += openmesh_a62
|
||||||
|
|
||||||
define Device/qcom_ap-dk01.1-c1
|
|
||||||
DEVICE_TITLE := QCA AP-DK01.1-C1
|
|
||||||
BOARD_NAME := ap-dk01.1-c1
|
|
||||||
DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
|
|
||||||
KERNEL_INSTALL := 1
|
|
||||||
KERNEL_SIZE := 4096k
|
|
||||||
IMAGE_SIZE := 26624k
|
|
||||||
$(call Device/FitImage)
|
|
||||||
IMAGES := sysupgrade.bin
|
|
||||||
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
|
|
||||||
endef
|
|
||||||
TARGET_DEVICES += qcom_ap-dk01.1-c1
|
|
||||||
|
|
||||||
define Device/p2w_r619ac
|
define Device/p2w_r619ac
|
||||||
$(call Device/FitzImage)
|
$(call Device/FitzImage)
|
||||||
$(call Device/UbiFit)
|
$(call Device/UbiFit)
|
||||||
@ -305,6 +304,19 @@ define Device/p2w_r619ac-128m
|
|||||||
endef
|
endef
|
||||||
TARGET_DEVICES += p2w_r619ac-128m
|
TARGET_DEVICES += p2w_r619ac-128m
|
||||||
|
|
||||||
|
define Device/qcom_ap-dk01.1-c1
|
||||||
|
DEVICE_TITLE := QCA AP-DK01.1-C1
|
||||||
|
BOARD_NAME := ap-dk01.1-c1
|
||||||
|
DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1
|
||||||
|
KERNEL_INSTALL := 1
|
||||||
|
KERNEL_SIZE := 4096k
|
||||||
|
IMAGE_SIZE := 26624k
|
||||||
|
$(call Device/FitImage)
|
||||||
|
IMAGES := sysupgrade.bin
|
||||||
|
IMAGE/sysupgrade.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | pad-rootfs | append-metadata
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += qcom_ap-dk01.1-c1
|
||||||
|
|
||||||
define Device/qcom_ap-dk04.1-c1
|
define Device/qcom_ap-dk04.1-c1
|
||||||
$(call Device/FitImage)
|
$(call Device/FitImage)
|
||||||
$(call Device/UbiFit)
|
$(call Device/UbiFit)
|
||||||
@ -318,19 +330,6 @@ define Device/qcom_ap-dk04.1-c1
|
|||||||
endef
|
endef
|
||||||
TARGET_DEVICES += qcom_ap-dk04.1-c1
|
TARGET_DEVICES += qcom_ap-dk04.1-c1
|
||||||
|
|
||||||
define Device/hugo_ac1200
|
|
||||||
$(call Device/FitImage)
|
|
||||||
DEVICE_TITLE := Hugo AC1200
|
|
||||||
BOARD_NAME := hugo_ac1200
|
|
||||||
DEVICE_DTS := qcom-ipq4019-hugo-ac1200
|
|
||||||
KERNEL_SIZE := 4096k
|
|
||||||
IMAGE_SIZE := 31232k
|
|
||||||
IMAGES := sysupgrade.bin
|
|
||||||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
|
|
||||||
DEVICE_PACKAGES := ipq-wifi-hugo_ac1200
|
|
||||||
endef
|
|
||||||
TARGET_DEVICES += hugo_ac1200
|
|
||||||
|
|
||||||
define Device/zyxel_nbg6617
|
define Device/zyxel_nbg6617
|
||||||
$(call Device/FitImageLzma)
|
$(call Device/FitImageLzma)
|
||||||
DEVICE_DTS := qcom-ipq4018-nbg6617
|
DEVICE_DTS := qcom-ipq4018-nbg6617
|
||||||
|
@ -1,78 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# xor multiple hex values of the same length
|
|
||||||
xor() {
|
|
||||||
local val
|
|
||||||
local ret="0x$1"
|
|
||||||
local retlen=${#1}
|
|
||||||
|
|
||||||
shift
|
|
||||||
while [ -n "$1" ]; do
|
|
||||||
val="0x$1"
|
|
||||||
ret=$((ret ^ val))
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "%0${retlen}x" "$ret"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_die() {
|
|
||||||
echo "ath10cal: " "$*"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_from_file() {
|
|
||||||
local source=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
|
|
||||||
dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
|
||||||
ath10kcal_die "failed to extract calibration data from $source"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local mtd
|
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
|
||||||
[ -n "$mtd" ] || \
|
|
||||||
ath10kcal_die "no mtd device found for partition $part"
|
|
||||||
|
|
||||||
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
|
||||||
ath10kcal_die "failed to extract calibration data from $mtd"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10kcal_patch_mac_crc() {
|
|
||||||
local mac=$1
|
|
||||||
local mac_offset=6
|
|
||||||
local chksum_offset=2
|
|
||||||
local xor_mac
|
|
||||||
local xor_fw_mac
|
|
||||||
local xor_fw_chksum
|
|
||||||
|
|
||||||
[ -z "$mac" ] && return
|
|
||||||
|
|
||||||
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
|
||||||
|
|
||||||
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
|
|
||||||
|
|
||||||
xor_mac=${mac//:/}
|
|
||||||
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
|
||||||
|
|
||||||
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
|
||||||
|
|
||||||
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
|
||||||
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions/caldata.sh
|
||||||
. /lib/functions/system.sh
|
|
||||||
|
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
|
|
||||||
@ -80,68 +10,68 @@ case "$FIRMWARE" in
|
|||||||
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
||||||
case $board in
|
case $board in
|
||||||
buffalo,wxr-2533dhp)
|
buffalo,wxr-2533dhp)
|
||||||
ath10kcal_extract "ART" 4096 12064
|
caldata_extract "ART" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 30)
|
ath10k_patch_mac $(mtd_get_mac_binary ART 0x1e)
|
||||||
;;
|
;;
|
||||||
linksys,ea8500)
|
linksys,ea8500)
|
||||||
ath10kcal_extract "art" 4096 12064
|
caldata_extract "art" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1)
|
||||||
;;
|
;;
|
||||||
nec,wg2600hp)
|
nec,wg2600hp)
|
||||||
ath10kcal_extract "ART" 4096 12064
|
caldata_extract "ART" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 12) +1)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 0xc) +1)
|
||||||
;;
|
;;
|
||||||
netgear,d7800 |\
|
netgear,d7800 |\
|
||||||
netgear,r7500v2 |\
|
netgear,r7500v2 |\
|
||||||
netgear,r7800)
|
netgear,r7800)
|
||||||
ath10kcal_extract "art" 4096 12064
|
caldata_extract "art" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 6) +1)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) +1)
|
||||||
;;
|
;;
|
||||||
tplink,c2600)
|
tplink,c2600)
|
||||||
ath10kcal_extract "radio" 4096 12064
|
caldata_extract "radio" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 8) -1)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 0x8) -1)
|
||||||
;;
|
;;
|
||||||
tplink,vr2600v)
|
tplink,vr2600v)
|
||||||
ath10kcal_extract "ART" 4096 12064
|
caldata_extract "ART" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0) -1)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 0x0) -1)
|
||||||
;;
|
;;
|
||||||
zyxel,nbg6817)
|
zyxel,nbg6817)
|
||||||
ath10kcal_extract "0:ART" 4096 12064
|
caldata_extract "0:ART" 0x1000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"ath10k/pre-cal-pci-0001:01:00.0.bin")
|
"ath10k/pre-cal-pci-0001:01:00.0.bin")
|
||||||
case $board in
|
case $board in
|
||||||
buffalo,wxr-2533dhp)
|
buffalo,wxr-2533dhp)
|
||||||
ath10kcal_extract "ART" 20480 12064
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 24)
|
ath10k_patch_mac $(mtd_get_mac_binary ART 0x18)
|
||||||
;;
|
;;
|
||||||
linksys,ea8500)
|
linksys,ea8500)
|
||||||
ath10kcal_extract "art" 20480 12064
|
caldata_extract "art" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2)
|
||||||
;;
|
;;
|
||||||
nec,wg2600hp)
|
nec,wg2600hp)
|
||||||
ath10kcal_extract "ART" 20480 12064
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary PRODUCTDATA 12)
|
ath10k_patch_mac $(mtd_get_mac_binary PRODUCTDATA 0xc)
|
||||||
;;
|
;;
|
||||||
netgear,d7800 |\
|
netgear,d7800 |\
|
||||||
netgear,r7500v2 |\
|
netgear,r7500v2 |\
|
||||||
netgear,r7800)
|
netgear,r7800)
|
||||||
ath10kcal_extract "art" 20480 12064
|
caldata_extract "art" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 6) +2)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) +2)
|
||||||
;;
|
;;
|
||||||
tplink,c2600)
|
tplink,c2600)
|
||||||
ath10kcal_extract "radio" 20480 12064
|
caldata_extract "radio" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 8)
|
ath10k_patch_mac $(mtd_get_mac_binary default-mac 0x8)
|
||||||
;;
|
;;
|
||||||
tplink,vr2600v)
|
tplink,vr2600v)
|
||||||
ath10kcal_extract "ART" 20480 12064
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0)
|
ath10k_patch_mac $(mtd_get_mac_binary default-mac 0x0)
|
||||||
;;
|
;;
|
||||||
zyxel,nbg6817)
|
zyxel,nbg6817)
|
||||||
ath10kcal_extract "0:ART" 20480 12064
|
caldata_extract "0:ART" 0x5000 0x2f20
|
||||||
ath10kcal_patch_mac_crc $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
|
ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -29,4 +29,3 @@ set_ether_mac() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add preinit_main set_ether_mac
|
boot_hook_add preinit_main set_ether_mac
|
||||||
|
|
||||||
|
@ -3,47 +3,18 @@
|
|||||||
|
|
||||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions/caldata.sh
|
||||||
. /lib/functions/system.sh
|
|
||||||
. /lib/upgrade/nand.sh
|
|
||||||
|
|
||||||
ath10k_caldata_die() {
|
|
||||||
echo "ath10k caldata: " "$*"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10k_caldata_extract_ubi() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
|
||||||
local ubi
|
|
||||||
|
|
||||||
ubi=$(nand_find_volume $ubidev $part)
|
|
||||||
[ -n "$ubi" ] || \
|
|
||||||
ath10k_caldata_die "no UBI volume found for $part"
|
|
||||||
|
|
||||||
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
|
||||||
ath10k_caldata_die "failed to extract from $ubi"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath10k_caldata_set_macaddr() {
|
|
||||||
local macaddr=$1
|
|
||||||
|
|
||||||
macaddr_2bin $macaddr | dd of=/lib/firmware/$FIRMWARE \
|
|
||||||
conv=notrunc bs=1 seek=6 count=6
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$FIRMWARE" in
|
case "$FIRMWARE" in
|
||||||
"ath10k/cal-pci-0000:02:00.0.bin")
|
"ath10k/cal-pci-0000:02:00.0.bin")
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
case $board in
|
case $board in
|
||||||
bt,homehub-v5a)
|
bt,homehub-v5a)
|
||||||
ath10k_caldata_extract_ubi "caldata" 20480 2116
|
caldata_extract_ubi "caldata" 0x5000 0x844
|
||||||
ath10k_caldata_set_macaddr $(macaddr_add $(mtd_get_mac_binary_ubi caldata 4364) +3)
|
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +3)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath10k_caldata_die "board $board is not supported yet"
|
caldata_die "board $board is not supported yet"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -1,130 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Based on ar71xx 10-ath9k-eeprom
|
|
||||||
|
|
||||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions/caldata.sh
|
||||||
. /lib/functions/system.sh
|
|
||||||
. /lib/upgrade/nand.sh
|
|
||||||
|
|
||||||
# xor multiple hex values of the same length
|
caldata_extract_swap() {
|
||||||
xor() {
|
|
||||||
local val
|
|
||||||
local ret="0x$1"
|
|
||||||
local retlen=${#1}
|
|
||||||
|
|
||||||
shift
|
|
||||||
while [ -n "$1" ]; do
|
|
||||||
val="0x$1"
|
|
||||||
ret=$((ret ^ val))
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "%0${retlen}x" "$ret"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_eeprom_die() {
|
|
||||||
echo "ath9k eeprom: $*"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_eeprom_extract_raw() {
|
|
||||||
local source=$1
|
|
||||||
local offset=$2
|
|
||||||
local swap=$3
|
|
||||||
local size=4096
|
|
||||||
local bs=1
|
|
||||||
local conv=
|
|
||||||
|
|
||||||
if [ $swap -gt 0 ]; then
|
|
||||||
bs=2
|
|
||||||
conv="conv=swab"
|
|
||||||
size=$((size / bs))
|
|
||||||
offset=$((offset / bs))
|
|
||||||
fi
|
|
||||||
|
|
||||||
dd if=$source of=/lib/firmware/$FIRMWARE bs=$bs skip=$offset count=$size $conv 2>/dev/null || \
|
|
||||||
ath9k_eeprom_die "failed to extract from $mtd"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_eeprom_extract_reverse() {
|
|
||||||
local part=$1
|
local part=$1
|
||||||
local offset=$2
|
local offset=$2
|
||||||
local count=$3
|
local count=$3
|
||||||
local mtd
|
local mtd
|
||||||
local reversed
|
|
||||||
local caldata
|
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev "$part")
|
|
||||||
reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
|
|
||||||
|
|
||||||
for byte in $reversed; do
|
|
||||||
caldata="\x${byte}${caldata}"
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_eeprom_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local swap=$3
|
|
||||||
local mtd
|
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
mtd=$(find_mtd_chardev $part)
|
||||||
[ -n "$mtd" ] || \
|
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
|
||||||
ath9k_eeprom_die "no mtd device found for partition $part"
|
|
||||||
|
|
||||||
ath9k_eeprom_extract_raw $mtd $offset $swap
|
offset=$(($offset / 2))
|
||||||
}
|
count=$(($count / 2))
|
||||||
|
|
||||||
ath9k_ubi_eeprom_extract() {
|
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=2 skip=$offset count=$count conv=swab 2>/dev/null || \
|
||||||
local part=$1
|
caldata_die "failed to extract calibration data from $mtd"
|
||||||
local offset=$2
|
|
||||||
local swap=$3
|
|
||||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
|
||||||
local ubi
|
|
||||||
|
|
||||||
ubi=$(nand_find_volume $ubidev $part)
|
|
||||||
[ -n "$ubi" ] || \
|
|
||||||
ath9k_eeprom_die "no UBI volume found for $part"
|
|
||||||
|
|
||||||
ath9k_eeprom_extract_raw /dev/$ubi $offset $swap
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_patch_fw_mac_crc() {
|
|
||||||
local mac=$1
|
|
||||||
local mac_offset=$2
|
|
||||||
local chksum_offset=$((mac_offset - 10))
|
|
||||||
|
|
||||||
ath9k_patch_fw_mac "${mac}" "${mac_offset}" "${chksum_offset}"
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_patch_fw_mac() {
|
|
||||||
local mac=$1
|
|
||||||
local mac_offset=$2
|
|
||||||
local chksum_offset=$3
|
|
||||||
local xor_mac
|
|
||||||
local xor_fw_mac
|
|
||||||
local xor_fw_chksum
|
|
||||||
|
|
||||||
[ -z "$mac" -o -z "$mac_offset" ] && return
|
|
||||||
|
|
||||||
[ -n "$chksum_offset" ] && {
|
|
||||||
xor_mac=${mac//:/}
|
|
||||||
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
|
||||||
|
|
||||||
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
|
||||||
|
|
||||||
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
||||||
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
|
||||||
|
|
||||||
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
|
||||||
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
|
|
||||||
}
|
|
||||||
|
|
||||||
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$mac_offset count=6
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$FIRMWARE" in
|
case "$FIRMWARE" in
|
||||||
@ -135,43 +28,43 @@ case "$FIRMWARE" in
|
|||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
arcadyan,arv7518pw)
|
arcadyan,arv7518pw)
|
||||||
ath9k_eeprom_extract "boardconfig" 1024 1
|
caldata_extract_swap "boardconfig" 0x400 0x1000
|
||||||
;;
|
;;
|
||||||
arcadyan,arv8539pw22)
|
arcadyan,arv8539pw22)
|
||||||
ath9k_eeprom_extract "art" 1024 1
|
caldata_extract_swap "art" 0x400 0x1000
|
||||||
;;
|
;;
|
||||||
bt,homehub-v2b)
|
bt,homehub-v2b)
|
||||||
ath9k_eeprom_extract "art" 0 1
|
caldata_extract_swap "art" 0x0 0x1000
|
||||||
ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 524
|
ath9k_patch_mac_crc "00:00:00:00:00:00" 0x20c
|
||||||
;;
|
;;
|
||||||
bt,homehub-v3a)
|
bt,homehub-v3a)
|
||||||
ath9k_eeprom_extract "art-copy" 0 1
|
caldata_extract_swap "art-copy" 0x0 0x1000
|
||||||
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 268
|
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 0x10c
|
||||||
;;
|
;;
|
||||||
bt,homehub-v5a)
|
bt,homehub-v5a)
|
||||||
ath9k_ubi_eeprom_extract "caldata" 4096 0
|
caldata_extract_ubi "caldata" 0x1000 0x1000
|
||||||
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 4364) +2) 268
|
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +2) 0x10c
|
||||||
;;
|
;;
|
||||||
netgear,dgn3500|netgear,dgn3500b)
|
netgear,dgn3500|netgear,dgn3500b)
|
||||||
ath9k_eeprom_extract "calibration" 61440 0
|
caldata_extract "calibration" 0xf000 0x1000
|
||||||
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524
|
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 0x20c
|
||||||
;;
|
;;
|
||||||
avm,fritz3370-rev2-hynix|\
|
avm,fritz3370-rev2-hynix|\
|
||||||
avm,fritz3370-rev2-micron|\
|
avm,fritz3370-rev2-micron|\
|
||||||
avm,fritz7362sl)
|
avm,fritz7362sl)
|
||||||
ath9k_eeprom_extract_reverse "urlader" 5441 1088
|
caldata_extract_reverse "urlader" 0x1541 0x440
|
||||||
;;
|
;;
|
||||||
avm,fritz7312|avm,fritz7320|avm,fritz7360sl)
|
avm,fritz7312|avm,fritz7320|avm,fritz7360sl)
|
||||||
ath9k_eeprom_extract "urlader" 2437 0
|
caldata_extract "urlader" 0x985 0x1000
|
||||||
;;
|
;;
|
||||||
avm,fritz7412)
|
avm,fritz7412)
|
||||||
/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
|
/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
|
||||||
;;
|
;;
|
||||||
tplink,tdw8970|tplink,tdw8980)
|
tplink,tdw8970|tplink,tdw8980)
|
||||||
ath9k_eeprom_extract "boardconfig" 135168 0
|
caldata_extract "boardconfig" 0x21000 0x1000
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
caldata_die "board $board is not supported yet"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -3,37 +3,7 @@
|
|||||||
# Copyright (C) 2013 OpenWrt.org
|
# Copyright (C) 2013 OpenWrt.org
|
||||||
#
|
#
|
||||||
|
|
||||||
LED_OPTIONS_CHANGED=0
|
. /lib/functions/migrations.sh
|
||||||
|
|
||||||
. /lib/functions.sh
|
|
||||||
|
|
||||||
do_led_update_sysfs()
|
|
||||||
{
|
|
||||||
local cfg=$1; shift
|
|
||||||
local tuples="$@"
|
|
||||||
local sysfs
|
|
||||||
local name
|
|
||||||
|
|
||||||
config_get sysfs $cfg sysfs
|
|
||||||
config_get name $cfg name
|
|
||||||
|
|
||||||
[ -z "$sysfs" ] && return
|
|
||||||
|
|
||||||
for tuple in $tuples; do
|
|
||||||
local old=${tuple%=*}
|
|
||||||
local new=${tuple#*=}
|
|
||||||
local new_sysfs
|
|
||||||
|
|
||||||
new_sysfs=$(echo ${sysfs} | sed "s/${old}/${new}/")
|
|
||||||
|
|
||||||
[ "$new_sysfs" = "$sysfs" ] && continue
|
|
||||||
|
|
||||||
uci set system.${cfg}.sysfs="${new_sysfs}"
|
|
||||||
LED_OPTIONS_CHANGED=1
|
|
||||||
|
|
||||||
logger -t led-migration "sysfs option of LED \"${name}\" updated to ${new_sysfs}"
|
|
||||||
done;
|
|
||||||
}
|
|
||||||
|
|
||||||
do_internet_led_rename()
|
do_internet_led_rename()
|
||||||
{
|
{
|
||||||
@ -45,38 +15,29 @@ do_internet_led_rename()
|
|||||||
uci rename system.led_internet=led_dsl
|
uci rename system.led_internet=led_dsl
|
||||||
uci set system.led_dsl.name=dsl
|
uci set system.led_dsl.name=dsl
|
||||||
|
|
||||||
LED_OPTIONS_CHANGED=1
|
|
||||||
logger -t led-migration "internet led renamed to dsl"
|
logger -t led-migration "internet led renamed to dsl"
|
||||||
}
|
}
|
||||||
|
|
||||||
migrate_leds()
|
|
||||||
{
|
|
||||||
config_load system
|
|
||||||
config_foreach do_led_update_sysfs led "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$(board_name)" in
|
case "$(board_name)" in
|
||||||
|
alphanetworks,asl56026|\
|
||||||
arcadyan,arv452cqw|\
|
arcadyan,arv452cqw|\
|
||||||
arcadyan,arv7510pw22|\
|
arcadyan,arv7510pw22|\
|
||||||
arcadyan,arv7519rw22|\
|
arcadyan,arv7519rw22|\
|
||||||
arcadyan,arv752dpw|\
|
arcadyan,arv752dpw|\
|
||||||
arcadyan,arv752dpw22|\
|
arcadyan,arv752dpw22|\
|
||||||
alphanetworks,asl56026|\
|
arcadyan,vg3503j|\
|
||||||
|
avm,fritz7360sl|\
|
||||||
bt,homehub-v2b|\
|
bt,homehub-v2b|\
|
||||||
bt,homehub-v3a|\
|
bt,homehub-v3a|\
|
||||||
bt,homehub-v5a|\
|
bt,homehub-v5a)
|
||||||
avm,fritz7360sl|\
|
|
||||||
arcadyan,vg3503j)
|
|
||||||
do_internet_led_rename
|
do_internet_led_rename
|
||||||
;;
|
;;
|
||||||
netgear,dgn3500|\
|
netgear,dgn3500|\
|
||||||
netgear,dgn3500b)
|
netgear,dgn3500b)
|
||||||
migrate_leds "dgn3500:blue:wireless=dgn3500:green:wireless"
|
migrate_leds "dgn3500:blue:wireless=dgn3500:green:wireless"
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ "$LED_OPTIONS_CHANGED" = "1" ] && uci commit system
|
migrations_apply system
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
. /lib/functions/lantiq.sh
|
|
||||||
|
|
||||||
IFNAME_CHANGED=0
|
IFNAME_CHANGED=0
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. /lib/functions/lantiq.sh
|
|
||||||
|
|
||||||
set_preinit_iface() {
|
set_preinit_iface() {
|
||||||
ifname=eth0
|
ifname=eth0
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add preinit_main set_preinit_iface
|
boot_hook_add preinit_main set_preinit_iface
|
||||||
|
|
||||||
|
@ -1,41 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
FW_FILE="/lib/firmware/$FIRMWARE"
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||||
|
|
||||||
ath9k_eeprom_die() {
|
. /lib/functions/caldata.sh
|
||||||
echo "ath9k eeprom: " "$*" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ath9k_eeprom_extract() {
|
|
||||||
local part=$1
|
|
||||||
local offset=$2
|
|
||||||
local count=$3
|
|
||||||
local mtd
|
|
||||||
|
|
||||||
mtd=$(find_mtd_chardev $part)
|
|
||||||
[ -n "$mtd" ] || \
|
|
||||||
ath9k_eeprom_die "no mtd device found for partition $part"
|
|
||||||
|
|
||||||
dd if=$mtd bs=$offset skip=1 count=1 2>/dev/null | dd of=$FW_FILE bs=$count count=1 2>/dev/null || \
|
|
||||||
ath9k_eeprom_die "failed to extract from $mtd"
|
|
||||||
}
|
|
||||||
|
|
||||||
tpl_set_wireless_mac()
|
|
||||||
{
|
|
||||||
local offset=$1
|
|
||||||
local mac
|
|
||||||
|
|
||||||
mac=$(mtd_get_mac_binary u-boot 326656)
|
|
||||||
mac=$(macaddr_add $mac $offset)
|
|
||||||
|
|
||||||
macaddr_2bin $mac | dd bs=1 count=6 seek=2 conv=notrunc of=$FW_FILE 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -e $FW_FILE ] && exit 0
|
|
||||||
|
|
||||||
. /lib/functions.sh
|
|
||||||
. /lib/functions/system.sh
|
|
||||||
|
|
||||||
board=$(board_name)
|
board=$(board_name)
|
||||||
|
|
||||||
@ -43,11 +10,11 @@ case "$FIRMWARE" in
|
|||||||
"pci_wmac0.eeprom")
|
"pci_wmac0.eeprom")
|
||||||
case $board in
|
case $board in
|
||||||
tplink,tl-wdr4900-v1)
|
tplink,tl-wdr4900-v1)
|
||||||
ath9k_eeprom_extract "caldata" 4096 2048
|
caldata_extract "caldata" 0x1000 0x800
|
||||||
tpl_set_wireless_mac 0
|
ath9k_patch_mac $(mtd_get_mac_binary u-boot 0x4fc00)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
caldata_die "board $board is not supported yet"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -55,11 +22,11 @@ case "$FIRMWARE" in
|
|||||||
"pci_wmac1.eeprom")
|
"pci_wmac1.eeprom")
|
||||||
case $board in
|
case $board in
|
||||||
tplink,tl-wdr4900-v1)
|
tplink,tl-wdr4900-v1)
|
||||||
ath9k_eeprom_extract "caldata" 20480 2048
|
caldata_extract "caldata" 0x5000 0x800
|
||||||
tpl_set_wireless_mac -1
|
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) -1)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ath9k_eeprom_die "board $board is not supported yet"
|
caldata_die "board $board is not supported yet"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -3,27 +3,54 @@
|
|||||||
# Copyright (C) 2013 OpenWrt.org
|
# Copyright (C) 2013 OpenWrt.org
|
||||||
#
|
#
|
||||||
|
|
||||||
ramips_set_preinit_iface() {
|
. /lib/functions.sh
|
||||||
RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
|
|
||||||
|
|
||||||
if [ -n "${RT3X5X}" ]; then
|
ramips_switchdev_from_soc() {
|
||||||
# The ethernet switch driver enables VLAN by default, but
|
# The ethernet switch driver enables VLAN by default, but
|
||||||
# failsafe uses eth0, making the device unreachable:
|
# failsafe uses eth0, making the device unreachable:
|
||||||
# https://dev.openwrt.org/ticket/18768
|
# https://dev.openwrt.org/ticket/18768
|
||||||
case "${RT3X5X}" in
|
|
||||||
*MT7620*)
|
local switchdev
|
||||||
ralink_switchdev=mt7620
|
local RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
|
||||||
;;
|
|
||||||
*MT7621*)
|
[ -n "$RT3X5X" ] || return 1
|
||||||
ralink_switchdev=mt7530
|
|
||||||
;;
|
case "$RT3X5X" in
|
||||||
*)
|
*MT7620*)
|
||||||
ralink_switchdev=rt305x
|
switchdev=mt7620
|
||||||
;;
|
;;
|
||||||
esac
|
*MT7621*)
|
||||||
swconfig dev $ralink_switchdev set reset 1
|
switchdev=mt7530
|
||||||
swconfig dev $ralink_switchdev set enable_vlan 0
|
;;
|
||||||
swconfig dev $ralink_switchdev set apply 1
|
*)
|
||||||
|
switchdev=rt305x
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$switchdev"
|
||||||
|
}
|
||||||
|
|
||||||
|
ramips_switchdev_from_board() {
|
||||||
|
# For these devices, external ethernet switch should be used
|
||||||
|
# instead of the SoC internal switch.
|
||||||
|
|
||||||
|
local switchdev
|
||||||
|
local board=$(board_name)
|
||||||
|
|
||||||
|
case "$board" in
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$switchdev"
|
||||||
|
}
|
||||||
|
|
||||||
|
ramips_set_preinit_iface() {
|
||||||
|
local switchdev=$(ramips_switchdev_from_board)
|
||||||
|
[ -n "$switchdev" ] || switchdev=$(ramips_switchdev_from_soc)
|
||||||
|
|
||||||
|
if [ -n "$switchdev" ]; then
|
||||||
|
swconfig dev $switchdev set reset 1
|
||||||
|
swconfig dev $switchdev set enable_vlan 0
|
||||||
|
swconfig dev $switchdev set apply 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ifname=eth0
|
ifname=eth0
|
||||||
|
Loading…
Reference in New Issue
Block a user