Build a bootable Linux image for your BPI M2

Hi Community of ARM people.

I spent weeks trying to figure out how to build an SD bootable image for my Banana PI A31s, and having searched the vast galaxy of web servers I managed to accomplish my mission.

In part this guide is more focused at assisting with the set up of a compatible toolchain that will allow you to make use of banana-pi.org’s BPI-M2-bsp build scripts

Section 1 Linux Distro Base + Toolchain

  1. Download ubuntu-14.04.3-server-amd64.iso
  2. Install in a 64-bit virtual environment > 4GB RAM and 4CPU
  3. Add this to /etc/apt/sources.list “deb http://us.archive.ubuntu.com/ubuntu precise main universe”
  4. apt-update
  5. apt-get install build-essential libncurses5-dev u-boot-tools qemu-user-static debootstrap git binfmt-support libusb-1.0-0-dev pkg-config lzop libssl-dev lib32stdc++6 libc6:i386
  6. apt-get install gcc-4.6-arm-linux-gnueabi install

***MUST be 6.4 - 4,5, 7 and 8 wont work!

http://radxa.com/Rock/Booting_Linux git clone https://github.com/neo-technologies/rockchip-mkbootimg.git cd rockchip-mkbootimg make make install

=== Compile Distro for A31 BPI-M2 === https://drive.google.com/a/edu.52miku.tk/file/d/0B4l1r4Ltm446MFBvUkwtVU9lcmM/view?pli=1

  1. ./build.sh
  • HDMI Option 2 1080p
  • HDMI Option 1 720p

I really hope this saves a lot of frustration

3 Likes

Hi,

Also you will need to point the build scripts at the 64bit compatible cross-compiler previously installed as the allwinner-tools cross compilers wont work with the Ubuntu 64 bit system. I can only assume that these binaries were build for 32bit OS!

NOTE: I must stress that you MUST install a 64-bit base system. The scripts will only execute on a 64bit base!

cp /usr/bin/arm-linux-gnueabi-gcc-4.6 /usr/bin/arm-linux-gnueabi-gcc

cd /usr/src/BPI-M2-bsp

vi Makefile

Comment CROSS_COMPILE=$(COMPILE_TOOL)/arm-linux-gnueabi-

Add this - CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-

Shift ZZ

I think that’s it. Have fun with your Banana fella’s :smile:

A more simple approach is described here: http://forum.armbian.com/index.php/topic/126-fyi-armbian-running-on-a31s-based-banana-pi-m2/

Hi,

Well I have been playing with the BPI_M2_720P Configuration today and it seems that the following is still broken.

  1. Console re-direction to HDMI

It seems that there is only one specific release of U-Boot that is compatible with the Allwinner 31s as it went end of life, and quite simply it’s not possible to set up a console=tty0 in your env.fex

  1. The “Green” LED that your supposed to be able to control doesn’t seem possible,

root@bananapi:~# ls -la /sys/class/leds/ total 0 drwxr-xr-x 2 root root 0 Jan 1 01:14 . drwxr-xr-x 54 root root 0 Jan 1 01:14 … root@bananapi:~#

Adding this to /etc/inittab allows you to login on /dev/ttyS0

1:2345:respawn:/sbin/getty -L 115200 ttyS0 vt100

I haven’t tested GPIO yet, but I am hopeful that this is at least part working as the [gpio_para] GPIO mappings have already been added to the sys_config.fex file, and seem correct!

Can anybody advise me if it’s possible to fudge U-Boot to console redirect to HDMI /dev/fb0 (framebuffer 0) ?? I have altered the kernel configuration (sun6i_config) to no current avail. Also can somebody also assist with getting the /sys/class/leds to populate with LED’s pretty please?

Support for the A31s is going to be a right pain as quite simply put there isn’t any support for it provided by Allwinner.

Many Thanks

Alan

You won’t get support for the A31/A31s from Allwinner (chip already discontinued) and obviously you won’t get any support from the manufacturer of the M2. :smile:

Relying on the old crappy kernel 3.3 and U-Boot from 2011 is not the best idea. Better go with mainline.

If you want to keep your outdated environment you could have a look here for LED definitions and add them to your sysconfig.fex

1 Like

HI tkaiser: We appreciate your professional explanation. :yum:

HI alantrundle: The image you downloaded is not the latest version of kernel3.3. We’ll soon updated the images including both the latest kernel3.3 and 4.1.6 If you’re really in a hurry, you may as well do the update yourself.


◎If you use kernel3.3: please download and rebuild the latest kernel from here: https://github.com/BPI-SINOVOIP/BPI-M2-bsp

BPI-M2-bsp commit :b39973edc60f5746f34b2a7f8976da57bb208c54

◎If you’d like to use the latest kernel 4.1.6: please see https://github.com/BPI-SINOVOIP/BPI-Mainline-kernel


Use Kernel3.3

Green_LED :PG10 Blue_LED: PG11

Hi,

Please see this link for a good work around

I managed to build an SD bootable image for my Banana PI-M2 using a custom config mainline kernel. Boots to login screen fine all colors of lights on and or blinking What is used for login and password.

I did not use .configure or make just followed instruction set for build of Sd card only

using this kernel

using script build.sh with added line

export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- export KBUILD_OUTPUT=output/bpi mkdir -p $KBUILD_OUTPUT make bpi_defconfig make menuconfig <-------------Added make -j8 dtbs LOADADDR=0x40008000 make -j8 uImage make -j8 modules make -j8 INSTALL_MOD_PATH=out modules_install

and using this u-boot using script bpi-m2.sh

and I used Root File Systems (no kernel): debian-wheezy-7.5-armhf.com-20140603.tar.xz from http://www.armhf.com/download/

At boot on screen I have

Debian GNU/Linux 7 debian-armhf tty1 debian-armhf login

for login i have tried

user root password bananapi

user root password root

user bananapi password bananapi

user pi password bananapi

user bananapi password pi

I also tried it a second time redone SD card and used

./configure Bananapi_M2 and make then followed instruction to setup Sd card At boot on screen I have

Debian GNU/Linux 7 debian-armhf tty1 debian-armhf login

Same results could not login

Thanks in advance Tim