Building and installing LEDE image from source on Mikrotik rb433

I tried to build LEDE from source from the github. I successfully cloned and compiled the image. When I tried to transfer the image to my Mikrotik rb433 board, I encountered this error: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0).

I followed the instructions here:
https://wiki.openwrt.org/toh/mikrotik/common

For flashing the image on my Mikrotik rb433, first I tried to use initramfs image of LEDE to boot the board with usual tftp boot. When I saw the /proc/mtd values, I got the following:

root@LEDE:/# cat /proc/mtd
dev: size erasesize name
mtd0: 0000b000 00008000 "routerboot"
mtd1: 00001000 00008000 "hard_config"
mtd2: 00002000 00008000 "bios"
mtd3: 00001000 00001000 "soft_config"
mtd4: 00040000 00020000 "booter"
mtd5: 003c0000 00020000 "kernel"
mtd6: 07c00000 00020000 "ubi"

So I rebooted with old openwrt initramfs image, on which I got the following:

root@OpenWrt:/# 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: 003c0000 00020000 "kernel"
mtd6: 07c00000 00020000 "rootfs"

I proceeded with the website instructions for manually flashing the image as follows. (I've also tried wget2nand, but that also did not work). The commands I gave for manual flashing and their outputs are:

root@OpenWrt:/# mtd erase /dev/mtd5
Unlocking /dev/mtd5 ...
Erasing /dev/mtd5 ...
root@OpenWrt:/# mtd erase /dev/mtd6
Unlocking /dev/mtd6 ...
Erasing /dev/mtd6 ...

Skipping bad block at 0x980000
Skipping bad block at 0x1640000
Skipping bad block at 0x23a0000
Skipping bad block at 0x25e0000
Skipping bad block at 0x4ae0000
root@OpenWrt:/# mkdir mnt/kernel
root@OpenWrt:/# mkdir mnt/rootfs
root@OpenWrt:/# mount /dev/mtdblock5 /mnt/kernel
[ 428.170000] yaffs: dev is 32505861 name is "mtdblock5" rw
[ 428.180000] yaffs: passed flags ""
root@OpenWrt:/# mount /dev/mtdblock6 /mnt/rootfs
[ 444.250000] yaffs: dev is 32505862 name is "mtdblock6" rw
[ 444.260000] yaffs: passed flags ""

Following this, I did scp to transfer lede-ar71xx-mikrotik-vmlinux-lzma.elf and lede-ar71xx-mikrotik-default-rootfs.tar.gz images from host to the /tmp folder of the board, and finally ran the the following commands:

root@OpenWrt:/# mv /tmp/lede-ar71xx-mikrotik-vmlinux-lzma.elf /mnt/kernel/kernel
root@OpenWrt:/# chmod +x /mnt/kernel/kernel
root@OpenWrt:/# umount /mnt/kernel/
root@OpenWrt:/mnt/rootfs# tar -xvzf /tmp/lede-ar71xx-mikrotik-default-rootfs.tar.gz
root@OpenWrt:/# umount /mnt/rootfs
root@OpenWrt:/# sync
root@OpenWrt:/# reboot

On rebooting (from NAND), I am getting the following errors (few last lines of the boot-time messages):

[ 2.340051] rb: no calibration data found
[ 2.347285] UBI error: no valid UBI magic found inside mtd6VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 2.360039] Please append a correct "root=" boot option; here are the available partitions:
[ 2.368389] 1f00 44 mtdblock0 (driver?)
[ 2.373442] 1f01 4 mtdblock1 (driver?)
[ 2.378498] 1f02 8 mtdblock2 (driver?)
[ 2.383545] 1f03 4 mtdblock3 (driver?)
[ 2.388603] 1f04 256 mtdblock4 (driver?)
[ 2.393650] 1f05 3840 mtdblock5 (driver?)
[ 2.398708] 1f06 126976 mtdblock6 (driver?)
[ 2.403756] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.412909] Rebooting in 1 seconds..

Any help is greatly appreciated. Did I do some mistake in generating images? I also want to understand why rootfs is not mounting?

Regards.
Inam

We already have 2 other cases of "no valid UBI magic found", but both are unresolved until today:

For mikrotik: boot initramfs image, transfer sysupgrade file to /tmp and do sysupgrade -n...

Can you explained sysupgrade process in a bit more detail? because i tried that too, but I remember ended with a message like: "sysupgrade is not yet implemented for rb433.."

Just do sysupgrade from lede initramfs image. This working for rb912 and few other boards.

It worked. The image that worked is:
lede/bin/targets/ar71xx/mikrotik/lede-ar71xx-mikrotik-nand-large-squashfs-sysupgrade.bin

Might help someone.

Thank you all, especially cezary, for help!

Regards
Inam

Hi inam

I found this thread interesting and usefull because i'm trying to install LEDE/OpenWrt on the same Board.

I can't find a complete step by step guide for install it.

Can you tell me where have you found the lede-ar71xx-mikrotik-default-rootfs.tar.gz file?
i can't find it on the repository.

Thanks in advance
FMH

You need the lede-ar71xx-mikrotik-initramfs.elf image. To get this, do git clone for lede from github, and follow the instructions there to build the image on your host. Once the make is complete, you get the images in lede/bin/targets/ar71xx/mikrotik/. Then you will have to follow the flash procedure for the image in your host machine to your router board, and once your router boots up, follow the procedure for sysupgrade from lede/bin/targets/ar71xx/mikrotik/lede-ar71xx-mikrotik-nand-large-squashfs-sysupgrade.bin

Inam

That file can neither be found in 17.01.4 nor in snapshots.
What IS available in 17.01.4 and what comes closest to this file: https://downloads.lede-project.org/releases/17.01.4/targets/ar71xx/mikrotik/lede-17.01.4-ar71xx-mikrotik-vmlinux-initramfs.elf

I wonder if installation also works with this initramfs image.
Can someone shed some light on this?

Right. that is the correct name. Just give it a try.

Thanks, I updated the dataentry accordingly.
https://lede-project.org/toh/hwdata/mikrotik/mikrotik_rb433

Hi all,
after compile from lede source my bin/targets/ar71xx/mikrotik/ is:

config.seed
lede-ar71xx-mikrotik-device-nand-64m.manifest
lede-ar71xx-mikrotik-nand-64m-squashfs-sysupgrade.bin
lede-ar71xx-mikrotik-root.squashfs
lede-ar71xx-mikrotik-vmlinux.bin
lede-ar71xx-mikrotik-vmlinux.elf
lede-ar71xx-mikrotik-vmlinux-initramfs.bin
lede-ar71xx-mikrotik-vmlinux-initramfs.elf
lede-ar71xx-mikrotik-vmlinux-initramfs.lzma
lede-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf
lede-ar71xx-mikrotik-vmlinux.lzma
lede-ar71xx-mikrotik-vmlinux-lzma.elf
packages
sha256sums

but no lede-ar71xx-mikrotik-default-rootfs.tar.gz file in there

thanks in advance for the support
FMH

P.S.: if i finally got my router up and running with lede i write a complete step by step guide

I hope this can help someone,
leave me a message if there is something to correct.

something is taken from: https://wiki.openwrt.org/toh/mikrotik/rb433

Thanks
FMH

COMPILE FROM SOURCE

sudo apt install build-essential git zlib1g-dev

as non privileged user

cd ~; mkdir lede-project
git clone https://github.com/lede-project/source.git
cd source
make menuconfig

i made only this choiche
--- Target System (Atheros AR7xxx/AR9xxx)
--- Subtarget (Mikrotik devices with NAND/NOR flash)
--- Target Profile (MikroTik RouterBoard (64 MB NAND))

exit and save .config file

make

if something missing check the errors
when everithing is finished

sudo mkdir /tftpboot
sudo cp bin/targets/ar71xx/mikrotik/lede-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf /tftpboot/boot.elf
sudo cp bin/targets/ar71xx/mikrotiklede-ar71xx-mikrotik-nand-64m-squashfs-sysupgrade.bin /tmp/su.bin

NAND INSTALLATION

sudo apt-get install dnsmasq
sudo ip addr add 192.168.6.1/24 dev <LAN_INTERFACE>
echo "interface=<LAN_INTERFACE>" > /etc/dnsmasq.conf
echo "dhcp-range=192.168.6.100,192.168.6.119,12" >> /etc/dnsmasq.conf
echo "dhcp-host=<MAC_ADDRESS>,192.168.6.101" >> /etc/dnsmasq.conf
echo "enable-tftp" >> /etc/dnsmasq.conf
echo "tftp-root=/tftpboot" >> /etc/dnsmasq.conf
echo "dhcp-boot=/tftpboot/boot.elf,boothost,192.168.6.1" >> /etc/dnsmasq.conf
sudo /etc/init.d/dnsmasq restart
sudo apt install minicom

run minicom

minicom

setup the serial port
Ctrl-a-z --> O
Serial port Setup --> A
/dev/ttyUSB0 --> Enter --> Enter
Save setup as dfl --> Exit --> Ctrl-a-z --> X

rerun minicom

minicom

  • Connect to the serial port with a null modem cable (115200, 8N1).
  • Power on Router
  • Press a key shortly after powering the board.
  • Press o to change the boot device
  • Press e to boot from ethernet in the future.
  • Press x to leave setup (-o-e-x is needed only once, the boot method is saved in non-volatile memory)

....after boot press return then:

root@LEDE:/# scp <USERNAME>@192.168.6.1:/tmp/su.bin /tmp
Host '192.168.6.1' is not in the trusted hosts file.
Do you want to continue connecting? y/n) y
<USERNAME>@192.168.6.1's password:
su.bin 100% 3660KB 3.6MB/s 00:01
root@LEDE:/# cd /tmp/
root@LEDE:/tmp# sysupgrade su.bin
Sending KILL to remaining processes ...
Performing system upgrade...
Unlocking kernel ...
Erasing kernel ...
[...]
sysupgrade successful
[...]
reboot: Restarting system

  • Press a key shortly after powering the board.
  • Press o to change the boot device
  • Press n to boot from NAND in the future.
  • Press x to leave setup

if everithing is fine you can see

[...]
Press any key within 2 seconds to enter setup..
loading kernel from nand... OK
setting up elf image... OK
jumping to kernel code
[...]
Please press Enter to activate this console.
[ENTER]
root@LEDE:/# vi /etc/opkg/distfeeds.conf

  • uncomment reboot_luci reboot_packages

root@LEDE:/# opkg update
root@LEDE:/# opkg install luci
root@LEDE:/# exit

ENJOY