OpenWRT firmware for routers
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Go to file
Michal Cieslakiewicz e2b89ea069 kernel: generic: 5.4: fix mtd concat panic on read/write functions
Commit 2431c4f5b46c32c4ac495456b1ef4ce59c0bb85d ("mtd: Implement
mtd_{read,write}() as wrappers around mtd_{read,write}_oob()") for kernel 5.4
restrict mtd devices to register only one type of read/write functions
(either generic or OOB).

mtd concat does not follow above rule and defines both methods at the same
time, causing this type of device to be rejected by kernel. For routers that
use mtd concat for root UBI volume that means kernel panic and boot loop with
following error:

[    0.767307] Creating 1 MTD partitions on "ubi-concat":
[    0.772547] 0x000000000000-0x000007500000 : "ubi"
[    0.777953] ------------[ cut here ]------------
[    0.782683] WARNING: CPU: 0 PID: 1 at drivers/mtd/mtdcore.c:621 add_mtd_device+0x84/0x5f4
[    0.790983] Modules linked in:
[    0.794093] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.24 #0
[    0.799932] Stack : 80680000 8062af20 00000000 00000000 8062a0f0 87c2dae4 87c282fc 8065fd23
[    0.808430]         805c64f4 00000001 807b32d8 80670000 80670000 00000001 87c2da98 25c15bcb
[    0.816909]         00000000 00000000 807e0000 0000006e 61696e74 00000000 2e342e32 34202330
[    0.825397]         0000006e cef2ada7 00000000 000c1ded 00000000 00000009 00000000 8034de64
[    0.833889]         00000009 80670000 80670000 80676d18 00000000 80320044 00000000 807b0000
[    0.842381]         ...
[    0.844861] Call Trace:
[    0.847367] [<80069994>] show_stack+0x30/0x100
[    0.851913] [<8007e8ac>] __warn+0xc0/0x10c
[    0.856072] [<8007e954>] warn_slowpath_fmt+0x5c/0xac
[    0.861134] [<8034de64>] add_mtd_device+0x84/0x5f4
[    0.866001] [<80352a50>] add_mtd_partitions+0xd8/0x1b8
[    0.871231] [<803527b8>] parse_mtd_partitions+0x238/0x3f8
[    0.876717] [<8034e51c>] mtd_device_parse_register+0x48/0x1b0
[    0.882586] [<8038dd2c>] virt_concat_probe+0x170/0x1ec
[    0.887820] [<803334c8>] platform_drv_probe+0x40/0x94
[    0.892970] [<80331638>] really_probe+0x104/0x35c
[    0.897766] [<80331d54>] device_driver_attach+0x70/0x98
[    0.903072] [<80331ddc>] __driver_attach+0x60/0x100
[    0.908042] [<8032f668>] bus_for_each_dev+0x68/0xa4
[    0.912989] [<803309d4>] bus_add_driver+0x1f0/0x200
[    0.917952] [<80332448>] driver_register+0x84/0x148
[    0.922906] [<80060a1c>] do_one_initcall+0x7c/0x1dc
[    0.927870] [<80684e14>] kernel_init_freeable+0x158/0x23c
[    0.933361] [<805387d8>] kernel_init+0x10/0xf0
[    0.937883] [<80064dd8>] ret_from_kernel_thread+0x14/0x1c
[    0.943375] ---[ end trace 62e0927fba490f68 ]---
[...]
[    2.266513] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.274893] Rebooting in 1 seconds..

This patch makes mtd concat to follow new mtd requirements by registering
either normal or oob versions of read/write functions, but not both at the
same time. OOB is used only when underlying mtd devices provide such
functionality (like NAND chips) - otherwise generic methods are used.

Tested successfully on Netgear WNDR4300.

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
4 years ago
.github build: Update README & github help 6 years ago
config x86: switch image generation to new code 4 years ago
include kernel: bump 5.4 to 5.4.28 4 years ago
package curl: rebuild when libopenssl config changes 4 years ago
scripts scripts: fixup qemustart for new x86 image names 4 years ago
target kernel: generic: 5.4: fix mtd concat panic on read/write functions 4 years ago
toolchain toolchain: Update GCC 9 to version 9.3.0 4 years ago
tools tools: squashfskit4: fix build with GCC10 4 years ago
.gitattributes add .gitattributes to prevent the git autocrlf option from messing with CRLF/LF in files 12 years ago
.gitignore gitignore: ignore patches in OpenWrt root directory 5 years ago
BSDmakefile add missing copyright header 18 years ago
Config.in merge: base: update base-files and basic config 7 years ago
LICENSE finally move buildroot-ng to trunk 8 years ago
Makefile build: clean menuconfig utility as part of dirclean 4 years ago
README build: switch to Python 3 5 years ago
feeds.conf.default feeds: switch git.lede-project.org URLs to git.openwrt.org 6 years ago
rules.mk rules.mk: remove "$(STAGING_DIR)/include" 5 years ago

README

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------

This is the buildsystem for the OpenWrt Linux distribution.

To build your own firmware you need a Linux, BSD or MacOSX system (case
sensitive filesystem required). Cygwin is unsupported because of the lack
of a case sensitive file system.

You need gcc, binutils, bzip2, flex, python3.5+, perl, make, find, grep, diff,
unzip, gawk, getopt, subversion, libz-dev and libc headers installed.

1. Run "./scripts/feeds update -a" to obtain all the latest package definitions
defined in feeds.conf / feeds.conf.default

2. Run "./scripts/feeds install -a" to install symlinks for all obtained
packages into package/feeds/

3. Run "make menuconfig" to select your preferred configuration for the
toolchain, target system & firmware packages.

4. Run "make" to build your firmware. This will download all sources, build
the cross-compile toolchain and then cross-compile the Linux kernel & all
chosen applications for your target system.

Sunshine!
	Your OpenWrt Community
	http://www.openwrt.org