|
|
1. Setup ARM Cross Compiler
1.1 Download and uncompress the ARM Cross Compiler
- 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
- Modify your ~/.bashrc file to add a new path with editor (gedit or vi)
gedit ~/.bashrc
- add the follow into the .bashrc file
export PATH=/opt/FriendlyARM/toolschain/4.4.3/bin/:$PATH
- 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
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
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
- 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
- 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:
- 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
- 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/)
- 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
- 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
- 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
- Then insert the MicroSD card to the NanoPi, try it.
5.2 Update the U-boot Boot Parameter
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
|