[Kernel] 3.4.29+ for A13 MICRO board with serial, lan, wifi, and uvc drivers.

Started by iso9660, February 01, 2013, 02:06:15 PM

Previous topic - Next topic

iso9660

0.- Meet the prerequisites (compilation tools, etc):
sudo apt-get install gcc-arm-linux-gnueabihf ncurses-dev uboot-mkimage build-essential git

1.- Download the kernel branch sunxi-3.4:

git clone https://github.com/linux-sunxi/linux-sunxi.git kernel
cd kernel
git checkout sunxi-3.4


2.- In the recently created kernel folder create the file arch/arm/configs/a13om_defconfig
with the contents at a13_olinuxino_micro_defconfig_full. This defconfig has usb serial drivers, wifi, lan, and uvc support.

3.- Create a script with the code below and execute it to compile the kernel:

#!/bin/bash
__ARCH=arm
__CROSS_COMPILE=arm-linux-gnueabihf-
__KBUILD_DEBARCH=arm

echo "Args = ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE}"
rm -rf deploy
mkdir deploy
mkdir deploy/fs
make mrproper
make -j5 ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} a13om_defconfig
make clean
make -j5 ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} menuconfig
make -j5 ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} dep
make -j5 ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} uImage
make -j5 ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} modules
make ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} INSTALL_MOD_PATH=deploy/fs modules_install
make ARCH=${__ARCH} CROSS_COMPILE=${__CROSS_COMPILE} INSTALL_FW_PATH=deploy/fs/lib/firmware firmware_install
cp .config deploy/fs/a13_olimex_micro_defconfig
cp arch/arm/boot/uImage deploy/fs/uImage
cd deploy/fs
tar czf ../linux.tar.gz *
cd ../..


4.- When the compilation finish there will be created the file deploy/linux.tar.gz.
This file should be untared in the / path of the second partition of the SD
card containing the A13_Micro_Debian_first_preliminary_release.img image that
you should have  written in a SD card beforehand.
Then in the first partition you should copy the files a13_olimex_micro_defconfig
and uImage that were untared in the / path of the second partition.

5.- Disconect the power and the serial port of the MICRO and reconnect them again.
If you don't do this the board will not propertly load the new kernel (I don't know why).

jeroends

Excellent tutorial and works (almost) like a charm. Almost because I had to disable the "Suspend to RAM and standby" feature, it simply wouldn't compile and caused a make error.

Maybe nice to notice that some prerequisites are needed if you're starting the first time compiling the kernel (those can be found in de wiki unther the compiling for the "normal" a13 board).

Question: you don't happen to know how to get an spi userspace device? I enabled it by enabling the experimental drivers, but no spi device is created (yet "/sys/class/spi_master/spi2") is created).

iso9660

Quote from: jeroends on February 04, 2013, 04:46:43 PM
Maybe nice to notice that some prerequisites are needed if you're starting the first time compiling the kernel (those can be found in de wiki unther the compiling for the "normal" a13 board).

Added prerequisites.

Quote from: jeroends on February 04, 2013, 04:46:43 PM
Question: you don't happen to know how to get an spi userspace device? I enabled it by enabling the experimental drivers, but no spi device is created (yet "/sys/class/spi_master/spi2") is created).

No, I'm sorry, but maybe you could get some help here:
https://groups.google.com/forum/#!forum/linux-sunxi

iso9660

Quote from: jeroends on February 04, 2013, 04:46:43 PM
Question: you don't happen to know how to get an spi userspace device? I enabled it by enabling the experimental drivers, but no spi device is created (yet "/sys/class/spi_master/spi2") is created).

I've converted script.bin to a .fex file and I discovered that spi seems to be disabled on boot

...
[spi2_para]
spi_used = 0
...


jeroends

QuoteI've converted script.bin to a .fex file and I discovered that spi seems to be disabled on boot

Code: [Select]
...
[spi2_para]
spi_used = 0
...

Unfortunatly I already went that way, I also added:

[spi_devices]
spi_dev_num = 1


Thanks anyway, I'll keep googling untill I got it working

lordlothar

Tried to follow the steps, but always exits with error:

drivers/video/sunxi/disp/OSAL_Pin.c:24:50: error: ../../../../power/axp_power/axp-gpio.h: No such file or directory
drivers/video/sunxi/disp/OSAL_Pin.c: In function 'OSAL_GPIO_Request':
drivers/video/sunxi/disp/OSAL_Pin.c:37: error: implicit declaration of function 'axp_gpio_set_io'
drivers/video/sunxi/disp/OSAL_Pin.c:39: error: implicit declaration of function 'axp_gpio_set_value'
drivers/video/sunxi/disp/OSAL_Pin.c: In function 'OSAL_GPIO_DevREAD_ONEPIN_DATA':
drivers/video/sunxi/disp/OSAL_Pin.c:126: error: implicit declaration of function 'axp_gpio_get_value'
make[3]: *** [drivers/video/sunxi/disp/OSAL_Pin.o] Error 1
make[2]: *** [drivers/video/sunxi/disp] Error 2
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2
cp: cannot stat `arch/arm/boot/uImage': No such file or directory


iso9660

Quote from: lordlothar on February 06, 2013, 04:43:11 AM
Tried to follow the steps, but always exits with error:

drivers/video/sunxi/disp/OSAL_Pin.c:24:50: error: ../../../../power/axp_power/axp-gpio.h: No such file or directory
drivers/video/sunxi/disp/OSAL_Pin.c: In function 'OSAL_GPIO_Request':
drivers/video/sunxi/disp/OSAL_Pin.c:37: error: implicit declaration of function 'axp_gpio_set_io'
drivers/video/sunxi/disp/OSAL_Pin.c:39: error: implicit declaration of function 'axp_gpio_set_value'
drivers/video/sunxi/disp/OSAL_Pin.c: In function 'OSAL_GPIO_DevREAD_ONEPIN_DATA':
drivers/video/sunxi/disp/OSAL_Pin.c:126: error: implicit declaration of function 'axp_gpio_get_value'
make[3]: *** [drivers/video/sunxi/disp/OSAL_Pin.o] Error 1
make[2]: *** [drivers/video/sunxi/disp] Error 2
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2
cp: cannot stat `arch/arm/boot/uImage': No such file or directory


There was an errata in the instructions I provided. The kernel branch is stage/sunxi-3.4.
Be careful to get that branch and pull the last changes after cloning the repo:

git clone https://github.com/linux-sunxi/linux-sunxi.git kernel
cd kernel
git checkout stage/sunxi-3.4
git pull


At last try to compile without adding more modules, then if you need it add other drivers.

jeroends

QuoteTried to follow the steps, but always exits with error:

That's the reason why I removed
Quote"Suspend to RAM and standby"

Since the micro doesn't have a standby mode, this isn't really needed.
Later on today I'm going to try something else to get the spi userspace device enabled. Going to try to add some board info for the "spidev" in the fex file and driver code.
ex for fex file:
[spi_board0]
modalias = "spidev"
max_speed_hz = 20000000
bus_num = 2
chip_select = 0
mode = 0


lordlothar

I also removed Suspend but it didn't work at first, but got it working at last! So, thank you very very much iso9660! I actually had also to enable experimental features on menuconfig, because my usb adapter uses atheros9170 chipset which was not supported by default at you configuration, but anyway, at last it works! Thanks again!!

sandro

I have this errors when I try to recompile it:

include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
include/asm-generic/gpio.h:221:2: error: implicit declaration of function '__gpio_get_value' [-Werror=implicit-function-declaration]
include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
include/asm-generic/gpio.h:227:2: error: implicit declaration of function '__gpio_set_value' [-Werror=implicit-function-declaration]
drivers/spi/spi_sunxi.c: In function 'spi_sunxi_register_spidev':
drivers/spi/spi_sunxi.c:1836:2: error: implicit declaration of function 'gpio_request' [-Werror=implicit-function-declaration]
drivers/spi/spi_sunxi.c:1837:3: error: implicit declaration of function '__gpio_to_irq' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors


Can you help to solve it?
Thanks

voelker

add

CONFIG_GPIOLIB=y

to arch/arm/config/a13om_defconfig

(worked for me)

iso9660

Quote from: voelker on April 24, 2013, 12:12:49 PM
add

CONFIG_GPIOLIB=y

to arch/arm/config/a13om_defconfig

(worked for me)

Thanks, I've updated the config file in the instructions to allow to compile the kernel propertly.

chuck_norris

Thanks for this, works pretty well.

But this defconfig don't support any lcds, right?. Anybody knows the kernel modules to have lcd support?

pulpo

Anybody knows where I can find the A13_Micro_Debian_first_preliminary_release.img?
It seems that the only available image nowadays is: A13_Micro_Debian_1GHz_GPIO_100kHz_I2C_WIFI_USB_LAN_without_X_and_touch_second_release.img which has a 3.0.52+ kernel and is described as A13-OLinuXino-MICRO Debian 4GB SD-card image release-2.