BPI-M3 BSP Cross Compile teach

thank 陳鈞 share it.we just transfer to english.

BLOG:http://blog.jim60105.com/2016/03/bananapi-m3-cross-compile.html

use system message:

jim@jim-Ubuntu:~$ uname -a
Linux jim-Ubuntu 4.2.0-34-generic #39-Ubuntu SMP Thu Mar 10 22:13:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

1 Compile BPI-M3 BSP

create a dir for BPI-M3 and get source code from gitgub

mkdir bananapi
cd bananapi
git clone https://github.com/BPI-SINOVOIP/BPI-M3-bsp.git
cd BPI-M3-bsp
mkdir -p linux-sunxi/output/lib/firmware

2, run this segment if you use 64 bits platform

the official kit was compiled on 32 bit platform ,so you must support 32bit execution in your 64 bits ubuntu.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386

3,install necessary tools:(skip this if you have executed the two instructions in the segment of the 64 bits)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential u-boot-tools binutils-arm-linux-gnueabihf gcc-4.7-arm-linux-gnueabihf-base g++-4.7-arm-linux-gnueabihf gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi cpp-arm-linux-gnueabihf libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev

4,begin to Compile

for me, i need use LCD on BPI-M3, so i choose is:3

./build.sh

now choose menu:

            BPI-M3 BSP Build Tool         
==========================================

This tool support following BPI board(s):
------------------------------------------
 1. BPI_M3_720P
 2. BPI_M3_1080P
 3. BPI_M3_LCD7
 4. BPI_M3_USB_720P
 5. BPI_M3_USB_1080P
 6. BPI_M3_USB_LCD7
------------------------------------------
Please choose a target(1-6): 3


 Now configuring...

BPI_M3_LCD7 configured. Now run `make`

 Configure success!

please waitting , it need long time to compile,it takes a while and depends on the performance of your computer

Note: if compile success ,will have ../bananapi/BPI-M3-BSP dir.if it does not show up, any other "build success" screen are deceptive.

5 burn image to SD card:

take a new SD card , and install official image to SD card.

official image : http://www.banana-pi.org/download.html

the next step, be sure to choose the correct device.

sudo fdisk -l
 umount /dev/sdf*

clean

sudo fdisk /dev/sdf
p 
d
w
sync

please use "d" clean partition.And then dropped the device completely clear

dd if=/dev/zero of=/dev/sdf bs=4M

buru official image to SD card .please do not Android and Berryboot image.

example: ArchLinux

image name: 015-12-09-ArchLinuxARM-lite-bpi-m3-sd-emmc.img.zip

unzip 2015-12-09-ArchLinuxARM-lite-bpi-m3-sd-emmc.img.zip -d ~
cd ~
sudo dd if=2015-12-09-ArchLinuxARM-lite-bpi-m3-sd-emmc.img of=/dev/sdf bs=4M

waiting still dd finish.

umount /dev/sdf*

check partition

sudo fsck /dev/sdf1
sudo fsck /dev/sdf2

change /dev/sdf2 to ext2,and change size

sudo tune2fs -O ^has_journal /dev/sdf2
sudo e2fsck -f /dev/sdf2

Write the first compiled data: next step will clean partition table, so we must transcribe it at first

go to we just compiled things stored folder

cd ~/bananapi/BPI-M3-bsp/download/BPI_M3_LCD7

all file will such as this below:

Empty memory card 1m before space (and clears the partition table)

sudo dd if=/dev/zero of=/dev/sdf bs=1M count=1

in order to write compiled file

sudo dd if=boot0_sdcard.fex of=/dev/sdf bs=1k seek=8
sudo dd if=u-boot.fex of=/dev/sdf bs=1k seek=19096
sudo dd if=sunxi_mbr.fex of=/dev/sdf bs=1k seek=20480
sudo dd if=boot-resource.fex of=/dev/sdf bs=1k seek=36864
sudo dd if=env.fex of=/dev/sdf bs=1k seek=69632
sudo dd if=boot.fex of=/dev/sdf bs=1k seek=86016

recovery partition table,and increase the capacity to the memory card is the largest,also change to /dev/sdf2.

sudo fdisk /dev/sdf
p
n
p
1
204800
729087
t
c
n
p
2
729088
# here just "enter",default will get max size 
w
sync
sudo fsck /dev/sdf1
sudo fsck /dev/sdf2
sudo resize2fs /dev/sdf2
sudo tune2fs -j /dev/sdf2
sudo e2fsck -f /dev/sdf2

all is finish. just use this SD card to boot your banana pi.

Last updated