Building Debian Linux image for A10-OLinuXino-Lime with Kernel 3.4.67+


Image

If you do not want to bother with Linux Debian image generations here is image build following the instructions below, so you just write it to SD card and boot your LIME 🙂

1. Setup of the toolchain

You should make sure you have the tools for building the Linux Kernel and install them if you don’t have them. To install new software you should be with super user rights on your Linux machine, so do this type in a terminal.

$ sudo su

you will be asked for your password and then your prompt will change to # which means you are now the super user, all future commands should be run in this mode.

First update apt-get links by typing

# apt-get update

Install the toolchain by typing the following.

# apt-get install gcc-4.7-arm-linux-gnueabihf ncurses-dev uboot-mkimage build-essential git

This will install: GCC compiler used to compile the kernal, The kernel config menu
uboot make image which is required to allow the SD card to book into the linux image, Git which allows you to download from the github which holds source code for some of the system, Some other tools for building the kernel.

Note that if you use debian may be you will need to add

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

in the file below:

/etc/apt/sources.list

after the installation you now have all tools to make your very own A10 kernel image!

2. Building Uboot

The Allwinner Linux-Sunxi community uboot is maintained by Henrik Nordstrom aka hno on Freenode irc. You can find him in #linux-sunxi or #olimex channels, if something with uboot is broken he is your man 🙂

First let’s make the directory where we will build the A10-OLinuXino-LIME linux:

# mkdir A10_kernel_3.4/
 # cd A10_kernel_3.4/

Then let’s download the uboot sources from GitHub repository, note there are lot of branches but you have to use sunxi branch.

Note that the A10-OLinuXino-LIME board u-boot is tested with the next branch:

# git rev-parse --verify HEAD
 4e491b03b53bd89af3065fc325a99106d0161998

Download u-boot sourses:

# git clone -b sunxi https://github.com/linux-sunxi/u-boot-sunxi.git

After the download you should have a new directory

# cd u-boot-sunxi/

With the following command you can start the uboot build:

# make A10-OLinuXino-Lime CROSS_COMPILE=arm-linux-gnueabihf-

At the end of the process you can check if everything is OK by

# ls u-boot.bin u-boot-sunxi-with-spl.bin spl/sunxi-spl.bin
spl/sunxi-spl.bin u-boot.bin u-boot-sunxi-with-spl.bin

If you got these files everything is complete, well done so far

# cd ..

You should be in the following directory

/home/user/A10_kernel_3.4/#

3. Building kernel sources for A10-OLinuXino-LIME

For problems related to Linux Kernel  use  #linux-sunxi irc channel or Google groups Mailing List.

Kernel sources for A10 are available on GitHub. Note that the following building is made with the revision below:

# git rev-parse --verify HEAD
 a7350cb6a9ec1aae510e26cdc730f05f12e13f9f

You can download the kernel sources using the following command:

# git clone https://github.com/linux-sunxi/linux-sunxi

After the download go to the kernel directory

# cd linux-sunxi/

Here you need from A10 configuration file – a10lime_defconfig. The file contains all kernel module settings.

Download a10lime_defconfig then copy a10lime_defconfig file to configs directory:

# cp a10lime_defconfig linux-sunxi/arch/arm/configs/.

and make:

# make ARCH=arm a10lime_defconfig

The result should be:

configuration written to .config

If you wish to make your changes in the kernel configuration do:

# make ARCH=arm menuconfig

The menuconfig changes a .config text file, which you can view/edit even with a text editor like vi,nano.

With this command you can add or remove different modules for the different peripherials in the kernel. Be careful when use this as this may cause the kernel to not work properly.

Note that before compiling kernel you have to do a patch related with I2C speed. The patch changes i2c speed from 200kHz to 100kHz.
If you want to use some of olimex’s i2c modules on UEXT then you need from this patch.

Download the patch sunxi-i2c.patch and apply the patch:

# patch -p0 < sunxi-i2c.patch

The other patch is related with A10-OLinuXino-LIME sound.

Download the patch a10_sound.patch and apply the patch:

# patch -p0 < a10_sound.patch

Note that by default A10-OLinuXino-LIME board there is no audio connectors and if you do not need from audio then you no need from this patch.

Now you can continue with kernel image compiling.

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

when this finish’s you will have uImage ready and the result should be:

Image Name: Linux-3.4.67+
 Created: Mon Sep 16 13:39:04 2013
 Image Type: ARM Linux Kernel Image (uncompressed)
 Data Size: 5450904 Bytes = 5323.15 kB = 5.20 MB
 Load Address: 40008000
 Entry Point: 40008000
 Image arch/arm/boot/uImage is ready

Now you can build the kernel modules:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 INSTALL_MOD_PATH=out modules
 # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 INSTALL_MOD_PATH=out modules_install

DONE! At this point you have uboot and kernel modules.

The uImage file is located in linux-sunxi/arch/arm/boot/

The kernel modules are located in linux-sunxi/out/lib/modules/3.x.xx where 3.x.xx is kernel version in our case the directory with modules is:

linux-sunxi/out/lib/modules/3.4.67+

4. Format and setup the SD-card

We suggest 4GB class 10 micro sd-card but you can use any card between 2GB and 16GB.

First we have to make the correct card partitions, this is done with fdisk.

Plug SD card into your SD card reader and enter in the terminal

# ls /dev/sd

Then press two times <TAB> you will see a list of your sd devices like sda sdb sdc note that some of these devices may be your hard disk so make sure you know which one is your sd card before you proceed as you can damage your HDD if you choose the wrong sd-device. You can do this by unplugging your sd card reader and identify which “sd” devices remove from the list.

Once you know which device is your sdcard like sda use this text instead of the sdX name in the references below:

# fdisk /dev/sdX

then do these steps:

1. p

will list your partitions

if there are already partitions on your card do:

2. d enter 1

if you have more than one partitition press d while delete them all

3. create the first partition, starting from 2048
n enter p enter 1 enter enter +16M

4. create second partition
n enter p enter 2 enter enter enter

then list the created partitions:
p enter

if you did everything correctly on 4GB card you should see something like:

Disk /dev/sdg: 3980 MB, 3980394496 bytes
 123 heads, 62 sectors/track, 1019 cylinders, total 7774208 sectors
 Units = sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
 /dev/sdg1 2048 34815 16384 83 Linux
 /dev/sdg2 34816 7774207 3869696 83 Linux

7. w

write changes to sd card

now we have to format the file system on the card:

the first partition should be vfat as this is FS which the Allwinner bootloader understands

# mkfs.vfat /dev/sdX1

the second should be normal Linux EXT3 FS

# mkfs.ext3 /dev/sdX2

5. Write the Uboot and sunxi-spl.bin

You should be in /home/user/A10_kernel_3.4/# directory

Note that you have to write u-boot-sunxi-with-spl.bin in /dev/sdX (not sdX1 or sdX2)

# dd if=u-boot-sunxi/u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8

6. Write kernel uImage you build to the SD-card

You should be in the directory below

/home/user/A10_kernel_3.4/# directory
 # mount /dev/sdX1 /mnt/sd

copy the Kernel uImage to root directory in partition 1

# cp linux-sunxi/arch/arm/boot/uImage /mnt/sd

7. Write script.bin file

script.bin is a file with very important configuration parameters like port GPIO assignments, DDR memory parameters, Video resolution etc.

Download the script.bin

# cp script.bin /mnt/sd
# sync
# umount /dev/sdX1

8. Debian rootfs

The Linux Kernel and Uboot are ready, now we have need from Linux distribution rootfs.

Basically the only difference between the different Linux distributions is the rootfs, so if you put Debian rootfs you will have Debian, if you put Ubuntu rootfs it will be Ubuntu etc.

How to build one is a long topic, the good thing is that there are many already pre-built so we can just download one and use.

exit the kernel directory

# cd ..

You should be in the directory below

# /home/user/A10_kernel_3.4/

download debian rootfs – a10-olinuxino-lime.tgz

mount your sd card EXT3 FS partition:

# mkdir /mnt/sd
# mount /dev/sdX2 /mnt/sd

and unarchive the rootfs

# tar xzvf debian_34_67_fs.tgz -C /mnt/sd
# ls /mnt/sd

the right result should be:
bin dev home lost+found mnt proc run selinux sys usr
boot etc lib media opt root sbin srv tmp var

Now you have to replace the new generated kernel modules from

/home/user/A10_kernel_3.4/linux-sunxi/out/lib/modules/ to the new debian file system

# rm -rf /mnt/sd/lib/modules/*
# cp -rfv linux-sunxi/out/lib/modules/3.x.xx+/ /mnt/sd/lib/modules/

where x.xx is the kernel version in our case:

# cp -rfv linux-sunxi/out/lib/modules/3.4.67+/ /mnt/sd/lib/modules/

replace /lib/firmware folder with the generated /linux-sunxi/out/firmware

# rm -rf /mnt/sd/lib/firmware/
# cp -rfv linux-sunxi/out/lib/firmware/ /mnt/sd/lib/
# sync
# umount /mnt/sdX2

at this point you have Debian on your SD card second partition and you have an SD card ready to boot debian on A10-OLinuXino-Micro

Connect USB-SERIAL-CABLE-F to UEXT Tx.Rx and GND, or connect a HDMI screen. Put the SD-card in A10-OLinuXino-Micro and apply 5V power, you should see Uboot and then Kernel messages on the console

default username/password is : root / olimex

38 Comments (+add yours?)

  1. Dimityr Tomow
    Dec 13, 2013 @ 20:48:57

    I will be direct:

    I downloaded the ready for boot image, write it down to a sd card and boot it. But I’m very unpleased with its performance. Simple 240p video playback is hard and skips frames. HDMI audio is non – driver crashes – gives kernel ops “NULL point reference”. I’m happy i’m not using this as desktop replacement or some kind of HMI, but surveillance station. NO GUI , just terminal and running services. Still I have to say i’m disappointed. I have A13 based tablet which works OK. Yes, it runs Android, but Android is modified Linux kernel, yet obviously it has better hardware support for this kind of hardware. I will wait for the Android image just to see how are things there.

    Also one thing that your image does not have right (personal opinion). For a image ready to boot it is expected to have DHCP configured for the Ethernet interface, not static 😉

    Still I think this A10-Lime board is very neat, because it is very compact and packs nice options, but Linux isn’t that great on that board, … yet.

    Reply

    • OLIMEX Ltd
      Dec 13, 2013 @ 21:14:11

      I will ask Lub to read and reply in Monday but this image have XFCE4 for sure 🙂 and we tested both video and audio last two days

      Reply

    • ssvb
      Dec 14, 2013 @ 05:42:06

      This image is using the fbdev xorg driver, which does not provide XV extension for accelerated scaling and colorspace conversion of software decoded video. You can install https://github.com/ssvb/xf86-video-fbturbo/wiki/Installation to solve this problem and get faster video scaling in video players (don’t bother about X11 EGL).

      Also the video players in debian are not configured to use NEON SIMD by default, which also seriously hinders the video playback performance.

      Reply

    • ssvb
      Dec 14, 2013 @ 05:55:35

      Also if you want a fast and responsive linux desktop, it is really critical to set the cpufreq governor to “performance” in the kernel menuconfig. Or alternatively run “sudo cpufreq-set -g performance” in the console on LIME.

      Reply

  2. Dimityr Tomow
    Dec 13, 2013 @ 21:05:29

    The reason I choose this board is the SATA port, because I need storage for the surveillance. Now I tested a NEW SATA HDD and it doesn’t even start ?!. Is SATA support enabled in your image ? In your reports you said SATA works and you have tested with several HDDs, it will be very strange if you have not enabled it 😕

    Reply

  3. Dimityr Tomow
    Dec 13, 2013 @ 21:15:28

    I use your SATA-cable-set and I’m powering the board with 4A 5V adapter. What is the power consumption limit that I must meet ? This limitation was not mentioned anywhere. The drive is absolutely new -> SEAGATE BARRACUDA 1000GB , exact model: ST1000DM003. Any advice will be appreciated 😉

    Reply

    • OLIMEX Ltd
      Dec 13, 2013 @ 21:22:02

      the limitation is your power supply to provide enough power for LIME and HDD together as some HDD require 5V 1A and people may try to power LIME with our 5V 1A adapter 🙂 but this is not your case if you use 5V 4A adapter
      is your HDD 2.5″ or 3.5″ as our SATA cable set provide only 5V while 3.5″ HDD require both 5 and 12V 😉

      Reply

      • Dimityr Tomow
        Dec 13, 2013 @ 21:35:07

        This is the trouble. Ahhhh. I bought 3.5” HDD. Why I didn’t know this. It will be wise to mention this on the A10-LIME page , that you provide only 5V for 2.5” HDD. But it is my mistake I didn’t research this. Thank you for your quick response.

        btw: The image has X11 and XFCE4, i was telling above that i’m going to use it with no GUI 😉 But the hdmi sound is really crashing 😉

      • Dimityr Tomow
        Dec 13, 2013 @ 22:16:44

        I pluged in and connected external 12V adapter 2.5A and now the 3.5” HDD SATA works. 🙂 So SATA is ok – great ! 🙂

      • OLIMEX Ltd
        Dec 13, 2013 @ 23:02:06

        if you want to use LiPo as UPS backup you have to find 2.5″ SATA HDD which needs only 5V

  4. selsinork
    Dec 13, 2013 @ 22:06:28

    The image has a static IP of 192.168.0.243/24 with gateway 192.168.0.1 configured. DHCP would probably be more useful.

    So far unable to get any output on HDMI, but that seems to be down to my 4:3 monitor. The monitor is detected, but as it’s a 1600×1200 display, there doesn’t seem to be a mode to match:
    [ 3.013816] ParseEDID
    [ 3.055084] EDID version: 1.3
    [ 3.064307] PCLK=162000000 X 1600 1664 1856 2160 Y 1200 1201 1204 1250 fr 60 PP
    [ 3.075450] Using above mode as preferred EDID mode
    [ 3.086199] disp_clk: Could not find a matching pll-freq for 78800000 pclk
    [ 3.098908] disp_clk: Could not find a matching pll-freq for 26150000 pclk

    Combining the above two meant I was forced to use the serial console. Can I suggest for future versions you have a 4 pin console header instead of the three pin one? Add 3.3v like the one found on the A20-OLinuXino-MICRO

    Reply

    • Lub
      Dec 14, 2013 @ 11:00:37

      We use static address due to popular demand – people that use only SSH for interacting with the boards sometimes can’t guess the proper address that was assigned by the DHCP (say at job places with high-security). It is not that hard to change it to DHCP…

      Reply

      • selsinork
        Dec 14, 2013 @ 13:41:53

        I agree it’s not hard to change, adding a few lines to the page telling us it’s set to static IP and what the address is, isn’t hard either 🙂

  5. Lurch
    Dec 13, 2013 @ 22:06:32

    Nice Job! HDMI and SATA OK. Added wireless Rapoo keyboard and mousepad and everything I could try was OK.
    Those small pins are difficult to connect with grabber-clips. Are there cables in the works?

    Reply

    • Dimityr Tomow
      Dec 13, 2013 @ 22:19:32

      HDMI Video output and SATA works by me too, I also have plugged in a Rapoo keyboard and mice 😀
      But have you tried HDMI audio ? In my case it crashes with kernel ops.
      Also have you tried some video playback 😕

      Reply

      • Lurch
        Dec 14, 2013 @ 00:30:04

        Video playback doesn’t work for me either. I converted an .mp4 to .avi to try that, but still no luck. The CPU hits 100% and that’s it. I may also have some protection problems, since I did some stuff as root. Well, it’s weekend ….

  6. selsinork
    Dec 13, 2013 @ 22:43:37

    anyone else seeing in the output of ps ax
    18 ? D 0:00 [usb-hardware-sc]
    and a permenant loadavg of 1 ?

    Reply

  7. Peter Meewald
    Dec 16, 2013 @ 12:50:33

    the product page claims that LCD modules from Olimex are supported (“LCD connector compatible with with 4.3″, 7.0″, 10.1″ LCD modules from Olimex”); this is indeed not the case as the connectors have different format — am I missing something? is an adapter available?

    Reply

    • OLIMEX Ltd
      Dec 16, 2013 @ 12:52:34

      supported in the DEBIAN image!
      sure you will need proper cable/adapter to connect the LCDs this is obvious 🙂

      Reply

      • Peter Meewald
        Dec 18, 2013 @ 12:49:04

        an adapter would be appreciated; do you have a suggestion?

        w.r.t. obvious: almost anything is somehow compatible with an adapter — your product description could be a lot more helpful and specific

        thanks, p.

  8. Trackback: New A10-OLinuXino-LIME image have full HD hardware acceleration | olimex
  9. Mikael
    Dec 26, 2013 @ 17:49:30

    It works pretty well so far.
    But I still have that issue with every board (a10s,a20,a10) using the latest olimex image: the load average is > 1.
    I can’t use the board in my project until this is fixed.
    Thanks.

    Reply

  10. Mikael
    Dec 27, 2013 @ 19:50:15

    Here is a quick how to fix this yourself:

    git clone git://github.com/linux-sunxi/sunxi-tools.git
    cd sunxi-tools/
    make fex2bin

    Then retrieve the original script_a10_lime_HDMI.fex from your sdcard and copy it.

    vi script_a10_lime_HDMI.fex

    I use this setup on the buggy USB port (thanks to Xfer) :

    [usbc0]
    usb_used = 1
    usb_port_type = 1
    usb_detect_type = 0
    usb_id_gpio = port:PH04
    usb_det_vbus_gpio = port:PH05
    usb_drv_vbus_gpio = port:PB09
    usb_host_init_state = 1
    usb_restric_flag = 0

    “which keeps the low load (low ksoftirq cpu usage) AND keeps OTG port (mini-USB) working both with USB 1.1 and with USB 2.0 devices, if only in Host mode (which is the most useful anyway).” Xfer

    Then you convert it back to script bin.

    ./fex2bin -v script_a10_lime_HDMI.fex script.bin

    And you copy it back to the root of your sdcard.

    This should be the default until an official fix is found imho.

    Reply

  11. jurij
    Jan 12, 2014 @ 02:12:09

    1. If you have trouble compiling the reason may be gcc location. Ubuntu 12.0.4 LTS install arm gcc in /usr/bin/arm-linux-gnueabihf-gcc-4.6. Just make symbolic link ln -s /usr/bin/arm-linux-gnueabihf-gcc-4.6 /usr/bin/arm-linux-gnueabihf-gcc.

    2. Correct syntax for compiling modules: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 INSTALL_MOD_PATH=out modules_install

    Reply

  12. Charlie Hand
    Jun 08, 2014 @ 15:52:11

    I’m stuck at step one. I can’t get gcc-4.7-arm-linux-gnueabihf.

    When I add deb http://www.emdebian.org/debian unstable main
    to sources.list, I get an error in apt-get update

    W: Failed to fetch http://www.emdebian.org/debian/dists/unstable/Release Unable to find expected entry ‘main/binary-armhf/Packages’ in Release file (Wrong sources.list entry or malformed file)

    Can I build this kernel on another computer, say a Mint system? Or do I have to build it on the a10 board?

    How can I get the emdebian.org source to work?

    Reply

    • Charlie Hand
      Jun 09, 2014 @ 05:13:50

      I built it on Mint 13/Ubuntu 12, so that got me past my toolchain problems.

      When I got to
      make A10-OLinuXino-Lime CROSS_COMPILE=arm-linux-gnueabihf-

      It told me the package had to be configured for a specific board, and pointed me to a README.

      Based on the README, and a hunch, I tried,
      make A10-OLinuXino-Lime_config
      which succeeded.

      Afterwards the
      make A10-OLinuXino-Lime CROSS_COMPILE=arm-linux-gnueabihf-

      gave me “no such target”. I tried dropping the target altogether, thus:
      make CROSS_COMPILE=arm-linux-gnueabihf-

      This succeeded and in the end my new kernel and distro boots just fine.

      Reply

      • selsinork
        Jun 09, 2014 @ 11:02:13

        if you had to use :
        make A10-OLinuXino-Lime_config
        then you didn’t follow the instructions, which clearly state they are for rev 4e491b03b53bd89af3065fc325a99106d0161998 from the u-boot-sunxi repository.

        If you choose to ignore the instructions, then it’s somewhat unfair to complain that things don’t work.

      • Charlie Hand
        Jun 09, 2014 @ 12:16:01

        Dude. Ease up.

        # git rev-parse –verify HEAD
        a7350cb6a9ec1aae510e26cdc730f05f12e13f9f

        is not “clear”.

        Thanks for the help. Give people a little break.

        If you wanted to be clear, you should have given the git command to clone the specific revisiion.

        Thanks for all your help, I couldn’t have built the kernel without it.

        The scolding I don’t need.

    • ar
      Sep 08, 2014 @ 15:54:17

      I have same toolchain problems but in debian stable (wheezy). can’t get gcc-4.7-arm-linux-gnueabihf . tried installing gcc-4.7-arm-linux-gnueabi but it’s a broken package = won’t install.

      how did you get past your problems? by using a different system?

      Reply

  13. Trackback: Olimex 4.3 LCD A13-LCD43TS PWM backlight controlPHARscape
  14. Trackback: Olimex 4.3 LCD A13-LCD43TS PWM backlight control | PHARscape
  15. ar
    Sep 08, 2014 @ 15:39:01

    what is the git command to clone the specific revision, how do I find out what is the revision I need for lime-a10? please.

    Reply

  16. ss
    Sep 09, 2014 @ 11:50:39

    can someone give a new link of defconfig file please

    Reply

  17. Gintaras
    Sep 23, 2014 @ 21:41:17

    I got stuck at the command
    # make A10-OLinuXino-Lime CROSS_COMPILE=arm-linux-gnueabihf-
    too, but found solution by modifying Makefile.
    Lines with:
    cc $(CROSS_COMPILE)gcc
    ar $(CROSS_COMPILE)ar
    I have changed to:
    cc $(CROSS_COMPILE)gcc-4.7
    ar $(CROSS_COMPILE)gcc-ar-4.7
    After that following commands run without any complains
    # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
    # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- A10-OLinuXino-Lime_config
    # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

    Reply

  18. Francis
    May 07, 2015 @ 17:52:13

    download debian rootfs – a10-olinuxino-lime.tgz
    This link is broken

    Reply

Leave a comment