diff --git a/config/Config-devel.in b/config/Config-devel.in index 3f73cb404d..e16e6ecaab 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -17,6 +17,20 @@ menuconfig DEVEL Store built firmware images and filesystem images in this directory. If not set, uses './bin/$(BOARD)' + config DOWNLOAD_TOOL_CUSTOM + string "Use custom download tool" if DEVEL + default "" + help + Use and force custom download tool instead of relying on autoselection + between curl if available and wget as a fallback. + + download.pl supports 3 tools officially aria2c, curl and wget. + If one of the tool is used in this config, download.pl will use the + default args to make use of them. + + If the provided string is different than aria2c, curl or wget, the command + is used as is and the download url will be appended at the end of such command. + config DOWNLOAD_FOLDER string "Download folder" if DEVEL default "" diff --git a/include/download.mk b/include/download.mk index 6cd5445133..634d213225 100644 --- a/include/download.mk +++ b/include/download.mk @@ -20,6 +20,7 @@ DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) # Export options for download.pl export DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE) +export DOWNLOAD_TOOL_CUSTOM:=$(CONFIG_DOWNLOAD_TOOL_CUSTOM) define dl_method_git $(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git) diff --git a/include/image-commands.mk b/include/image-commands.mk index 6b4bc4945c..492e6933f1 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -218,6 +218,11 @@ define Build/copy-file cat "$(1)" > "$@" endef +define Build/edimax-header + $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) + @mv $@.new $@ +endef + define Build/elecom-product-header $(eval product=$(word 1,$(1))) $(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@)) diff --git a/include/kernel.mk b/include/kernel.mk index 001718d89d..2efa3bf8f8 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -125,17 +125,17 @@ ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL KERNELRELEASE=$(LINUX_VERSION) endif +ifneq ($(HOST_OS),Linux) + KERNEL_MAKE_FLAGS += CONFIG_STACK_VALIDATION= + export SKIP_STACK_VALIDATION:=1 +endif + KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS) ifdef CONFIG_USE_SPARSE KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse endif -ifneq ($(HOST_OS),Linux) - KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION= - export SKIP_STACK_VALIDATION:=1 -endif - PKG_EXTMOD_SUBDIRS ?= . PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers diff --git a/package/boot/arm-trusted-firmware-sunxi/Makefile b/package/boot/arm-trusted-firmware-sunxi/Makefile index 178b3958b8..430d78f7a3 100644 --- a/package/boot/arm-trusted-firmware-sunxi/Makefile +++ b/package/boot/arm-trusted-firmware-sunxi/Makefile @@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=arm-trusted-firmware-sunxi +PKG_CPE_ID:=cpe:/o:arm:arm_trusted_firmware PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622 index 654f78056a..9ad4c7c1a7 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7622 +++ b/package/boot/uboot-envtools/files/mediatek_mt7622 @@ -17,16 +17,13 @@ linksys,e8450-ubi) ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; bananapi,bpi-r64) - . /lib/upgrade/common.sh - export_bootdevice - export_partdevice rootdev 0 - case "$rootdev" in - mmc*) + case "$(cmdline_get_var root)" in + /dev/mmc*) local envdev=$(find_mmc_part "ubootenv" $rootdev) ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1" ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1" ;; - *) + /dev/ubi*) ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1" ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; diff --git a/package/boot/uboot-fritz4040/Makefile b/package/boot/uboot-fritz4040/Makefile index 3aa08081bf..e3ff69d0e4 100644 --- a/package/boot/uboot-fritz4040/Makefile +++ b/package/boot/uboot-fritz4040/Makefile @@ -41,6 +41,11 @@ define U-Boot/fritz4040 BUILD_DEVICES:=avm_fritzbox-4040 endef +define U-Boot/fritz7520 + NAME:=FritzBox 7520 + BUILD_DEVICES:=avm_fritzbox-7530 +endef + define U-Boot/fritz7530 NAME:=FritzBox 7530 BUILD_DEVICES:=avm_fritzbox-7530 @@ -72,6 +77,6 @@ define Package/u-boot/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/upload-to-f4040.sh $(1)/ endef -UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7530 +UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7520 fritz7530 $(eval $(call BuildPackage/U-Boot)) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 3ad458286f..c4b6861192 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -649,6 +649,7 @@ define KernelPackage/fs-ntfs3 KCONFIG:= CONFIG_NTFS3_FS CONFIG_NTFS3_FS_POSIX_ACL=y FILES:=$(LINUX_DIR)/fs/ntfs3/ntfs3.ko $(call AddDepends/nls) + DEPENDS+=@!LINUX_5_10 AUTOLOAD:=$(call AutoLoad,80,ntfs3) endef diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index a4b2ee93e9..afd14ef47b 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -25,14 +25,17 @@ endef $(eval $(call KernelPackage,iio-core)) +define AddDepends/iio + SUBMENU:=$(IIO_MENU) + DEPENDS+=+kmod-iio-core $(1) +endef define KernelPackage/iio-kfifo-buf - SUBMENU:=$(IIO_MENU) TITLE:=Industrial I/O buffering based on kfifo - DEPENDS:=+kmod-iio-core KCONFIG:=CONFIG_IIO_KFIFO_BUF FILES:=$(LINUX_DIR)/drivers/iio/buffer/kfifo_buf.ko AUTOLOAD:=$(call AutoLoad,55,kfifo_buf) + $(call AddDepends/iio) endef define KernelPackage/iio-kfifo-buf/description @@ -44,12 +47,12 @@ $(eval $(call KernelPackage,iio-kfifo-buf)) define KernelPackage/industrialio-triggered-buffer - SUBMENU:=$(IIO_MENU) TITLE:=Provides helper functions for setting up triggered buffers. - DEPENDS:=+kmod-iio-core +kmod-iio-kfifo-buf + DEPENDS:=+kmod-iio-kfifo-buf KCONFIG:=CONFIG_IIO_TRIGGERED_BUFFER FILES:=$(LINUX_DIR)/drivers/iio/buffer/industrialio-triggered-buffer.ko AUTOLOAD:=$(call AutoLoad,55,industrialio-triggered-buffer) + $(call AddDepends/iio) endef define KernelPackage/industrialio-triggered-buffer/description @@ -60,14 +63,14 @@ $(eval $(call KernelPackage,industrialio-triggered-buffer)) define KernelPackage/iio-ad799x - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-i2c-core +kmod-industrialio-triggered-buffer TITLE:=Analog Devices AD799x ADC driver KCONFIG:= \ CONFIG_AD799X_RING_BUFFER=y \ CONFIG_AD799X FILES:=$(LINUX_DIR)/drivers/iio/adc/ad799x.ko AUTOLOAD:=$(call AutoLoad,56,ad799x) + $(call AddDepends/iio) endef define KernelPackage/iio-ad799x/description @@ -79,12 +82,12 @@ endef $(eval $(call KernelPackage,iio-ad799x)) define KernelPackage/iio-ads1015 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap-i2c +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c +kmod-industrialio-triggered-buffer TITLE:=Texas Instruments ADS1015 ADC driver KCONFIG:= CONFIG_TI_ADS1015 FILES:=$(LINUX_DIR)/drivers/iio/adc/ti-ads1015.ko AUTOLOAD:=$(call AutoLoad,56,ti-ads1015) + $(call AddDepends/iio) endef define KernelPackage/iio-ads1015/description @@ -94,14 +97,14 @@ endef $(eval $(call KernelPackage,iio-ads1015)) define KernelPackage/iio-hmc5843 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap-i2c +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-i2c-core +kmod-regmap-i2c +kmod-industrialio-triggered-buffer TITLE:=Honeywell HMC58x3 Magnetometer KCONFIG:= CONFIG_SENSORS_HMC5843_I2C FILES:= \ $(LINUX_DIR)/drivers/iio/magnetometer/hmc5843_i2c.ko \ $(LINUX_DIR)/drivers/iio/magnetometer/hmc5843_core.ko AUTOLOAD:=$(call AutoLoad,56,hmc5843) + $(call AddDepends/iio) endef define KernelPackage/iio-hmc5843/description @@ -111,12 +114,12 @@ endef $(eval $(call KernelPackage,iio-hmc5843)) define KernelPackage/iio-bh1750 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core TITLE:=ROHM BH1750 ambient light sensor KCONFIG:= CONFIG_BH1750 FILES:=$(LINUX_DIR)/drivers/iio/light/bh1750.ko AUTOLOAD:=$(call AutoLoad,56,bh1750) + $(call AddDepends/iio) endef define KernelPackage/iio-bh1750/description ROHM BH1750 ambient light sensor (i2c bus) @@ -124,12 +127,12 @@ endef $(eval $(call KernelPackage,iio-bh1750)) define KernelPackage/iio-am2315 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-i2c-core +kmod-industrialio-triggered-buffer TITLE:=Asong AM2315 humidity/temperature sensor KCONFIG:= CONFIG_AM2315 FILES:=$(LINUX_DIR)/drivers/iio/humidity/am2315.ko AUTOLOAD:=$(call AutoLoad,56,am2315) + $(call AddDepends/iio) endef define KernelPackage/iio-am2315/description Aosong AM2315 humidity/temperature sensor (I2C bus) @@ -137,13 +140,13 @@ endef $(eval $(call KernelPackage,iio-am2315)) define KernelPackage/iio-mxs-lradc - SUBMENU:=$(IIO_MENU) - DEPENDS:=@TARGET_mxs +kmod-iio-core +kmod-industrialio-triggered-buffer + DEPENDS:=@TARGET_mxs +kmod-industrialio-triggered-buffer TITLE:=Freescale i.MX23/i.MX28 LRADC ADC driver KCONFIG:= \ CONFIG_MXS_LRADC_ADC FILES:=$(LINUX_DIR)/drivers/iio/adc/mxs-lradc-adc.ko AUTOLOAD:=$(call AutoLoad,56,mxs-lradc-adc) + $(call AddDepends/iio) endef define KernelPackage/iio-mxs-lradc/description @@ -153,13 +156,13 @@ endef $(eval $(call KernelPackage,iio-mxs-lradc)) define KernelPackage/iio-dht11 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-iio-core @GPIO_SUPPORT @USES_DEVICETREE + DEPENDS:=@GPIO_SUPPORT @USES_DEVICETREE TITLE:=DHT11 (and compatible) humidity and temperature sensors KCONFIG:= \ CONFIG_DHT11 FILES:=$(LINUX_DIR)/drivers/iio/humidity/dht11.ko AUTOLOAD:=$(call AutoLoad,56,dht11) + $(call AddDepends/iio) endef define KernelPackage/iio-dht11/description @@ -172,11 +175,11 @@ $(eval $(call KernelPackage,iio-dht11)) define KernelPackage/iio-bme680 - SUBMENU:=$(IIO_MENU) TITLE:=BME680 gas/humidity/pressure/temperature sensor - DEPENDS:=+kmod-iio-core +kmod-regmap-core + DEPENDS:=+kmod-regmap-core KCONFIG:=CONFIG_BME680 FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_core.ko + $(call AddDepends/iio) endef define KernelPackage/iio-bme680/description @@ -187,12 +190,12 @@ endef $(eval $(call KernelPackage,iio-bme680)) define KernelPackage/iio-bme680-i2c - SUBMENU:=$(IIO_MENU) TITLE:=BME680 gas/humidity/pressure/temperature sensor (I2C) DEPENDS:=+kmod-iio-bme680 +kmod-regmap-i2c KCONFIG:=CONFIG_BME680_I2C FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_i2c.ko AUTOLOAD:=$(call AutoProbe,bme680-i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-bme680-i2c/description This driver adds support for Bosch Sensortec's BME680 connected via I2C. @@ -201,12 +204,12 @@ endef $(eval $(call KernelPackage,iio-bme680-i2c)) define KernelPackage/iio-bme680-spi - SUBMENU:=$(IIO_MENU) TITLE:=BME680 gas/humidity/pressure/temperature sensor (SPI) DEPENDS:=+kmod-iio-bme680 +kmod-regmap-spi KCONFIG:=CONFIG_BME680_SPI FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_spi.ko AUTOLOAD:=$(call AutoProbe,bme680-spi) + $(call AddDepends/iio) endef define KernelPackage/iio-bme680-spi/description This driver adds support for Bosch Sensortec's BME680 connected via SPI. @@ -216,11 +219,11 @@ $(eval $(call KernelPackage,iio-bme680-spi)) define KernelPackage/iio-bmp280 - SUBMENU:=$(IIO_MENU) TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor - DEPENDS:=+kmod-iio-core +kmod-regmap-core + DEPENDS:=+kmod-regmap-core KCONFIG:=CONFIG_BMP280 FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280.ko + $(call AddDepends/iio) endef define KernelPackage/iio-bmp280/description @@ -233,12 +236,12 @@ $(eval $(call KernelPackage,iio-bmp280)) define KernelPackage/iio-bmp280-i2c - SUBMENU:=$(IIO_MENU) TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor (I2C) DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core +kmod-regmap-i2c KCONFIG:=CONFIG_BMP280_I2C FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-i2c.ko AUTOLOAD:=$(call AutoProbe,bmp280-i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-bmp280-i2c/description This driver adds support for Bosch Sensortec's digital pressure and @@ -249,12 +252,12 @@ $(eval $(call KernelPackage,iio-bmp280-i2c)) define KernelPackage/iio-bmp280-spi - SUBMENU:=$(IIO_MENU) TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor (SPI) DEPENDS:=+kmod-iio-bmp280 +kmod-spi-bitbang KCONFIG:=CONFIG_BMP280_SPI FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-spi.ko AUTOLOAD:=$(call AutoProbe,bmp280-spi) + $(call AddDepends/iio) endef define KernelPackage/iio-bmp280-spi/description This driver adds support for Bosch Sensortec's digital pressure and @@ -264,8 +267,7 @@ endef $(eval $(call KernelPackage,iio-bmp280-spi)) define KernelPackage/iio-htu21 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core TITLE:=HTU21 humidity & temperature sensor KCONFIG:= \ CONFIG_HTU21 \ @@ -274,6 +276,7 @@ define KernelPackage/iio-htu21 $(LINUX_DIR)/drivers/iio/humidity/htu21.ko \ $(LINUX_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko AUTOLOAD:=$(call AutoLoad,56,htu21) + $(call AddDepends/iio) endef define KernelPackage/iio-htu21/description @@ -287,13 +290,13 @@ $(eval $(call KernelPackage,iio-htu21)) define KernelPackage/iio-ccs811 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-i2c-core +kmod-industrialio-triggered-buffer TITLE:=AMS CCS811 VOC sensor KCONFIG:= \ CONFIG_CCS811 FILES:= $(LINUX_DIR)/drivers/iio/chemical/ccs811.ko AUTOLOAD:=$(call AutoLoad,56,ccs811) + $(call AddDepends/iio) endef define KernelPackage/iio-ccs811/description @@ -304,12 +307,12 @@ $(eval $(call KernelPackage,iio-ccs811)) define KernelPackage/iio-si7020 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core TITLE:=Silicon Labs Si7020 sensor KCONFIG:= CONFIG_SI7020 FILES:=$(LINUX_DIR)/drivers/iio/humidity/si7020.ko AUTOLOAD:=$(call AutoLoad,56,si7020) + $(call AddDepends/iio) endef define KernelPackage/iio-si7020/description @@ -322,15 +325,15 @@ $(eval $(call KernelPackage,iio-si7020)) define KernelPackage/iio-st_accel - SUBMENU:=$(IIO_MENU) TITLE:=STMicroelectronics accelerometer 3-Axis Driver - DEPENDS:=+kmod-iio-core +kmod-regmap-core +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-regmap-core +kmod-industrialio-triggered-buffer KCONFIG:= \ CONFIG_IIO_ST_ACCEL_3AXIS \ CONFIG_IIO_ST_SENSORS_CORE FILES:= \ $(LINUX_DIR)/drivers/iio/accel/st_accel.ko \ $(LINUX_DIR)/drivers/iio/common/st_sensors/st_sensors.ko + $(call AddDepends/iio) endef define KernelPackage/iio-st_accel/description @@ -344,7 +347,6 @@ $(eval $(call KernelPackage,iio-st_accel)) define KernelPackage/iio-st_accel-i2c - SUBMENU:=$(IIO_MENU) TITLE:=STMicroelectronics accelerometer 3-Axis Driver (I2C) DEPENDS:=+kmod-iio-st_accel +kmod-i2c-core +kmod-regmap-i2c KCONFIG:= CONFIG_IIO_ST_ACCEL_I2C_3AXIS @@ -352,6 +354,7 @@ define KernelPackage/iio-st_accel-i2c $(LINUX_DIR)/drivers/iio/accel/st_accel_i2c.ko \ $(LINUX_DIR)/drivers/iio/common/st_sensors/st_sensors_i2c.ko AUTOLOAD:=$(call AutoLoad,56,st_accel_i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-st_accel-i2c/description @@ -362,7 +365,6 @@ $(eval $(call KernelPackage,iio-st_accel-i2c)) define KernelPackage/iio-st_accel-spi - SUBMENU:=$(IIO_MENU) TITLE:=STMicroelectronics accelerometer 3-Axis Driver (SPI) DEPENDS:=+kmod-iio-st_accel +kmod-regmap-spi KCONFIG:= CONFIG_IIO_ST_ACCEL_SPI_3AXIS @@ -370,6 +372,7 @@ define KernelPackage/iio-st_accel-spi $(LINUX_DIR)/drivers/iio/accel/st_accel_spi.ko \ $(LINUX_DIR)/drivers/iio/common/st_sensors/st_sensors_spi.ko AUTOLOAD:=$(call AutoLoad,56,st_accel_spi) + $(call AddDepends/iio) endef define KernelPackage/iio-st_accel-spi/description @@ -380,12 +383,12 @@ $(eval $(call KernelPackage,iio-st_accel-spi)) define KernelPackage/iio-lsm6dsx - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-iio-core +kmod-iio-kfifo-buf +kmod-regmap-core + DEPENDS:=+kmod-iio-kfifo-buf +kmod-regmap-core TITLE:=ST LSM6DSx driver for IMU MEMS sensors KCONFIG:=CONFIG_IIO_ST_LSM6DSX FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.ko AUTOLOAD:=$(call AutoProbe,st_lsm6dsx) + $(call AddDepends/iio) endef define KernelPackage/iio-lsm6dsx/description @@ -396,12 +399,12 @@ $(eval $(call KernelPackage,iio-lsm6dsx)) define KernelPackage/iio-lsm6dsx-i2c - SUBMENU:=$(IIO_MENU) DEPENDS:=+kmod-iio-lsm6dsx +kmod-i2c-core +kmod-regmap-i2c TITLE:=ST LSM6DSx driver for IMU MEMS sensors (I2C) KCONFIG:=CONFIG_IIO_ST_LSM6DSX FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.ko AUTOLOAD:=$(call AutoProbe,st_lsm6dsx-i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-lsm6dsx-i2c/description @@ -412,12 +415,12 @@ $(eval $(call KernelPackage,iio-lsm6dsx-i2c)) define KernelPackage/iio-lsm6dsx-spi - SUBMENU:=$(IIO_MENU) DEPENDS:=+kmod-iio-lsm6dsx +kmod-regmap-spi TITLE:=ST LSM6DSx driver for IMU MEMS sensors (SPI) KCONFIG:=CONFIG_IIO_ST_LSM6DSX FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.ko AUTOLOAD:=$(call AutoProbe,st_lsm6dsx-spi) + $(call AddDepends/iio) endef define KernelPackage/iio-lsm6dsx-spi/description @@ -428,8 +431,7 @@ $(eval $(call KernelPackage,iio-lsm6dsx-spi)) define KernelPackage/iio-sps30 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-industrialio-triggered-buffer +kmod-lib-crc8 + DEPENDS:=+kmod-i2c-core +kmod-industrialio-triggered-buffer +kmod-lib-crc8 TITLE:=Sensirion SPS30 particulate matter sensor KCONFIG:= \ CONFIG_SPS30 \ @@ -438,6 +440,7 @@ define KernelPackage/iio-sps30 $(LINUX_DIR)/drivers/iio/chemical/sps30.ko \ $(LINUX_DIR)/drivers/iio/chemical/sps30_i2c.ko@ge5.14 AUTOLOAD:=$(call AutoProbe,sps30 sps30_i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-sps30/description @@ -448,12 +451,12 @@ $(eval $(call KernelPackage,iio-sps30)) define KernelPackage/iio-tsl4531 - SUBMENU:=$(IIO_MENU) - DEPENDS:=+kmod-i2c-core +kmod-iio-core + DEPENDS:=+kmod-i2c-core TITLE:=TAOS TSL4531 ambient light sensor KCONFIG:= CONFIG_TSL4531 FILES:=$(LINUX_DIR)/drivers/iio/light/tsl4531.ko AUTOLOAD:=$(call AutoLoad,56,tsl4531) + $(call AddDepends/iio) endef define KernelPackage/iio-tsl4531/description @@ -466,12 +469,12 @@ $(eval $(call KernelPackage,iio-tsl4531)) define KernelPackage/iio-fxas21002c - SUBMENU:=$(IIO_MENU) TITLE:=Freescale FXAS21002C 3-axis gyro driver - DEPENDS:=+kmod-iio-core +kmod-regmap-core +kmod-industrialio-triggered-buffer + DEPENDS:=+kmod-regmap-core +kmod-industrialio-triggered-buffer KCONFIG:= CONFIG_FXAS21002C FILES:=$(LINUX_DIR)/drivers/iio/gyro/fxas21002c_core.ko AUTOLOAD:=$(call AutoLoad,56,fxas21002c) + $(call AddDepends/iio) endef define KernelPackage/iio-fxas21002c/description @@ -482,12 +485,12 @@ $(eval $(call KernelPackage,iio-fxas21002c)) define KernelPackage/iio-fxas21002c-i2c - SUBMENU:=$(IIO_MENU) TITLE:=Freescale FXAS21002C 3-axis gyro driver (I2C) DEPENDS:=+kmod-iio-fxas21002c +kmod-i2c-core +kmod-regmap-i2c KCONFIG:= CONFIG_FXAS21002C_I2C FILES:=$(LINUX_DIR)/drivers/iio/gyro/fxas21002c_i2c.ko AUTOLOAD:=$(call AutoLoad,56,fxas21002c_i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-fxas21002c-i2c/description @@ -499,12 +502,12 @@ endef $(eval $(call KernelPackage,iio-fxas21002c-i2c)) define KernelPackage/iio-fxas21002c-spi - SUBMENU:=$(IIO_MENU) DEPENDS:=+kmod-iio-fxas21002c +kmod-regmap-spi TITLE:=Freescale FXAS21002C 3-axis gyro driver (SPI) KCONFIG:= CONFIG_FXAS21002C_SPI FILES:=$(LINUX_DIR)/drivers/iio/gyro/fxas21002c_spi.ko AUTOLOAD:=$(call AutoLoad,56,fxas21002c_spi) + $(call AddDepends/iio) endef define KernelPackage/iio-fxas21002c-spi/description @@ -516,12 +519,12 @@ $(eval $(call KernelPackage,iio-fxas21002c-spi)) define KernelPackage/iio-fxos8700 - SUBMENU:=$(IIO_MENU) TITLE:=Freescale FXOS8700 3-axis accelerometer driver - DEPENDS:=+kmod-iio-core +kmod-regmap-core + DEPENDS:=+kmod-regmap-core KCONFIG:= CONFIG_FXOS8700 FILES:=$(LINUX_DIR)/drivers/iio/imu/fxos8700_core.ko AUTOLOAD:=$(call AutoLoad,56,fxos8700) + $(call AddDepends/iio) endef define KernelPackage/iio-fxos8700/description @@ -532,12 +535,12 @@ $(eval $(call KernelPackage,iio-fxos8700)) define KernelPackage/iio-fxos8700-i2c - SUBMENU:=$(IIO_MENU) TITLE:=Freescale FXOS8700 3-axis acceleromter driver (I2C) DEPENDS:=+kmod-iio-fxos8700 +kmod-i2c-core +kmod-regmap-i2c KCONFIG:= CONFIG_FXOS8700_I2C FILES:=$(LINUX_DIR)/drivers/iio/imu/fxos8700_i2c.ko AUTOLOAD:=$(call AutoLoad,56,fxos8700_i2c) + $(call AddDepends/iio) endef define KernelPackage/iio-fxos8700-i2c/description @@ -549,12 +552,12 @@ endef $(eval $(call KernelPackage,iio-fxos8700-i2c)) define KernelPackage/iio-fxos8700-spi - SUBMENU:=$(IIO_MENU) DEPENDS:=+kmod-iio-fxos8700 +kmod-regmap-spi TITLE:=Freescale FXOS8700 3-axis accelerometer driver (SPI) KCONFIG:= CONFIG_FXOS8700_SPI FILES:=$(LINUX_DIR)/drivers/iio/imu/fxos8700_spi.ko AUTOLOAD:=$(call AutoLoad,56,fxos8700_spi) + $(call AddDepends/iio) endef define KernelPackage/iio-fxos8700-spi/description diff --git a/package/kernel/linux/modules/spi.mk b/package/kernel/linux/modules/spi.mk index 01dc7dc7e6..5cdfc3b2b3 100644 --- a/package/kernel/linux/modules/spi.mk +++ b/package/kernel/linux/modules/spi.mk @@ -15,9 +15,10 @@ define KernelPackage/mmc-spi CONFIG_SPI=y \ CONFIG_SPI_MASTER=y FILES:=\ - $(if $(CONFIG_OF),$(LINUX_DIR)/drivers/mmc/host/of_mmc_spi.ko) \ + $(if $(CONFIG_OF),$(LINUX_DIR)/drivers/mmc/host/of_mmc_spi.ko@lt5.13) \ + $(LINUX_DIR)/drivers/mmc/host/of_mmc_spi.ko@ge5.13 \ $(LINUX_DIR)/drivers/mmc/host/mmc_spi.ko - AUTOLOAD:=$(call AutoProbe,$(if $(CONFIG_OF),of_mmc_spi) mmc_spi) + AUTOLOAD:=$(call AutoProbe,$(if $(CONFIG_OF),of_mmc_spi@lt5.13) of_mmc_spi@ge5.13 mmc_spi) endef define KernelPackage/mmc-spi/description diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index 93aae692d4..c3a8cdf236 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnftnl +PKG_CPE_ID:=cpe:/a:netfilter:libnftnl PKG_VERSION:=1.2.3 PKG_RELEASE:=$(AUTORELEASE) diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index b21dd2b0ab..14f74082af 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses +PKG_CPE_ID:=cpe:/a:gnu:ncurses PKG_VERSION:=6.3 PKG_RELEASE:=$(AUTORELEASE) diff --git a/package/network/utils/wireless-tools/Makefile b/package/network/utils/wireless-tools/Makefile index 52e246a59c..6ac66a056a 100644 --- a/package/network/utils/wireless-tools/Makefile +++ b/package/network/utils/wireless-tools/Makefile @@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-tools +PKG_CPE_ID:=cpe:/a:wireless_tools_project:wireless_tools PKG_VERSION:=29 PKG_MINOR:= PKG_RELEASE:=6 diff --git a/scripts/download.pl b/scripts/download.pl index 9c089760f7..7751459bc6 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -25,6 +25,8 @@ my @mirrors; my $ok; my $check_certificate = $ENV{DOWNLOAD_CHECK_CERTIFICATE} eq "y"; +my $custom_tool = $ENV{DOWNLOAD_TOOL_CUSTOM}; +my $download_tool; $url_filename or $url_filename = $filename; @@ -85,35 +87,54 @@ sub tool_present { return $present } +sub select_tool { + $custom_tool =~ tr/"//d; + if ($custom_tool) { + return $custom_tool; + } + + # Try to use curl if available + if (tool_present("curl", "curl")) { + return "curl"; + } + + # No tool found, fallback to wget + return "wget"; +} + sub download_cmd { my $url = shift; my $filename = shift; - my $additional_mirrors = join(" ", map "$_/$filename", @_); - my @chArray = ('a'..'z', 'A'..'Z', 0..9); - my $rfn = join '', "${filename}_", map{ $chArray[int rand @chArray] } 0..9; + if ($download_tool eq "curl") { + return (qw(curl -f --connect-timeout 20 --retry 5 --location), + $check_certificate ? () : '--insecure', + shellwords($ENV{CURL_OPTIONS} || ''), + $url); + } elsif ($download_tool eq "wget") { + return (qw(wget --tries=5 --timeout=20 --output-document=-), + $check_certificate ? () : '--no-check-certificate', + shellwords($ENV{WGET_OPTIONS} || ''), + $url); + } elsif ($download_tool eq "aria2c") { + my $additional_mirrors = join(" ", map "$_/$filename", @_); + my @chArray = ('a'..'z', 'A'..'Z', 0..9); + my $rfn = join '', "${filename}_", map{ $chArray[int rand @chArray] } 0..9; - if (tool_present('aria2c', 'aria2')) { @mirrors=(); + return join(" ", "[ -d $ENV{'TMPDIR'}/aria2c ] || mkdir $ENV{'TMPDIR'}/aria2c;", "touch $ENV{'TMPDIR'}/aria2c/${rfn}_spp;", qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $url, $additional_mirrors, $check_certificate ? () : '--check-certificate=false', "--server-stat-of=$ENV{'TMPDIR'}/aria2c/${rfn}_spp", "--server-stat-if=$ENV{'TMPDIR'}/aria2c/${rfn}_spp", + "--daemon=false --no-conf", shellwords($ENV{ARIA2C_OPTIONS} || ''), "-d $ENV{'TMPDIR'}/aria2c -o $rfn;", "cat $ENV{'TMPDIR'}/aria2c/$rfn;", "rm $ENV{'TMPDIR'}/aria2c/$rfn $ENV{'TMPDIR'}/aria2c/${rfn}_spp"); - } elsif (tool_present('curl', 'curl')) { - return (qw(curl -f --connect-timeout 20 --retry 5 --location), - $check_certificate ? () : '--insecure', - shellwords($ENV{CURL_OPTIONS} || ''), - $url); } else { - return (qw(wget --tries=5 --timeout=20 --output-document=-), - $check_certificate ? () : '--no-check-certificate', - shellwords($ENV{WGET_OPTIONS} || ''), - $url); + return join(" ", $download_tool, $url); } } @@ -354,6 +375,8 @@ if (-f "$target/$filename") { }; } +$download_tool = select_tool(); + while (!-f "$target/$filename") { my $mirror = shift @mirrors; $mirror or die "No more mirrors to try - giving up.\n"; diff --git a/target/linux/ath79/config-5.10 b/target/linux/ath79/config-5.10 index ac903aee6d..04eec4375f 100644 --- a/target/linux/ath79/config-5.10 +++ b/target/linux/ath79/config-5.10 @@ -126,6 +126,7 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set # CONFIG_MTD_MAP_BANK_WIDTH_4 is not set CONFIG_MTD_PARSER_CYBERTAN=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_ELF_FW=y diff --git a/target/linux/ath79/config-5.15 b/target/linux/ath79/config-5.15 index acb6b840bf..ce987c5539 100644 --- a/target/linux/ath79/config-5.15 +++ b/target/linux/ath79/config-5.15 @@ -123,6 +123,7 @@ CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set # CONFIG_MTD_MAP_BANK_WIDTH_4 is not set CONFIG_MTD_PARSER_CYBERTAN=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_ELF_FW=y diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts b/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts index 510b577d19..f7358891b0 100644 --- a/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts +++ b/target/linux/ath79/dts/qca9563_elecom_wrc-1750ghbk2-i.dts @@ -44,11 +44,34 @@ label = "art"; reg = <0xff0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + macaddr_art_1002: macaddr@1002 { + reg = <0x1002 0x6>; + }; + + cal_art_5000: cal@5000 { + reg = <0x5000 0x844>; + }; }; }; &pcie { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; + }; }; ð0 { @@ -58,15 +81,6 @@ }; &wmac { - mtd-cal-data = <&art 0x1000>; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_1002: macaddr@1002 { - reg = <0x1002 0x6>; - }; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts b/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts index 28ffce6434..5ffff57b48 100644 --- a/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts +++ b/target/linux/ath79/dts/qca9563_elecom_wrc-300ghbk2-i.dts @@ -38,6 +38,18 @@ label = "art"; reg = <0x7f0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + macaddr_art_1002: macaddr@1002 { + reg = <0x1002 0x6>; + }; }; }; @@ -48,15 +60,6 @@ }; &wmac { - mtd-cal-data = <&art 0x1000>; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_1002: macaddr@1002 { - reg = <0x1002 0x6>; - }; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index a2ae5cb8de..1d8beaaa25 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -634,7 +634,8 @@ ath79_setup_macs() ;; elecom,wrc-1750ghbk2-i|\ elecom,wrc-300ghbk2-i) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" -2) + wan_mac=$(mtd_get_mac_ascii hwconfig "HW.WAN.MAC.Address") + label_mac=$wan_mac ;; engenius,ecb1200|\ engenius,ecb1750) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 57e59a89d6..8783b137ca 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -74,9 +74,6 @@ case "$FIRMWARE" in caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac") ;; - elecom,wrc-1750ghbk2-i) - caldata_extract "art" 0x5000 0x844 - ;; engenius,ecb1200|\ engenius,ecb1750) caldata_extract "art" 0x5000 0x844 diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 1df0b4ac0f..c940f1e067 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -11,24 +11,6 @@ DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING -define Build/add-elecom-factory-initramfs - $(eval edimax_model=$(word 1,$(1))) - $(eval product=$(word 2,$(1))) - - $(STAGING_DIR_HOST)/bin/mkedimaximg \ - -b -s CSYS -m $(edimax_model) \ - -f 0x70000 -S 0x01100000 \ - -i $@ -o $@.factory - - $(call Build/elecom-product-header,$(product) $@.factory) - - if [ "$$(stat -c%s $@.factory)" -le $$(($(subst k,* 1024,$(subst m, * 1024k,$(IMAGE_SIZE))))) ]; then \ - mv $@.factory $(BIN_DIR)/$(KERNEL_INITRAMFS_PREFIX)-factory.bin; \ - else \ - echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \ - fi -endef - define Build/addpattern -$(STAGING_DIR_HOST)/bin/addpattern -B $(ADDPATTERN_ID) \ -v v$(ADDPATTERN_VERSION) -i $@ -o $@.new @@ -1106,8 +1088,12 @@ define Device/elecom_wrc-1750ghbk2-i DEVICE_VENDOR := ELECOM DEVICE_MODEL := WRC-1750GHBK2-I/C IMAGE_SIZE := 15808k - KERNEL_INITRAMFS := $$(KERNEL) | pad-to 2 | \ - add-elecom-factory-initramfs RN68 WRC-1750GHBK2 +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.bin + ARTIFACT/initramfs-factory.bin := append-image initramfs-kernel.bin | \ + pad-to 2 | edimax-header -b -s CSYS -m RN68 -f 0x70000 -S 0x01100000 | \ + elecom-product-header WRC-1750GHBK2 | check-size +endif DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct endef TARGET_DEVICES += elecom_wrc-1750ghbk2-i @@ -1117,8 +1103,12 @@ define Device/elecom_wrc-300ghbk2-i DEVICE_VENDOR := ELECOM DEVICE_MODEL := WRC-300GHBK2-I IMAGE_SIZE := 7616k - KERNEL_INITRAMFS := $$(KERNEL) | pad-to 2 | \ - add-elecom-factory-initramfs RN51 WRC-300GHBK2-I +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.bin + ARTIFACT/initramfs-factory.bin := append-image initramfs-kernel.bin | \ + pad-to 2 | edimax-header -b -s CSYS -m RN51 -f 0x70000 -S 0x01100000 | \ + elecom-product-header WRC-300GHBK2-I | check-size +endif endef TARGET_DEVICES += elecom_wrc-300ghbk2-i diff --git a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index 92f5116a8e..5ff2a61c7a 100644 --- a/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/ath79/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -851,6 +851,17 @@ out_error: +@@ -843,6 +843,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/ath79/patches-5.15/404-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-5.15/404-mtd-cybertan-trx-parser.patch index cfc017871f..4e8e536e29 100644 --- a/target/linux/ath79/patches-5.15/404-mtd-cybertan-trx-parser.patch +++ b/target/linux/ath79/patches-5.15/404-mtd-cybertan-trx-parser.patch @@ -25,7 +25,7 @@ Submitted-by: Christian Lamparter +obj-$(CONFIG_MTD_PARSER_CYBERTAN) += parser_cybertan.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o + obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig @@ -102,6 +102,14 @@ config MTD_OF_PARTS_LINKSYS_NS diff --git a/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc index eae84bb771..89ce8970d7 100644 --- a/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bcm53xx/base-files/etc/uci-defaults/09_fix_crc @@ -1,5 +1,22 @@ +. /lib/functions.sh + +board=$(board_name) + kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd) -mtd ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 -mtd ${kernel_size:+-c 0x$kernel_size} fixseama firmware && exit 0 -exit 1 +fixtrx() { + mtd ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0 +} + +fixseama() { + mtd ${kernel_size:+-c 0x$kernel_size} fixseama firmware && exit 0 +} + +case "$board" in +dlink,dir-885l) + fixseama + ;; +*) + fixtrx + ;; +esac diff --git a/target/linux/bcm53xx/config-5.10 b/target/linux/bcm53xx/config-5.10 index d8fb7b2a5d..9850aa9563 100644 --- a/target/linux/bcm53xx/config-5.10 +++ b/target/linux/bcm53xx/config-5.10 @@ -196,6 +196,7 @@ CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_OF_PARTS_LINKSYS_NS=y +CONFIG_MTD_PARSER_TPLINK_SAFELOADER=y CONFIG_MTD_PARSER_TRX=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/bcm53xx/config-5.15 b/target/linux/bcm53xx/config-5.15 index 32ac9fb6cc..3941c22b9c 100644 --- a/target/linux/bcm53xx/config-5.15 +++ b/target/linux/bcm53xx/config-5.15 @@ -205,6 +205,7 @@ CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_OF_PARTS_LINKSYS_NS=y +CONFIG_MTD_PARSER_TPLINK_SAFELOADER=y CONFIG_MTD_PARSER_TRX=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index d682592727..3291adb684 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -170,7 +170,7 @@ TARGET_DEVICES += asus_rt-ac87u define Device/asus_rt-ac88u $(call Device/asus) DEVICE_MODEL := RT-AC88U - DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES) + DEVICE_PACKAGES := $(BRCMFMAC_4366B1) $(BRCMFMAC_4366C0) $(USB3_PACKAGES) ASUS_PRODUCTID := RT-AC88U endef TARGET_DEVICES += asus_rt-ac88u diff --git a/target/linux/generic/backport-5.10/416-v6.1-mtd-core-add-missing-of_node_get-in-dynamic-partitio.patch b/target/linux/generic/backport-5.10/416-v6.1-mtd-core-add-missing-of_node_get-in-dynamic-partitio.patch new file mode 100644 index 0000000000..0c359c65f8 --- /dev/null +++ b/target/linux/generic/backport-5.10/416-v6.1-mtd-core-add-missing-of_node_get-in-dynamic-partitio.patch @@ -0,0 +1,101 @@ +From 12b58961de0bd88b3c7dfa5d21f6d67f4678b780 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 18 Oct 2022 07:18:22 +0200 +Subject: [PATCH] mtd: core: add missing of_node_get() in dynamic partitions + code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes unbalanced of_node_put(): +[ 1.078910] 6 cmdlinepart partitions found on MTD device gpmi-nand +[ 1.085116] Creating 6 MTD partitions on "gpmi-nand": +[ 1.090181] 0x000000000000-0x000008000000 : "nandboot" +[ 1.096952] 0x000008000000-0x000009000000 : "nandfit" +[ 1.103547] 0x000009000000-0x00000b000000 : "nandkernel" +[ 1.110317] 0x00000b000000-0x00000c000000 : "nanddtb" +[ 1.115525] ------------[ cut here ]------------ +[ 1.120141] refcount_t: addition on 0; use-after-free. +[ 1.125328] WARNING: CPU: 0 PID: 1 at lib/refcount.c:25 refcount_warn_saturate+0xdc/0x148 +[ 1.133528] Modules linked in: +[ 1.136589] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc7-next-20220930-04543-g8cf3f7 +[ 1.146342] Hardware name: Freescale i.MX8DXL DDR3L EVK (DT) +[ 1.151999] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) +[ 1.158965] pc : refcount_warn_saturate+0xdc/0x148 +[ 1.163760] lr : refcount_warn_saturate+0xdc/0x148 +[ 1.168556] sp : ffff800009ddb080 +[ 1.171866] x29: ffff800009ddb080 x28: ffff800009ddb35a x27: 0000000000000002 +[ 1.179015] x26: ffff8000098b06ad x25: ffffffffffffffff x24: ffff0a00ffffff05 +[ 1.186165] x23: ffff00001fdf6470 x22: ffff800009ddb367 x21: 0000000000000000 +[ 1.193314] x20: ffff00001fdfebe8 x19: ffff00001fdfec50 x18: ffffffffffffffff +[ 1.200464] x17: 0000000000000000 x16: 0000000000000118 x15: 0000000000000004 +[ 1.207614] x14: 0000000000000fff x13: ffff800009bca248 x12: 0000000000000003 +[ 1.214764] x11: 00000000ffffefff x10: c0000000ffffefff x9 : 4762cb2ccb52de00 +[ 1.221914] x8 : 4762cb2ccb52de00 x7 : 205d313431303231 x6 : 312e31202020205b +[ 1.229063] x5 : ffff800009d55c1f x4 : 0000000000000001 x3 : 0000000000000000 +[ 1.236213] x2 : 0000000000000000 x1 : ffff800009954be6 x0 : 000000000000002a +[ 1.243365] Call trace: +[ 1.245806] refcount_warn_saturate+0xdc/0x148 +[ 1.250253] kobject_get+0x98/0x9c +[ 1.253658] of_node_get+0x20/0x34 +[ 1.257072] of_fwnode_get+0x3c/0x54 +[ 1.260652] fwnode_get_nth_parent+0xd8/0xf4 +[ 1.264926] fwnode_full_name_string+0x3c/0xb4 +[ 1.269373] device_node_string+0x498/0x5b4 +[ 1.273561] pointer+0x41c/0x5d0 +[ 1.276793] vsnprintf+0x4d8/0x694 +[ 1.280198] vprintk_store+0x164/0x528 +[ 1.283951] vprintk_emit+0x98/0x164 +[ 1.287530] vprintk_default+0x44/0x6c +[ 1.291284] vprintk+0xf0/0x134 +[ 1.294428] _printk+0x54/0x7c +[ 1.297486] of_node_release+0xe8/0x128 +[ 1.301326] kobject_put+0x98/0xfc +[ 1.304732] of_node_put+0x1c/0x28 +[ 1.308137] add_mtd_device+0x484/0x6d4 +[ 1.311977] add_mtd_partitions+0xf0/0x1d0 +[ 1.316078] parse_mtd_partitions+0x45c/0x518 +[ 1.320439] mtd_device_parse_register+0xb0/0x274 +[ 1.325147] gpmi_nand_probe+0x51c/0x650 +[ 1.329074] platform_probe+0xa8/0xd0 +[ 1.332740] really_probe+0x130/0x334 +[ 1.336406] __driver_probe_device+0xb4/0xe0 +[ 1.340681] driver_probe_device+0x3c/0x1f8 +[ 1.344869] __driver_attach+0xdc/0x1a4 +[ 1.348708] bus_for_each_dev+0x80/0xcc +[ 1.352548] driver_attach+0x24/0x30 +[ 1.356127] bus_add_driver+0x108/0x1f4 +[ 1.359967] driver_register+0x78/0x114 +[ 1.363807] __platform_driver_register+0x24/0x30 +[ 1.368515] gpmi_nand_driver_init+0x1c/0x28 +[ 1.372798] do_one_initcall+0xbc/0x238 +[ 1.376638] do_initcall_level+0x94/0xb4 +[ 1.380565] do_initcalls+0x54/0x94 +[ 1.384058] do_basic_setup+0x1c/0x28 +[ 1.387724] kernel_init_freeable+0x110/0x188 +[ 1.392084] kernel_init+0x20/0x1a0 +[ 1.395578] ret_from_fork+0x10/0x20 +[ 1.399157] ---[ end trace 0000000000000000 ]--- +[ 1.403782] ------------[ cut here ]------------ + +Reported-by: Han Xu +Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions") +Signed-off-by: Rafał Miłecki +Tested-by: Han Xu +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221018051822.28685-1-zajec5@gmail.com +--- + drivers/mtd/mtdcore.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -577,7 +577,7 @@ static void mtd_check_of_node(struct mtd + if (!mtd_is_partition(mtd)) + return; + parent = mtd->parent; +- parent_dn = dev_of_node(&parent->dev); ++ parent_dn = of_node_get(dev_of_node(&parent->dev)); + if (!parent_dn) + return; + diff --git a/target/linux/generic/backport-5.10/417-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch b/target/linux/generic/backport-5.10/417-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch new file mode 100644 index 0000000000..e47def580c --- /dev/null +++ b/target/linux/generic/backport-5.10/417-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch @@ -0,0 +1,65 @@ +From 63db0cb35e1cb3b3c134906d1062f65513fdda2d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 4 Oct 2022 10:37:09 +0200 +Subject: [PATCH] mtd: core: simplify (a bit) code find partition-matching + dynamic OF node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Don't hardcode "partition-" string twice +2. Use simpler logic & use ->name to avoid of_property_read_string() +3. Use mtd_get_of_node() helper + +Cc: Christian Marangi +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221004083710.27704-1-zajec5@gmail.com +--- + drivers/mtd/mtdcore.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -566,18 +566,16 @@ static void mtd_check_of_node(struct mtd + struct device_node *partitions, *parent_dn, *mtd_dn = NULL; + const char *pname, *prefix = "partition-"; + int plen, mtd_name_len, offset, prefix_len; +- struct mtd_info *parent; + bool found = false; + + /* Check if MTD already has a device node */ +- if (dev_of_node(&mtd->dev)) ++ if (mtd_get_of_node(mtd)) + return; + + /* Check if a partitions node exist */ + if (!mtd_is_partition(mtd)) + return; +- parent = mtd->parent; +- parent_dn = of_node_get(dev_of_node(&parent->dev)); ++ parent_dn = of_node_get(mtd_get_of_node(mtd->parent)); + if (!parent_dn) + return; + +@@ -590,15 +588,15 @@ static void mtd_check_of_node(struct mtd + + /* Search if a partition is defined with the same name */ + for_each_child_of_node(partitions, mtd_dn) { +- offset = 0; +- + /* Skip partition with no/wrong prefix */ +- if (!of_node_name_prefix(mtd_dn, "partition-")) ++ if (!of_node_name_prefix(mtd_dn, prefix)) + continue; + + /* Label have priority. Check that first */ +- if (of_property_read_string(mtd_dn, "label", &pname)) { +- of_property_read_string(mtd_dn, "name", &pname); ++ if (!of_property_read_string(mtd_dn, "label", &pname)) { ++ offset = 0; ++ } else { ++ pname = mtd_dn->name; + offset = prefix_len; + } + diff --git a/target/linux/generic/backport-5.10/417-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch b/target/linux/generic/backport-5.10/417-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch new file mode 100644 index 0000000000..438e25b7f9 --- /dev/null +++ b/target/linux/generic/backport-5.10/417-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch @@ -0,0 +1,84 @@ +From ddb8cefb7af288950447ca6eeeafb09977dab56f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 4 Oct 2022 10:37:10 +0200 +Subject: [PATCH] mtd: core: try to find OF node for every MTD partition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far this feature was limited to the top-level "nvmem-cells" node. +There are multiple parsers creating partitions and subpartitions +dynamically. Extend that code to handle them too. + +This allows finding partition-* node for every MTD (sub)partition. + +Random example: + +partitions { + compatible = "brcm,bcm947xx-cfe-partitions"; + + partition-firmware { + compatible = "brcm,trx"; + + partition-loader { + }; + }; +}; + +Cc: Christian Marangi +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221004083710.27704-2-zajec5@gmail.com +--- + drivers/mtd/mtdcore.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -566,20 +566,22 @@ static void mtd_check_of_node(struct mtd + struct device_node *partitions, *parent_dn, *mtd_dn = NULL; + const char *pname, *prefix = "partition-"; + int plen, mtd_name_len, offset, prefix_len; +- bool found = false; + + /* Check if MTD already has a device node */ + if (mtd_get_of_node(mtd)) + return; + +- /* Check if a partitions node exist */ + if (!mtd_is_partition(mtd)) + return; ++ + parent_dn = of_node_get(mtd_get_of_node(mtd->parent)); + if (!parent_dn) + return; + +- partitions = of_get_child_by_name(parent_dn, "partitions"); ++ if (mtd_is_partition(mtd->parent)) ++ partitions = of_node_get(parent_dn); ++ else ++ partitions = of_get_child_by_name(parent_dn, "partitions"); + if (!partitions) + goto exit_parent; + +@@ -603,19 +605,11 @@ static void mtd_check_of_node(struct mtd + plen = strlen(pname) - offset; + if (plen == mtd_name_len && + !strncmp(mtd->name, pname + offset, plen)) { +- found = true; ++ mtd_set_of_node(mtd, mtd_dn); + break; + } + } + +- if (!found) +- goto exit_partitions; +- +- /* Set of_node only for nvmem */ +- if (of_device_is_compatible(mtd_dn, "nvmem-cells")) +- mtd_set_of_node(mtd, mtd_dn); +- +-exit_partitions: + of_node_put(partitions); + exit_parent: + of_node_put(parent_dn); diff --git a/target/linux/generic/backport-5.10/421-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch b/target/linux/generic/backport-5.10/421-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch new file mode 100644 index 0000000000..9f543365a5 --- /dev/null +++ b/target/linux/generic/backport-5.10/421-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch @@ -0,0 +1,229 @@ +From aec4d5f5ffd0f0092bd9dc21ea90e0bc237d4b74 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 15 Oct 2022 11:29:50 +0200 +Subject: [PATCH] mtd: parsers: add TP-Link SafeLoader partitions table parser +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This parser deals with most TP-Link home routers. It reads info about +partitions and registers them in the MTD subsystem. + +Example from TP-Link Archer C5 V2: + +spi-nor spi0.0: s25fl128s1 (16384 Kbytes) +15 tplink-safeloader partitions found on MTD device spi0.0 +Creating 15 MTD partitions on "spi0.0": +0x000000000000-0x000000040000 : "fs-uboot" +0x000000040000-0x000000440000 : "os-image" +0x000000440000-0x000000e40000 : "rootfs" +0x000000e40000-0x000000e40200 : "default-mac" +0x000000e40200-0x000000e40400 : "pin" +0x000000e40400-0x000000e40600 : "product-info" +0x000000e50000-0x000000e60000 : "partition-table" +0x000000e60000-0x000000e60200 : "soft-version" +0x000000e61000-0x000000e70000 : "support-list" +0x000000e70000-0x000000e80000 : "profile" +0x000000e80000-0x000000e90000 : "default-config" +0x000000e90000-0x000000ee0000 : "user-config" +0x000000ee0000-0x000000fe0000 : "log" +0x000000fe0000-0x000000ff0000 : "radio_bk" +0x000000ff0000-0x000001000000 : "radio" + +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221015092950.27467-2-zajec5@gmail.com +--- + drivers/mtd/parsers/Kconfig | 15 +++ + drivers/mtd/parsers/Makefile | 1 + + drivers/mtd/parsers/tplink_safeloader.c | 150 ++++++++++++++++++++++++ + 3 files changed, 166 insertions(+) + create mode 100644 drivers/mtd/parsers/tplink_safeloader.c + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -113,6 +113,21 @@ config MTD_AFS_PARTS + for your particular device. It won't happen automatically. The + 'physmap' map driver (CONFIG_MTD_PHYSMAP) does this, for example. + ++config MTD_PARSER_TPLINK_SAFELOADER ++ tristate "TP-Link Safeloader partitions parser" ++ depends on MTD && (ARCH_BCM_5301X || ATH79 || SOC_MT7620 || SOC_MT7621 || COMPILE_TEST) ++ help ++ TP-Link home routers use flash partitions to store various data. Info ++ about flash space layout is stored in a partitions table using a ++ custom ASCII-based format. ++ ++ That format was first found in devices with SafeLoader bootloader and ++ was named after it. Later it was adapted to CFE and U-Boot ++ bootloaders. ++ ++ This driver reads partitions table, parses it and creates MTD ++ partitions. ++ + config MTD_PARSER_TRX + tristate "Parser for TRX format partitions" + depends on MTD && (BCM47XX || ARCH_BCM_5301X || ARCH_MEDIATEK || RALINK || COMPILE_TEST) +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -9,6 +9,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += + ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o ++obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o + obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpart.o + obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o +--- /dev/null ++++ b/drivers/mtd/parsers/tplink_safeloader.c +@@ -0,0 +1,150 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright © 2022 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define TPLINK_SAFELOADER_DATA_OFFSET 4 ++#define TPLINK_SAFELOADER_MAX_PARTS 32 ++ ++struct safeloader_cmn_header { ++ __be32 size; ++ uint32_t unused; ++} __packed; ++ ++static void *mtd_parser_tplink_safeloader_read_table(struct mtd_info *mtd) ++{ ++ struct safeloader_cmn_header hdr; ++ struct device_node *np; ++ size_t bytes_read; ++ size_t offset; ++ size_t size; ++ char *buf; ++ int err; ++ ++ np = mtd_get_of_node(mtd); ++ if (mtd_is_partition(mtd)) ++ of_node_get(np); ++ else ++ np = of_get_child_by_name(np, "partitions"); ++ ++ if (of_property_read_u32(np, "partitions-table-offset", (u32 *)&offset)) { ++ pr_err("Failed to get partitions table offset\n"); ++ goto err_put; ++ } ++ ++ err = mtd_read(mtd, offset, sizeof(hdr), &bytes_read, (uint8_t *)&hdr); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("Failed to read from %s at 0x%zx\n", mtd->name, offset); ++ goto err_put; ++ } ++ ++ size = be32_to_cpu(hdr.size); ++ ++ buf = kmalloc(size + 1, GFP_KERNEL); ++ if (!buf) ++ goto err_put; ++ ++ err = mtd_read(mtd, offset + sizeof(hdr), size, &bytes_read, buf); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("Failed to read from %s at 0x%zx\n", mtd->name, offset + sizeof(hdr)); ++ goto err_kfree; ++ } ++ ++ buf[size] = '\0'; ++ ++ of_node_put(np); ++ ++ return buf; ++ ++err_kfree: ++ kfree(buf); ++err_put: ++ of_node_put(np); ++ return NULL; ++} ++ ++static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct mtd_partition *parts; ++ char name[65]; ++ size_t offset; ++ size_t bytes; ++ char *buf; ++ int idx; ++ int err; ++ ++ parts = kcalloc(TPLINK_SAFELOADER_MAX_PARTS, sizeof(*parts), GFP_KERNEL); ++ if (!parts) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ buf = mtd_parser_tplink_safeloader_read_table(mtd); ++ if (!buf) { ++ err = -ENOENT; ++ goto err_out; ++ } ++ ++ for (idx = 0, offset = TPLINK_SAFELOADER_DATA_OFFSET; ++ idx < TPLINK_SAFELOADER_MAX_PARTS && ++ sscanf(buf + offset, "partition %64s base 0x%llx size 0x%llx%zn\n", ++ name, &parts[idx].offset, &parts[idx].size, &bytes) == 3; ++ idx++, offset += bytes + 1) { ++ parts[idx].name = kstrdup(name, GFP_KERNEL); ++ if (!parts[idx].name) { ++ err = -ENOMEM; ++ goto err_free; ++ } ++ } ++ ++ if (idx == TPLINK_SAFELOADER_MAX_PARTS) ++ pr_warn("Reached maximum number of partitions!\n"); ++ ++ kfree(buf); ++ ++ *pparts = parts; ++ ++ return idx; ++ ++err_free: ++ for (idx -= 1; idx >= 0; idx--) ++ kfree(parts[idx].name); ++err_out: ++ return err; ++}; ++ ++static void mtd_parser_tplink_safeloader_cleanup(const struct mtd_partition *pparts, ++ int nr_parts) ++{ ++ int i; ++ ++ for (i = 0; i < nr_parts; i++) ++ kfree(pparts[i].name); ++ ++ kfree(pparts); ++} ++ ++static const struct of_device_id mtd_parser_tplink_safeloader_of_match_table[] = { ++ { .compatible = "tplink,safeloader-partitions" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mtd_parser_tplink_safeloader_of_match_table); ++ ++static struct mtd_part_parser mtd_parser_tplink_safeloader = { ++ .parse_fn = mtd_parser_tplink_safeloader_parse, ++ .cleanup = mtd_parser_tplink_safeloader_cleanup, ++ .name = "tplink-safeloader", ++ .of_match_table = mtd_parser_tplink_safeloader_of_match_table, ++}; ++module_mtd_part_parser(mtd_parser_tplink_safeloader); ++ ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/405-v6.1-mtd-core-add-missing-of_node_get-in-dynamic-partitio.patch b/target/linux/generic/backport-5.15/405-v6.1-mtd-core-add-missing-of_node_get-in-dynamic-partitio.patch new file mode 100644 index 0000000000..9399a00aa1 --- /dev/null +++ b/target/linux/generic/backport-5.15/405-v6.1-mtd-core-add-missing-of_node_get-in-dynamic-partitio.patch @@ -0,0 +1,101 @@ +From 12b58961de0bd88b3c7dfa5d21f6d67f4678b780 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 18 Oct 2022 07:18:22 +0200 +Subject: [PATCH] mtd: core: add missing of_node_get() in dynamic partitions + code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes unbalanced of_node_put(): +[ 1.078910] 6 cmdlinepart partitions found on MTD device gpmi-nand +[ 1.085116] Creating 6 MTD partitions on "gpmi-nand": +[ 1.090181] 0x000000000000-0x000008000000 : "nandboot" +[ 1.096952] 0x000008000000-0x000009000000 : "nandfit" +[ 1.103547] 0x000009000000-0x00000b000000 : "nandkernel" +[ 1.110317] 0x00000b000000-0x00000c000000 : "nanddtb" +[ 1.115525] ------------[ cut here ]------------ +[ 1.120141] refcount_t: addition on 0; use-after-free. +[ 1.125328] WARNING: CPU: 0 PID: 1 at lib/refcount.c:25 refcount_warn_saturate+0xdc/0x148 +[ 1.133528] Modules linked in: +[ 1.136589] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc7-next-20220930-04543-g8cf3f7 +[ 1.146342] Hardware name: Freescale i.MX8DXL DDR3L EVK (DT) +[ 1.151999] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) +[ 1.158965] pc : refcount_warn_saturate+0xdc/0x148 +[ 1.163760] lr : refcount_warn_saturate+0xdc/0x148 +[ 1.168556] sp : ffff800009ddb080 +[ 1.171866] x29: ffff800009ddb080 x28: ffff800009ddb35a x27: 0000000000000002 +[ 1.179015] x26: ffff8000098b06ad x25: ffffffffffffffff x24: ffff0a00ffffff05 +[ 1.186165] x23: ffff00001fdf6470 x22: ffff800009ddb367 x21: 0000000000000000 +[ 1.193314] x20: ffff00001fdfebe8 x19: ffff00001fdfec50 x18: ffffffffffffffff +[ 1.200464] x17: 0000000000000000 x16: 0000000000000118 x15: 0000000000000004 +[ 1.207614] x14: 0000000000000fff x13: ffff800009bca248 x12: 0000000000000003 +[ 1.214764] x11: 00000000ffffefff x10: c0000000ffffefff x9 : 4762cb2ccb52de00 +[ 1.221914] x8 : 4762cb2ccb52de00 x7 : 205d313431303231 x6 : 312e31202020205b +[ 1.229063] x5 : ffff800009d55c1f x4 : 0000000000000001 x3 : 0000000000000000 +[ 1.236213] x2 : 0000000000000000 x1 : ffff800009954be6 x0 : 000000000000002a +[ 1.243365] Call trace: +[ 1.245806] refcount_warn_saturate+0xdc/0x148 +[ 1.250253] kobject_get+0x98/0x9c +[ 1.253658] of_node_get+0x20/0x34 +[ 1.257072] of_fwnode_get+0x3c/0x54 +[ 1.260652] fwnode_get_nth_parent+0xd8/0xf4 +[ 1.264926] fwnode_full_name_string+0x3c/0xb4 +[ 1.269373] device_node_string+0x498/0x5b4 +[ 1.273561] pointer+0x41c/0x5d0 +[ 1.276793] vsnprintf+0x4d8/0x694 +[ 1.280198] vprintk_store+0x164/0x528 +[ 1.283951] vprintk_emit+0x98/0x164 +[ 1.287530] vprintk_default+0x44/0x6c +[ 1.291284] vprintk+0xf0/0x134 +[ 1.294428] _printk+0x54/0x7c +[ 1.297486] of_node_release+0xe8/0x128 +[ 1.301326] kobject_put+0x98/0xfc +[ 1.304732] of_node_put+0x1c/0x28 +[ 1.308137] add_mtd_device+0x484/0x6d4 +[ 1.311977] add_mtd_partitions+0xf0/0x1d0 +[ 1.316078] parse_mtd_partitions+0x45c/0x518 +[ 1.320439] mtd_device_parse_register+0xb0/0x274 +[ 1.325147] gpmi_nand_probe+0x51c/0x650 +[ 1.329074] platform_probe+0xa8/0xd0 +[ 1.332740] really_probe+0x130/0x334 +[ 1.336406] __driver_probe_device+0xb4/0xe0 +[ 1.340681] driver_probe_device+0x3c/0x1f8 +[ 1.344869] __driver_attach+0xdc/0x1a4 +[ 1.348708] bus_for_each_dev+0x80/0xcc +[ 1.352548] driver_attach+0x24/0x30 +[ 1.356127] bus_add_driver+0x108/0x1f4 +[ 1.359967] driver_register+0x78/0x114 +[ 1.363807] __platform_driver_register+0x24/0x30 +[ 1.368515] gpmi_nand_driver_init+0x1c/0x28 +[ 1.372798] do_one_initcall+0xbc/0x238 +[ 1.376638] do_initcall_level+0x94/0xb4 +[ 1.380565] do_initcalls+0x54/0x94 +[ 1.384058] do_basic_setup+0x1c/0x28 +[ 1.387724] kernel_init_freeable+0x110/0x188 +[ 1.392084] kernel_init+0x20/0x1a0 +[ 1.395578] ret_from_fork+0x10/0x20 +[ 1.399157] ---[ end trace 0000000000000000 ]--- +[ 1.403782] ------------[ cut here ]------------ + +Reported-by: Han Xu +Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions") +Signed-off-by: Rafał Miłecki +Tested-by: Han Xu +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221018051822.28685-1-zajec5@gmail.com +--- + drivers/mtd/mtdcore.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -580,7 +580,7 @@ static void mtd_check_of_node(struct mtd + if (!mtd_is_partition(mtd)) + return; + parent = mtd->parent; +- parent_dn = dev_of_node(&parent->dev); ++ parent_dn = of_node_get(dev_of_node(&parent->dev)); + if (!parent_dn) + return; + diff --git a/target/linux/generic/backport-5.15/406-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch b/target/linux/generic/backport-5.15/406-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch new file mode 100644 index 0000000000..7e9645ea98 --- /dev/null +++ b/target/linux/generic/backport-5.15/406-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch @@ -0,0 +1,65 @@ +From 63db0cb35e1cb3b3c134906d1062f65513fdda2d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 4 Oct 2022 10:37:09 +0200 +Subject: [PATCH] mtd: core: simplify (a bit) code find partition-matching + dynamic OF node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Don't hardcode "partition-" string twice +2. Use simpler logic & use ->name to avoid of_property_read_string() +3. Use mtd_get_of_node() helper + +Cc: Christian Marangi +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221004083710.27704-1-zajec5@gmail.com +--- + drivers/mtd/mtdcore.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -569,18 +569,16 @@ static void mtd_check_of_node(struct mtd + struct device_node *partitions, *parent_dn, *mtd_dn = NULL; + const char *pname, *prefix = "partition-"; + int plen, mtd_name_len, offset, prefix_len; +- struct mtd_info *parent; + bool found = false; + + /* Check if MTD already has a device node */ +- if (dev_of_node(&mtd->dev)) ++ if (mtd_get_of_node(mtd)) + return; + + /* Check if a partitions node exist */ + if (!mtd_is_partition(mtd)) + return; +- parent = mtd->parent; +- parent_dn = of_node_get(dev_of_node(&parent->dev)); ++ parent_dn = of_node_get(mtd_get_of_node(mtd->parent)); + if (!parent_dn) + return; + +@@ -593,15 +591,15 @@ static void mtd_check_of_node(struct mtd + + /* Search if a partition is defined with the same name */ + for_each_child_of_node(partitions, mtd_dn) { +- offset = 0; +- + /* Skip partition with no/wrong prefix */ +- if (!of_node_name_prefix(mtd_dn, "partition-")) ++ if (!of_node_name_prefix(mtd_dn, prefix)) + continue; + + /* Label have priority. Check that first */ +- if (of_property_read_string(mtd_dn, "label", &pname)) { +- of_property_read_string(mtd_dn, "name", &pname); ++ if (!of_property_read_string(mtd_dn, "label", &pname)) { ++ offset = 0; ++ } else { ++ pname = mtd_dn->name; + offset = prefix_len; + } + diff --git a/target/linux/generic/backport-5.15/406-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch b/target/linux/generic/backport-5.15/406-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch new file mode 100644 index 0000000000..48a7c13cd0 --- /dev/null +++ b/target/linux/generic/backport-5.15/406-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch @@ -0,0 +1,84 @@ +From ddb8cefb7af288950447ca6eeeafb09977dab56f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 4 Oct 2022 10:37:10 +0200 +Subject: [PATCH] mtd: core: try to find OF node for every MTD partition +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far this feature was limited to the top-level "nvmem-cells" node. +There are multiple parsers creating partitions and subpartitions +dynamically. Extend that code to handle them too. + +This allows finding partition-* node for every MTD (sub)partition. + +Random example: + +partitions { + compatible = "brcm,bcm947xx-cfe-partitions"; + + partition-firmware { + compatible = "brcm,trx"; + + partition-loader { + }; + }; +}; + +Cc: Christian Marangi +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221004083710.27704-2-zajec5@gmail.com +--- + drivers/mtd/mtdcore.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -569,20 +569,22 @@ static void mtd_check_of_node(struct mtd + struct device_node *partitions, *parent_dn, *mtd_dn = NULL; + const char *pname, *prefix = "partition-"; + int plen, mtd_name_len, offset, prefix_len; +- bool found = false; + + /* Check if MTD already has a device node */ + if (mtd_get_of_node(mtd)) + return; + +- /* Check if a partitions node exist */ + if (!mtd_is_partition(mtd)) + return; ++ + parent_dn = of_node_get(mtd_get_of_node(mtd->parent)); + if (!parent_dn) + return; + +- partitions = of_get_child_by_name(parent_dn, "partitions"); ++ if (mtd_is_partition(mtd->parent)) ++ partitions = of_node_get(parent_dn); ++ else ++ partitions = of_get_child_by_name(parent_dn, "partitions"); + if (!partitions) + goto exit_parent; + +@@ -606,19 +608,11 @@ static void mtd_check_of_node(struct mtd + plen = strlen(pname) - offset; + if (plen == mtd_name_len && + !strncmp(mtd->name, pname + offset, plen)) { +- found = true; ++ mtd_set_of_node(mtd, mtd_dn); + break; + } + } + +- if (!found) +- goto exit_partitions; +- +- /* Set of_node only for nvmem */ +- if (of_device_is_compatible(mtd_dn, "nvmem-cells")) +- mtd_set_of_node(mtd, mtd_dn); +- +-exit_partitions: + of_node_put(partitions); + exit_parent: + of_node_put(parent_dn); diff --git a/target/linux/generic/backport-5.15/421-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch b/target/linux/generic/backport-5.15/421-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch new file mode 100644 index 0000000000..9f543365a5 --- /dev/null +++ b/target/linux/generic/backport-5.15/421-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch @@ -0,0 +1,229 @@ +From aec4d5f5ffd0f0092bd9dc21ea90e0bc237d4b74 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 15 Oct 2022 11:29:50 +0200 +Subject: [PATCH] mtd: parsers: add TP-Link SafeLoader partitions table parser +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This parser deals with most TP-Link home routers. It reads info about +partitions and registers them in the MTD subsystem. + +Example from TP-Link Archer C5 V2: + +spi-nor spi0.0: s25fl128s1 (16384 Kbytes) +15 tplink-safeloader partitions found on MTD device spi0.0 +Creating 15 MTD partitions on "spi0.0": +0x000000000000-0x000000040000 : "fs-uboot" +0x000000040000-0x000000440000 : "os-image" +0x000000440000-0x000000e40000 : "rootfs" +0x000000e40000-0x000000e40200 : "default-mac" +0x000000e40200-0x000000e40400 : "pin" +0x000000e40400-0x000000e40600 : "product-info" +0x000000e50000-0x000000e60000 : "partition-table" +0x000000e60000-0x000000e60200 : "soft-version" +0x000000e61000-0x000000e70000 : "support-list" +0x000000e70000-0x000000e80000 : "profile" +0x000000e80000-0x000000e90000 : "default-config" +0x000000e90000-0x000000ee0000 : "user-config" +0x000000ee0000-0x000000fe0000 : "log" +0x000000fe0000-0x000000ff0000 : "radio_bk" +0x000000ff0000-0x000001000000 : "radio" + +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20221015092950.27467-2-zajec5@gmail.com +--- + drivers/mtd/parsers/Kconfig | 15 +++ + drivers/mtd/parsers/Makefile | 1 + + drivers/mtd/parsers/tplink_safeloader.c | 150 ++++++++++++++++++++++++ + 3 files changed, 166 insertions(+) + create mode 100644 drivers/mtd/parsers/tplink_safeloader.c + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -113,6 +113,21 @@ config MTD_AFS_PARTS + for your particular device. It won't happen automatically. The + 'physmap' map driver (CONFIG_MTD_PHYSMAP) does this, for example. + ++config MTD_PARSER_TPLINK_SAFELOADER ++ tristate "TP-Link Safeloader partitions parser" ++ depends on MTD && (ARCH_BCM_5301X || ATH79 || SOC_MT7620 || SOC_MT7621 || COMPILE_TEST) ++ help ++ TP-Link home routers use flash partitions to store various data. Info ++ about flash space layout is stored in a partitions table using a ++ custom ASCII-based format. ++ ++ That format was first found in devices with SafeLoader bootloader and ++ was named after it. Later it was adapted to CFE and U-Boot ++ bootloaders. ++ ++ This driver reads partitions table, parses it and creates MTD ++ partitions. ++ + config MTD_PARSER_TRX + tristate "Parser for TRX format partitions" + depends on MTD && (BCM47XX || ARCH_BCM_5301X || ARCH_MEDIATEK || RALINK || COMPILE_TEST) +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -9,6 +9,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += + ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o ++obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o + obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpart.o + obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o +--- /dev/null ++++ b/drivers/mtd/parsers/tplink_safeloader.c +@@ -0,0 +1,150 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright © 2022 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define TPLINK_SAFELOADER_DATA_OFFSET 4 ++#define TPLINK_SAFELOADER_MAX_PARTS 32 ++ ++struct safeloader_cmn_header { ++ __be32 size; ++ uint32_t unused; ++} __packed; ++ ++static void *mtd_parser_tplink_safeloader_read_table(struct mtd_info *mtd) ++{ ++ struct safeloader_cmn_header hdr; ++ struct device_node *np; ++ size_t bytes_read; ++ size_t offset; ++ size_t size; ++ char *buf; ++ int err; ++ ++ np = mtd_get_of_node(mtd); ++ if (mtd_is_partition(mtd)) ++ of_node_get(np); ++ else ++ np = of_get_child_by_name(np, "partitions"); ++ ++ if (of_property_read_u32(np, "partitions-table-offset", (u32 *)&offset)) { ++ pr_err("Failed to get partitions table offset\n"); ++ goto err_put; ++ } ++ ++ err = mtd_read(mtd, offset, sizeof(hdr), &bytes_read, (uint8_t *)&hdr); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("Failed to read from %s at 0x%zx\n", mtd->name, offset); ++ goto err_put; ++ } ++ ++ size = be32_to_cpu(hdr.size); ++ ++ buf = kmalloc(size + 1, GFP_KERNEL); ++ if (!buf) ++ goto err_put; ++ ++ err = mtd_read(mtd, offset + sizeof(hdr), size, &bytes_read, buf); ++ if (err && !mtd_is_bitflip(err)) { ++ pr_err("Failed to read from %s at 0x%zx\n", mtd->name, offset + sizeof(hdr)); ++ goto err_kfree; ++ } ++ ++ buf[size] = '\0'; ++ ++ of_node_put(np); ++ ++ return buf; ++ ++err_kfree: ++ kfree(buf); ++err_put: ++ of_node_put(np); ++ return NULL; ++} ++ ++static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) ++{ ++ struct mtd_partition *parts; ++ char name[65]; ++ size_t offset; ++ size_t bytes; ++ char *buf; ++ int idx; ++ int err; ++ ++ parts = kcalloc(TPLINK_SAFELOADER_MAX_PARTS, sizeof(*parts), GFP_KERNEL); ++ if (!parts) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ buf = mtd_parser_tplink_safeloader_read_table(mtd); ++ if (!buf) { ++ err = -ENOENT; ++ goto err_out; ++ } ++ ++ for (idx = 0, offset = TPLINK_SAFELOADER_DATA_OFFSET; ++ idx < TPLINK_SAFELOADER_MAX_PARTS && ++ sscanf(buf + offset, "partition %64s base 0x%llx size 0x%llx%zn\n", ++ name, &parts[idx].offset, &parts[idx].size, &bytes) == 3; ++ idx++, offset += bytes + 1) { ++ parts[idx].name = kstrdup(name, GFP_KERNEL); ++ if (!parts[idx].name) { ++ err = -ENOMEM; ++ goto err_free; ++ } ++ } ++ ++ if (idx == TPLINK_SAFELOADER_MAX_PARTS) ++ pr_warn("Reached maximum number of partitions!\n"); ++ ++ kfree(buf); ++ ++ *pparts = parts; ++ ++ return idx; ++ ++err_free: ++ for (idx -= 1; idx >= 0; idx--) ++ kfree(parts[idx].name); ++err_out: ++ return err; ++}; ++ ++static void mtd_parser_tplink_safeloader_cleanup(const struct mtd_partition *pparts, ++ int nr_parts) ++{ ++ int i; ++ ++ for (i = 0; i < nr_parts; i++) ++ kfree(pparts[i].name); ++ ++ kfree(pparts); ++} ++ ++static const struct of_device_id mtd_parser_tplink_safeloader_of_match_table[] = { ++ { .compatible = "tplink,safeloader-partitions" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, mtd_parser_tplink_safeloader_of_match_table); ++ ++static struct mtd_part_parser mtd_parser_tplink_safeloader = { ++ .parse_fn = mtd_parser_tplink_safeloader_parse, ++ .cleanup = mtd_parser_tplink_safeloader_cleanup, ++ .name = "tplink-safeloader", ++ .of_match_table = mtd_parser_tplink_safeloader_of_match_table, ++}; ++module_mtd_part_parser(mtd_parser_tplink_safeloader); ++ ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch index 55388aa40c..a650320cd0 100644 --- a/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch +++ b/target/linux/generic/hack-5.10/402-mtd-blktrans-call-add-disks-after-mtd-device.patch @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle #include "mtdcore.h" -@@ -924,6 +925,8 @@ int mtd_device_parse_register(struct mtd +@@ -916,6 +917,8 @@ int mtd_device_parse_register(struct mtd register_reboot_notifier(&mtd->reboot_notifier); } diff --git a/target/linux/generic/hack-5.10/420-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/hack-5.10/420-mtd-set-rootfs-to-be-root-dev.patch index 5529bba12c..fa3b175dcf 100644 --- a/target/linux/generic/hack-5.10/420-mtd-set-rootfs-to-be-root-dev.patch +++ b/target/linux/generic/hack-5.10/420-mtd-set-rootfs-to-be-root-dev.patch @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos #include #include -@@ -767,6 +768,19 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -759,6 +760,19 @@ int add_mtd_device(struct mtd_info *mtd) of this try_ nonsense, and no bitching about it either. :) */ __module_get(THIS_MODULE); diff --git a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch index eaba093376..dcb1aaa6e4 100644 --- a/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch +++ b/target/linux/generic/hack-5.15/402-mtd-blktrans-call-add-disks-after-mtd-device.patch @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle #include "mtdcore.h" -@@ -1075,6 +1076,8 @@ int mtd_device_parse_register(struct mtd +@@ -1067,6 +1068,8 @@ int mtd_device_parse_register(struct mtd ret = mtd_otp_nvmem_add(mtd); diff --git a/target/linux/generic/hack-5.15/420-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/hack-5.15/420-mtd-set-rootfs-to-be-root-dev.patch index 8bf8288bbd..f3004b60fd 100644 --- a/target/linux/generic/hack-5.15/420-mtd-set-rootfs-to-be-root-dev.patch +++ b/target/linux/generic/hack-5.15/420-mtd-set-rootfs-to-be-root-dev.patch @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos #include #include -@@ -770,6 +771,16 @@ int add_mtd_device(struct mtd_info *mtd) +@@ -762,6 +763,16 @@ int add_mtd_device(struct mtd_info *mtd) of this try_ nonsense, and no bitching about it either. :) */ __module_get(THIS_MODULE); diff --git a/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch index 446bc0bef1..5c7b57b373 100644 --- a/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch @@ -16,7 +16,7 @@ Signed-off-by: Thibaut VARÈNE --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -204,3 +204,12 @@ config MTD_SERCOMM_PARTS +@@ -219,3 +219,12 @@ config MTD_SERCOMM_PARTS partition map. This partition table contains real partition offsets, which may differ from device to device depending on the number and location of bad blocks on NAND. @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -14,3 +14,4 @@ obj-$(CONFIG_MTD_PARSER_TRX) += parser_ +@@ -15,3 +15,4 @@ obj-$(CONFIG_MTD_PARSER_TRX) += parser_ obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpart.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o diff --git a/target/linux/generic/pending-5.15/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.15/435-mtd-add-routerbootpart-parser-config.patch index 30f5334af4..ee949f73c0 100644 --- a/target/linux/generic/pending-5.15/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.15/435-mtd-add-routerbootpart-parser-config.patch @@ -16,7 +16,7 @@ Signed-off-by: Thibaut VARÈNE --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -211,3 +211,12 @@ config MTD_SERCOMM_PARTS +@@ -226,3 +226,12 @@ config MTD_SERCOMM_PARTS partition map. This partition table contains real partition offsets, which may differ from device to device depending on the number and location of bad blocks on NAND. @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -15,3 +15,4 @@ obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpa +@@ -16,3 +16,4 @@ obj-$(CONFIG_MTD_SERCOMM_PARTS) += scpa obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o obj-$(CONFIG_MTD_QCOMSMEM_PARTS) += qcomsmempart.o diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 1089a7f3f8..36f1f7c24a 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -52,11 +52,14 @@ ipq40xx_setup_interfaces() cellc,rtl30vw) ucidef_set_interface_lan "lan1 lan2" ;; + compex,wpj428) + ucidef_set_interface_lan "lan1 lan2" + ;; glinet,gl-b1300) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; - compex,wpj428) - ucidef_set_interface_lan "lan1 lan2" + mikrotik,wap-ac) + ucidef_set_interface_lan "sw-eth1 sw-eth2" ;; zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 18c24e0511..e4a5eb3e89 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -26,8 +26,8 @@ preinit_set_mac_address() { ;; mikrotik,wap-ac) base_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base) - ip link set dev eth0 address "$base_mac" - ip link set dev eth1 address $(macaddr_add "$base_mac" 1) + ip link set dev sw-eth1 address "$base_mac" + ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1) ;; zyxel,nbg6617) base_mac=$(cat /sys/class/net/eth0/address) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts index e6a6202216..ecbdfac15f 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts @@ -187,6 +187,24 @@ status = "okay"; }; +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + label = "sw-eth2"; +}; + +&swport5 { + status = "okay"; + label = "sw-eth1"; +}; + &wifi0 { status = "okay"; diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk index 8491ff4a42..d1f0829cd3 100644 --- a/target/linux/ipq40xx/image/mikrotik.mk +++ b/target/linux/ipq40xx/image/mikrotik.mk @@ -69,5 +69,4 @@ define Device/mikrotik_wap-ac SOC := qcom-ipq4018 DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers endef -# Missing DSA Setup -#TARGET_DEVICES += mikrotik_wap-ac +TARGET_DEVICES += mikrotik_wap-ac diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi index be82acd204..060b88f9dd 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a.dtsi @@ -297,9 +297,8 @@ compatible = "mediatek,mt7986-auxadc", "mediatek,mt7622-auxadc"; reg = <0 0x1100d000 0 0x1000>; - clocks = <&infracfg CLK_INFRA_ADC_26M_CK>, - <&infracfg CLK_INFRA_ADC_FRC_CK>; - clock-names = "main", "32k"; + clocks = <&infracfg CLK_INFRA_ADC_26M_CK>; + clock-names = "main"; #io-channel-cells = <1>; }; @@ -349,9 +348,8 @@ reg = <0 0x1100c800 0 0x800>; interrupts = ; clocks = <&infracfg CLK_INFRA_THERM_CK>, - <&infracfg CLK_INFRA_ADC_26M_CK>, - <&infracfg CLK_INFRA_ADC_FRC_CK>; - clock-names = "therm", "auxadc", "adc_32k"; + <&infracfg CLK_INFRA_ADC_26M_CK>; + clock-names = "therm", "auxadc"; mediatek,auxadc = <&auxadc>; mediatek,apmixedsys = <&apmixedsys>; nvmem-cells = <&thermal_calibration>; diff --git a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-infracfg.c b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-infracfg.c index 3be168c34f..82279dfcf5 100644 --- a/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-infracfg.c +++ b/target/linux/mediatek/files-5.15/drivers/clk/mediatek/clk-mt7986-infracfg.c @@ -153,7 +153,7 @@ static const struct mtk_gate infra_clks[] = { 18), GATE_INFRA1(CLK_INFRA_MSDC_66M_CK, "infra_msdc_66m", "infra_sysaxi_d2", 19), - GATE_INFRA1(CLK_INFRA_ADC_26M_CK, "infra_adc_26m", "csw_f26m_sel", 20), + GATE_INFRA1(CLK_INFRA_ADC_26M_CK, "infra_adc_26m", "infra_adc_frc", 20), GATE_INFRA1(CLK_INFRA_ADC_FRC_CK, "infra_adc_frc", "csw_f26m_sel", 21), GATE_INFRA1(CLK_INFRA_FBIST2FPC_CK, "infra_fbist2fpc", "nfi1x_sel", 23), /* INFRA2 */ diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index ace254992a..2e21cc3ce5 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -183,7 +183,6 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y -CONFIG_IIO=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_INITRAMFS_SOURCE="" CONFIG_IO_URING=y @@ -206,7 +205,6 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MEDIATEK_GE_PHY=y -CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 diff --git a/target/linux/mediatek/modules.mk b/target/linux/mediatek/modules.mk index 42f2d7d832..f46a6ad2ff 100644 --- a/target/linux/mediatek/modules.mk +++ b/target/linux/mediatek/modules.mk @@ -27,16 +27,13 @@ endef $(eval $(call KernelPackage,btmtkuart)) -define KernelPackage/sdhci-mtk - SUBMENU:=Other modules - TITLE:=Mediatek SDHCI driver - DEPENDS:=@TARGET_mediatek_mt7622 +kmod-sdhci - KCONFIG:=CONFIG_MMC_MTK +define KernelPackage/iio-mt6577-auxadc + TITLE:=Mediatek AUXADC driver + DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623||TARGET_mediatek_filogic) + KCONFIG:=CONFIG_MEDIATEK_MT6577_AUXADC FILES:= \ - $(LINUX_DIR)/drivers/mmc/host/mtk-sd.ko - AUTOLOAD:=$(call AutoProbe,mtk-sd,1) + $(LINUX_DIR)/drivers/iio/adc/mt6577_auxadc.ko + AUTOLOAD:=$(call AutoProbe,mt6577_auxadc) + $(call AddDepends/iio) endef - -$(eval $(call KernelPackage,sdhci-mtk)) - - +$(eval $(call KernelPackage,iio-mt6577-auxadc)) diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index 1036793145..e62eba7ef1 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -6,8 +6,8 @@ platform_do_upgrade() { case "$board" in bananapi,bpi-r64) - export_bootdevice - export_partdevice rootdev 0 + local rootdev="$(cmdline_get_var root)" + rootdev="${rootdev##*/}" case "$rootdev" in mmc*) CI_ROOTDEV="$rootdev" diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index 13bc77bb98..4a753c1b9f 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -96,8 +96,8 @@ CONFIG_CONFIGFS_FS=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 # CONFIG_CPUFREQ_DT is not set CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y @@ -231,7 +231,6 @@ CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MEDIATEK_GE_PHY=y -CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 @@ -258,6 +257,7 @@ CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIT_FW=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index a829624861..279599e97f 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -267,7 +267,6 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y -CONFIG_IIO=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y @@ -322,7 +321,6 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_GPIO=y CONFIG_MEDIATEK_GE_PHY=y -CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y diff --git a/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch b/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch deleted file mode 100644 index 5b98235ff4..0000000000 --- a/target/linux/mediatek/patches-5.15/501-auxadc-add-auxadc-32k-clk.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- a/drivers/iio/adc/mt6577_auxadc.c -+++ b/drivers/iio/adc/mt6577_auxadc.c -@@ -42,6 +42,7 @@ struct mtk_auxadc_compatible { - struct mt6577_auxadc_device { - void __iomem *reg_base; - struct clk *adc_clk; -+ struct clk *adc_32k_clk; - struct mutex lock; - const struct mtk_auxadc_compatible *dev_comp; - }; -@@ -222,6 +223,14 @@ static int __maybe_unused mt6577_auxadc_ - return ret; - } - -+ if (!IS_ERR(adc_dev->adc_32k_clk)) { -+ ret = clk_prepare_enable(adc_dev->adc_32k_clk); -+ if (ret) { -+ pr_err("failed to enable auxadc clock\n"); -+ return ret; -+ } -+ } -+ - mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, - MT6577_AUXADC_PDN_EN, 0); - mdelay(MT6577_AUXADC_POWER_READY_MS); -@@ -236,6 +243,8 @@ static int __maybe_unused mt6577_auxadc_ - - mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, - 0, MT6577_AUXADC_PDN_EN); -+ -+ clk_disable_unprepare(adc_dev->adc_32k_clk); - clk_disable_unprepare(adc_dev->adc_clk); - - return 0; -@@ -277,6 +286,17 @@ static int mt6577_auxadc_probe(struct pl - return ret; - } - -+ adc_dev->adc_32k_clk = devm_clk_get(&pdev->dev, "32k"); -+ if (IS_ERR(adc_dev->adc_32k_clk)) { -+ dev_err(&pdev->dev, "failed to get auxadc 32k clock\n"); -+ } else { -+ ret = clk_prepare_enable(adc_dev->adc_32k_clk); -+ if (ret) { -+ dev_err(&pdev->dev, "failed to enable auxadc 32k clock\n"); -+ return ret; -+ } -+ } -+ - adc_clk_rate = clk_get_rate(adc_dev->adc_clk); - if (!adc_clk_rate) { - ret = -EINVAL; -@@ -306,6 +326,7 @@ err_power_off: - mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, - 0, MT6577_AUXADC_PDN_EN); - err_disable_clk: -+ clk_disable_unprepare(adc_dev->adc_32k_clk); - clk_disable_unprepare(adc_dev->adc_clk); - return ret; - } -@@ -320,6 +341,7 @@ static int mt6577_auxadc_remove(struct p - mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, - 0, MT6577_AUXADC_PDN_EN); - -+ clk_disable_unprepare(adc_dev->adc_32k_clk); - clk_disable_unprepare(adc_dev->adc_clk); - - return 0; diff --git a/target/linux/mediatek/patches-5.15/800-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch similarity index 70% rename from target/linux/mediatek/patches-5.15/800-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch rename to target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch index e57f742fc8..785bfe53f5 100644 --- a/target/linux/mediatek/patches-5.15/800-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch +++ b/target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch @@ -1,15 +1,16 @@ -From 44ae4ed142265a6d50a9d3e6f4c395f97b6849ab Mon Sep 17 00:00:00 2001 -From: Zhanyong Wang -Date: Sat, 6 Nov 2021 20:06:30 +0800 -Subject: [PATCH 2/5] nvmem: mtk-efuse: support minimum one byte access stride - and granularity +From 98e2c4efae214fb7086cac9117616eb6ea11475d Mon Sep 17 00:00:00 2001 +From: Chunfeng Yun +Date: Thu, 9 Dec 2021 17:42:34 +0000 +Subject: [PATCH] nvmem: mtk-efuse: support minimum one byte access stride and + granularity In order to support nvmem bits property, should support minimum 1 byte read stride and minimum 1 byte read granularity at the same time. Signed-off-by: Chunfeng Yun -Signed-off-by: Zhanyong Wang -Change-Id: Iafe1ebf195d58a3e9e3518913f795d14a01dfd3b +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211209174235.14049-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/mtk-efuse.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/target/linux/mediatek/patches-5.15/805-thermal-drivers-mediatek-add-support-for-MT7986-and-.patch b/target/linux/mediatek/patches-5.15/805-thermal-drivers-mediatek-add-support-for-MT7986-and-.patch index ff2b71872c..ed72f78009 100644 --- a/target/linux/mediatek/patches-5.15/805-thermal-drivers-mediatek-add-support-for-MT7986-and-.patch +++ b/target/linux/mediatek/patches-5.15/805-thermal-drivers-mediatek-add-support-for-MT7986-and-.patch @@ -70,15 +70,7 @@ Signed-off-by: Daniel Golle struct mtk_thermal; struct thermal_bank_cfg { -@@ -279,6 +316,7 @@ struct mtk_thermal { - - struct clk *clk_peri_therm; - struct clk *clk_auxadc; -+ struct clk *clk_adc_32k; - /* lock: for getting and putting banks */ - struct mutex lock; - -@@ -386,6 +424,14 @@ static const int mt7622_mux_values[MT762 +@@ -386,6 +423,14 @@ static const int mt7622_mux_values[MT762 static const int mt7622_vts_index[MT7622_NUM_SENSORS] = { VTS1 }; static const int mt7622_tc_offset[MT7622_NUM_CONTROLLER] = { 0x0, }; @@ -93,7 +85,7 @@ Signed-off-by: Daniel Golle /* * The MT8173 thermal controller has four banks. Each bank can read up to * four temperature sensors simultaneously. The MT8173 has a total of 5 -@@ -549,6 +595,30 @@ static const struct mtk_thermal_data mt8 +@@ -549,6 +594,30 @@ static const struct mtk_thermal_data mt8 .version = MTK_THERMAL_V1, }; @@ -124,7 +116,7 @@ Signed-off-by: Daniel Golle /** * raw_to_mcelsius - convert a raw ADC value to mcelsius * @mt: The thermal controller -@@ -603,6 +673,22 @@ static int raw_to_mcelsius_v2(struct mtk +@@ -603,6 +672,22 @@ static int raw_to_mcelsius_v2(struct mtk return (format_2 - tmp) * 100; } @@ -147,7 +139,7 @@ Signed-off-by: Daniel Golle /** * mtk_thermal_get_bank - get bank * @bank: The bank -@@ -659,9 +745,12 @@ static int mtk_thermal_bank_temperature( +@@ -659,9 +744,12 @@ static int mtk_thermal_bank_temperature( if (mt->conf->version == MTK_THERMAL_V1) { temp = raw_to_mcelsius_v1( mt, conf->bank_data[bank->id].sensors[i], raw); @@ -161,7 +153,7 @@ Signed-off-by: Daniel Golle } /* -@@ -887,6 +976,26 @@ static int mtk_thermal_extract_efuse_v2( +@@ -887,6 +975,26 @@ static int mtk_thermal_extract_efuse_v2( return 0; } @@ -188,7 +180,7 @@ Signed-off-by: Daniel Golle static int mtk_thermal_get_calibration_data(struct device *dev, struct mtk_thermal *mt) { -@@ -897,6 +1006,7 @@ static int mtk_thermal_get_calibration_d +@@ -897,6 +1005,7 @@ static int mtk_thermal_get_calibration_d /* Start with default values */ mt->adc_ge = 512; @@ -196,7 +188,7 @@ Signed-off-by: Daniel Golle for (i = 0; i < mt->conf->num_sensors; i++) mt->vts[i] = 260; mt->degc_cali = 40; -@@ -924,8 +1034,10 @@ static int mtk_thermal_get_calibration_d +@@ -924,8 +1033,10 @@ static int mtk_thermal_get_calibration_d if (mt->conf->version == MTK_THERMAL_V1) ret = mtk_thermal_extract_efuse_v1(mt, buf); @@ -208,7 +200,7 @@ Signed-off-by: Daniel Golle if (ret) { dev_info(dev, "Device not calibrated, using default calibration values\n"); -@@ -956,6 +1068,10 @@ static const struct of_device_id mtk_the +@@ -956,6 +1067,10 @@ static const struct of_device_id mtk_the .data = (void *)&mt7622_thermal_data, }, { @@ -219,40 +211,7 @@ Signed-off-by: Daniel Golle .compatible = "mediatek,mt8183-thermal", .data = (void *)&mt8183_thermal_data, }, { -@@ -1009,6 +1125,12 @@ static int mtk_thermal_probe(struct plat - if (IS_ERR(mt->clk_auxadc)) - return PTR_ERR(mt->clk_auxadc); - -+ if (mt->conf->version == MTK_THERMAL_V3) { -+ mt->clk_adc_32k = devm_clk_get(&pdev->dev, "adc_32k"); -+ if (IS_ERR(mt->clk_adc_32k)) -+ return PTR_ERR(mt->clk_adc_32k); -+ } -+ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - mt->thermal_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(mt->thermal_base)) -@@ -1058,10 +1180,18 @@ static int mtk_thermal_probe(struct plat - if (ret) - return ret; - -+ if (mt->conf->version == MTK_THERMAL_V3) { -+ ret = clk_prepare_enable(mt->clk_adc_32k); -+ if (ret) { -+ dev_err(&pdev->dev, "Can't enable auxadc 32k clk: %d\n", ret); -+ return ret; -+ } -+ } -+ - ret = clk_prepare_enable(mt->clk_auxadc); - if (ret) { - dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret); -- return ret; -+ goto err_disable_clk_adc_32k; - } - - ret = clk_prepare_enable(mt->clk_peri_therm); -@@ -1070,7 +1200,8 @@ static int mtk_thermal_probe(struct plat +@@ -1070,7 +1185,8 @@ static int mtk_thermal_probe(struct plat goto err_disable_clk_auxadc; } @@ -262,23 +221,3 @@ Signed-off-by: Daniel Golle mtk_thermal_turn_on_buffer(apmixed_base); mtk_thermal_release_periodic_ts(mt, auxadc_base); } -@@ -1099,6 +1230,9 @@ err_disable_clk_peri_therm: - clk_disable_unprepare(mt->clk_peri_therm); - err_disable_clk_auxadc: - clk_disable_unprepare(mt->clk_auxadc); -+err_disable_clk_adc_32k: -+ if (mt->conf->version == MTK_THERMAL_V3) -+ clk_disable_unprepare(mt->clk_adc_32k); - - return ret; - } -@@ -1110,6 +1244,9 @@ static int mtk_thermal_remove(struct pla - clk_disable_unprepare(mt->clk_peri_therm); - clk_disable_unprepare(mt->clk_auxadc); - -+ if (mt->conf->version == MTK_THERMAL_V3) -+ clk_disable_unprepare(mt->clk_adc_32k); -+ - return 0; - } - diff --git a/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch index 62f610492f..5b14d1f8cb 100644 --- a/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.10/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -851,6 +851,17 @@ out_error: +@@ -843,6 +843,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index d48b220231..0992d6ba9f 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -28,11 +28,6 @@ LOADER_FLASH_START := $(ldrflashstart-y) KERNEL_DTB = kernel-bin | append-dtb | lzma -define Build/edimax-header - $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) - @mv $@.new $@ -endef - define Build/jcg-header $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \ $(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \ diff --git a/target/linux/ramips/mt7620/config-5.10 b/target/linux/ramips/mt7620/config-5.10 index f6b3882249..fb0fd1d30b 100644 --- a/target/linux/ramips/mt7620/config-5.10 +++ b/target/linux/ramips/mt7620/config-5.10 @@ -112,6 +112,7 @@ CONFIG_MODULES_USE_ELF_REL=y # CONFIG_MT7621_WDT is not set # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y diff --git a/target/linux/ramips/mt7620/config-5.15 b/target/linux/ramips/mt7620/config-5.15 index d6c6995efe..0f8aca000c 100644 --- a/target/linux/ramips/mt7620/config-5.15 +++ b/target/linux/ramips/mt7620/config-5.15 @@ -113,6 +113,7 @@ CONFIG_MODULES_USE_ELF_REL=y # CONFIG_MT7621_WDT is not set # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y diff --git a/target/linux/ramips/mt7621/config-5.10 b/target/linux/ramips/mt7621/config-5.10 index 1b415f3e66..b6c7407484 100644 --- a/target/linux/ramips/mt7621/config-5.10 +++ b/target/linux/ramips/mt7621/config-5.10 @@ -159,6 +159,7 @@ CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_NAND_MT7621=y CONFIG_MTD_NAND_MTK_BMT=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_ROUTERBOOT_PARTS=y diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15 index a8094fe305..adda3fef64 100644 --- a/target/linux/ramips/mt7621/config-5.15 +++ b/target/linux/ramips/mt7621/config-5.15 @@ -160,6 +160,7 @@ CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_NAND_MT7621=y CONFIG_MTD_NAND_MTK_BMT=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_ROUTERBOOT_PARTS=y diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 963a20c653..38ff38bac5 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -117,6 +117,13 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "6@eth0" ;; + kroks,kndrt31r19) + ucidef_add_switch "switch0" \ + "0:lan" "6@eth0" + ucidef_add_switch_attr "switch0" "enable" "false" + ucidef_set_interface_lan "eth0" + ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" + ;; motorola,mwr03) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" @@ -132,7 +139,6 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" ;; - kroks,kndrt31r19|\ tplink,tl-mr3020-v3) ucidef_add_switch "switch0" \ "0:lan" "6@eth0" diff --git a/target/linux/ramips/mt76x8/config-5.10 b/target/linux/ramips/mt76x8/config-5.10 index 39d04b8d10..37f0bb8e3e 100644 --- a/target/linux/ramips/mt76x8/config-5.10 +++ b/target/linux/ramips/mt76x8/config-5.10 @@ -110,6 +110,7 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_MT7621_WDT=y # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PARSER_TRX=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/ramips/mt76x8/config-5.15 b/target/linux/ramips/mt76x8/config-5.15 index 555b57fe60..5e44d613df 100644 --- a/target/linux/ramips/mt76x8/config-5.15 +++ b/target/linux/ramips/mt76x8/config-5.15 @@ -111,6 +111,7 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_MT7621_WDT=y # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set CONFIG_MTD_PARSER_TRX=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile index 5631be78ee..a7c52ce489 100644 --- a/target/linux/x86/Makefile +++ b/target/linux/x86/Makefile @@ -10,8 +10,7 @@ BOARDNAME:=x86 FEATURES:=squashfs ext4 vdi vmdk vhdx pcmcia targz fpu boot-part rootfs-part SUBTARGETS:=64 generic legacy geode -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 KERNELNAME:=bzImage diff --git a/tools/Makefile b/tools/Makefile index 4eee0cc81a..79de499a85 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -41,24 +41,24 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf # builddir dependencies $(curdir)/autoconf/compile := $(curdir)/m4/compile -$(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile +$(curdir)/automake/compile := $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile $(curdir)/b43-tools/compile := $(curdir)/bison/compile $(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile $(curdir)/bison/compile := $(curdir)/flex/compile $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile -$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile +$(curdir)/dosfstools/compile := $(curdir)/automake/compile $(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile $(curdir)/fakeroot/compile := $(curdir)/libtool/compile $(curdir)/findutils/compile := $(curdir)/bison/compile -$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile $(curdir)/zlib/compile +$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile $(curdir)/flex/compile := $(curdir)/libtool/compile $(curdir)/gengetopt/compile := $(curdir)/libtool/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/gptfdisk/compile += $(curdir)/e2fsprogs/compile $(curdir)/popt/compile $(curdir)/isl/compile := $(curdir)/gmp/compile $(curdir)/libressl/compile := $(curdir)/pkgconf/compile -$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile +$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile diff --git a/tools/automake/Makefile b/tools/automake/Makefile index c016f1d76a..a1121f1378 100644 --- a/tools/automake/Makefile +++ b/tools/automake/Makefile @@ -43,9 +43,8 @@ define Host/Install ln -sf aclocal $(STAGING_DIR_HOST)/bin/aclocal-1.15 endef -define Host/Clean - -$(MAKE) -C $(HOST_BUILD_DIR) uninstall - $(call Host/Clean/Default) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) endef $(eval $(call HostBuild)) diff --git a/tools/bash/Makefile b/tools/bash/Makefile index 7c25b83327..992933c6bf 100644 --- a/tools/bash/Makefile +++ b/tools/bash/Makefile @@ -18,4 +18,8 @@ HOST_BUILD_PARALLEL := 1 include $(INCLUDE_DIR)/host-build.mk +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/bc/Makefile b/tools/bc/Makefile index 9e1b2ba336..ac6609e008 100644 --- a/tools/bc/Makefile +++ b/tools/bc/Makefile @@ -18,4 +18,8 @@ PKG_CPE_ID:=cpe:/a:gnu:bc include $(INCLUDE_DIR)/host-build.mk +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/bison/Makefile b/tools/bison/Makefile index 5f96463ae0..30555541e6 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -19,14 +19,14 @@ include $(INCLUDE_DIR)/host-build.mk HOST_CONFIGURE_ARGS += --enable-threads=posix --disable-nls -define Host/Clean - -$(MAKE) -C $(HOST_BUILD_DIR) uninstall - $(call Host/Clean/Default) -endef - define Host/Install $(call Host/Install/Default) $(INSTALL_BIN) ./scripts/yacc $(STAGING_DIR_HOST)/bin/yacc endef +define Host/Uninstall + rm -f $(STAGING_DIR_HOST)/bin/yacc + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index 87c9102fa6..c64210c5a7 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -35,4 +35,9 @@ define Host/Install ln -sf ginstall $(1)/bin/install endef +define Host/Uninstall + rm -f $(STAGING_DIR_HOST)/bin/install + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/cpio/Makefile b/tools/cpio/Makefile index 2852209847..82b5aa8365 100644 --- a/tools/cpio/Makefile +++ b/tools/cpio/Makefile @@ -11,4 +11,8 @@ PKG_HASH:=eab5bdc5ae1df285c59f2a4f140a98fc33678a0bf61bdba67d9436ae26b46f6d include $(INCLUDE_DIR)/host-build.mk +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/dosfstools/Makefile b/tools/dosfstools/Makefile index d52c46b302..7c834dfd49 100644 --- a/tools/dosfstools/Makefile +++ b/tools/dosfstools/Makefile @@ -24,4 +24,8 @@ ifeq ($(HOST_OS),Darwin) HOST_CFLAGS += -UHAVE_ENDIAN_H endif +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile index 92a916ec4d..37e0d545f8 100644 --- a/tools/elfutils/Makefile +++ b/tools/elfutils/Makefile @@ -30,4 +30,8 @@ HOST_CONFIGURE_ARGS += \ HOST_MAKE_FLAGS += \ SUBDIRS="lib libelf libcpu backends libebl libdwelf libdwfl libdw" +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/fakeroot/Makefile b/tools/fakeroot/Makefile index 5d31e19781..efd9227d1a 100644 --- a/tools/fakeroot/Makefile +++ b/tools/fakeroot/Makefile @@ -25,4 +25,8 @@ HOST_CONFIGURE_VARS += \ HOST_CONFIGURE_ARGS += \ --with-ipc=tcp +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/findutils/Makefile b/tools/findutils/Makefile index d0d780689b..ac1d5312c9 100644 --- a/tools/findutils/Makefile +++ b/tools/findutils/Makefile @@ -28,4 +28,8 @@ HOST_CONFIGURE_ARGS += \ --disable-nls \ --without-selinux +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/flex/Makefile b/tools/flex/Makefile index bb5aecbdfe..da037ae72d 100644 --- a/tools/flex/Makefile +++ b/tools/flex/Makefile @@ -26,8 +26,12 @@ define Host/Install $(LN) flex $(STAGING_DIR_HOST)/bin/lex endef +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + define Host/Clean - -$(MAKE) -C $(HOST_BUILD_DIR) uninstall + rm -f $(STAGING_DIR_HOST)/bin/lex $(call Host/Clean/Default) endef diff --git a/tools/flock/Makefile b/tools/flock/Makefile index cd3561bb69..4e0a45440f 100644 --- a/tools/flock/Makefile +++ b/tools/flock/Makefile @@ -24,4 +24,8 @@ define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/flock $(STAGING_DIR_HOST)/bin/ endef +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/flock +endef + $(eval $(call HostBuild)) diff --git a/tools/gmp/Makefile b/tools/gmp/Makefile index 967cf6817b..cfd6e30e04 100644 --- a/tools/gmp/Makefile +++ b/tools/gmp/Makefile @@ -31,4 +31,8 @@ ifeq ($(GNU_HOST_NAME),x86_64-linux-gnux32) HOST_CONFIGURE_ARGS += ABI=x32 endif +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/isl/Makefile b/tools/isl/Makefile index e9674debc2..0fab02fe3f 100644 --- a/tools/isl/Makefile +++ b/tools/isl/Makefile @@ -24,4 +24,8 @@ HOST_CONFIGURE_ARGS += \ --disable-shared \ --with-gmp-prefix=$(STAGING_DIR_HOST) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index 0b5175124e..fe73e7cde2 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -34,4 +34,8 @@ HOST_CONFIGURE_ARGS += \ --with-pic \ --disable-tests +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/libtool/Makefile b/tools/libtool/Makefile index 2bc9db7d0d..fcac06e269 100644 --- a/tools/libtool/Makefile +++ b/tools/libtool/Makefile @@ -34,8 +34,11 @@ define Host/Install $(SED) 's,-lstdc++,-luClibc++,g' $(STAGING_DIR_HOST)/bin/libtool-ucxx endef +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + define Host/Clean - -$(MAKE) -C $(HOST_BUILD_DIR) uninstall $(call Host/Clean/Default) endef diff --git a/tools/lzma/Makefile b/tools/lzma/Makefile index b87289e385..29f7e0fb1d 100644 --- a/tools/lzma/Makefile +++ b/tools/lzma/Makefile @@ -31,6 +31,7 @@ define Host/Install endef define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/lzma endef $(eval $(call HostBuild)) diff --git a/tools/m4/Makefile b/tools/m4/Makefile index 0a358c35f1..d621000daf 100644 --- a/tools/m4/Makefile +++ b/tools/m4/Makefile @@ -21,9 +21,8 @@ include $(INCLUDE_DIR)/host-build.mk HOST_CONFIGURE_VARS += gl_cv_func_strstr_linear=no -define Host/Clean - -$(MAKE) -C $(HOST_BUILD_DIR) uninstall - $(call Host/Clean/Default) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) endef $(eval $(call HostBuild)) diff --git a/tools/mpc/Makefile b/tools/mpc/Makefile index 733c14173b..b170043c1a 100644 --- a/tools/mpc/Makefile +++ b/tools/mpc/Makefile @@ -25,4 +25,8 @@ HOST_CONFIGURE_ARGS += \ --with-mpfr=$(TOPDIR)/staging_dir/host \ --with-gmp=$(TOPDIR)/staging_dir/host +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index 65e6f8959f..4562c128d4 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -25,4 +25,8 @@ HOST_CONFIGURE_ARGS += \ --enable-thread-safe \ --with-gmp=$(STAGING_DIR_HOST) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/patch/Makefile b/tools/patch/Makefile index e0481204f7..bac7d5692c 100644 --- a/tools/patch/Makefile +++ b/tools/patch/Makefile @@ -22,4 +22,8 @@ include $(INCLUDE_DIR)/host-build.mk HOSTCC := $(HOSTCC_NOCACHE) HOSTCXX := $(HOSTCXX_NOCACHE) +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/patchelf/Makefile b/tools/patchelf/Makefile index 7c88f8dc45..4cf039c407 100644 --- a/tools/patchelf/Makefile +++ b/tools/patchelf/Makefile @@ -24,4 +24,8 @@ define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/patchelf $(STAGING_DIR_HOST)/bin/patchelf endef +define Host/Clean + rm -rf $(STAGING_DIR_HOST)/bin/patchelf +endef + $(eval $(call HostBuild)) diff --git a/tools/sparse/Makefile b/tools/sparse/Makefile index 549ec3a3cc..e08bd1d05f 100644 --- a/tools/sparse/Makefile +++ b/tools/sparse/Makefile @@ -21,4 +21,8 @@ define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/sparse $(STAGING_DIR_HOST)/bin endef +define Host/Clean + rm -f $(STAGING_DIR_HOST)/bin/sparse +endef + $(eval $(call HostBuild)) diff --git a/tools/tar/Makefile b/tools/tar/Makefile index f1dfc11f93..47aad9ec6e 100644 --- a/tools/tar/Makefile +++ b/tools/tar/Makefile @@ -28,4 +28,8 @@ HOST_CONFIGURE_ARGS += \ --disable-acl \ --disable-nls +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/xz/Makefile b/tools/xz/Makefile index ef0ed02396..8add2f21df 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -33,4 +33,8 @@ define Host/Install +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat" endef +define Host/Uninstall + -$(call Host/Compile/Default,uninstall) +endef + $(eval $(call HostBuild)) diff --git a/tools/zip/Makefile b/tools/zip/Makefile index 7dd81a1b8b..6e83dafb40 100644 --- a/tools/zip/Makefile +++ b/tools/zip/Makefile @@ -32,5 +32,8 @@ define Host/Install $(INSTALL_BIN) $(HOST_BUILD_DIR)/zip $(STAGING_DIR_HOST)/bin/ endef +define Host/Clean + rm -rf $(STAGING_DIR_HOST)/bin/zip +endef + $(eval $(call HostBuild)) -#$(eval $(call BuildPackage,zip))