BPI-W2 new image : How to make and run the 64-bit ubuntu 16.04 on SD card 2018-4-28

How to make and run the 64-bit ubuntu on SD card for Banana Pi W2

1.Requirement:

  1. A PC with ubuntu as the host;

  2. A banana Pi W2 board;

  3. A SD card;

  4. Downloaded latest ubuntu base tar file (ubuntu-base-16.04.4-base-arm64.tar.gz) from url: Ubuntu Base 16.04.6 LTS (Xenial Xerus)

  5. Hardware configuration file, u-boot binary file, kernel image file and audio file, which can be downloaded from: w2 release for ubuntu.zip - Google Drive

    1. oRTD1296_hwsetting_BOOT_4DDR4_4Gb_s1866_padding.bin – hardware config
    2. odvrboot.exe.bin – u-boot binary
    3. ouImage – kernel image
    4. obluecore.audio – audio and video firmware for RTK1296

2.Write the bootloader to the Banana Pi W2 flash:

Banana Pi W2 board can boot from EMMC flash or SPI flash on the board, the difference is the location of the bootloader, so if you will not participate in the development of u-boot, this will not matter to you. So here is how to write bootloader to EMMC.

Normally the W2 board you got had been programed in the factory, but if the version of the bootloader isn’t the latest one, I recommend you to program it by yourself again. The latest version of bootloader is available on the Banana Pi website.

Requirement:

  1. A windows PC runs serial terminal tool like hypertrm. (I recommend using “hypertrm”, because other tools sometimes fail to transmit data);
  2. Latest version u-boot binary file from Banana Pi website (dvrboot.exe.bin);
  3. A hardware configuration binary file for W2 (RTD1296_hwsetting_BOOT_4DDR4_4Gb_s1866_padding.bin);

Steps:

  1. Connect the serial port between the host and the board correctly, run the terminal software and set up the relevant parameters (115200, 8N1, none);

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

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

  4. Wait for the transfer to complete, then input below in console:

    s98007058

    01500000

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

  6. Wait for the transmission to complete. Enter “g” then the u-boot will be programed to the EMMC automatically.

3.Make a ubuntu root file system for W2 on a ubuntu PC.

Ubuntu has the version for arm64 architecture, it’s suitable for the Banana Pi W2, most of packages built by ubuntu for arm64 can run on the W2 board.

Requirement:

  1. A PC runs linux (recommend ubuntu)
  2. The latest version of ubuntu tar file for arm64 (ubuntu-base-16.04.4-base-arm64.tar.gz) is downloaded from ubuntu website: Ubuntu Base 16.04.6 LTS (Xenial Xerus)

Steps: (on the host):

  1. mkdir rootfs

  2. su root

  3. tar zxvf ubuntu-base-16.04.4-base-arm64.tar.gz -C rootfs

  4. write a shell script file, please copy below contents to the file ch-mount.sh (vi ch-mount.sh and copy):

    !/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/"
         echo ""
         echo 1st parameter : ${1}
         echo 2nd parameter : ${2}
     fi
    
  5. apt-get install qemu-user-static

  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. apt-get install iputils-ping

  10. apt-get install udev

  11. apt-get install net-tools

  12. Modify the root password by running: “passwd root”

  13. exit

  14. ./ch-mount.sh -u rootfs/

Until now, the ubuntu file system have been built successfully on the host, next we will write it to the SD card.

4.Write the system to the SD card (on the host):

Requirement:

  1. A SD card;
  2. Device tree binary file downloaded from Banana Pi website: bpi-w2.dtb;
  3. Kernel image file downloaded from Banana Pi website: uImage;
  4. Video and Audio firmware file downloaded from Banana Pi website: bluecore.audio;

Steps:

  1. Using fdisk tool to create two partitions in SD card: format the first partition as FAT32, and the second partition as ext4; It’s recommended that the first partition size should not be less than 100M;

  2. Copy the three files: bpi-w2.dtb, uImage, bluecore.audio to the first partition;

  3. 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

  4. Eject the SD card and insert it to the W2 board, after power on the board, you can see the ubuntu is running now.

  5. Set up network and get packages by using apt-get from ubuntu repository

Steps:

  1. Log in with root and the password was set by yourself;
  2. Ifconfig eth0 or eth1: ifconfig eth1 192.168.2.231
  3. Add default gateway to let the board can reach internet: route add default gw 192.168.2.1
  4. Add a DNS: echo ‘nameserver 8.8.8.8’ >> /etc/resolv.conf
  5. apt-get update
  6. then you can fetch and install any packages from ubuntu by using apt-get.

6.Furthermore:

Some functions are not available on the W2 now, because the kernel is not fully functional, we are working hard to make it more and more complete, please follow our official website update.

PDF documents:

How to make and run a ubuntu root filesystem on SD card for Banana Pi W2.pdf (174.3 KB)

Thank you for these instructions. I was able to create the SD card in section 3, but can you please elaborate on the first step of Section 2, Updating the Bootloader, where you state “Connect the serial port between the host and the board correctly”. Specifically, what type of cable and where should it connect to the Windows PC and to the BPI-W2 board? Thanks!

Update: I purchased a USB to UART cable and successfully followed all the instructions in Section 2. When I restart the BPI-W2 board with the micro SD card inserted, It displays a green screen and nothing more, even after more than 15 minutes. If I power off the BPI-W2, remove the SD card and power back on, I get a black screen; it no longer boots the Android O/S installed on the board. I would appreciate any suggestions on how to troubleshoot this issue.

Note: the keyboard responds to CTRL-ALT-DEL, but the screen simply goes dark, then redisplays all green.

I’ve re-connected my BPI-W2 board to a Putty serial connection on my PC via the USB-UART cable. When I power up with the SD card inserted, I can log in as root to a terminal session of Ubuntu 16.04.4 LTS (GNU/Linux 4.4.18-ning aarch64) via the Putty client on my PC. If I try the same with the SD card removed, the process ends before giving me any sort of Android session. I’ve uploaded the session output from each, in case anyone can identify either why the Android boot hangs, or why the Ubuntu session, when started without the UART cable and an HDMI monitor plugged in, stops with just a solid green screen displayed. For the Ubuntu session, dmesg continually displays the following issues, suggesting there is some problem with the graphics driver:

[ 702.436077] I/DC: [dc_wait_vsync_timeout 884] wait vsync timeout! vo_vsync_flag:0x00000101

BootWithoutSDCard.txt (64.7 KB) BootWithSDCard.txt (69.7 KB)

Will NTFS-3G and fuse be supported?

I think you you describe very important matter,because many time when i try to run my website Condolence message in 64 bit ubuntu on SD card,each time I failed badly.That is why I am searching for some answer which solved my problem.After searching many website i think now I find the best solution which I want to need.Thanks a ton.