Booting ubuntu from bpi_w2


(gary) #1

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


#2

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.


(gary) #3

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.


(gary) #4

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


(bpi team) #5

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


(gary) #6

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!

(gary) #7

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.


#8

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)


(gary) #9

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


#10

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)


(gary) #11

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

#12

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)