cyanogenmod development - Gen8 General

I want to port cyanogenmod to archos
Are there any developers who know how to download the source of cnm and archos firmware
I'm a game developer and I have no experience with drivers but we can compare are achos devices with other cnm supported devices, the nexus s has the same processor, so we don't have to create a driver for that
Compare list (Update 24 June)
processor is the same as in the droid 2
touchscreen = ?
sound hardware =
screen hardware =

You should take a look at the [DEVELOPEMENT] Cyanogen thread on the Dev subforum - think they'll be pretty happy to see you over there!

fisha21 said:
You should take a look at the [DEVELOPEMENT] Cyanogen thread on the Dev subforum - think they'll be pretty happy to see you over there!
Click to expand...
Click to collapse
Yes, but I'm a newcomer and I can't post a replay there

coen22 said:
Yes, but I'm a newcomer and I can't post a replay there
Click to expand...
Click to collapse
im the thread starter at the post above
Just post 6 posts and you can post at dev section

Lennb said:
im the thread starter at the post above
Just post 6 posts and you can post at dev section
Click to expand...
Click to collapse
Thx, but what do think of my idea

coen22 said:
Thx, but what do think from my idea
Click to expand...
Click to collapse
Im happy, if anyone want to help, but
we need a guy who really have android developement knowledge
Anyone?

I still can't reply to the main thread of cyanogenmod [DEV]
The first thing we have to do is a hardware research
the archos gen8 devices have a
First
Processor: Arm cortex-A8 <-- same as galaxy s, and nexus s
Screen: <--- ?
Then
Touchscreen: <--- ?
Later
Camera: <--- ?
Camera A43: <--- ?
WiFi: <--- ?
Sound: <--- ?
Software buttons
I think we should first make the processor and the screen working, then we are able to debug the device using adb
And we are able to view debug codes on archos

Because all drivers are included in the kernel, what would be the outcome of running say AOSP gingerbread on top of the current kernel?
Archos didn't make much changes to the kernel and the system compared to other manufactures like HTC and it's Sense ROM.

Sorry for this rant, but I cant help myself.
Guys, stop the nonsense regarding not being an android dev and thusnot being able to get anything done. Are you not capable of learning? Please dont reply with negative until you ve tried.
I'm a linuxadmin. It took me 2 hours to get a CM build just by following the instructions. How much longer would it take to rip the drivers ad add them to the image? My guess is that if you start with CM 6 (froyo?) you ll be done in a few days.
So please stop begging for an android dev and all the idle talk of how you think you might get things to work. Just get started with the cyanogenmod build guide already!
Again sorry for the rant

wvl0 said:
Sorry for this rant, but I cant help myself.
Guys, stop the nonsense regarding not being an android dev and thusnot being able to get anything done. Are you not capable of learning? Please dont reply with negative until you ve tried.
I'm a linuxadmin. It took me 2 hours to get a CM build just by following the instructions. How much longer would it take to rip the drivers ad add them to the image? My guess is that if you start with CM 6 (froyo?) you ll be done in a few days.
So please stop begging for an android dev and all the idle talk of how you think you might get things to work. Just get started with the cyanogenmod build guide already!
Again sorry for the rant
Click to expand...
Click to collapse
Ho year sure, downloading sources for a supported device and building the entire thing is not rocket science and can be easily done by following the wiki.
But building one for an unsupported device is an other story.
It requires a good knowledge and a lot of spare time.
The knowledge can be learned online but it requires a lot more spare time too and many of us don't have that spare time, unfortunately.
do you?

I'm not here to lecture people on how they spend their time. I simply want to point out that waiting for a dev to come along to fix your woes isn't the right way to get a project started. Besides, all the time spent on forum posts will nicely accumulate into a plentiful amount of time that can be spent on learning.
If there is an dev interested in building a rom, they will. No need to create some kind of placeholder containing information you think someone might want.
The open source way is to scratch your own itch.
Just on the technical side of things. If you port the cyanogen froyo version, you should simply be able to use the same drivers archos uses. So there isn't going to be any development involved, just compiling stuff.
As to your last question, I surely don't have to reply.

wvl0 said:
I'm not here to lecture people on how they spend their time.
Click to expand...
Click to collapse
I see , what are you here for ?
I simply want to point out that waiting for a dev to come along to fix your woes isn't the right way to get a project started. Besides, all the time spent on forum posts will nicely accumulate into a plentiful amount of time that can be spent on learning.
If there is an dev interested in building a rom, they will. No need to create some kind of placeholder containing information you think someone might want.
The open source way is to scratch your own itch.
Just on the technical side of things. If you port the cyanogen froyo version, you should simply be able to use the same drivers archos uses. So there isn't going to be any development involved, just compiling stuff.
As to your last question, I surely don't have to reply.
Click to expand...
Click to collapse
Well that was one of the useless posts found on this thread. Thank you for adding yours to the list

Hey guys, please join us at the Developer Thread.]
Its better to have only one thread

sibere said:
I see , what are you here for ?
Well that was one of the useless posts found on this thread. Thank you for adding yours to the list
Click to expand...
Click to collapse
Touché. I guess I'll just add what I learned then.
How to get your buildsystem up and running on Ubuntu Oneiric 64bit.
Before following this guide: http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Sholes
Do this first, just to avoid having to install individual packages later on:
Code:
add-apt-repository "deb http://archive.canonical.com/ maverick partner"
Code:
apt-get install bison build-essential curl flex g++-4.3-multilib gcc-4.3-multilib git-core g++-multilib gnupg gperf lib32ncurses5-dev lib32readline5-dev lib32z1-dev libc6-dev-i386 libesd0-dev libncurses5-dev libsdl1.2-dev libsdl-dev libwxgtk2.6-dev ncurses-dev pngcrush schedtool squashfs-tools sun-java6-jdk zip zlib1g-dev
I think I ran into compile issues with gcc-4.6, so I switched over to 4.4
Code:
rm /usr/bin/gcc
ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
rm /usr/bin/g++
ln -s /usr/bin/g++-4.4 /usr/bin/g++
Then following this guide to get ADB running with your tablet:
http://forum.xda-developers.com/archive/index.php/t-892847.html
Now you can follow the Sholes build guide.
You might run into compile issues. This bug report includes a fix:
http://code.google.com/p/cyanogenmod/issues/detail?id=2455
and in case you run into this one:
frameworks/base/core/java/android/widget/ListView.java:3631: warning 13: Method android.widget.ListView.getCheckItemIds: (at)Deprecated annotation and (at)deprecated doc tag do not match
Checking API: checkapi-last
(unknown): error 17: Field org.apache.http.protocol.HTTP.EXPECT_CONTINUE has changed value from "100-Continue" to "100-continue"​
Solve it by:
The error here is that someone needs to change the "100-continue" line on line 63 of file external/apache-http/src/org/apache/http/protocol/HTTP.java to "100-Continue"​
And there's this one too:
Code:
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
host SharedLib: libneo_cs (out/host/linux-x86/obj/lib/libneo_cs.so)
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
make: *** Waiting for unfinished jobs....
Which can be fixed by edditing frameworks/base/libs/utils/Android.mk
Change the line:
Code:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
To:
Code:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
This should give you a few files that possibly can be flashed to our tablets:
Code:
Install system fs image: out/target/product/generic/system.img
Target ram disk: out/target/product/generic/ramdisk.img
Target userdata fs image: out/target/product/generic/userdata.img
Happy Hacking.
[edit]
Here's the result, just in case anyone is brave enough to flash it.
http://www.megaupload.com/?d=7PCNF69Z
[/edit]
[edit 2]
I guess the next step would be editing the img files to order to add the necessary drivers.
You need YAFFS2 support to mount these files. YAFFS2 isn't included in this version of ubuntu however.
So get yaffs2:
Code:
git clone ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
..and get a nice old kernel, considering the current version in git doesn't support 2.6.39 cleanly.
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.35/linux-2.6.35.13.tar.bz2
untar your kernel sources.
then follow the instructions included with YAFFS:
Code:
cd yaffs-dir
./patch-ker.sh c m linux-tree
complains that linux-tree/fs/yaffs2 already exists
rm -rf linuux-tree/fs/yaffs2
./patch-ker.sh c m linux-tree
Copy your /boot/config-XXX to the directory you unpacked your kernel tarball.
run a:
Code:
make oldconfig
Now add YAFFS to your config using
Code:
make menuconfig
(Filesystems->Miscellaneous filesystems->yaffs)
..compile and reboot ubuntu into your own kernel containing yaffs2 support
mount your img files with
Code:
mount -o loop -t yaffs2 filename mountpoint
[/edit 2]
[edit 3]
So apparently building cyanogenmod doesn't mean you're building a full rom, you have to do the kernel seperately (as far as I can tell ATM):
http://wiki.cyanogenmod.com/index.php?title=Building_Kernel_from_source
there was no /proc/config.gz, so i ripped the urkdroid kernel .config file instead
also getting an arm toolchain working seemed tedious, so I followed the advice in on the wiki and got one from:
http://www.codesourcery.com/sgpp/lite/arm/portal/subscription3053
Had to tell the compile process where to find the arm compiler. Think I'm actually using one I downloaded from Ubuntu's repository instead of the one from the above link - oh well.
Code:
[email protected]:~/android/kernel/cm-kernel# make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -j`grep 'processor' /proc/cpuinfo | wc -l`
[/edit 3]

wvl0 said:
Touché. I guess I'll just add what I learned then.
How to get your buildsystem up and running on Ubuntu Oneiric 64bit.
Before following this guide: http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Sholes
Do this first, just to avoid having to install individual packages later on:
Code:
add-apt-repository "deb http://archive.canonical.com/ maverick partner"
Code:
apt-get install bison build-essential curl flex g++-4.3-multilib gcc-4.3-multilib git-core g++-multilib gnupg gperf lib32ncurses5-dev lib32readline5-dev lib32z1-dev libc6-dev-i386 libesd0-dev libncurses5-dev libsdl1.2-dev libsdl-dev libwxgtk2.6-dev ncurses-dev pngcrush schedtool squashfs-tools sun-java6-jdk zip zlib1g-dev
I think I ran into compile issues with gcc-4.6, so I switched over to 4.4
Code:
rm /usr/bin/gcc
ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
rm /usr/bin/g++
ln -s /usr/bin/g++-4.4 /usr/bin/g++
Then following this guide to get ADB running with your tablet:
http://forum.xda-developers.com/archive/index.php/t-892847.html
Now you can follow the Sholes build guide.
You might run into compile issues. This bug report includes a fix:
http://code.google.com/p/cyanogenmod/issues/detail?id=2455
and in case you run into this one:
frameworks/base/core/java/android/widget/ListView.java:3631: warning 13: Method android.widget.ListView.getCheckItemIds: (at)Deprecated annotation and (at)deprecated doc tag do not match
Checking API: checkapi-last
(unknown): error 17: Field org.apache.http.protocol.HTTP.EXPECT_CONTINUE has changed value from "100-Continue" to "100-continue"​
Solve it by:
The error here is that someone needs to change the "100-continue" line on line 63 of file external/apache-http/src/org/apache/http/protocol/HTTP.java to "100-Continue"​
And there's this one too:
Code:
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
host SharedLib: libneo_cs (out/host/linux-x86/obj/lib/libneo_cs.so)
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
make: *** Waiting for unfinished jobs....
Which can be fixed by edditing frameworks/base/libs/utils/Android.mk
Change the line:
Code:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
To:
Code:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
This should give you a few files that possibly can be flashed to our tablets:
Code:
Install system fs image: out/target/product/generic/system.img
Target ram disk: out/target/product/generic/ramdisk.img
Target userdata fs image: out/target/product/generic/userdata.img
Happy Hacking.
[edit]
Here's the result, just in case anyone is brave enough to flash it.
http://www.megaupload.com/?d=7PCNF69Z
[/edit]
[edit 2]
I guess the next step would be editing the img files to order to add the necessary drivers.
You need YAFFS2 support to mount these files. YAFFS2 isn't included in this version of ubuntu however.
So get yaffs2:
Code:
git clone ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
..and get a nice old kernel, considering the current version in git doesn't support 2.6.39 cleanly.
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.35/linux-2.6.35.13.tar.bz2
untar your kernel sources.
then follow the instructions included with YAFFS:
Code:
cd yaffs-dir
./patch-ker.sh c m linux-tree
complains that linux-tree/fs/yaffs2 already exists
rm -rf linuux-tree/fs/yaffs2
./patch-ker.sh c m linux-tree
Copy your /boot/config-XXX to the directory you unpacked your kernel tarball.
run a:
Code:
make oldconfig
Now add YAFFS to your config using
Code:
make menuconfig
(Filesystems->Miscellaneous filesystems->yaffs)
..compile and reboot ubuntu into your own kernel containing yaffs2 support
mount your img files with
Code:
mount -o loop -t yaffs2 filename mountpoint
[/edit 2]
[edit 3]
So apparently building cyanogenmod doesn't mean you're building a full rom, you have to do the kernel seperately (as far as I can tell ATM):
http://wiki.cyanogenmod.com/index.php?title=Building_Kernel_from_source
there was no /proc/config.gz, so i ripped the urkdroid kernel .config file instead
also getting an arm toolchain working seemed tedious, so I followed the advice in on the wiki and got one from:
http://www.codesourcery.com/sgpp/lite/arm/portal/subscription3053
Had to tell the compile process where to find the arm compiler. Think I'm actually using one I downloaded from Ubuntu's repository instead of the one from the above link - oh well.
Code:
[email protected]:~/android/kernel/cm-kernel# make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- -j`grep 'processor' /proc/cpuinfo | wc -l`
[/edit 3]
Click to expand...
Click to collapse
That looks very good

wvl0 said:
Touché. I guess I'll just add what I learned then.
How to get your buildsystem up and running on Ubuntu Oneiric 64bit.
Before following this guide: http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Sholes
Click to expand...
Click to collapse
This may be my misunderstanding but I thought this guide only teaches you how to compile your own cyanogen build for the Motorola Sholes. It even states that you need a sholes with a working copy of cyanogenmod installed. This guide will only work for devices which are already supported by the cyanogenmod team, and is not a guide to build for unsupported devices. At least, that was my understanding from spending most of a day crawling around the cyanogenmod wiki.
Part of the build process involves pulling proprietary system files from the device. I guess one starting point would be to work out which files these are, then obtain the files from the archos. However, this stuff takes time to learn and I have very little to spare, like most. But then, neither am I asking someone else to do it, or sitting waiting for it.
If it comes, it comes...

Building for a compatible CPU architecture should at least give you a semi bootable ROM, after that you have to get the drivers in.
Considering we have the source and are using the same kernel versions, we can just recompile the drivers for our kernel.

wvl0 said:
Building for a compatible CPU architecture should at least give you a semi bootable ROM, after that you have to get the drivers in.
Considering we have the source and are using the same kernel versions, we can just recompile the drivers for our kernel.
Click to expand...
Click to collapse
Thank, you guys!
Could you please joyn my Thread for CM Developement, so other guys could help?
One thread is better than two
Finally, guys with Knowledge work on a CM, how can i help?

You could help by completely taking over, 'cause I don't want a cyanogen rom per se, I just want to show people that you don't have to be a developer to compile a rom.

wvl0 said:
You could help by completely taking over, 'cause I don't want a cyanogen rom per se, I just want to show people that you don't have to be a developer to compile a rom.
Click to expand...
Click to collapse
Okey, i understand^^
Could you tell me a few steps to compile the CM ?, i think the drivers we'll do later

Related

[HOW-TO] Build CM9 Kernel w/o Building ROM!

For those of you with lower powered computers like me (My computer right now is 2gb RAM, Core 2 Duo) its a hassle every time you build ICS. For me it takes around 10 hours, and half the time the build crashes.
So since I wanted to just get my feet wet with the development going on here as far as the actual ROM, I decided I wanted to go the kernel route.
The actual compilation guides around the internet are just for compiling the kernel and then adding it into the ROM's build directory so that it gets build along with the ROM. The thing is though that if you don't compile the build kernel with the ROM, then it lacks the ramdisk and doesn't boot.
So thanks to the help of jcsullins, we now have a guide for building CM9 without the ROM building It is below. Many parts of this guide were taken from here: https://www.evernote.com/shard/s102...6dfbf53e0fe5/ba173394b43ed99ae6a90a4d1c51210f (by danabw) and from here: http://code.google.com/p/moboot/issues/detail?id=20
This guide assumes you havent build android before on your system. The build requires some extra programs which are explained in the steps below as well.
Where ever there is multiple lines of code, run the code lines one at a time. Also, I am not responsible for anything that happens as a result of this guide, though it works perfectly for me on Ubuntu 10.04 and the CM9 Nightlies.
Without further ado, here it is:
Prerequisites:
-Touchpad (d'oh)
-PC running Ubuntu 10.04 or higher (I recommend 10.04 for the best stability as far as android builds go including this one)
-Run these lines of code to install most of the prerequisites you need for building android (approx 103 mb)
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-bin
sudo apt-get install sun-java6-jdk
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
Click to expand...
Click to collapse
1. Create the kernel build directory
mkdir -p ~/android/kernel/
Click to expand...
Click to collapse
2. Get the kernel source.
cd ~/android/kernel/
git clone git://github.com/CyanogenMod/hp-kernel-tenderloin.git -b ics
Click to expand...
Click to collapse
3. Download & install uboot-mkimage and set the PATH to it:
sudo apt-get install uboot-mkimage
PATH=${PATH}:~/usr/bin
Click to expand...
Click to collapse
4. Download & install CodeSourcery for the ARM Toolchain
Click on the link here: https://sourcery.mentor.com/sgpp/lite/arm/portal/release1802
Click "IA32 GNU/Linux Installer"
Let the package download
After done, go to terminal and navigate to your download directory (mine is /home/rohan/Download)
Type these commands:
chmod +x arm-2011.03-42-arm-none-eabi.bin
./arm-2011.03-42-arm-none-eabi.bin
Click to expand...
Click to collapse
Follow the directions it gives you. If it comes up with an error about reconfiguring dpkg, do what the message in the terminal says about turning off a settings. You can reenable this later if you want by doing the same command and choosing yes instead of no.
5. Configure the configuration file
Close out of that terminal and open a new one.
Navigate to the kernel's build folder (the one whose path ends in the folder hp-kernel-tenderloin)
Then type:
make ARCH=arm tenderloin_android_defconfig
Click to expand...
Click to collapse
6. Build the kernel
Type the following into terminal:
make ARCH=arm -j8 CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- uImage
Click to expand...
Click to collapse
Where it says "-j8" above, replace with the number of CPU/cores on your system. On a dual core system that should be -j8, but -j3 worked fine on my dual core system as well.
This took my system around 7 minutes.
7. Ready the uimage-extractor tool
Go up one directory in your terminal and then do the following commands:
git clone https://code.google.com/p/moboot
cd moboot/tools
gcc -lz uimage-extract.c -o uimage-extract
Click to expand...
Click to collapse
Now grab the uImage.CyanogenMod you have in your Touchpad's /boot folder (via a file manager with root access or adb) and put the uImage in the moboot/tools directory (where the terminal currently is in)
8. Decompile the existing uImage
Type the following:
./uimage-extract uImage.CyanogenMod
Click to expand...
Click to collapse
9. Grab the built uImage and put it in the extracted folder
Type the following:
cp <location to the hp-kernel-tenderloin folder here>/arch/arm/boot/uImage <location to the moboot/tools folder here>/uImage
Click to expand...
Click to collapse
10. Build the new kernel using the old ramdisk and your new built uImage
Type the following:
mkimage -A arm -O linux -T ramdisk -C none -a 0x60000000 -e 0x60000000 -n "Image" -d ramdisk.img uRamdisk
mkimage -A arm -O linux -T multi -a 0x40208000 -e 0x40208000 -C none -n "multi image" -d uImage:uRamdisk uImage.CyanogenMod.new
Click to expand...
Click to collapse
Thats it!
Your new kernel should now be in the moboot/tools directory under the name "uImage.CyanogenMod.new"
Transfer it to the /boot folder of your device and watch your hard work pay off
Again, HUGE thanks to jcsullins for all his work, along with the entire CM Team. It is truly awesome what they have put together!
Nice job man. While I haven't worked on the kernel side of things much, may have to give it more thought now.
Sent from my PG86100 using Tapatalk
Win7
OP,
Is there a similar guide for Win7 aside from Ubuntu? The above process looks manageable and TC in my experience is semi-unbrickable.
austin_dreq said:
OP,
Is there a similar guide for Win7 aside from Ubuntu? The above process looks manageable and TC in my experience is semi-unbrickable.
Click to expand...
Click to collapse
No. </10char>
For ubuntu users:
Instead of the CodeSourcery compilers you could also use the package gcc-arm-linux-gnueabi which has everything you need. Aside from not installing the CodeSourcery compilers the only thing in the guide that needs to be changed is the compile operation:
From
Code:
make ARCH=arm -j8 CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- uImage
To
Code:
make ARCH=arm -j8 CROSS_COMPILE=arm-linux-gnueabi- uImage
austin_dreq said:
OP,
Is there a similar guide for Win7 aside from Ubuntu? The above process looks manageable and TC in my experience is semi-unbrickable.
Click to expand...
Click to collapse
Over on RootzWiki there is a similar guide for building the kernel that is incorporated into the ROM, using Oracle VM on Win7. It is very clear and wish I would had this when I started building projects and kernels. I believe that is what Rohan was referring to in his OP. So you can follow those steps, including setting up the VM. The main difference then is the last few steps in terms of making the kernel with the ramdisk.
As an aside, my computer system is not very special, an older quad core amd with 8GB memory and I can typically build the ROM in a VM environment, depending on how many new commits there are, in ~30 minutes. But I do tend to build every day to keep up with the commits and thus keep my build time down. In terms of the kernel, as mentioned, I can usually build in only a few minutes. There are many fewer commits to the kernel, so that is pretty static unless you are doing a lot of development yourself.
O.a.T. said:
Over on RootzWiki there is a similar guide for building the kernel that is incorporated into the ROM, using Oracle VM on Win7. It is very clear and wish I would had this when I started building projects and kernels. I believe that is what Rohan was referring to in his OP. So you can follow those steps, including setting up the VM. The main difference then is the last few steps in terms of making the kernel with the ramdisk.
As an aside, my computer system is not very special, an older quad core amd with 8GB memory and I can typically build the ROM in a VM environment, depending on how many new commits there are, in ~30 minutes. But I do tend to build every day to keep up with the commits and thus keep my build time down. In terms of the kernel, as mentioned, I can usually build in only a few minutes. There are many fewer commits to the kernel, so that is pretty static unless you are doing a lot of development yourself.
Click to expand...
Click to collapse
Yeah I want to develop kernels mainly because I've never done it before for Android. I've developed for a Symbian device before since thats my current phone. The Touchpad is my first Android device, and I really hope to get a GNex soon as soon as it is brought to AT&T. If not, I'll probably either switch to VZ since AT&T is getting really annoying.
As for the non-installation of Code Sourcery, thanks! I never knew that package existed! Seems a lot less bloated than the Code Sourcery version.
And also for the developing on Windows, I'd just set up a VM for Ubuntu 10.04. Or you could install wubi, which is a dual boot solution to your Windows predicament. I'm currently running wubi since my only machine right now is old and aging. I need to migrate over to a full dual boot soon though.
This guide can be used on other phones?
sahibunlimited said:
This guide can be used on other phones?
Click to expand...
Click to collapse
If they use the same uImage format then yes. However, I'm not sure if other devices allow you to boot from the uImage, you may need to further compile a boot.img from this. The Touchpad allows this since it needs the uImage for moboot.
rohan32 said:
Yeah I want to develop kernels mainly because I've never done it before for Android. I've developed for a Symbian device before since thats my current phone. The Touchpad is my first Android device, and I really hope to get a GNex soon as soon as it is brought to AT&T. If not, I'll probably either switch to VZ since AT&T is getting really annoying.
Click to expand...
Click to collapse
HTC ONE X<Should have been the Nexus instead of Samsung version.

[GUIDE][ICS] Compile Cyanogenmod 9 on Mac OS X Lion

There are a lot of toturials for building CM9 on ubuntu or CM7 on Mac but I couldn't find a decent toturial for building CM9 on Mac (specially Lion). Development in AOSP/CM land is rapid and guides frequently need updating. I had to spend a little time to figure everything out and I decided to share it here.
This tutorial is for building CM9 (ICS) for Galaxy Nexus GSM (maguro) on Mac OS X Lion 10.7.3 using Xcode 4.3 and homebrew . You can easily make the instructions work for most other cm9 devices, but I wouldn't know anything about that.
DISCLAIMER: I'm not responsible if you blow yourself up, blah blah blah
However, I've tried to make this as noob friendly as possible because, well I'm a noob myself
Instrunctions:
UPADTE (MAY 29TH) : The Xcode 4.3 default compiler (llvm-gcc) used to be incompatible with CM9. Thanks to jocelyn and topprospect, the LLVM compatibility patches from mainline AOSP are now merged into CM9. Therefore, you can now use Xcode 4.3 and its command line tools without installing another compiler. However, since GCC is still the only officially supported compiler, incompatibilites with llvm-gcc could still be introduced with future updates. Therefore, if your build fails, it might be worth it to try installing and compiling with GCC 4.2. See the Troubleshooting section for more info.
Now that we have Xcode 4.3 and Xcode command line tools (CLT) installed, let's continue.
Open Terminal and run
Code:
java
if you don't have Java, you will get a prompt asking you to download and install Java. Go ahead and install it.
If you don't have adb and fastboot working, download the android-sdk from google (version r18 as of now) and put it in /usr/local/ and rename the folder to "android-sdk".
Install the homebrew package manager
Code:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
To make sure that homebrew and android-sdk executables are in $PATH:
Code:
touch ~/.bash_profile && echo "PATH=/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/android-sdk/tools:/usr/local/android-sdk/platform-tools" >> ~/.bash_profile
Relaunch Terminal for the change to take effect.
At this point you can run
Code:
brew doctor
to detect any problems there might be (Homebrew may instruct you to use the xcode-select utility to select the xcode installation path). Hopefully, your system is raring to brew
Now we have to install a bunch of packages:
Code:
brew install git coreutils findutils gnu-sed gnupg pngcrush repo
We now need to create a couple of symlinks so that the gnu versions of 'sed' and 'find' are used rather than the osx provided versions :
Code:
ln -s /usr/local/bin/gfind /usr/local/bin/find && ln -s /usr/local/bin/gsed /usr/local/bin/sed && ln -s /usr/local/bin/gstat /usr/local/bin/stat
It's time to create a case sensitive image which will hold our working directory:
Code:
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 40g -volname "android" -attach ~/Desktop/Android
Now we have a disk image in ~/Desktop/Android. Mount it if it's not mounted already. (Don't be picky about the size, the image will only take as much as space as its contents).
Now we need to create a working directory inside the mounted volume:
Code:
cd /Volumes/android && mkdir cm9 && cd cm9
We can initialize and download the source now:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics && repo sync && say 'finished'
Now we need to get the required proprietry files for our device. We can get these from the device itself. Connect your phone (make sure USB Debugging is enabled) and run the following (for maguro):
Code:
cd /Volumes/android/cm9/device/samsung/maguro/ && ./extract-files.sh
[If you see errors in the output from extract-files.sh, see the Troubleshooting section below]
For Google devices,we can also get them directly from google. For maguro, download the 3 files and extract them to /Volumes/android/cm9. Then,
Code:
cd /Volumes/android/cm9
/Volumes/android/cm9/extract-broadcom-maguro.sh
/Volumes/android/cm9/extract-imgtec-maguro.sh
/Volumes/android/cm9/extract-samsung-maguro.sh
We also need the prebuilts (like ROM manager and Term.apk):
Code:
/Volumes/android/cm9/vendor/cm/get-prebuilts
You can optionally tell the build to use the ccache tool. CCache acts as a compiler cache that can be used to speed-up rebuilds :
Code:
export USE_CCACHE=1 && /Volumes/android/cm9/prebuilt/darwin-x86/ccache/ccache -M 20G
Default is 1GB. Anything between 20GB-50GB should be fine.
Before starting the build, we need to workaround an issue with Lion and compiling the QEMU emulator.
[This step doesn't seem to be needed anymore. QEMU is automatically ignored on OS X/Darwin]
If you build now, you're probably gonna get kernel build errors regarding the missing elf.h header (this error might be device specific). Fortunately, we already have this file downloaded, so we only need to copy it to /usr/local/include:
Code:
cp /Volumes/android/cm9/external/elfutils/libelf/elf.h /usr/local/include
FINALLY, we are ready to build:
Code:
cd /Volumes/android/cm9 && source build/envsetup.sh && brunch
Pick your device from the list and enter the number. For maguro, you could use "brunch maguro" instead and skip the menu. Depending on your system, this will take 30min-4hours.
You should now see a beautiful zip file waiting to be flashed:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​Troubleshooting:
The extract script for maguro seems to be a little outdated, as it doesn't pull the gps proprietary blob. You can either use the google provided scripts, or add koush's git repository for your device to your local_manifest.xml.
As explained above, the CM9 source is currently compatible with llvm-gcc. In the future, if llvm-gcc fails to build correctly, you should try installing and compiling using GCC4.2 (the Xcode 3 compiler). You can install apple-gcc4.2 from homebrew:
Code:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
This version of gcc can happily coexist with Xcode 4.x .
So now you have GCC 4.2 installed, but it won't be used unless we update the corresposing environment variables:
Code:
export CC=/usr/local/bin/gcc-4.2 && export CXX=/usr/local/bin/g++-4.2
Notice that using the export command is temporary. If you relaunch Terminal, you will need to set these again. However, this is a good thing, because changing these values permanently (by putting them in ~/.bash_profile) can interfere with other builds.
If you use this method, the build might fail while compiling "external/zlib/x86/adler32.c". It appears that a recent change in zlib has introduced an incompatibility with gcc 4.2. you have to revert the following 2 commits:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Alternatively, you can add topprospect's zlib on github (which has those commits reverted) to your local_manifast.xml. Simply run:
Code:
nano /Volumes/android/cm9/.repo/local_manifest.xml
and add the following line
Code:
<project name="dferg/android_external_zlib" path="external/zlib" remote="github" />
If you get a build error, and your error is not covered here, copy the last 20-30 lines of the build output AND the output from the following command into pastebin and post the link. Hopefully me or someone else will help you.
Code:
echo -e "\nENV:\n$(env)\n\nWHICH GCC\n:$(which gcc)\n\nWHICH G++:\n$(which g++)\n\nWHICH CC:\n$(which cc)\n\nWHICH C++:\n$(which c++)\n\nBREW DOCTOR:\n$(brew doctor)\n\nBREW LIST:\n$(brew list)\n\n/USR/BIN:\n$(ls -l /usr/bin | grep gcc)\n\n/USR/LOCAL/BIN:\n$(ls -l /usr/local/bin | grep gcc)\n\n"
​Notes/Extras:
To quickly setup your environment, add an alias like the following to ~/.bash_profile:
Code:
alias cm9env="hdiutil attach PATH-TO-DISK-IMAGE -mountpoint /Volumes/android && cd /Volumes/android/cm9 && source ./build/envsetup.sh && export USE_CCACHE=1"
alias cm9build="cm9env && make clobber && reposync && brunch maguro"
Now you can save time by using "cm9env" to get your environment setup or "cm9build" to compile a clean updated build.
To clear your output directory for a new build, run "make clobber". You probably don't need this if you've only changed a few lines of code.
To cherry pick yet-to-be-merged changes from the gerrit instance:
1. Pick an open commit from CM Gerrit
2. Under list of Patch Sets pick the latest and open cherry-pick tab
3. Check what Git repository the url is pointing e.g. http://review.cyanog...frameworks_base
4. In your CM9 working tree go to the corresponding directory, which in this case is something like ~/your-working-directory/frameworks/base/
5. Now simply paste the whole line seen in CM Gerrit cherry-pick tab e.g. "git fetch http://review.cyanog....rameworks_base refs/changes/00/13100/4 && git cherry-pick FETCH_HEAD"
It should be now included in your next compiled build. When doing repo sync again, cherry picks will be lost.[CREDIT Fihlvein from xda]
Click to expand...
Click to collapse
Enjoy your custom built CM9!
I updated OP with some updated info about Xcode 4.3.
Nice work man. Very helpful.
conantroutman said:
Nice work man. Very helpful.
Click to expand...
Click to collapse
thanks! I'll try to keep this topic updated as issues with mac are introduced/resolved.
Nice write up. Thanks.
Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.
Also, any tips to switch from macports to homebrew?
In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?
For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
grad061980 said:
Nice write up. Thanks.
Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.
Also, any tips to switch from macports to homebrew?
In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?
For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
Click to expand...
Click to collapse
Yes, this guide should work fine on Snow Leopard. It mostly depends on your Xcode version. If you have Xcode 3, you can skip step 1 entirely, since you already have gcc4.2 as part of Xcode.
If you have access to Xcode 4.2 and above, you will need to install gcc4.2 separately, as explained in the guide.
Now regarding Macports, I strongly suggest that you completely uninstall Macports before installing homebrew. Instructions are here: http://guide.macports.org/chunked/installing.macports.uninstalling.html
WonkyYew said:
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
Click to expand...
Click to collapse
Full instructions are available on android.com : http://source.android.com/source/initializing.html
If you are using this guide, you need to change the repo initialization command to :
Code:
repo init -u https://android.googlesource.com/platform/manifest
and then do repo sync. You can setup ccache as usual. I don't think AOSP has the "brunch command", so you have to use launch and then make.
Run "lunch" and select an option from the menu. You can find more info about the options here: http://source.android.com/source/building.html. For maguro, you should use "full_maguro-userdebug".
To start the build, use
Code:
make -j$(sysctl -n hw.ncpu)
@ArmanUV. Sounds good & thanks for the input. I'll give the link to macports uninstall a go.
Im a real noob, whats the advantage of compiling from source?
Thanks for the help man !
Hi, thanks for your guide, setting up the repo was no problem at all!
But: I'm getting the following error when building.
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....
Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
ArmanUV,
Thanks so much for posting this guide. Very helpful!
Are you having any trouble with errors like this?
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.
Thanks again for the guide!
EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
topprospect said:
ArmanUV,
Thanks so much for posting this guide. Very helpful!
Are you having any trouble with errors like this?
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.
Thanks again for the guide!
EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
Click to expand...
Click to collapse
empyyy said:
Hi, thanks for your guide, setting up the repo was no problem at all!
But: I'm getting the following error when building.
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....
Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
Click to expand...
Click to collapse
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
ArmanUV said:
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
Click to expand...
Click to collapse
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:
Code:
# echo -n "which gcc: "; which gcc; echo -n "which g++: "; which g++; echo ""; echo "gcc -v:"; gcc -v; echo ""; echo "g++ -v:"; g++ -v; echo ""; echo "cc -v:"; cc -v
which gcc: /usr/bin/gcc
which g++: /usr/bin/g++
gcc -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
g++ -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
cc -v:
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
They are pointing to LLVM, but my CC and CXX variables point to:
Code:
env|grep 4.2
CXX=/usr/local/bin/g++-4.2
CC=/usr/local/bin/gcc-4.2
Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
topprospect said:
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:
Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
Click to expand...
Click to collapse
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.
Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.
A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :
Code:
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++
Obviousely, a systemic method like this has its downsides but it may be the only choice without having to change CM code (especially since I lack the knowledge to do so )
[I recently found out that master aosp is no longer using CC/CXX to find the compiler (see ./build/core/combo/). Instead, it uses "gcc" and "g++" directly, which means that llvm-gcc will be used no matter what env variable you have. Fortunately, unlike cm9, master aosp is supposed to build fine with llvm-gcc (except for qemu, which doesn't matter for device images). ]
ArmanUV said:
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.
Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.
A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :
Code:
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++
Click to expand...
Click to collapse
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.
The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).
So I backed out the change that introduced this adler32.c.
https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
The weird thing is: This change was made back in December. Why would it have worked for you?
topprospect said:
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
Click to expand...
Click to collapse
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.
So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
topprospect said:
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Click to expand...
Click to collapse
The first revert works fine, however the second one gives me the following error:
Code:
$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
empyyy said:
The first revert works fine, however the second one gives me the following error:
Code:
$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
Click to expand...
Click to collapse
Well, run git status. You'll see that the only conflict is in the comments in zlib.h. So, you can just ignore it.
topprospect said:
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.
The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).
So I backed out the change that introduced this adler32.c.
https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
The weird thing is: This change was made back in December. Why would it have worked for you?
Click to expand...
Click to collapse
topprospect said:
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.
So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
Click to expand...
Click to collapse
Nice find. I tried to compile this morning and I ran into the same issue. This is what I don't understand: I did a couple of builds about a week ago without running into this issue. But, the latest commits on zlib are from 2 months ago.
Amazingly, the Xcode 4.3 toolchain (clang and llvm-gcc) builds this external/zlib/adler32.c just fine.
An alternative to this problem is to install an up to date gcc 4.7 :
Code:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb
and then create symlinks to gcc-4.7/g++-4.7. I have not tested this yet.

[Step by Step] Build ICS/JB Kernel

I have created a new thread with a script to build the kernel. Full credit for the script goes to the amazing mapkel. Without him there would be no script.
[Script] Build ICS/JB Kernel
This thread will remain as a Step by Step guide. Either method works fine but the script method is much simpler.
This is an informative guide and I decline responsibility for any damage to your device.
Do not attempt to build this kernel if you are going to complain to devs about issues.
That being said, I designed this so that even those with little knowledge can follow the exact commands and will run into no issues. If you have issues building, post here and I will try to assist you.
The following is a complete tutorial to building the kernel.
Credits:
Kernel Devs: krystianp, lehjr, Epinter, and mmontuori for making this kernel; without them there is no kernel.
Big thanks to benouch for the idea and basic outline of this tutorial.
Another big thanks to zen25205 for help with building the kernel and getting the Linaro Toolchain.
A final big thanks to mchinand for suggesting using "${HOME}" (no need to change for username anymore)
Kernel Kitchen
Thanks to:
quetzalcoatl2435
nlabrad
You need to install Ubuntu 12.04 64bit (Google for instructions)
1. Download linaro.zip (toolchain) from here: http://www.mediafire.com/?ok2paef7uhx2ji8
2. Download kitchen.zip from here: https://mega.co.nz/#!Uc4D0YiD!bs-f4FLWQTu7Q8FQziY0o3GWRPJWGBl-6-Hhm6nta-k
3. Download kernel-working.zip from here: http://www.mediafire.com/?wtavk4yb24x3lj1
4. Download misc.zip from here: http://www.mediafire.com/?q693gipql6a6ty8
If there are any issues with this guide, or if you have any issues building the kernel, post here and I will assist you as best I can.
The following is for Arch Linux Only. Ignore if you are using Ubuntu
Code:
pacman -Syu
pacman -S base-devel
pacman -S git
pacman -S bzip2
pacman -S unzip
Ubuntu Users Start Here
If you get an error on apt-get (something about package not found), enable all software sources in Ubuntu Software Center.
Stage 1 (first time only). Go to Stage 2 if you have already built the kernel.
Open a terminal and run the following commands:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
Code:
sudo apt-get install git
Create a folder named “olympus” in your home directory:
Code:
mkdir ${HOME}/olympus/
Extract the downloaded .zip files to the “olympus” folder (you can use the file manager or the following commands):
Code:
unzip ${HOME}/Downloads/linaro.zip -d ${HOME}/olympus/
unzip ${HOME}/Downloads/kitchen.zip -d ${HOME}/olympus/
unzip ${HOME}/Downloads/kernel-working.zip -d ${HOME}/olympus/
unzip ${HOME}/Downloads/misc.zip -d ${HOME}/olympus/
There should now be 4 folders in ${HOME}/olympus/: “linaro”, “kitchen”, “kernel-working” and “misc”.
In a terminal:
Code:
cd ${HOME}/olympus/
Code:
git clone git://github.com/CyanogenMod-Atrix/android_kernel_motorola_olympus.git
Stage 2 (start here if you are building again).
Code:
cd ${HOME}/olympus/android_kernel_motorola_olympus/
Get the latest updates from git:
Code:
git remote update
Now run the following commands to build the kernel:
Code:
export CROSS_COMPILE=${HOME}/olympus/linaro/bin/arm-unknown-linux-gnueabi-
Code:
make clean && make mrproper
Code:
make -j2 ARCH=arm tegra_olympus_defconfig
Code:
make -j2 ARCH=arm
Now start packing the new kernel and modules:
Code:
cp ${HOME}/olympus/android_kernel_motorola_olympus/arch/arm/boot/zImage ${HOME}/olympus/kitchen/kernel-tools/input/
Code:
cp ${HOME}/olympus/misc/CM9/boot.img ${HOME}/olympus/kitchen/kernel-tools/input/
(Replace CM9 with CM10 for CM10)
Code:
cd ${HOME}/olympus/kitchen/kernel-tools/
Code:
./menu
Press Enter Key
Select Option 1
Press Enter Key (again)
Select Option 1 (again)
Type “olympus” and press Enter Key
Press "Ctrl+C"
Code:
cp ${HOME}/olympus/kitchen/kernel-tools/output/bootimg-contents/initrd.img ${HOME}/olympus/kitchen/kernel-tools/input/
Code:
cd ${HOME}/olympus/kitchen/kernel-tools/
Code:
./menu
Press Enter Key
Select Option 1
Press Enter Key (again)
Select Option 3
Type “olympus” and press Enter Key
Press "Ctrl+C"
Run the following commands:
Code:
cp ${HOME}/olympus/kitchen/kernel-tools/output/boot.img ${HOME}/olympus/kernel-working/
Code:
find ${HOME}/olympus/android_kernel_motorola_olympus/drivers/ -name *.ko -exec cp -f {} ${HOME}/olympus/kernel-working/system/lib/modules/ \;
Code:
cd ${HOME}/olympus/kernel-working/
Code:
zip -r new_kernel.zip *
The “new_kernel.zip” file will be located at ${HOME}/olympus/kernel-working/new_kernel.zip
This is a flashable zip that you can flash on top of MROM CM9 and the ROMs that the devs will be releasing.
You will have the latest kernel changes by building it yourself.
Thanks for the tutorial. Just a quick question, why did you include the kernel modules in the kernel-working.zip; aren't they going to be overwritten with the newly compiled ones?
I can do it in debian?
mchinand said:
Thanks for the tutorial. Just a quick question, why did you include the kernel modules in the kernel-working.zip; aren't they going to be overwritten with the newly compiled ones?
Click to expand...
Click to collapse
They were useless. I have reuploaded. New link in OP.
Ufoex said:
I can do it in debian?
Click to expand...
Click to collapse
I have not tested. You can try and report back. If it works I will update the thread.
Usually devs stick to Ubuntu for Android development.
Seeing as Ubuntu is based off Debian, it should work.
atrix4g18 said:
They were useless. I have reuploaded. New link in OP.
Click to expand...
Click to collapse
I think it is better to only include what is necessary in the zips. Not for space/bandwidth reasons (they were small as you said), but more for understanding the process and knowing what's essential to build a flashable kernel.
mchinand said:
I think it is better to only include what is necessary in the zips. Not for space/bandwidth reasons (they were small as you said), but more for understanding the process and knowing what's essential to build a flashable kernel.
Click to expand...
Click to collapse
100 Percent agree. I appreciate the suggestion. As I said the new kernel-working.zip is updated without those files. Check OP.
Thanks
You forgot "sudo apt-get install git".
Oh, and if you get an error on apt-get (something about package not found), enable all software sources in Ubuntu Software Center.
quetzalcoatl2435 said:
You forgot "sudo apt-get install git".
Oh, and if you get an error on apt-get (something about package not found), enable all software sources in Ubuntu Software Center.
Click to expand...
Click to collapse
Second Post Updated. Thanks. (I don't think anyone will have the apt-get error, but if they do I will let them know).
I got that error on apt-get, which is why I mentioned it.
It was weird, I had to enable local (CD) sources to make apt-get work. It had to read the source list from the CD first before downloading the packages.
It might be a wonky install, though. I just put it here in case anyone faces the same problem.
what?
Does the kernel already includes Linaro?
omg Kristian said he'll look at it, so did he? :crying: Happy:crying:
crazymania56 said:
what?
Does the kernel already includes Linaro?
omg Kristian said he'll look at it, so did he? :crying: Happy:crying:
Click to expand...
Click to collapse
No this is only the Linaro Toolchain used to build the kernel.
Other tutorials would have you download the Android NDK for the toolchains within.. This tutorial uses the Linaro Toolchain instead.
quetzalcoatl2435 said:
I got that error on apt-get, which is why I mentioned it.
Click to expand...
Click to collapse
Added to second post. Thanks. Also made a list of credits in the OP and you are in it.
Hi, i'm trying this in Arch, i looked for the equivalent packages that are needed in ubuntu and seems that Arch has some of them in the arch-devel group of packages and the *-dev packages are included in the non-dev (arch doesn't splits the packages in dev and nondev).
So, i started unziping, and when i'm unzipping the linaro.zip, some files are overwritten, (it asks if i want to overwrite them or not), i chose yes to overwrite.
I'm compiling, so far no problems, i'll update after i finish.
nlabrad said:
Hi, i'm trying this in Arch, i looked for the equivalent packages that are needed in ubuntu and seems that Arch has some of them in the arch-devel group of packages and the *-dev packages are included in the non-dev (arch doesn't splits the packages in dev and nondev).
So, i started unziping, and when i'm unzipping the linaro.zip, some files are overwritten, (it asks if i want to overwrite them or not), i chose yes to overwrite.
I'm compiling, so far no problems, i'll update after i finish.
Click to expand...
Click to collapse
Good to know.
If it works get into the specifics and I can edit the guide or make a second one for Arch. With full credit to you of course.
Im writing this as it compiles
-No errors in make clean && make mproper
-No errors in make mrom_deconfig
The errors must be in the make.
There are a few warnings, unused functions, unused variables, uninitialized variables, i see a few modules being built, but the extension is ".o" not ".ko", for example dhd_something.o
"arch/arm/boot/compressed/head.S: Assembler messages:
arch/arm/boot/compressed/head.S:[num]: Warning: (null) (it appears a like 30 times.
Then i see, for example
"LD [M] drivers/char/hw_random/rng-core.ko" so i guess it was compiled.
Ok nevermind, the find command DOES FIND the files, but i thought that it didn´t because im used to run cp with -v, and i saw no output and i got confused.
ITS OK THEN.
Something else, after running the kitchen, its faster to press CTRL-C instead of closing/opening the terminal.
Plus you have the log of what you've been doing so far.
No current issue, the modules were compiled, i got confused.
I have the kernel zip ready to be tested.
CTRL-C will work in any bash terminal, which is the one that Ubuntu uses.
Instead of closing the terminal, it just ends the current running process (in this case, the kitchen script will end, and you get the prompt ready again).
My english is weak so if you need to change some grammar of this next few lines, feel free to do so:
So far, to compile it in Arch you need to run: (or check if you already have the packages)
pacman -Syu
pacman -S base-devel
pacman -S git
pacman -S bzip2
pacman -S unzip
Then follow the tutorial normally.
Is MROM CM9 = MROM ICS?
nlabrad said:
No current issue, the modules were compiled, i got confused.
I have the kernel zip ready to be tested.
CTRL-C will work in any bash terminal, which is the one that Ubuntu uses.
Instead of closing the terminal, it just ends the current running process (in this case, the kitchen script will end, and you get the prompt ready again).
My english is weak so if you need to change some grammar of this next few lines, feel free to do so:
So far, to compile it in Arch you need to run: (or check if you already have the packages)
pacman -Syu
pacman -S base-devel
pacman -S git
pacman -S bzip2
pacman -S unzip
Then follow the tutorial normally.
Is MROM CM9 = MROM ICS?
Click to expand...
Click to collapse
Updated Second Post. Take a look.

Building Android 5 for n7000

I want to compile Android 5 for the Galaxy Note.
Set up Linux build environment:
1. Download http://elementaryos.org/ and install
2. sudo apt-get install openjdk-7-jdk git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i38 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386; sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so; echo "export USE_CCACHE=1" >> ~/.bashrc; mkdir ~/bin; mkdir ~/android/distroname; curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo; chmod a+x ~/bin/repo; cd ~/android/distroname
3. repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.0_r1
4. repo sync; source build/envsetup.sh
Copy n7000 files from a working distro:
export rs="rsync -av --delete"
export distro="~/android/distro"
$rs $distro/device/samsung device/
$rs $distro/hardware/samsung hardware/
$rs $distro/vendor/samsung vendor/
$rs $distro/kernel/samsung kernel/
$rs $distro/hardware/ril hardware/
# $rs $distro/hardware/ril/libril/Android.mk hardware/ril/libril/ #(for the BOARD_PROVIDES_LIBRIL)
$rs $distro/device/samsung/galaxys2-common/selinux/uevent.te device/samsung/galaxys2-common/selinux/ueventd.te
# $rs distro/frameworks/opt/telephony/src/java/com/android/internal/telephony/Samsung* frameworks/opt/telephony/src/java/com/android/internal/telephony/
$rs $distro/hardware/libhardware_legacy hardware/
add 'system/media/camera/include' to device/samsung/galaxys2-common/camera/Android.mk in LOCAL_C_INCLUDES
edit device/{n7000,galaxys2-common}/overlay/frameworks/base/core/res/res/values/{config,arrays}.xml and comment out the options added by the distro that it complains about. For me that's "shutdown_reboot_options, shutdown_reboot_actions, config_forceDisableHardwareKeyboard, config_enableTorch, config_deviceHardwareKeys, config_stylusGestures, config_samsung_stk"
lunch full_n7000-userdebug
time make -j8
The source is online. Here's the command:
Code:
repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.0_r1
repo sync
Mine is syncing now.
Yes. Let me test once ready....
jjamain said:
Yes. Let me test once ready....
Click to expand...
Click to collapse
Me too..
Meeee tooooooooo...
Sent from my GT-N7000 using Tapatalk
raoabdullah said:
Meeee tooooooooo...
Sent from my GT-N7000 using Tapatalk
Click to expand...
Click to collapse
how to much time to take for building android l for n7000
rvkumar said:
how to much time to take for building android l for n7000
Click to expand...
Click to collapse
SAME AS TIME TAKES TO CATCH FISH
Mine still isn't done syncing.
I think maybe the servers are being overloaded from too many people syncing, because I'm getting errors that say "the remote end hung up unexpectedly", and I have to restart the sync.
hey guys i heard google released native android l just yesterday, is this true?
is it possible to port it to n7000 then?
It's true. I'm going to try to compile it for n7000. If you want to try too, just install Linux in a virtual machine if you don't run it, and use repo to sync the source code. Then we'll go over the steps to get it to work.
Mine is done syncing. I'm trying to compile.
noterio said:
Mine is done syncing. I'm trying to compile.
Click to expand...
Click to collapse
I am waiting...
I copied the n7000 files into the tree. When compiling it complains that libril is already defined. There's a libril in hardware/ril, which is the one that comes with Android, and one in hardware/samsung/ril. I removed the stock one, to use the Samsung one. It's still compiling, so I don't know if that worked yet.
noterio said:
It's true. I'm going to try to compile it for n7000. If you want to try too, just install Linux in a virtual machine if you don't run it, and use repo to sync the source code. Then we'll go over the steps to get it to work.
Click to expand...
Click to collapse
thanks for you answer
but that's an additionnal work with no touchscreen and Amoled screen experience so i think i will wait for your rom bro
Who said I was giving you a ROM? It's better to teach someone to fish than give them what you catch. Plus why do you trust random strangers with your operating system? I'll load it with a backdoor so I can steal all your bank accounts.
It choked on: tinyalsa_audio/audio_ril_interface
Then I redid the make, and it had a problem with tinyalsa_audio/mixer AUDIO_CHANNEL_OUT_SURROUND
Hmm.
noterio said:
Who said I was giving you a ROM? It's better to teach someone to fish than give them what you catch. Plus why do you trust random strangers with your operating system? I'll load it with a backdoor so I can steal all your bank accounts.
It choked on: tinyalsa_audio/audio_ril_interface
Then I redid the make, and it had a problem with tinyalsa_audio/mixer AUDIO_CHANNEL_OUT_SURROUND
Hmm.
Click to expand...
Click to collapse
Will this work https://github.com/JijonHyuni/galaxys2-common/tree/master/tinyalsa_audio? I need to get a Linux vm working.
Maybe. I have source trees from CyanogenMod, SlimKat, and LiquidSmooth set up, and I successfully compiled SlimKat and LiquidSmooth, so I am trying files from those. We should have everything we need, just need to find the right combo or edit some files to make it fit with the original AOSP code. I don't know enough about Android yet to know exactly what's going on, but I think just having the Samsung specific files should be enough to get it to build, as long as it's configured correctly.
I edited the first post with some basic steps to get the virtual machine ready to compile. Once we figure out the next steps to get it to build I'll add those. Also need to add the busybox and custom recovery files I think, which I haven't done yet. I just wanted to get it to compile with the basic stuff first.
noterio said:
Who said I was giving you a ROM? It's better to teach someone to fish than give them what you catch. Plus why do you trust random strangers with your operating system? I'll load it with a backdoor so I can steal all your bank accounts.
It choked on: tinyalsa_audio/audio_ril_interface
Then I redid the make, and it had a problem with tinyalsa_audio/mixer AUDIO_CHANNEL_OUT_SURROUND
Hmm.
Click to expand...
Click to collapse
Well i am not an android geek to port or compile roms and builds. i know it's easy to learn but it's hard to master so that will require too much time which i don't have at the moment that's why i will wait for you do all the work LOL
and concerning the bank account details theft, well i don't have a bank account
Is anyone else trying to build this? The latest error is about there being no system/camera_vendor_tags.h

[Guide]How To Compile Kernel (Especially for Redmi Note 5A)

Hi guys , it is a common fact that kernel runs linux. Without kernel, linux won't be usable. One of linux family is Android. Okay, so after that preamble, i just want to share to you "How To Compile Kernel (Especially for Redmi Note 5A)"​
So, Let's start !​Prerequisites :
1. Laptop/PC with Linux installed (i prefer Ubuntu based distro, for other distributions i'll update if i have tested​2. Already installed needed package (you'll see list below)​3. Internet connection (Optional if you have prepared all)​
Stages :
1. Install all needed packages by typing this command in terminal (if you encounter any error just delete the package that causes error)
Code:
sudo apt-get install git –core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib adb
2. Get the compiler(gcc) by typing this command in terminal
Code:
git clone <url> gcc
3. Get the kernel source from github or gitlab or whatever the service is by typing this command in terminal
Code:
git clone –b <branch name> https://github.com/xxx/xxx
Compile :
After all required components are ready, now let's start compiling our kernel. Run terminal in your kernel folder and type commands below :
1. First, we have to export(to tell the computer) the path of our compiler(gcc) by typing this command :
Code:
export CROSS_COMPILE=/home/<your host>/<gcc folder>/bin/<toolchain prefix>
Example :
Code:
export CROSS_COMPILE=/home/nayef/gcc/bin/aarch64-linux-android-
2. Second, we have to export(to tell the computer) the architecture for our devices. Fortunately Redmi Note 5A has ARM 64 bit architecture, so it should be "arm64".
Code:
export ARCH=arm64 && export SUBARCH=arm64
3. Third, before compiling, let's configure our devices configuration by using available defconfig, usually our devs name it "ugglite_defconfig", but from official Xiaomi source it is "ugglite_msm8937_defconfig" . There are many sources of Redmi Note 5A Kernel. PM me if you want the list.
Code:
make O=out <defconfig name>
Example:
Code:
make O=out ugglite_defconfig
4. Now, let's compile it by typing this commands below
Code:
make O=out -j4
Reference :
nathanchance thread
Android Google Source
Hey man, does the wifi work after compiling the kernel?
I am trying to compile redmi 5a kernel from source.
Even though device boots with new kernel , the wifi doesn't work.
The guid at https://github.com/MiCode/Xiaomi_Kernel_OpenSource/wiki/How-to-compile-kernel-standalone
talks about non-dtbo and include-dtbo. What are those? Can you give me some idea.
Partha Dip said:
Hey man, does the wifi work after compiling the kernel?
I am trying to compile redmi 5a kernel from source.
Even though device boots with new kernel , the wifi doesn't work.
The guid at https://github.com/MiCode/Xiaomi_Kernel_OpenSource/wiki/How-to-compile-kernel-standalone
talks about non-dtbo and include-dtbo. What are those? Can you give me some idea.
Click to expand...
Click to collapse
you have to add prima wlan drivers to get wifi working correctly
Bro plz help me .tell me the source and toolchain you use plz bro reply plz I request
Bro plz tell me toolchain and source you use
Mind sending me the guide that you use to root your Redmi 5A? I'm not so interested into building my own kernel from source, as I don't really see any benefits of doing so unless I'm changing compilation flags which, at least right now, is not my intention.
I have experience with Linux, but I'm having a few questions that I cannot come up with the answer and some technical issues which I'm still trying to overcome, and I've seen several guides from several people each doing different stuff to achieve the same goal and I'm lost on which one to follow and why, as most of them are oversimplified and are merely a set of instructions without further explanation, and I would hate to brick my phone because of it (although it's a old phone so that's not that bad).
Also the github page you mentioned has an outdated version of the Linux kernel.
Also since the Redmi 5A runs armv8 (aarch64) you could run any Linux distribution you like, right? Obviously it has to have support out of the box in the iso for touch screen otherwise you can't do anything, but I should be fine installing a generic distribution that ships with aarch64 and touch input, right? Worst case scenario it doesn't ship with the drivers required for some components to works, as you mentioned with wi-fi, but that's a matter of installing it on the system.

Categories

Resources