📜 ⬆️ ⬇️

Installing Mono 3 on the SoC of the Allwinner A10 / A20 family, using the example of Cubieboard2

Hello,

This article contains information from various sources on how to transfer Cubieboard motherboards from the category of useless toys. In the debugging platform for advanced C # developer.

This is Linux, these are hardcore babes

')
What we need is an SD card of at least 2 GB.
And the actual device itself, in my case, is Cubieboard2

First you need an already installed and working system on Nand. In my case, it was lubuntu-server-13.08-v1.06 . Since from there you will need one small, but very important file. More this system is not used.
If you want to write something like “Hello C # world on Linux”, then this is enough for you, since this system includes a package based on mono version 2.10.8.1. Unfortunately, in this version there are several unpleasant bugs that do not allow you to do something more serious.
And who said that it would be easy, it ... Actually, something I already repeat.

Therefore, we continue.
Here: https://romanrm.net/a10/debian download the installation for your SoC'a.
Why this one? Because it is one of the few where the system is installed at the required minimum, without a heap of initially unnecessary packages.

Unpack and write it to the SD card.
Under Linux, this can be done with a single command: bzip2 -dc a20-debian-server-2gb * .bz2> / dev / sdX
Where / dev / sdX is the path to your SD card.

Under Windows, you can unpack, for example, using 7Zip , and write to an SD card using win32diskimager .

We insert the SD card into the device and boot. For a special type of device, such as the MK802, additional steps are needed to install the bootloader, but I did not have to do this.

You need to have local access to the device, for example, a monitor + keyboard, or I used the USB-UART TTL 3.3V adapter, parameters 115200/8 / N / 1. Since the network is currently not working yet.
Log into the system name / password: root / password

We mount our Nand and copy the smallest, but very important file from there.
cp /boot/script.bin /boot/script.bak mount /dev/nanda /mnt cp /mnt/script.bin /boot/ umount /dev/nanda sync 

In order not to look for a device every time over an incomplete home network, as in devices assembled on the A20, the developers did not bother to assign a liquid MAC address to the device, and after each reboot it is generated randomly, respectively, the DHCP server assigns a different IP.

We assign the following to it in the / etc / network / interfaces file:
 auto lo iface lo inet loopback auto eth0 # for DHCP #iface eth0 inet dhcp # hwaddress ether c0:b0:c0:a8:1:f5 # Static IP iface eth0 inet static hwaddress ether c0:bo:c0:a8:1:17 address 192.168.1.23 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 nameserver 192.168.1.1 

We generate new keys for the SSH server, change the root password
 rm /etc/ssh/ssh_host_* dpkg-reconfigure openssh-server passwd reboot 

After the reboot, you can connect to the system with our favorite SSH client.

We update the system to the current state, set the locales and time
 apt-get update aptitude dist-upgrade dpkg-reconfigure locales dpkg-reconfigure tzdata 

If you use an SD card larger than 2GB, then it makes sense to expand the data section to the entire card.
This is done as follows, using the example of a re-partitioned disk:
 root@debian:/dev# fdisk /dev/mmcblk0 Command (m for help): p Disk /dev/mmcblk0: 8018 MB, 8018460672 bytes 4 heads, 16 sectors/track, 244704 cylinders, total 15661056 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: 0x000cb560 Device Boot Start End Blocks Id System /dev/mmcblk0p1 2048 127071 62512 e W95 FAT16 (LBA) /dev/mmcblk0p2 131072 15661055 7764992 83 Linux 

We look where we have the 2nd section. It is important to keep the starting address. In my case it was 131072.

delete the data section, do not worry, we do not physically delete them, even if something goes wrong at this moment. Nothing bad will happen. Since the data is not recorded to disk yet.
 Command (m for help): d Partition number (1-4): 2 

Create a new section
 Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): Using default value 2 First sector (127072-15661055, default 127072): 

Here it is important not to make a mistake and disagree with the default values, but to enter the previously recorded value of the first sector of the section.
 First sector (127072-15661055, default 127072): 131072 Last sector, +sectors or +size{K,M,G} (131072-15661055, default 15661055): Using default value 15661055 

We check that everything is correct and record the changes in the partition table. A reboot is required.
 Command (m for help): p Disk /dev/mmcblk0: 8018 MB, 8018460672 bytes 4 heads, 16 sectors/track, 244704 cylinders, total 15661056 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: 0x000cb560 Device Boot Start End Blocks Id System /dev/mmcblk0p1 2048 127071 62512 e W95 FAT16 (LBA) /dev/mmcblk0p2 131072 15661055 7764992 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. 

Now you need to actually tell the system that it can use all the free space under the partition.
resize2fs / dev / mmcblk0p2
And check
 root@debian:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 7.3G 746M 6.3G 11% / ....skip.... 


Uh, now the fun begins.
Since there is no official port for armv7l, at least when trying to install, reports that mono-runtime is not in the list of available packages. We need an experimental version.

First we need to transfer the system from a stable wheezy branch to sid + experimental.
We bring the file /etc/apt/sources.list to the following form
 deb ftp://ftp.debian.org/debian experimental main deb ftp://ftp.debian.org/debian sid main contrib non-free 

Further, everything is standard
 apt-get update apt-get dist-upgrade reboot 

Well, actually because of what all this fuss was started
 root@debian:~#apt-get -t experimental install mono-devel ....skip.... root@debian:~# uname -a Linux debian 3.4.79-r0-s20-rm2+ #54 SMP Tue Feb 18 01:09:07 YEKT 2014 armv7l GNU/Linux root@debian:~t# mono -V Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: normal Notifications: epoll Architecture: armel,vfp+hard Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen 

Source: https://habr.com/ru/post/215399/


All Articles