Loading...

You have no items in your shopping cart.

 
 
 
×

Registration

Profile Informations

Login Datas

or login

First name is required!
Last name is required!
First name is not valid!
Last name is not valid!
This is not an email address!
Email address is required!
This email is already registered!
Password is required!
Enter a valid password!
Please enter 6 or more characters!
Please enter 16 or less characters!
Passwords are not same!
Terms and Conditions are required!
Email or Password is wrong!
Captcha is required!
Captcha is wrong!

Build Your Own Linux System Step by Step

Under normal circumstances, when you want to compile your own customized system, you can compile manually from the source codes step by step, which costs you a lot of time and efforts. Fortunately, experts on linux-sunxi prepared a nice compiling script which does save a lot of work.

We will use the script to generate our own linux system here. Itead Studio equipped Iteaduino Plus A10 with a SDK, which offers some functions to facilitate operations of underlying hardware. If you want to use the SDK, you need to adpot 3.4.67 kernel with the default configuration files.

Preparation

The operations mentioned in the text are based on debian 7.0 amd64 system.

To install Cross-development Toolchains for Debian, follow the instructions on emdebian.org.

Note: Emdebian's armhf-toolchain is only available for Debian/unstable at the moment.

Edit your /etc/apt/sources.list as approriate and advised above:

deb http://www.emdebian.org/debian/ unstable main

Install Cross Compiler and build utilities:

apt-get install emdebian-archive-keyring
apt-get update
apt-get install gcc-4.7-arm-linux-gnueabihf

You might want additional tools for building a sunxi kernel that are not related to the cross-compiler:

apt-get install build-essential git debootstrap u-boot-tools

Create symlinks to specific version of the cross-compiler-tools so they are found by the kernel build system:

 cd /usr/bin 
for i in arm-linux-gnueabihf*-4.7 ; do ln -s $i ${i%%-4.7} ; done

You will also need file conversion tools for fex and bin.

git clone https://github.com/linux-sunxi/sunxi-tools.git
cd sunxi-tools/
make
export PATH=$PATH:$PWD

After successful compiling, you will get two files: fex2bin and bin2fex. Add $PWD to PATH temporily, then you can execute the two files directly.

git clone https://github.com/linux-sunxi/sunxi-bsp.git
cd sunxi-bsp/scripts 
export PATH=$PATH:$PWD

Then add $PWD export to PATH.

Up to now, the compiling environment is prepared. Then we can proceed with the next step.

Prepare Hwpack

"hwpack" means a "hardware-specific package", which include the following contents

  • bootloader: contains sunxi-spl and u-boot;
  • kernel: contains kernel uImage and script.bin;
  • rootfs: contains some configuration files and kernel modules.

All that we need to do is to prepare all the files and place them into the corresponding directories.

1. Compile Bootloader

git clone https://github.com/itead/u-boot-sunxi.git
cd u-boot-sunxi/
make distclean CROSS_COMPILE=arm-linux-gnueabihf-
make Iteaduino_Plus_A10 CROSS_COMPILE=arm-linux-gnueabihf-

If compiling suceeded, you will see the following prompt:

arm-linux-gnueabihf-ld.bfd  -r -o libstubs.o  stubs.o
arm-linux-gnueabihf-ld.bfd  -g -Ttext 0x50000000 \
                    -o hello_world -e hello_world hello_world.o libstubs.o \
                    -L/usr/lib/gcc/arm-linux-gnueabihf/4.7 -lgcc
arm-linux-gnueabihf-objcopy -O srec hello_world hello_world.srec 2>/dev/null
arm-linux-gnueabihf-objcopy -O binary hello_world hello_world.bin 2>/dev/null
make[2]: Leaving directory `/home/debian/work/allwinner/u-boot-sunxi/examples/standalone'
make[1]: Leaving directory `/home/debian/work/allwinner/u-boot-sunxi'

After successful compiling, you will get two files: sunxi-spl.bin and u-boot.img.

2. Compile kernel

Download kernel source file:

git clone https://github.com/itead/linux-sunxi.git
cd linux-sunxi/

SDK offered by Itead only works properly with Kernel 3.4.67 during testing, thus we cannot guarantee it is compatible with other versions. If you want to use the SDK, please replace with 3.4 kernel and the default configuration files.

git checkout sunxi-3.4
make ARCH=arm iteadunio_plus_a10_defconfig

If you have special requirements, you can cut the kernel by yourself.

make ARCH=arm menuconfig

Then, compile the kernel:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage

If compiling succeeded, you can see the prompt below:

OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-3.4.67+
Created:      Tue Dec 17 18:03:14 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    4358912 Bytes = 4256.75 kB = 4.16 MB
Load Address: 40008000
Entry Point:  40008000
Image arch/arm/boot/uImage is ready

After successful compiling, you will get file uImage.

Take next step as option, it will generate as below after being executed

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules

If compiling suceeded, you will see prompt below and some driver modules will be generated.

LD [M]  sound/soc/sunxi/i2s/sndi2s.ko
LD [M]  sound/soc/sunxi/i2s/sunxi-i2s.ko
LD [M]  sound/soc/sunxi/i2s/sunxi-i2sdma.ko
LD [M]  sound/soc/sunxi/i2s/sunxi-sndi2s.ko
LD [M]  sound/soc/sunxi/spdif/sndspdif.ko
LD [M]  sound/soc/sunxi/spdif/sunxi_sndspdif.ko
LD [M]  sound/soc/sunxi/spdif/sunxi_spdif.ko
LD [M]  sound/soc/sunxi/spdif/sunxi_spdma.ko

Then copy the files needed and paste them into the corresponding directories. For details, please find the hwpack directory trees in the section below.

3. Prepare kernel modules and configuration file

CedarX is Allwinner's multimedia co-processing technology for hardware accelerated video and image decoding, as used inside their A10 SoC's and others. For more information, please click here.

wget https://github.com/linux-sunxi/cedarx-libs/blob/master/libcedarv/linux-armhf/libvecore/libvecore.so

A FEX file defines various aspects of how the SoC works. It configures the GPIO pins and sets up DRAM, Display, etc parameters. Download the corresponding fex file for Iteaduino Plus A10 and convert it to script.bin with fex2bin.

wget https://github.com/itead/sunxi-boards/blob/master/sys_config/a10/iteaduino_plus_a10.fex
fex2bin iteaduino_plus_a10.fex script.bin

Download needed rootfs files for debian/ubuntu from https://github.com/linux-sunxi/sunxi-bsp/tree/master/rootfs/debian-ubuntu

Till now, we have prepared all the files needed to make. Create a folder and name it as plusA10_hwpack, then list the generated files according to the directories below:

jerry@ThinkBig:~/Downloads/itead_hwpack$ tree
 ├── bootloader
 │   ├── sunxi-spl.bin
 │   └── u-boot.img
 ├── kernel
 │   ├── script.bin
 │   └── uImage
 ├── README
 └── rootfs
 ├── etc
 │   ├── modprobe.d
 │   │   └── 8192cu.conf
 │   └── modules
 └── lib
    ├── libvecore.so
    └── modules
        └── 3.0.76
            ├── kernel
            │   ├── drivers
            │   │   ├── ata
            │   │   │   └── sw_ahci_platform.ko
            │   │   ├── cpufreq
            │   │   │   └── cpufreq_stats.ko
            │   │   ├── gpio
            │   │   │   └── gpio-sunxi.ko
            │   │   ├── gpu
            │   │   │   ├── drm
            │   │   │   │   ├── drm.ko
            │   │   │   │   └── mali
            │   │   │   │       └── mali_drm.ko
            │   │   │   └── mali
            │   │   │       ├── mali
            │   │   │       │   └── mali.ko
            │   │   │       └── ump
            │   │   │           └── ump.ko
            │   │   ├── i2c
            │   │   │   └── algos
            │   │   │       └── i2c-algo-bit.ko
            │   │   ├── input
            │   │   │   ├── keyboard
            │   │   │   │   ├── hv2605.ko
            │   │   │   │   ├── sun4i-ir.ko
            │   │   │   │   ├── sun4i-keyboard.ko
            │   │   │   │   └── sun4i-keypad.ko
            │   │   │   └── touchscreen
            │   │   │       ├── ft5x_ts.ko
            │   │   │       ├── goodix_touch.ko
            │   │   │       ├── gt811_ts.ko
            │   │   │       ├── gt818_ts.ko
            │   │   │       ├── sun4i-ts.ko
            │   │   │       └── zt8031.ko
            │   │   ├── media
            │   │   │   ├── common
            │   │   │   │   └── tuners
            │   │   │   │       └── tea5761.ko
            │   │   │   └── video
            │   │   │       ├── sun4i_csi
            │   │   │       │   ├── csi0
            │   │   │       │   │   └── sun4i_csi0.ko
            │   │   │       │   ├── csi1
            │   │   │       │   │   └── sun4i_csi1.ko
            │   │   │       │   └── device
            │   │   │       │       ├── gc0307.ko
            │   │   │       │       ├── gc0308.ko
            │   │   │       │       ├── gt2005.ko
            │   │   │       │       ├── hi253.ko
            │   │   │       │       ├── hi704.ko
            │   │   │       │       ├── mt9d112.ko
            │   │   │       │       ├── mt9m112.ko
            │   │   │       │       ├── mt9m113.ko
            │   │   │       │       ├── ov2655.ko
            │   │   │       │       ├── ov5640.ko
            │   │   │       │       ├── ov7670.ko
            │   │   │       │       └── sp0838.ko
            │   │   │       ├── videobuf-core.ko
            │   │   │       └── videobuf-dma-contig.ko
            │   │   ├── misc
            │   │   │   └── sunxi-dbgreg.ko
            │   │   ├── net
            │   │   │   ├── tun.ko
            │   │   │   ├── usb
            │   │   │   │   ├── asix.ko
            │   │   │   │   ├── cdc_ether.ko
            │   │   │   │   ├── cdc_ncm.ko
            │   │   │   │   ├── cdc_subset.ko
            │   │   │   │   ├── hso.ko
            │   │   │   │   ├── ipheth.ko
            │   │   │   │   ├── kaweth.ko
            │   │   │   │   ├── net1080.ko
            │   │   │   │   ├── pegasus.ko
            │   │   │   │   ├── qf9700.ko
            │   │   │   │   ├── usbnet.ko
            │   │   │   │   └── zaurus.ko
            │   │   │   └── wireless
            │   │   │       ├── bcm4330
            │   │   │       │   └── bcm4330.ko
            │   │   │       └── rtl8192cu
            │   │   │           └── 8192cu.ko
            │   │   ├── scsi
            │   │   │   └── scsi_wait_scan.ko
            │   │   ├── staging
            │   │   │   └── zram
            │   │   │       └── zram.ko
            │   │   ├── usb
            │   │   │   └── gadget
            │   │   │       └── g_file_storage.ko
            │   │   └── video
            │   │       └── sunxi
            │   │           └── disp
            │   │               └── disp_ump.ko
            │   ├── net
            │   │   ├── bridge
            │   │   │   └── bridge.ko
            │   │   ├── core
            │   │   │   └── pktgen.ko
            │   │   └── ipv6
            │   │       ├── sit.ko
            │   │       ├── xfrm6_mode_beet.ko
            │   │       ├── xfrm6_mode_transport.ko
            │   │       └── xfrm6_mode_tunnel.ko
            │   └── sound
            │       └── soc
            │           └── sun4i
            │               ├── i2s
            │               │   ├── sndi2s.ko
            │               │   ├── sun4i-i2sdma.ko
            │               │   ├── sun4i-i2s.ko
            │               │   └── sun4i-sndi2s.ko
            │               └── spdif
            │                   ├── sndspdif.ko
            │                   ├── sun4i_sndspdif.ko
            │                   ├── sun4i_spdif.ko
            │                   └── sun4i_spdma.ko
            ├── modules.alias
            ├── modules.alias.bin
            ├── modules.builtin
            ├── modules.builtin.bin
            ├── modules.ccwmap
            ├── modules.dep
            ├── modules.dep.bin
            ├── modules.devname
            ├── modules.ieee1394map
            ├── modules.inputmap
            ├── modules.isapnpmap
            ├── modules.ofmap
            ├── modules.order
            ├── modules.pcimap
            ├── modules.seriomap
            ├── modules.softdep
            ├── modules.symbols
            ├── modules.symbols.bin
            └── modules.usbmap

Then pack, and hardware pack will be generated.

tar cvf -  plusA10_hwpack | lzma > plusA10_hwpack.tar.xz

Prepare rootfs

Download linaro rootfs. If you do not want linaro, you can use other fs as you like.

wget https://releases.linaro.org/12.11/ubuntu/precise-images/alip/linaro-precise-alip-20121124-519.tar.gz

Then pack, and system mirror image will be generated.

sunxi-media-create.sh /dev/sdx plusA10_hwpack.tar.xz linaro-precise-alip-20121124-519.tar.gz

You can now burn the image to Micro-SD card, plug into Iteaduino Plus A10 and have a try.

Reference:

  1. http://linux-sunxi.org/Toolchain
  2. http://linux-sunxi.org/BSP