Booting ubuntu from bpi_w2

I have be playing around with this board for some time now. I got the serial port to work somewhat under Linux, can +q to get to the ymodem to try and load the 2 required file for booting (At least thats what I can parse from the docs): RTD1296_hwsetting_BOOT_4DDR4_4Gb_s1866_padding.bin dvrboot.exe.bin When I try the ymodem it never really completes, hang minicom util.

I was able to build the sdcard as doc’ed, but I think the above flash has to be done, no? Any help would be great and appreciated. Otherwise I may try sending it back. Waste of $100.

Doc is pretty confusing to my know how… Gary

seeing as kernel 4.9 can boot from SD alone I guess it might be possible to leave drvboot.exe.bin out.

Not sure about hwsetting.

I would try getting XP VM and use hypertrm (not sure if it would work under wine … worth a shot before deploying virtualbox / kvm / whatever)

I have tried with minicom on ubuntu machine when TeraTerm (hypertrm alternative on win7) failed. I ended up downloading hypertrm and corresponding .dll file to run it under win7 - minicom failed same way as TeraTerm …

Hypertrm worked 1st try.

Am headed in that directions…I have a version of windows I can install. Will dual boot my machine with w7 and linux and give it a try.

BTW I tried building the sdcard with opensuse and mint - both were missing the static compiled /usr/bin/qemu-aarch64-static .

Then I tried Fedora distro and everything except minicom (flashing failed) worked. Just for the record. I appreciate your post. I really don’t like windows but I’ll give a try with hypertrm.

thanks.

Is there anyone out there that has gotten a linux distro with hypertrm like software to work flashing the emmc or spi chips? I’m having a ton of trouble getting a laptop that came with win8 to reinstall windows.

Can see why minicom wouldn’t work.

thanks for any help, Gary

http://wiki.banana-pi.org/Getting_Started_with_BPI-W2

this writeup makes sense and is clear from - "Ubuntu How to make and run the 64-bit ubuntu 16.04 on SD card 2018-4… … "

  • I was able to build the sdcard, BUT what’s ambiguous is the first section that has you tftp’ing. Its unclear whether I need to do that at al if I want the a bootable Ubuntu. If I do get this all to work I’ll write up what I did and post what I think is clear and straight forward. Sorry, but I feel I’ve spent a lot of time on getting a linux distro to boot. I have no need for an Android or Openwrt for this hardware. Thanks much for responding!

I did download win-10 and will add hypertrm and try. It would be great if the loaders could just discover the sd card and boot it. Of coarse I’m probably guilty of disliking microsoft and not having a copy I can use, VMwise or DualBoot.

I’ll also try 4.9, without flashing and see if it works.

I’m now committed to writing steps that work for this board for me, I’ll hope others can use.

4.9 boots fine with sw4 on position 1. uImage + bluecore + dtb should be not in root of p1 but in full tree available in .tgz (bananapi/xxxx/yyy - forgot exactly where)

In my setup I ended up having set for kernel 4.4 in root of SD p1 and 4.9 in that full path. With uboot provided in Ubuntu package flashed to emmc (sw4 on 0 boots from root of SD) and new uboot from 4.9 commit flashed on SD card (sw4 on 1 boots SD card as described above)

Are you saying if I build the sdcard with 4.9 of Ubuntu and the sw4 in 1 position the board will boot Ubuntu? Gary

This is how I got it working.

I flashed full package as described in guide to get Ubuntu (package linked in guide is 4.4) and from there it was sw4 on 0 to use.

Installed bpi-tools found on GitHub. When kernel 4.9 showed up on GitHub I did bpi-update -c bpi-w2.conf

Tool downloaded whole commit and unpacked it wherever needed. At that point I thought directory structure on SD p1 was mistake and I moved files to root of p1 - no boot at all. Put 4.4 in root of SD p1 and try again. There is another tool bpi-bootselect or sth. Used it with uboot file found in bpi-w2.conf and new uboot got flashed to SD.

From now on - sw4 1 boots with that new uboot on SD (kernel 4.9)

okay, woohoo! got it to boot, hear are all 24 steps (many copied from bpi docs) includes the creation of a win10 system with hypertrm:

  • ---------------------------------------------------------------*
  • Create a Ubuntu bootable bpi_w2 soc
  • ---------------------------------------------------------------*
  • On Linux: create WIN10 installer on USB drive and add hypertrm *
  • (could not get minicom on linux to work, use 1970s hypertrm)
  1. download windows 10 iso image from MS site.
  2. sudo apt install extlinux
  3. mkdir ~/bin/
  4. cd ~/bin/
  5. curl -L https://git.io/bootiso -O
  6. chmod +x bootiso
  7. (To list your usb pen drive run) ~/bin/bootiso -l
  8. (To write create a bootable Windows 10 USB from an ~/bin/bootiso -p ~/Downloads/{imageName}.iso ~/bin/bootiso ~/Downloads/{imageName}.iso
  9. install win10 and add hypertrm.exe and hypertrm.dll (hypertrm available on older xp, win7 or off web)
  10. get needed files to flash bpi_w2/flashing process:
    • sw2 switch in 0 position.

    • https://drive.google.com/file/d/1LX4FwXcSzkuI4BUPEVxbUyeG_UYwIkwY/view?usp=sharing

    • Setup windows PC runs serial terminal tool like hypertrm (see 1…9).

    • Connect the serial port between the host and the board correctly using Debug Uart pins, relevant parameters (115200, 8N1, none - I think this means non hardware control),

    • press “ctrl+q” then to power on the board, and when this screen appears ’ d/g/r ', it can be released.

    • Input “h” and send hardware configuration binary files (RTD1296_hwsetting_BOOT_4DDR4_4Gb_s1866_padding.bin) in Y-modem mode on the terminal side.

    • Wait for the transfer to complete, then input below in console: s98007058 01500000

    • Input “d” and send u-boot binary files (dvrboot.exe.bin) in Y-modem mode on the terminal side.

    • Wait for the transmission to complete. Enter “g” then the

      u-boot will be programmed to the EMMC automatically.

  • create ubuntu on sdcard w/Fedora desktop **
  1. (download arm64 base of ubuntu, 16.04.5 works) wget http://someURL/ubuntu-base-{some nn.nn.n}-arm64.tar.gz
  2. mkdir rootfs && tar zxvf ubuntu-base-{some nn.nn.n}-arm64.tar.gz -C rootfs/
  3. vi ch-mount.sh and save below script for mounting ubuntu in chroot. #!/bin/bash function mnt() { echo “MOUNTING” sudo mount -t proc /proc ${2}proc sudo mount -t sysfs /sys ${2}sys sudo mount -o bind /dev ${2}dev sudo mount -o bind /dev/pts ${2}dev/pts sudo chroot ${2} } function umnt() { echo “UNMOUNTING” sudo umount ${2}proc sudo umount ${2}sys sudo umount ${2}dev/pts sudo umount ${2}dev } if [ “$1” == “-m” ] && [ -n “$2” ] ; then mnt $1 $2 elif [ “$1” == “-u” ] && [ -n “$2” ]; then umnt $1 $2 else echo “” echo “Either 1’st, 2’nd or both parameters were missing” echo “” echo “1’st parameter can be one of these: -m(mount) OR -u(umount)” echo “2’nd parameter is the full path of rootfs directory(with trailing ‘/’)” echo “” echo “For example: ch-mount -m /media/sdcard/” 29,1 Top echo “For example: ch-mount -m /media/sdcard/” echo “” echo 1st parameter : ${1} echo 2nd parameter : ${2} fi
  4. chmod 755 ch-mount.sh
  5. dnf install qemu-user-static (if using fedora desktop)
  6. cp /usr/bin/qemu-aarch64-static rootfs/usr/bin
  7. cp -b /etc/resolv.conf rootfs/etc/
  8. ./ch-mount.sh -m rootfs/
  9. passwd root (change root password) apt-get install iputils-ping udev nettools
  10. ./ch-mount.sh -u rootfs/
  11. Using fdisk tool to create two partitions in SD card: format the first partition as FAT32 (no less then 100M), and the second partition as ext4. (mark 1st partition as bootable)
  12. Copy the three files: bpi-w2.dtb, uImage, bluecore.audio to the first partition.
  13. Copy the all files in root filesystem which just built by us to the second partition using root privilege: cp -a rootfs/* /media/xxx/sdxx/ sync
  14. Eject the SD card and insert it to the W2 board, on your own now

now head over here: https://github.com/BPI-SINOVOIP/bpi-tools All needed from there is:

Run this:

curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash -

on your board.

When tools are installed you can just use them for pretty straight forward updates. 1st one (when booted via sw4 on 0) to point to SD card for operations (mmcblk0 is internal at this point):

bpi-update -c bpi-w2.conf -d mmcblk1

this will get config file and all files mentioned there, unpack files for p1, set kernel modules on p2 …

then you can just run this:

bpi-bootsel

it will list uboot images available on your board and how to use it. For some reason -c [conffile] was not working for me but it was fine when triggered manually (make sure this path is there after initial run of the command:

bpi-bootsel /usr/lib/u-boot/bananapi/BPI-W2-720P-2k.img.gz /dev/mmcblk1

Power off the board, switch sw4 to 1 and boot up again. It will boot from SD with kernel 4.9.

From quick glance at tools code it looks like you will need to remove bpi-w2.conf for next release (it checks if the file is there before trying to download fresh one from github)

When booted with sw4 on 1 your SD card is mmcblk0 so that part can be left out when invoking same stuff again (mmcblk0 is default target)

Am I right in saying that the - bpi-update -c bpi-w2.conf -d mmcblk1

  • will update the sdcard partition 1 (vfat) and partition 2 (ext4), then the bpi-bootsel set the img to boot from?

Sorry, it still confuses me that I need to install to flash (emmc) a boot loader and a kernel and then install a bootloader and kernel on sdcard. Guess there are 2 levels of bootloading.

That post was before last SPI ROM update. In the event you have booted from emmc (sw4 0) you need to specify -d mmcblk1 as target (SD) and then switch to sw4 1 (update files downloaded in the process were prepared to boot from SD)

If I remember it right there was some trick in bootloader on emmc to just do 1st step in there and then continue from SD (even with sw4 on 0 you needed sd card inserted to boot)

If you already have SPI rom updated and newest image flashed to SD that whole process is not required. sw4 on 1 boots from SPI + SD as it was designed.

Kamil, thanks for responding…A few questions:

(1) How do I know if I have the SPI ROM update?

  • I did do the cntl+q flashing of dvrboot.exe.bin and RTD1296_hwsetting_BOOT_4DDR4_4Gb_s1866_padding.bin
  • is the SPI-ROM upgraded in doing that?

(2) when the board switch sw4 is set to 1, that mean the bootloader is where?

  • SPI ROM?
  • or the board pulls/boot from SDdisk only?

I haven’t found a good/clear explanation of the bootloading steps. My first banana board and been quite a struggle.

There is new thread with Ubuntu 18.04 image and there is guide how to upgrade SPI ROM.

If I remember right sw4 0 is supposed to be emmc only (bootloader and system root) and sw4 1 supposed to boot with SPI + SD.

Guide for Ubuntu 16.04 mentioned flashing uboot to emmc - that uboot was designed to boot from emmc but look for system root in SD (so you were in fact in the middle between sw4 0 and sw4 1 while having sw4 on 0)

Get etcher and flash the images to your sd with etcher. It is literally that simple. I thought I wasted 200$ on two boards until I downloaded etcher and flashed the sd card with any of the images available and set my sw4 to 0 and bam live Linux OS’s. Don’t give up on it man. It’s a good board but these programmers can’t write instructions worth a damned

Your instructions aren’t worth a damned. Etcher is the way to go…not your stupid spi-ROM which damned near made it impossible to get it working again.

Thanks…but I did give up. Its a nice board, I agree, but the doc on setting it up was pretty confusing. I did get it to install iptables, but never got the hdmi interface to work.

When I stepped back and thought about what I wanted the board for - as a internet facing router - I thought it was risky if I don’t have a good updating path on the kernel and software. I played with the board for about a month.

Sold the board on Amazon - 30$ loss - never got a response from the Chinese website I bought it on. If BPI get there infra-structure cleaned up I’d reconsider.

Not my instructions - I am user as you, not affiliated with devs here. There was one topic here saying factory SPI rom have some bugs and it might not boot SD card with sw4 on 1 (the only setting SPI rom is actually in use). Someone had to power cycle board few times to finally complete boot process - it was freezing in the middle. They made workaround (as in guide for Ubuntu 16.04) - flash specially cooked uboot on emmc (used when sw4 on 0) to look for kernel and root fs on SD card. Without that workaround sw4 on 0 is full system load on emmc - no matter if you have SD plugged or not. Now I am not sure about uboot in guide for 18.04 (if there is any designed for emmc) but if your board boots SD while sw4 is on 0 that is workaround in place. I am glad it is working for you, but it is not 100% sure it will work for others. Always worth a shot though.