NanoPi-2
>>Nanopi series Comparison list
NanoPi-2 development Manual

1. Setup ARM Cross Compiler

1.1 Download and uncompress the ARM Cross Compiler
  1. FriendlyARM has an open source Android package which contains a working cross compiler. You can set it up in the "PATH" variable:
    export PATH=/opt/FriendlyARM/s5p4418/android/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
    arm-eabi-gcc -v
    The “/opt/FriendlyARM/s5p4418/android” is where Android source code package is located.
    When you use this compiler please specify the option "CROSS_COMPILE=arm-eabi-".

2 Build U-Boot from sources

2.1 Download and Build U-Boot
  • Download the U-Boot source code and compile it. Please note the github's branch is s5p4418-nanopi2:
    git clone https://github.com/friendlyarm/uboot_nanopi2.git
    cd uboot_nanopi2
    git checkout s5p4418-nanopi2
    make s5p4418_nanopi2_config
    make CROSS_COMPILE=arm-eabi-
    After your compilation succeeds a u-boot.bin will be generated. If you want to test it please flash it to your installation MicroSD card via fastboot.
    Warning: you cannot update this MicroSD card by commanding "dd". This command which will cause trouble when booting the NanoPi2. 
2.2 Prepare mkimage
  • You need the mkimage utility to compile a U-Boot source code package. Please make sure this utility works well on your host before you start compiling a uImage.
    You can install this utility by either commanding "sudo apt-get install u-boot-tools" or following the commands below:
    cd uboot_nanopi2
    make tools
    mkdir -p /usr/local/sbin && cp -v tools/mkimage /usr/local/sbin

3 Build Linux Kernel

3.1 Download and Build Linux kernel
  • Download Kernel Source Code
    git clone https://github.com/friendlyarm/linux-3.4.y.git
    cd linux-3.4.y
    git checkout s5p4418-nanopi2
    The NanoPi2's kernel source code lies in the "s5p4418-nanopi2" branch.
  • Compile Android Kernel
    make nanopi2_android_defconfig
    touch .scmversion
    make CROSS_COMPILE=arm-eabi- uImage
    
  • Compile Debian Kernel
    make nanopi2_linux_defconfig
    touch .scmversion
    make CROSS_COMPILE=arm-eabi- uImage
    After your compilation succeeds a uImage will be generated in the "arch/arm/boot/" directory.
3.2 Compile Kernel Modules
  • Android contains kernel modules which are in the "/lib/modules" directory in the system section. If you want to add your own modules to the kernel or you changed your kernel configurations you need to recompile these new modules. Compile Original Kernel Modules:
    cd linux-3.4.y
    make CROSS_COMPILE=arm-eabi- modules
    Here we have two new modules and we can compile them by following the commands below:
    cd /opt/FriendlyARM/s5p4418/android
    ./vendor/friendly-arm/build/common/build-modules.sh
    The "/opt/FriendlyARM/s5p4418/android" directory points to the top directory of Android source code. You can get more details by specifying option "-h". After your compilation succeeds new modules will be generated

4 Compile Android

  • Install Cross Compiler
    We recommend installing 64 bit Ubuntu 14.04 on your PC host.
    sudo apt-get install zlib1g-dev:i386
    sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
    sudo apt-get install flex libncurses5-dev zlib1g-dev gawk minicom
    For more details please refer to https://source.android.com/source/initializing.html
  • Download Source Code
    You need to use repo to get the Android source code. Please refer to https://source.android.com/source/downloading.html
    mkdir android && cd android
    repo init -u https://github.com/friendlyarm/android_manifest.git -b nanopi2-kitkat
    repo sync
    The "android" directory is the working directory. To initialize repo you can do "HTTPS clone URL".
  • Compile System Package
    source build/envsetup.sh
    lunch aosp_nanopi2-userdebug
    make -j8
    After your compilation succeeds an image will be generated in the "out/target/product/nanopi2/" directory.

Follow Us: 
| |
Market Mail :
Support Mail:

Work time: 09:00-18:00
Copyright @ 2014 to 2020 - FriendlyARM NanoPi Team