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#2124 - zyxel P-2812HNU-F1 errors out on bad crc for trunk after installing through Luci #6014

Closed
openwrt-bot opened this issue Feb 15, 2019 · 13 comments
Labels

Comments

@openwrt-bot
Copy link

Mafketel:

Supply the following if possible:

  • Device problem occurs on

zyxel P-2812HNU-F1

  • Software versions of OpenWrt/LEDE release, packages, etc.

trunk

  • Steps to reproduce

flash trunk firmware to modem via Luci, see below for output.
I have tried both with keep settings and with delete settings same error

serial console output

ROM VER: 1.0.5
CFG 06
NAND
NAND Read OK

U-Boot SPL 2013.10-openwrt5 (Nov 18 2014 - 19:54:01)
SPL: initializing NAND flash
SPL: checking U-Boot image
SPL: loading U-Boot to RAM
SPL: decompressing U-Boot with LZO
SPL: jumping to U-Boot

U-Boot 2013.10-openwrt5 (Nov 18 2014 - 19:54:01) P-2812HNU-Fx

Board: ZyXEL P-2812HNU-Fx
SoC: Lantiq VRX288 v1.1
CPU: 500 MHz
IO: 250 MHz
BUS: 250 MHz
BOOT: NAND
DRAM: 128 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: ltq-eth
Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x60000, size 0x200000
2097152 bytes read: OK

Booting kernel from Legacy Image at 80800000 ...

Image Name: MIPS OpenWrt Linux-4.14.98
Created: 2019-02-13 9:37:36 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 2119245 Bytes = 2 MiB
Load Address: 80002000
Entry Point: 80002000
Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
P-2812HNU-Fx #


serial console output flash proces

Watchdog handover: fd=3

  • watchdog -
    killall: dropbear: no process killed
    killall: ash: no process killed
    Sending TERM to remaining processes ... logd rpcd netifd odhcpd vdsl_cpe_contro ntpd dnsmasq sh sysupgrade ubus ubusd askfirst
    Sending KILL to remaining processes ...
    Unlocking kernel ...

Writing from to kernel ... [e]Failed to get erase block status
removing ubiblock0_0
[ 103.424000] UBI: ubiblock0_0 released
Volume ID 0, size 23 LEBs (2967552 bytes, 2.8 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "rootfs", alignment 1
Set volume size to 123604992
Volume ID 1, size 958 LEBs (123604992 bytes, 117.9 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "rootfs_data", alignment 1
sysupgrade successful
[ 104.356000] reboot: Reÿ
ROM VER: 1.0.5
CFG 06
NAND
NAND Read OK

U-Boot SPL 2013.10-openwrt5 (Nov 18 2014 - 19:54:01)
SPL: initializing NAND flash
SPL: checking U-Boot image
SPL: loading U-Boot to RAM
SPL: decompressing U-Boot with LZO
SPL: jumping to U-Boot

U-Boot 2013.10-openwrt5 (Nov 18 2014 - 19:54:01) P-2812HNU-Fx

Board: ZyXEL P-2812HNU-Fx
SoC: Lantiq VRX288 v1.1
CPU: 500 MHz
IO: 250 MHz
BUS: 250 MHz
BOOT: NAND
DRAM: 128 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: ltq-eth
Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x60000, size 0x200000
2097152 bytes read: OK

Booting kernel from Legacy Image at 80800000 ...

Image Name: MIPS OpenWrt Linux-4.14.98
Created: 2019-02-13 9:37:36 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 2119245 Bytes = 2 MiB
Load Address: 80002000
Entry Point: 80002000
Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
P-2812HNU-Fx #

@openwrt-bot
Copy link
Author

chunkeey:

NAND read: device 0 offset 0x60000, size 0x200000 [...] Data Size: 2119245 Bytes = 2 MiB

There's the problem. The bootloader only reads 0x200000 = 2097152 bytes
However, the kernel image is 2119245 bytes long. Luckily, this device
already has a second-stage bootloader.

So, in order to fix this you need to update the uboot's nboot env variable.
You can do this in the following way:

setenv nboot 'nand read 0x80800000 0x60000 0x300000; bootm 0x80800000' saveenv

(This is a bit of a stop-gap measure, ideally you would want to use
a better nand boot command that can read the size of the kernel dynamically.
But it should do well enough for a test)

and then enter:

run bootcmd

If this works, please let us know so the wiki can be updated. Thanks.

@openwrt-bot
Copy link
Author

Mafketel:

thnx for the suggestion and your time

sadly it did not help

Anything else I can do apart from checking this website more often ;) since I did not get a notification. just updated the settings should receive emails with updates now ;)


NAND read: device 0 offset 0x60000, size 0x300000
3145728 bytes read: OK

Booting kernel from Legacy Image at 80800000 ...

Image Name: MIPS OpenWrt Linux-4.14.101
Created: 2019-02-20 22:06:16 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 2119765 Bytes = 2 MiB
Load Address: 80002000
Entry Point: 80002000
Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
P-2812HNU-Fx #

@openwrt-bot
Copy link
Author

chunkeey:

NAND read: device 0 offset 0x60000, size 0x300000 3145728 bytes read: OK ## Booting kernel from Legacy Image at 80800000 ... Image Name: MIPS OpenWrt Linux-4.14.101 Created: 2019-02-20 22:06:16 UTC Image Type: MIPS Linux Kernel Image (lzma compressed) Data Size: 2119765 Bytes = 2 MiB Load Address: 80002000 Entry Point: 80002000 Verifying Checksum ... Bad Data CRC ERROR: can't get kernel image! P-2812HNU-Fx #

Well, looking at the [[https://oldwiki.archive.openwrt.org/toh/zyxel/p2812hnu-f1|flashing instructions]] step 3-5

Step 3: Upload kernel image

tftp 0x80800000 openwrt-lantiq-xrx200-P2812HNUF1-uImage

Step 4: Erase NAND

nand erase 0x60000 0x200000

Step 5: Flash kernel image onto NAND

nand write 0x80800000 0x60000 0x200000

So, only 2MiB of the image was ever written to the nand, so there's no full image to be had,
so the device needs to be reflashed with the full image.

Now, question is: does the u-boot support tftp command set the "$filesize" or not?
Because ideally, you would want to erase and write as little as possible (on the other hand
having a fixed save limit has less potential for screw ups in the future.)

Step 3: Upload kernel image

tftp 0x80800000 openwrt-lantiq-xrx200-P2812HNUF1-uImage

[...]

echo $filesize

and check if "echo $filesize" returned something in the 2110000 - 2120000 range.
If it does then you can continue along. If it is garbage then please replace the $filesize with a fixed value (like 0x300000).

Step 4: Erase NAND

nand erase 0x60000 $filesize

Step 5: Flash kernel image onto NAND

nand write 0x80800000 0x60000 $filesize

(and then run bootcmd)

@openwrt-bot
Copy link
Author

Mafketel:

tftboot updates that variable and the uImage you are referring to in the wiki is an old one that is less then 2mb. Apart from the old uImages and initramfs available on scapi's github there are none available, not in trunk 18 or 17 version of openwrt.

To install openwrt you need to first get CC on the modem and then from within luci upgrade.

I am not following the very old wiki directly anymore as it is outdated and not complete.

currently this is the steps I take to get from empty nand to working 18.6.2 or earlier
(I also started a thread on the forum to get some feedback on to update the wiki)
I probably should also update the use of tftp to tftpboot since the command was renamed after tftpput was added a while ago


files are from:
https://github.com/ScApi/P2812HNUFx-Pre-Build/tree/OpenWrt-Chaos-Calmer-r45578
r46 something also works but anything after that will either not have all files necessary or will error out.
and 18.6.2 and trunk are from openwrt

short to gnd r17 and wait for the uart boot mode

send the openwrt-lantiq-p2812hnufx_ram-u-boot.asc (works from 18.6.2 and trunk and old version)

wait for it to finish

then at the prompt

tftp openwrt-lantiq-p2812hnufx_nandtpl-u-boot.img

nand erase 0 $filesize && nand write $fileaddr 0 $filesize

turn off power (otherwise you stay in the uart mode)

from here on you need to use the the CC version of files
P2812HNUFx-Pre-Build-OpenWrt-Chaos-Calmer-r45578

setenv ethaddr B0:B2:DC:XX:XX:XX
setenv nboot 'nand read 0x80800000 0x60000 0x300000; bootm 0x80800000'
setenv bootcmd 'run nboot'
saveenv

tftp openwrt-lantiq-xrx200-P2812HNUF1-uImage

nand erase 0x60000 $filesize

nand write $fileaddr 0x60000 $filesize

tftpboot openwrt-lantiq-xrx200-P2812HNUF1-uImage-initramfs

bootm $fileaddr

upgrade to newer firmware through luci and I checked the checksum and they were the same.

there are no recent full images of the p-2812

I will attach the serial log in a file ps this is from the successful 18.06.2 installation(except for the wireless eeprom), if you upgrade to trunk from luci you get the errors I described in the beginning.

@openwrt-bot
Copy link
Author

Mafketel:

slightly related the bug report of the missing files for the p-2812
https://bugs.openwrt.org/index.php?do=details&task_id=1611

@openwrt-bot
Copy link
Author

Mafketel:

would it be helpful to load the kernel in memory manually?

so get kernel file from sysupgrade file with binwalk -e
upload it to the modem with tftpboot and then run it ...

go to the u-boot prompt and

tftpboot kernel

bootm $fileaddr

I have very little confidence it will boot all the way but I hope it at least tests the crc... and starts booting

@openwrt-bot
Copy link
Author

Mafketel:

Well that was a surprise ..... ;)

That actually worked and booted
so the kernel file in the sysupgrade snapshot is fine but something goes wrong between the upgrade and running the kernel.

Can I manually write the kernel image to the nand?

......serial log
bootm $fileaddr

Booting kernel from Legacy Image at 81000000 ...

Image Name: MIPS OpenWrt Linux-4.14.101
Created: 2019-02-22 1:35:05 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 2119834 Bytes = 2 MiB
Load Address: 80002000
Entry Point: 80002000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK

Starting kernel ...

[ 0.000000] Linux version 4.14.101 (buildbot@buildslave) (gcc version 7.4.0 (OpenWrt GCC 7.4.0 r9415-73c60ef239)) #0 SMP Fri Feb 22 01:35:05 2019
[ 0.000000] SoC: xRX200 rev 1.1
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 00019555 (MIPS 34Kc)
[ 0.000000] MIPS: machine is ZyXEL P-2812HNU-F1
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Detected 1 available secondary CPU(s)
[ 0.000000] Primary instruction cache 32kB, 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-0x0000000007ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] random: get_random_bytes called from start_kernel+0x8c/0x4a8 with crng_init=0
[ 0.000000] percpu: Embedded 14 pages/cpu @8110e000 s25968 r8192 d23184 u57344
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: console=ttyLTQ0,115200
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Writing ErrCtl register=00021400
[ 0.000000] Readback ErrCtl register=00021400
[ 0.000000] Memory: 121504K/131072K available (5168K kernel code, 198K rwdata, 1376K rodata, 1240K init, 230K bss, 9568K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] NR_IRQS: 256
[ 0.000000] CPU Clock: 500MHz
[ 0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041786 ns
[ 0.000011] sched_clock: 32 bits at 250MHz, resolution 4ns, wraps every 8589934590ns
[ 0.007909] Calibrating delay loop... 332.54 BogoMIPS (lpj=665088)
[ 0.045991] pid_max: default: 32768 minimum: 301
[ 0.050909] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.057414] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.066831] Hierarchical SRCU implementation.
[ 0.072274] smp: Bringing up secondary CPUs ...
[ 0.077687] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[ 0.077700] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.077854] CPU1 revision is: 00019555 (MIPS 34Kc)
[ 0.108927] Synchronize counters for CPU 1: done.
[ 0.133232] smp: Brought up 1 node, 2 CPUs
[ 0.142445] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.152112] futex hash table entries: 512 (order: 2, 16384 bytes)
[ 0.158382] pinctrl core: initialized pinctrl subsystem
[ 0.165175] NET: Registered protocol family 16
[ 0.181414] pinctrl-xway 1e100b10.pinmux: Init done
[ 0.188089] dma-xway 1e104100.dma: Init done - hw rev: 7, ports: 7, channels: 28
[ 0.200149] dcdc-xrx200 1f106a00.dcdc: Core Voltage : 1016 mV
[ 0.213035] PCI host bridge /fpi@10000000/pci@e105400 ranges:
[ 0.218718] MEM 0x0000000018000000..0x0000000019ffffff
[ 0.223970] IO 0x000000001ae00000..0x000000001affffff
[ 0.253957] gpio-stp-xway 1e100bb0.stp: Init done
[ 0.261115] usbcore: registered new interface driver usbfs
[ 0.266678] usbcore: registered new interface driver hub
[ 0.272093] usbcore: registered new device driver usb
[ 0.277776] PCI host bridge to bus 0000:00
[ 0.281785] pci_bus 0000:00: root bus resource [mem 0x18000000-0x19ffffff]
[ 0.288696] pci_bus 0000:00: root bus resource [io 0x1ae00000-0x1affffff]
[ 0.295656] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[ 0.302503] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 0.311174] pci 0000:00:0e.0: BAR 0: assigned [mem 0x18000000-0x1800ffff]
[ 0.320167] clocksource: Switched to clocksource MIPS

@openwrt-bot
Copy link
Author

Mafketel:

.... after typing a lot ....
sort off success
running snapshot now after sysupgrade tftpboot kernel and an bootm does the trick ....
Now how to get the kernel into nand.
MTD partition seems to small 0x000000060000-0x000000260000 : "kernel"
dunno if that is made by sysupgrade or the structure reused.

trying now how to resize MTD partition 3 and 4.

root@OpenWrt:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00020000 "uboot"
mtd1: 00020000 00020000 "uboot-env"
mtd2: 00200000 00020000 "kernel"
mtd3: 07da0000 00020000 "ubi"

mtd2 should be enlarged to 3mb or more, dunno what to expect in kernel size in the future, as there is 128mb of nand flash should not be to skimpy

in the u-boot environment there do not seem to be mtd partitions defined
P-2812HNU-Fx # mtdparts
mtdparts variable not set, see 'help mtdparts'
no partitions defined

defaults:
mtdids : nand0=nand
mtdparts: mtdparts=nand:256k(uboot),128k(uboot_env),-@0x60000(rootfs);
P-2812HNU-Fx #

even if I change the mtdparts in u-boot the linux comes up with the same 4 partitions

P-2812HNU-Fx # mtdparts default
P-2812HNU-Fx # mtdparts

device nand0 , # parts = 3
#: name size offset mask_flags
0: uboot 0x00040000 0x00000000 0
1: uboot_env 0x00020000 0x00040000 0
2: rootfs 0x07fa0000 0x00060000 0

active partition: nand0,0 - (uboot) 0x00040000 @ 0x00000000

defaults:
mtdids : nand0=nand
mtdparts: mtdparts=nand:256k(uboot),128k(uboot_env),-@0x60000(rootfs);

tried this as well
P-2812HNU-Fx # mtdparts

device nand0 , # parts = 4
#: name size offset mask_flags
0: uboot 0x00040000 0x00000000 0
1: uboot_env 0x00020000 0x00040000 0
2: kernel 0x00300000 0x00060000 0
3: rootfs 0x07ca0000 0x00360000 0

active partition: nand0,0 - (uboot) 0x00040000 @ 0x00000000

defaults:
mtdids : nand0=nand
mtdparts: mtdparts=nand:256k(uboot),128k(uboot_env),-@0x60000(rootfs);

but the kernel does not like that ;) notice that mtdblock 2 is still 2megabytes and not 3mb
[ 1.279306] UBI error: no valid UBI magic found inside mtd3
[ 1.283910] USB_VBU[ 1.287587] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 1.293691] Please append a correct "root=" boot option; here are the available partitions:
[ 1.302027] 1f00 256 mtdblock0
[ 1.302038] (driver?)
[ 1.308545] 1f01 128 mtdblock1
[ 1.308555] (driver?)
[ 1.315041] 1f02 2048 mtdblock2
[ 1.315052] (driver?)
[ 1.321573] 1f03 128640 mtdblock3
[ 1.321584] (driver?)
[ 1.328140] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.338724] Rebooting in 1 seconds..

attached serial log and a second one where I changed mtdblocks

@openwrt-bot
Copy link
Author

Mafketel:

It seems like one needs to adjust this file.

https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUF1.dts;h=911a2d6afee0ef878d4ec9b8ea8e775b6b7ffcad;hb=HEAD

Is my understanding correct that the standard would be:
U-boot
U-boot-config
rootfs

or Maybe follow the original layout since it was already a U-boot linux-kernel box to begin with

p.s. the f3 version needs to be adjusted as well
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUF3.dts;h=202226aa862a80f59ba3e77495475c09c8d7747e;hb=HEAD

@openwrt-bot
Copy link
Author

Mafketel:

I can confirm that is the file to edit and it boots after that change without crc error

@openwrt-bot
Copy link
Author

Mafketel:

Any change this can be integrated in the tree snapshot and into the release as well without me doing that?

changes needed:
in
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/lantiq/files-4.14/arch/mips/boot/dts/P2812HNUF1.dts;h=911a2d6afee0ef878d4ec9b8ea8e775b6b7ffcad;

and

https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/lantiq/files-4.9/arch/mips/boot/dts/P2812HNUF1.dts;h=911a2d6afee0ef878d4ec9b8ea8e775b6b7ffcad;

48 partition@60000 {
49 label = "kernel";
50 reg = <0x60000 0x200000>;
51 };
52 partition@260000 {
53 label = "ubi";
54 reg = <0x260000 0x7da0000>;

into 48 partition@60000 {
49 label = "kernel";
50 reg = <0x60000 0x300000>;
51 };
52 partition@360000 {
53 label = "ubi";
54 reg = <0x360000 0x7ca0000>;

@openwrt-bot
Copy link
Author

chunkeey:

Any change this can be integrated in the tree snapshot and into the release as well without me doing that?

Thank you, yes for the most part this should be possible. The change is easy enough and given that the device seem to have plenty of space and the current images are bricking devices already I don't think there would be much of a push-back. (Another alternative would have been trying to shrinking the kernel, but that's easier said than done)

What's a bit of a issue is that your name is will be required for a [[https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes|Reported-By: / Suggested-By]] tag.

If you want to take a peek at the possible commit (more suggestions?), I added it to my
staging tree:

https://git.openwrt.org/?p=openwrt/staging/chunkeey.git;a=commit;h=cf3fa21ce1d466590b9e953465bc7d2288540fac

@openwrt-bot
Copy link
Author

Mafketel:

One small change needed in the commit, for the rest better written then I would have ;)

B.T.W. do you want to include the same change to the 4.9 kernel dts file? For I only see the change in the 4.14 kernel dts file.

partition@260000 {

should be

partition@360000 {

as we moved the partition by 1 megabyte.

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