[HOWTO] Build custom kernel, libraries and applications on your own - Gen8 Android Development

For building own custom stuff for my Gen8 Device I set up an Ubuntu 10.10 32bit Virtual Machine, so everything in here refers to it, may be different on other linux system.
[disclaimer]This is only a HowTo, if you brick your android device with some custom kernels or other stuff, don't blame me! I'm not responsible for anything you do![/disclaimer]
Notice: ** = you only have to do this step once
Prerequisites for Ubuntu 10.10 32 Bit: **
Code:
# sudo apt-get install git-core flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl automake autoconf libtool gettext texinfo libmpfr1ldbl
Prepare environment: **
Code:
# mkdir -pv $HOME/{archos,bin}
# echo export ARCHOS=\$HOME/archos >> ~/.bashrc
# echo export PATH=\$HOME/bin:\$PATH >> ~/.bashrc
# cd $HOME/archos
# wget -Oavos_env.tgz http://archos-gen8-dvb.googlecode.com/files/avos_env_20110415.tgz
# tar xzf avos_env.tgz
# install -m755 cross $HOME/bin/
# rm -f cross avos_env.tgz
RESTART CONSOLE OR REBOOT COMPUTER!
Toolchain: **
Code:
# cd $ARCHOS
# make all
Configure kernel:
Code:
# cd $ARCHOS
# make kernel-config
Restore kernel config:
Code:
# cd $ARCHOS
# make kernel-reset
Build kernel:
Code:
# cd $ARCHOS
# make kernel-build
CrossCompile: (this is just an example for if you want to build some linux libraries or tools)
Code:
# echo $ARCHOS
# cd ..xyz../..zyx../
# cross make

I followed your instructions, and I got all the way to the end, but when I did 'make kernel-build' it ended with this:
drivers/built-in.o: In function `archos_dpm_suspend':
/home/zyntax/archos/gen8-gpl-froyo/linux/drivers/usb/storage/archos_hdd.c:261: undefined reference to `usbsata_power'
make[3]: *** [.tmp_vmlinux1] Error 1
make[2]: *** [sub-make] Error 2
make[2]: Leaving directory `/home/zyntax/archos/gen8-gpl-froyo/linux'
make[1]: *** [/home/zyntax/archos/gen8-gpl-froyo/buildroot//linux/arch/arm/boot/zImage] Error 2
make[1]: Leaving directory `/home/zyntax/archos/gen8-gpl-froyo/buildroot'
make: *** [kernel-build] Error 2
[email protected]:~/archos$
This is on a fresh install of Ubuntu 10.10 32-bit in Virtualbox. I installed it, updated the OS, then started your steps. Not sure if this is normal and I'm holding off on the last step. I did do one extra step: in 'make kernal-config' I deselected all the Archos boards under System Type except for the A101IT since that's what I have.

jbradshw said:
This is on a fresh install of Ubuntu 10.10 32-bit in Virtualbox. I installed it, updated the OS, then started your steps. Not sure if this is normal and I'm holding off on the last step. I did do one extra step: in 'make kernal-config' I deselected all the Archos boards under System Type except for the A101IT since that's what I have.
Click to expand...
Click to collapse
can you please try again without modifying kernel config?

Did that, now I get this:
CC [M] drivers/usb/musb/omap2430.o
/home/zyntax/archos/gen8-gpl-froyo/linux/drivers/usb/musb/omap2430.c:221: warning: 'omap_phy_read' defined but not used
LD [M] drivers/usb/musb/musb_hdrc.o
LD drivers/built-in.o
make[2]: *** [sub-make] Error 2
make[2]: Leaving directory `/home/zyntax/archos/gen8-gpl-froyo/linux'
make[1]: *** [/home/zyntax/archos/gen8-gpl-froyo/buildroot//linux/arch/arm/boot/zImage] Error 2
make[1]: Leaving directory `/home/zyntax/archos/gen8-gpl-froyo/buildroot'
make: *** [kernel-build] Error 2
I don't believe I changed anything besides what I mentioned earlier. Is there anyway to get back a default kernel-config?

hehe, I thought you should try with default kernel-config
I added a section for restoring kernel config in the start posting :
chulri said:
[*]Restore kernel config:
Code:
# cd $ARCHOS
# tar xzf gen8-gpl-froyo.tgz gen8-gpl-froyo/linux/linux.config
Click to expand...
Click to collapse

Well I did poke around in the config, but as far as I remember I only removed those extra archos systems. I'll restore the default and run it again later tonight.
Thanks.

jbradshw said:
Well I did poke around in the config, but as far as I remember I only removed those extra archos systems. I'll restore the default and run it again later tonight.
Click to expand...
Click to collapse
You can't remove other devices (like A32, A101 etc) from Linux kernel config because Archos made bad dependencies for different parts of the kernel and even 70S requires some USB kernel code, it's only compiled when you choose A101 - so either you clean it up manually, or you are required to leave checked other archos devices :/

Thanks for this howto, this is gonna be useful for me, should be a sticky.

OK the make kernel-build worked without errors. Now I'm just questioning the command 'cd ..xyz../..zyx../' I don't have any files or directories called that, and running that reports the same. Can I just skip that and do the make cross?

@jbradshw that's just a sample if someone wants to crosscompile something (e.g. some linux library or application like linuxtv-dvb-apps or w_scan)
you don't have to do everything mentioned in the howto. it's a HowTo not a HaveTo

Ahh OK. So I guess I'm done then. I haven't installed the SDE on my Archos yet, but what's the final 'thing' that came out of this procedure that I'll be placing on the tablet?
Also I don't have an microSD card yet, and I know there was talk of putting stuff on there - can this be done using just the internal memory (8 GB for me)?

you have to install the SDE to install a custom kernel. follow this guide: http://forum.xda-developers.com/showthread.php?p=10157349#post10157349

Yeah I saw that guide, my question is where is the zImage and initramfs.cpio.gz that I assume was part of the compiling I just did? And also if a microSD card is needed for any of this?

no microsd is needed
initramfs.cpio.gz can be extracted from current installation ( /dev/mmcblk0p1 -> init ), read this: http://forum.xda-developers.com/showthread.php?t=880321&page=5
zImage is compiled at this location: $ARCHOS/gen8-gpl-froyo/buildroot/linux/arch/arm/boot/zImage

Shouldn't it be
Code:
cross make kernel-build
?
Here I have to use cross, which makes sense to find gcc arm binaries.

No you don't. In case of building stuff which comes with the gen8-gpl-froyo.tgz (e.g. kernel) the env vars are set up by the supplied makefiles

chulri said:
No you don't. In case of building stuff which comes with the gen8-gpl-froyo.tgz (e.g. kernel) the env vars are set up by the supplied makefiles
Click to expand...
Click to collapse
If I don't use cross, here is what I get:
[email protected]:~/archos$ make kernel-build
make -C gen8-gpl-froyo/linux mrproper
make[1]: arm-linux-gcc: Command not found
make[1]: Entering directory `/home/ubuntu/archos/gen8-gpl-froyo/linux'
make[3]: arm-linux-gcc: Command not found
But using cross it compiled fine, though I followed carefully your directions !

Apparently I was too frightened by the error messages, since it does work in the end
Thank you very much, hope some good things come from this !
Cheers !

desiresush said:
Apparently I was too frightened by the error messages, since it does work in the end
Click to expand...
Click to collapse
Yeah it's just an annoying bug, it doesn't hurt because "mrproper" only cleans the build directory and doesn't need compiler at all

2.6.29 kernel for Froyo?
Does anybody know, why Archos releases the SDK with a 2.6.29 kernel?
Shouldn't 2.2 Froyo be a 2.6.32 kernel?

Related

Can't Compile wlan.ko

I hate to clutter the dev section, but this is definitely a development question. I'm trying to build my own kernel, which I got the kernel built, but I can't get a working wlan.ko to build. I have one that builds every time in *kernel source path*/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko but it won't enable wifi when I push it to /system/lib/modules as bcm4329.ko. I think its because for some reason it's compiling a driver for a Texas Instruments chip like the one in the Droid, instread of the Broadcom chip in the Nexus.
I've checked in *kernel source dir*/drivers/net/wireless/bcm4329/ where everything says it should be for this chip, but it never compiles there. Any ideas? I'm using pretty much the stock config from Cyanogens Nexus kernel, and the only things I've changed in source are a HUGE audio boost, OC with a slight undervolt of my own, and pershoot's board-mahimahi.h tweaks for added RAM.
Here is my build script
Code:
#!/bin/sh
export KERNEL_DIR=/home/geniusdog/geniusdogkern/cm-kernel
export TOOLCHAIN=/home/geniusdog/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
cd $KERNEL_DIR
make ARCH=arm CROSS_COMPILE=$TOOLCHAIN MODULES_INSTALL=~/Desktop/modules
echo ---Finished building kernel!
cd ~/Desktop/nexuskernel
mv $KERNEL_DIR/arch/arm/boot/zImage zImage
mv $KERNEL_DIR/drivers/net/wireless/bcm4329/wlan.ko ~/Desktop/nexuskernel/wlan_bcm.ko
mv ~/system/wlan/ti/sta_dk_4_0_4_32/wlan.ko ~/Desktop/nexuskernel/wlan_ti.ko
echo --- Finished copying!
Also, I'm not a moron, I have it set to copy both of the wlan files over just in case they show up, which they never do. I can browse the the directory where the broadcom one should be and its still not there, even if I have it set to move it. Whenever I compile everything compiles fine but once it gets to the wlan module I get:
Code:
*more compiling messages up here*
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 2 modules
ERROR: "init_mm" [drivers/net/wireless/tiwlan1251/wlan.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
Then compiling stops. I still have my kernel zimage but no working wlan file.
Please help
run a full make:
make ARCH=arm CROSS_COMPILE=$TOOLCHAIN
then run make again with modules_install as your last argument after INSTALL_MOD_PATH:
make ARCH=arm CROSS_COMPILE=$TOOLCHAIN INSTALL_MOD_PATH=~/Desktop/modules/ modules_install
your CROSS_COMPILE definition should have arm-eabi- (for example) at the end.
make sure:
CONFIG_WIRELESS=y
CONFIG_BCM4329=m
Thanks pershoot! Worked like a charm with that!

(Q) First time Compiling

Ok, I setup my 2 build boxes. One Ubuntu 11.10x64 and one Mint 11x86. Installed required packages and downloaded multiple toolchains. I have tried compiling on both machines and on both I get the same errors.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make: *** Waiting for unfinished jobs....
CHK include/linux/version.h
I have tried make thunderc_perf_defconfig and get the same error. Copied .config from device dropped into source, same error.
Any ideas on what is going on? I'm new to this so any help would be great.
I don't known, maybe gcc
try checking your mount options?
Nope its not gcc; as I said I have installed all required packages including gcc + bison etc. My mount options? Is that the "export ARCH=arm" ? Where I have to set the default compiler? I'm new to the newer flavors of linux. The last distro I used was Mandrake 7.1 ;-) Now I am testing this on 2 builds; an x64 Ubuntu and a x86 Mint(Which is Ubuntu). I have to be missing something on both, but I have followed tutorials guides to the T and still get this error. I get more errors than this by the way. The compiler kicks back Kconfig saying unexpected line of code.
SgtPropain said:
Ok, I setup my 2 build boxes. One Ubuntu 11.10x64 and one Mint 11x86. Installed required packages and downloaded multiple toolchains. I have tried compiling on both machines and on both I get the same errors.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make: *** Waiting for unfinished jobs....
CHK include/linux/version.h
I have tried make thunderc_perf_defconfig and get the same error. Copied .config from device dropped into source, same error.
Any ideas on what is going on? I'm new to this so any help would be great.
Click to expand...
Click to collapse
I ran a search on your error message about the missing rule to make auto.conf and found this:
https://bbs.archlinux.org/viewtopic.php?id=99089
It relates to the other poster's comment about checking your mount options. It's a short process to fix it.
And if it doesn't work maybe it will at least give you a new error message to research.
glarepate said:
I ran a search on your error message about the missing rule to make auto.conf and found this:
https://bbs.archlinux.org/viewtopic.php?id=99089
It relates to the other poster's comment about checking your mount options. It's a short process to fix it.
And if it doesn't work maybe it will at least give you a new error message to research.
Click to expand...
Click to collapse
just as i thought. that might have happened. its worth a try though.
SgtPropain said:
Nope its not gcc; as I said I have installed all required packages including gcc + bison etc. My mount options? Is that the "export ARCH=arm" ? Where I have to set the default compiler? I'm new to the newer flavors of linux. The last distro I used was Mandrake 7.1 ;-) Now I am testing this on 2 builds; an x64 Ubuntu and a x86 Mint(Which is Ubuntu). I have to be missing something on both, but I have followed tutorials guides to the T and still get this error. I get more errors than this by the way. The compiler kicks back Kconfig saying unexpected line of code.
Click to expand...
Click to collapse
Wrong...
Because you don't have .config file in the source. If you are building kernel from source, you must have the kernel config. That kernel config can be shared in the source code, it depends on that kernel developer, he can shared it in arch/arm/config, access to there then find that kernel defconfig. Or you can get the kernel config of that kernel with another method, but this method just can be applied if the kernel you want to build is for our device: flash that kernel then go to terminal then type:
Code:
su
(Accept the super user)
Code:
cp /proc/config.gz /sdcard
If it show "No such file or directory found" so you should ask that kernel developer for their .config.
If it doesn't show anything, go to sdcard and find if there is a file that named config.gz, it's the kernel config. Get back to terminal then type:
cd /sdcard
gunzip config.gz
Voila!
I actually tried that already.... I have been at this for about three days. XDA was my last resort as I like to figure things out on my own. However I'm stuck @ a brick wall. I have edited /etc/fstab and removed the bs mount options..remounted same error. Mind you I'm doing most of this from a Virtual Environment. Starting to think this is my issue, but it doesn't explain the same error on machine #2. Maybe I'm doing it right, possibly a bad git clone?
thachtunganh said:
Wrong...
Because you don't have .config file in the source. If you are building kernel from source, you must have the kernel config. That kernel config can be shared in the source code, it depends on that kernel developer, he can shared it in arch/arm/config, access to there then find that kernel defconfig. Or you can get the kernel config of that kernel with another method, but this method just can be applied if the kernel you want to build is for our device: flash that kernel then go to terminal then type:
Code:
su
(Accept the super user)
Code:
cp /proc/config.gz /sdcard
If it show "No such file or directory found" so you should ask that kernel developer for their .config.
If it doesn't show anything, go to sdcard and find if there is a file that named config.gz, it's the kernel config. Get back to terminal then type:
cd /sdcard
gunzip config.gz
Voila!
Click to expand...
Click to collapse
Yeah that would be great if I hadn't done that already. In my post I stated I had replaced the .config from my device. I have literately tried everything but doing this from base. IE not from a VM. I appreciate the help but its a "no go".
Beginning of my .config for proof
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.9-ck2
# Wed Apr 11 20:41:44 2012
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_KTIME_SCALAR=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_CPUFREQ=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
Setting up a third independent machine Ubuntu x86 testing..
where do you get that .config from?
pull /proc/config.gz
SgtPropain said:
pull /proc/config.gz
Click to expand...
Click to collapse
What device are you using, and what kernel are you using.
for the time being you can use prebuilt kernel...no need to build kernel from source....
williamcharles said:
for the time being you can use prebuilt kernel...no need to build kernel from source....
Click to expand...
Click to collapse
He isn't building ROM from source. He is learning how to build a kernel from source.
Sorry for the delay; had 2 deaths in the family.
I setup my third box and again I get the same results. I really don't know where I'm going wrong. This kinda makes me lean to, I have bad source code. I'm no pro C programmer; however when building I get Kconfig errors. I opened said file and the comments look all messed up. The compiler I think is reading the comments as code and kicking it back giving me this error.
by the way what are you compiling and please teach me compiling i want to learn it .
I'm compiling a modified kernel for the Optimus V. I can't teach you how to compile because I don't even know if I'm doing it right.

[GUIDE]Newbie's Guide to Kernel Compiling

Background :
So I was asked by some people on how I compile kernels so I am just posting some stuff related to same .
This is a beginners' tutorial and is mostly relevant to Xperia 2011 MDPI section . It might work on other sections but I won't be offering any guarantee .
For whom is this tutorial designed for ?
People who like to read stuff and can read stuff ,people who have desire to learn something and would like a more hands on approach .
Index :
#post 1 = Introduction & Setup Environment
#post 2 =Index of Toolchains & sources+FAQ
#post 3 =Kernel Manipulation
#post 4=Compiling , Source Distribution
Click to expand...
Click to collapse
Requirements :
Linux Distro installed on PC .Thats preferrable . Search,read ,install.It's not rocket science .
I am using Linux Mint 13 in this tutorial . Ubuntu,Debian and Ubuntu/debian based distros should be similar to setup.
This tutorial should work on other distros too ...
Click to expand...
Click to collapse
I am not going to support questions/doubts regarding
Cygwin on Windows
Linux installed in Virtual machine
Live Linux distributions .
I would rather spend time fixing issue then figuring out how to do same thing in another environment .
Get tools for stuff you need not know
install these tools via relevant package manager
Code:
build-essential,bzip2,gcc-multilib,g++-multilib,git,gnupg,libncurses5-dev,lib32ncurses5-dev,lib32z1-dev,kernel-package,ia32-libs,zlib1g-dev,zip
e.g for Linux Mint it's
Code:
sudo apt-get install build-essential bzip2 gcc-multilib g++-multilib git gnupg libncurses5-dev lib32ncurses5-dev lib32z1-dev kernel-package ia32-libs zlib1g-dev zip
Next download Android SDK and configure adb and fastboot . Use the amazing service known as google to set up .Test run if they work properly .
Click to expand...
Click to collapse
Some information :
Q1:What is boot.img ,kernel and ramdisk ?
Boot.img or the file you flash to boot partion .It is actually made up of two parts.
zImage is the actual kernel .You can't edit it .You have to recompile it using the kernel sources
initrd.img is the ramdisk .Using tools like Android Kitchen or kernel-tools-master you can edit it .
More about each part in relevant section .
Q2:How do you manipulate ramdisk,change bootlogo ?
A: Check @dsixda 's Android Kitchen or @championswimmer 's kernel-tools-master
Q3:Where does BOOTCLASSPATH lie in ramdisk ?
A:It's present in init.rc
Q4:Where do you change the path to wifi libs ?
A:Check init.semc.rc
Steps I use to work with Boot.img
Modify Ramdisk with Android Kitchen completely .
Use Stock kernel
Repack using Android kitchen
Check if kernel boots
if it does than you have a working ramdisk.
Now you just have to change zImage after compiling it.
Click to expand...
Click to collapse
Sources :
For Xperia Phones
Download the stock sources from
http://developer.sonymobile.com/dow...s/open-source-archive-for-build-4-0-2-a-0-84/
http://developer.sonymobile.com/dow...ves/open-source-archive-for-build-4-1-b-1-13/
to fix toolchain errors
I peeked into wedgess' Lupus and kast's Kappa sources
https://github.com/garwedgess/LuPuS-STOCK-ICS-Xperia2011
Toolchains :
Toolchains are the compilers (cross compilers to be exact ) with which kernel is compiled .
There are tooooooooo many compilers .
I can't test everyone
The best way is to go for compilers which are proven to be work
Path to the compiler .
Before compiling kernels the path to cross compiler must be exported using
Code:
export CROSS_COMPILE=path_ to_compiler
e.g.
My 4.4.3 compiler lies in
/home/user/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
In the folder of the toolchain the compiler is present ,all the tools are prefixed with arm-linux-android-eabi-
so the path to compiler becomes
Code:
export CROSS_COMPILE=/home/karan/xd/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin//arm-linux-androideabi-
Some have arm-eabi- as prefix ,some have no prefixes .Adjust the path accordingly
The usual path of compiler is in bin folder .
Toolchain sources :
Source no 1 : Android NDK
http://developer.android.com/tools/sdk/ndk/index.html
Download the one which has above 360MB of download size ...I have the older version and it has 4.4.3,4.6,4.7
Source no. 2 : Github of @DooMLoRD and @wedgess
https://github.com/garwedgess/toolchains
https://github.com/DooMLoRD/android_prebuilt_toolchains
Doomlord has 4.4.3,Linaro 4.6.2,4.7
Wedgess has 4.4.3 ,Linaro 4.6.2 , Linaro 4.7.3
Use git clone command to download the toolchains
e.g
Code:
git clone https://github.com/DooMLoRD/android_prebuilt_toolchains.git
Code:
git clone https://github.com/garwedgess/toolchains.git
@Christopher83's thread
http://forum.xda-developers.com/showthread.php?p=36677987
He has one toolchain for every occasion . If you wish to dabble ,feel free to dive in ...
FAQ:
What Toolchain works on Stock sources ?
On pure Stock ROM ,without any modification I have been able to compile only on the 4.4.3 by DoomLord ..I would recommend using that one.It works fine on both ICS and GB stock kernels .The kernels boot fine
What should be done so that that you can compile with other toolchains ?
A:There are certain changes in the main Makefile which need to be carried out
Open the main makefile and search for
KBUILD_CFLAGS
Replace
Code:
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Werror \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks
with
Code:
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Wno-unused-but-set-variable -Wno-uninitialized \
-fno-strict-aliasing -fno-common \
-Wimplicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks
Now open
Code:
/include/linux/netfilter/x_tables.h
and delete these lines
Code:
const struct xt_match *match;
const void *matchinfo;
That should fix 4.6.2 & 4.7.3 erros
The Linaro 4.7.3 toolchain requires editing the /arch/arm/boot/compressed/Makefile.Honestly ,peek into kast's Makefile ,since I was able to compile only by applying his Makefile fix .
For others ,Please check logs and correct errors
Making changes to source :
Governors,I/O schedulers & Overclocking :-
Check XDA university's thread
http://xda-university.com/as-a-developer/adding-features-to-your-kernel
It's very well written and i don't want to repeat the same stuff
Making changes to Partition on MDPI
this is a post I made earlier :Read it for details ..
http://forum.xda-developers.com/showthread.php?t=2532418
Compiling the kernel :
First Open Terminal in the main kernel directory .
It is in kernel folder of stock sources .
Step no. 1
Export the architecture .Our phone use arm architecture . Some phones use x86 architecture like our phones .Hence the architecture must be defined before compiling .Do this by .
Code:
export ARCH=arm
Step no. 2
Export the Cross Compiler since thats what will be used to compile kernel .
Code:
export CROSS_COMPILE=/home/karan/a/android_prebuilt_toolchains/arm-linux-androideabi-4.7/bin/arm-linux-androidwabi-
Step no. 3
Clean earlier builds . Important before recompiling
Code:
make clean && make mrproper
Step no. 4
Specify the defconfig
The default config for xperia is in /arch/arm/configs ...they are like semc_mango_defconfig or whatever phone you are using
use
Code:
make semc_mango_defconfig
Step no. 5 Editing: optional
Make edits via menuconfig or xconfig :
This allows you to enable/disable governors,schedulers,filesytems ,modify other parameters which were predefined in defconfig
Code:
make menuconfig
OR
Code:
make xconfig
menuconfig is Command line tool while xconfig is the graphical interface .
You can save the config and use it later and use that as defconfig next time instead
Step 6: Compile
Initiate Compiling ....
Code:
make
If you are compiling for first time it's recommended to use
Code:
make
instead of
Code:
make -j2
or whatever . It will help you to troubleshoot errors .Else errors will be thrown ,you wouldn't be abele to view in terminal and there would be no zImage
Step no. 7: Grab zImage and pack it
after successful compiling zImage will be present in /arch/arm/boot folder
Then use Android kitchen to pack it .
Source Distribution :
1)In a tar ball like sony
Just use an archive manager and make a tar archive ...
Advantages : Easy ,hassle free
Disadvantages : Too large in size if modifying very few aspects
2.)Using diff patch
It's like a comparing tool
e.g If I am my base kernel source is Lupus and I have added some tweak then I can create a patch file which can be used on the Lupus source and the result will be my work .It's pretty handy if you are dealing with few files .
Advantages : small size ,pretty handy ,
Disadvantages : Without a proper text editor like Geany ,check patches is a nuisance .The Mesa patch for MDPI has over 1,500,000 lines ...enough to screw with normal text editors
3)Git with github or similar site
It's a fantastic way to upload source .It allows many features to a developer which makes life lot easier .
Advantages : Excellent Version Control
Disadvantages : Steep learning curve .
Git is quite complex for a newbie and it can overwhelm a person .I would suggest reading a lot about git and experimenting thoroughly before diving in .
Credits :
@pinkflozd
For helping me out when i needed
@DooMLoRD
 @wedgess
 @kast
 @an0nym0us_
Peeked in their sources and learnt Stuff
Recommended Text Editor :If you want to seriously dabble with sources I would suggest to use Geany .
It saves a lot of time .It's a must have if you peek a lot into patch files and/or sources .
Reserved for future FAQ
Reserved Just in case
Reserved Just in case
Stuck with this errors!
trying to find solution from a week
Xperia Mini | Stock GB Kernel Source | android-ndk-r9b-linux-x86.tar.bz2 with x32 ubuntu
http://forum.xda-developers.com/showthread.php?t=2569212
Thanks for the guide
Now i dont have to search around.
Thanx
@karandpr- a guide like this suits for the android general or appropriate forums!
Why keep it so inside? just a suggestion though
Thanx for this!
piousheart said:
Stuck with this errors!
trying to find solution from a week
Xperia Mini | Stock GB Kernel Source | android-ndk-r9b-linux-x86.tar.bz2 with x32 ubuntu
http://forum.xda-developers.com/showthread.php?t=2569212
Thanks for the guide
Now i dont have to search around.
Click to expand...
Click to collapse
usually the error of unknown CPU architecture is because you're using linaro toolchain but without proper definition of CPU architecture in Makefile flags. stay away from linaro for first timer. i would strongly suggest using google vanilla 4.4.3 toolchain. abit old but always work given that the're no actual error in the source itself.
Finally karan:thumbup: Thanks a lot for the guide. Really helpful
Cheers,
Vatsal
piousheart said:
Stuck with this errors!
trying to find solution from a week
Xperia Mini | Stock GB Kernel Source | android-ndk-r9b-linux-x86.tar.bz2 with x32 ubuntu
http://forum.xda-developers.com/showthread.php?t=2569212
Thanks for the guide
Now i dont have to search around.
Click to expand...
Click to collapse
add
Code:
-Wno-unused-but-set-variable
in the makefile in KBUILD_CFLAGS =
Didn't check the second error .
It's because you are using Linaro 4.7.3
Like i said above
Code:
/arch/arm/boot/compressed/Makefile
You need to change it a bit ...
Compare it with changes of Kappa or Lupus .
http://forum.xda-developers.com/showthread.php?p=36677987
an0nym0us_ said:
usually the error of unknown CPU architecture is because you're using linaro toolchain but without proper definition of CPU architecture in Makefile flags. stay away from linaro for first timer. i would strongly suggest using google vanilla 4.4.3 toolchain. abit old but always work given that the're no actual error in the source itself.
Click to expand...
Click to collapse
Thanks for the reply!
I'm not using linaro toolchain but ndk r9b (something 4.8)
i also modified makefile according to your solution i found when searching google in one of the xda thread.
---------- Post added at 11:20 AM ---------- Previous post was at 11:18 AM ----------
karandpr said:
add
Code:
-Wno-unused-but-set-variable
in the makefile in KBUILD_CFLAGS =
Didn't check the second error .
It's because you are using Linaro 4.7.3
Like i said above
Code:
/arch/arm/boot/compressed/Makefile
You need to change it a bit ...
Compare it with changes of Kappa or Lupus .
http://forum.xda-developers.com/showthread.php?p=36677987
Click to expand...
Click to collapse
I'm not using Linaro but ndk r9b. (correct me if ndk is also known as Linaro, im a Noob)
piousheart said:
Thanks for the reply!
I'm not using linaro toolchain but ndk r9b (something 4.8)
i also modified makefile according to your solution i found when searching google in one of the xda thread.
---------- Post added at 11:20 AM ---------- Previous post was at 11:18 AM ----------
I'm not using Linaro but ndk r9b. (correct me if ndk is also known as Linaro, im a Noob)
Click to expand...
Click to collapse
I will take a look at it but for time being ,I would recommend switching to 4.4.3 since it has least erros and the zImage boots fine .
Congratulations karan for finally making the guide will be very helpful for many of us :good:
[email protected] ~/13/kernel $ export ARCH=arm
[email protected] ~/13/kernel $ export CROSS_COMPILE=~/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
[email protected] ~/13/kernel $ make semc_haida_defconfig
#
# configuration written to .config
#
[email protected] ~/13/kernel $ make -j4
make: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: Command not found
scripts/kconfig/conf -s arch/arm/Kconfig
make: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: Command not found
CHK include/linux/version.h
SYMLINK include/asm -> include/asm-arm
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC scripts/mod/empty.o
/bin/sh: 1: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
CC kernel/bounds.s
/bin/sh: 1: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
[email protected] ~/13/kernel $
Hey karan can you look into this error?
koradiavatsal said:
[email protected] ~/13/kernel $ export ARCH=arm
[email protected] ~/13/kernel $ export CROSS_COMPILE=~/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
[email protected] ~/13/kernel $ make semc_haida_defconfig
#
# configuration written to .config
#
[email protected] ~/13/kernel $ make -j4
make: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: Command not found
scripts/kconfig/conf -s arch/arm/Kconfig
make: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: Command not found
CHK include/linux/version.h
SYMLINK include/asm -> include/asm-arm
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC scripts/mod/empty.o
/bin/sh: 1: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
CC kernel/bounds.s
/bin/sh: 1: /home/vatsal/file:///home/vatsal/android/kernel/ndk/toolchains/4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
[email protected] ~/13/kernel $
Hey karan can you look into this error?
Click to expand...
Click to collapse
Check Path to toolchains
Can i use the guide for 2010 devices? X10mini..
piousheart said:
Can i use the guide for 2010 devices? X10mini..
Click to expand...
Click to collapse
Yes... Except you will need different source...
Sent from my MT11i using Tapatalk 2
Attitude.SSJ said:
Yes... Except you will need different source...
Sent from my MT11i using Tapatalk 2
Click to expand...
Click to collapse
can you prefer any toolchain?

[ROM][6.0.1] Zaphods CyanogenMOD 13.0 11/12/15 UBER 4.9/5.2

Source
CyanogenMOD https://github.com/CyanogenMod
OnePlus One kernel https://github.com/CyanogenMod/andro...4/tree/cm-13.0
Credits
All credit go to Cyanogenmod and the devs in this forum (CraZY_BoY^, vinman12 and Temasek specifically). I just build, picked, tweaked and learnt a bit about cm13.
What works
Bluetooth, vpn, incoming calls, gps, outgoing calls, sim, wifi, battery %.
Install
1. wipe dalvik, system, data and cache
2. flash rom, gapps (I use slim gapps here or opengapps) and supersu. Boot.
3. Set up the device and reboot
4. Enjoy
I recommend running the rom in f2fs data and cache mode but ext4 is cool too. Clean flash is always best, however this does generally dirty flash onto previous releases. The rom now has superuser installed and operable. However I still cant work out a way of updating the binaries,hence flashing supersu is recommended and Selinux is set to permissive.
Probably lots more other problems that you can advise, but these are to do with CM13.
I take no responsibility if this messes your device. Use it at your own risk. I did this for myself but it may be of use by others, and its nice to be nice.
Download
zb-cm-13-20151101-UNOFFICIAL-bacon.zip
zb-cm-13.0-20151109-UNOFFICIAL-bacon.zip
zb-cm-13.0-20151112-UNOFFICIAL-bacon.zip
zb-cm-13.0-20151113-uber-4.9-5.2-bacon.zip
zb-cm-13.0-20151115-uber-4.9-5.2-bacon.zip
zb-cm-13.0-20151211-uber-4.9-5.2-bacon.zip
First. Oo. Flashing
Reserved
Amazing! Thanks a lot looking forward!
Sent from my A0001 using Tapatalk
Placing a call causes the phone to freeze up.
Sent from my A0001 using Tapatalk
Thanks for this build! For now the only thing that doesn't seem to work is GPS.
Edit: And the placing calls issue.
itslels said:
Placing a call causes the phone to freeze up.
Sent from my A0001 using Tapatalk
Click to expand...
Click to collapse
Oh yes. Didnt spot that. Worked fine on yesterdays build.
Spider-Vice said:
Thanks for this build! For now the only thing that doesn't seem to work is GPS.
Edit: And the placing calls issue.
Click to expand...
Click to collapse
GPS seem to be working for me.
It didn't here, probably related to network location though, CM has it broken I think.
Spider-Vice said:
It didn't here, probably related to network location though, CM has it broken I think.
Click to expand...
Click to collapse
GPS test shows up 10 satellites ok and google maps gets it right for me. The outgoing calls problem is new , as other cm13 roms built 1/11 have the same problem. Im rebuilding from source and compiling another build overnight so ill check it out tomorrow. CM13 had many changes yesterday.
Hopefully the next build will be UBER based, but its proving to be a little inconsistent with CM13.0 at the moment.
Added to OnePlus One index thread:
[INDEX] OnePlus One
Edid....
Enviado do meu Oneplus One através de Tapatalk
Just updated to cm1 09/11/15 build now with minimal changes to source. Running pretty good now, and Im using this build as my daily relatively problem free in f2fs mode.
The 12/11/15 build is perfect. Almost. Everything seems to work well. SuperSU still needs to be flashed, but all seems to be working very well, and this seems to be the best battery version of CM13.0 to date.
Dirty flashing this version over the last version works fine.
15/11/15 build has fixed the startup reboot.
Is AOKP dead?
On your rom for over a week now, working like a charm. Thnks
@zaphodbeeb thanx for ur rom, been using it since a week.
i need some help with cm13 compilation.
I am new to android development stuff and getting stuck at this error.
Code:
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/amardeep/cm13/out/host/linux-x86/framework/jack-launcher.jar -cp /home/amardeep/cm13/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
GEN /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/Makefile
Building with Jack: /home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/classes.jack
java -Xmx3500m -jar /home/amardeep/cm13/out/host/linux-x86/framework/jill.jar --output /home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v17_intermediates/classes.jack.tmpjill.jack prebuilts/sdk/17/android.jar
#
# configuration written to .config
#
make[1]: Leaving directory `/home/amardeep/cm13/kernel/oneplus/msm8974'
Using additional config 'cyanogenmod_debug_config'
Using /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/.config as base
Merging kernel/oneplus/msm8974/arch/arm/configs/cyanogenmod_debug_config
#
# merged configuration written to /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/.config (needs make)
#
make[1]: Entering directory `/home/amardeep/cm13/kernel/oneplus/msm8974'
GEN /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/Makefile
scripts/kconfig/conf --alldefconfig Kconfig
/home/amardeep/cm13/out/host/linux-x86/bin/jack: line 131: 24457 Killed $SERVER_PRG $SERVER_PORT_SERVICE $SERVER_PORT_ADMIN $SERVER_COUNT $SERVER_NB_COMPILE $SERVER_TIMEOUT >> $SERVER_LOG 2>&1
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/amardeep/cm13/out/host/linux-x86/framework/jack-launcher.jar -cp /home/amardeep/cm13/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/amardeep/cm13/out/host/linux-x86/framework/jack-launcher.jar -cp /home/amardeep/cm13/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
ERROR: Cannot launch Jack server
make: *** [/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/with-local/classes.dex] Error 41
make: *** Waiting for unfinished jobs....
#
# configuration written to .config
#
make[1]: Leaving directory `/home/amardeep/cm13/kernel/oneplus/msm8974'
ERROR: Bad request, see Jack server log (/tmp/jack-amardeep/jack-8072.log)
ERROR: Bad request, see Jack server log (/tmp/jack-amardeep/jack-8072.log)
make: *** [/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v17_intermediates/classes.jack] Error 255
make: *** Deleting file `/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v17_intermediates/classes.jack'
make: *** [/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack] Error 255
make: *** Deleting file `/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack'
make: Leaving directory `/home/amardeep/cm13'
#### make failed to build some targets (06:47 (mm:ss)) ####
amardeep434 said:
@zaphodbeeb thanx for ur rom, been using it since a week.
i need some help with cm13 compilation.
I am new to android development stuff and getting stuck at this error.
Code:
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/amardeep/cm13/out/host/linux-x86/framework/jack-launcher.jar -cp /home/amardeep/cm13/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
GEN /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/Makefile
Building with Jack: /home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/classes.jack
java -Xmx3500m -jar /home/amardeep/cm13/out/host/linux-x86/framework/jill.jar --output /home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v17_intermediates/classes.jack.tmpjill.jack prebuilts/sdk/17/android.jar
#
# configuration written to .config
#
make[1]: Leaving directory `/home/amardeep/cm13/kernel/oneplus/msm8974'
Using additional config 'cyanogenmod_debug_config'
Using /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/.config as base
Merging kernel/oneplus/msm8974/arch/arm/configs/cyanogenmod_debug_config
#
# merged configuration written to /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/.config (needs make)
#
make[1]: Entering directory `/home/amardeep/cm13/kernel/oneplus/msm8974'
GEN /home/amardeep/cm13/out/target/product/bacon/obj/KERNEL_OBJ/Makefile
scripts/kconfig/conf --alldefconfig Kconfig
/home/amardeep/cm13/out/host/linux-x86/bin/jack: line 131: 24457 Killed $SERVER_PRG $SERVER_PORT_SERVICE $SERVER_PORT_ADMIN $SERVER_COUNT $SERVER_NB_COMPILE $SERVER_TIMEOUT >> $SERVER_LOG 2>&1
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/amardeep/cm13/out/host/linux-x86/framework/jack-launcher.jar -cp /home/amardeep/cm13/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar /home/amardeep/cm13/out/host/linux-x86/framework/jack-launcher.jar -cp /home/amardeep/cm13/out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer
ERROR: Cannot launch Jack server
make: *** [/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/with-local/classes.dex] Error 41
make: *** Waiting for unfinished jobs....
#
# configuration written to .config
#
make[1]: Leaving directory `/home/amardeep/cm13/kernel/oneplus/msm8974'
ERROR: Bad request, see Jack server log (/tmp/jack-amardeep/jack-8072.log)
ERROR: Bad request, see Jack server log (/tmp/jack-amardeep/jack-8072.log)
make: *** [/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v17_intermediates/classes.jack] Error 255
make: *** Deleting file `/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v17_intermediates/classes.jack'
make: *** [/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack] Error 255
make: *** Deleting file `/home/amardeep/cm13/out/target/common/obj/JAVA_LIBRARIES/sdk_v8_intermediates/classes.jack'
make: Leaving directory `/home/amardeep/cm13'
#### make failed to build some targets (06:47 (mm:ss)) ####
Click to expand...
Click to collapse
Hi,
Are you building on Ubuntu? If so have you probably need to pick 113774 else the build will fail due to using Java 7 on Ubuntu. The pick enables that. I think thats should solve the problem.
Use repopick 113774
zaphodbeeb said:
Hi,
Are you building on Ubuntu? If so have you probably need to pick 113774 else the build will fail due to using Java 7 on Ubuntu. The pick enables that. I think thats should solve the problem.
Click to expand...
Click to collapse
First of all thanks for the reply
Yes im on ubuntu 14.04lts
Thanx for pointing,will surely try that and report back.

Compile kexec support into kernel of acer a3-a20fhd?

I am not sure if this is the right place to ask, so apologies from me if not.
What works (at the moment, I cannot post links, so I spare out the details):
a) I managed to root my acer a3-a20fhd with the help of a windows version of kingoroot.
b) Secondly I finally chrooted successfully into an archlinux armv7-image from archlinux
c) So I could update, install and run xfce-desktop with the help of vncserver and a vcn-client from google's playstore (there are some left even the device is stuck to android 4.4.2).
I wondered if there is a way to add kexec support to the native kernel and then run the linux environment directly on the tab by firing up kexec from the chroot environment.
But I am stuck, is this possible at all?
Following the guide "Building Your First Kernel" from this forum and using the kernel sources from the website of acer, the best I can get is:
Code:
export CROSS_COMPILE="/mnt/sda9/ProjectX/archlinux/acer-a3-a20FHD/toolchain/bin/arm-eabi-"
export ARCH=arm && export SUBARCH=arm
cd /mnt/sda9/ProjectX/archlinux/acer-a3-a20FHD/acer.com/work/kernel/
make menuconfig
/mnt/Data_bb/sda9/ProjectX/archlinux/acer-a3-a20FHD/acer.com/work/kernel/arch/arm/Makefile:237: /mnt/Data_bb/sda9/ProjectX/archlinux/acer-a3-a20FHD/acer.com/work/kernel/mediatek/Makefile: No such file or directory
make: *** No rule to make target '/mnt/Data_bb/sda9/ProjectX/archlinux/acer-a3-a20FHD/acer.com/work/kernel/mediatek/Makefile'. Stop.

Categories

Resources