Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ramips: enable flash variable erasure and fix potential lost configuration issues after upgrade #12602

Merged
merged 3 commits into from May 18, 2023

Conversation

DragonBluep
Copy link
Contributor

@DragonBluep DragonBluep commented May 13, 2023

In the kernel 5.15, the default flash sector erase size of the mt7620 sub-target has been switched to 64k. This may cause configuration loss after upgrading the system. This PR solves the potential issue and enables variable size erasure for all sub-target. The last commit is a small cleanup.

Closes: #8715

@github-actions github-actions bot added kernel pull request/issue with Linux kernel related changes target/ramips pull request/issue for ramips target labels May 13, 2023
@Leo-PL
Copy link
Contributor

Leo-PL commented May 13, 2023

Yes, please. Finally reasonable flash performance for MF283+. Thank you!
Will test and report in a few days.

@DragonBluep
Copy link
Contributor Author

DragonBluep commented May 15, 2023

rootfs_data partition will automatically align to 64k regardless of the size of the firmware partition, so we do not need to change the partition table of any device.

root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 007ad000 00010000 "firmware"
mtd4: 00240000 00010000 "kernel"
mtd5: 0056d000 00010000 "rootfs"
mtd6: 001d0000 00010000 "rootfs_data"
mtd7: 00003000 00010000 "test"

[    1.131202] Creating 5 MTD partitions on "spi0.0":
[    1.183959] 0x000000000000-0x000000030000 : "u-boot"
[    1.242691] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.302620] 0x000000040000-0x000000050000 : "factory"
[    1.361723] 0x000000050000-0x0000007fd000 : "firmware"
[    1.419896] 2 uimage-fw partitions found on MTD device firmware
[    1.485103] Creating 2 MTD partitions on "firmware":
[    1.539711] 0x000000000000-0x000000240000 : "kernel"
[    1.597606] 0x000000240000-0x0000007ad000 : "rootfs"
[    1.653638] mtd: setting mtd5 (rootfs) as root device
[    1.710363] 1 squashfs-split partitions found on MTD device rootfs
[    1.778468] 0x0000005d0000-0x0000007a0000 : "rootfs_data"
[    1.840318] 0x0000007fd000-0x000000800000 : "test"

@peterwillcn
Copy link
Contributor

peterwillcn commented May 15, 2023

What is the purpose of the mtd7 test partition and should it not be retained?

@DragonBluep
Copy link
Contributor Author

What is the purpose of the mtd7 test partition and should it not be retained?

It's just a placeholder that I use to make firmware partition size not aligned to 64k. Just an experiment. I use it to test whether the read and write ability of firmware partition will be affected.

As long as the start address of the partition is aligned to 64k, it is readable and writable. If the start address of the partition is not aligned to 64k, it will be read only. Fortunately, the firmware partition and u-boot-env partition start addresses of all devices are aligned to 64k.

@ptpt52
Copy link
Contributor

ptpt52 commented May 15, 2023

mark.

Make use of minor sector size (4k) on supported flash chips to improve
spi read/write performance.

Tested on ramips/mt7628: Motorola MWR03

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
In kernel 5.15, the default erase sector size of the nor flash has
been switched from 4k to 64k. This may cause the configuration not
be preserved across upgrades. To avoid this issue, change the default
BLOCKSIZE to 64k.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
These same codes are repeated for many devices now, it's better to
move them to shared definition. This commit also add the missing
KERNEL_SIZE of the ZyXEL NR7101 and ZyXEL LTE3301-PLUS.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
@openwrt-bot openwrt-bot merged commit b09a838 into openwrt:master May 18, 2023
3 checks passed
@DragonBluep DragonBluep deleted the ramips_blocksize branch May 19, 2023 00:03
DEVICE_VENDOR := Airlink
DEVICE_MODEL := AR670W
IMAGE_SIZE := 3840k
KERNEL := $(KERNEL_DTB) | pad-to $$(BLOCKSIZE)
KERNEL := $(KERNEL_DTB) | pad-to $$$$(BLOCKSIZE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hauke Sorry I made a mistake here. I didn't notice this error because my local build and ci automatically excluded this device. However, it will surely break the buildbot build.
ref: https://buildbot.staging.openwrt.org/images/#/builders/12/builds/4
I have sent a fix patch to the mailing list and cc to you.

BTW, I suggest marking the rt288x sub-target as source only. Because the only supported device Belkin F5D8235 has only 32MiB RAM, I don't think it can run the 5.15 kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel pull request/issue with Linux kernel related changes target/ramips pull request/issue for ramips target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FS#3699 - MT7620 platform with spi flash has very low read & write performance
6 participants