[LEDE-DEV] Sysupgrade on Mikrotik RB912

Edwin van Drunen edwin at vandrunen.net
Wed Apr 12 07:45:17 PDT 2017


Hello Sergey,

I forget to include the mailing list and did so now, so others can also maybe benefit from our findings.

The board is booted with 17.01.0 initramfs image and “sysupgraded” with the 17.01.0 nand-large image (corresponding with the 2048 byte page size of the NAND flash).
Then I used an OpenWRT trunk initramfs image to get the board booted and mounted the kernel partition as follows:
  mount /dev/mtdblock5 /mnt

The filesystem would mount and automatically detect yaffs, with the output of “mount":
  /dev/mtdblock5 on /mnt type yaffs (rw,relatime)

Besides an empty “lost+found” directory there is nothing on the partition.
“df” would show there is 768K used out of 3840K total (3072K available), no idea what the 768K was used for.

What I meant with “manually formatting the kernel partition” is just executing “mtd erase /dev/mtd5”.
This is not actually necessary, because just mounting the partition and copying the kernel with scp works since the partition was already empty, no need to erase again.

What was your procedure for creating and restoring the kernel partition images?
Did you use “dd” for reading and “mtd write” for writing?

Met vriendelijke groet / With kind regards,

Edwin van Drunen

> On 12 Apr 2017, at 14:45, Sergey Ryazanov <ryazanov.s.a at gmail.com> wrote:
> 
> Hello Edwin,
> 
> sorry, I can not help with this issue more intensively, all I could
> help is consultation via lede-devel mailing list.
> 
> Could you do the following steps to see what happened with kernel
> during sysupgrade:
> - flash firmware with help of LEDE initramfs image and sysupgrade
> - boot board with an old OpenWRT initramfs image
> - attempt to mount kernel partition (e.g. mount -t yaffs /dev/mtdblock5 /mnt)
> - if partition is mounted then show partition filesystem content
> (e.g. ls -la /mnt)
> 
> BTW, what do you mean, when you type "manually format the kernel
> partition", do you use some special utility?
> 
> On Wed, Apr 12, 2017 at 3:15 PM, Edwin van Drunen <edwin at vandrunen.net> wrote:
>> Hello Sergey,
>> 
>> Thank you for the info, but still no luck.
>> I have booted with a snapshot initramfs image and tried using the sysupgrade
>> image of 17.01.0 and a snapshot image.
>> 
>> Both initramfs images would show the same info about the NAND flash in the
>> kernel log.
>> I have 11 new boards to flash and they use two different NAND flash types,
>> but both 128MB, with 2048 byte pages + 64 byte spare.
>> On both 17.0.1.0 and snapshot the kernel would not be found and the board
>> could only boot through TFTP.
>> 
>> If after the sysupgrade I boot an older OpenWRT initramfs image with YAFFS
>> support, manually format the kernel partition and copy the kernel, the
>> system will boot just fine.
>> I also couldn’t find any differences between the sysupgrade scripts on
>> stable and snapshot, so probably there is something wrong with the kernel
>> images.
>> 
>> Is there something else I can try? Would you like to organise a teamviewer
>> session so you can see for yourself?
>> Or would you like to receive an RB912 board?
>> I am willing to donate one to you if it would result in a fix and help the
>> LEDE project.
>> 
>> Below I included relevant information from the kernel log from two boards
>> with different NAND flash:
>> 
>> RB912 with Samsung K9F1G08U0E NAND Flash
>> 
>> [    0.599755] m25p80 spi0.0: found w25x05, expected m25p80
>> [    0.605330] m25p80 spi0.0: w25x05 (64 Kbytes)
>> [    0.609842] Creating 4 MTD partitions on "spi0.0":
>> [    0.614821] 0x000000000000-0x00000000c000 : "routerboot"
>> [    0.622978] 0x00000000c000-0x00000000d000 : "hard_config"
>> [    0.630489] 0x00000000d000-0x00000000e000 : "bios"
>> [    0.637382] 0x00000000e000-0x00000000f000 : "soft_config"
>> [    0.645228] NAND flash driver for the RouterBOARD 91x series
>> [    0.651256] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
>> [    0.657887] nand: Samsung NAND 128MiB 3,3V 8-bit
>> [    0.662660] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB
>> size: 64
>> [    0.670521] Scanning device for bad blocks
>> [    0.829169] Creating 3 MTD partitions on "NAND 128MiB 3,3V 8-bit":
>> [    0.835597] 0x000000000000-0x000000040000 : "booter"
>> [    0.842384] 0x000000040000-0x000000400000 : "kernel"
>> [    0.849467] 0x000000400000-0x000008000000 : "ubi"
>> 
>> RB912 with Winbond W29N01GVSIAA NAND Flash
>> 
>> [    2.971306] m25p80 spi0.0: found w25x05, expected m25p80
>> [    2.976811] m25p80 spi0.0: w25x05 (64 Kbytes)
>> [    2.981391] Creating 4 MTD partitions on "spi0.0":
>> [    2.986344] 0x000000000000-0x00000000c000 : "routerboot"
>> [    2.994767] 0x00000000c000-0x00000000d000 : "hard_config"
>> [    3.002322] 0x00000000d000-0x00000000e000 : "bios"
>> [    3.009246] 0x00000000e000-0x00000000f000 : "soft_config"
>> [    3.017142] NAND flash driver for the RouterBOARD 91x series
>> [    3.025183] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xf1
>> [    3.031811] nand: Unknown W29N01GV
>> [    3.035323] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB
>> size: 64
>> [    3.043189] Scanning device for bad blocks
>> [    3.107905] Creating 3 MTD partitions on "W29N01GV":
>> [    3.113055] 0x000000000000-0x000000040000 : "booter"
>> [    3.119947] 0x000000040000-0x000000400000 : "kernel"
>> [    3.126949] 0x000000400000-0x000008000000 : "ubi"
>> 
>> 
>> Met vriendelijke groet / With kind regards,
>> 
>> Edwin van Drunen
>> 
>> On 11 Apr 2017, at 00:13, Sergey Ryazanov <ryazanov.s.a at gmail.com> wrote:
>> 
>> Hello Edwin,
>> 
>> On Sun, Apr 9, 2017 at 10:11 PM, Edwin van Drunen <edwin at vandrunen.net>
>> wrote:
>> 
>> My RB912 boards came with 2048-byte pages and I installed the nand-large
>> image, specifically:
>> https://downloads.lede-project.org/releases/17.01.0/targets/ar71xx/mikrotik/lede-17.01.0-r3205-59508e3-ar71xx-mikrotik-nand-large-squashfs-sysupgrade.bin
>> 
>> I have installed it on 23 boards so far and none would boot after a regular
>> sysupgrade.
>> They all needed the kernel partition (MTD5) to be formatted to YAFFS and the
>> kernel manually copied.
>> I used this initramsfs image:
>> https://downloads.lede-project.org/releases/17.01.0/targets/ar71xx/mikrotik/lede-17.01.0-r3205-59508e3-ar71xx-mikrotik-vmlinux-initramfs.elf
>> 
>> This problem and the solution were mentioned before on this mailing list,
>> but I never got a definite answer on if this is normal behaviour.
>> 
>> 
>> No, this is not normal behavior.
>> 
>> Sysupgrade image now includes kernel _partition_ image, which already
>> formatted in YAFFS and contains "kernel" file. This kernel partition
>> image just copied to flash in byte-for-byte manner during sysupgrade
>> procedure.
>> 
>> Now I am curious to know if your boards are maybe different or there is some
>> other small detail I am not getting right.
>> 
>> 
>> I do not think so. The only obvious difference is firmware version.
>> For my tests I used images, which I manually built from latest
>> sources.
>> 
>> Could you try latest snapshot build, may be this could solve your
>> issues:
>> https://downloads.lede-project.org/snapshots/targets/ar71xx/mikrotik/
>> 
>> 
>> On 9 Apr 2017, at 18:37, Sergey Ryazanov <ryazanov.s.a at gmail.com> wrote:
>> On Mon, Mar 20, 2017 at 4:04 PM, Edwin van Drunen <edwin at vandrunen.net>
>> wrote:
>> 
>> * Longer story:
>> The installation procedure for LEDE 17.01 on Mikrotik RB-912 boards should
>> be as follows:
>> - TFTP boot the board using the "vmlinux-initramfs.elf” image
>> - scp the "squashfs-sysupgrade.bin” image to /tmp
>> 
>> 
>> Which exactly image did you use 'nand-64m' or 'nand-large'?
>> 
>> - use sysupgrade to install the LEDE sysupgrade image
>> 
>> After a reboot the system will always attempt to boot from the network,
>> because a kernel can not be found.
>> The MTD6 partition (previously rootfs) is now in UBI format and hosts the
>> kernel and the root partitions inside.
>> But routerboot looks for a kernel in MTD5 and (probably?) only supports
>> YAFFS.
>> 
>> I was able to get LEDE to boot by doing these extra steps:
>> - TFTP boot an old OpenWRT initramfs image (14.07) that supports YAFFS
>> - MTD erase /dev/mtd5
>> - mount /dev/mtdblock5 /mnt
>> - copy the LEDE LZMA kernel image to /mnt, renaming it to “kernel” and chmod
>> a+x.
>> 
>> The kernel loads just fine from the YAFFS partition and the rootfs is
>> mounted using UBIFS (as overlay on squashfs), which is a big improvement
>> over YAFFS.
>> But now I will not be able to sysupgrade to a newer version of LEDE and
>> can’t access the kernel partition, because YAFFS is not supported on LEDE.
>> 
>> Am I missing something or is this just the way it is for now?
>> 
>> 
>> I test new sysupgrade with several Mikrotik boards (RB912 in
>> particular) and despite some ambiguous it works like a charm.
>> 
>> Most notable is selection of proper image from two's available:
>> "nand-64m" or "nand-large". You could find related discussion here
>> [1].
>> 
>> In short, you should use 'nand-64m' image for NAND with 512-bytes
>> pages, and 'nand-large' for NAND with 2048-bytes pages. All RB912
>> boards which I saw are equipped with NAND IC with 2048-bytes pages, so
>> the common choise for this boards is
>> 'nand-large-squashfs-sysupgrade.bin' image.
>> 
>> 1. Mikrotik RB411AH sysupgrade issues //
>> http://lists.infradead.org/pipermail/lede-dev/2017-February/006195.html
> 
> --
> Sergey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20170412/e3fcfa6e/attachment.sig>


More information about the Lede-dev mailing list