Skip to content

Commit

Permalink
Merge Official Source
Browse files Browse the repository at this point in the history
Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Jan 13, 2025
2 parents bc79a29 + 54463f1 commit 2ac86e2
Show file tree
Hide file tree
Showing 51 changed files with 1,706 additions and 126 deletions.
8 changes: 8 additions & 0 deletions include/image-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,14 @@ define Build/sysupgrade-tar
$@
endef

define Build/tplink-image-2022
$(TOPDIR)/scripts/tplink-mkimage-2022.py \
--create $@.new \
--rootfs $@ \
--support "$(TPLINK_SUPPORT_STRING)"
@mv $@.new $@
endef

define Build/tplink-safeloader
-$(STAGING_DIR_HOST)/bin/tplink-safeloader \
-B $(TPLINK_BOARD_ID) \
Expand Down
4 changes: 2 additions & 2 deletions include/kernel-6.6
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LINUX_VERSION-6.6 = .70
LINUX_KERNEL_HASH-6.6.70 = 84d23ee07fb26febbcb6d1295ba15efdc67ac382b4137b2c8853146c10fd2f97
LINUX_VERSION-6.6 = .71
LINUX_KERNEL_HASH-6.6.71 = 219715ba2dcfa6539fba09ad3f9212772f3507189eb60d77f8e89b06c32e724e
4 changes: 2 additions & 2 deletions package/boot/uboot-envtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=uboot-envtools
PKG_DISTNAME:=u-boot
PKG_VERSION:=2024.07
PKG_VERSION:=2025.01
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
https://ftp.denx.de/pub/u-boot \
https://mirror.cyberbits.eu/u-boot \
ftp://ftp.denx.de/pub/u-boot
PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f
PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)

Expand Down
4 changes: 4 additions & 0 deletions package/boot/uboot-envtools/files/qualcommax_ipq60xx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ netgear,wax214)
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000"
;;
tplink,eap610-outdoor)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000"
yuncore,fap650)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
Expand Down
2 changes: 2 additions & 0 deletions package/firmware/ipq-wifi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ALLWIFIBOARDS:= \
redmi_ax6 \
skspruce_wia3300-20 \
spectrum_sax1v1k \
tplink_eap610-outdoor \
tplink_eap620hd-v1 \
tplink_eap660hd-v1 \
wallys_dr40x9 \
Expand Down Expand Up @@ -185,6 +186,7 @@ $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze))
$(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
$(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20))
$(eval $(call generate-ipq-wifi-package,spectrum_sax1v1k,Spectrum SAX1V1K))
$(eval $(call generate-ipq-wifi-package,tplink_eap610-outdoor,TPLink EAP610-Outdoor))
$(eval $(call generate-ipq-wifi-package,tplink_eap620hd-v1,TP-Link EAP620 HD v1))
$(eval $(call generate-ipq-wifi-package,tplink_eap660hd-v1,TP-Link EAP660 HD v1))
$(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9))
Expand Down
2 changes: 1 addition & 1 deletion package/network/services/hostapd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=hostapd
PKG_RELEASE:=2
PKG_RELEASE:=3

PKG_SOURCE_URL:=https://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
sm->eap_if->aaaFail = true;
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -95,6 +95,7 @@ struct sta_info {
@@ -94,6 +94,7 @@ struct sta_info {
u8 supported_rates[WLAN_SUPP_RATES_MAX];
int supported_rates_len;
u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
+
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -408,23 +408,8 @@ int ap_sta_re_add(struct hostapd_data *h
@@ -409,23 +409,8 @@ int ap_sta_re_add(struct hostapd_data *h

void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 161327f91d956771996c96ea1b6e4e1cb8dc074c Mon Sep 17 00:00:00 2001
From: Stone Zhang <[email protected]>
Date: Mon, 14 Oct 2024 18:47:32 +0800
Subject: [PATCH] hostapd: Fix clearing up settings for color switch

Settings for color switch (struct cca_settings settings)
is used without zero clearing, which causes the member
settings->ubpr->unsol_bcast_probe_resp_intervalettings
to be a random value. It is againsts the NLA policy of
NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT and causes
BSS color switch failure.

Fixes: 654d2395dddf ("BSS coloring: Handling of collision events and triggering CCA")
Signed-off-by: Stone Zhang <[email protected]>
---
src/ap/hostapd.c | 1 +
1 file changed, 1 insertion(+)

--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -4813,6 +4813,7 @@ static void hostapd_switch_color_timeout
struct cca_settings settings;
int ret;

+ os_memset(&settings, 0, sizeof(settings));
hostapd_cleanup_cca_params(bss);
bss->cca_color = r;
bss->cca_count = 10;
198 changes: 198 additions & 0 deletions scripts/tplink-mkimage-2022.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#!/usr/bin/env python3

'''A program for manipulating tplink2022 images.
A tplink2022 is an image format encountered on TP-Link devices around the year
2022. This was seen at least on the EAP610-Outdoor. The format is a container
for a rootfs, and has optional fields for the "software" version. It also
requires a "support" string that describes the list of compatible devices.
This module is intended for creating such images with an OpenWRT UBI image, but
also supports analysis and extraction of vendor images. Altough tplink2022
images can be signed, this program does not support signing image.
To get an explanation of the commandline arguments, run this program with the
"--help" argument.
'''

import argparse
import hashlib
import os
import pprint
import struct

def decode_header(datafile):
'''Read the tplink2022 image header anbd decode it into a dictionary'''
header = {}
fmt = '>2I'

datafile.seek(0x1014)
raw_header = datafile.read(8)
fields = struct.unpack(fmt, raw_header)

header['rootfs_size'] = fields[0]
header['num_items'] = fields[1]
header['items'] = []

rootfs = {}
rootfs['name'] = 'rootfs.ubi'
rootfs['offset'] = 0
rootfs['size'] = header['rootfs_size']
header['items'].append(rootfs)

for _ in range(header['num_items']):
entry = datafile.read(0x2c)
fmt = '>I32s2I'
fields = struct.unpack(fmt, entry)

section = {}
section['name'] = fields[1].decode("utf-8").rstrip('\0')
section['type'] = fields[0]
section['offset'] = fields[2]
section['size'] = fields[3]
header['items'].append(section)
return header

def extract(datafile):
'''Extract the sections of the tplink2022 image to separate files'''
header = decode_header(datafile)

pretty = pprint.PrettyPrinter(indent=4, sort_dicts=False)
pretty.pprint(header)

for section in header['items']:
datafile.seek(0x1814 + section['offset'])
section_contents = datafile.read(section['size'])

with open(f"{section['name']}.bin", 'wb') as section_file:
section_file.write(section_contents)

with open('leftover.bin', 'wb') as extras_file:
extras_file.write(datafile.read())

def get_section_contents(section):
'''I don't remember what this does. It's been a year since I wrote this'''
if section.get('data'):
data = section['data']
elif section.get('file'):
with open(section['file'], 'rb') as section_file:
data = section_file.read()
else:
data = bytes()

if section['size'] != len(data):
raise ValueError("Wrong section size", len(data))

return data

def write_image(output_image, header):
'''Write a tplink2022 image with the contents in the "header" dictionary'''
with open(output_image, 'w+b') as out_file:
# header MD5
salt = [ 0x7a, 0x2b, 0x15, 0xed,
0x9b, 0x98, 0x59, 0x6d,
0xe5, 0x04, 0xab, 0x44,
0xac, 0x2a, 0x9f, 0x4e
]

out_file.seek(4)
out_file.write(bytes(salt))

# unknown section
out_file.write(bytes([0xff] * 0x1000))

# Table of contents
raw_header = struct.pack('>2I', header['rootfs_size'],
header['num_items'])
out_file.write(raw_header)

for section in header['items']:
if section['name'] == 'rootfs.ubi':
continue

hdr = struct.pack('>I32s2I',
section.get('type', 0),
section['name'].encode('utf-8'),
section['offset'],
section['size']
)

out_file.write(hdr)

for section in header['items']:
out_file.seek(0x1814 + section['offset'])
out_file.write(get_section_contents(section))

size = out_file.tell()

out_file.seek(4)
md5_sum = hashlib.md5(out_file.read())

out_file.seek(0)
out_file.write(struct.pack('>I16s', size, md5_sum.digest()))

def encode_soft_verson():
'''Not sure of the meaning of version. Also doesn't appear to be needed.'''
return struct.pack('>4B1I2I', 0xff, 1, 0 ,0, 0x2020202, 30000, 1)

def create_image(output_image, root, support):
'''Create an image with a ubi "root" and a "support" string.'''
header = {}

header['rootfs_size'] = os.path.getsize(root)
header['items'] = []

rootfs = {}
rootfs['name'] = 'rootfs.ubi'
rootfs['file'] = root
rootfs['offset'] = 0
rootfs['size'] = header['rootfs_size']
header['items'].append(rootfs)

support_list = {}
support_list['name'] = 'support-list'
support_list['data'] = support.replace(" ", "\r\n").encode('utf-8')
support_list['offset'] = header['rootfs_size']
support_list['size'] = len(support_list['data'])
header['items'].append(support_list)

sw_version = {}
sw_version['name'] = 'soft-version'
sw_version['type'] = 1
sw_version['data'] = encode_soft_verson()
sw_version['offset'] = support_list['offset'] + support_list['size']
sw_version['size'] = len(sw_version['data'])
header['items'].append(sw_version)

header['num_items'] = len(header['items']) - 1
write_image(output_image, header)

def main(args):
'''We support image analysis,extraction, and creation'''
if args.extract:
with open(args.image, 'rb') as image:
extract(image)
elif args.create:
if not args.rootfs or not args.support:
raise ValueError('To create an image, specify rootfs and support list')
create_image(args.image, args.rootfs, args.support)
else:
with open(args.image, 'rb') as image:
header = decode_header(image)

pretty = pprint.PrettyPrinter(indent=4, sort_dicts=False)
pretty.pprint(header)

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='EAP extractor')
parser.add_argument('--info', action='store_true')
parser.add_argument('--extract', action='store_true')
parser.add_argument('--create', action='store_true')
parser.add_argument('image', type=str,
help='Name of image to create or decode')
parser.add_argument('--rootfs', type=str,
help='When creating an EAP image, UBI image with rootfs and kernel')
parser.add_argument('--support', type=str,
help='String for the "support-list" section')

main(parser.parse_args())
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ Signed-off-by: Christian Marangi <[email protected]>
const struct clk_ops pcie_ops;
int (*hw_init)(struct platform_device *pdev,
struct clk_hw_onecell_data *clk_data);
@@ -525,8 +526,6 @@ static void en7523_register_clocks(struc
@@ -504,8 +505,6 @@ static void en7523_register_clocks(struc
u32 rate;
int i;

hw = en7523_register_pcie_clk(dev, np_base);
clk_data->hws[EN7523_CLK_PCIE] = hw;
-
- clk_data->num = EN7523_NUM_CLOCKS;
}

static int en7523_clk_hw_init(struct platform_device *pdev,
-
for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) {
const struct en_clk_desc *desc = &en7523_base_clks[i];
u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg;
@@ -587,8 +586,6 @@ static void en7581_register_clocks(struc

hw = en7523_register_pcie_clk(dev, base);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,27 @@ Signed-off-by: Christian Marangi <[email protected]>

host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk");
if (IS_ERR(host->bus_clk))
@@ -2740,11 +2767,14 @@ static int msdc_drv_probe(struct platfor
goto host_free;
@@ -2731,10 +2758,13 @@ static int msdc_drv_probe(struct platfor
return PTR_ERR(host->pins_default);
}

- host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs");
- if (IS_ERR(host->pins_uhs)) {
- ret = PTR_ERR(host->pins_uhs);
- dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n");
- goto host_free;
- return PTR_ERR(host->pins_uhs);
+ /* AN7581 doesn't have state_uhs pins */
+ if (!device_is_compatible(&pdev->dev, "airoha,an7581-mmc")) {
+ host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs");
+ if (IS_ERR(host->pins_uhs)) {
+ ret = PTR_ERR(host->pins_uhs);
+ dev_err(&pdev->dev, "Cannot find pinctrl uhs!\n");
+ goto host_free;
+ return PTR_ERR(host->pins_uhs);
+ }
}

/* Support for SDIO eint irq ? */
@@ -2825,6 +2855,12 @@ static int msdc_drv_probe(struct platfor
@@ -2815,6 +2845,12 @@ static int msdc_drv_probe(struct platfor
dev_err(&pdev->dev, "Cannot ungate clocks!\n");
goto release_mem;
goto release_clk;
}
+
+ /* AN7581 without regulator require tune to OCR values */
Expand Down
Loading

0 comments on commit 2ac86e2

Please sign in to comment.