Graperain G3128 User manual

G3128
Single Board Computer
Development Manual
Shenzhen Graperain Technology Co., Ltd.
www.graperain.com/

Copyright Statement
Copyrights of this manual belong to Shenzhen Graperain Technology Co., Ltd. and all rights
are reserved. Any companies or individuals are not allowed to extract part or all of this
manual, and violators will be prosecuted under law.
Attention:
The manuals of development platform on sell will be updated from time to time, please
download the latest manual from website www.graperain.com or contact our company sales
representative, there would be no further notice.

Release Notes
Version
Release Date
Author
Description
Rev.01
2018-8-20
David
Revision

Technical Support
Any questions about the manuals, you can call our landline or email us.
Website: http://www.graperain.com
Landline:+86 755 23025312
E-mail: support[email protected]
Sales and Service Network
Shenzhen Graperain Technology Co., Ltd.
Website: http://www.graperain.com
Landline: +86 755 23025312
E-mail: [email protected]
Address: Building A, Huafeng Tech. & Innov. Park Baoan Wisdom Valley, Xixiang, Baoan
Dist.Shenzhen, Guangdong. Post code 518101.

5
Catalogue
Copyright Statement.....................................................................................................2
Chapter 1 Setting up Android Platform Development Environment............................. 7
1.1 Install Ubuntu OS by U-disk............................................................................................... 7
1.2 Install Dependent Package of Android Source Code....................................................... 8
1.3 Install Cross-complier Tool.............................................................................................. 10
1.4 Specify GCC Cross-complier............................................................................................. 10
Chapter2 Compiling Android Source Code Package................................................... 12
2.1 Install Android Source Code Package.............................................................................. 12
2.2 Analysis Compiled Script.................................................................................................. 12
2.3 Compiling Source Code..................................................................................................... 13
2.3.1 Checking Compiling Assistance.............................................................................13
2.3.2 Compiling Uboot.....................................................................................................13
2.3.3 Compiling Kernel....................................................................................................13
2.3.4 Compiling Android File System.............................................................................13
2.4 Configurating Kernel......................................................................................................... 13
Chapter 3 Compiling Linux QT Source Code..............................................................15
3.1 Install Linux Source Code Package.................................................................................. 15
3.2 Compiling Script Analysis................................................................................................. 15
3.3 Compiling Source Code..................................................................................................... 15
3.3.1 Check compiling assistant out...............................................................................15
3.3.2 Compiling Uboot.....................................................................................................16
3.3.3 Compiling Kernel....................................................................................................16
3.3.4 Compiling Linux File System................................................................................. 16
3.3.5 Generate System Update Package.........................................................................16
3.4 Configurating Kernel......................................................................................................... 16
3.5 Configuration File System.................................................................................................17
Chapter 4 Programming Android Image Files..........................................................18
4.1 Upgrade Firmware in Ubuntu Environment...................................................................18
4.2 Upgrade Firmware in Windows....................................................................................... 18
4.2.1 Install RK USB Drive...............................................................................................18
4.2.2 Connect Device....................................................................................................... 19
4.2.3 Take AndroidTool to Upgrade Firmware..............................................................21
4.3 Update Firmware by TF Card When Off-line...................................................................22
Chapter 5 Programme Linux-qt Image File.............................................................. 26
5.1 Update Firmware in Ubuntu Environment..................................................................... 26
5.2 Update Firmware in Windows Environment..................................................................26
5.2.1 Install RK USB Drive...............................................................................................26

6
5.2.2 Connect Device....................................................................................................... 27
5.2.3 Take AndroidTool Update Firmware.................................................................... 28
5.3 Update Firmware When Off-line............................................................................31
Chapter 6 Product Portfolio....................................................................................... 34
6.1 System on Module Series...........................................................................................34
6.2 Development Board Series........................................................................................ 34
6.3 Single Board Computer (SBC) Series........................................................................34

7
Chapter 1 Setting up Android Platform Development Environment
Please install Linux operating system in PC which could fully play PC performance as
compiling Android source could ask for high requirements in PC hardware. We use
Ubuntu14.04 64bit system in this chapter. Please keep the same as our version.
1.1 Install Ubuntu OS by U-disk
Tool:
One U-disk bigger than 2GB
Software: Linuxlive usb creater, Download link:http://www.linuxliveusb.com/
Operating System:
Ubuntu14.04, Download link:http://www.ubuntu.com/download/desktop/
Installation Method:
Step1: Download Ubuntu ISO file and linuxlive usb creater, and done installation.
Step2: Insert U-disk, and open usb creater file, and done setting as hints, at first, please take
installation and tell U-disk, second, find downloaded file ubuntu image file, third default, and
check hide files and FAT32 format U-disk, last click lightning icon and done installation.-

8
Step3: Re-start computer, and enter into BIOS setting menu, and take U-disk launch.
Generally, the desktop computer press DEL key, and notebook computer F2, or F10 enter into
BIOS. Done setting, save and quit.
Step4: Re-start it one more time, and Ubuntu installation interface will be, please check your
language and go on;
Step5: Check install, and go on;
Step6: Check your language, and go on;
Step7: Netconfig, installation or not both ok, or installation it after system done;
Step8: Check something else, and Go on; separate two zones for Ubuntu, “一个 /”and”一
个/home”.Zones can be re-buit or format. It depends on requirements.
Step9: Setup area, take yours;
Step10: Select Keyboard;
Step11: Login user name and password, and done setup. Go on and install it directly. Restart
when done installation, and enter into Ubuntu operating system.
1.2 Install Dependent Package of Android Source Code
Dependent software package and 64bit System patches:

9
GIT
JDK 8
JDK 7
git-core,gnupg,flex,bison,gperf,libsdl-dev,libesd0-dev,libwxgtk2.6-dev,
libwxgtk2.8-dev,build-essential,zip,curl,libncurses5-dev,zlib1g-dev,libxml2-utils,
genromfs,lsb-core,libc6-dev-i386,g++-multilib,lib32z1-dev,lib32ncurses5-dev,
u-boot-tools,
android-tools-fastboot,Texinfo,lib32readline-gplv2-dev,gcc-multilib,libswitch-perl,
gcc-arm-linux-gnueabihf
All software package needed:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev
libwxgtk2.6-dev libwxgtk2.8-dev build-essential zip curl libncurses5-dev zlib1g-dev
libxml2-utils genromfs lsb-core libc6-dev-i386 g++-multilib lib32z1-dev lib32ncurses5-dev
u-boot-tools android-tools-fastboot Texinfo lib32readline-gplv2-dev
gcc-multilib,libswitch-perl gcc-arm-linux-gnueabihf
Install aboving software packages one by one, and then failing ones will be found.
Install manually JDK8:
Step details in Ubuntu os:
Step1: Execute following order:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Step2: Re-start the system
Check Java version:

10
root@david:/usr/lib/jvm# java -version
Till now, done JDK8 installation.
Install manually DK7:
Install manually jdk1.7 in Ubuntu:
Step1: Execute following order:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-set-default
Step2: Re-start the system
Step3: Check Java version:
root@david:/usr/lib/jvm# java -version
Till now, done jdk7 installation.
1.3 Install Cross-complier Tool
The cross-complier tool has been integrated into source code package yet, no need manual
installation. Its path:(Android source code)
prebuilts/gcc/linux-x86/arm
1.4 Specify GCC Cross-complier
When install latest GCC cross-complier in Ubuntu system, the version is exceed 4.4. Check GG
version with the following command:
gcc –version
Maybe shows following information:
david@ubuntu-server:~$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.8.3
Copyright ©2011 Free Software Foundation, Inc.
Above information shows version is 4.8, it will be error hint. That caused by new GCC version
error, you could find solution in internet. If you do not want to modify those error, just
downgrading your version into 4.4 will be ok.

11
Solution:
Install 4.4 version
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib
Done installation, and downgrading version gcc
cd /usr/bin
sudo mv gcc gcc.bk
sudo ln -s gcc-4.4 gcc
sudo mv g++ g++.bk
sudo ln -s g++-4.4 g++
Check version and done downgrading:
david@david-work:~$ gcc -version
gcc: unrecognized option '-version'
gcc: no input files
david@david-work:~$ gcc --version
gcc (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.

12
Chapter2 Compiling Android Source Code Package
G3128 single board computer is of eMMC memory as fault.
State: Take ordinary permissions when compiling image. Done compiling, following images
happen: uboot.img,kernel.img,resource.img,boot.img,recovery.img,misc.img,
system.img,update.img。
uboot.img: bootloader, which used to guide kernel
kernel.img:kernal image
resource.img: source files image
system.img: android file system image
update.img: all android system upgrading, which includes all images compiled
2.1 Install Android Source Code Package
Copy Android 5.1 source code package from cloud storage into user catalogue.
Notice: do not save this file into root catalogue of system file, if you do, there will be
administration authority problem.
For example: Do following command in user’s authority:
cp yourcdromdir/source/g3128-android-v51-xxx.tar.bz2 ~/
cd
tar -xjvf g3128-android-v51-xxx.tar.bz2
Now all Android file saved in the extracted directory. Till here all Android source code package
installation done well.
State: Source code names could be different as its data issued, subject to cloud storage.
2.2 Analysis Compiled Script
State: Kinds of source code version is different but principle same. And its script details subject
to its relevant source code package, here it used to be analysis realizing mechanism.

13
2.3 Compiling Source Code
2.3.1 Checking Compiling Assistance
Do following command to checking usage of mk script
./mk.sh –h
2.3.2 Compiling Uboot
Do following command and compiling uboot. Save uboot.img file into out/release catalogue
when compiling done.
./mk.sh -u -j=4
2.3.3 Compiling Kernel
Do following command to compiling Android kernel in Android source code catalogue:
./mk.sh -k -j=4
Done compiling, new image happens: kernel.img and resource.img, save them into out/release
2.3.4 Compiling Android File System
First, check “out catalogue”in Android root catalogue. Cancel full out cataluge at the first
compiling, and take following command as following to compiling Android image files :
./mk.sh -s -j=4
Done compiling and save images into out/release, which includes: system.img,boot.img,
misc.img,recovery.img., parameter.txt, and all system firmware package update.img.
2.4 Configurating Kernel
Kernel configuration file:kernel/arch/arm/configs/g3128_defconfig, and its steps are:
1) cp kernel/arch/arm/configs/g3128_defconfig kernel/.config (copy it)

14
2) make menuconfig ARCH=arm (Manual configuration, and save it.)
3) cp kernel/.config kernel/arch/arm/configs/g3128_defconfig (Updating
configuration files.)
4) ./mk.sh -k (Compiling kernel one more time.)

15
Chapter 3 Compiling Linux QT Source Code
G3128 single board computer is of standard eMMC.
State: Take ordinary permissions when compiling image. Done compiling, following
images will be happend: uboot.img,kernel.img,resource.img,linux_system.img,
update_linux.img。
uboot.img: bootloader, which used to be guide kernel.
kernel.img: which is kernel image.
resource.img: which is source files image.
linux_system.img: which is file system image.
update_linux.img: which includes all Linux qt system updating images.
3.1 Install Linux Source Code Package
Copy Linux QT source code package into user catalogue. Notice not save into root catalogue,
or administrative authority issue happens:
For example: Do following command in user’authority:
cp yourcdromdir/source/g3128-linux-xxx.tar.bz2 ~/
cd
tar -xjvf g3128-linux-xxx.tar.bz2
Save all Linux files system into current zip catalogue. And till now, Linux source
code package installation done.
State: The name of source code package maybe different name as date, please
reference its real name in disk.
3.2 Compiling Script Analysis
State: Different version source code script are different, but principle same.
3.3 Compiling Source Code
3.3.1 Check compiling assistant out.

16
Do following command to check mk script details out:
./mk.sh –h
3.3.2 Compiling Uboot
Do following command to compiling uboot in Linux source code catalogue and then save the
image uboog.img into out/release:
./mk.sh -u -j=4
3.3.3 Compiling Kernel
Do following command to compiling kernel in Linux source code catalogue:
./mk.sh -k -j=4
Done compiling and save all images kernel.img and resource.img into out/release.
3.3.4 Compiling Linux File System
Do following command to compiling Linux file system in Linux source code catalogue:
./mk.sh -r -j=4
Done compiling and save image linux_system.img into out/release.
3.3.5 Generate System Update Package
Do following command to generate system update package in Linux source code catalogue:
./mk.sh -l -j=4
Done compiling and save image update_linux.img into out/release.
3.4 Configurating Kernel
All configuration files saved in kernel/arch/arm/configs/g3128_defconfig, and configuration
steps as following;
1) cp kernel/arch/arm/configs/g3128_defconfig kernel/.config (copy files)

17
2) make menuconfig ARCH=arm (Manual configuration and save it when done
configuration)
3) cp kernel/.config kernel/arch/arm/configs/g3128_defconfig (Update
configuration files)
4) ./mk.sh -k (Compiling kernel again)
3.5 Configuration File System
The name of configuration file is rootfs/buildroot/configs/rk3128_rootfs_defconfig,and
configuration process is:
1) cp configs/rk3128_rootfs_defconfig .config (Copy it)
2) make menuconfig (Manual configuration in rootfs/buildroot, and save it after
done.)
3) cp .config configs/rk3128_rootfs_defconfig (Update configuration files)
4) ./mk.sh -r (Compiling it again in Linux source code catalogue)

18
Chapter 4 Programming Android Image Files
4.1 Upgrade Firmware in Ubuntu Environment
In Ubuntu Environment to upgrade firmware.
Preparation:
Insert power charger with G3128 single board computer, and connect OTG cable with PC,
and connect serial cable with PC, and open serial terminal and command terminal;
Power on, and press Update key, meanwhile press Reset key, and upgrade automatically.
Then, take following operation in PC command line:
sudo ./upgrade_tool uf update.img (Upgrade full Android upgrade image)
Or upgrade them separately: uboot,kernel and resource firmware files:
sudo ./upgrade_tool di uboot uboot.img
sudo ./upgrade_tool di -k kernel.img
sudo ./upgrade_tool di resource resource.img
sudo ./upgrade_tool di -b boot.img
sudo ./upgrade_tool di -r recovery.img
sudo ./upgrade_tool di -m misc.img
sudo ./upgrade_tool di -p paramater.txt
sudo ./upgrade_tool di -s system.img
Comment:
All images and download tool are in out/release.
4.2 Upgrade Firmware in Windows
4.2.1 Install RK USB Drive
Steps:
Step1, Run DriverAssitant_v4.4 in DriverInstall.exe, and done installation;

19
Notice:
1)Support xp,win7_32,win7_64,win8_32,win8_64 OS.
2)Done installation of XP OS, still hint find new device, please take automount “自动安装”
3)Click quit drive and install drive then if old drive version found before installation.
4.2.2 Connect Device
Run AnroidTool.exe tool in AndroidTool, and find following interface:
1)When eMMC have not programmed any firmware before.

20
Press Update key, and connect G3128 single board computer with PC through OTG cable.
Done connection, take off Update key will be ok. And the board will enter into MASKROM,
and waiting for programming to upgrade.
2)When the G3128 single board computer have been programmed firmware before:
Power the board, and connect the board with PC through OTC, press Update key, and
meanwhile press Reset key, re-start the board, take off Update key will be ok. And then the
board will enter into LOADER, and waiting for upgrading. And its interfaces like following
picture:
Table of contents
Other Graperain Motherboard manuals