====== Getting started with Olimex A20-SOM ====== Interesting links: * https://www.olimex.com/wiki/A20-SOM * http://fablab-robert-houdin.org/wiki/doku.php?id=tutoriels * http://linux-sunxi.org/Main_Page * https://github.com/linux-sunxi ===== Buildroot system ===== Based on https://github.com/mireq/buildroot-a20-olinuxino, using the sunxi u-boot and Linux kernel make a20_olinuxino_defconfig make ===== Bootable microSD ===== Make two partitions: * boot partition: FAT16, starting at offset 1MB, for u-boot.img, script.bin, uEnv.txt and uImage * linux partion: ext3 for rootfs > :!: Before running below commands be sure of which device is your to-be-formatted microSD card. In this example we take ''/dev/sdc'' . You might loose data if you run the wrong command! sudo sfdisk /dev/sdc << EOF 2048,98304,0xE,* ,,,- EOF Format the first partition in FAT16 for boot sudo mkfs.vfat -F 16 /dev/sdc1 -n boot Format the second in EXT3 for the root filesystem sudo mkfs.ext3 /dev/sdc2 -L rootfs Burn ''sunxi-spl.bin'' and ''u-boot.bin'', from //Buildroot//'s ''output/images'', at the beginning of the SD card: sudo dd if=sunxi-spl.bin of=/dev/sdc bs=1024 seek=8 sudo dd if=u-boot.bin of=/dev/sdc bs=1024 seek=32 or, equivalently, ''u-boot-sunxi-with-spl.bin'' (actually, the concatenation of ''sunxi-spl.bin'' and ''u-boot.bin''), to be found in //Buildroot//'s ''build/uboot'': sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1024 seek=8 Copy the content of the boot partition: tar -xvf rootfs.tar -C --strip=2 --wildcards './boot/*' --exclude './boot/u-boot.bin' --exclude './boot/u-boot.img' --exclude './boot/sunxi-spl.bin' --exclude './boot/u-boot-sunxi-with-spl.bin' Copy the content of the root filesystem: sudo tar xvf rootfs.tar -C --exclude 'boot' ===== Display ===== [[http://www.elecfreaks.com/wiki/index.php?title=2.2S%22_TFT_LCD:_TFT01-2.2S]] ==== SPI support ==== - Add the spi-sun7i driver support to the linux kernel: [[http://will-tm.com/spi-on-the-cubieboard2/]] and [[https://github.com/matzrh/rfm12b-linux/blob/master/spi-sun7i.patch]] - Load the spi driver: ''modprobe spi_sun7i'' ==== FBTFT support ==== [[https://github.com/notro/fbtft]] (requires spi driver to be loaded) - Add the fbtft driver support to Buildroot: [[http://lists.busybox.net/pipermail/buildroot/2015-January/116416.html]] - Load the fbtft_device driver: ''modprobe fbtft_device name=rpi-display busnum=1 gpios=reset:4,dc:5,led:6 rotate=90'' * ''rpi-display'' is associated to the 'ili9341' driver, * ''busnum=1'' refers to device ''/dev/spi1.0'', * ''gpios=...'' makes the link between the defferents signals to the actual gpios they are connected to) * ''rotate=...'' indicates the rotation angle (counter clockwise) of the screen (0, 90, 180 or 270) - Load the driver corresponding to the screen: ''modprobe fb_ili9341'' === Backlight === https://github.com/notro/fbtft/wiki/Backlight ===== Network configuration ===== ==== Ethernet ==== To enable eth0 interface, load sunxi-emac driver on the OLinuXino-Lime modprobe sunxi-emac ==== WLAN ==== === with a rt2870 chipset === Add the support for the rt2870 chipset to your system: * make sure linux-firmware is ticked in your buildroot configuration * make sure Busybox mdev is configured to support firmware hotload On target, * configure mdev as kernel hotplug sysctl -w kernel.hotplug=/sbin/mdev mdev -s * load the rt2800usb driver modprobe rt2800usb * bring up the wlan0 interface ifconfig wlan0 up === with a mt7601 chipset === == Build the driver == Download the driver sources from [[https://github.com/porjo/mt7601]] Apply the following patch: diff --git a/src/Makefile b/src/Makefile index dfe1283..b2615ab 100755 --- a/src/Makefile +++ b/src/Makefile @@ -197,11 +197,13 @@ endif ifeq ($(PLATFORM),PC) # Linux 2.6 -LINUX_SRC = /lib/modules/$(shell uname -r)/build +LINUX_SRC = # Linux 2.4 Change to your local setting #LINUX_SRC = /usr/src/linux-2.4 -LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/ -CROSS_COMPILE = +LINUX_SRC_MODULE = $LINUX_SRC/drivers/net/wireless +CROSS_COMPILE = /host/usr/bin/arm-linux- +ARCH=arm +export ARCH endif ifeq ($(PLATFORM),INTELP6) diff --git a/src/include/os/rt_linux.h b/src/include/os/rt_linux.h index 3726b9e..821e401 100755 --- a/src/include/os/rt_linux.h +++ b/src/include/os/rt_linux.h @@ -279,7 +279,7 @@ typedef struct file* RTMP_OS_FD; typedef struct _OS_FS_INFO_ { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,02,0) uid_t fsuid; gid_t fsgid; #else diff --git a/src/include/rtmp_def.h b/src/include/rtmp_def.h index 2afcb77..b69af63 100755 --- a/src/include/rtmp_def.h +++ b/src/include/rtmp_def.h @@ -75,7 +75,7 @@ #define RX_RING_SIZE 8 #endif /* INF_AMAZON_SE */ #define MAX_TX_PROCESS 4 -#define LOCAL_TXBUF_SIZE 2048 +#define LOCAL_TXBUF_SIZE 256 #endif /* RTMP_MAC_USB */ #ifdef MULTIPLE_CARD_SUPPORT diff --git a/src/os/linux/config.mk b/src/os/linux/config.mk index 531b00e..e67c864 100755 --- a/src/os/linux/config.mk +++ b/src/os/linux/config.mk @@ -1054,7 +1054,7 @@ CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -Wall -O2 -Wundef -Wstrict-prototy export CFLAGS endif -GCCVERSION = $(shell gcc -dumpversion) +GCCVERSION = $(shell $(CROSS_COMPILE)gcc -dumpversion) ifeq ($(PLATFORM),PC) ifneq (,$(findstring 2.4,$(LINUX_SRC))) where - '''' is the path to the sources of kernel for your target; e.g. ''/output/build/linux-sunxi-v3.4.104-r0'' - '''' is your buildroot output directory; e.g. ''/output'' Note that changing the ''LOCAL_TXBUF_SIZE'' define value from ''2048'' to ''256'' prevents an error to occur during the loading of your driver. Launch the compilation: $ cd src $ make and copy the generated ''src/os.linux/mt7601Usta.ko'' driver to your target. Note that the generated file is quite big (15MB)... == Load the driver == On your target: * load the driver: $ insmod mt7601Usta.ko * enable the ''ra0'' interface: $ ifconfig ra0 up ===== PWM ===== [[https://www.olimex.com/wiki/How_to_add_pwm]] ===== OpenGL ===== via the mali driver ([[http://linux-sunxi.org/Mali_binary_driver]]) To redirect the output the a non standard //framebuffer device//, define the ''FRAMEBUFFER'' environnement variable to the wanted device. THe same variable has to be used to launch a Qt5 application, instead of the normal ''QT_QPA_EGLFS_FB'' one.