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

FS#3883 - [NAND with badblocks] InitramFS image uses real partitions offset, w/o corrections to bad blocks #8888

Closed
openwrt-bot opened this issue Jun 18, 2021 · 1 comment
Labels

Comments

@openwrt-bot
Copy link

csharper2005:

  • Device problem occurs on - at least ramips NAND devices with bad erase blocks (Beeline Smartbox GIGA, Xiaomi Redmi router AC2100)
  • Software versions - Trunk
  • Steps to reproduce (on a device with bad erase blocks, at 0x2c0000 in the following example):
  1. Boot OpenWRT InitramFS (e.g. from TFTP);
  2. Write something on a mtd* partition (after a badblock):

mtd write kernel.bin /dev/mtd4
mtd4 offset - 0x400000

  1. Check the written data using U-Boot or OpenWRT installed on NAND. Written data is shifted by (number of bad blocks)*(block size, 0x20000). Our data is actually written at 0x380000 (for U-Boot or OpenWRT installed on NAND). System doesn't boot if it was a kernel.

Device layout (dts file):
0x000000000000-0x000000100000: "Boot Loader"
0x000000100000-0x000000200000: "dynamic partition map"
0x000000200000-0x000000300000: "Factory"
0x000000300000-0x000000400000: "Boot Flag"
0x000000400000-0x000000a00000: "Kernel" mtd4
0x000000a00000-0x000001000000: "Kernel 2"
0x000001000000-0x000002800000: "File System 1"
0x000002800000-0x000004000000: "File System 2"

Real partition addresses (for U-Boot, stock firmware & OpenWRT installed on NAND):
0x000000000000-0x000000100000 : "Boot Loader"
0x000000100000-0x000000200000 : "dynamic partition map"
0x000000200000-0x000000320000(shift by 1 block - 0x20000) : "Factory"
0x000000320000-0x000000420000(shift by 1 block - 0x20000): "Boot Flag"
0x000000420000-0x000000a20000(shift by 1 block - 0x20000): "Kernel" mtd4
0x000000a20000-0x000001020000(shift by 1 block - 0x20000): "Kernel 2"
0x000001020000-0x000002820000(shift by 1 block - 0x20000): "File System 1"
0x000002820000-0x000004020000(shift by 1 block - 0x20000): "File System 2"

Real partition addresses (for OpenWRT initramfs):
0x000000000000-0x000000100000 : "Boot Loader"
0x000000100000-0x000000200000 : "dynamic partition map"
0x000000200000-0x000000320000(shift by 1 block - 0x20000) : "Factory"
0x000000320000-0x000000420000(shift by 1 block - 0x20000): "Boot Flag"
0x000000420000-0x000000a20000(shift by 1 block - 0x20000): "Kernel 1"
0x000000a20000-0x000001020000(shift by 1 block - 0x20000): "Kernel 2"
0x000001020000-0x000002820000(shift by 1 block - 0x20000): "File System 1"
0x000002820000-0x000004020000(shift by 1 block - 0x20000): "File System 2"

@openwrt-bot
Copy link
Author

csharper2005:

*Correction - Real partition addresses (for OpenWRT initramfs):
0x000000000000-0x000000100000: "Boot Loader"
0x000000100000-0x000000200000: "dynamic partition map"
0x000000200000-0x000000300000: "Factory"
0x000000300000-0x000000400000: "Boot Flag"
0x000000400000-0x000000a00000: "Kernel" mtd4
0x000000a00000-0x000001000000: "Kernel 2"
0x000001000000-0x000002800000: "File System 1"
0x000002800000-0x000004000000: "File System 2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant