I git clone github.com/openwrt ,
then, git switch to v22.03.2 ,
then ./scripts/feeds update -a , ./scripts/feeds install -a,
then modify source:
diff --git a/feeds.conf.default b/feeds.conf.default
index 1de500be4a..201f01b0e9 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -1,4 +1,4 @@
-src-git-full packages https://git.openwrt.org/feed/packages.git^dba8a0102e5965cad58a871335002e9c964b6719
-src-git-full luci https://git.openwrt.org/project/luci.git^96ec0cd3ccfe954f13fd5a337efdd70374dde03f
+src-git-full packages https://gitcode.net/mirrors/openwrt/packages.git^dba8a0102e5965cad58a871335002e9c964b6719
+src-git-full luci https://gitcode.net/mirrors/openwrt/luci.git^96ec0cd3ccfe954f13fd5a337efdd70374dde03f
src-git-full routing https://git.openwrt.org/feed/routing.git^85028704f688a6768d3f10d5d3c10a799a121e0d
src-git-full telephony https://git.openwrt.org/feed/telephony.git^1d2031a5c82816483c51bca15649e2957fbe2bc2
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
index 6aa46b0c74..6f20f74c46 100644
--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
@@ -174,7 +174,7 @@ detect_mac80211() {
set wireless.radio${devidx}.channel=${channel}
set wireless.radio${devidx}.band=${mode_band}
set wireless.radio${devidx}.htmode=$htmode
- set wireless.radio${devidx}.disabled=1
+ set wireless.radio${devidx}.disabled=0
set wireless.default_radio${devidx}=wifi-iface
set wireless.default_radio${devidx}.device=radio${devidx}
diff --git a/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi b/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
index a3f4dc036d..6ddbfc8c79 100644
--- a/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
+++ b/target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
@@ -88,12 +88,12 @@
partition@20000 {
compatible = "tplink,firmware";
label = "firmware";
- reg = <0x020000 0x7d0000>;
+ reg = <0x020000 0xfd0000>;
};
- art: partition@7f0000 {
+ art: partition@ff0000 {
label = "art";
- reg = <0x7f0000 0x010000>;
+ reg = <0xff0000 0x010000>;
read-only;
};
};
iff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
index fed572c884..cb828efb71 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -608,7 +608,7 @@ endef
TARGET_DEVICES += tplink_tl-wdr4300-v1-il
define Device/tplink_tl-wdr4310-v1
- $(Device/tplink-8mlzma)
+ $(Device/tplink-16mlzma)
SOC := ar9344
DEVICE_MODEL := TL-WDR4310
DEVICE_VARIANT := v1
then build, but the kernel version differs from the original release.
The installed version of package kernel is not compatible, require 5.10.146-1-72e39b50… while 5.10.146-1-ad49758c… is installed.
what to do next?
I just want to build an mini image with luci, and using the official prebuild ipkgs.
thanks!
slh
November 19, 2022, 4:17am
2
Any change, however small, will change the version number (which, contains a hash over the kernel config as part of the dependencies). If you are building from source anyways, just build everything you need and include it directly into your images - no need for opkg and/ or dependency mismatches that way.
but how can I just modify dts and attach it to the kernel?and making bin image?
and by the way the dts should not part of kernel.
slh
November 19, 2022, 4:37am
5
There isn't really a supported way to do this (depending on the details, imagebuilder may play ball, but again, not really a supported method - if it breaks, you get to keep both pieces),
There's usually no choice about this, considering the (ancient) pre-installed OEM bootloader (a heavily butchered up U-Boot 1.1.4 in this case, which predates device trees and has no idea what to do with those).
../../../staging_dir/host/bin/lzma d tplink_tl-wdr4310-v1-kernel.bin 4310.unlzma
2.
using hexedit software okteta edit 4310.unlzma three offsets need modified (after A4):
0072:5258 replace hex 00020000 007d0000 with 00200000 00fd0000
0073:5272 replace string 7f with ff
0073:5298 replace hex 007f0000 00010000 with 00ff0000 00010000
3.
../../../staging_dir/host/bin/lzma e -lc1 -lp2 4310.unlzma tplink_tl-wdr4310-v1-kernel.bin
4.
modify openwrt-imagebuilder-22.03.2-ath79-generic.Linux-x86_64/target/linux/ath79/image/generic-tp-link.mk
define Device/tplink_tl-wdr4310-v1
$(Device/tplink-8mlzma) ---> changing to 16mlzma
SOC := ar9344
DEVICE_MODEL := TL-WDR4310
DEVICE_VARIANT := v1
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
TPLINK_HWID := 0x43100001
SUPPORTED_DEVICES += tl-wdr4300
endef
TARGET_DEVICES += tplink_tl-wdr4310-v1
make image PROFILE=tplink_tl-wdr4310-v1 PACKAGES="uhttpd luci luci-ssl"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Taras Gavrylenko"
__copyright__ = "Copyright 2020, The OpenWrt Project"
__version__ = "0.9"
__email__ = "gavrylenko.taras@gmail.com"
__status__ = "Beta"
"""
OpenWrt TP-Link kernel DTS patcher allows to use release 19.07 kernel
and packages on hardware modded devices with increased flash chip size.
Set environment variable $LZMA_UTIL_PATH with path to LZMA utility
Recommended LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
from Openwrt originals
Be sure you have Python interpreter 3.8 or higher
Run: python3.8 kernel_patcher.py <path_to_kernel_file>
Script stages:
1. Rename original kernel to *.bak
2. Unpack original kernel
3. Patch DTS partition table
4. Pack new kernel
"""
import argparse
import logging
import os
import subprocess
from pathlib import Path
logging.basicConfig(
format='%(asctime)s %(levelname)s %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
def run_command(cmd: str):
return subprocess.call(cmd, shell=True)
def compress_lzma(lzma_util: str, raw_path: Path, lzma_path: Path) -> int:
cmd = f'{lzma_util} e {raw_path} {lzma_path} -lc1 -lp2'
status = run_command(cmd)
if status != 0:
raise RuntimeError(f'Failed to compress {raw_path}')
return lzma_path.stat().st_size
def decompress_lzma(lzma_util: str, lzma_path: Path, raw_path: Path) -> int:
cmd = f'{lzma_util} d {lzma_path} {raw_path}'
status = run_command(cmd)
if status != 0:
raise RuntimeError(f'Failed to decompress {lzma_path}')
return raw_path.stat().st_size
def resize_kernel_dts(krnl_path: Path):
chunk_num = 0
chunk_size = 64 * 1024
with krnl_path.open(mode='rb+') as f_out:
while data := f_out.read(chunk_size):
if (offset := data.find(b'partition@20000')) > 0:
ofs_part = chunk_num * chunk_size + offset
logger.info('Found DTS partition table at: '
f'0x{ofs_part:08x}')
break
chunk_num += 1
else:
raise RuntimeError('Could not find DTS partition table')
f_out.seek(ofs_part)
data = bytearray(f_out.read(0x100))
if (offset := data.find(b'\xaa\0\x02\0\0\0\x7d\0\0')) > 0:
data[offset+6] |= 0xff
else:
raise RuntimeError('Partition pattern not found')
if (offset := data.find(b'partition@7f0000')) > 0:
data[offset+10] = ord('f')
else:
raise RuntimeError('Partition pattern not found')
if (offset := data.find(b'\xaa\0\x7f\0\0\0\x01\0\0')) > 0:
data[offset+2] |= 0xff
else:
raise RuntimeError('Partition pattern not found')
f_out.seek(ofs_part)
f_out.write(data)
def main():
logger.info('OpenWrt Imagebuilder DTS patcher v0.9')
lzma_util_path = os.getenv('LZMA_UTIL_PATH')
if lzma_util_path is None:
logger.error('Compressor utility path is not set: LZMA_UTIL_PATH')
exit(1)
parser = argparse.ArgumentParser()
parser.add_argument('image', help='OpenWrt kernel image file')
args = parser.parse_args()
krnl_path = Path(args.image)
if krnl_path.is_file() is False:
logger.error(f'Kernel image file does not exist: {krnl_path}')
exit(1)
krnl_size = krnl_path.stat().st_size
logger.info(f'Processing kernel image file: {krnl_path}')
logger.info(f'Origin kernel size: 0x{krnl_size:08x}')
kernel_raw_path = Path(krnl_path.with_suffix('.raw'))
logger.info('Decompressing kernel...')
krnl_raw_size = decompress_lzma(
lzma_util_path, krnl_path, kernel_raw_path)
logger.info(f'Decompressed kernel size: 0x{krnl_raw_size:08x}')
logger.info('Resizing kernel DTS...')
resize_kernel_dts(kernel_raw_path)
krnl_path.rename(krnl_path.with_suffix('.bak'))
logger.info('Compressing kernel...')
krnl_lzma_size = compress_lzma(
lzma_util_path, kernel_raw_path, krnl_path)
logger.info(f'Compressed kernel size: 0x{krnl_lzma_size:08x}')
if krnl_lzma_size > krnl_size:
logger.warning('Re-compressed kernel is bigger than original.')
logger.info('Done')
if __name__ == '__main__':
main()