[Guide][Noobs Familiar]How To Build Android Kernel With Features! - Android

{
"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"
}
What Is Kernel?
The kernel is a computer program that is the core of a computer's operating system, with complete control over everything in the system.[1] It is the first program loaded on start-up. It handles the rest of start-up as well as input/output requests from software, translating them into data-processing instructions for the central processing unit. It handles memory and peripherals like keyboards, monitors, printers, and speakers.
Is There A Connection Between Kernel And Android?
Haha,Sorry but yes.Kernel is the main component for Android.Basically Android devices use the Linux kernel, but it's not the exact same kernel other Linux-based operating systems use. There's a lot of Android specific code built in, and Google's Android kernel maintainers have their work cut out for them. OEMs have to contribute as well, because they need to develop hardware drivers for the parts they're using for the kernel version they're using. This is why it takes a while for independent Android developers and hackers to port new versions to older devices and get everything working. Drivers written to work with the Gingerbread kernel on a phone won't necessarily work with the Ice Cream Sandwich kernel. And that's important, because one of the kernel's main functions is to control the hardware. It's a whole lot of source code, with more options while building it than you can imagine, but in the end it's just the intermediary between the hardware and the software. So basically if any instruction is given to mobile it first gives the command to kernel for the particular task execution.​
Ah It's Work Time! Lets Get Started!​
Part – I​Setting Up Your Build Environment​Open The Terminal and Paste following Command!
Upgrade The Built-In Environments!
Code:
sudo apt-get update && sudo apt-get upgrade
Install Required Tools.
Code:
sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng
PART-I.II​​​Get The Kernel Source!​Now When It Comes About Kernel Source,Where You'll Find That?
No Worries,Search In Your Device Open Source Projects Websites To Get The Source OR You May Met With Github. Search In Github For Kernel Source For Your Device!
Here Are Some Sites,Where You Can Download Kernel Source Though:
For HTC: http://www.htcdev.com/
For Samsung: http://opensource.samsung.com/
For Sony: http://developer.sonymobile.com/wportal/devworld/search-downloads/opensource
For LG: http://opensource.lge.com/index
Note: If You've Download The Source Then Extract It In A Directory. Or If You Want To Clone/Download Source From Github Then Follow Next Steps!​
How To Download/Clone Kernel Source From Github?​To Clone From Github,You Have To Install Repo Tool!
A. Open The Terminal and Paste Following Command!
Code:
sudo apt-get install phablet-tools
1. To Clone Go To Your Kernel Source Page.Like This -->>
2.Then Click On Clone Or Download Button,And Copy The Link!
B. Open A Terminal And Type This Command!
Code:
git clone <the link that you copied from github> android/kernel
For Me I Type The Following -->>
Code:
git clone https://github.com/Alberteno/android_kernel_samsung_on7xelte.git android/kernel
Explaination:
1. <the link that you copied from github> -->> Replace With The Link You Copied From Github To Clone The Source!
2. android/kernel ->> This Is My Directory Where I Want To Clone It!
C. Done.You Cloned The Source!​

Part-II
How To Add Features To Kernel?
Ah.So Here I'm With Following Guides.What We're Gonna Learn Today?.Lets Go Ahed.
Here are some features you can add via cherry-picking.Check out those-> https://forum.xda-developers.com/showpost.php?p=77089212&postcount=41
How To Upstream Android Kernel?
Well,I'm Not Gonna Spam Or Do Somethings Like This,Here's A Simple Guide By @The Flash To Upstream!
Here Is The Link-->> [url]https://forum.xda-developers.com/android/software-hacking/reference-how-to-upstream-android-kernel-t3626913[/URL]
How To Add I/O Scheduler Or Governor To Kernel?
To Add Governor Or I/O Scheduler To Kernel,You Have To Learn Cherry-Picking! Well,I'm Not Gonna Make A Tutorial For That![Or Maybe I'll].For Now Follow What I Say In Next Steps.
A.
1. So Basically There's Many Governors/IO Schedulers Available In Internet To Add.Choose One Governor,Well I Choosed Nightmare Governor For Example. I'm Showing How To Add A Governor In The Guide.
2. Now What You Have To Do Is To Go To Github,And Type "Add Nightmare Governor" In Search Bar Then Hit Enter.
3. You'll Get Some Many Results,Open One Of Them That Include Many Files About The Governor.Like This -->>
4. Now Where You'll Find The Commit ID To Cherry-Pick It To Your Kernel Source? See Below Pick To Get Idea Which One Is The Idea -->>
5.Yay,So You Got It! Now Open A Terminal And Go To Your Kernel Source Folder! For Me I Typed -->>
Code:
cd android/kernel
6. Now To Cherry-Pick You Have To Fetch The Kernel Source From Which You'll Cherry-Pick.To Do That Type Following In Terminal -- >>
Code:
git remote add <anyname> <link of the kernel source from which you're taking the governor commit>
For Me I Typed This -->>
Code:
git remote add lol [url]https://github.com/B14CKB1RD-Kernel/B14CKB1RD_Kernel_OnePlus3_Unified.git[/url]
Explaination:
1. <anyname> - What Ever You Want.
2. <link of the kernel source from which you're taking the governor commit> - Where You'll Find? Check Below Image.The Blue Selected Image In URL Bar Is the "<link of the kernel source from which you're taking the governor commit>"
7.Then Type This In Terminal -->>
Code:
git fetch <anyname>
For Me I Typed This -->>
Code:
git fetch lol
B.
1.In Terminal Type -->>
Code:
git cherry-pick <commit id>
For Me I Typed This Change <commit id> with the id you copied from github-->>
[code]git cherry-pick 042b5123de94e9875e717efb0ac1d344fdf2282e
2.Now You'll Get Some Conflicts,How To Solve Them? Use This Guide By @jabza .
Here Is The Guide -->> [url]https://forum.xda-developers.com/showthread.php?t=2763236[/URL]
3.Solve The Conflicts And You're Done Adding Governor To Kernel!
How To Add Support Force Fast Charging?(Only For Snapdragon Devices)
1. In Kernel Source Go To "arch/arm/mach-msm" Folder.
2. Then Open The "Kconfig" File And The Following Code -->>
Code:
config FORCE_FAST_CHARGE
bool "Force AC charge mode at will"
default y
help
A simple sysfs interface to force adapters that
are detected as USB to charge as AC.
3. Save It,Then Open "Makefile" And Add The Following Code-->>
Code:
obj-$(CONFIG_FORCE_FAST_CHARGE) += fastchg.o
4. Save The Makefile,Now Create/Add The Fast Charge File In That Directory! Where Is That File? Here Is It -->> Here
5. Now Go To kernel source/drivers/usb/otg directory And Open "msm_otg.c" File, And Add The Following Code -->>
Code:
#ifdef CONFIG_FORCE_FAST_CHARGE
#include <linux/fastchg.h>
#define USB_FASTCHG_LOAD 1000 /* uA */
#endif
And This Code -->>
Code:
#ifdef CONFIG_FORCE_FAST_CHARGE
if (force_fast_charge == 1) {
mA = USB_FASTCHG_LOAD;
pr_info("USB fast charging is ON - 1000mA.\n");
} else {
pr_info("USB fast charging is OFF.\n");
}
#endif
6. Save msm_otg.c File.Now Go To "include/linux" Directory And Add "fastchg.h" File.Here's The Link For That File -->> Here
7. Well Done You've Added Force Fast Charging Support! :fingers-crossed:
How To Add Support Voltage Control For MSM Devices?
1. Go To arch/arm/mach-msm Folder,And Open "Kconfig" File,And Add Following Codes-->>
Code:
config CPU_VOLTAGE_TABLE
bool "Enable CPU Voltage Table via sysfs for adjustements"
default n
help
Krait User Votlage Control
2.Save Kconfig File.Now open "acpuclock-krait.c" File.Add This Code-->>
Code:
#ifdef CONFIG_CPU_VOLTAGE_TABLE
#define HFPLL_MIN_VDD 800000
#define HFPLL_MAX_VDD 1350000
ssize_t acpuclk_get_vdd_levels_str(char *buf) {
int i, len = 0;
if (buf) {
mutex_lock(&driver_lock);
for (i = 0; drv.acpu_freq_tbl[i].speed.khz; i++) {
/* updated to use uv required by 8x60 architecture - faux123 */
len += sprintf(buf + len, "%8lu: %8d\n", drv.acpu_freq_tbl[i].speed.khz,
drv.acpu_freq_tbl[i].vdd_core );
}
mutex_unlock(&driver_lock);
}
return len;
}
/* updated to use uv required by 8x60 architecture - faux123 */
void acpuclk_set_vdd(unsigned int khz, int vdd_uv) {
int i;
unsigned int new_vdd_uv;
mutex_lock(&driver_lock);
for (i = 0; drv.acpu_freq_tbl[i].speed.khz; i++) {
if (khz == 0)
new_vdd_uv = min(max((unsigned int)(drv.acpu_freq_tbl[i].vdd_core + vdd_uv),
(unsigned int)HFPLL_MIN_VDD), (unsigned int)HFPLL_MAX_VDD);
else if ( drv.acpu_freq_tbl[i].speed.khz == khz)
new_vdd_uv = min(max((unsigned int)vdd_uv,
(unsigned int)HFPLL_MIN_VDD), (unsigned int)HFPLL_MAX_VDD);
else
continue;
drv.acpu_freq_tbl[i].vdd_core = new_vdd_uv;
}
pr_warn("faux123: user voltage table modified!\n");
mutex_unlock(&driver_lock);
}
#endif /* CONFIG_CPU_VOTALGE_TABLE */
3.Save The File.Done! You've Added It To Your Kernel.
How To Add Init.d Support To Kernel?
1. Copy Your boot.img To A Folder In Ubuntu And Open A Terminal With boot.img directory.
2. Now Type The Following In Terminal -->>
Code:
abootimg -x boot.img
3. You'll Get 3 Files From It(bootimg.cfg, initrd.img, zImage)
4. Now Create A New Work Folder And Decompress "initrd.img" Using The Following Commands -->>
Code:
mkdir work
cd work
zcat ../initrd.img | cpio -i
5. Now Open The Work Folder.Now Open The "init.rc" File And Add This Line At The End Of This File -->>
Code:
# Execute files in /etc/init.d during boot
service userinit /system/xbin/busybox run-parts /system/etc/init.d
oneshot
class late_start
user root
group root
6.Save "init.rc" File And You're Done!
Or Try This Guide By @alireza7991 -->> Here :laugh:
How To Make Kernel Boot In Permissive Mode(A Small Guide)
1. Go To "Kernel Source/security/selinux" Folder And Open "hooks.c".
2. Find This Line -->>
Code:
selinux_enforcing = enforcing ? 1 : 0;
3. Change It To -->>
Code:
selinux_enforcing = 0;// enforcing ? 1 : 0;
4. Now Save "hooks.c" File.Now Open "selinuxfs.c" File And Search For This Line -->>
Code:
if (new_value != selinux_enforcing) {
5. Add Below Code Above "if (new_value != selinux_enforcing) {" line -->>
Code:
new_value = 0;
6. Yo.You Finally Made The Kernel Boot In Permissive Mode,To Check If It Got Permissive Or Not -->> Go To Settings -> About Phone -> SE-Linux Status (You'll See Its "Permissive")

How To Build The Kernel?
1. Clone A Toolchain That Supports Your Device[
2. Point the Makefile To Your Compiler (run this from within the toolchain folder!!)
Code:
export CROSS_COMPILE=$(pwd)/bin/<toolchain_prefix>-
Example:
Code:
export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
3. Tell Makefile About The Architecture Of Your Device Using This Command -->>
Code:
export ARCH=<arch> && export SUBARCH=<arch>
Example:
Code:
export ARCH=arm64 && export SUBARCH=arm64
4. Locate Your Proper Defconfig File.Where You Will Found That?
Go To "arch/<arch>/configs" Folder,And There You'll Find A Defconfig File Along With Your Device Codename Like For S7 Edge, Its --> "exynos8890_hero2lte-defconfig"
5. Now Come Back To Main Kernel Source Directory Then Enter These Command To Start Building!
Code:
make clean
make mrproper
make <defconfig_name>
make -s -j$(nproc --all) [B][U]Or[/U][/B] make zImage -j4
6.And You're Done! Where You'll Find The zImage?
When Building Finished,The Terminal Will Show The Directory!
How To Flash The zImage?
1. Pull Your Device's Boot Image From The Latest Image Available For Your Device (Whether It Be A ROM Or Stock).
2. Download The Latest Android Image Kitchen From This thread
3. Run The Following With The Boot Image:
Code:
unpackimg.sh <image_name>.img
4. Locate The New zImage File And Replace It With Your Kernel Image (rename it to what came out of the boot image)
5. Run The Following To Repack:
Code:
repackimg.sh
6. Flash The New Boot Image With TWRP!​

Mentions:​
@LahKeda For Always Being With Me. (My AOSP Teacher)
@The Flash
@MZO
@krasCGQ
@flar2
@jazba
And All Devs Being With Me!

Some good stuff coming from you

Albe96 said:
6.And You're Done! Where You'll Find The zImage?
When Building Finished,The Terminal Will Show The Directory!
Click to expand...
Click to collapse
It won't if you use -s switch after make
Which will silent the output!
The resulting kernel image will be located at:
ARM: arch/arm/boot/zImage(-dtb)
ARM64: arch/arm64/boot/Image.gz(-dtb)
x86: arch/x86/boot/bzImage(-dtb)
ARM64 only:
If kernel image creation fails, complaining missing dtb, symlink dtb from ARM dts folder:
Code:
$ ln -s ../../../arm/boot/dts/<dtb-name>.dtb arch/arm64/boot/dts/<dtb-name>.dtb
Sent from my Redmi 3 using XDA Labs

krasCGQ said:
It won't if you use -s switch after make
Which will silent the output!
The resulting kernel image will be located at:
ARM: arch/arm/boot/zImage(-dtb)
ARM64: arch/arm64/boot/Image.gz(-dtb)
x86: arch/x86/boot/bzImage(-dtb)
ARM64 only:
If kernel image creation fails, complaining missing dtb, symlink dtb from ARM dts folder:
Click to expand...
Click to collapse
Thanks you sir! Will Update It Soon!

MZO said:
Some good stuff coming from you
Click to expand...
Click to collapse
But There's So New Though.I Just Explained My Guide To Help Some Noobs ?

I
Sent from my SAMSUNG-SM-N920A using Tapatalk

clmenz said:
I
Sent from my SAMSUNG-SM-N920A using Tapatalk
Click to expand...
Click to collapse
How to add to improve sound ??
Enviado desde mi XT1575 mediante Tapatalk

More feature please

lolnwl said:
More feature please
Click to expand...
Click to collapse
umm.Sure why not.But if I get a free time [emoji4]

Hi @Albe96
Can you please help me compile?
I have Samsung J7 prime SM-G610F (nougat).
I Have downloaded GCC "arm-linux-androideabi-4.9" ( as written in the readme_kernel.txt file of kernel source).
I am not sure if my device is 32-bit or 64-bit.
The readme_kernel.txt file points to 64-bit architecture so I am assuming its 64-bit.
Now the problem:-
When compiling as per your codes, when I type:
make clean,
I'm getting the error "make: *** No rule to make target 'clean'. Stop." and same for every other code after that.
Attaching the readme_kernel.txt file for your reference.

ashwini215 said:
Hi @Albe96
Can you please help me compile?
I have Samsung J7 prime SM-G610F (nougat).
I Have downloaded GCC "arm-linux-androideabi-4.9" ( as written in the readme_kernel.txt file of kernel source).
I am not sure if my device is 32-bit or 64-bit.
The readme_kernel.txt file points to 64-bit architecture so I am assuming its 64-bit.
Now the problem:-
When compiling as per your codes, when I type:
make clean,
I'm getting the error "make: *** No rule to make target 'clean'. Stop." and same for every other code after that.
Attaching the readme_kernel.txt file for your reference.
Click to expand...
Click to collapse
the error you're saying me is not a error I assume.Post full error log so I can look into it

Hi.how can we set kernel to permissive?

nikkali25 said:
Hi.how can we set kernel to permissive?
Click to expand...
Click to collapse
Yes and I think guide is already added

Albe96 said:
Yes and I think guide is already added
Click to expand...
Click to collapse
How to dis able tia and ready root kernel

Albe96 said:
the error you're saying me is not a error I assume.Post full error log so I can look into it
Click to expand...
Click to collapse
So, I corrected my previous mistake and finally was able to compile
Towards the end of compilation, I got this message :
/scripts/fips_crypto_utils.c: In function ‘main’:
./scripts/fips_crypto_utils.c:28:7: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
if (!strcmp ("-u", argv[1]))
^~~~~~
./scripts/fips_crypto_utils.c:52:10: warning: implicit declaration of function ‘update_crypto_hmac’ [-Wimplicit-function-declaration]
return update_crypto_hmac (vmlinux_file, hmac_file, offset);
^~~~~~~~~~~~~~~~~~
./scripts/fips_crypto_utils.c:82:10: warning: implicit declaration of function ‘collect_crypto_bytes’ [-Wimplicit-function-declaration]
return collect_crypto_bytes (in_file, section_name, offset, size, out_file);
^~~~~~~~~~~~~~~~~~~~
HMAC-SHA256(builtime_bytes.bin)= 80387d4cca5322a3de63d73fe615c492385801c8ae36494795eda733492d5a10
OBJCOPY arch/arm64/boot/Image
GZIP arch/arm64/boot/Image.gz
Is this anything to be concerned about?
Can I flash the kernel?
Have added the complete log.

I was able to complete with no errors! ( after running into a dozen )
Although I cannot find zimage anywhere.
I do notice that a bunch of folders / file's modified date has updated throughout the kernels source code folder .
I am building a Samsung exynos 7850 kernel .
Thanks for this great write up!

hightech316 said:
I was able to complete with no errors! ( after running into a dozen )
Although I cannot find zimage anywhere.
I do notice that a bunch of folders / file's modified date has updated throughout the kernels source code folder .
I am building a Samsung exynos 7850 kernel .
Thanks for this great write up!
Click to expand...
Click to collapse
It should be inside arch/(arm/arm64)/boot folder

Related

[Dual-Boot SDCard | CM7.2 Source | Guides | Recovery | Stock 1.4.2 ]

Hello,
WARNING: Perform at your own risk. Do your research.
I am providing the source to compile CM7 for the Nook Tablet. I am not providing a CM7 build since Team B+ have done so. What I provide is the device and vendor contents, kernel, and kernel configuration file, ramdisk, and boot image. You will need to compile your own CM7. This will give you a more updated CM7 with latest update.
My source is primary based on Whistlestop source, but I’ve used bits and pieces from other sources like Nook Color and LG P925.
My goal was to build CM7 for the Nook Tablet as a learning experience. I have always used rom created by other people because I am not a developer. I did my research and learned to build my own CM7. I find that building your own rom is more satisfying and I think everyone should try it at least once. It will require a lot of time and some learning, but it will be special in the end.
More info are on my blog.
New Source for CM7, compile your own CM7.2 RC1
https://github.com/succulent/android_device_bn_acclaim
https://github.com/succulent/android_vendor_bn_acclaim
Recovery sdcard, Flashable Recovery, Unbrick files
https://github.com/succulent/acclaim_recovery_sdcard
Mediefire Nook Tablet Folder
http://www.mediafire.com/?eidcug5a7en8r
Dual boot (CM7/CM9)
- Instruction here (My blog)
- Includes files for single/dual-boot sdcard
- Boot to CM7/CM9 from sdcard with fattire's cyanoboot
- Roms not included
- Please don't post iso/img/prebuilt sdcard of this
- http://www.youtube.com/watch?v=x6syVkhPQaM
- Mockup pic
{
"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"
}
flash_recovery.zip (use recovery to flash it. no more sdcard recovery)
- Hold Power & "n button" down until the device turns on and off again.
- Then press Power to turn the device on normally and access the recovery.
- You can also boot to recovery by issuing command "reboot recovery" in adb or terminal
flash_stock_recovery.zip (use recovery to flash it, restore stock recovery)
flash_u-boot_and_MLO.zip (use it to restore bootloader and xloader)
- Flash this if all you get is a black screen (no 'n' logo screen) when turning your Nook Tablet on.
flash_stock_1.4.2.zip (use it to restore to stock 1.4.2)
- After restart, it will take up to a couple minutes to setup data and system folder.
- It'll be up to a couple of minutes before the setup screen shows up.
- This is virgin stock rom, no root, no added apps, etc.
- This rom will wipe your user data and cache so you don't have to. BACKUP beforehand.
flash-restore-stock.zip (use it to restore partition 1-6)
- Only use this as last measure. Meaning only if you formatted rom (p5) and bootdata (p6).
- You will need to install flash_stock_1.4.2.zip afterward or a CM7 rom.
- To get your serial number back, you need to perform factory restore (8 failed boot method)
- The one that prompt,
Clearing data…
A reset is being performed.
This may take a few minutes
What’s not working:
-Mic in Talking Cat/Dog apps. I can get the mic working but no audio so I choose audio but no mic.
-Can't get mic to work same time as speaker.
-XX and X. You tell me.
Notes:
- DO NOT FORMAT ANY PARTITIONS, ONLY USE WIPE DATA/FACTORY RESET
- Use the forum search.
- First time booting, you will see a long delay black (old)/2 android guys (new) screen until the android skate by.
- To remount sdcard, go to settings/storage and mount your sdcard manually or reinsert your sdcard.
- When restoring with Titanium Backup, restore manually the apps and data. You do not want old stuff getting restore and causing problem.
- HW Decoding is limited to 3GP, 3G2, MP4, M4V, MKV, WEBM, H.264 (Baseline/Main/High profile) up to 1920x1080, MPEG-4 Simple/Advanced Simple profile up to 1920x1080, & H.263
- Got Wifi problem, do Wifi calibration to see if it fixes it.
- If your Nook Tablet go to sleep and never wake up, plug the USB power cable in and hold the power button for 30 seconds, release and repeat.
- Got an extra Nook Tablet? Donate it to fattire so he can help getting ICS on Nook Tablet faster.
- Screen goes crazy? Is it low on battery? Plugged in the USB power cable in.
- What different in this CM7 build and Team B? Nothing much, we shared ideas.
- There will be random problems.
- RC stand for release candidate. Latest for NT is RC1
- If your sdcard doesn't mount after reboot, take your sdcard out and put it back in and wait a few seconds for it to automount
OLD SOURCE Mirrors:
http://d01.megashares.com/index.php?d01=oAajznB
http://www.mediafire.com/?96fa3zx95xiebeg
https://www.rapidshare.com/files/4067595392/Nook-Tablet.zip
http://depositfiles.com/files/k655wvhtc
http://www.wupload.com/file/2675371217
Extras in Old Source:
.config – kernel configuration file
boot.img – prebuilt boot image with modified u-boot from bauwks
irboot.img – the modified u-boot needed to concatenate to custom boot.img
zImage – prebuilt kernel with cifs, tun, and nfs modules built in and other stuffs.
Credits:
Bauwks for his exploit in 2nd boot.
Team B+ (Goncezilla, CelticWebs, Indirect) for furthering Nook Tablet development.
Whistlestop and JackpotClavin from Kindle Fire development for the device and vendor source.
Fattire, Nemith, and Dalingrin for CWM, and works on Nook Color and Nook Tablet development.
Koush, Cyanogenmod and XDA for home to many great developers.
CM7.2 RC1 with Nexus S modified build.prop
HD (succulent)
Need help?
Post questions here.
How to pack Nook Tablet (16gb) boot.img on Windows 7.
http://www.freeyourandroid.com/guide/extract-edit-repack-boot-img-windows
- Download and install Cygwin,
http://www.freeyourandroid.com/guide/installing-cygwin-windows
- Download packboot.zip and extract contents to C:\cygwin\packboot
- http://mir.cr/1BTTGZ0V
- Open Cygwin.bat, located in C:\cygwin
- In the command box, type
$ cd c:/cygwin/packboot
$ ./packboot
- Your new boot.img is newboot.img.
Notes:
- If you want to make an 8gb version newboot.img, replace the boot.img with a backup of 8gb version.
- You can change the ramdisk in the folder “c:/cygwin/out/ramdisk”
- You can replace the kernel, “zImage”.
- You can replace the irboot.img with one that you make, the one included support both 8gb/16gb.
How to compile CM7
Install VirtualBox and Ubuntu with at least 20GB.
Install the Build Packages
Install using the package manager of your choice:
For 32-bit & 64-bit systems:
$ 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
For 64-bit only systems:
$ apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
NOTE: gcc-4.3-multilib g++-4.3-multilib is no longer available for Ubuntu 11.04 64-bit, but should still build without issue.
NOTE: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:
$ add-apt-repository "deb http://archive.canonical.com/ maverick partner"
Create the Directories
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
Install the Repository
Enter the following to download make executable the "repo" binary:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
NOTE: You may need to reboot for these changes to take effect.
Now enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
If you don't want to download unnecessary device projects, open .repo/manifest.xml. Remove devices between device/common and external/alsa-lib.
<project path="device/common" name="CyanogenMod/android_device_common" />
- delete devices -
<project path="external/alsa-lib" name="CyanogenMod/android_external_alsa-lib" />
$ repo sync
NOTE: This step takes a long time, depending on your internet speed. It will download several gigabytes of data. I recommend that you have a lot of hard drive space.
Copy device and vendor folder from Nook-Tablet to ~/android/system/
$ mkdir device/bn
$ mkdir device/bn/acclaim
$ git clone https://github.com/succulent/android_device_bn_acclaim
$ mv android_device_bn_acclaim device/bn/acclaim
$ mkdir vendor/bn
$ mkdir vendor/bn/acclaim
$ git clone https://github.com/succulent/android_vendor_bn_acclaim
$ mv android_vendor_bn_acclaim vendor/bn/acclaim
$ /vendor/cyanogen/./get-rommanager
$ make clean
Configure Build & Compile
$ . build/envsetup.sh && brunch acclaim
NOTE: This step takes a long time, time vary depend on your computer processing power.
Copy your .zip file from ~/out/target/product/acclaim/update.cm-XXXXX-signed.zip to the root of the SD card.
Your rom will contain recovery, MLO and U-boot.bin. (Only with new source)
Replace the boot.img in the .zip file with one in Nook-Tablet. (Only with old source)
Replace updater-script in the .zip file with one in Nook-Tablet. updater-scripte is in /META-INF/com/google/android/. (Only with old source)
Flash .zip files from recovery. Wipe data/factory reset.
References:
Fattire's CM9 for NookColor Build Instructions
https://docs.google.com/document/d/19f7Z1rxJHa5grNlNFSkh7hQ0LmDOuPdKMQUg8HFiyzs/edit?pli=1
Barnes & Noble Nook Color: Compile CyanogenMod (Linux)
http://wiki.cyanogenmod.com/wiki/Barnes_&_Noble_Nook_Color:_Compile_CyanogenMod_(Linux)
Excellent!
Excellent tutorial!! I'll try it out soon!
I had a few queries; how did team B enable hardware acceleration? I mean, what files were modified? Are these files included in your zip or they're built while compiling? Or are they kernel related?
Moreover, I am also keen on learning to build kernels, but I wanna do that after I finish learning everything in CM7 building. So, if you have any idea about it, members here would be pleased if you post a tutorial for that also.
Thanks once again for this tutorial!
Thank you very much succulent for the kernel.
Can I use it for my MIUI rom?
(post deleted)
rjmohit said:
Excellent tutorial!! I'll try it out soon!
I had a few queries; how did team B enable hardware acceleration? I mean, what files were modified? Are these files included in your zip or they're built while compiling? Or are they kernel related?
Moreover, I am also keen on learning to build kernels, but I wanna do that after I finish learning everything in CM7 building. So, if you have any idea about it, members here would be pleased if you post a tutorial for that also.
Thanks once again for this tutorial!
Click to expand...
Click to collapse
They just built it from source, I believe. Mixing the B&N source with cm7 broke it, and using a full cm7 source fixed it (unless I'm mistaken)
Sent from my Nook Tablet using XDA
Also, give me a week and I'll post my kernel guide here. Im going to cover both anykernel and normal update.zip for the tab.
Sent from my Nook Tablet using XDA
cobrato said:
Thank you very much succulent for the kernel.
Can I use it for my MIUI rom?
Click to expand...
Click to collapse
Sure. For your information, if you use my kernel, you need to use the wifi contents in the vendor/../wifi folder or else your wifi won't work. Else, you can compile your own wifi modules. Modules depend on kernel version.
succulent said:
Sure. For your information, if you use my kernel, you need to use the wifi contents in the vendor/../wifi folder or else your wifi won't work. Else, you can compile your own wifi modules. Modules depend on kernel version.
Click to expand...
Click to collapse
Thanks. I use stock wifi modules (1.4.1) and they work perfect
Why this kernel cannot flash wih TEAM-B+ ROM?
I try compiled a kernel of NT official source code with NFS support and it crashed with TEAM-B+ ROM.
highfly22 said:
Why this kernel cannot flash wih TEAM-B+ ROM?
I try compiled a kernel of NT official source code with NFS support and it crashed with TEAM-B+ ROM.
Click to expand...
Click to collapse
Need more information in your post.
The reason you don't use this kernel with Team-B rom is that the kernel version numbering is different, although you can change it in the Makefile to match Team-B kernel version. The ramdisk is also different. It'll have effects on the rom like no wifi or won’t boot.
Simply compiling the kernel and sticking it to a boot.img will not work; hence, I put my way of making boot.img in the second post. You need attach bauwks second u-boot to your boot.img if you do it manually. Since I have a different ramdisk than Team-B rom, you need to wipe your cache.
YES! Got it working, I was able to boot a boot.img & recovery.img using my own kernel by following this tutorial. But, some problems I added extra file to the recovery.img /sbin folder (genptable, simg2img, make_ext4fs mkdosfs from my unbrick tools) and they show up and run correctly but the whole input stuff is broken, the tablet behaves as if the volume keys are always pressed and the bar is always moving the n key is not able to select any menu option. Any pointers on how to fix this?
PS
Here is my recovery.img if you want to test http://dl.dropbox.com/u/64885133/recovery.img
and my build script
Code:
cd /mnt/scratch/src/distro/kernel/android-2.6.35
export DST=/mnt/scratch/cm7src/out/target/product/acclaim
export ARCH=arm
export CROSS_COMPILE=/opt/arm-2010q1/bin/arm-none-linux-gnueabi-
export BOARD_KERNEL_CMDLINE="androidboot.console=ttyO0 console=ttyO0,115200n8 [email protected] [email protected] [email protected] init=/init rootwait vram=32M,9CC00000 omapfb.vram=0:[email protected]"
export KERNEL_DIR=/mnt/scratch/src/distro/kernel/android-2.6.35
make mrproper
make android_4430BN_defconfig
cat fs-conf >> .config
make oldconfig
make -j4 zImage
make -j4 modules
cp -a arch/arm/boot/zImage $DST/kernel
cp -a drivers/media/video/omapgfx/gfx_vout_mod.o $DST/system/etc/
cd /mnt/scratch/src/mydroid/hardware/ti/wlan/wl1283/platforms/os/linux
make clean
make TNETW=1273
cp -a tiwlan_drv.ko $DST/system/etc/
cd ../../../../wl1283_softAP/platforms/os/linux/
make clean
make TNETW=1273
cp -a tiap_drv.ko $DST/system/etc/wifi/softap
cd /mnt/scratch/src/mydroid/hardware/ti/wlan/wl1283/firmware
cp -a firmware.bin tiwlan.ini.activemode wlan_cu.st $DST/system/etc/
cd /mnt/scratch/src/distro/android/fwram
make clean
make
cp -a fwram.ko $DST/system/etc/
cd /mnt/scratch/src
and this is my fs-conf (Since I use fedora, I mostly use their style of generating kernel configs)
Code:
CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_AFS_FS is not set
# CONFIG_CEPH_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_NCP_FS is not set
# CONFIG_SMB_FS is not set
CONFIG_NLS_UTF8=y
CONFIG_SLOW_WORK=y
# CONFIG_SLOW_WORK_DEBUG is not set
CONFIG_CIFS=y
CONFIG_CIFS_DEBUG2=y
CONFIG_CIFS_EXPERIMENTAL=y
CONFIG_CIFS_POSIX=y
CONFIG_CIFS_STATS=y
# CONFIG_CIFS_STATS2 is not set
# CONFIG_CIFS_WEAK_PW_HASH is not set
CONFIG_CIFS_XATTR=y
CONFIG_EXPORTFS=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFSD=y
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
# CONFIG_ROOT_NFS is not set
CONFIG_RPCSEC_GSS_KRB5=y
# CONFIG_RPCSEC_GSS_SPKM3 is not set
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_TUN=y
CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_STAT_DETAILS=y
CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
# CONFIG_BLK_DEV_MD is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_DM_CRYPT=y
# CONFIG_DM_DEBUG is not set
# CONFIG_DM_DELAY is not set
# CONFIG_DM_MIRROR is not set
# CONFIG_DM_MULTIPATH is not set
# CONFIG_DM_SNAPSHOT is not set
CONFIG_DM_UEVENT=y
# CONFIG_DM_ZERO is not set
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
meghd00t said:
YES! Got it working, I was able to boot a boot.img & recovery.img using my own kernel by following this tutorial. But, some problems I added extra file to the recovery.img /sbin folder (genptable, simg2img, make_ext4fs mkdosfs from my unbrick tools) and they show up and run correctly but the whole input stuff is broken, the tablet behaves as if the volume keys are always pressed and the bar is always moving the n key is not able to select any menu option. Any pointers on how to fix this?
Click to expand...
Click to collapse
Good job!
You can add this to the acclaim.mk,
Code:
PRODUCT_PACKAGES += \
make_ext4fs \
setup_fs \
PRODUCT_PACKAGES := \
make_ext4fs \
For the recovery part, I didn't test it because we already have recovery tools made by others here. Sorry about that. In the recovery folder, there is a recovery ui file, you can edit it. It's the same one from Whistlestop’s KF device, so the keys might be off. The Nook Color recovery ui file is,
Code:
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <linux/input.h>
#include "recovery_ui.h"
#include "common.h"
#include "extendedcommands.h"
char* MENU_HEADERS[] = { NULL };
char* MENU_ITEMS[] = { "reboot system now",
"apply update from sdcard",
"wipe data/factory reset",
"wipe cache partition",
"install zip from sdcard",
"backup and restore",
"mounts and storage",
"advanced",
NULL };
int device_recovery_start() {
return 0;
}
int device_toggle_display(volatile char* key_pressed, int key_code) {
int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
if (alt && key_code == KEY_L)
return 1;
// allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
if (ui_get_showing_back_button()) {
return get_allow_toggle_display() && (key_code == KEY_MENU || key_code == KEY_END);
}
return get_allow_toggle_display() && (key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
}
int device_reboot_now(volatile char* key_pressed, int key_code) {
return 0;
}
int device_handle_key(int key_code, int visible) {
if (visible) {
switch (key_code) {
case KEY_CAPSLOCK:
case KEY_VOLUMEDOWN:
return HIGHLIGHT_DOWN;
case KEY_LEFTSHIFT:
case KEY_VOLUMEUP:
return HIGHLIGHT_UP;
case KEY_POWER:
if (ui_get_showing_back_button()) {
return SELECT_ITEM;
}
if (!get_allow_toggle_display())
return GO_BACK;
break;
case KEY_HOME:
case KEY_LEFTBRACE:
case KEY_ENTER:
case BTN_MOUSE:
case KEY_CENTER:
case KEY_CAMERA:
case KEY_F21:
case KEY_SEND:
return SELECT_ITEM;
case KEY_END:
case KEY_BACKSPACE:
case KEY_BACK:
if (!get_allow_toggle_display())
return GO_BACK;
}
}
return NO_ACTION;
}
int device_perform_action(int which) {
return which;
}
int device_wipe_data() {
return 0;
}
One more thing,
I think fattire/dalingrin added postrecoveryboot.sh to the recovery folder to clear the boot count so your NT doesn’t reset itself.
postrecoveryboot.sh, I’ve added bootdata partition which is where the boot count is on NT. Boot count might also be on rom partition, I don’t know.
Code:
#!/sbin/sh
# Resets the boot counter and the bcb instructions
mkdir /rom
mount /dev/block/mmcblk0p5 /rom
mkdir /bootdata
mount /dev/block/mmcblk0p6 /bootdata
# Zero out the boot counter
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
dd if=/dev/zero of=/bootdata/BootCnt bs=1 count=4
# Reset the bootloader control block (bcb) file
dd if=/dev/zero of=/rom/bcb bs=1 count=1088
dd if=/dev/zero of=/bootdata/BCB bs=1 count=1088
umount /rom
rmdir /rom
umount /bootdata
rmdir /bootdata
You will also have to add this to the AndroidBoard.mk,
Code:
file := $(TARGET_RECOVERY_ROOT_OUT)/sbin/postrecoveryboot.sh
ALL_PREBUILT += $(file)
$(file) : $(LOCAL_PATH)/recovery/postrecoveryboot.sh | $(ACP)
$(transform-prebuilt-to-target)
Ok, Thanks for all that info, I will try all this and report back tomorrow.
Is there any easy way to build static native c or c++ code for android ndk is complicated I gave up and built on fedora arm (hacked up really) but now I have gdisk and sgdisk!!
How do I contribute these binaries back to clockwork mod to replace the ancient and buggy parted that lives inside clockworkmod?
Are there any plans to make a kernel compatible with Team B+ CM7 ROM? This would be similar to what was done in the Nook Color world with dalingrin's OC'ed kernel.
Ok I worked a bit on that pointer, got myself a working cwm, and Here are the results http://dl.dropbox.com/u/64885133/myrecovery.zip
and attached is the diff from your sources, I have left out the binary files you can fine then in other posts here.
Thank you for the inspiration.
I have a complete cm7 locally built and with a fully functional recovery, which is actually proving useful in unbricking and fixing partition table issues
As you dot seem to have a proper github repo here is a zip containing my changes to your file.
Once again thank you.
http://dl.dropbox.com/u/64885133/cm7stuff/meghd00t-cm7-mods-src.zip
I will post my updated source on github later this week. I have one small coding that need to be fix and I am not even a coder.
I didn't post my rom on xda because I wanted people to learn to compile their own rom. Fattire did similar thing with cm9 on Nook Color forum. Plus, Team-B had first dib on CM7. I rather not post similar rom. However, if you Google, you might find it.
I know I saw your art and was blown away! 3 years ago when I got this PC I went and got the W700, at that time there was no driver for the built in Wacom and I wasted my time waiting, then I got tired and made a patch and pushed it upstream all this took another 15 months. Now I actually have a working wacom on the laptop but I hardly ever use it!
If you let me know what is bugging you I could take a look, maybe I know something.
thanks once more for sharing!
Ok, I got everything updated and uploaded to github.
https://github.com/succulent/android_device_bn_acclaim
https://github.com/succulent/android_vendor_bn_acclaim
https://github.com/succulent/acclaim_recovery_sdcard
Enjoy compiling your own rom.

[GUIDE] Newbie-Proof Tutorial Howto Compile Kernel For Galaxy Ace incl. Screenshot

Hi guys. U might not know me but in the past i've compiled my own custom kernel for galaxy ace. So in this tutorial i'll provide tutorial step by step howto compile kernel for anyone who wish to try. i'll try to make this as simple as possible for anyone to understand. But do excuse my poor english tho, its not my spoken language nor my native language
1- Most important of all is that u need to have linux installed in your pc. In this tutorial i use Fedora 17 gnome 64bit freshly installed, so i'll be providing indepth tutorial using fedora. But it really doesnt matter which distro i use; ubuntu, fedora, opensuse, debian, arch etc, in theory u can compile kernel in all linux distro u can think of, as long its linux. Sorry windows guys, no kernel compiling for u
Please note that i said installed. U need to have a linux distro installed, by dualbooting or by virtualisation using vmware or virtualbox, as long as its intalled. Livecd or liveusb enviroment wont work, mandatory need installed enviroment. But dont ask me howto install linux, google is always your friend, ask him/her
Click to expand...
Click to collapse
2- We need to setup our linux with suitable enviroment to build the kernel, by installing dev package etc. First we need to make sure that our system is uptodate. Old package combined with newer one can result in error when compiling. Open linux terminal and type
Code:
sudo yum upgrade
next is to install needed dev package for kernel compiling
Code:
sudo yum install gcc libstdc++ ncurses-devel java-1.7.0-openjdk java-1.7.0-openjdk-devel
Because i'm using 64bit fedora, i also need to install 32bit libs. Ignore this if you're using fedora 32bit.
Code:
sudo yum install glibc-devel.i686 gtk2-devel.i686 gtk-nodoka-engine.i686 libcanberra.i686 libcanberra-gtk2.i686 PackageKit-gtk-module.i686 GConf2.i686 ncurses-libs.i686 xulrunner.i686
Click to expand...
Click to collapse
3- Next is to download and install arm crosscompile toolchain. In this tutorial i use latest toolchain from Codesourcery
Choose to download the EABI release, for ARM processor
{
"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"
}
Download the linux installer as its easier to setup.
Click to expand...
Click to collapse
4- Now we can install the toolchain, but first we need to make it executable. Open terminal and do
Code:
chmod +x /path/to/file/arm-2011.09-69-arm-none-eabi.bin
or just right click on the file and tick to allow executing in permission tab
then just install it. Still in terminal, do
Code:
sh /path/to/file/arm-2011.09-69-arm-none-eabi.bin
and gui installer will appear. Just accept the default choice and continue with the installation until finish.
Click to expand...
Click to collapse
5- For extracting archive, i use this nice bash profile script as universal extract command. Edit bashrc profile file
Code:
gedit ~/.bashrc
and add this on the bottom of the file
Code:
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
and save the file. U need to logout and relogin for this script to take effect.
Now create working dir for later use
Code:
mkdir ~/android && mkdir ~/android/kernel_compiling && mkdir ~/android/ramdisk_extract
Click to expand...
Click to collapse
6- Next, download ace's kernel source. U can grab stock kernel source from here. In this tutorial i download the GT-S5570-S5670-S5830_Opensource_GB.zip.
and extract it
Code:
extract ~/GT-S5570-S5670-S5830_Opensource_GB.zip
u'll get two file, GT-S5830_kernel.tar.gz and GT-S5830_platform.tar.gz. The GT-S5830_kernel.tar.gz is what we need, now extract and copy it into earlier working folder we created (the ~/android/kernel_compiling)
Code:
extract ~/GT-S5830_kernel.tar.gz && cp -R ~/kernel/* ~/android/kernel_compiling
Now that folder should have a bunch of folder and files in it. Thats our kernel source tree.
Click to expand...
Click to collapse
7- Grab boot.img from any stock rom and also wifi module (ar6000.ko) that came with the rom for that kernel. We will need that ar6000.ko later.
Now copy the boot.img into our earlier working folder (~/android/ramdisk_extract)
Code:
cp ~/boot.img ~/android/ramdisk_extract
Click to expand...
Click to collapse
8- Download this tool to extract ramdisk from the boot.img, and extract it into the same folder that we put our boot.img earlier
Code:
cd ~/android/ramdisk_extract && extract ~/Bootimgutils.zip
Now make those three file that we extracted executable
Code:
chmod +x ~/android/ramdisk_extract/mkbootimg && chmod +x ~/android/ramdisk_extract/repack_bootimg.pl && chmod +x ~/android/ramdisk_extract/repack_bootimg.pl
or just use the right click like step 4 above.
Click to expand...
Click to collapse
9- Time to extract ramdisk from the boot.img. Still in terminal do
Code:
cd ~/android/ramdisk_extract && BASE="0x$(od -A n -h -j 34 -N 2 boot.img|sed 's/ //g')0000" && echo $BASE
Note the output, eg
Code:
0x13600000
So thats our kernel base parameter
Now to extract ramdisk
Code:
cd ~/android/ramdisk_extract && ./split_bootimg.pl boot.img && mkdir ramdisk && cd ramdisk && gzip -dc ../boot.img-ramdisk.gz | cpio -i
Note the output, eg
Code:
Page size: 4096 (0x00001000)
Kernel size: 3137536 (0x002fe000)
Ramdisk size: 3153892 (0x00301fe4)
Second size: 0 (0x00000000)
What we need is the pagesize. Now we know that its 4096.
Now after we look into the ramdisk_extract folder theres a bunch of files produced, and in the folder itself contain another folder, ramdisk. In the ramdisk folder contains our actual extracted ramdisk including bootlogo, modules, scipts etc. In case u were wondering, this is where the famous cfroot autoroot script works its magic.
Click to expand...
Click to collapse
Still excited after all this terminal thingy? Good.. keep up the spirit
Now we continue.
10- From previous step we know that ace's kernel base parameter is 0x13600000 and pagesize is 4096. We now look into kernel repack script to make sure its right
Code:
gedit ~/android/ramdisk_extract/repack_bootimg.pl
and look for predefined base parameter and pagesize. It should look like this in line 19
Code:
system ("./mkbootimg --kernel $ARGV[0] --ramdisk ramdisk-repack.cpio.gz --base 0x13600000 --pagesize 4096 -o $ARGV[2]");
Good. The predefined kernel base parameter and pagesize is same with out earlier test result, so no need to alter the file.
Click to expand...
Click to collapse
11- We now need to find localversion of samsung's proprietary module in the extracted ramdisk. In terminal do
Code:
cd ~/android/ramdisk_extract/ramdisk/lib/modules && strings fsr.ko | grep vermagic
and it should produce output like this
Code:
vermagic=2.6.35.7-perf-CL382966 preempt mod_unload ARMv6
what needed is the -CL382966, thats the module localversion.
It depends on which stock boot.img we use. Different boot.img might have different output, what i've shown is what i got from boot.img that i'm using, yours might be different. Do note of the parameter, we need that later.
Click to expand...
Click to collapse
12- Now we look into our kernel source tree folder (~/android/kernel_compiling). There should be a file named make_kernel_GT-S5830.sh. We open that file
Code:
gedit ~/android/kernel_compiling/make_kernel_GT-S5830.sh
or
Code:
head ~/android/kernel_compiling/make_kernel_GT-S5830.sh
it contain something like this
Code:
make cooper_rev03_defconfig
make
edit that file abit to be
Code:
make clean
make cooper_rev03_defconfig
make
and save. Now we know that ace's defconfig (kernel config file) is cooper_rev03_defconfig.
it should be in ~/android/kernel_compiling/arch/arm/configs
now we edit the defconfig
Code:
gedit ~/android/kernel_compiling/arch/arm/configs/cooper_rev03_defconfig
and look for this line
Code:
CONFIG_LOCALVERSION="-perf"
and edit it to include our localversion we got from step 11 above. In my case its -CL382966 so i edited it to be
Code:
CONFIG_LOCALVERSION="-perf-CL382966"
Click to expand...
Click to collapse
13- Next we need to modify kernel makefile to include crosscompile toolchain path and define build for arm architecture
Code:
gedit ~/android/kernel_compiling/Makefile
and look for this section
Code:
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?=
#CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
ARCH =arm
CROSS_COMPILE =../../toolchain/arm-eabi-4.4.3/bin/arm-eabi-
edit it to be
Code:
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?=
#CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
ARCH =arm
CROSS_COMPILE =/home/anonymous/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/arm-none-eabi-
Do note that the path to crosscompile toolchain is not the same as that for u. Lets say that your linux account username is johndoe, the correct path should be
Code:
CROSS_COMPILE =/home/johndoe/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/arm-none-eabi-
so just change it accordingly.
Click to expand...
Click to collapse
14- Still editing the makefile from step 13 above, look for this section
Code:
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-fno-delete-null-pointer-checks
and modify it to be
Code:
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-w \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-error=unused-but-set-variable \
-Wno-format-security \
-fno-delete-null-pointer-checks
and save the file.
Click to expand...
Click to collapse
15- Moment of truth, now we compile the kernel!!
But do make sure that the script from step 12 above is executable
Code:
chmod +x ~/android/kernel_compiling/make_kernel_GT-S5830.sh
then, we compile!!
Code:
cd ~/android/kernel_compiling && ./make_kernel_GT-S5830.sh
if everything working according to plan, there should be a nice bunch of output tailing in terminal, dont close it!! Make yourself a nice hot cup of coffee and wait... wait... wait...
Click to expand...
Click to collapse
Look who's still reading
16- And wait untill it finish. On my dualcore asus laptop with 2gb ram it took a good 20 minutes to finish compiling. If nothing goes wrong, last output will be something like
Code:
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 7 modules
CC arch/arm/common/cpaccess.mod.o
LD [M] arch/arm/common/cpaccess.ko
CC arch/arm/mach-msm/dma_test.mod.o
LD [M] arch/arm/mach-msm/dma_test.ko
CC arch/arm/mach-msm/reset_modem.mod.o
LD [M] arch/arm/mach-msm/reset_modem.ko
CC arch/arm/oprofile/oprofile.mod.o
LD [M] arch/arm/oprofile/oprofile.ko
CC drivers/input/evbug.mod.o
LD [M] drivers/input/evbug.ko
CC drivers/net/wireless/libra/librasdioif.mod.o
LD [M] drivers/net/wireless/libra/librasdioif.ko
CC drivers/scsi/scsi_wait_scan.mod.o
LD [M] drivers/scsi/scsi_wait_scan.ko
Congratulations!! u just compile your own kernel
Click to expand...
Click to collapse
17- Next is to repack our newly compiled kernel with the extracted ramdisk from step 9 earlier. Our compiled kernel will be in form of zImage file, located in ~/android/kernel_compiling/arch/arm/boot.
So in terminal do
Code:
mv ~/android/ramdisk_extract/boot.img-kernel ~/android/ramdisk_extract/boot.img-kernel.bak && cp ~/android/kernel_compiling/arch/arm/boot/zImage ~/android/ramdisk_extract/boot.img-kernel && cd ~/android/ramdisk_extract && ./repack_bootimg.pl boot.img-kernel ramdisk bootnew.img
At last we did it. Our kernel is ready, look in ~/android/ramdisk_extract, theres a new file named bootnew.img. Thats what we accomplish this far. Now the bootnew.img can be flash using cwm or such. Remember the ar6000.ko in step 7 earlier? Thats the wifi module. If this compiled kernel flashed and boot fine, just replace phone default wifi module in /system/lib/modules with our own wifi module from step 7 and wifi will work
Click to expand...
Click to collapse
So thats it for now. I'll continue again with advanced steps like pulling patch from github to add cpu governor and disk io scheduler, compressing kernel with better lzma compression for smaller filesize and more stuff later
For now, kernel compiled using this guide should boot on original galaxy ace (not the "i" variant, because we using original ace source, not the "i" variant source. both using different hadware) running stock rom or rom based on stock (because we using stock ramdisk extracted from stock boot.img, will not work on cm because it uses its own ramdisk).
And credit also goes to ketut.kumajaya and madman for some info i got from them that i included in this guide.
another placeholder
No offence bro , nice guide and all , but if I remember all guides should be in General
This was sent from a Galaxy Ace. Problem?
Its development guide
Btw nice one
Gonna try it again on my pc
Hopefully this time my pc get the kernel to compile and dont stuck at some parts
Sent from my i9070 using xda premium
Great guide! I'm going to try it since its holiday now! Thanks!
Respecting others never hurt, let's build a better XDA community.
Nice guide
an0nym0us_ nice, I hope you will add to this guide how to make boot.img.
btw fedora is nice UI
going to install it instead of Linux mint
CoolCatGetHome said:
btw fedora is nice UI
going to install it instead of Linux mint
Click to expand...
Click to collapse
thats pure gnome 3.x where as mint comes with themed one / you installed different shell
@anonymous_ in ubuntu i don't think you can directly do sh packagename
you need to do
Code:
dpkg-reconfigure -plow dash
and select No and then run /bin/sh packagename
dragonnn said:
an0nym0us_ nice, I hope you will add to this guide how to make boot.img.
Click to expand...
Click to collapse
yes, thats what i intended with this tuts. until succesful creating boot.img, or maybe even further until creating cwm flashable zip.
madman said:
thats pure gnome 3.x where as mint comes with themed one / you installed different shell
@anonymous_ in ubuntu i don't think you can directly do sh packagename
you need to do
Code:
dpkg-reconfigure -plow dash
and select No and then run /bin/sh packagename
Click to expand...
Click to collapse
thank you. yes thats true for ubuntu, to change from using bash to sh.
but since this tuts is using fedora so i'm writing what relevant with fedora. fedora stil uses sh by default
Nice guide. Moved to General.
You have great english for a non-native speaker
And how universal is this? If I had the kernel source for any phone this might apply?
Sent from my Nexus S using xda premium
scoffyburito said:
You have great english for a non-native speaker
And how universal is this? If I had the kernel source for any phone this might apply?
Sent from my Nexus S using xda premium
Click to expand...
Click to collapse
pretty much universal.
got kernel source+boot.img for the ramdisk+correct base parameter+correct pagesize+correct defconfig and u can compile for any device.
an0nym0us_ said:
Hi guys. U might not know me but in the past i've compiled my own custom kernel for galaxy ace. So in this tutorial i'll provide tutorial step by step howto compile kernel for anyone who wish to try. i'll try to make this as simple as possible for anyone to understand. But do excuse my poor english tho, its not my spoken language nor my native language
Click to expand...
Click to collapse
A little late... lol... great work
Also to compile faster make -j[number of cores+1]
example
Dual core
make -j3
Sent from my GT-S5830 using XDA
scoffyburito said:
You have great english for a non-native speaker
And how universal is this? If I had the kernel source for any phone this might apply?
Sent from my Nexus S using xda premium
Click to expand...
Click to collapse
Just that module local version will not be applicable as only samsung kept fsr modules proprietory closed... Newer Samsung devices don't have it as i observed
Sent from Galaxy Ace which just landed on "MOON"
i get yum not found
SonyXperiaAce said:
i get yum not found
Click to expand...
Click to collapse
you should read that guide uses fedora as compiling system and you are probably new to linux as well as package managers and using ubuntu so steps are somewhat different
We can just guess that he use ubuntu, if so its apt-get.
But please dont tell u try that on windows cmd
Btw difference only for yum and apt-get, and package name. Anything else is the same. And ubuntu needs more dev package to be installed than fedora. Thats why I love fedora

[TUTORIAL] How to create a C++ Qml Ubuntu Touch Application from start to end

How to create a C++ Qml Ubuntu Touch Application from start to end (now with easy setup)
(Including packaging and creating your own ppa)
Important! Only use lowercase for your project name otherwise your gonna have a lot of problems
I created a branch for easy access but I recommend you still read the tutorial.
So to create the basic environment you can use the following (with the rename.sh you change all the important values)
Code:
bzr branch lp:~hansueli-burri/+junk/CreateYourProject
cd CreateYourProject/
./rename.sh
1. Things you need before we start
Create a Lauchpad Account (https://launchpad.net)
Create your OpenPGP key (Needed for packaging)
Sign the Ubuntu Code of Conduct (Needed to create a PPA)
Register an SSH Key (https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair) (Needed for uploading to lauchpad)
Install the Ubuntu SDK (http://developer.ubuntu.com/get-started/gomobile/)
2. How to start your Project?
Well the default templates didn't work for me so we create a custom project.
2.1. Create a new Folder (with the name of your project)
In my case apcalc-qml
2.2. Create a subfolder for your QML-files and a subfolder for your c++ files
In my case qml and cpp
2.3. Now we create a new Project-file
In my case apcalc-qml.pro
That looks something like this (When you create a new class it should be added automaticly if not you have to add it your self, like the applicationdata class)
apcalc-qml.pro
Code:
[COLOR="Purple"]QT[/COLOR] += qml quick
[COLOR="Green"]# If your application uses the Qt Mobility libraries, uncomment the following
# lines and add the respective components to the MOBILITY variable.
# CONFIG += mobility
# MOBILITY +=
#C++ source files[/COLOR]
[COLOR="Purple"]SOURCES[/COLOR] += cpp/main.cpp\
cpp/applicationdata.cpp\
[COLOR="Green"]#C++ header files
[/COLOR][COLOR="Purple"]HEADERS[/COLOR] += cpp/applicationdata.h
[COLOR="Green"]#Path to the libraries...
[/COLOR][COLOR="Purple"]INCLUDEPATH[/COLOR] += $$PWD\
$$PWD/../../../../usr/lib
[COLOR="Purple"]DEPENDPATH[/COLOR] += $$PWD/../../../../usr/lib
[COLOR="Green"]#Path to "other files" in this case the QML-Files
[/COLOR][COLOR="Purple"]OTHER_FILES[/COLOR] += \
qml/main.qml\
qml/basicCalc/*.qml
2.4. Now we should create the C++, Source, Header and QML files.
main.cpp
Code:
[COLOR="Blue"]
#include [COLOR="Green"]<QtGui/QGuiApplication>[/COLOR]
#include [COLOR="Green"]<QGuiApplication>[/COLOR]
#include [COLOR="Green"]<QQuickView>[/COLOR]
#include [COLOR="Green"]<QtQml/qqmlcontext.h>[/COLOR]
#include [COLOR="Green"]<stdio.h>[/COLOR]
#include [COLOR="Green"] "applicationdata.h"[/COLOR]
[/COLOR]
[COLOR="Olive"]int [/COLOR]main([COLOR="Olive"]int[/COLOR] argc, [COLOR="Olive"]char[/COLOR] *argv[])
{
[COLOR="Purple"]QGuiApplication[/COLOR] app(argc, argv);
[COLOR="Purple"]QQuickView[/COLOR] view;
[COLOR="Purple"]ApplicationData[/COLOR] data;
[COLOR="Green"] //Resize Mode so the content of the QML file will scale to the window size[/COLOR]
view.setResizeMode([COLOR="Purple"]QQuickView[/COLOR]::[COLOR="Purple"]SizeRootObjectToView[/COLOR]);
[COLOR="Green"] //With this we can add the c++ Object to the QML file[/COLOR]
view.rootContext()->setContextProperty([COLOR="Green"]"applicationData"[/COLOR], &data);
[COLOR="Green"] //Resolve the relativ path to the absolute path (at runtime)[/COLOR]
[COLOR="Olive"]const[/COLOR] [COLOR="Purple"]QString[/COLOR] qmlFilePath= [COLOR="Purple"]QString[/COLOR]::fromLatin1([COLOR="Green"]"%1/%2"[/COLOR]).arg([COLOR="Purple"]QCoreApplication[/COLOR]::applicationDirPath(), "qml/main.qml");
view.setSource([COLOR="Purple"]QUrl[/COLOR]::fromLocalFile(qmlFilePath));
[COLOR="Green"] //For debugging we print out the location of the qml file[/COLOR]
[COLOR="Purple"]QByteArray[/COLOR] ba = qmlFilePath.toLocal8Bit();
[COLOR="Olive"]const char[/COLOR] *str = ba.data();
printf([COLOR="Green"]"Qml File:%s\n"[/COLOR],str);
[COLOR="Green"] //Not sure if this is nessesary, but on mobile devices the app should start in fullscreen mode[/COLOR]
[COLOR="Blue"]#if[/COLOR] defined([COLOR="Purple"]Q_WS_SIMULATOR[/COLOR]) || defined([COLOR="Purple"]Q_OS_QNX[/COLOR])
view.showFullScreen();
[COLOR="Blue"] #else[/COLOR]
view.show();
[COLOR="Blue"] #endif[/COLOR]
[COLOR="Olive"]return[/COLOR] app.exec();
}
main.qml
Code:
import QtQuick 2.0
[COLOR="Olive"]import[/COLOR] Ubuntu.Components 0.1
[COLOR="Olive"]import[/COLOR] [COLOR="Green"]"basicCalc"[/COLOR]
[COLOR="Olive"]import[/COLOR] QtQuick.Window 2.0
[COLOR="Purple"]MainView[/COLOR] {
[COLOR="Green"] //objectName for functional testing purposes (autopilot-qt5)[/COLOR]
[COLOR="Sienna"]objectName[/COLOR]: [COLOR="Green"]"mainView"[/COLOR]
[COLOR="Sienna"]applicationName[/COLOR]: [COLOR="Green"]"apcalc-qml"[/COLOR]
[COLOR="Sienna"]automaticOrientation[/COLOR]:true;
[COLOR="Sienna"]width[/COLOR]: units.gu(60);
[COLOR="Sienna"]height[/COLOR]: units.gu(100);
[COLOR="Sienna"]id[/COLOR]:root
[COLOR="Purple"]Tabs[/COLOR] {
[COLOR="Sienna"]objectName[/COLOR]: [COLOR="Green"]"Tabs"[/COLOR]
[COLOR="Sienna"]ItemStyle.class[/COLOR]: [COLOR="Green"]"new-tabs"[/COLOR]
[COLOR="Sienna"]anchors.fill[/COLOR]: parent
[COLOR="Sienna"] id[/COLOR]:mainWindow;
[COLOR="Purple"]Tab[/COLOR] {
[COLOR="Sienna"]objectName[/COLOR]: [COLOR="Green"]"Calculator"[/COLOR]
[COLOR="Sienna"]title[/COLOR]:[COLOR="Green"] "Calculator"[/COLOR]
[COLOR="Sienna"]page[/COLOR]:[COLOR="Purple"]BasicCalc[/COLOR]{
[COLOR="Sienna"]width[/COLOR]: root.width;
[COLOR="Sienna"]height[/COLOR]: root.height-root.header.height;
[COLOR="Sienna"]anchors.top[/COLOR]: parent.top;
[COLOR="Sienna"]anchors.topMargin[/COLOR]: root.header.height;
[COLOR="Sienna"]onToCalculateChanged[/COLOR]: {
[COLOR="Green"] //access to the c++ Object [/COLOR]
result=[COLOR="Blue"]applicationData[/COLOR].calculate(toCalculate);
}
}
}
}
}
applicationdata.h
Code:
[COLOR="Blue"]#ifndef[/COLOR] APPLICATIONDATA_H
[COLOR="Blue"]#define APPLICATIONDATA_H
#include[/COLOR] [COLOR="Green"]<QObject>[/COLOR]
[COLOR="Olive"]class[/COLOR] [COLOR="Purple"]ApplicationData[/COLOR] : [COLOR="Olive"]public[/COLOR] [COLOR="Purple"]QObject[/COLOR]
{
[COLOR="Blue"] Q_OBJECT[/COLOR]
[COLOR="Olive"]public[/COLOR]:
[COLOR="Olive"]explicit[/COLOR] [COLOR="Purple"]ApplicationData[/COLOR]([COLOR="Purple"]QObject[/COLOR] *parent = [COLOR="Blue"]0[/COLOR]);
[COLOR="Purple"] Q_INVOKABLE QString [/COLOR]calculate([COLOR="Purple"]QString[/COLOR]) [COLOR="Olive"]const[/COLOR];
[COLOR="Olive"]signals[/COLOR]:
[COLOR="Olive"]public slots[/COLOR]:
};
[COLOR="Blue"]#endif[/COLOR] // APPLICATIONDATA_H
applicationdata.cpp
Code:
[COLOR="Blue"]#include[/COLOR] [COLOR="Green"]"applicationdata.h"[/COLOR]
[COLOR="Purple"]ApplicationData[/COLOR]::[COLOR="Purple"]ApplicationData[/COLOR]([COLOR="Purple"]QObject[/COLOR] *parent) :
[COLOR="Purple"]QObject[/COLOR](parent)
{
}
[COLOR="Purple"]QString ApplicationData[/COLOR]::calculate([COLOR="Purple"]QString[/COLOR] command) [COLOR="Olive"]const[/COLOR] {
[COLOR="Green"] // Some Logic comes here[/COLOR]
[COLOR="Olive"]return[/COLOR] command;
}
Those were the important files.
Never forget to mark your functions as Q_INVOKABLE otherwise you can't access them from within the qml file.
You can have a look at the other qm files at http://bazaar.launchpad.net/~hansueli-burri/+junk/apcalc-qml/files
Before you can build your project we have to edit the build properties and add a custom build and clean up step. It should look something like this:
{
"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"
}
3. Packaging
Lets start with the easy things.
3.1. Create an App icon
Call it something like <YourProjectName>64.png
We will use this in the Desktop file.
3.2. Create a bin file <YourProjectName>.bin
It's a very simple textfile containing something like this, and nothing more.
Code:
/usr/share/<YourProjectName>/<YourBinaryName>
The Binary name will most probably be the same as your project name.
But It can be whatever you want because we create it in the rules file manually.
3.3. Create a desktop file
Here you got an example how to do it.
Code:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=<YourProjectName>
Exec=/usr/share/<YourProjectName>/<YourBinaryName>
Icon=/usr/share/<YourProjectName>/<YourProjectName>64.png
StartupNotify=true
X-Ubuntu-Touch=true
X-Ubuntu-StageHint=SideStage
3.4.Debian packaging
First you create the debian folder in your project folder, containing the following files
changelog
control
copyright
install
compat
rules
and a Subfolder called source containing a file called format
The content of the format file should be:
Code:
3.0 (native)
The other files should contain the following. (for the original files go to http://bazaar.launchpad.net/~hansueli-burri/+junk/apcalc-qml/files/head:/debian/)
changelog
Here you can document your changes, changelog entries look something like:
Code:
<YourProjectName (0.1) raring; urgency=low
* initial release
-- <Full OpenPGP Identifier (Full name and email address)> Sat, 4 April 2013 00:00:00 +0200
for more information google it.
control
Here you put your build dependencies, dependencies for running your application, your homepage, discription and so on.
I think all the Build-Depends listed bellow are nessesary to successfully compile and build the qt5 qml project but correct me if I'm wrong.
Code:
Source: [COLOR="Gray"]<YourProjectName>[/COLOR]
Priority: extra
Maintainer: [COLOR="Gray"]<Full OpenPGP Identifier (Full name and email address)> [/COLOR]
Build-Depends: debhelper (>= 9),
qtbase5-dev,
qtdeclarative5-dev,
qt5-default,
[COLOR="Gray"]<YourBuildDependencies>[/COLOR]
Standards-Version: 3.9.4
Section: misc
Homepage: [COLOR="Gray"]<YourHomePage>[/COLOR]
Package: [COLOR="Gray"]<YourPackageName>[/COLOR]
Section: misc
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends}, ${misc:Depends},
qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
qtdeclarative5-qtquick2-plugin,
[COLOR="Gray"] <YourRunningDependencies>[/COLOR]
Description: [COLOR="Gray"]<YourShortDescription>
<YourLongDescription>[/COLOR]
copyright
Here you put licencing information mine looks like this
Code:
Format: http://dep.debian.net/deps/dep5
Upstream-Name: [COLOR="Gray"]<YourPackageName>[/COLOR]
Source:
Files: *
Copyright: 2013 [COLOR="Gray"]<YourName>[/COLOR]
License: GPL-3.0
Files: debian/*
Copyright: 2013 [COLOR="Gray"]<YourName>[/COLOR]
License: LGPL-3.0
License: GPL-3.0
This package is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License can be found in "/usr/share/common-licenses/GPL-3".
License: LGPL-3.0
This package is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU Lesser General
Public License can be found in "/usr/share/common-licenses/LGPL-3".
Install
If someone knows what this is needed for please tell me, cause I don't know, but with the following content everything will work;
Code:
usr/share/applications
usr/bin
usr/share/[COLOR="Gray"]<YourProjectName>[/COLOR]
compat
It just contains an 8, I also don't know why.
Code:
8
rules
This is a rather important file. Because here we define some of the logic to deploy the package.
Mine looks like this. You have to add all the files that need to be copied.
To understand what it does:
The content of $(CURDIR)/debian/tmp/usr/share/<YourProjectName> for example will be copied to /usr/share/<YourProjectName> when you install the package.
Code:
[COLOR="Blue"]#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# Work-around for some machines where INSTALL_ROOT is not set properly by
# dh_auto_install[/COLOR][COLOR="DimGray"]
[COLOR="MediumTurquoise"]override_dh_auto_install:[/COLOR]
dh_auto_install -- INSTALL_ROOT=$([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp
[COLOR="Blue"]# Workaround a bug in that debhelper package version[/COLOR]
[COLOR="MediumTurquoise"]override_dh_install:[/COLOR]
[COLOR="DarkRed"]mkdir[/COLOR] -p $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/applications/
[COLOR="DarkRed"]mkdir[/COLOR] -p $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/bin/
[COLOR="DarkRed"]mkdir[/COLOR] -p $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/apcalc-qml/
[COLOR="DarkRed"]mkdir[/COLOR] -p $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/apcalc-qml/
[COLOR="DarkRed"]cp[/COLOR] apcalc-qml.desktop $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/applications/
[COLOR="DarkRed"]cp[/COLOR] apcalc-qml $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/apcalc-qml/apcalc-qml
[COLOR="DarkRed"]cp[/COLOR] *.png $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/apcalc-qml/
[COLOR="DarkRed"]cp[/COLOR] apcalc-qml.bin $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/bin/apcalc-qml
[COLOR="DarkRed"]cp[/COLOR] -r qml/ $([COLOR="SeaGreen"]CURDIR[/COLOR])/debian/tmp/usr/share/apcalc-qml/
dh_install --sourcedir=debian/tmp --fail-missing
[COLOR="MediumTurquoise"]%:[/COLOR]
dh [email protected][/COLOR]
4. Upload everything to Lauchpad
You can push (upload) personal branches (those not related to a project) with the following command:
bzr push lp:~YOUR_LAUNCHPAD_NAME/+junk/BRANCHNAME
(... more information if requested)
5. Create a recipe and test it
5.1. Setup pbuilder
First of you need to install pbuilder and modify or create ~/.pbuilderrc
Code:
# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="saucy"
TESTING_CODENAME="saucy"
STABLE_CODENAME="raring"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME
"unstable" "testing" "stable")
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=(“saucy",”raring" "quantal" "precise" "oneiric" "natty" "lucid" "hardy")
# Mirrors to use. Update these to your preferred mirror.
DEBIAN_MIRROR="ftp.us.debian.org"
UBUNTU_MIRROR="mirrors.kernel.org"
# Optionally use the changelog of a package to determine the suite to use if
# none set.
if [ -z "${DIST}" ] && [ -r "debian/changelog" ]; then
DIST=$(dpkg-parsechangelog | awk '/^Distribution: / {print $2}')
# Use the unstable suite for Debian experimental packages.
if [ "${DIST}" == "experimental" ]; then
DIST="unstable"
fi
fi
# Optionally set a default distribution if none is used. Note that you can set
# your own default (i.e. ${DIST:="unstable"}).
: ${DIST:="$(lsb_release --short --codename)"}
# Optionally change Debian codenames in $DIST to their aliases.
case "$DIST" in
$UNSTABLE_CODENAME)
DIST="unstable"
;;
$TESTING_CODENAME)
DIST="testing"
;;
$STABLE_CODENAME)
DIST="stable"
;;
esac
# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
: ${ARCH:="$(dpkg --print-architecture)"}
NAME="$DIST"
if [ -n "${ARCH}" ]; then
NAME="$NAME-$ARCH"
DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi
BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build/"
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
# Debian configuration
MIRRORSITE="http://$DEBIAN_MIRROR/debian/"
COMPONENTS="main contrib non-free"
if $(echo "$STABLE_CODENAME stable" | grep -q $DIST); then
EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
OTHERMIRROR="$OTHERMIRROR | deb http://www.backports.org/debian $STABLE_BACKPORTS_SUITE $COMPONENTS"
fi
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
# Ubuntu configuration
MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/"
COMPONENTS="main restricted universe multiverse"
else
echo "Unknown distribution: $DIST"
exit 1
fi
5.2. How to use pbuilder?
Create a base environment for Ubuntu raring
Code:
sudo DIST=raring pbuilder create
Update a base environment for Ubuntu raring
Code:
sudo DIST=raring pbuilder update
Build package for Ubuntu raring
Code:
sudo DIST=raring pbuilder build <working-dir>/<application_name>.dsc
5.3. Content of the recipe
It can be as simple as this.
Code:
# bzr-builder format 0.3 deb-version 0.1~{revno}
lp:~YOUR_LAUNCHPAD_NAME/+junk/BRANCHNAME
(... more information if requested)
6. Create PPA
Now you just need to create your ppa as explaind on launchpad.
Important by default your ppa will not build for arm. you have to ask a question on launchpad to request that your ppa will be build for arm as well.
(... more information if requested)
Sweet! Thank you!!
Sent from my LG-LS970 using xda app-developers app
Awesome work! I was waiting for this kind of tutorial.
thanks for that!:good:
Awesome work! I was waiting for this kind of tutorial.
thanks for that!
Click to expand...
Click to collapse
I was waiting on a tutorial as well, but nobody seed to be intrested in creating one
Can I use Java language for creating program?
imax27 said:
Can I use Java language for creating program?
Click to expand...
Click to collapse
Please no.
BTW no, really, Ubuntu (luckily) supports only C++ and C languages
Sent from my Nexus 4 using xda premium
Hi guys, how can I pack this into .click package for Ubuntu Touch?

[TUT] Introduction into Kernel development

INTRODUCTION INTO KERNEL DEVELOPMENT
PREPARATION
This guide is NOT a full development tutorial! For development of kernels you should be familiar with C. I cannot teach you full C - would be too much for me - but I can show you how to prepare a build environment especially for RAZR Kexec Kernel building! At the end you will find some first steps about how to develop a kernel.
As soon as you have a full dev setup you will be motivated to proceed with learning C - hopefully
For me it worked!
The reason is that I would like to see more people giving it a shot! Kexec is wondeful and it would be great if there are some more people working on kernels.
Please leave me some credits if this tutorial helped you wherever you provide your work! THX!
OVERVIEW
1. Install Linux
2. Setup build environment
3. Initialize Kernel Source
3.1 Branches
3.2 How to compile a kernel
4. Create your first development branch (Add a new Governor)
5. Git Commands
I will tell you the way I started once and guide you through the preparation.
It's important to know how to setup a build environment! The best way to learn about kernel development is to learn by practice!
How to setup a build environment
1. INSTALL LINUX
I suggest Linux Mint 15 Cinnamon (or Linux Mint 15 Mate is good for older for low-spec Systems) - it's free and very easy to install near Windows 7 (dual boot). After the installation you will have a very Windows-like desktop environment which is easy to handle also for beginners. Then you need to learn the Linux Shell!
*of course you can install any other Linux, like Ubuntu. Linux Mint is based on Ubuntu 13.04 and I use it as well.
If your CPU supports 64 bit you should install the 64 bit version! This is impossible also later when it comes to install libraires for development, etc. There are mostly two versions, whether for x32 or x64.
After the installation of Linux you need to imstall related software and depencies.
2. SETUP BUILD ENVIRONMENT
Now, Linux is installed, we begin to setup the build environment.
First install Git which is the main part for using services like Github, etc..
We will install also adb and fastboot!
NOTE
The main installation command for packages in Linux is:
apt-get install (mostly used with 'sudo' ("superuser doers" - admin), then it will be:
sudo apt-get install package-name
You can combine one command to imnstall multiple packages, like:
sudo apt-get install package-name package-name ...
It doesn't matter how much names you enter!
NOTE: Sometimes you will have to confirm the installation of a specific package, means it will ask you for proceed (e.g.: ...this will take xx mb of space (J/n) ?).
Press "j" and enter in this case.
Click to expand...
Click to collapse
Let's start!
Open a shell (terminal) and type:
Code:
sudo apt-get install git android-tools-adb android-tools-fastboot
(you will have to enter your password. Keep in mind that you won't see any input when typing passwords in Linux!)
Now you have installed adb, fastboot and Git!
After this you need to create a working space which means you have to download the full Android source to be able to build your kernel later.
Still in Terminal make sure you're in your user root directory (just type "cd" to get back into your root dir). Now you have to create a new directory for Android sources. Therefor we use the "mkdir" command (make directory). We need to create a folder structure, so we create another folder inside of your new folder:
Code:
mkdir android
cd android
mkdir system
NOTE
This will create: /home/android/system
There is a simpler way to create a folder structure by using on single command. Just add a "-p" to the mkdir command to create multiple directories:
Code:
mkdir -p ~/android/system
NOTE
The "-p" lets you also create directories while being somewhere else!
The "~" symbol is a placeholder for your home folder! It tells the terminal that you want to create the folders in your "home" dir. For better understanding I'll show you the command w/o the placeholder again:
mkdir -p /home/android/system
Click to expand...
Click to collapse
Now you have install the depencies (libraires, etc, needed for compiling Android). So you are still in your terminal and type:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc
NOTE
These depencies are for 32 bit & 64 bit systems!!
Click to expand...
Click to collapse
Now we need some additional libs because we are using a 64 bit system. Still in terminal install them by using the apt-get command. I will only show you the package names now, so you can practice and see if you have understood it. Install these:
Code:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib
NOTE
You can simply use copy&paste
Click to expand...
Click to collapse
Next step is the creation of the repo base directory. It is needed by the repo software which lets you control and use the git repositories on your local machine (your computer). Use the "mkdir" command to create the following directory:
Code:
mkdir -p ~/bin
Now you have to install the "repo command". It's a binary file, so you have to make it "executable" (runable) by using the "chmod" command. Chmod is similar to the "set_perm("...")" command used by updater-scripts (EDIFY script language). It just sets the permissions of a file, i.e. to allow the execution of this file or to make sure the file can be accessed by any people or other programs.
Enter the following to download the "repo" binary and make it executable (runnable):
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
NOTE
It would be too much to explaing stuff like "Curl", etc..
Click to expand...
Click to collapse
Now we have to make sure that we can call "repo" from anywhere. This means if you're in terminal in for example: $ /home/Downloads and you type "repo" it will tell you usually that "repo" is an unknown command. To avoid this we need to make it generic by adding "repo" to your static PATH (Path of execution). The command:
Code:
export PATH=${PATH}:~/bin
NOTE
if you set an "export" for anything (lkie repo) in your terminal, it will be gone as soon as you exit the terminal or also after a reboot. To keep it in your PATH forever you have to add the "export" to your bashrc file (this file stores your preferred Path commands, it's like a list where you can add whatever you need) to make this change to the path permanent for all future Terminal sessions:
Code:
gedit ~/.bashrc
This will launch a graphical text editor (if it doesn't work, try it with "sudo"). Just copy&paste the following line into it, save it and close:
Code:
export PATH=${PATH}:~/bin
Click to expand...
Click to collapse
Fine! So far we are prepared! Now we have to download the android source!
Still in terminal, type:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
NOTE
"repo init" initializes a repository oy your PC
the Git address is the link to the CM source code repo. YOu just told the computer that you just initialized a CM Git repo in the specifi folder /android/system
Click to expand...
Click to collapse
.
To start the download of all the source code to your computer:
Code:
repo sync
NOTE
This process can take a very long time - depends on your internet connection speed. The source is about 10 GB!!
"repo sync" will be your further command to keep the rpo up-to-date! Just enter it while being in the root dir of the android source (/android/system) at least once a day!
Click to expand...
Click to collapse
Now, when the download has been finished we have to download the prebuilt apps (like terminal emulator, etc):
Code:
cd ~/android/system/vendor/cm
then enter:
Code:
./get-prebuilts
Now there are the vendor files needed! There are two ways to do that: The "easy" way and - sometimes it doesn't work, then you have to use - the "harder" way.
The easy way:
Code:
source build/envsetup.sh
breakfast spyder
NOTE
this will usually download the vendor files (motorola speific device drivers). If you get an error message you have to use the second way (harder way).
Click to expand...
Click to collapse
Click to expand...
Click to collapse
The harder way:
cd to you vendor dir and clone the proprietary files manually:
Code:
cd ~/android/system/vendor
git clone https://github.com/Motorola-OMAP4-CM/proprietary_vendor_motorola.git -b cm-10.2
NOTE
"git clone" will be used always when you want to download a git repository to your computer, so you can work with it locally. e.g on Github.com there is always a clone URL given at the right side of the repo. Just type "git clone <link>" into the terminal to clone this repo.
Click to expand...
Click to collapse
Now open the file explorer (whether by using the mouse or in terminal: nautilus (maybe you you have to install this first) and head to /android/system/vendor.
You will find a folder called "proprietary_vendor_motorola".
Just rename it to "motorola".
NOTE
In the future, everytime you update your repo (repo sync) you will have to update the vendor repo too. Perform this by using "git remote update" command in terminal. Therefore you have to be in /android/system/vendor/motorola, and type:
Code:
git remote update
git pull
Click to expand...
Click to collapse
Congratulations! You have successfully setup your Android build environment!
Now we need the kernel source!
3. INITIALIZE KERNEL SOURCE
So you learned some basics about Git! Proof that you understand it and clone the kernel source repo to your PC! I'll give you the links but you have to clone it yourself! Use the clone URL you find at the following Github repo. Make sure you are NOT cloning into your Android source dir /android/system!)
The source for our 3.0.8 Kernel:
www.github.com/CyanogenMod/android_kernel_motorola_omap4-common
NOTE
Too hard? Let me help you (You can even copy&paste my stuff - but for real learning experience you should try to make it on your own)
Head into this dir:
Code:
cd ~/android
Clone the kernel source:
Code:
git clone https://github.com/CyanogenMod/android_kernel_motorola_omap4-common.git
The new folder will be: ~/android/android_kernel_motorola_omap4-common where your kernel source sits.
When done, you have successfully loaded the kernel source! Fine!
3.1 ---> BRANCHES
Now I am going explain you something about "branches" and how to use them!
A "branch" is a part of almost all git repos. It is very important and also very useful to work with branches!
A typical repository looks like that:
[CODE GIT REPO
|
master branch
/ \
/ \
branch: Test branch: Stable
\ /
\ /
\ /
MERGE changes[/CODE]
The repo contains mostly multiple branches. There is always the "master branch" (can have another name of course, branches can be named like you want) and some lower branches.
The "Master branch" is the main branch!
All other branches are custom and mainly used to test new code or sth else.
Let's say we have a kernel repo! This repo contains the JBX-Kernel. The master branch contains the current STABLE Version of the kernel. Now we want to implement a new feature. But when we use the master branch for development (which is sometimes an experiment) we could potentially break the kernel or its source and make it becoming unusable. Therefore we can use a different branch.
NOTE: A branch is always a copy of this branch where you are while creating a new branch! This means when I am currently in the JBX-Kernel master branch, and I create a new branch from there, then I will get a new branch which includes a full copy of my JBX-Kerne master branch. -- But I can work with it without being scared about breaking my repo!
Then many devs are using a "Merge branch". There we could in example copy all changes (which have been tested successfully before) together into a new branch. This process is called "merging".
Let's say we have finished our new feature inside of a test branch. Now the feature is ready to be built in into the Stable Kernel. Then we merge the test branch into the master branch. Thsi results in an updated master branch which now includes our new feature!
Another possibility to use branches can be found if you want to split our repo into different systems, such like the CM kernel source contains branches for CM10.1 and CM10.2. So there is a branch calld "cm-10.1" and another branch called "cm-10.2".
When you look at the part where we initalized the CM repo, you might notice that the repo URL includes this:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
The line marked with red in the URL points to a specific branch, the cm-10.2 branch.
Now we are still in the kernel source dir!
Because you want to build a 4.3 Kernel we need to be in the right branch for this! There are already branches exisiting in the kernel source (like explained above), it's splitted into different versions (4.2.2 and 4.3).
Still in terminal be sure you're inside your kernel source root dir (~/android/android_kernel_motorola_omap4-common), type:
Code:
git checkout cm-10.2
NOTE
"git checkout" is the command to switch to another branch. But it's also used to create or delete branches. More about that later...
Click to expand...
Click to collapse
The output in the terminal will tell you sth like: "Switched to branch cm-10.2"
(if it's the first time you enter a branch it will download the files first and tell you: "Switched to a new branch cm-10.2". Don't be confused by this. If you try to enter a non-existing branch it will give you an error).
Now you are in the kernel repo, in the 4.3 branch!
Before we start to play with the source code I will show you how to build a kernel! As long as the kernel source is untouched you can be sure that it will work! Also this will make sure you have done everything right so far - as soon as the kernel boots you've built!
3.2 HOW TO COMPILE A KERNEL
To get a first impression about how to build the kernel, please have a deeper look at my personal JBX build script:
https://github.com/RAZR-K-Devs/android_kernel_motorola_omap4-common/blob/JBX_4.3/build.sh
The script is very simple and contains only a few commands which can be used in the terminal as well. For your the script is only interesting until the poiont where it says: "make -j4 TARGET_KERNEL_SOURCE=/home/dtrail/android/android_kernel_motorola_omap4-common/ TARGET_KERNEL_CONFIG=mapphone_OCE_defconfig $OUT/boot.img"
Since the latest Android version and the modified kexec stuff it's not enough anymore to build the kernel only. The PVR source has been moved into the Android source and it must be built together with the kernel in order to get a working (booting) kernel! That's why I don't show you the common way.
In fact you can now build your kernel by taking my build script commands, and enter them - one by one - in your terminal. BUT you have to modify the paths because script was made for use on my computer (so, you probably are not called "dtrail!" ). You have to start in your kernel source dir (this is the location where my build script is being executed). To make it easier for you, I have pasted the script here and changed it so it will work for you. I have removed all comments and echo (output) commands so there are only the related build commands left. I just added comments just for you:
Code:
# THESE LINES (those beginning with #) ARE COMMENTS!!!
# Be in your kernel source: /android/android_kernel_motorola_omap4-common
# this command cleans all leftover files from prior compile (needed)
make mrproper
# We build the kernel and its modules
# enter the Android source dir
cd /android/system
# This command makes sure to use the additional build cache. It will make all fufutre build processes MUCH faster! (YOu have to install ccache first by using apt-get)
export USE_CCACHE=1
# Clean also the Android source dir
make mrproper
make ARCH=arm distclean
# Tell the compiler that we want to build now
source build/envsetup.sh
# Tell the compiler which device we want to build for
lunch cm_spyder-userdebug
# built kernel & modules (This command includes the full path to the kernel course and the used kernel config)
make -j4 TARGET_KERNEL_SOURCE=/home/YOUR_USERNAME_HERE/android/android_kernel_motorola_omap4-common/ TARGET_KERNEL_CONFIG=mapphone_mmi_defconfig $OUT/boot.img
After you entered this your computer will start building. The first compiling process will take longer! But future bui9lds will be built much faster thanks to the use of CCACHE!
CONGRATULATIONS!! You built your first kernel!!
Now we have to create a flashable zip file and flash the kernel to see if it works. >The advanced Linux users from you should have another look into my build script I linked above, there you can see how it automaticall pushes (copy) the fiules into a prepared folder which includes everything needed for a flashable zip and compresses it to a ready zip file!
Other less experienced users can just download my latest JBX-Kernel, unpack it, delete "logo.bin" and do this:
go to (by using mouse or terminal):
Code:
/android/system/out/target/product/spyder
There you will find a file called "kernel" - this is your fresh compiled kernel! Copy it to the unpacked JBX-Kernel folder, into:
Code:
.../JBX-Kernel_whatever.../system/etc/kexec
(and overwrite the previous kernel in there)
Now go to:
Code:
/android/system/out/target/product/spyder/system/lib/modules
There are all the modules you've just built. Copy them to:
Code:
.../JBX-Kernel_whatever.../system/lib/modules
Now compress the folders to a new zip file, copy it to your phone and flash it in recovery!
4. CREATE YOUR FIRST DEVELOPMENT BRANCH (add a new Governor)
to create a new branch locally, be in terminal inside the root of your kernel source, and type:
Code:
git checkout -b BRANCH_NAME
Replace BRANCH_NAME with whatever you want!
Now you created and switched to your new branch! Here you can start plaing with the files!
To develop Linux kernel (Android IS Linux!) you will have to learn C! The kernel is developed in pure C which is the best programming language for drivers (machine controlling).
if you're German I can suggest your the "open Book - C von A bis Z" (Galileo Computing, gratis).
Otherwiase just google for free C books or tutorials.
Take your time, this is not easy in the fist place - but as soon as you are more experienced you will find it more easy!
The best way to learn it is to read and browse others Kernel repos! You are always free to watch my JBX-Kernel Repo! Read the commit messages to see what this commit is for and look at the code-side changes! If you read carefully, and learn C at the same time, you will understand the commits, step by step.
Let me give you some more hints:
Set you some smaller goals and start to reach them one by one! Don't set yourself too high goals, otherwise you will make yourself too much pressure!
Small steps are the way to your success!
Some of you might only want to make some minor changes, such like adding new governors, etc. Therefor you can i.e. use google to find related commits. So open Google and type:
Code:
github kernel omap add governor
We hope that google will show us some repos where the dev(s) wrote commit messages like "Added XXX governor", etc, etc..
In this example Google will put out this:
https://www.google.com/search?q=github+kernel+omap+add+governor
If you click the link you will find the very first result, which leads us to:
https://github.com/broodplank/glass-omap-xrr02
There click on Commits and you will see a commit "Add SmartassV2 governor". Now open this commit, you will find this:
https://github.com/broodplank/glass-omap-xrr02/commit/f959e0e8c16412319e991b26aaa50d8fe3555a4e
There you can see now the FULL commit with all its details! It shows you exactly how to add a governor! The green parts are ALWAYS insertions on Github, while red parts are deletions! SO you can see exactly:
1. WHICH files have been changed
2. WHAT has been changed in these files
3. WHERE in the files were the changes made
4. HOW were these changes performed
Now, if you study this commit for a while, you might know what has to be done in order to add a new governor!
NOTE: The very long files which are COMPLETELY green are NEW FILES!
Let's say you want to take this SMartassV2 governor into your kernel:
You can do it with different ways.
1. Cherry-Pick
For this weay you have to add the "glass-omap-xrr02" repo as remote to your repo. So you get the clone URL and use the git remote command (in your kernel root dir with terminal):
Code:
git remote remove upstream
git remote add upstream https://github.com/broodplank/glass-omap-xrr02.git
Now we must fetch the repos content:
Code:
git fetch upstream
Wait until the fetching process is finished.
Now we need the SHA1 sum of the commits. You go to your browser and look at the commit. The SHA1 is a very large number you can find at the upper right.
In this case this is the SHA1 for the commit "add SmartassV2 governor":
Code:
f959e0e8c16412319e991b26aaa50d8fe3555a4e
So, we need to cherry-pick this commit by typing in the terminal:
Code:
git cherry-pick f959e0e8c16412319e991b26aaa50d8fe3555a4e
Now there are three possibilites! If you see a message about "...conflicts" then it didn't work correctly because your local kernel source files might be a little bit different than those from the remote repo. In this case you open these files with a text editor (gedit) and find the lines with the errors, they are looking like this:
Code:
<<<<< HEAD
..some code...
>>>>>> Add SmartassV2 governor
Compare the files to those in the remote commit in your browser qand correct the issues or just this:
Code:
git cherry-pick --abort
This reverts your cherry-pick and your files are clean and like they were before the cherry-pick!
YOu can add the governor manually by simply looking the remote commit in the browser and copy the green stuff into your local files. Make sure you insert the codes in the right places!!! When you copy it from the green parts you will have to remove EVERY SINGLE "+" at the beginninf of each line!
There is another view in github for files, called "RAW". This will shows the pure file - but also without green/red marks! But in case you add the SMartassV2 governor, you can just search for the keyword "smartass" in the raw view of the file and then copy all lines which are including "msartass" into your local files
The governor itself is a complete new file, so you canswitch to the raw view, right click --> select all --> copy. Then create as new file in the right location (/kernel_source_dir/drivers/cpufreq/cpufreq.c) with the same name like in the commit (cpufreq_smartassv2.c) and paste the whole code into it, save and close.
Don't forget the rest of the code in the other files!!
At last you have to insert the new governor into your kernel configuration! The kernel config is mostly a "defconfig" file!
ALl the related defconfigs we need are located in:
Code:
.../arch(arm/configs
The default defconfig for our RAZR is the:
Code:
mapphone_mmi_defconfig
The defconfig file inlcudedes everything which is built into the kernel later. If you search for keyword "GOV" you will see the other governos, like Hotplug, etc.. YOu can see how they are used in the defconfig file, so add your new governor the same way. This should be:
Code:
CONFIG_CPU_FREQ_GOV_SMARTASS2=y
# CPU_FREQ_DEFAULT_GOV_SMARTASS2 is not set
*The second line is for setting it as default governor.
Thats was it! Now make sure everything was done the right way, save and close all files. In terminal type:
Code:
git status
This shows you info about the current status. In this case it will show you the changed files and the new file(s) in red color.
Now you have to stage your commit:
Code:
git add .
Adds all new/changed/untracked files to the commit, then:
Code:
git commit -m "Added Smartassv2 governor"
Done! Your new commit is staged to the index and can be uploaded! (Uploading is not part of this at the moment! If you want to learn more about git, use Google)
Now repeat the compile process like you did already! See if your new governor is included and working.
For further learning it's a good way to proceed with learning C and read, compare and understand commits from other devs/repos.
Ok, guys! I hope you enjoy the guide and it's helpful for you! I will extend/fix/correct this time by time... for now I'm done!
5. GIT COMMANDS
Here are some basics about using git by Terminal:
git branch -D BRANCH_NAME - Delete a branch
git branch -b BRANCH_NAME - create a new branch (but don't switch to it)
git checkout -b BRANCH_NAME - create & switch to a new branch
git checkout BRANCH_NAME - switch to a exisitng branch
git push origin BRANCH_NAME - upload your changes to your repo on Github (You have to be in that branch you are also uploading to!)
git remote update - checks for the latest changes in the original repo (that one where you took the source)
git pull - after you used "git remote update" use "git pull" to download the changes to your computer
git diff BRANCH_NAME - shows differences between the current branch and any branch
git add . - Adds all your changed files to the index (this is important to upload your changes)
git commit -m "this is my commit message" - USe this after "git add ." to append a message to your changes, so other devs can
see why you did it, etc..
git log - Shows the commit history (the history of changes in this repo) inlcuding the related SHA1 for each commit
git revert SHA1 - this reverts (undo) one spedific commit. The SHA1 sum can be found near the commit messages (whether you
can look the with your browser or by us ing "git log")
git remote remove upstream - Removes the current upstream repository
git remote add upstream <git URL> - Adds a new upstream, useful if you want to take over changes from another repos/devs
git fetch upstream - get the new remote repo's content
git cherry-pick SHA1 - this picks one single commit from your current upstream repo - or from another branch
git cherry-pick --abort - This aborts your curerent cherry-pick, useful if you run into conflicts
Click to expand...
Click to collapse
If you find any mistakes or somethings missing in your mind, PM me or post it here.
Please leave me some credits if this tutorial helped you wherever you provide your work! THX!
CREDITS
*Cyanogenmod - took some single infos from their website
How to build Cyanogenmod for Droid Razr (website):
http://wiki.cyanogenmod.org/w/Build_for_spyder
*Hashcode - for being always helpful and supportive and of course for his great work with dhacker
*Linux, Google, XDA-DEVELOPERS
-- reserved --
Another reserver
MINE
Great write-up @dtrail1,
And I completely agree. I'm always hoping for more devs to jump into kernel development to learn and have fun with their devices.
Deffinitely interested in this. Il be hitting this guide up soon as I pick a better internet provider for Repoing.
Saving your book
Sent from my XT910 using xda app-developers app
Thanks for the write up .
Sent from my XT912 using XDA Premium 4 mobile app
Thanks. Perfect for youngsters like me
Sent from my XT910 using Tapatalk 2
Corrected a typo where a .git extension was missing (and users might not be able to clone the repo without it)
umts_spyder
Thank you dtrail1 for the great guide.
as XT910 owner, i guess that everywhere I see spyder in the code, I should replace it with umts_spyder ?
tester5224 said:
Thank you dtrail1 for the great guide.
as XT910 owner, i guess that everywhere I see spyder in the code, I should replace it with umts_spyder ?
Click to expand...
Click to collapse
No, just use the SPYDER source - otherwise your kernel won't support LTE for the CDMA users. The LTE modules are only built with the SPYDER source, that's why we use it.
But you can repeat these steps with UMTS_SPYDER, it will only download the UMTS depencies then, so you are able to build CM10.2 for the XT910. For the kernel only use SPYDER source.
dtrail1 said:
No, just use the SPYDER source - otherwise your kernel won't support LTE for the CDMA users. The LTE modules are only built with the SPYDER source, that's why we use it.
But you can repeat these steps with UMTS_SPYDER, it will only download the UMTS depencies then, so you are able to build CM10.2 for the XT910. For the kernel only use SPYDER source.
Click to expand...
Click to collapse
So if I understood correctly, the GSM\UMTS and LTE\CDMA are using the same kernel in CM ?
thanks for the reply
tester5224 said:
So if I understood correctly, the GSM\UMTS and LTE\CDMA are using the same kernel in CM ?
thanks for the reply
Click to expand...
Click to collapse
If I understood it correctly in the normal cm there are two different kernels. One for gsm without LTE modules and one cdma with LTE modules. So in case want to build for both you need the cdma version as it has the LTE modules and so cdma users have LTE and as usually gsm users will have there normal network.
Sent from my XT910 using XDA Premium 4 mobile app
Para94 said:
If I understood it correctly in the normal cm there are two different kernels. One for gsm without LTE modules and one cdma with LTE modules. So in case want to build for both you need the cdma version as it has the LTE modules and so cdma users have LTE and as usually gsm users will have there normal network.
Sent from my XT910 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
No, the kernel has no differences! It's about the modules. The kernel is always the same but the mlodules are not. If you build the kernel with UMTS_SPYDER depencies you will get umts baseband modules only. But if you build it with the SPYDER source you will get a working modules for umts and cdma.
:good: got it, thanks
tester5224 said:
:good: got it, thanks
Click to expand...
Click to collapse
It's special for our device. Usually it's enough to build the kernel only w/o using the full 15GB rom sources. But since 4.2.2 some parts of the kernel source were moved into the android rom source (e.g. the PVR (SGX) Sources), so we have to use the full rom source to build a working kernel - otherwise your kernel will cause a black screen on boot.
@dtrail1 Question regarding the script you use to build the kernel.
Your script shows: make mrproper
When I run this command I receive an error message: make: *** No rule to make target 'mrproper'. Stop.
Do you have any advice on where I set the target?
Edit: After continuing with the remainder of the script the last error I receive is: make: *** Waiting for unfinished jobs....
This command is needed to clean out the source directories. The error message is normal, just don't care about.
The second error you wrote about sounds like you tried to build without defconfig.
Make sure you have all related "export" commands AFTER the mrproper/distclean commands.
If you did so, then the error is caused by something else. Please post me the full last few lines of your terminal output, then I can tell you more.
Gesendet von meinem XT910 mit Tapatalk 4
awesome guide brother. thank you. i ll give it a try today

[WIP] Compiling TWRP for WI502Q Wren device

Background:
Can't locate a TWRP image for WI502Q device
@T10NAZ has been helping in his TWRP for WI501Q thread. It seems more polite to separate this discussion from his TWRP release thread.
Goal:
Build a booting TWRP image for WI502Q device
I'll be posting step-by-step directions as I make progress and I'll also be posting questions!
Steps
Repo
1) Install repo (sudo apt-get install repo)
1a) repo init -u git://github.com/joeykrim/platform_manifest_twrp_omni_wren.git -b twrp-6.0
1b) repo sync
2) Clone device configuration and kernel files
2a) mkdir -p device/asus/wren (Inside omni directory cloned in 1b)
2b) cd device/asus/ && git clone https://github.com/joeykrim/wren
3) Setup AOSP to compile and Compile
3a) . build/envsetup.sh
3b) lunch omni_wren-eng
3c) mka recoveryimage OR make clean && mka -j9 recoveryimage
Sources:
Referencing Dees_Troy's guide for compiling TWRP: http://forum.xda-developers.com/showthread.php?p=32965365#post32965365
Sparrow Omni ROM/Recovery compile files: https://github.com/asyan4ik/sparrow
Compiling kernel: http://forum.xda-developers.com/android/software/ultimate-guide-compile-android-kernel-t2871276 & https://source.android.com/source/building-kernels.html & @T10NAZ who compiled the kernel and provided the binary
Dependencies (Not complete list):
My GitHub forks include minor changes in order to compile without errors: https://github.com/joeykrim/platform_manifest_twrp_omni_wren & https://github.com/joeykrim/wren
OmniROM requires OpenJDK 7: sudo apt-get install openjdk-7-jdk (Reference for install, replace version 8 with 7)
Unresolved Issues:
1) Requires pre-compiled or compiling kernel
1a) Unable to pull from device: /dev/block/platform/msm_sdcc.1/by-name/boot: Permission denied and /dev/block/mmcblk0p11: Permission denied
1b) ASUS Kernel source: https://www.asus.com/au/support/Download/42/1/0/3/y5tW5D4k3zKBVKf4/32/
Latest version at this time: ASUS ZenWatch2 (WI502Q) Kernel source code V5.20.0.111 (MEC23G)
Requires a prebuilt toolchain - AOSP recommends: git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
make wren_user_msm8226-perf_defconfig - results in many errors, as shown in the multiple posts below
@T10NAZ suggested using wren_defconfig instead of wren_user_msm8226-perf_defconfig, compiled a kernel and posted it: http://forum.xda-developers.com/showpost.php?p=65955638&postcount=13
2) Sparrow (BoardConfig.mk) calls for an older font file: font_7x16.h (bootable/recovery/minui.old/font_7x16.h). For now, disabled as compiling with it results in an error:
"In file included from bootable/recovery/minui/graphics.cpp:35:
bootable/recovery/minui/font_7x16.h:12:14: error: initialization of flexible array member is not allowed
.rundata = {
^"
u should post in the android dev or android orid dev section of the zenwatch 2 i think.
here in q&a it might get lost
just a friendly advice. i have a w501q. for mine there is T10NAZ's version which works perfectly if tethered (a flashable version would be nich to have )
4RK4N said:
u should post in the android dev or android orid dev section of the zenwatch 2 i think.
here in q&a it might get lost
just a friendly advice. i have a w501q. for mine there is T10NAZ's version which works perfectly if tethered (a flashable version would be nich to have )
Click to expand...
Click to collapse
im working on making it flashable
T10NAZ said:
I used this dev tree here so you can modify it to get twrp for the 502
or to practice by using the files available for the 501
all you need is the omni 6.0 source for twrp 3.0.0.0 and the latest kernel source and you are off to the races!
If you need help let me know
Click to expand...
Click to collapse
Summary
I have omni 6.0 source and using asyan4ik's device tree for sparrow, I have the sparrow TWRP recovery.img compiled in out/target/product/sparrow. The 501 device was a good starting point, thanks!
Now to 502, I'm unable to get a kernel binary to use in order to build TWRP. Any suggestions on how to either get the 502 kernel binary or get the 502 kernel source compiling?
Details:
1) I'm not able to get the kernel binary, which asyan4ik provided for the 501/sparrow device on the github repo. I tried but couldn't pull the kernel binary from the 502 device: /dev/block/platform/msm_sdcc.1/by-name/boot: Permission denied and /dev/block/mmcblk0p11: Permission denied
2) I do have the kernel source from ASUS's web site, but am seeing multiple errors when compiling with wren_user_msm8226-perf_defconfig or wren_userdebug_msm8226_defconfig.
Example of an error: "kernel/printk.c: In function ‘printk_buffer_rebase’:
kernel/printk.c:1022:38: error: ‘ASUS_SW_VER’ undeclared (first use in this function)
strncpy(asus_global.kernel_version, ASUS_SW_VER, sizeof(asus_global.kernel_version));
^
kernel/printk.c:1022:38: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:308: recipe for target 'kernel/printk.o' failed"
joeykrim said:
Summary
I have omni 6.0 source and using asyan4ik's device tree for sparrow, I have the sparrow TWRP recovery.img compiled in out/target/product/sparrow. The 501 device was a good starting point, thanks!
Now to 502, I'm unable to get a kernel binary to use in order to build TWRP. Any suggestions on how to either get the 502 kernel binary or get the 502 kernel source compiling?
Details:
1) I'm not able to get the kernel binary, which asyan4ik provided for the 501/sparrow device on the github repo. I tried but couldn't pull the kernel binary from the 502 device: /dev/block/platform/msm_sdcc.1/by-name/boot: Permission denied and /dev/block/mmcblk0p11: Permission denied
2) I do have the kernel source from ASUS's web site, but am seeing multiple errors when compiling with wren_user_msm8226-perf_defconfig or wren_userdebug_msm8226_defconfig.
Example of an error: "kernel/printk.c: In function ‘printk_buffer_rebase’:
kernel/printk.c:1022:38: error: ‘ASUS_SW_VER’ undeclared (first use in this function)
strncpy(asus_global.kernel_version, ASUS_SW_VER, sizeof(asus_global.kernel_version));
^
kernel/printk.c:1022:38: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:308: recipe for target 'kernel/printk.o' failed"
Click to expand...
Click to collapse
that error was the most annoying thing ever and i always had an issue with it.
download this Makefile and replace the one in the root of the kernel folder with that one, that will get rid of that error. You may run into more errors, and hopefully they are ones that i had problems with
T10NAZ said:
that error was the most annoying thing ever and i always had an issue with it.
download this Makefile and replace the one in the root of the kernel folder with that one, that will get rid of that error. You may run into more errors, and hopefully they are ones that i had problems with
Click to expand...
Click to collapse
Great, your Makefile cleared up the ASUS_SW_VER error!
Amazing they release kernel source that doesn't compile...
Next error...
1) TIF_MM_RELEASED undecleared
kernel/exit.c: In function ‘exit_mm’:
kernel/exit.c:510:28: error: ‘TIF_MM_RELEASED’ undeclared (first use in this function)
set_tsk_thread_flag(tsk, TIF_MM_RELEASED);
^
kernel/exit.c:510:28: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:308: recipe for target 'kernel/exit.o' failed
It does appear to be defined...
grep -irs TIF_MM_RELEASED *
arch/arm/include/asm/thread_info.h:#define TIF_MM_RELEASED 23 /* task MM has been released */
arch/arm64/include/asm/thread_info.h:#define TIF_MM_RELEASED 24
drivers/staging/android/lowmemorykiller.c: if (test_task_flag(tsk, TIF_MM_RELEASED))
kernel/exit.c: set_tsk_thread_flag(tsk, TIF_MM_RELEASED);
joeykrim said:
Great, your Makefile cleared up the ASUS_SW_VER error!
Amazing they release kernel source that doesn't compile...
Next error...
1) TIF_MM_RELEASED undecleared
kernel/exit.c: In function ‘exit_mm’:
kernel/exit.c:510:28: error: ‘TIF_MM_RELEASED’ undeclared (first use in this function)
set_tsk_thread_flag(tsk, TIF_MM_RELEASED);
Click to expand...
Click to collapse
Your grep maybe or maybe not shed light on the issue.
The first 2 are defined but not in the last 2, the last 2 are calling TIF_MM_RELEASED (at least that is my understanding) however it has a number after defining it
anyways travel to the folder kernel and open exit.c, and assuming you can see line numbers on your text editor, go to line 506, and that whole #ifndef config thing, maybe either do this:
Code:
#define TIF_MM_RELEASED 23
#ifndef CONFIG_UML
mm_released = mmput(mm);
if (mm_released)
set_tsk_thread_flag(tsk, TIF_MM_RELEASED);
#endif
or add the define TIF_MM under the config_UML.
Im almost thinking ASUS has some other things outside of the kernel source to allow it to build cleanly
T10NAZ said:
Your grep maybe or maybe not shed light on the issue.
The first 2 are defined but not in the last 2, the last 2 are calling TIF_MM_RELEASED (at least that is my understanding) however it has a number after defining it
anyways travel to the folder kernel and open exit.c, and assuming you can see line numbers on your text editor, go to line 506, and that whole #ifndef config thing, maybe either do this:
Code:
#define TIF_MM_RELEASED 23
#ifndef CONFIG_UML
mm_released = mmput(mm);
if (mm_released)
set_tsk_thread_flag(tsk, TIF_MM_RELEASED);
#endif
or add the define TIF_MM under the config_UML.
Im almost thinking ASUS has some other things outside of the kernel source to allow it to build cleanly
Click to expand...
Click to collapse
Defining it either before or inside of CONFIG_UML both worked to clear the error. Thanks!
Now two more errors:
kernel/asusdebug.c: In function 'proc_asusdebug_init':
kernel/asusdebug.c:1405:15: error: 'struct mutex' has no member named 'owner'
fake_mutex.owner = current;
^
kernel/asusdebug.c: At top level:
kernel/asusdebug.c:1418:15: error: expected declaration specifiers or '...' before string constant
EXPORT_COMPAT("qcom,asusdebug");
^
scripts/Makefile.build:308: recipe for target 'kernel/asusdebug.o' failed
joeykrim said:
Defining it either before or inside of CONFIG_UML both worked to clear the error. Thanks!
Now two more errors:
kernel/asusdebug.c: In function 'proc_asusdebug_init':
kernel/asusdebug.c:1405:15: error: 'struct mutex' has no member named 'owner'
fake_mutex.owner = current;
^
kernel/asusdebug.c: At top level:
kernel/asusdebug.c:1418:15: error: expected declaration specifiers or '...' before string constant
EXPORT_COMPAT("qcom,asusdebug");
^
scripts/Makefile.build:308: recipe for target 'kernel/asusdebug.o' failed
Click to expand...
Click to collapse
Whats weird is asusdebug.c is exactly the same on the 501 and 502,
this may be a dumb question but, are you make clean after every edit?
T10NAZ said:
Whats weird is asusdebug.c is exactly the same on the 501 and 502,
this may be a dumb question but, are you make clean after every edit?
Click to expand...
Click to collapse
Yes, I have been using make clean, but the system I'm using might be on newer versions that are causing issues (Ubuntu 16.04).
I'm assuming that since asusdebug.c is the same between devices, you didn't receive the same error?
I'm using the toolchain included with OmniROM: prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi- through export CROSS_COMPILE=/tmp/omni/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-
Downgraded gcc to 4.8 (/usr/bin/gcc -> /usr/bin/gcc-4.8)
Anything else I should check? Not sure if I should just grab Ubuntu 14.04, put it in a VM and start again from there...
joeykrim said:
Yes, I have been using make clean, but the system I'm using might be on newer versions that are causing issues (Ubuntu 16.04).
I'm assuming that since asusdebug.c is the same between devices, you didn't receive the same error?
I'm using the toolchain included with OmniROM: prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi- through export CROSS_COMPILE=/tmp/omni/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-
Downgraded gcc to 4.8 (/usr/bin/gcc -> /usr/bin/gcc-4.8)
Anything else I should check? Not sure if I should just grab Ubuntu 14.04, put it in a VM and start again from there...
Click to expand...
Click to collapse
only difference i have is i am running 15.10 with linaro 4.9.4 toolchain I wonder if itll get stuck on the same error if i take a crack at it
---------- Post added at 10:06 PM ---------- Previous post was at 09:41 PM ----------
So i tried it, I tar -xvf'd the source, added the path to the linaro chain, used my modified makefile for Sparrow, and typed make wren_defconfig (that might be highly unconventional) and make -j# ARCH=arm
I didnt hit the errors you had, but I ran into issues im more familiar with, starting with
Code:
In file included from drivers/devfreq/devfreq_trace.h:43:0,
from drivers/devfreq/devfreq_trace.c:20:
include/trace/define_trace.h:79:43: fatal error: ./devfreq_trace.h: No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
^
compilation terminated.
which you just copy devfreq_trace.h into include/trace
after that I got the next error I encountered for sparrow,
Code:
drivers/hwmon/qpnp-adc-common.c: In function ‘qpnp_adc_scale_batt_therm’:
drivers/hwmon/qpnp-adc-common.c:732:4: error: ‘adcmap_btm_threshold’ undeclared (first use in this function)
adcmap_btm_threshold,
^
drivers/hwmon/qpnp-adc-common.c:732:4: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/kref.h:18:0,
from include/linux/of.h:21,
from drivers/hwmon/qpnp-adc-common.c:16:
and that issue, it calls either Sparrow or Wren specific battery voltages in the qpnp-adc-common.c for whatever you are working on. But it doesnt do that!! All you do is find qpnp-adc-common-wren.h
and copy pasta this:
Code:
static const struct qpnp_vadc_map_pt adcmap_btm_threshold[] = {
{-300, 1538},
{-200, 1538},
{-100, 1384},
{-90, 1372},
{-80, 1360},
{-70, 1346},
{-60, 1335},
{-50, 1322},
{-40, 1308},
{-30, 1298},
{-20, 1282},
{-10, 1269},
{0, 1255},
{10, 1251},
{20, 1238},
{30, 1225},
{40, 1212},
{50, 1199},
{60, 1186},
{70, 1173},
{80, 1160},
{90, 1147},
{100, 1122},
{110, 1111},
{120, 1097},
{130, 1086},
{140, 1074},
{150, 1060},
{160, 1048},
{170, 1035},
{180, 1021},
{190, 1009},
{200, 998},
{210, 987},
{220, 977},
{230, 966},
{240, 952},
{250, 943},
{260, 932},
{270, 923},
{280, 911},
{290, 902},
{300, 891},
{310, 881},
{320, 871},
{330, 860},
{340, 849},
{350, 839},
{360, 832},
{370, 823},
{380, 813},
{390, 807},
{400, 801},
{410, 790},
{420, 779},
{430, 774},
{440, 769},
{450, 760},
{460, 750},
{470, 742},
{480, 738},
{490, 730},
{500, 721},
{510, 714},
{520, 713},
{530, 707},
{540, 701},
{550, 695},
{560, 689},
{570, 683},
{580, 677},
{590, 671},
{600, 665},
{610, 659},
{620, 653},
{630, 647},
{640, 641},
{650, 635},
{660, 629},
{670, 623},
{680, 617},
{690, 611},
{700, 496},
{710, 490},
{720, 484},
{730, 478},
{740, 472},
{750, 466},
{760, 460},
{770, 454},
{780, 448},
{790, 442}
};
right above static const struct qpnp_vadc_map_pt adcmap_qrd_btm_threshold[] = { at line 56
There are a few more errors that can be easily fixed after that, Im not sure if its your 16.04 or omni's toochain but so far im just running into fixable errors that got in the way on sparrow as well
*Update*
I ran into 3 more issues, they are just indicating exactly where files are by adding /home/user/kernel/etc/etc/etc to things that say they dont know where its at
and I got it to build
{
"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"
}
@joeykrim do you want the zimage that i created so you can mess with twrp for now? I will try and assist in any way i can to get you to build the kernel and twrp up for Wren users!
T10NAZ said:
only difference i have is i am running 15.10 with linaro 4.9.4 toolchain I wonder if itll get stuck on the same error if i take a crack at it
---------- Post added at 10:06 PM ---------- Previous post was at 09:41 PM ----------
So i tried it, I tar -xvf'd the source, added the path to the linaro chain, used my modified makefile for Sparrow, and typed make wren_defconfig (that might be highly unconventional) and make -j# ARCH=arm
I didnt hit the errors you had, but I ran into issues im more familiar with, starting with
Code:
In file included from drivers/devfreq/devfreq_trace.h:43:0,
from drivers/devfreq/devfreq_trace.c:20:
include/trace/define_trace.h:79:43: fatal error: ./devfreq_trace.h: No such file or directory
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
^
compilation terminated.
which you just copy devfreq_trace.h into include/trace
after that I got the next error I encountered for sparrow,
Code:
drivers/hwmon/qpnp-adc-common.c: In function ‘qpnp_adc_scale_batt_therm’:
drivers/hwmon/qpnp-adc-common.c:732:4: error: ‘adcmap_btm_threshold’ undeclared (first use in this function)
adcmap_btm_threshold,
^
drivers/hwmon/qpnp-adc-common.c:732:4: note: each undeclared identifier is reported only once for each function it appears in
In file included from include/linux/kref.h:18:0,
from include/linux/of.h:21,
from drivers/hwmon/qpnp-adc-common.c:16:
and that issue, it calls either Sparrow or Wren specific battery voltages in the qpnp-adc-common.c for whatever you are working on. But it doesnt do that!! All you do is find qpnp-adc-common-wren.h
and copy pasta this:
Code:
static const struct qpnp_vadc_map_pt adcmap_btm_threshold[] = {
{-300, 1538},
{-200, 1538},
{-100, 1384},
{-90, 1372},
{-80, 1360},
{-70, 1346},
{-60, 1335},
{-50, 1322},
{-40, 1308},
{-30, 1298},
{-20, 1282},
{-10, 1269},
{0, 1255},
{10, 1251},
{20, 1238},
{30, 1225},
{40, 1212},
{50, 1199},
{60, 1186},
{70, 1173},
{80, 1160},
{90, 1147},
{100, 1122},
{110, 1111},
{120, 1097},
{130, 1086},
{140, 1074},
{150, 1060},
{160, 1048},
{170, 1035},
{180, 1021},
{190, 1009},
{200, 998},
{210, 987},
{220, 977},
{230, 966},
{240, 952},
{250, 943},
{260, 932},
{270, 923},
{280, 911},
{290, 902},
{300, 891},
{310, 881},
{320, 871},
{330, 860},
{340, 849},
{350, 839},
{360, 832},
{370, 823},
{380, 813},
{390, 807},
{400, 801},
{410, 790},
{420, 779},
{430, 774},
{440, 769},
{450, 760},
{460, 750},
{470, 742},
{480, 738},
{490, 730},
{500, 721},
{510, 714},
{520, 713},
{530, 707},
{540, 701},
{550, 695},
{560, 689},
{570, 683},
{580, 677},
{590, 671},
{600, 665},
{610, 659},
{620, 653},
{630, 647},
{640, 641},
{650, 635},
{660, 629},
{670, 623},
{680, 617},
{690, 611},
{700, 496},
{710, 490},
{720, 484},
{730, 478},
{740, 472},
{750, 466},
{760, 460},
{770, 454},
{780, 448},
{790, 442}
};
right above static const struct qpnp_vadc_map_pt adcmap_qrd_btm_threshold[] = { at line 56
There are a few more errors that can be easily fixed after that, Im not sure if its your 16.04 or omni's toochain but so far im just running into fixable errors that got in the way on sparrow as well
*Update*
I ran into 3 more issues, they are just indicating exactly where files are by adding /home/user/kernel/etc/etc/etc to things that say they dont know where its at
Click to expand...
Click to collapse
Excellent! Yea, not sure whether it's the not-yet-final Ubuntu 16.04 release, OmniROM's toolchain, or some odd combination. If I try again, I'll do everything in a VM with a fresh and final Ubuntu image...
T10NAZ said:
and I got it to build
@joeykrim do you want the zimage that i created so you can mess with twrp for now?
Click to expand...
Click to collapse
Yes, please!
Once I have the kernel image, I can focus on tinkering with the sparrow build files to get wren compiling and working. Hopefully won't take too much effort and fastboot booting...
joeykrim said:
Excellent! Yea, not sure whether it's the not-yet-final Ubuntu 16.04 release, OmniROM's toolchain, or some odd combination. If I try again, I'll do everything in a VM with a fresh and final Ubuntu image...
Yes, please!
Once I have the kernel image, I can focus on tinkering with the sparrow build files to get wren compiling and working. Hopefully won't take too much effort and fastboot booting...
Click to expand...
Click to collapse
Alrighty, I added both zImage and zImage-dtb just in case, dtb is mainly what you will work with.
And for twrp 3.0.0.0, there are a bit of changes you need to do to Sparrows files. So we will both be helping each other out with getting it stable and working right for sparrow and wren .
https://drive.google.com/file/d/0B_Duyz8Shz-YbmZ2ZE82VUZSR2c/view?usp=sharing
T10NAZ said:
Alrighty, I added both zImage and zImage-dtb just in case, dtb is mainly what you will work with.
And for twrp 3.0.0.0, there are a bit of changes you need to do to Sparrows files. So we will both be helping each other out with getting it stable and working right for sparrow and wren .
https://drive.google.com/file/d/0B_Duyz8Shz-YbmZ2ZE82VUZSR2c/view?usp=sharing
Click to expand...
Click to collapse
Great! Using the kernel you supplied and the slightly modified Build files from: https://github.com/lj50036/platform_manifest_twrp_omni and I forked here: https://github.com/joeykrim/wren
I was able to get the recovery (TWRP-v3.0.0-0) to compile and boot. wren TWRP v3.0.0-0 recovery.img: https://joeykrim.com/android/devices/wren/twrp-v3.0.0-0.jk-v1.recovery.img
Updates now posted in the development thread: http://forum.xda-developers.com/zen...nt/recovery-twrp-3-0-0-0-wi502q-root-t3343366
Bugs (All Fixed):
1) Unable to backup recovery partition - isn't visible from backup menu
2) The screen resolution is small, but it works! Any suggestions on adjusting the screen resolution?
I'll probably start with BoardConfig.mk settings...
fb0 reports (possibly inaccurate):
vi.bits_per_pixel = 32
vi.red.offset = 0 .length = 8
vi.green.offset = 8 .length = 8
vi.blue.offset = 16 .length = 8
setting GGL_PIXEL_FORMAT_RGBA_8888
double buffered
framebuffer: 0 (280 x 280)
I:Checking resolution...
I:Scaling theme width 0.875000x and height 0.875000x, offsets x: 0 y: 0

Categories

Resources