RB433 bad sector - cannot start OpenWrt

Currently, in order for the board to run, the kernel downloaded with bootp (another router in the network with dnsmasq) and the rest starts from nand.

dhcp-boot=openwrt-ar71xx-mikrotik-vmlinux-lzma.elf,boothost,192.168.1.3

If someone knows how to change the address where the board should look for the kernel, it would be great. I changed the partition layout to:

    {
        .name    = "kernel",
        .offset    = (256 * 1024) + (5 * 1024 * 1024),
        .size    = (8 * 1024 * 1024) - (256 * 1024),
    },

So partition layout is:

root@RB433:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 0000b000 00001000 "routerboot"
mtd1: 00001000 00001000 "hard_config"
mtd2: 00002000 00001000 "bios"
mtd3: 00001000 00001000 "soft_config"
mtd4: 00040000 00020000 "booter"
mtd5: 007c0000 00020000 "kernel"
mtd6: 07300000 00020000 "ubi"

and finally we have:

RouterBOOT booter 3.22

RouterBoard 433

CPU frequency: 300 MHz
  Memory size:  64 MiB
    NAND size: 128 MiB

Press any key within 2 seconds to enter setup..

loading kernel from nand... kernel not found
trying bootp protocol...................................................... OK
Got IP address: 192.168.1.6
resolved mac address F0:B4:29:59:41:AE
Gateway: 192.168.1.1
transfer started ............ transfer ok, time=1.27s
setting up elf image... OK
jumping to kernel code



OpenWrt kernel loader for AR7XXX/AR9XXX

Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>

Decompressing kernel... done!

Starting kernel at 80060000...


[    0.000000] Linux version 4.14.193 (amk082@krk-sc11-19) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11181-e754e0a)) #0 Wed Aug 12 09:10:16 2020
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR7130 rev 2
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x90/0x47c with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: parts=1 boot_part_size=4194304 gpio=4031 HZ=150000000 mem=64M kmac=00:0C:42:42:64:60 board=433 ver=3.22 hw_opt=00000000 boot=1 mlc=8 console=ttyS0,115200 rootfstype=squashfs noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 59396K/65536K available (3705K kernel code, 158K rwdata, 860K rodata, 196K init, 201K bss, 6140K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] Clocks: CPU:300.000MHz, DDR:300.000MHz, AHB:150.000MHz, Ref:40.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 12741736309 ns
[    0.000016] sched_clock: 32 bits at 150MHz, resolution 6ns, wraps every 14316557820ns
[    0.007916] Calibrating delay loop... 199.06 BogoMIPS (lpj=995328)
[    0.094106] pid_max: default: 32768 minimum: 301
[    0.099106] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.105722] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.116472] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.126348] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.133024] NET: Registered protocol family 16
[    0.139711] MIPS: machine is MikroTik RouterBOARD 433/AH
[    0.917342] registering PCI controller with io_map_base unset
[    0.944232] rb4xx-spi rb4xx-spi: controller is unqueued, this is deprecated
[    0.952646] PCI host bridge to bus 0000:00
[    0.956820] pci_bus 0000:00: root bus resource [mem 0x10000000-0x16ffffff]
[    0.963679] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.969265] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.976036] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.985123] clocksource: Switched to clocksource MIPS
[    0.991648] NET: Registered protocol family 2
[    0.997349] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    1.004339] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    1.010775] TCP: Hash tables configured (established 1024 bind 1024)
[    1.017382] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    1.023232] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    1.029920] NET: Registered protocol family 1
[    1.042176] Crashlog allocated RAM at address 0x3f00000
[    1.049280] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    1.064285] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.070171] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    1.094083] io scheduler noop registered
[    1.098073] io scheduler deadline registered (default)
[    1.103592] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    1.110556] console [ttyS0] disabled
[    1.134191] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 9375000) is a 16550A
[    1.142827] console [ttyS0] enabled
[    1.142827] console [ttyS0] enabled
[    1.149795] bootconsole [early0] disabled
[    1.149795] bootconsole [early0] disabled
[    1.159365] m25p80 spi0.0: pm25lv512 (64 Kbytes)
[    1.168408] Creating 4 MTD partitions on "spi0.0":
[    1.173213] 0x000000000000-0x00000000b000 : "routerboot"
[    1.180998] 0x00000000b000-0x00000000c000 : "hard_config"
[    1.188496] 0x00000000d000-0x00000000f000 : "bios"
[    1.196194] 0x00000000f000-0x000000010000 : "soft_config"
[    1.203856] NAND flash driver for RouterBoard 4xx series version 0.2.0
[    1.218085] nand: Could not find valid ONFI parameter page; aborting
[    1.224493] nand: device found, Manufacturer ID: 0x20, Chip ID: 0xf1
[    1.230847] nand: ST Micro NAND 128MiB 3,3V 8-bit
[    1.235567] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.243138] Scanning device for bad blocks
[    1.247854] Bad eraseblock 2 at 0x000000040000
[    1.252483] Bad eraseblock 3 at 0x000000060000
[    1.257137] Bad eraseblock 4 at 0x000000080000
[    1.261771] Bad eraseblock 5 at 0x0000000a0000
[    1.266425] Bad eraseblock 6 at 0x0000000c0000
[    1.271059] Bad eraseblock 7 at 0x0000000e0000
[    1.275713] Bad eraseblock 8 at 0x000000100000
[    1.280347] Bad eraseblock 9 at 0x000000120000
[    1.284978] Bad eraseblock 10 at 0x000000140000
[    1.289718] Bad eraseblock 11 at 0x000000160000
[    1.294439] Bad eraseblock 12 at 0x000000180000
[    1.299180] Bad eraseblock 13 at 0x0000001a0000
[    1.303900] Bad eraseblock 14 at 0x0000001c0000
[    1.308640] Bad eraseblock 15 at 0x0000001e0000
[    1.313360] Bad eraseblock 16 at 0x000000200000
[    1.318104] Bad eraseblock 17 at 0x000000220000
[    1.322822] Bad eraseblock 18 at 0x000000240000
[    1.327561] Bad eraseblock 19 at 0x000000260000
[    1.332273] Bad eraseblock 20 at 0x000000280000
[    1.337014] Bad eraseblock 21 at 0x0000002a0000
[    1.341735] Bad eraseblock 22 at 0x0000002c0000
[    1.346474] Bad eraseblock 23 at 0x0000002e0000
[    1.351187] Bad eraseblock 24 at 0x000000300000
[    1.355926] Bad eraseblock 25 at 0x000000320000
[    1.360638] Bad eraseblock 26 at 0x000000340000
[    1.365379] Bad eraseblock 27 at 0x000000360000
[    1.370100] Bad eraseblock 28 at 0x000000380000
[    1.374817] Bad eraseblock 29 at 0x0000003a0000
[    1.379557] Bad eraseblock 30 at 0x0000003c0000
[    1.384277] Bad eraseblock 31 at 0x0000003e0000
[    1.389018] Bad eraseblock 32 at 0x000000400000
[    1.393739] Bad eraseblock 33 at 0x000000420000
[    1.398479] Bad eraseblock 34 at 0x000000440000
[    1.403199] Bad eraseblock 35 at 0x000000460000
[    1.407940] Bad eraseblock 36 at 0x000000480000
[    1.412859] Bad eraseblock 38 at 0x0000004c0000
[    1.417599] Bad eraseblock 39 at 0x0000004e0000
[    1.618319] Creating 3 MTD partitions on "NAND 128MiB 3,3V 8-bit":
[    1.624505] 0x000000000000-0x000000040000 : "booter"
[    1.631905] 0x000000540000-0x000000d00000 : "kernel"
[    1.639108] 0x000000d00000-0x000008000000 : "ubi"
[    1.651098] libphy: Fixed MDIO Bus: probed
.....