Build 22.03.2 from source for 16M mod but kernel version error

I git clone,
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^dba8a0102e5965cad58a871335002e9c964b6719
-src-git-full luci^96ec0cd3ccfe954f13fd5a337efdd70374dde03f
+src-git-full packages^dba8a0102e5965cad58a871335002e9c964b6719
+src-git-full luci^96ec0cd3ccfe954f13fd5a337efdd70374dde03f
 src-git-full routing^85028704f688a6768d3f10d5d3c10a799a121e0d
 src-git-full telephony^1d2031a5c82816483c51bca15649e2957fbe2bc2
diff --git a/package/kernel/mac80211/files/lib/wifi/ b/package/kernel/mac80211/files/lib/wifi/
index 6aa46b0c74..6f20f74c46 100644
--- a/package/kernel/mac80211/files/lib/wifi/
+++ b/package/kernel/mac80211/files/lib/wifi/
@@ -174,7 +174,7 @@ detect_mac80211() {
-                       set${devidx}.disabled=1
+                       set${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>;
iff --git a/target/linux/ath79/image/ b/target/linux/ath79/image/
index fed572c884..cb828efb71 100644
--- a/target/linux/ath79/image/
+++ b/target/linux/ath79/image/
@@ -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

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.

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.

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
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
../../../staging_dir/host/bin/lzma e -lc1 -lp2 4310.unlzma tplink_tl-wdr4310-v1-kernel.bin

modify openwrt-imagebuilder-22.03.2-ath79-generic.Linux-x86_64/target/linux/ath79/image/
define Device/tplink_tl-wdr4310-v1
  $(Device/tplink-8mlzma) ---> changing to 16mlzma
  SOC := ar9344
  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
  TPLINK_HWID := 0x43100001
  SUPPORTED_DEVICES += tl-wdr4300
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__ = ""
__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 <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

    format='%(asctime)s %(levelname)s %(message)s',
logger = logging.getLogger(__name__)

def run_command(cmd: str):
    return, 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'rb+') as f_out:
        while data :=
            if (offset := data.find(b'partition@20000')) > 0:
                ofs_part = chunk_num * chunk_size + offset
      'Found DTS partition table at: '
            chunk_num += 1
            raise RuntimeError('Could not find DTS partition table')
        data = bytearray(
        if (offset := data.find(b'\xaa\0\x02\0\0\0\x7d\0\0')) > 0:
            data[offset+6] |= 0xff
            raise RuntimeError('Partition pattern not found')
        if (offset := data.find(b'partition@7f0000')) > 0:
            data[offset+10] = ord('f')
            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
            raise RuntimeError('Partition pattern not found')

def main():'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')

    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}')
    krnl_size = krnl_path.stat().st_size'Processing kernel image file: {krnl_path}')'Origin kernel size: 0x{krnl_size:08x}')
    kernel_raw_path = Path(krnl_path.with_suffix('.raw'))'Decompressing kernel...')
    krnl_raw_size = decompress_lzma(
        lzma_util_path, krnl_path, kernel_raw_path)'Decompressed kernel size: 0x{krnl_raw_size:08x}')'Resizing kernel DTS...')
    krnl_path.rename(krnl_path.with_suffix('.bak'))'Compressing kernel...')
    krnl_lzma_size = compress_lzma(
        lzma_util_path, kernel_raw_path, krnl_path)'Compressed kernel size: 0x{krnl_lzma_size:08x}')
    if krnl_lzma_size > krnl_size:
        logger.warning('Re-compressed kernel is bigger than original.')'Done')

if __name__ == '__main__':