Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: isidoro on July 29, 2013, 05:40:51 PM

Title: ReCompile Kernel for Debian Image
Post by: isidoro on July 29, 2013, 05:40:51 PM
As I've got two A20 (one with flash and another without) I've succefully tried debian image .
Unfortunately, I was not able to find config file that belongs to current kernel 3.0.0 (and cat /proc/config.gz gave no outputs). It is possible to have sources and config file in order to recompile and to make support for others device I own?
Thanks a lot,
Gianni

Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on July 29, 2013, 06:00:41 PM
Hello Gianni,

in this thread https://www.olimex.com/forum/index.php?topic=1514.0 , they say a "regular" sunxi kernel is not available yet, so they worked on the Allwinner kernel which is included in the A20-SDK (there's a link in the wiki).

From dmesg, I see a lot of things are quite preliminary yet: for one thing, actual clock is 912 MHz and not 1.0 GHz, and there are other issues to be ironed out (drivers not fully working etc.).

It's still a very young board without mature support, but it's quite exciting and looks very promising.  :)

Let's keep this thread updated while we make progress!

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on July 29, 2013, 06:21:52 PM
[they say a "regular" sunxi kernel is not available yet, so they worked on the Allwinner kernel which is included in the A20-SDK (there's a link in the wiki).]

Yes Fernando,
I agree , all  that I want is to recompile kernel with exactly the same config file they just used, and , If working, add only few devices (i.e. usb wifi I own) or enable multiple serial ports (now, thought A20 suppports up to 8 ports, kernel admits only the ttyS0).

In the meanwhile, let's enjoy the dual core!
Gianni
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on July 29, 2013, 06:46:55 PM
I also want to recompile the kernel to exclude some modules and drivers (need a faster boot).

Tonight I'll download the SDK and will report. Unfortunately it's a kernel for Android so I don't think it's going to be as straightforward as I'd like.  ::)
Title: Re: ReCompile Kernel for Debian Image
Post by: olimex on July 29, 2013, 08:26:06 PM
I asked Dimitar to make repo with the kernel and config, its quite lot of work he has done to make the normal Android kernel to work with touchscreen, gpios etc no need to reinvent the wheel
meantime linux-sunxi kernel seems to have some progress I saw Fedora distribution announcement which supports A20 but didnt try it yet https://groups.google.com/forum/#!msg/linux-sunxi/PLgUj-KefKQ/4soi2CUQtyMJ
Title: Re: ReCompile Kernel for Debian Image
Post by: Lurch on July 29, 2013, 08:56:46 PM
Thanks for the update.  You guys are really earning your vacation next week!
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on July 30, 2013, 01:50:35 AM
Impressive!
Thanks Olimex!!  ;)
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on July 31, 2013, 12:31:48 PM
Quote from: olimex on July 29, 2013, 08:26:06 PM
no need to reinvent the wheel
I agree, so I hope Dimitar will release sources & .config
Quote from: olimex on July 29, 2013, 08:26:06 PM
meantime linux-sunxi kernel seems to have some progress I saw Fedora distribution announcement which supports A20 but didnt try it yet https://groups.google.com/forum/#!msg/linux-sunxi/PLgUj-KefKQ/4soi2CUQtyMJ
I'havent tried yet Fedora, but if someone will report it works, it will be usefull to share just the ready-to-sd image for the A20.
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on July 31, 2013, 01:25:20 PM
I'd much prefer to stick to Debian.

Problem is, as for now I can't start my project because the kernel does not provide ALSA MIDI Sequencer (no built-in driver, no external module).
So as long as I can't recompile the kernel (starting from a working .config of course) I don't have MIDI and can't even start to build anything.  :'(

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on July 31, 2013, 04:20:40 PM
This is the defconfig used for the new Fedora 19r1 kernel.

https://www.amazon.com/clouddrive/share?s=Q_e8WjzMQXgukJNhcDDoaw (https://www.amazon.com/clouddrive/share?s=Q_e8WjzMQXgukJNhcDDoaw)

Now we just need the kernel source.  ::)
Unfortunately, it looks like the patches have not been integrated in sunxi-3.4 kernel yet.   :(

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: giovanni.v on August 01, 2013, 10:59:35 AM
Quote from: XFer on July 31, 2013, 04:20:40 PM
Now we just need the kernel source.  ::)
Unfortunately, it looks like the patches have not been integrated in sunxi-3.4 kernel yet.   :(

This one from the cubieboard community could be interesting:
- https://github.com/patrickhwood/linux-sunxi/tree/sunxi-3.3-cb2
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 01, 2013, 11:09:24 AM
Quote from: XFer on July 31, 2013, 04:20:40 PM
Now we just need the kernel source.  ::)


here's source:
https://github.com/jwrdegoede/linux-sunxi/archive/fedora-19-r1.zip
this is repo:
https://github.com/jwrdegoede/linux-sunxi/tree/fedora-19-r1
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 02, 2013, 02:21:28 AM
The git clone I just got has serious issues (can't even unpack properly, symlink issues).
I'll try the previous zip archive.  :(
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 02, 2013, 03:40:42 AM
I have to give up. :(
Make menuconfig does not work (maybe it's incompatibile with the ncurses version I have on Ubuntu 13.04), make defconfig can't be done since there's no default configuration for sun7i (Allwinner A20) nor Olinuxino A20, and the values in the .config I found and linked are strange at best, so I don't trust them.

Let's wait Dimitar to host the repo with his kernel!  :)

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 02, 2013, 04:27:20 PM
this is a good config to start:

https://github.com/archlinuxarm/PKGBUILDs/blob/054be56ac1e959031d5280154548b232692ca3ba/core/linux-sun7i/config

it is based on 3.3.0 branch,
so sources can be picked here:
https://github.com/patrickhwood/linux-sunxi/archive/sunxi-3.3-cb2.zip

Therefore, to unzip, I suggest to use 7-zip:

:# 7z x sunxi-3.3-cb2.zip

(if unsure, apt-get install p7zip-full)
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 02, 2013, 08:31:43 PM
Right now, I'm trying to have 3.4 branch working.
I'm pulling sunxi-3.4, they merged in a sun7i-defconfig now, hopefully it'll compile.
Title: Re: ReCompile Kernel for Debian Image
Post by: vinifr on August 04, 2013, 06:52:05 AM
Hi,

linux-sunxi into branch stage/sunxi-3.4 already includes several patches to A20 https://github.com/linux-sunxi/linux-sunxi/tree/stage/sunxi-3.4 (https://github.com/linux-sunxi/linux-sunxi/tree/stage/sunxi-3.4)

https://github.com/linux-sunxi/linux-sunxi/blob/stage/sunxi-3.4/arch/arm/configs/sun7i_defconfig (https://github.com/linux-sunxi/linux-sunxi/blob/stage/sunxi-3.4/arch/arm/configs/sun7i_defconfig)
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 04, 2013, 11:47:30 AM
I pulled sunxi-3.4 (not the stage version) and it has a sun7i_defconfig.
I managed to compile everything, uImage and modules, but the A20 doesn't boot, does not even start writing a kernel log.
My board is headless so I have an hard time debugging kernel-related issues (I don't have the time to look for a serial-USB cable to set up a debugging console).
I guess I'll wait for more mature kernels, or for Olimex own repository (their kernel works fine, but it's incomplete).
Title: Re: ReCompile Kernel for Debian Image
Post by: vinifr on August 04, 2013, 04:44:14 PM
Only stage/sunxi-3.4 has Hans' and hramrach's patches to A20, look sun7i: https://github.com/linux-sunxi/linux-sunxi/commits/stage/sunxi-3.4 (https://github.com/linux-sunxi/linux-sunxi/commits/stage/sunxi-3.4)

Do you tried it? ;)
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 04, 2013, 09:57:26 PM
The kernel I downloaded has A20 patches (I contacted Hans directly), despite not being the stage branch.
So that's not the issue. Anyway I'm tired of trying any possible kernel. I'll wait for Dimitar to return from holidays, he should publish source and config then. :)
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 05, 2013, 10:53:05 AM
Quote from: XFer on August 04, 2013, 11:47:30 AM
I pulled sunxi-3.4 (not the stage version) and it has a sun7i_defconfig.
I managed to compile everything, uImage and modules, but the A20 doesn't boot, does not even start writing a kernel log.
My board is headless so I have an hard time debugging kernel-related issues (I don't have the time to look for a serial-USB cable to set up a debugging console).
I guess I'll wait for more mature kernels, or for Olimex own repository (their kernel works fine, but it's incomplete).
as in new 3.4 kernel they modifed machine id for sun7i
(see here http://linux-sunxi.org/Cubieboard2_wheezy_image and here http://androtab.info/cubieboard2/)
your uEnv.txt must begin with this line:
machid=0x10bb

meanwhile for kernel 3.3 machid remain 0xf35, but as it is saved in u-boot env, it is not necessary.




Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 06, 2013, 01:41:10 AM
Quote from: isidoro on August 02, 2013, 04:27:20 PM
https://github.com/patrickhwood/linux-sunxi/archive/sunxi-3.3-cb2.zip

just compiled with gcc  4.6.3, this is config:
http://pastebin.com/e3yPQ7dp


In the meanwhilte I' studiyng on how to put binary file (uImage and modules ) on amazon or google doc.
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 06, 2013, 01:03:40 PM
That's great, Gianni!

Could you please share your uEnv.txt and script.fex?
I suspect my problems lie there. :(

Thanks!
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 06, 2013, 03:28:36 PM
Quote from: XFer on August 06, 2013, 01:03:40 PM
Could you please share your uEnv.txt and script.fex?
I suspect my problems lie there. :(

Thanks!
uEnv.txt:
console=ttyS0,115200
root=/dev/mmcblk0p2
loglevel=8
panic=10


fex file untouched , default script.bin.


Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 06, 2013, 06:05:00 PM
That's really nasty! :(
I temporary attached an HDMI screen: my kernel (now from stage/sunxi-3.4) starts and shows the login prompt.
But does not load the network, who knows why.
So being an headless board, I can't do anything. :(
The A20 Ethernet driver is built in the kernel, not even as a module, so it can't be a module loading issue.
It's going to be a long and painful debug!  :P

Thanks for your support Gianni. Eventually I'll resort to your already built kernel if I can't sort this out.

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 06, 2013, 08:09:57 PM
Quote from: XFer on August 06, 2013, 06:05:00 PM
That's really nasty! :(
I temporary attached an HDMI screen: my kernel (now from stage/sunxi-3.4) starts and shows the login prompt.
But does not load the network, who knows why.
So being an headless board, I can't do anything. :(
The A20 Ethernet driver is built in the kernel, not even as a module, so it can't be a module loading issue.

Fernando
Please, once login , do a : dmesg | grep eth
Or dmesg | grep wemac .
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 06, 2013, 08:27:23 PM
If I could login, I'd already done that. :)

I have no USB keyboard to attach to it (not even a HDMI screen, actually, that was a brief test at a friend's house), so I can't login without a working Ethernet.
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 07, 2013, 06:23:52 PM
Latest news  :)

I dropped my efforts on sunxi-3.4 and instead focused on the 3.3cp2 suggested by Isidoro.

I succesfully recompiled a trimmed down, optimized kernel that actually works, and allows to login via ssh in 25 seconds from poweroff. :)
And this is with a not particularly fast 8GB Sandisk microSD (16 MB/s tested with hdparm).
Kernel itself boots in 13 seconds.

So a big THANKS to everyone and to Isidoro in particular: grazie Gianni! :)

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 09, 2013, 01:03:39 PM
Looks like USB_HOST does not fully work on 3.3.0-CB2: only keyboards and mices work (but my MIDI keyboard does not: connects and disconnects in a loop).

I've seen in the sunxi mailing list that they are reworking all the USB Host stuff in 3.4, but I'm not able to backport their patches in 3.3.0.

Anyone tried the latest 3.4 cb2? Does it work on our Olinuxino A20 boards? Any caveats?

Thanks!

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 09, 2013, 04:12:49 PM
Reply to myself: tried 3.4cb2, but audio does not work. :(

sunxi audio driver fails with "audio codec_wakeup request gpio fail!"
Title: Re: ReCompile Kernel for Debian Image
Post by: PaceyIV on August 09, 2013, 08:50:07 PM
Quote from: isidoro on August 06, 2013, 01:41:10 AM
In the meanwhilte I' studiyng on how to put binary file (uImage and modules ) on amazon or google doc.


With google docs is much easy! Upload and share!
I'm downloading the source code you provided with and also your config.

1. Have you enabled sata support? I saw that CONFIG_SATA_PMP=y and CONFIG_SW_SATA_AHCI_PLATFORM=y are setted but not the CONFIG_SATA_AHCI_PLATFORM
2. About paranoid, to disable this features (I make a server with the Olimex A20!) I just need to set to no CONFIG_ANDROID_PARANOID_NETWORK=y ? And CONFIG_MMC_PARANOID_SD_INIT=y ?
Title: Re: ReCompile Kernel for Debian Image
Post by: PaceyIV on August 10, 2013, 12:21:28 AM
I share my kernel image, modules, config and uEnv.txt on gdrive ad link https://drive.google.com/folderview?id=0BzF5qrRdBNDbR0ZCdkJ3LWJCWEE&usp=sharing

It's the same config provided by isidoro
I only disable CONFIG_ANDROID_PARANOID_NETWORK=y
More info about this features at link http://elinux.org/Android_Security
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 19, 2013, 05:29:47 PM
Quote from: PaceyIV on August 10, 2013, 12:21:28 AM
I share my kernel image, modules, config and uEnv.txt on gdrive ad link https://drive.google.com/folderview?id=0BzF5qrRdBNDbR0ZCdkJ3LWJCWEE&usp=sharing

It's the same config provided by isidoro
I only disable CONFIG_ANDROID_PARANOID_NETWORK=y
More info about this features at link http://elinux.org/Android_Security
I'll take a look at .config and test your kernel as soon as I can (I'm on holidays this days).
My future effort will focus on multiple uart and sunxi touch screen module tuning
Title: Re: ReCompile Kernel for Debian Image
Post by: WELK on August 23, 2013, 07:52:56 PM
Hello everyone.
i would like to know which toolchain you use for crosscompile software for Allwinner A20 Processor
thanks in advance
Title: Re: ReCompile Kernel for Debian Image
Post by: PaceyIV on August 23, 2013, 09:39:01 PM
From a Debian 7.1 x86 machine


$ sudo apt-get install build-essential libncurses5-dev u-boot-tools qemu-user-static debootstrap git binfmt-support libusb-1.0-0-dev pkg-config

$ sudo nano /etc/apt/sources.list

deb http://www.emdebian.org/debian/ wheezy main
deb http://www.emdebian.org/debian/ sid main

$ sudo apt-get install emdebian-archive-keyring
$ sudo apt-get update
$ sudo apt-get install gcc-4.6-arm-linux-gnueabihf
$ cd /usr/bin
$ sudo for i in arm-linux-gnueabi*-4.6 ; do ln -s $i ${i%%-4.6} ; done

$ make ARCH=arm menuconfig

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 23, 2013, 11:51:19 PM
I cross compile from Ubuntu 13.04.
My toolchain is gcc-4.7-arm-linux-gnueabihf (gcc version 4.7.2); better than 4.6, because it has better optimizations for the ARM Cortex A7 (Allwinner A20).

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: PaceyIV on August 24, 2013, 01:51:53 PM
Thanks for the info!

About gcc optimization, have you seen some problems? When I compile some programs directly on the board I have to limit the optimization with only "CFLAGS=-g -Os" "CXXFLAGS=-g -Os" otherwise something doesn't work.
On the board I use gcc version 4.6.3 (Debian 4.6.3-14)
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 24, 2013, 02:01:13 PM
No I don't have any issue with GCC 4.7.2.

Apart from kernel compiling, I use

CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -ffast-math -Ofast"

and get very nice performances.

For kernel building, I stick to "-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4" and leave out the other two flags.

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: WELK on August 24, 2013, 11:01:37 PM
OK thanks :D
Title: Re: ReCompile Kernel for Debian Image
Post by: KNK on August 27, 2013, 09:41:29 PM
Tried both fedora and 3.3-cb2, but there is an error while unzipping 'file name too long' for both of them and later on missing files while compiling, am i missing something?
Title: Re: ReCompile Kernel for Debian Image
Post by: XFer on August 28, 2013, 10:52:36 AM
Yes I had it too. Occurs when using unzip.
Install 7zip for Linux, it handles the .zip without issues.

Fernando
Title: Re: ReCompile Kernel for Debian Image
Post by: isidoro on August 28, 2013, 12:25:21 PM
Quote from: KNK on August 27, 2013, 09:41:29 PM
Tried both fedora and 3.3-cb2, but there is an error while unzipping 'file name too long' for both of them and later on missing files while compiling, am i missing something?

as stated few post ago:

Therefore, to unzip, I suggest to use 7-zip:

:# 7z x sunxi-3.3-cb2.zip

(if unsure, apt-get install p7zip-full)

Title: Re: ReCompile Kernel for Debian Image
Post by: KNK on August 28, 2013, 09:42:25 PM
Thanks, 7z did the job right.

P.S. I am mc fan and it uses unzip for extracting *.zip