A20-OLinuXino universal image updated – now supporting our new boards with SPI+eMMC

d6ndarl

We just uploaded new A20-OLinuXino universal image at our FTP.

With this image we add support for the new OLinuXino boards with eMMC+SPI.

Few things need some more attention and will be fixed in new image next week: boot from SPI with rootFS on HDD or USB Flash. The new LCD-15.6 eDP display also doesn’t like the new kernel and drivers, but will be fixed too. These are explained in the ISSUES.txt.

The new image also support our new 5″, 7″ and 10″ capacitive touch displays (not on our web for sale yet as still testing) automatically i.e. plug and play and no need to run display script, each time at boot it recognizes the connected display and configure the drivers.

All other peripherals and devices are tested to work with: A20-OLinuXino-LIME, A20-OLinuXino-LIME2, A20-OLinuXino-MICRO, A20-SOM and A20-SOM204.

New univeral A20 image released which works with all our A20 boards and auto detect and configure on boot

d6ndarl

We are releasing universal A20 Linux image which will boot and work on all our A20 boards:

The image is based on Armbian with modifications necessary to support OLinuXino specific features.

There are two image releases – Ubuntu Bionic Desktop image which is the recommended image for beginners or when you want to evaluate the board’s hardware fully – it has good HDMI, audio support and Debian Stretch Server image which contains no binary blobs but is headless and has poor video and audio support.

Currently, our latest Ubuntu Bionic A20 image uses kernel 4.19.10, or to be more specific:

root@olinuxino:~# uname -a
Linux olinuxino 4.19.10-sunxi #5.65 SMP Tue Dec 18 14:19:16 EET 2018 armv7l armv7l armv7l GNU/Linu

Our Armbian Ubuntu Bionic image can be downloaded from FTP or Torrent.

Our Armbian Debian Stretch image can be download from FTP or Torrent.

Username is according to Armbian documentation: root and password: 1234

Since we have a large array of A20 boards and numerous variants there is auto-detection enabled in the image. Information about the model of the board is stored in the EEPROM of each A20 board that had been recently manufactured and this information is used by the new images to load the proper configuration. The EEPROM contents are described here.

The images can be used with boards from early revisions which has no EEPROM or has EEPROM with wrong content after one time set up of the EEPROM during in the first u-boot of the new image. If you have trouble booting interrupt u-boot by pressing space and type “olinuxino”. An example configuration for manually setting the EEPROM of A20-OLinuXino-LIME-e16Gs16MB hardware revision K is given at the end of the post.

The new images have support for both legacy resistive and new capacitive/resistive touch displays with auto detection feature (please bear with us they are not released yet on the web as we test them). The newer versions of the displays has suffix -CTS for capacitive touch screen and -RTS for resistive touch screen and are offered in 5″, 7″ and 10″ size with different resolutions. These displays are automatically detected by boot and drivers properly configured for them. If the LCDs are not detected HDMI output is only enabled and the image can be configured one time at first boot manually as described in this wiki article.

Please note that mainline Kernel now do not support NAND Flash, so if you wish to boot from the flash memory, consider either using the legacy 3.4.xx images which are still available or switch to A20 boards with eMMC. The eMMC boot is supported via armbian-config (nand-sata-install). Due to lack of reliable eMMC 5.X support by Allwonner boot0 and for future compatibility we are adding 16MB SPI flash for all A20 boards with eMMC, this way the board first boots from the SPI then continue to eMMC with properly set configuration. Allwinner Boot0 can’t handle correctly eMMC 5.X and sometime boot sometimes do not boot, as this is binary blob inside SOC there is nothing we can do than to use SPI boot to fix eMMC boot parameters.

Build instructions for the new images can be found here.

An example configuration for manually setting the EEPROM of A20-OLinuXino-LIME-e16GB hardware revision K is given below:

=> olinuxino 
olinuxino - OLinuXino board configurator

Usage:
olinuxino config info - Print current configuration: ID, serial, ram, storage, grade...
olinuxino config list - Print supported boards and their IDs
olinuxino config erase - Erase currently stored configuration
olinuxino config write [id] [revision] [serial] [mac]
arguments:
[id] - Specific board ID
[revision] - Board revision: C, D1, etc...
[serial] - New serial number for the board
[mac] - New MAC address for the board
Format can be:
aa:bb:cc:dd:ee:ff
FF:FF:FF:FF:FF:FF
aabbccddeeff
olinuxino monitor list - Print supported video outputs
olinuxino monitor set - Set specific LCD

=> olinuxino config list

Supported boards:
----------------------------------------
A20-OLinuXino-LIME - 7739 
A20-OLinuXino-LIME-n4GB - 7743 
A20-OLinuXino-LIME-n8GB - 8934 
A20-OLinuXino-LIME-s16MB - 9076 
T2-OLinuXino-LIME-IND - 9211 
T2-OLinuXino-LIME-s16MB-IND - 9215 
T2-OLinuXino-LIME-e4GB-IND - 9219 
A20-OLinuXino-LIME2 - 7701 
A20-OLinuXino-LIME2-e4GB - 8340 
A20-OLinuXino-LIME2-e16GB - 9166 
A20-OLinuXino-LIME2-n4GB - 7624 
A20-OLinuXino-LIME2-n8GB - 8910 
A20-OLinuXino-LIME2-s16MB - 8946 
A20-OLinuXino-LIME2-e16Gs16M - 9604 
A20-OLinuXino-LIME2-e4Gs16M - 9613 
T2-OLinuXino-LIME2-IND - 9239 
T2-OLinuXino-LIME2-s16MB-IND - 9247 
T2-OLinuXino-LIME2-e4GB-IND - 9243 
A20-OLinuXino-MICRO - 4614 
A20-OLinuXino-MICRO-e4GB - 8832 
A20-OLinuXino-MICRO-e16GB - 9042 
A20-OLinuXino-MICRO-e4GB-IND - 8661 
A20-OLinuXino-MICRO-IND - 8828 
A20-OLinuXino-MICRO-n4GB - 4615 
A20-OLinuXino-MICRO-n8GB - 8918 
A20-OLinuXino-MICRO-s16MB - 9231 
T2-OLinuXino-MICRO-IND - 9223 
T2-OLinuXino-MICRO-s16MB-IND - 9235 
T2-OLinuXino-MICRO-e4GB-IND - 9227 
A20-SOM-n4GB - 4673 
A20-SOM - 7664 
A20-SOM-IND - 8849 
A20-SOM-n8GB - 8922 
A20-SOM-e16GB - 9155 
A20-SOM-e16GB-IND - 9148 
T2-SOM-IND - 9259 
A20-SOM204-1G - 8991 
A20-SOM204-1Gs16Me16G-MC - 8958

=> olinuxino config write 9166 k

Erasing EEPROM configuration...
Writting EEPROM configuration...
Writting MMC configuration...

=> saveenv

Saving Environment to EXT4... Recovery required
update journal finished
done
OK

=> reset

Shrinking the Penguins or How Remy van Elst shrink our Debian images to just 177MB size!

ping

Building Linux images is magic, we still learn … When we make the Linux images for Olinuxino we want to put the maximal functionality and include in everything we can think of so our customers do not have to worry to build custom kernels etc for different modules and USB sticks, unfortunately this comes to it’s price … huge files for download and write on the SD cards.

Remy van Elst set his goal how small he can shrink our images and he did remarkable job which blogged here.

Following what he did was quite educational at least for us!

For instance we never knew apt-lists contain 100MB of info which anyone can easily download with apt-get update instead to put in the SD card image 🙂 but you learn while you are live!

Great job Remy!

Now the small images lovers can download just 177MB basic image for LIME2.

We are taking notes and will make srink images for all our boards as alternative to the (we have everything fat) images we have now on our server for download!

Android 4.2.2 image for A20-OLinuXino-LIME

android-icon

NAND Flash image for Android 4.2.2 with 7″ LCD 800×600 pixels

NAND Flash image for Android 4.2.2 with 10″ LCD 1024×600 pixels

4GB SD-card image for Android 4.2.2 with 7″ LCD 800×600 pixels

Building Debian Linux bootable SD card with hardware accelerated video decoding and Kernel 3.4 for A10-OLinuXino-LIME

Image

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

For problems around u-boot use Linux-Sunxi mailing list at Google Groups: https://groups.google.com/forum/#!forum/linux-sunxi

First let’s make the directory where we will build the A10-OLinuXino-Micro 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

The Allwinner Linux-Sunxi community Kernel is maintained by Alejandro Mery aka mnemoc on Freenode irc. You can find him in #linux-sunxi or #olimex channel, if something is broken with the Linux Kernel you can contact him or use http://linux-sunxi.org/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 ralated 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 and boot.scr 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 file

# cp script.bin /mnt/sd

boot.scr contains your needed uboot commands for loading script.bin, kernel. initrd (optional), setting kernel parameters and booting.
We offer the boot.scr file ready to use but if you whant to change it you can then read https://github.com/linux-sunxi/u-boot-sunxi/wiki

download the boot.scr

# cp boot.scr /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_2_release.tgz

mount your sd card EXT3 FS partition:

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

and unarchive the rootfs

# tar xzvf a10-olinuxino-lime_2_release.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-Lime

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

default username/password is : root / olimex

Prebuild image is available for download at: https://drive.google.com/file/d/0B-bAEPML8fwlZWMtZHZCNVNoYTQ/edit?usp=sharing

Linux shell script create basic Debian image for A20-OLinuXino-MICRO automatically

Image

Jens Thiele made script which create basic debian image for OLinuXino-A20-MICRO

You can download the script from https://www.karme.de/olimex/olinuxino-a20-micro-image-builder

How to make bootable SD card with Debian Linux for A20-OLinuXino-MICRO based on Kernel 3.4

debian_logo

Linux-Sunxi is changing the 3.4 Kernel with amazing speed, about 20-30 patches apply every day, few days ago we made our Debian image3 based on 3.4.53 and now few days later the kernel is 3.4.61+ so we blog based on this snapshot but if you try few days later things may change again. From the patches I see the development is focused on adding CedarX (VPU acceleration), Mali400 GPU and NAND support, and cleaning old code.

1. Setup of the toolchain

We use Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2+deb7u2 i686 GNU/Linux on our server to generate the images, it may or it may not work on other distributions if you follow the instructions below.

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 A20 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 A20-OLinuXino-Micro linux:

# mkdir a20_kernel_3.4/
# cd a20_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 OLinuXino-A20-Micro board u-boot is tested with the next branch:

# git rev-parse --verify HEAD
3d2fc4e8ff764209a8249c3b52dc937f3a106a7f

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 A20-OLinuXino_MICRO 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/a20_kernel_3.4/#

3. Building kernel sources for Olinuxino-A20-Micro

The Allwinner Linux-Sunxi community Kernel is maintained by Alejandro Mery aka mnemoc on Freenode irc. You can find him in #linux-sunxi or #olimex channel, if something is broken with the Linux Kernel you can contact him or use http://linux-sunxi.org/Mailing_list

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

# git rev-parse --verify HEAD
8388cf06936aaf05342fb912ed6fc1a3b04e5afb

You can download the kernel sources using the following command:

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

After the download go to the kernel directory

# cd linux-sunxi/

Here you need from a20 configuration file – olinuxinoa20_defconfig. The file contains all kernel module settings.

Download olinuxinoa20_defconfig https://docs.google.com/file/d/0B-bAEPML8fwldEVvU1hCZ29DODQ/edit?usp=sharing

then copy olinuxinoa20_defconfig file to configs directory:

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

and make:

# make ARCH=arm olinuxinoa20_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 some patches which are still not merged in 3.4:

the first patch is related with PWM:

download the patch sunxi-pwm.patch from https://docs.google.com/file/d/0B-bAEPML8fwlLVRucUJwamFQWHc/edit?usp=sharing

and apply the patch:

# patch -p0 < sunxi-pwm.patch

The second patch is realted with I2C speed and it is not mandatory. 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 from https://docs.google.com/file/d/0B-bAEPML8fwlbnFyVnZHczJjVDQ/edit?usp=sharing

and apply the patch:

# patch -p0 < sunxi-i2c.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.61+
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.61+

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

  5. 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/a20_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/sdg bs=1024 seek=8

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

You should be in the directory below

/home/user/a20_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 file from https://docs.google.com/file/d/0B-bAEPML8fwlbENYRHVJVXhrUmM/edit?usp=sharing

# 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/a20_kernel_3.4/

download debian rootfs – debian_34_fs.tgz from https://docs.google.com/file/d/0B-bAEPML8fwlZ3E1SnVNMDk4d2s/edit?usp=sharing

mount your sd card EXT3 FS partition:

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

and unarchive the rootfs

# tar xzvf debian_34_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/a20_kernel_3.4/linux-sunxi/out/lib/modules/ to the new debian file system
# rm -rf /mnt/sd/lib/modules/3.4.43+/
# 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.61+/ /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 A20-OLinuXino-Micro

Note that if you want to use the Olimex’s USB-WIFI module(https://www.olimex.com/Products/Modules/Ethernet/MOD-WIFI-RTL8188)
you need to install realtek firmware

for example:

connect LAN cable to the board

# dhclient eth0
# apt-get install firmware-realtek

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

default username/password is : root / olimex

The ready made image-4 is here:

https://docs.google.com/file/d/0B-bAEPML8fwleDJMaG5reWZZeDQ/edit?usp=sharing

Aside

Previous Older Entries