[HowTo] Arch Linux ARM for A20-OLinuXino-(LIME|LIME2|MICRO)

Started by progmetalbg, March 12, 2015, 11:58:13 AM

Previous topic - Next topic

progmetalbg

There is already a guide in the forum for building Arch Linux ARM image for A20-OLinuXino-MICRO, but it is was modified several times in the last 18 months and meanwhile Olimex released 2 other boards based on the same SoC.
Official how-to on Arch Linux ARM site for AllWinner A20 OLinuXinos does not exist at the moment, but u-boot packages are provided for every Olimex board and sun7i linux kernel supports all AllWinner A20 based boards.
This how-to is based on http://archlinuxarm.org/platforms/armv7/allwinner/cubieboard-2

Install to a micro SD card
Replace sdX in the following instructions with the device name for the SD card as it appears on your computer (in most cases it is either /dev/sdb or /dev/mmcblk0).

1. Zero the beginning of the SD card:
dd if=/dev/zero of=/dev/sdX bs=1M count=8

2. Start fdisk to partition the SD card:
fdisk /dev/sdX
At the fdisk prompt, delete old partitions and create a new one:
Type o. This will clear out any partitions on the drive.
Type p to list partitions. There should be no partitions left.
Now type n, then p for primary, 1 for the first partition on the drive, 2048 for the first sector, and then press ENTER to accept the default last sector.
Write the partition table and exit by typing w.

3. Create and mount the ext4 filesystem:
mkfs.ext4 -m 1 /dev/sdX1
mkdir mnt
mount /dev/sdX1 mnt


4. Download and extract the root filesystem:
wget http://archlinuxarm.org/os/ArchLinuxARM-sun7i-latest.tar.gz
bsdtar -xpf ArchLinuxARM-sun7i-latest.tar.gz -C mnt
sync


5. Install the U-Boot bootloader:
5a. A20-OLinuXino-LIME

wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-lime/u-boot-sunxi-with-spl.bin
wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-lime/boot.scr -O mnt/boot/boot.scr
wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-lime/script.bin -O mnt/boot/script.bin


5b. A20-OLinuXino-LIME2

wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-lime2/u-boot-sunxi-with-spl.bin
wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-lime2/boot.scr -O mnt/boot/boot.scr
wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-lime2/script.bin -O mnt/boot/script.bin

Note: For some reason kernel module for gigabit ethernet MAC is not loaded automatically, it can be enabled that way:

echo sunxi_gmac > mnt/etc/modules-load.d/lime2.conf


5c. A20-OLinuXino-MICRO

wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-micro/u-boot-sunxi-with-spl.bin
wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-micro/boot.scr -O mnt/boot/boot.scr
wget http://archlinuxarm.org/os/sunxi/boot/a20-olinuxino-micro/script.bin -O mnt/boot/script.bin


For all boards:

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


Insert the micro SD card into the A20-OLinuXino-(LIME|LIME2|MICRO), connect ethernet, and apply power (5V for LIME/LIME2, 6-16V for MICRO).
Use the serial console or SSH to the IP address given to the board by your router. The default root password is 'root'.



Install the U-Boot package

In order to receive updates to the U-Boot bootloader, after logging into the system type:

rm /boot/script.bin

Depending on board model type one of the commands below:
pacman -Syu uboot-a20-olinuxino-lime
pacman -Syu uboot-a20-olinuxino-lime2
pacman -Syu uboot-a20-olinuxino-micro
When prompted, press y and hit enter to flash the bootloader to the SD card.
Merge any pacnew files created by the package overwriting the manually installed bootloader files.



Mainline Kernel

Install the new kernel, which will remove the linux-sun7i package:
pacman -Syu linux-armv7
Or you can try also the latest release candidate, which at the time of writing this post is 4.0.0-rc3:
pacman -Syu linux-armv7-rc
Reboot the system:
reboot
*Note that at the moment mainline kernel does not support GPU/VPU and audio, it is only useful for headless systems


davidahoward

LIME2 crash and burn on u-boot...


U-Boot SPL 2015.01-4 (Jan 27 2015 - 22:12:53)
DRAM: 1024 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2


U-Boot 2015.01-4 (Jan 27 2015 - 22:12:53) Arch Linux ARM

CPU:   Allwinner A20 (SUN7I)
I2C:   ready
DRAM:  1016 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Reserved 8192kB of RAM for Framebuffer.
HDMI connected.
Setting up a 1024x768 console.
In:    serial
Out:   vga
Err:   vga
SCSI:  SUNXI SCSI INIT
AHCI PHY power up failed.
Net:   dwmac.1c50000
data abort
pc : [<4a017aa4>]          lr : [<4a017a88>]
sp : 7f33bd28  ip : 00000074     fp : 7f33c6c0
r10: 00000002  r9 : 7f33bf00     r8 : 7f7a23a8
r7 : 4a03d16b  r6 : 4a05a89c     r5 : ffffffcb  r4 : ffffffff
r3 : 0000008b  r2 : 00000000     r1 : 4a03d16c  r0 : ffffff8b
Flags: NzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

progmetalbg

QuoteHDMI connected.
Setting up a 1024x768 console.
Try booting the board without HDMI cable connected to it and paste here the output from u-boot.

sakishrist

With linux-sun7i I could not get the integrated ethernet to work, no tools for wireless either. I ended up using a usb ethernet adapter. When I switched to latest kernel everything was good.

Anyway, it's working so thanks for the effort!

progmetalbg

Quote from: sakishrist on March 16, 2015, 07:47:09 AM
With linux-sun7i I could not get the integrated ethernet to work

Which one of the 3 boards do you have - MICRO, LIME or LIME2? I have MICRO and it is working fine with both linux-sun7i and mainline kernel. If you have LIME2 with Gigabit ethernet you can try to manually load the sunxi_gmac module with
modprobe sunxi_gmac

jmyreen

Quote from: progmetalbg on March 16, 2015, 11:14:41 AM

Which one of the 3 boards do you have - MICRO, LIME or LIME2? I have MICRO and it is working fine with both linux-sun7i and mainline kernel. If you have LIME2 with Gigabit ethernet you can try to manually load the sunxi_gmac module with
modprobe sunxi_gmac

Just a quick note: I have a LIME2 board, and can confirm that Ethernet is not working "out of the box". I didn't have time to investigate the problem any further.

progmetalbg

Quote from: jmyreen
Just a quick note: I have a LIME2 board, and can confirm that Ethernet is not working "out of the box". I didn't have time to investigate the problem any further.
Please try to load sunxi_gmac kernel module and let us know the result.
Also create a file /etc/modules-load.d/lime2.conf with contents
sunxi_gmac
On next reboot/power on this module should be automatically loaded.
If this workaround works I'll update the first post.

Gerrit

Quote from: progmetalbg on March 16, 2015, 01:27:55 PM
Quote from: jmyreen
Just a quick note: I have a LIME2 board, and can confirm that Ethernet is not working "out of the box". I didn't have time to investigate the problem any further.
Please try to load sunxi_gmac kernel module and let us know the result.
Also create a file /etc/modules-load.d/lime2.conf with contents
sunxi_gmac
On next reboot/power on this module should be automatically loaded.
If this workaround works I'll update the first post.

I can confirm both, LIME2 does not load the sunxi_gmac without any help so no ethernet after boot.
but your solution creating the file /etc/modules-load.d/lime2.conf does make it work.


progmetalbg

Quote from: Gerrit link
I can confirm both, LIME2 does not load the sunxi_gmac without any help so no ethernet after boot.
but your solution creating the file /etc/modules-load.d/lime2.conf does make it work.
Thanks!
I updated first post.

sakishrist

Quote from: progmetalbg on March 16, 2015, 11:14:41 AM
Quote from: sakishrist on March 16, 2015, 07:47:09 AM
With linux-sun7i I could not get the integrated ethernet to work

Which one of the 3 boards do you have - MICRO, LIME or LIME2? I have MICRO and it is working fine with both linux-sun7i and mainline kernel. If you have LIME2 with Gigabit ethernet you can try to manually load the sunxi_gmac module with
modprobe sunxi_gmac
Yep, it's a LIME2. After installing mainline everything works fine. Thanks again!

majesticra

What about installing arch linux to NAND? (A20-Olinuxino-LIME)

kdubious

This no longer works, http://archlinuxarm.org/os/ArchLinuxARM-sun7i-latest.tar.gz is a dead link.

Anyone have updated instructions? The ones on the ALARM site lead me to a crash after "Loading kernel"

progmetalbg

Arch Linux ARM no longer supports linux sunxi kernel 3.4 for Allwinner devices (because of issues with systemd).
I have A20-OLinuXino-MICRO, followed instructions on ALARM site: https://archlinuxarm.org/platforms/armv7/allwinner/a20-olinuxino-micro and everyting works.
I currently use it as a torrent box/home NAS and it is pretty stable, uptime is several weeks.
You can ask in Arch Linux ARM forum for assistance since all Allwinner A20 Olimex boards are supported.