Porting Android


258 posts   Page 3 of 11   1, 2, 3, 4, 5, 6 ... 11
by shawnbusker » Mon Jul 09, 2012 2:54 pm
lesderid wrote:I compiled a 3.3 kernel with Android support. It runs Debian Wheezy. Compiling ICS for ARMv5/ARMv6 might be harder though...

My email is shawnbusker@gmail.com Would you mind emailing me that kernel, I haven't been able to get a kernel to boot, but I think I have a 2.3.7 generic filesystem that should work. Also, what tutorial did you follow to patch the linux kernel with android patches? The tutorial I used, used the 3.1.9 kernel not 3.3.

Shawn
Posts: 23
Joined: Sun Jul 01, 2012 3:10 am
by lesderid » Mon Jul 09, 2012 3:39 pm
shawnbusker wrote:
lesderid wrote:I compiled a 3.3 kernel with Android support. It runs Debian Wheezy. Compiling ICS for ARMv5/ARMv6 might be harder though...

My email is shawnbusker@gmail.com Would you mind emailing me that kernel, I haven't been able to get a kernel to boot, but I think I have a 2.3.7 generic filesystem that should work. Also, what tutorial did you follow to patch the linux kernel with android patches? The tutorial I used, used the 3.1.9 kernel not 3.3.

Shawn


In version 3.3, Android specific patches were merged with the mainline kernel. I used the 3.3 RPi kernel posted earlier in this thread. But to be sure I had the latest Android patches, I extracted the patches from the 3.3 AOSP kernel (diff'ing them to mainline) and used them on the RPi kernel. It didn't fully patch all files, but I didn't bother to go through all of them because it compiled without any problems...

Here will be/is the compiled kernel: http://lesderid.net/RPi/Kernel/Android/3.3a/.
Posts: 13
Joined: Mon Jul 09, 2012 12:44 pm
Location: Mechelen, Belgium
by headlessandroid » Mon Jul 09, 2012 4:04 pm
shawnbusker wrote:I tried that tutorial and it wouldn't compile at all. I'm actually shocked it didn't work, it seemed like that tutorial would work. The command that failed was
Code: Select all
make -k -j6


If anyone has a fix or a solution let me know so I can try to compile this kernel.
Error log:
Code: Select all
shawnbusker@RPi-DEV:~/work/raspberry-pi/kernel/linux-3.1.9$ make -k -j6
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mabi=aapcs-linux"
cc1: error: unrecognized command line option "-mno-thumb-interwork"
scripts/mod/empty.c:1: error: bad value (armv5t) for -march= switch
scripts/mod/empty.c:1: error: bad value (strongarm) for -mtune= switch
make[2]: *** [scripts/mod/empty.o] Error 1
make[2]: Target `__build' not remade because of errors.
make[1]: *** [scripts/mod] Error 2
make[1]: Target `__build' not remade because of errors.
make: *** [scripts] Error 2
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mabi=aapcs-linux"
cc1: error: unrecognized command line option "-mno-thumb-interwork"
kernel/bounds.c:1: error: bad value (armv5t) for -march= switch
kernel/bounds.c:1: error: bad value (strongarm) for -mtune= switch
make[1]: *** [kernel/bounds.s] Error 1
make[1]: Target `__build' not remade because of errors.
make: *** [prepare0] Error 2
make: Target `_all' not remade because of errors.


Shawn



Shawn,

From your following post it looks like you figured it out. It certainly looked like your cross compiler didn't work.

Casey
Posts: 2
Joined: Mon Jul 09, 2012 4:01 pm
by headlessandroid » Mon Jul 09, 2012 4:07 pm
shawnbusker wrote:Yep, the cross-compiler included with the tutorial was not working, had to use another way since I'm on 10.04. I got it to compile so now I'm going to test it using my Raspberry Pi once it finishes. If anyone wants the kernel or kernel.img let me know and I'll post it.

Shawn


Hey Shawn, just curious if you were able to get it to work. From a following post it doesn't look like it did. Just curious if you could give us some more information on what didn't work?

Casey
Posts: 2
Joined: Mon Jul 09, 2012 4:01 pm
by digital_mallet » Mon Jul 09, 2012 4:09 pm
Warg wrote:I have the entire filesystem that was created by the GB-compile, I have a .img-file containing it, now I just need to restore that .img onto a partition on the SD-card (not the entire SD-card as that'd kill the FAT32 /boot, no?), and that's where I'm stuck.
Any and all help appreciated,
Warg


I took a look at a card with Debian, and it seems that the linux filesystem is extracted into one of the partitions. I think you'd want to extract the contents of that img file into the non boot partition on the SD card.

Can you upload your files somewhere? I'd like to play with them and try and get it to boot.
Posts: 1
Joined: Mon Jul 09, 2012 4:00 pm
by fodi » Mon Jul 09, 2012 4:52 pm
lesderid wrote:Compiling ICS for ARMv5/ARMv6 might be harder though...


https://github.com/CyanogenMod/repositories?page=7
zte skate and blade have arm6 processors, here are the sources for them, i guess we can use the standard linux drivers for the devices we have (or we might use gpu drivers from galaxy y, it has an arm6 chipset with the same videocore 4 gpu and has cm9 available)
User avatar
Posts: 112
Joined: Wed Mar 14, 2012 9:03 pm
Location: Hungary
by aaa801 » Mon Jul 09, 2012 7:24 pm
Just to pitch in here, I have android 4.0.3 running quite nicely on a arm6 phone with less then 256mb of ram
All thats needed is a swap partition and your fine
Posts: 427
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire
by Warg » Mon Jul 09, 2012 7:34 pm
I am in the process of rebuilding everything due to getting stuck on the infamous "colour screen" at boot, after that my priority is to push everything to two git-repos, one for the kernel and one for the filesystem.

Regards,
Warg
Posts: 20
Joined: Thu Jul 05, 2012 8:47 pm
Location: Sweden
by Mathijs » Mon Jul 09, 2012 8:35 pm
I used a 3.3 kernel and a filesystem of Android 2.3. I got to the A N D R O I D screen, but then it prints 'untracked pid xx'. Then it tries to go into recovery mode, but this of course fails since it isn't there. Apparently /system/bin/servicemanager crashes 4 times, this may have something to do with the ipc binder..
Posts: 22
Joined: Sat Jun 30, 2012 2:23 pm
by fodi » Mon Jul 09, 2012 9:01 pm
Warg wrote:I am in the process of rebuilding everything due to getting stuck on the infamous "colour screen" at boot, after that my priority is to push everything to two git-repos, one for the kernel and one for the filesystem.

Regards,
Warg

Image
User avatar
Posts: 112
Joined: Wed Mar 14, 2012 9:03 pm
Location: Hungary
by arturo777 » Mon Jul 09, 2012 9:43 pm
I managed to build an Android kernel using basically the steps outlined by Casey Anderson here:

http://headlessandroid.blogspot.hu/2012/07/android-raspberry-pi-kernel-build.html

It worked basically flawlessly! :D

For anyone else doing this, here is what I did (but credits to Casey for the awesome guide):

Firstly, I used the toolchain provided with the Android NDK (as I already had it installed). I assume that it is installed ~/android/ndk.

That means I set:
Code: Select all
export PATH=$PATH:~/android/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
export CROSS_COMPILE=~/android/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-

For newbies like me, be careful modifying the path; I mucked it up the first time and overwrote my existing one...

I decided to build the whole thing in ~/pi, so set the rest of the stuff up like this:

Code: Select all
export RASP_SRC_BASE=~/pi
export ARCH=arm
export CCACHE_DIR=~/.ccache/
export USE_CCACHE=1

I needed to install patch because I didn't have it:
Code: Select all
sudo apt-get install patch

Then everything then runs like clockwork to build the normal kernel:
Code: Select all
mkdir -p $RASP_SRC_BASE/kernel/patches
cd $RASP_SRC_BASE/kernel
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.1.9.tar.bz2
tar jxvf linux-3.1.9.tar.bz2
cd $RASP_SRC_BASE/kernel/patches/
wget http://www.cnx-software.com/patch/r-pi_linux_3.1.9.patch.gz
gunzip r-pi_linux_3.1.9.patch.gz
cd $RASP_SRC_BASE/kernel/linux-3.1.9
patch -p1 < ../patches/r-pi_linux_3.1.9.patch
cd $RASP_SRC_BASE/kernel/linux-3.1.9
cp arch/arm/configs/bcmrpi_cutdown_defconfig .config
make oldconfig
make -k -j6

I'm guessing it is possible to download and patch together a standard Linux kernel for the Pi in other (better?) ways, e.g. via the official Git repo, I'll try this too soon.

If this all works you're pretty much done, now the idea is to apply the Android patches. Following the guide:
Code: Select all
cd $RASP_SRC_BASE/kernel/patches/
wget https://dl.dropbox.com/u/24888185/android_3.1.9_patch.tar.gz
gunzip android_3.1.9_patch.tar.gz

The thing is now you also want to extract the actual patches from the android_3.1.9_patch.tar that is in $RASP_SRC_BASE/kernel/patches/ into this directory. I did this with Ubuntu's archive, this can also be done with tar.

Once that is done, the final steps are:
Code: Select all
cd $RASP_SRC_BASE/kernel/linux-3.1.9
patch -p1 < ../patches/linux-3.1.9-stock-to-android.patch
patch -p1 < ../patches/linux-3.1.9-fs-proc-base.patch
patch -p1 < ../patches/linux-3.1.9-yaffs2.patch
patch -p1 < ../patches/linux-3.1.9-power.patch
cd $RASP_SRC_BASE/kernel
wget https://dl.dropbox.com/u/24888185/rasp_android_defconfig.gz
gunzip rasp_android_defconfig.gz
mv rasp_android_defconfig .config
make -k -j6

Again this process could be streamlined quite a bit, but at the end, if all is well, you should end up with a vmlinux :P

Next step, build the rest of Android :)

Once again, a big thank you to Casey Anderson for your work :) I hope you don't mind me reposting the steps here.
Posts: 27
Joined: Sat Mar 24, 2012 10:02 am
by Warg » Mon Jul 09, 2012 10:17 pm
I just cannot get my head around this, I follow Casey Anderson's instructions, no errors but my kernel will not be read by the Raspberry Pi. All I get is the colour screen upon boot.
Anyone who's successfully gotten their kernel to be read by the RPi care to share what's wrong with my output? http://www.mediafire.com/?z11qbnedonoq7zp is a link to my compiled Image, renamed to kernel.img as per instructions found at http://elinux.org/Rpi_kernel_compilation.

Also, update on the git-repo: my internet connection has been wonky these last few hours, so I'll push tomorrow morning.
Posts: 20
Joined: Thu Jul 05, 2012 8:47 pm
Location: Sweden
by shawnbusker » Tue Jul 10, 2012 1:36 am
Warg wrote:I just cannot get my head around this, I follow Casey Anderson's instructions, no errors but my kernel will not be read by the Raspberry Pi. All I get is the colour screen upon boot.
Anyone who's successfully gotten their kernel to be read by the RPi care to share what's wrong with my output? http://www.mediafire.com/?z11qbnedonoq7zp is a link to my compiled Image, renamed to kernel.img as per instructions found at http://elinux.org/Rpi_kernel_compilation.

Also, update on the git-repo: my internet connection has been wonky these last few hours, so I'll push tomorrow morning.

I get the same thing, it doesn't load even though the kernel compiled just fine. I'll try using the android NDK toolchain and see if it works.

Shawn
Posts: 23
Joined: Sun Jul 01, 2012 3:10 am
by shawnbusker » Tue Jul 10, 2012 1:38 am
headlessandroid wrote:
shawnbusker wrote:Yep, the cross-compiler included with the tutorial was not working, had to use another way since I'm on 10.04. I got it to compile so now I'm going to test it using my Raspberry Pi once it finishes. If anyone wants the kernel or kernel.img let me know and I'll post it.

Shawn


Hey Shawn, just curious if you were able to get it to work. From a following post it doesn't look like it did. Just curious if you could give us some more information on what didn't work?

Casey


I had to install package by package the Cross Compiler for arm on Ubuntu 10.04 and then it worked by following the compile command from the kernel guide on the RPi Wiki at eLinux.
Posts: 23
Joined: Sun Jul 01, 2012 3:10 am
by shawnbusker » Tue Jul 10, 2012 1:43 am
Also, from experience I know that Android is split up between different partitions, how will that work on the RPi? I know that there's boot, root, system, and data, how will those mount? I do know that in order to keep file permissions working the .img files can't be extracted and copied to the partition, they have to be written directly to a partition, so what would the partition layout be on the sdcard?
Posts: 23
Joined: Sun Jul 01, 2012 3:10 am
by Mathijs » Tue Jul 10, 2012 5:45 am
shawnbusker wrote:Also, from experience I know that Android is split up between different partitions, how will that work on the RPi? I know that there's boot, root, system, and data, how will those mount? I do know that in order to keep file permissions working the .img files can't be extracted and copied to the partition, they have to be written directly to a partition, so what would the partition layout be on the sdcard?

I bypassed that problem by downloading a root filesystem and extracting that to an ext4 partition. You can find one compiled for our cpu here, although it's a bit dated. (gingerbread 2.3.2, while the latest version is 2.3.7)
Posts: 22
Joined: Sat Jun 30, 2012 2:23 pm
by lesderid » Tue Jul 10, 2012 8:12 am
Mathijs wrote:
shawnbusker wrote:Also, from experience I know that Android is split up between different partitions, how will that work on the RPi? I know that there's boot, root, system, and data, how will those mount? I do know that in order to keep file permissions working the .img files can't be extracted and copied to the partition, they have to be written directly to a partition, so what would the partition layout be on the sdcard?

I bypassed that problem by downloading a root filesystem and extracting that to an ext4 partition. You can find one compiled for our cpu here, although it's a bit dated. (gingerbread 2.3.2, while the latest version is 2.3.7)


How exactly did you get it to boot using this filesystem?
Posts: 13
Joined: Mon Jul 09, 2012 12:44 pm
Location: Mechelen, Belgium
by arturo777 » Tue Jul 10, 2012 9:01 am
I just read over on the e-linux pi wiki that if you are using the older firmware, the compiled Image file needs to be converted with a python script. See http://elinux.org/RPi_Kernel_Compilation for details.

The latest firmware doesn't have this restriction, it'll work with the standard Image or zImage - maybe it is worth making sure that we're using the latest version from https://github.com/raspberrypi/firmware

This page also has details on checking out the latest kernel from github and compiling it; I did this and patching the latest pi kernel with the android patches from listed by Casey (headlessandroid) also appears to work :D

It could be that the updated kernel gives us a greater chance of success :)

Warg, what version of the pi linux kernel did you patch? Patching and compiling the latest one produced an image 4,358,196 bytes, I notice yours is 4,255,812 bytes.
Posts: 27
Joined: Sat Mar 24, 2012 10:02 am
by Mathijs » Tue Jul 10, 2012 9:33 am
Thought I'd share my kernel images. They all have the Android options enabled.
3.1.9+
3.3
3.5-rc2

But every image with the needed android patches enabled doesn't boot (colour screen). I tried to compile one without them and that one boots just fine.
Posts: 22
Joined: Sat Jun 30, 2012 2:23 pm
by Warg » Tue Jul 10, 2012 9:43 am
Mathijs wrote:Thought I'd share my kernel images. They all have the Android options enabled.
3.1.9+
3.3
3.5-rc2

But every image with the needed android patches enabled doesn't boot (colour screen). I tried to compile one without them and that one boots just fine.

So I guess it's safe to say that there's some incompability between the android patches and the RPi-kernel. :(
Posts: 20
Joined: Thu Jul 05, 2012 8:47 pm
Location: Sweden
by arturo777 » Tue Jul 10, 2012 10:02 am
Mine is here if you want to try, I won't be able to until tonight...

http://dl.dropbox.com/u/90715939/pi/kernel_pi_android_1.zip

I guess you are using the latest firmware if it works fine without the patches ;)
Posts: 27
Joined: Sat Mar 24, 2012 10:02 am
by Mathijs » Tue Jul 10, 2012 10:40 am
arturo777 wrote:Mine is here if you want to try, I won't be able to until tonight...

http://dl.dropbox.com/u/90715939/pi/kernel_pi_android_1.zip

I guess you are using the latest firmware if it works fine without the patches ;)


I tried your image, colour screen :(
Posts: 22
Joined: Sat Jun 30, 2012 2:23 pm
by arturo777 » Tue Jul 10, 2012 11:01 am
Ok, I guess the next step is to use different patches...

I'm reading through this guide, maybe it helps: http://elinux.org/Android_on_OMAP#Patch_extraction
Posts: 27
Joined: Sat Mar 24, 2012 10:02 am
by Mathijs » Tue Jul 10, 2012 11:05 am
arturo777 wrote:Ok, I guess the next step is to use different patches...

I'm reading through this guide, maybe it helps: http://elinux.org/Android_on_OMAP#Patch_extraction

I didn't use any patches with the 3.5 kernel, just the Android drivers from staging. Still, I got the colourscreen, so I doubt the problem lies in the patches. It is worth a shot though, I got the 3.5 kernel from github, maybe the rpi patches were applied to that kernel and then conflicted (not while patching, but somewhere else I guess since the patching and compile process was error-free).
Posts: 22
Joined: Sat Jun 30, 2012 2:23 pm
by arturo777 » Tue Jul 10, 2012 11:15 am
What exactly does the infamous "colour screen" look like? :idea: I'd like to check that we're seeing the same thing.
Posts: 27
Joined: Sat Mar 24, 2012 10:02 am