New BP4 - how to log in

Hi,

I have got a macbook and an rj45 cable. I have no way to connect to a serial port.

NAND image on a USB thumb drive,

I do not think Openwrt make a NAND image for the BP4.

Have I got to install the banana pie4 operating system first, then after doing the install, booted off the NAND banana pie operating system, I then install openWRT as usual?

This bit fails:

Failed to find NVMEM device Error: environment not initialized

The SD image cannot be burnt onto the NAND. This is the problem.

I tried these instruction, but these do not make too much sense to me:

> Note: when you want to Update Nand device, Firstly Change boot switch to boot from SD device and insert one SD with SD boot Image, then after boot up,you need flash one nand image into nand device. Finally you change bootstrap to boot from Nand device.

How can I boot from an SD image and then flash a NAND image from it?

I did copy this onto the SD card, and try to boot from it ( I set the dip switches to SD boot ):

dd if=mtk-bpi-r4-NAND-20240620.img of=/dev/disk2 bs=1M

However, I got no response when I tried to connect to 192.168.1.1, and tcpdump gave nothing of interest:

# ifconfig -a|grep 192 
 	inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
^C
# tcpdump -n
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on pktap, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
02:27:49.501276 ARP, Request who-has 192.168.1.1 tell 192.168.1.5, length 28
02:27:50.481209 ARP, Request who-has 192.168.1.1 tell 192.168.1.5, length 28
02:27:51.481584 ARP, Request who-has 192.168.1.1 tell 192.168.1.5, length 28
02:27:52.486450 ARP, Request who-has 192.168.1.1 tell 192.168.1.5, length 28
02:27:53.494631 ARP, Request who-has 192.168.1.1 tell 192.168.1.5, length 28
^C
5 packets captured
5 packets received by filter
0 packets dropped by kernel
^C
#

After this, I burnt the banani pi OpenWrt SD image to the SD card:

# dd if=mtk-bpi-r4-SD-20240620.img of=/dev/disk2 bs=1M
102+1 records in
102+1 records out
107114041 bytes transferred in 70.960671 secs (1509485 bytes/sec)

And then booted from it, which let me login ( screenshot enclosed ).

# ssh 192.168.1.1
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
RSA key fingerprint is SHA256:kG+biTOv38NKesFgl2lobiH96r1rn+7fW2gPn9Tno0E.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.1' (RSA) to the list of known hosts.
BusyBox v1.33.2 (2024-06-05 06:11:29 UTC) built-in shell (ash)
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02-SNAPSHOT, unknown
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~#
mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /tmp/root type tmpfs (rw,noatime,mode=755)
overlayfs:/tmp/root on / type overlay (rw,noatime,lowerdir=/,upperdir=/tmp/root/upper,workdir=/tmp/root/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
pstore on /sys/fs/pstore type pstore (rw,noatime)
mountd(pid6114) on /tmp/run/blockd type autofs (rw,relatime,fd=7,pgrp=1,timeout=21474836510,minproto=5,maxproto=5,indirect)

But I cannot see an option in the BananaPi4 image you linked to that lets me copy an image onto the NAND.

How should I proceed?

like @Radford tells already

download the nand-file and do the steps described in the bpi-wiki

https://wiki.banana-pi.org/Getting_Started_with_BPI-R4#How_to_burn_image_to_onboard_Nand

upstream openwrt is installed in uboot (available through debug-uart) by selecting the right bootmenu entry.

I tried those steps, but these do not make sense, and I read these several times:

"Copy the NAND image onto an SD card and then boot from the NAND and install from the SD card. " Paraphrasing.

How can you boot from a NAND if there’s nothing installed on NAND device? Chicken and egg.

debug-uart: I do not even understand what this is.

They should include a pre-installed O/S on the BananaPi4 devices.

Otherwise, it is a nice looking paper wieght.

You have a 3pin header near sfp wan. There you can connect a usb2uart adapter (ftdi recommended) to which you can connect your pc to the r4 and follow the boot process (with terminal application like putty or minicom) and see where and why it hangs.

When you are able to ssh to the board all necessary works,but if not there are 1000 causes why it does not work :stuck_out_tongue:

Hi,

I think the NAND is probably bad, which is why it cannot boot. But I have to get a router up and running.

So, do you know if this idea will work:

  • Run the O/S off the SD card preconfigured with my configuration.

I could boot from the SD card, let it run read-only, log everything to tmpfs/ram or whatever OpenWRT uses.

I would mount the .img image as read-write on my PC or macbook, and copy the configuration in, then write out a new .img and copy it onto the SD card.

After all, all it have to do is route traffic.

Can anybody think of any gotchas?

Unless of course there are sellers in the EU that seller BananiPi 4’s. Then I could replace this one, because SinoVoip has never replied to any message on AliExpress.

Just checked into this more on the openwrt website, but this impossible to do in my case: ReiserFS is not support on MacOs, and it is unavailable in macports or Brew for Macos 12.
This is a no go.

Back to the drawing board.

You have to boot from sdcard (flashed with sdcard image) first. Then transfer the nand-image to your system to flash it to nand in running system.

Please do not mix bpi image and openwrt 24.10.

Afaik openwrt can only be installed to nand from uboot,so you need a debug uart adapter. Maybe fw_setenv can be used,but it will do things you do not see if they fail. So better invest the 5€.

When this is done you can boot off nand and install to emmc.

Hi,

You have to boot from sdcard (flashed with sdcard image) first. Then transfer the nand-image to your system to flash it to nand in running system.

I do not understand this bit.

The sdcard image, when I boot from it, has not got a nand image on it. It is the sd card image. So, I cannot copy a nand image over.

This is a chicken and egg thing.

I can boot from the sdcard with this image mtk-bpi-r4-SD-20240620.img but it is an SD card image and not a Nand image.

You can run from sdcard and have nand-image on usb drive for example. Or create additional partition on sdcard and put the file there or copy via ssh,or or or…

This makes sense.

I can do this.

Hi,

The instructions on this forum post …

https://wiki.banana-pi.org/Getting_Started_with_BPI-R4#How_to_burn_image_to_onboard_Nand

… tell me to do this:

“3. Plug in USB disk to the board, and mount the USB to /mnt or other directory as follows: (you can skip mounting if it is mounted automatically) * mount -t vfat /dev/sda1 /mnt * change your directory to the mounting point, here is : cd /mnt”

But, this cannot work because /mnt has these devices:

/mnt/mmcblk0p6
/mnt/mtdbblock4

Also, /dev/sda does not exist according to fdisk or df.

The instructions are misleading! Hence the problem I had.

So, I tried to mount the nand img using:

# mkdir /mnt/a
# mount -o loopback /tmp/mtk-bpi-r4-NAND-20240620 /mnt/a mount: mounting /dev/loop0 on /mnt/a failed: Invalid argument

However, why must I do this, when I think I just have got to do this:

  1. Execute following command to erase the whole Nand flash and copy image to nand device:
    • mtd erase /dev/mtd0
    • dd if=mtk-bpi-r4-NAND-20231030.img of=/dev/mtdblock0

Or will step 4. break render the BPR4 bricked? Well, lets find out:

#mtd erase /dev/mtd0
Unlocking /dev/mtd0 …
Erasing /dev/mtd0 …
# dd if=mtk-bpi-r4-NAND-20231030.img of=/dev/mtdblock0
151808+0 records in
151808+0 records in
#

(Cannot edit the above post anymore for some reason)

Finally a miracle.

Booted off the NAND! :slight_smile:

Bpi-wiki/image uses completely different way to flash,boot and so on. You cannot adapt the steps between the images directly.

/mnt is only a dir…when bpi image prepared folder in it just create another and mount to this.

/dev/sda is maybe your usb-stick,so it has to be available to mount /dev/sda1

All working :slight_smile:

Next step is to flash stock BPR4 openwrt image.

1/ Is it best to flash to emmc or nand? My angle is longevity compared to storage . The box will only be used as a router. No storage required.

2/ Can I flash an OpenWrt sysupgrade-compatible image from openwrt.org using the Luci interface used in the BPIR4 NAND?

you cannot install mainline openwrt from the bpi version. you have to follow the mainline openwrt way (sd->nand->emmc via uboot menu-entry) as it is different to bpi-version/wiki

I installed the BPI NAND one. It works.

i’ve read the wiki several times and I just do not understand why we cannot install mainline open WRT onto a working bananaPi.

I mean, this is exactly the way we would do it when I install openWRT onto any of my other routers from TP link, to Ubiquiti EdgeRouter to D-link boxes: Go to the manufacturers’ 192.168.1.1 web page, and install OpenWrt image. Done.

How come we cannot do this on a BananaPi box?

Did they design this box just to make everybodies life difficult?

I am lost for words.

Banana Pi strapline should be: One step forward → Two steps back.

Did I just waste my time installing the banana pie image onto the NAND?

Finally:

sd->nand->emmc via uboot menu-entry) as it is different to bpi-version/wiki

OpenWrt cannot access the NAND: Impossible to do.

This is not possible because of the aforementioned error message.

root@OpenWrt:~# fw_setenv bootcmd “env default bootcmd ; saveenv ; run ubi_init ; bootmenu 6”
Cannot parse config file ‘/etc/fw_env.config’: No such file or directory
Failed to find NVMEM device
Error: environment not initialized

I wrote “install openwrt via uboot”,the fw_setenv was a try to set the default bootmenu entry…maybe i took the wrong one.

Bpi wrt and mainline openwrt have different image/boot structure that are not compatible to each other. Bpi uses old mtk with propritary nmbm layer on nand and mainline openwrt uses ubifs directly on mtd.

Please try selecting the right uboot menuentry after booting mainline openwrt from sdcard via debuguart. Not hassle with the fw_setenv (maybe it is buggy).

I’m no openwrt user/expert,only know basics on how it should work

Hi Frank,

My Apologies. My rant was towards SinoVoip and not you. I do appreciate your help and patience.

I know that have got to buy some hardware to get access to uBoot, but I refuse to buy anything from SinoVoip again.