NanoPi
    >>Nanopi series Comparison list
NanoPi development Manual

1. Setup ARM Cross Compiler

1.1 Download and uncompress the ARM Cross Compiler
  1. Run the follow command to download the Cross Compiler from our git webserver.
    git clone https://github.com/friendlyarm/prebuilts.git
    tar xvzf prebuilts/gcc/arm-linux-gcc-4.4.3.tar.gz -C /
1.2 Install Cross-Compile tools
  1. Modify your ~/.bashrc file to add a new path with editor (gedit or vi)
    gedit ~/.bashrc
  2. add the follow into the .bashrc file
    export PATH=/opt/FriendlyARM/toolschain/4.4.3/bin/:$PATH
  3. To apply this change, login again or restart the .bashrc
    source ~/.bashrc

2 Build U-Boot from sources

2.1 Download and Build U-Boot
  • You can easily download U-Boot source code from FriendlyARM GitHub U-Boot repository.
  • clone the GitHub U-Boot repository, and Build U-Boot binary.
    git clone https://github.com/friendlyarm/uboot_nanopi.git
    cd uboot_nanopi
    git checkout nanopi
    make nanopi_config
    make

    The result of these operations is a fresh U-Boot binary called u-boot.bin

2.2 Update the u-boot.bin to MicroSD card.
  • If you want to test the u-boot.bin, you can use the shell fusing.sh to do it, if your MicroSD card inode is /dev/sdd, then do it with root user as the follow command:
    su
    ./fusing.sh /dev/sdd

3 Build Linux Kernel

3.1 Download and Build Linux kernel
  • clone the GitHub Kernel repository, and Build Kernel binary.
    git clone https://github.com/friendlyarm/linux-4.x.y.git
    cd linux-4.x.y
    git checkout nanopi-v4.1.y
    make nanopi_defconfig
    touch .scmversion
    make
    
    The linux kernel Branch for NanoPi is nanopi-v4.1.y, you should switch the branch to nanopi-v4.1.y, then build it, you will get the kernel programming file arch/arm/boot/zImage.
3.2 Build the Linux Kernel Module
  • When the linux kernel was compiled, some kernel module file(such as ipv6, netfilter) were built default, it have created the ko file.
  • If you want to add or edit the kernel module, you need compile the kernel module and compress it as kernel-modules.tgz file, and replace the basefs/kernel-modules.tgz on the Rootfs folder.
  • Run the followed command with root user, install the .ko file to /tmp/nanopi-modules
    make INSTALL_MOD_PATH=/tmp/nanopi-modules modules_install
  • Then strip the Linux kernel module, creat the compress lib
    cd /tmp/nanopi-modules/lib/
    find . -name \*.ko | xargs arm-linux-strip --strip-unneeded
    tar czvf kernel-modules.tgz modules/
  • If you want to test the new kernel module, uncompress the kernel-modules.tgz to lib folder on the nanoPi MicroSD system Card.
    rm -rf /media/fa/NANOPI/lib/modules/
    tar xzvf kernel-modules.tgz -C /media/fa/NANOPI/lib/
    The Rootfs Partition on the MicroSD card was mount on the /media/fa/NANOPI folder.

4 Created the File system

4.1 Build the Debian file system
  1. The pre-install Debian system is the standard debian insatll package, you can download with the follow command
    git clone https://github.com/friendlyarm/sd-fuse_nanopi.git
    cd sd-fuse_nanopi/prebuilt/
    ls -l rootfs.tgz
  2. If you want to do your own Debian system, you can upcompress the rootfs.tgz and edit it, then recompress it again, such as install a deb software package with the follow command:
    tar xzf rootfs.tgz 
    dpkg -i --force-all --root=./rootfs /tmp/qtembedded-4.8.5_armel.deb 
    tar czf rootfs.tgz rootfs
4.2 Create the Rabbit Linux

We provide a sample file system, we called it as Rabbit Linux, If you want to build it, you can run the follow command:

  1. User the root user, then Download the Rootfs source code and Build it
    git clone https://github.com/friendlyarm/rootfs_nanopi.git
    cd rootfs_nanopi
    git checkout nanopi
    su
    make && make install && make strip
  2. When build success, it will show the follow info
    RootFS (core) successfully installed to:
       /tmp/FriendlyARM/nanopi/rootfs
     
    Copyright 2015 FriendlyARM (http://www.arm9.net/)
  3. The above info show the rootfs was created on the /tmp/FriendlyARM/nanopi/rootfs folder, we compress it
    cd /tmp/FriendlyARM/nanopi
    tar czvf rootfs.tgz rootfs/

5 Created a MicroSD Card with Compiled system image

5.1 Created the MicroSD card
  1. Download the SD card Tools lib, and switch it to master branch.
    git clone https://github.com/friendlyarm/sd-fuse_nanopi.git
    cd sd-fuse_nanopi
    git checkout master
  2. The system image was in the prebuilt folder(The prebuilt folder was in the sd-fuse_nanopi folder).
    >>u-boot.bin : System Bootloader image file
    >>sdenv.raw : U-boot Boot Parameter, for booting the system
    >>zImage : Linux kernel image file
    >>rootfs.tgz : the Root file system compress lib
    Replace them with your compiled system image file, then run the follow command on the sd-fuse_nanopi folder:
    su
    ./fusing.sh /dev/sdx
    Notice: the /dev/sdx was your MicroSD card inode on the PC
  3. Then insert the MicroSD card to the NanoPi, try it.
5.2 Update the U-boot Boot Parameter 
  • If you update the U-Boot boot Parameter on the U-Boot command line, and want to use it in the new SD card, you should save it and replace the sdenv.raw file in the Rootfs prebuilt folder.
    ./readenv.sh /dev/sdd
    cp sdenv.raw prebuilt/

Extended connection

Connect camera module
Connect LCD TFT
Connect Matrix starter DIY Suite

Play with NanoPi

Make a 4.3 inch computer
Making wireless smart car

Follow Us: 
Facebook | Google+ | Twitter
Market Mail : market@armdevs.com
Support Mail: support@armdevs.com
NanoPi Online Chat >
Work time: 09:00-18:00
Copyright @ 2014 to 2020 - FriendlyARM NanoPi Team