[OpenWrt-Devel] [PATCH RFT] ramips: mt7621: use lzma-loader for all devices
INAGAKI Hiroshi
musashino.open at gmail.com
Tue Apr 14 14:23:22 EDT 2020
Hello,
I tried this change in several routers.
In the following routers, kernel 5.4 without/with your patch works fine:
- Buffalo WSR-1166DHP
U-Boot 1.1.3 (Dec 16 2014 - 14:38:30) 0.09, Ralink UBoot Version:
4.2.1.0
- ELECOM WRC-1167GHBK2-S
U-Boot 1.1.3 (Jan 23 2017 - 20:06:24), Ralink UBoot Version: 5.0.0.0
- I-O DATA WN-GX300GR
U-boot Ver:1.0.4.11 2017/08/31 09:55:19, Senao Uboot Init Ver.1.0.0
But in I-O DATA WN-AX1167GR2, failed to start lzma-loader and hangs up:
===================================================================
MT7621 stage1 code 10:33:11 (ASIC)
CPU=50000000 HZ BUS=16666666 HZ
==================================================================
Change MPLL source from XTAL to CR...
do MEMPLL setting..
MEMPLL Config : 0x11100000
3PLL mode + External loopback
=== XTAL-40Mhz === DDR-1200Mhz ===
PLL3 FB_DL: 0x4, 1/0 = 544/480 11000000
PLL4 FB_DL: 0x7, 1/0 = 609/415 1D000000
PLL2 FB_DL: 0x19, 1/0 = 568/456 65000000
do DDR setting..[00320381]
Apply DDR3 Setting...(use customer AC)
0 8 16 24 32 40 48 56 64 72 80 88
96 104 112 120
--------------------------------------------------------------------------------
0000:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0001:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0002:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0003:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0004:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0005:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0006:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0007:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0008:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0009:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
000A:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
000B:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
000C:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
000D:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
000E:| 0 0 0 0 0 0 0 0 0 0 0 1
1 1 1 1
000F:| 0 0 0 0 0 0 1 1 1 1 1 1
1 1 1 1
0010:| 1 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0
0011:| 1 1 1 1 1 0 0 0 0 0 0 0
0 0 0 0
0012:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0013:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0014:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0015:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0016:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0017:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0018:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
0019:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
001A:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
001B:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
001C:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
001D:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
001E:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
001F:| 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
rank 0 coarse = 16
rank 0 fine = 40
B:| 0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0
opt_dle value:10
DRAMC_R0DELDLY[018]=00002121
==================================================================
RX DQS perbit delay software calibration
==================================================================
1.0-15 bit dq delay value
==================================================================
bit| 0 1 2 3 4 5 6 7 8 9
--------------------------------------
0 | 10 9 8 10 6 7 8 6 7 6
10 | 9 8 9 9 7 9
--------------------------------------
==================================================================
2.dqs window
x=pass dqs delay value (min~max)center
y=0-7bit DQ of every group
input delay:DQS0 =33 DQS1 = 33
==================================================================
bit DQS0 bit DQS1
0 (1~65)33 8 (1~63)32
1 (1~66)33 9 (1~63)32
2 (0~62)31 10 (1~63)32
3 (1~66)33 11 (1~62)31
4 (1~63)32 12 (1~63)32
5 (1~66)33 13 (0~62)31
6 (1~63)32 14 (1~65)33
7 (1~66)33 15 (1~65)33
==================================================================
3.dq delay value last
==================================================================
bit| 0 1 2 3 4 5 6 7 8 9
--------------------------------------
0 | 10 9 10 10 7 7 9 6 8 7
10 | 10 10 10 11 7 9
==================================================================
==================================================================
TX perbyte calibration
==================================================================
DQS loop = 15, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqsdly_pass[0]=15, finish count=1
dqs_perbyte_dly.last_dqsdly_pass[1]=15, finish count=2
DQ loop=15, cmp_err_1 = ffff0082
dqs_perbyte_dly.last_dqdly_pass[1]=15, finish count=1
DQ loop=14, cmp_err_1 = ffff0000
dqs_perbyte_dly.last_dqdly_pass[0]=14, finish count=2
byte:0, (DQS,DQ)=(8,8)
byte:1, (DQS,DQ)=(8,8)
20,data:88
[EMI] DRAMC calibration passed
===================================================================
MT7621 stage1 code done
CPU=50000000 HZ BUS=16666666 HZ
===================================================================
U-Boot 1.1.3 (Dec 9 2016 - 10:20:35)
Board: Ralink APSoC DRAM: 128 MB
relocate_code Pointer at: 87fac000
Config XHCI 40M PLL
******************************
Software System Reset Occurred
******************************
Allocate 16 byte aligned buffer: 87fdf010
Enable NFI Clock
# MTK NAND # : Use HW ECC
NAND ID [01 F1 80 1D 01]
Device found in MTK table, ID: 1f1, EXT_ID: 801d01
Support this Device in MTK table! 1f1
select_chip
[NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
Signature matched and data read!
load_fact_bbt success 1023
load fact bbt success
[mtk_nand] probe successfully!
mtd->writesize=2048 mtd->oobsize=64, mtd->erasesize=131072
devinfo.iowidth=8
....============================================
Ralink UBoot Version: 5.0.0.0
--------------------------------------------
ASIC MT7621A DualCore (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection
DRAM_TYPE: DDR3
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: NAND Flash
Date:Dec 9 2016 Time:10:20:35
============================================
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768
##### The CPU freq = 880 MHZ ####
estimate memory size =128 Mbytes
#Reset_MT7530
set LAN/WAN WLLLL
.## Starting application at 0x81E00000 ...
Z-LOADER V1.24 | 12/09/2016 10:20:37
..Hit ESC key to stop autoboot: 1
Checking image 1...
Image Name: MIPS OpenWrt Linux-5.4.3
Image Type: MIPS Linux Kernel Image (uncompressed)
Data Size: 2317045 Bytes = 2.2 MB
Load Address: 80001000
Entry Point: 80001000
.................................... Verifying Checksum ... ##
Booting image at bc400000 ...
OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128
Starting kernel ...
(hang up)
This model uses "Z-LOADER" to boot kernel.The same loader is also used
in following I-O DATA devices:
- WN-AX2033GR
- WN-DX1167R
Regards,
Hiroshi
On 2020/04/14 15:44, Chuanhong Guo wrote:
> With current kernel reaching 5MB uncompressed, several devices failed
> to boot. They either fails on lzma decompression or ends up with a
> corrupted kernel image. We already faced this problem two years ago
> and it was solved by limiting LZMA dictionary size. Our own lzma-loader
> extracts data without this limit just fine and lifting this limit saves
> 15KB kernel space when compressed.
> mediatek u-boot 1.1.3 comes with support for uncompressed uimage by
> default and ideally no vendor bother to remove this support.
> This commit uses uncompressed uimage with lzma-loader for all mt7621
> devices with default kernel template.
>
> Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
> ---
>
> D-Link DIR-860L B1 needs a different loader implementation and isn't
> covered by this patch.
> Please help testing this patch on top of current master:
> 75f19deb3a ramips: define image recipe for uncompressed uimage with loader
> 1. If your device fails to boot after 5.4 switch for mt7621:
> Is the problem fixed by this patch?
> 2. Other devices:
> Does this patch break your router?
>
> Thanks in advance!
>
> target/linux/ramips/image/Makefile | 4 ++++
> target/linux/ramips/image/mt7621.mk | 1 -
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
> index a966ba4349..1fb37d7c6c 100644
> --- a/target/linux/ramips/image/Makefile
> +++ b/target/linux/ramips/image/Makefile
> @@ -27,7 +27,11 @@ LOADER_PLATFORM := $(ldrplatform-y)
> KERNEL_DTB = kernel-bin | append-dtb | lzma
> define Device/Default
> PROFILES = Default
> +ifeq ($(SUBTARGET),mt7621)
> + $(Device/uimage-lzma-loader)
> +else
> KERNEL := $(KERNEL_DTB) | uImage lzma
> +endif
> SOC := $(DEFAULT_SOC)
> DEVICE_DTS_DIR := ../dts
> DEVICE_DTS = $$(SOC)_$(1)
> diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
> index 8980ff70d4..942308c29a 100644
> --- a/target/linux/ramips/image/mt7621.mk
> +++ b/target/linux/ramips/image/mt7621.mk
> @@ -6,7 +6,6 @@ include ./common-tp-link.mk
>
> DEFAULT_SOC := mt7621
>
> -KERNEL_DTB += -d21
> DEVICE_VARS += UIMAGE_MAGIC SERCOMM_HWNAME
>
> # The OEM webinterface expects an kernel with initramfs which has the uImage
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list